Skip to content

Commit

Permalink
Introduction to Angular 8. (oppia#7027)
Browse files Browse the repository at this point in the history
* init

* Tries

* required appinit

* Fix some tests

* Fix some tests

* Fix last remaining e2e

* Merge

* fix failing tests

* fix failing tests

* restore karma

* multi karma tries

* revert multi karma tries

* Half way mod try

* email dashboard mod

* Tries

* Clean up and apply workaround

* Change name of the combine file

* Remove waitforangularenable statement

* Remove unwanted difs

* Added comments

* Review changes

* Remove unnecessary additions

* Review

* Remove extra require

* Remove unnecessary change

* Remove unnecessary change

* Review changes
  • Loading branch information
YashJipkate authored and seanlip committed Jun 28, 2019
1 parent a614c6b commit e1bb364
Show file tree
Hide file tree
Showing 726 changed files with 2,251 additions and 1,134 deletions.
5 changes: 4 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"sourceType": "module"
},
"extends": [
"eslint:recommended",
"eslint:recommended"
],
"plugins": [
"angular",
Expand Down
2 changes: 2 additions & 0 deletions core/templates/dev/head/App.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ require('app.constants.ts');
// loaded after app.constants.ts
require('I18nFooter.ts');

var oppia = require('AppInit.ts').module;

oppia.config([
'$compileProvider', '$cookiesProvider', '$httpProvider',
'$interpolateProvider', '$locationProvider',
Expand Down
30 changes: 29 additions & 1 deletion core/templates/dev/head/AppInit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,39 @@
* @fileoverview File for initializing the main oppia module.
*/

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { StaticProvider } from '@angular/core';

@NgModule({
imports: [
BrowserModule
]
})
class MainAngularModule {
// Empty placeholder method to satisfy the `Compiler`.
ngDoBootstrap() {}
}

import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { downgradeModule } from '@angular/upgrade/static';

const bootstrapFn = (extraProviders: StaticProvider[]) => {
const platformRef = platformBrowserDynamic(extraProviders);
return platformRef.bootstrapModule(MainAngularModule);
};
const downgradedModule = downgradeModule(bootstrapFn);

declare var angular: any;

var oppia = angular.module(
'oppia', [
'dndLists', 'headroom', 'infinite-scroll', 'ngAnimate',
'ngAudio', 'ngCookies', 'ngImgCrop', 'ngJoyRide', 'ngMaterial',
'ngResource', 'ngSanitize', 'ngTouch', 'pascalprecht.translate',
'toastr', 'ui.bootstrap', 'ui.sortable', 'ui.tree', 'ui.validate'
'toastr', 'ui.bootstrap', 'ui.sortable', 'ui.tree', 'ui.validate',
downgradedModule
].concat(
window.GLOBALS ? (window.GLOBALS.ADDITIONAL_ANGULAR_MODULES || []) : []));

exports.module = oppia;
2 changes: 2 additions & 0 deletions core/templates/dev/head/I18nFooter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
* @author milagro.teruel@gmail.com (Milagro Teruel)
*/

var oppia = require('AppInit.ts').module;

oppia.controller('I18nFooter', [
'$cookies', '$http', '$rootScope', '$scope', '$timeout', '$translate',
'UserService',
Expand Down
2 changes: 2 additions & 0 deletions core/templates/dev/head/app.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* @fileoverview Shared constants for the Oppia module.
*/

var oppia = require('AppInit.ts').module;

for (var constantName in constants) {
oppia.constant(constantName, constants[constantName]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ require('pages/OppiaFooterDirective.ts');

require('domain/utilities/UrlInterpolationService.ts');

var oppia = require('AppInit.ts').module;

oppia.directive('baseContent', [
'UrlInterpolationService',
function(UrlInterpolationService) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

require('domain/utilities/UrlInterpolationService.ts');

var oppia = require('AppInit.ts').module;

oppia.directive('warningLoader', [
'UrlInterpolationService',
function(UrlInterpolationService) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ require('services/contextual/UrlService.ts');
require('services/SiteAnalyticsService.ts');
require('services/UserService.ts');

var oppia = require('AppInit.ts').module;

oppia.directive('createActivityButton', [
'UrlInterpolationService', function(UrlInterpolationService) {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
require('domain/utilities/UrlInterpolationService.ts');
require('services/SiteAnalyticsService.ts');

var oppia = require('AppInit.ts').module;

oppia.factory('ExplorationEmbedButtonService', [
'$uibModal', 'SiteAnalyticsService', 'UrlInterpolationService',
function($uibModal, SiteAnalyticsService, UrlInterpolationService) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ require('services/contextual/DeviceInfoService.ts');

require('pages/exploration-player-page/exploration-player-page.constants.ts');

var oppia = require('AppInit.ts').module;

oppia.directive('hintAndSolutionButtons', [
'UrlInterpolationService', function(UrlInterpolationService) {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

require('domain/utilities/UrlInterpolationService.ts');

var oppia = require('AppInit.ts').module;

oppia.directive('socialButtons', [
'UrlInterpolationService', function(UrlInterpolationService) {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
require('services/ContextService.ts');
require('services/RteHelperService.ts');

var oppia = require('AppInit.ts').module;

oppia.directive('ckEditorRte', [
'ContextService', 'RteHelperService', 'PAGE_CONTEXT',
function(ContextService, RteHelperService, PAGE_CONTEXT) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ require('rich_text_components/richTextComponentsRequires.ts');
require('services/HtmlEscaperService.ts');
require('services/RteHelperService.ts');

var oppia = require('AppInit.ts').module;

oppia.run([
'$timeout', '$compile', '$rootScope', '$uibModal', 'RteHelperService',
'HtmlEscaperService',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

require('services/AlertsService.ts');

var oppia = require('AppInit.ts').module;

oppia.directive('alertMessage', [function() {
return {
restrict: 'E',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
require('domain/utilities/BrowserCheckerService.ts');
require('domain/utilities/UrlInterpolationService.ts');

var oppia = require('AppInit.ts').module;

oppia.directive('attributionGuide', [
'UrlInterpolationService', function(UrlInterpolationService) {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

require('domain/utilities/UrlInterpolationService.ts');

var oppia = require('AppInit.ts').module;

oppia.directive('backgroundBanner', [
'UrlInterpolationService', function(UrlInterpolationService) {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

require('domain/utilities/UrlInterpolationService.ts');

var oppia = require('AppInit.ts').module;

oppia.directive('loadingDots', [
'UrlInterpolationService', function(UrlInterpolationService) {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
require('domain/utilities/UrlInterpolationService.ts');
require('services/PromoBarService.ts');

var oppia = require('AppInit.ts').module;

oppia.directive('promoBar', [
'$window', 'PromoBarService', 'UrlInterpolationService',
function($window, PromoBarService, UrlInterpolationService) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ require('domain/utilities/UrlInterpolationService.ts');
require('services/HtmlEscaperService.ts');
require('services/SiteAnalyticsService.ts');

var oppia = require('AppInit.ts').module;

oppia.directive('sharingLinks', [
'UrlInterpolationService', function(UrlInterpolationService) {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

require('domain/utilities/UrlInterpolationService.ts');

var oppia = require('AppInit.ts').module;

oppia.directive('sideNavigationBar', [
'UrlInterpolationService', function(UrlInterpolationService) {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ require('services/UserService.ts');
require('services/contextual/DeviceInfoService.ts');
require('services/contextual/WindowDimensionsService.ts');

var oppia = require('AppInit.ts').module;

oppia.directive('topNavigationBar', [
'UrlInterpolationService', function(UrlInterpolationService) {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ require('services/SiteAnalyticsService.ts');
// duplicated code between CollectionCreationService and
// ExplorationCreationService.

var oppia = require('AppInit.ts').module;

oppia.factory('CollectionCreationService', [
'$http', '$rootScope', '$timeout', '$window', 'AlertsService',
'SiteAnalyticsService', 'UrlInterpolationService',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ require('domain/utilities/UrlInterpolationService.ts');
require('services/AlertsService.ts');
require('services/SiteAnalyticsService.ts');

var oppia = require('AppInit.ts').module;

oppia.factory('ExplorationCreationService', [
'$http', '$rootScope', '$timeout', '$uibModal', '$window',
'AlertsService', 'SiteAnalyticsService', 'UrlInterpolationService',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

require('domain/utilities/UrlInterpolationService.ts');

var oppia = require('AppInit.ts').module;

oppia.factory('QuestionCreationService', [
'$http', '$q', 'UrlInterpolationService',
function($http, $q, UrlInterpolationService) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
require('domain/utilities/UrlInterpolationService.ts');
require('services/AlertsService.ts');

var oppia = require('AppInit.ts').module;

oppia.factory('SkillCreationService', [
'$http', '$rootScope', '$timeout', '$window', 'AlertsService',
'UrlInterpolationService',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ require('domain/utilities/UrlInterpolationService.ts');
require('pages/topic-editor-page/services/topic-editor-state.service.ts');
require('services/AlertsService.ts');

var oppia = require('AppInit.ts').module;

oppia.factory('StoryCreationService', [
'$http', '$rootScope', '$timeout', '$uibModal', '$window', 'AlertsService',
'TopicEditorStateService', 'TopicUpdateService', 'UrlInterpolationService',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
require('domain/utilities/UrlInterpolationService.ts');
require('services/AlertsService.ts');

var oppia = require('AppInit.ts').module;

oppia.factory('TopicCreationService', [
'$http', '$rootScope', '$timeout', '$uibModal', '$window', 'AlertsService',
'UrlInterpolationService',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
require('filters/string-utility-filters/underscores-to-camel-case.filter.ts');

/* eslint-disable angular/directive-restrict */
var oppia = require('AppInit.ts').module;

oppia.directive('applyValidation', ['$filter', function($filter) {
return {
require: 'ngModel',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
require('domain/utilities/UrlInterpolationService.ts');
require('services/IdGenerationService.ts');

var oppia = require('AppInit.ts').module;

oppia.directive('audioFileUploader', [
'IdGenerationService', 'UrlInterpolationService',
function(IdGenerationService, UrlInterpolationService) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ require('domain/utilities/UrlInterpolationService.ts');
// Attribute 'val' is presented to the user. After user selection, the
// corresponding attribute 'id' is assigned to 'selection'

var oppia = require('AppInit.ts').module;

oppia.directive('htmlSelect', [
'UrlInterpolationService', function(UrlInterpolationService) {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
require('domain/utilities/UrlInterpolationService.ts');
require('services/IdGenerationService.ts');

var oppia = require('AppInit.ts').module;

oppia.directive('imageUploader', [
'IdGenerationService', 'UrlInterpolationService',
function(IdGenerationService, UrlInterpolationService) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

// Individual object editor directives are in extensions/objects/templates.

var oppia = require('AppInit.ts').module;

oppia.directive('objectEditor', ['$compile', '$log', function($compile, $log) {
return {
scope: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
require('components/forms/validators/is-float.filter.ts');

/* eslint-disable angular/directive-restrict */
var oppia = require('AppInit.ts').module;

oppia.directive('requireIsFloat', ['$filter', function($filter) {
return {
require: 'ngModel',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

require('domain/utilities/UrlInterpolationService.ts');

var oppia = require('AppInit.ts').module;

oppia.directive('select2Dropdown', [
'UrlInterpolationService', function(UrlInterpolationService) {
// Directive for incorporating select2 dropdowns.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* mark_all_audio_and_translations_as_needing_update modal.
*/

var oppia = require('AppInit.ts').module;

oppia.controller('MarkAllAudioAndTranslationsAsNeedingUpdateController', [
'$scope', '$uibModalInstance',
function($scope, $uibModalInstance) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

require('domain/utilities/UrlInterpolationService.ts');

var oppia = require('AppInit.ts').module;

oppia.directive('schemaBasedBoolEditor', [
'UrlInterpolationService',
function(UrlInterpolationService) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
require('domain/utilities/UrlInterpolationService.ts');
require('services/NestedDirectivesRecursionTimeoutPreventionService.ts');

var oppia = require('AppInit.ts').module;

oppia.directive('schemaBasedChoicesEditor', [
'NestedDirectivesRecursionTimeoutPreventionService',
'UrlInterpolationService',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
require('domain/utilities/UrlInterpolationService.ts');
require('services/NestedDirectivesRecursionTimeoutPreventionService.ts');

var oppia = require('AppInit.ts').module;

oppia.directive('schemaBasedCustomEditor', [
'NestedDirectivesRecursionTimeoutPreventionService',
'UrlInterpolationService',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ require('domain/utilities/UrlInterpolationService.ts');
require('services/IdGenerationService.ts');
require('services/NestedDirectivesRecursionTimeoutPreventionService.ts');

var oppia = require('AppInit.ts').module;

oppia.directive('schemaBasedDictEditor', [
'NestedDirectivesRecursionTimeoutPreventionService',
'UrlInterpolationService',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ require(

require('domain/utilities/UrlInterpolationService.ts');

var oppia = require('AppInit.ts').module;

oppia.directive('schemaBasedEditor', [
'UrlInterpolationService', function(UrlInterpolationService) {
return {
Expand Down
Loading

0 comments on commit e1bb364

Please sign in to comment.