From 392323400e5a606b810b8e41155c644cd7f862bb Mon Sep 17 00:00:00 2001 From: Yash Jipkate <34203227+YashJipkate@users.noreply.github.com> Date: Thu, 1 Aug 2019 14:39:00 +0530 Subject: [PATCH] Remove oppia module export. (#7259) * Half * half * half * Cleanup * Cleanup * Cleanup * Break line * Remove var oppia from App.ts * Removed var oppia * Removed var oppia * Partial lint * FIx FE * Partial lint * Partial lint * Partial lint * Partial lint * Fix learner dashboard * Partial lint * Lint * Address review * Update package.json * Update package.json * Revert "Update package.json" This reverts commit 0530a8c247ffea60bb7a73dd59748cf045e8b65a. * Revert "Update package.json" This reverts commit c18ff6a80126b2de594977d9203a09d6a477751b. * Revert "Address review" This reverts commit 333e7fa6c8683df19581eaa1b41df332aadd4cd0. * Revert package.json --- .eslintrc | 1 - core/templates/dev/head/App.ts | 12 +- core/templates/dev/head/AppInit.ts | 17 +- core/templates/dev/head/I18nFooter.ts | 13 +- core/templates/dev/head/app.constants.ts | 110 +- .../base_components/BaseContentDirective.ts | 4 +- .../base_components/WarningLoaderDirective.ts | 4 +- .../create-activity-button.directive.ts | 4 +- .../exploration-embed-button.service.ts | 4 +- .../hint-and-solution-buttons.directive.ts | 4 +- .../social-buttons.directive.ts | 4 +- .../ck-editor-4-rte.directive.ts | 4 +- .../ck-editor-4-widgets.initializer.ts | 8 +- .../alert-message.directive.ts | 4 +- .../attribution-guide.directive.ts | 4 +- .../background-banner.directive.ts | 4 +- .../common-elements/loading-dots.directive.ts | 4 +- .../common-elements/promo-bar.directive.ts | 4 +- .../sharing-links.directive.ts | 4 +- .../side-navigation-bar.directive.ts | 4 +- .../top-navigation-bar.directive.ts | 4 +- .../concept-card/concept-card.directive.ts | 4 +- .../collection-creation.service.ts | 4 +- .../exploration-creation.service.ts | 4 +- .../question-creation.service.ts | 8 +- .../skill-creation.service.ts | 4 +- .../story-creation.service.ts | 4 +- .../topic-creation.service.ts.ts | 4 +- .../apply-validation.directive.ts | 85 +- .../audio-file-uploader.directive.ts | 4 +- .../html-select.directive.ts | 4 +- .../image-uploader.directive.ts | 4 +- .../object-editor.directive.ts | 78 +- .../require-is-float.directive.ts | 33 +- .../select2-dropdown.directive.ts | 4 +- ...anslations-as-needing-update.controller.ts | 25 +- .../schema-based-bool-editor.directive.ts | 4 +- .../schema-based-choices-editor.directive.ts | 4 +- .../schema-based-custom-editor.directive.ts | 4 +- .../schema-based-dict-editor.directive.ts | 4 +- .../schema-based-editor.directive.ts | 4 +- ...chema-based-expression-editor.directive.ts | 4 +- .../schema-based-float-editor.directive.ts | 4 +- .../schema-based-html-editor.directive.ts | 4 +- .../schema-based-int-editor.directive.ts | 4 +- .../schema-based-list-editor.directive.ts | 4 +- .../schema-based-unicode-editor.directive.ts | 4 +- .../schema-based-custom-viewer.directive.ts | 4 +- .../schema-based-dict-viewer.directive.ts | 4 +- .../schema-based-html-viewer.directive.ts | 4 +- .../schema-based-list-viewer.directive.ts | 4 +- ...schema-based-primitive-viewer.directive.ts | 4 +- .../schema-based-unicode-viewer.directive.ts | 4 +- .../schema-based-viewer.directive.ts | 4 +- .../forms/validators/is-at-least.filter.ts | 4 +- .../forms/validators/is-at-most.filter.ts | 4 +- .../forms/validators/is-float.filter.ts | 4 +- .../forms/validators/is-integer.filter.ts | 4 +- .../forms/validators/is-nonempty.filter.ts | 4 +- .../graph-services/graph-layout.service.ts | 8 +- .../circular-image.directive.ts | 4 +- .../profile-link-image.directive.ts | 4 +- .../profile-link-text.directive.ts | 4 +- .../question-editor.directive.ts | 4 +- .../question-player.constants.ts | 14 +- .../question-player.directive.ts | 8 +- .../services/question-player-state.service.ts | 4 +- .../questions-list.constants.ts | 9 +- .../questions-list.directive.ts | 4 +- .../rating-computation.service.ts | 4 +- .../rating-display.directive.ts | 4 +- .../score-ring/score-ring.directive.ts | 4 +- .../answer-group-editor.directive.ts | 4 +- .../summary-list-header.directive.ts | 4 +- .../hint-editor/hint-editor.directive.ts | 4 +- .../outcome-destination-editor.directive.ts | 4 +- .../outcome-editor.directive.ts | 4 +- .../outcome-feedback-editor.directive.ts | 8 +- .../response-header.directive.ts | 4 +- .../rule-editor/rule-editor.directive.ts | 4 +- .../rule-type-selector.directive.ts | 4 +- .../solution-editor.directive.ts | 23 +- .../solution-explanation-editor.directive.ts | 8 +- .../state-content-editor.directive.ts | 4 +- .../state-content.service.ts | 4 +- .../state-customization-args.service.ts | 4 +- .../state-editor.service.ts | 4 +- .../state-hints.service.ts | 4 +- .../state-interaction-id.service.ts | 4 +- .../state-param-changes.service.ts | 4 +- .../state-property.service.ts | 8 +- .../state-recorded-voiceovers.service.ts | 4 +- .../state-solicit-answer-details.service.ts | 4 +- .../state-solution.service.ts | 4 +- .../state-written-translations.service.ts | 4 +- .../state-editor/state-editor.constants.ts | 5 +- .../state-editor/state-editor.directive.ts | 4 +- .../state-hints-editor.directive.ts | 4 +- .../state-interaction-editor.directive.ts | 4 +- .../state-responses.directive.ts | 4 +- .../state-solution-editor.directive.ts | 4 +- .../collection-summary-tile.constants.ts | 6 +- .../collection-summary-tile.directive.ts | 4 +- .../exploration-summary-tile.directive.ts | 4 +- .../story-summary-tile.directive.ts | 4 +- .../codemirror-mergeview.directive.ts | 4 +- .../version-diff-visualization.directive.ts | 4 +- .../directives/angular-html-bind.directive.ts | 41 +- .../dev/head/directives/focus-on.directive.ts | 4 +- .../head/directives/mathjax-bind.directive.ts | 4 +- ...AnswerClassificationResultObjectFactory.ts | 4 +- .../classifier/ClassifierObjectFactory.ts | 4 +- .../PredictionResultObjectFactory.ts | 4 +- .../collection/CollectionNodeObjectFactory.ts | 4 +- .../collection/CollectionObjectFactory.ts | 4 +- .../CollectionPlaythroughObjectFactory.ts | 4 +- .../CollectionRightsBackendApiService.ts | 8 +- .../CollectionRightsObjectFactory.ts | 4 +- .../collection/CollectionUpdateService.ts | 23 +- .../collection/CollectionValidationService.ts | 7 +- .../EditableCollectionBackendApiService.ts | 8 +- .../GuestCollectionProgressObjectFactory.ts | 4 +- .../GuestCollectionProgressService.ts | 4 +- .../ReadOnlyCollectionBackendApiService.ts | 8 +- .../SearchExplorationsBackendApiService.ts | 8 +- .../collection/collection-domain.constants.ts | 36 +- .../CreatorDashboardBackendApiService.ts | 4 +- .../domain/editor/editor-domain.constants.ts | 4 +- .../editor/undo_redo/BaseUndoRedoService.ts | 4 +- .../editor/undo_redo/ChangeObjectFactory.ts | 5 +- .../undo_redo/QuestionUndoRedoService.ts | 4 +- .../editor/undo_redo/UndoRedoService.ts | 4 +- .../exploration/AnswerGroupObjectFactory.ts | 4 +- .../exploration/AnswerStatsObjectFactory.ts | 4 +- .../EditableExplorationBackendApiService.ts | 6 +- .../ExplorationDraftObjectFactory.ts | 4 +- .../exploration/ExplorationObjectFactory.ts | 4 +- .../domain/exploration/HintObjectFactory.ts | 4 +- .../exploration/InteractionObjectFactory.ts | 4 +- .../exploration/OutcomeObjectFactory.ts | 4 +- .../exploration/ParamChangeObjectFactory.ts | 4 +- .../exploration/ParamChangesObjectFactory.ts | 4 +- .../exploration/ParamMetadataObjectFactory.ts | 4 +- .../exploration/ParamSpecObjectFactory.ts | 4 +- .../exploration/ParamSpecsObjectFactory.ts | 4 +- .../exploration/ParamTypeObjectFactory.ts | 4 +- .../ReadOnlyExplorationBackendApiService.ts | 4 +- .../RecordedVoiceoversObjectFactory.ts | 8 +- .../domain/exploration/RuleObjectFactory.ts | 4 +- .../exploration/SolutionObjectFactory.ts | 4 +- .../domain/exploration/StatesObjectFactory.ts | 4 +- .../exploration/SubtitledHtmlObjectFactory.ts | 4 +- .../exploration/VoiceoverObjectFactory.ts | 4 +- .../WrittenTranslationObjectFactory.ts | 4 +- .../WrittenTranslationsObjectFactory.ts | 4 +- .../FeedbackMessageSummaryObjectFactory.ts | 4 +- .../FeedbackThreadObjectFactory.ts | 4 +- .../FeedbackThreadSummaryObjectFactory.ts | 4 +- ...earnerDashboardActivityIdsObjectFactory.ts | 4 +- .../LearnerDashboardBackendApiService.ts | 4 +- .../LearnerDashboardIconsDirective.ts | 4 +- .../LearnerDashboardIdsBackendApiService.ts | 4 +- .../LearnerPlaylistService.ts | 4 +- .../domain/objects/FractionObjectFactory.ts | 4 +- .../objects/NumberWithUnitsObjectFactory.ts | 4 +- .../head/domain/objects/UnitsObjectFactory.ts | 4 +- .../objects/objects-domain.constants.ts | 8 +- .../EditableQuestionBackendApiService.ts | 4 +- .../PretestQuestionBackendApiService.ts | 4 +- .../question/QuestionBackendApiService.ts | 4 +- .../domain/question/QuestionObjectFactory.ts | 4 +- .../domain/question/QuestionUpdateService.ts | 8 +- .../question/question-domain.constants.ts | 23 +- .../domain/sidebar/SidebarStatusService.ts | 4 +- .../skill/ConceptCardBackendApiService.ts | 4 +- .../domain/skill/ConceptCardObjectFactory.ts | 4 +- .../skill/EditableSkillBackendApiService.ts | 4 +- .../skill/MisconceptionObjectFactory.ts | 4 +- .../skill/SkillDifficultyObjectFactory.ts | 4 +- .../head/domain/skill/SkillObjectFactory.ts | 4 +- .../skill/SkillRightsBackendApiService.ts | 4 +- .../domain/skill/SkillRightsObjectFactory.ts | 4 +- .../domain/skill/SkillSummaryObjectFactory.ts | 4 +- .../head/domain/skill/SkillUpdateService.ts | 12 +- .../domain/skill/skill-domain.constants.ts | 43 +- .../head/domain/state/StateObjectFactory.ts | 4 +- .../state_card/StateCardObjectFactory.ts | 8 +- .../FeedbackImprovementCardObjectFactory.ts | 4 +- .../ImprovementActionButtonObjectFactory.ts | 4 +- .../statistics/LearnerActionObjectFactory.ts | 4 +- .../LearnerAnswerDetailsBackendApiService.ts | 4 +- .../LearnerAnswerInfoObjectFactory.ts | 4 +- ...PlaythroughImprovementCardObjectFactory.ts | 4 +- .../PlaythroughIssueObjectFactory.ts | 4 +- .../statistics/PlaythroughObjectFactory.ts | 4 +- .../SuggestionImprovementCardObjectFactory.ts | 4 +- .../statistics/statistics-domain.constants.ts | 14 +- .../story/EditableStoryBackendApiService.ts | 4 +- .../story/StoryContentsObjectFactory.ts | 4 +- .../domain/story/StoryNodeObjectFactory.ts | 4 +- .../head/domain/story/StoryObjectFactory.ts | 6 +- .../head/domain/story/StoryUpdateService.ts | 4 +- .../domain/story/story-domain.constants.ts | 43 +- .../ReadOnlyStoryNodeObjectFactory.ts | 4 +- .../StoryPlaythroughObjectFactory.ts | 4 +- .../StoryViewerBackendApiService.ts | 4 +- .../story-viewer-domain.constants.ts | 6 +- .../suggestion/SuggestionObjectFactory.ts | 4 +- .../SuggestionThreadObjectFactory.ts | 4 +- .../ExplorationSummaryBackendApiService.ts | 4 +- .../topic/EditableTopicBackendApiService.ts | 8 +- .../domain/topic/SubtopicObjectFactory.ts | 6 +- .../SubtopicPageContentsObjectFactory.ts | 4 +- .../domain/topic/SubtopicPageObjectFactory.ts | 4 +- .../head/domain/topic/TopicObjectFactory.ts | 4 +- .../topic/TopicRightsBackendApiService.ts | 12 +- .../domain/topic/TopicRightsObjectFactory.ts | 4 +- .../head/domain/topic/TopicUpdateService.ts | 4 +- .../domain/topic/topic-domain.constants.ts | 51 +- .../TopicViewerBackendApiService.ts | 4 +- .../topic-viewer-domain.constants.ts | 4 +- ...picsAndSkillsDashboardBackendApiService.ts | 4 +- ...s-and-skills-dashboard-domain.constants.ts | 4 +- .../head/domain/user/UserInfoObjectFactory.ts | 4 +- .../utilities/AudioFileObjectFactory.ts | 4 +- .../utilities/AudioLanguageObjectFactory.ts | 4 +- ...AutogeneratedAudioLanguageObjectFactory.ts | 4 +- .../domain/utilities/BrowserCheckerService.ts | 4 +- .../FileDownloadRequestObjectFactory.ts | 4 +- .../utilities/ImageFileObjectFactory.ts | 4 +- .../domain/utilities/LanguageUtilService.ts | 4 +- .../utilities/StopwatchObjectFactory.ts | 53 +- .../utilities/UrlInterpolationService.ts | 12 +- .../expressions/ExpressionEvaluatorService.ts | 8 +- .../ExpressionInterpolationService.ts | 4 +- .../expressions/ExpressionParserService.js | 4 +- .../ExpressionSyntaxTreeService.ts | 8 +- .../ExpressionTypeParserService.ts | 8 +- .../filters/convert-html-to-unicode.filter.ts | 4 +- .../filters/convert-unicode-to-html.filter.ts | 4 +- ...vert-unicode-with-params-to-html.filter.ts | 139 ++- .../head/filters/format-rte-preview.filter.ts | 37 +- .../dev/head/filters/format-timer.filter.ts | 4 +- .../parameterize-rule-description.filter.ts | 4 +- .../remove-duplicates-in-array.filter.ts | 4 +- .../camel-case-to-hyphens.filter.ts | 4 +- .../capitalize.filter.ts | 4 +- .../convert-to-plain-text.filter.ts | 4 +- .../get-abbreviated-text.filter.ts | 4 +- ...-whitespace-punctuation-and-case.filter.ts | 65 +- .../normalize-whitespace.filter.ts | 29 +- .../replace-inputs-with-ellipses.filter.ts | 4 +- .../truncate-and-capitalize.filter.ts | 4 +- .../truncate-at-first-ellipsis.filter.ts | 4 +- .../truncate-at-first-line.filter.ts | 4 +- .../string-utility-filters/truncate.filter.ts | 4 +- .../underscores-to-camel-case.filter.ts | 4 +- .../wrap-text-with-ellipsis.filter.ts | 4 +- .../summarize-nonnegative-number.filter.ts | 4 +- ...based-on-interaction-answer-type.filter.ts | 4 +- core/templates/dev/head/pages/Base.ts | 4 +- .../dev/head/pages/OppiaFooterDirective.ts | 31 +- .../pages/about-page/about-page.controller.ts | 6 +- .../pages/about-page/about-page.module.ts | 77 ++ .../pages/about-page/about-page.scripts.ts | 4 +- ...admin-dev-mode-activities-tab.directive.ts | 4 +- ...dmin-prod-mode-activities-tab.directive.ts | 4 +- .../pages/admin-page/admin-page.constants.ts | 14 +- .../pages/admin-page/admin-page.directive.ts | 4 +- .../pages/admin-page/admin-page.scripts.ts | 1 + .../config-tab/admin-config-tab.directive.ts | 4 +- .../jobs-tab/admin-jobs-tab.directive.ts | 4 +- .../misc-tab/admin-misc-tab.directive.ts | 4 +- .../navbar/admin-navbar.directive.ts | 4 +- .../roles-tab/admin-roles-tab.directive.ts | 4 +- .../roles-tab/role-graph.directive.ts | 4 +- .../admin-page/services/admin-data.service.ts | 4 +- .../services/admin-router.service.ts | 4 +- .../services/admin-task-manager.service.ts | 4 +- .../collection-editor-page.constants.ts | 16 +- .../collection-editor-page.directive.ts | 4 +- .../collection-editor-page.scripts.ts | 1 + .../collection-editor-tab.directive.ts | 4 +- .../collection-node-creator.directive.ts | 4 +- .../collection-node-editor.directive.ts | 4 +- .../collection-history-tab.directive.ts | 4 +- ...tion-editor-navbar-breadcrumb.directive.ts | 4 +- .../collection-editor-navbar.directive.ts | 4 +- .../collection-editor-state.service.ts | 4 +- .../services/collection-linearizer.service.ts | 4 +- .../collection-details-editor.directive.ts | 4 +- .../collection-permissions-card.directive.ts | 4 +- .../collection-settings-tab.directive.ts | 4 +- .../collection-statistics-tab.directive.ts | 4 +- .../collection-footer.directive.ts | 4 +- .../collection-local-nav.directive.ts | 4 +- .../collection-navbar.directive.ts | 6 +- .../collection-node-list.directive.ts | 4 +- .../collection-player-page.directive.ts | 27 +- .../collection-player-page.scripts.ts | 1 + .../contact-page/contact-page.scripts.ts | 1 + .../creator-dashboard-page.constants.ts | 12 +- .../creator-dashboard-page.controller.ts | 646 +++++----- .../creator-dashboard-page.scripts.ts | 1 + ...ggestion-modal-for-creator-view.service.ts | 8 +- .../donate-page/donate-page.controller.ts | 85 +- .../pages/donate-page/donate-page.scripts.ts | 1 + .../email-dashboard-data.service.ts | 4 +- .../email-dashboard-page.controller.ts | 154 +-- .../email-dashboard-page.scripts.ts | 1 + .../email-dashboard-result.controller.ts | 4 +- .../email-dashboard-result.scripts.ts | 1 + .../error-pages/error-page.controller.ts | 46 +- .../pages/error-pages/error-page.scripts.ts | 1 + .../editor-navbar-breadcrumb.directive.ts | 4 +- .../editor-navigation.directive.ts | 4 +- .../exploration-editor-tab.directive.ts | 375 +++--- .../exploration-graph.directive.ts | 178 ++- .../state-graph-visualization.directive.ts | 4 +- .../services/answer-groups-cache.service.ts | 4 +- .../interaction-details-cache.service.ts | 4 +- .../editor-tab/services/responses.service.ts | 8 +- .../services/solution-validity.service.ts | 4 +- .../services/solution-verification.service.ts | 4 +- .../state-name-editor.directive.ts | 4 +- .../state-param-changes-editor.directive.ts | 4 +- .../test-interaction-panel.directive.ts | 4 +- .../training-data-editor-panel.service.ts | 4 +- .../training-panel/training-data.service.ts | 12 +- .../training-panel/training-modal.service.ts | 4 +- .../training-panel.directive.ts | 4 +- .../unresolved-answers-overview.directive.ts | 4 +- .../exploration-editor-page.constants.ts | 34 +- .../exploration-editor-page.controller.ts | 919 +++++++-------- .../exploration-editor-page.scripts.ts | 1 + .../exploration-objective-editor.directive.ts | 4 +- ...tion-save-and-publish-buttons.directive.ts | 4 +- .../exploration-title-editor.directive.ts | 4 +- .../feedback-tab/feedback-tab.directive.ts | 359 +++--- .../services/thread-data.service.ts | 4 +- .../services/thread-status-display.service.ts | 4 +- .../thread-table/thread-table.directive.ts | 4 +- .../history-tab/history-tab.directive.ts | 557 ++++----- .../services/compare-versions.service.ts | 12 +- .../services/version-tree.service.ts | 5 +- .../feedback-improvement-card.directive.ts | 4 +- .../improvements-tab.directive.ts | 4 +- .../playthrough-improvement-card.directive.ts | 4 +- .../services/improvement-modal.service.ts | 4 +- .../suggestion-improvement-card.directive.ts | 4 +- .../param-changes-editor.directive.ts | 4 +- .../value-generator-editor.directive.ts | 71 +- .../preview-tab/preview-tab.directive.ts | 303 +++-- .../services/angular-name.service.ts | 5 +- .../services/autosave-info-modals.service.ts | 4 +- .../services/change-list.service.ts | 4 +- .../changes-in-human-readable-form.service.ts | 4 +- .../editor-first-time-events.service.ts | 4 +- ...ration-automatic-text-to-speech.service.ts | 4 +- .../services/exploration-category.service.ts | 4 +- ...xploration-correctness-feedback.service.ts | 4 +- .../services/exploration-data.service.ts | 4 +- .../services/exploration-diff.service.ts | 4 +- .../exploration-init-state-name.service.ts | 4 +- .../exploration-language-code.service.ts | 4 +- .../services/exploration-objective.service.ts | 4 +- .../exploration-param-changes.service.ts | 4 +- .../exploration-param-specs.service.ts | 4 +- .../services/exploration-property.service.ts | 4 +- .../services/exploration-rights.service.ts | 4 +- .../services/exploration-save.service.ts | 4 +- .../services/exploration-states.service.ts | 8 +- .../services/exploration-tags.service.ts | 4 +- .../services/exploration-title.service.ts | 4 +- .../services/exploration-warnings.service.ts | 16 +- .../services/graph-data.service.ts | 4 +- .../services/parameter-metadata.service.ts | 4 +- .../services/router.service.ts | 4 +- .../state-tutorial-first-time.service.ts | 4 +- .../user-email-preferences.service.ts | 8 +- .../settings-tab/settings-tab.directive.ts | 770 ++++++------ .../charts/bar-chart.directive.ts | 4 +- .../charts/pie-chart.directive.ts | 4 +- .../issues/answer-submit-action.directive.ts | 4 +- .../cyclic-transitions-issue.directive.ts | 4 +- .../issues/early-quit-issue.directive.ts | 4 +- .../multiple-incorrect-issue.directive.ts | 4 +- .../issues/playthrough-issues.directive.ts | 4 +- .../services/learner-action-render.service.ts | 12 +- .../state-improvement-suggestion.service.ts | 4 +- .../statistics-tab.directive.ts | 454 ++++--- ...on-modal-for-exploration-editor.service.ts | 4 +- .../audio-translation-bar.directive.ts | 4 +- .../services/translation-language.service.ts | 4 +- .../services/translation-status.service.ts | 4 +- ...anslation-tab-active-content-id.service.ts | 8 +- .../translation-tab-active-mode.service.ts | 4 +- .../services/voiceover-recording.service.ts | 6 +- .../state-translation-editor.directive.ts | 4 +- ...tate-translation-status-graph.directive.ts | 4 +- .../state-translation.directive.ts | 4 +- .../translation-tab.directive.ts | 4 +- .../translator-overview.directive.ts | 4 +- .../exploration-player-page.constants.ts | 45 +- .../exploration-player-page.controller.ts | 4 +- .../exploration-player-page.scripts.ts | 1 + .../layout-directives/audio-bar.directive.ts | 4 +- .../correctness-footer.directive.ts | 4 +- .../exploration-footer.directive.ts | 4 +- .../feedback-popup.directive.ts | 4 +- .../learner-local-nav.directive.ts | 197 ++-- .../learner-view-info.directive.ts | 251 ++-- .../progress-nav.directive.ts | 4 +- .../continue-button.directive.ts | 4 +- .../conversation-skin.directive.ts | 363 +++--- .../input-response-pair.directive.ts | 4 +- .../supplemental-card.directive.ts | 4 +- .../tutor-card.directive.ts | 48 +- .../services/answer-classification.service.ts | 4 +- .../services/audio-preloader.service.ts | 12 +- .../audio-translation-language.service.ts | 4 +- .../audio-translation-manager.service.ts | 4 +- .../services/current-interaction.service.ts | 4 +- .../services/exploration-engine.service.ts | 36 +- .../exploration-player-state.service.ts | 12 +- .../exploration-recommendations.service.ts | 4 +- ...ract-image-filenames-from-state.service.ts | 4 +- .../services/fatigue-detection.service.ts | 4 +- .../hint-and-solution-modal.service.ts | 4 +- .../hints-and-solution-manager.service.ts | 16 +- .../services/image-preloader.service.ts | 12 +- .../services/learner-params.service.ts | 4 +- .../services/learner-view-rating.service.ts | 4 +- .../services/number-attempts.service.ts | 4 +- ...er-correctness-feedback-enabled.service.ts | 4 +- .../services/player-position.service.ts | 4 +- .../services/player-transcript.service.ts | 6 +- .../prediction-algorithm-registry.service.ts | 4 +- .../question-player-engine.service.ts | 8 +- ...-exploration-confirmation-modal.service.ts | 117 +- .../state-classifier-mapping.service.ts | 4 +- .../services/stats-reporting.service.ts | 10 +- ...on-modal-for-exploration-player.service.ts | 4 +- .../get-started-page.scripts.ts | 1 + .../head/pages/interaction-specs.constants.ts | 5 +- .../stewards-landing-page.controller.ts | 245 ++-- .../stewards-landing-page.scripts.ts | 1 + .../topic-landing-page.constants.ts | 4 +- .../topic-landing-page.controller.ts | 174 ++- .../topic-landing-page.scripts.ts | 1 + .../learner-dashboard-page.constants.ts | 12 +- .../learner-dashboard-page.controller.ts | 1039 +++++++++-------- .../learner-dashboard-page.scripts.ts | 23 + ...ion-modal-for-learner-dashboard.service.ts | 8 +- .../library-footer.directive.ts | 40 +- .../library-page/library-page.constants.ts | 6 +- .../library-page/library-page.directive.ts | 4 +- .../library-page/library-page.scripts.ts | 1 + .../search-bar/search-bar.directive.ts | 4 +- .../activity-tiles-infinity-grid.directive.ts | 4 +- .../search-results.directive.ts | 6 +- .../maintenance-page.controller.ts | 6 +- .../maintenance-page.scripts.ts | 22 + .../moderator-page.controller.ts | 209 ++-- .../moderator-page/moderator-page.scripts.ts | 1 + ...notifications-dashboard-page.controller.ts | 4 +- .../notifications-dashboard-page.scripts.ts | 1 + .../practice-session-page.constants.ts | 10 +- .../practice-session-page.controller.ts | 154 +-- .../practice-session-page.scripts.ts | 1 + .../preferences-page.controller.ts | 443 ++++--- .../preferences-page.scripts.ts | 1 + ....controller.ts => privacy-page.scripts.ts} | 1 + .../profile-page-navbar.directive.ts | 6 +- .../profile-page/profile-page.controller.ts | 349 +++--- .../profile-page/profile-page.scripts.ts | 1 + .../review-test-engine.service.ts | 4 +- .../review-test-page.constants.ts | 11 +- .../review-test-page.directive.ts | 161 ++- .../review-test-page.scripts.ts | 1 + .../signup-page/signup-page.controller.ts | 397 ++++--- .../pages/signup-page/signup-page.scripts.ts | 1 + .../skill-concept-card-editor.directive.ts | 4 +- .../worked-example-editor.directive.ts | 4 +- .../skill-description-editor.directive.ts | 4 +- .../skill-editor-main-tab.directive.ts | 8 +- .../misconception-editor.directive.ts | 4 +- .../skill-misconceptions-editor.directive.ts | 4 +- ...kill-editor-navbar-breadcrumb.directive.ts | 4 +- .../navbar/skill-editor-navbar.directive.ts | 4 +- .../questions-tab/questions-tab.directive.ts | 4 +- .../services/skill-editor-routing.service.ts | 8 +- .../services/skill-editor-state.service.ts | 12 +- .../skill-editor-page.constants.ts | 10 +- .../skill-editor-page.controller.ts | 42 +- .../skill-editor-page.scripts.ts | 1 + .../splash-page/splash-page.controller.ts | 107 +- .../pages/splash-page/splash-page.scripts.ts | 1 + .../editor-tab/story-editor.directive.ts | 4 +- .../editor-tab/story-node-editor.directive.ts | 4 +- ...tory-editor-navbar-breadcrumb.directive.ts | 4 +- .../navbar/story-editor-navbar.directive.ts | 4 +- .../services/story-editor-state.service.ts | 4 +- .../story-editor-page.constants.ts | 10 +- .../story-editor-page.controller.ts | 121 +- .../story-editor-page.scripts.ts | 1 + .../story-viewer-chapters-list.directive.ts | 8 +- ...tory-viewer-navbar-breadcrumb.directive.ts | 4 +- .../story-viewer-page.directive.ts | 4 +- .../story-viewer-page.scripts.ts | 1 + .../pages/teach-page/teach-page.controller.ts | 121 +- .../pages/teach-page/teach-page.scripts.ts | 1 + ...ge.controller.ts => terms-page.scripts.ts} | 1 + .../thanks-page/thanks-page.controller.ts | 7 +- .../pages/thanks-page/thanks-page.scripts.ts | 23 + .../editor-tab/stories-list.directive.ts | 4 +- .../editor-tab/topic-editor-tab.directive.ts | 4 +- ...opic-editor-navbar-breadcrumb.directive.ts | 4 +- .../navbar/topic-editor-navbar.directive.ts | 4 +- .../questions-tab/questions-tab.directive.ts | 4 +- .../services/topic-editor-routing.service.ts | 8 +- .../services/topic-editor-state.service.ts | 14 +- .../subtopics-list-tab.directive.ts | 4 +- .../topic-editor-page.constants.ts | 14 +- .../topic-editor-page.controller.ts | 61 +- .../topic-editor-page.scripts.ts | 1 + ...opic-viewer-navbar-breadcrumb.directive.ts | 4 +- .../practice-tab/practice-tab.directive.ts | 8 +- .../stories-list/stories-list.directive.ts | 4 +- .../topic-viewer-page.controller.ts | 91 +- .../topic-viewer-page.scripts.ts | 1 + ...s-dashboard-navbar-breadcrumb.directive.ts | 4 +- ...s-and-skills-dashboard-navbar.directive.ts | 4 +- .../skills-list/skills-list.directive.ts | 8 +- .../topic-selector.directive.ts | 4 +- ...ics-and-skills-dashboard-page.constants.ts | 8 +- ...cs-and-skills-dashboard-page.controller.ts | 4 +- ...opics-and-skills-dashboard-page.scripts.ts | 1 + .../topics-list/topics-list.directive.ts | 4 +- .../dev/head/services/AlertsService.ts | 4 +- .../head/services/AssetsBackendApiService.ts | 4 +- .../dev/head/services/AudioPlayerService.ts | 4 +- .../AutogeneratedAudioPlayerService.ts | 4 +- .../head/services/AutoplayedVideosService.ts | 4 +- .../head/services/CodeNormalizerService.ts | 4 +- .../dev/head/services/ComputeGraphService.ts | 6 +- .../ConstructTranslationIdsService.ts | 4 +- .../dev/head/services/ContextService.ts | 4 +- .../dev/head/services/CsrfTokenService.ts | 4 +- .../head/services/DateTimeFormatService.ts | 65 +- .../dev/head/services/DebouncerService.ts | 4 +- .../dev/head/services/EditabilityService.ts | 5 +- .../ExplorationFeaturesBackendApiService.ts | 4 +- .../services/ExplorationFeaturesService.ts | 4 +- .../ExplorationHtmlFormatterService.ts | 8 +- .../services/ExtensionTagAssemblerService.ts | 4 +- .../head/services/GenerateContentIdService.ts | 4 +- .../dev/head/services/HtmlEscaperService.ts | 4 +- .../dev/head/services/IdGenerationService.ts | 4 +- .../head/services/ImprovementCardService.ts | 4 +- .../dev/head/services/ImprovementsService.ts | 5 +- .../dev/head/services/LocalStorageService.ts | 4 +- .../dev/head/services/MessengerService.ts | 266 ++--- .../dev/head/services/NavigationService.ts | 4 +- ...ctivesRecursionTimeoutPreventionService.ts | 82 +- .../dev/head/services/PageTitleService.ts | 5 +- .../PlaythroughIssuesBackendApiService.ts | 4 +- .../head/services/PlaythroughIssuesService.ts | 4 +- .../dev/head/services/PlaythroughService.ts | 8 +- .../dev/head/services/PromoBarService.ts | 4 +- .../dev/head/services/QuestionsListService.ts | 4 +- .../dev/head/services/RteHelperService.ts | 12 +- .../services/SchemaDefaultValueService.ts | 4 +- .../SchemaUndefinedLastElementService.ts | 4 +- .../dev/head/services/SearchService.ts | 4 +- .../dev/head/services/SiteAnalyticsService.ts | 376 +++--- .../services/SpeechSynthesisChunkerService.ts | 4 +- .../head/services/StateRulesStatsService.ts | 8 +- .../StateTopAnswersStatsBackendApiService.ts | 4 +- .../services/StateTopAnswersStatsService.ts | 8 +- .../head/services/SuggestionModalService.ts | 4 +- .../TranslationFileHashLoaderService.ts | 4 +- .../dev/head/services/UserService.ts | 4 +- .../dev/head/services/UtilsService.ts | 4 +- .../dev/head/services/ValidatorsService.ts | 4 +- .../services/contextual/DeviceInfoService.ts | 41 +- .../head/services/contextual/UrlService.ts | 4 +- .../contextual/WindowDimensionsService.ts | 45 +- .../dev/head/services/services.constants.ts | 34 +- .../stateful/BackgroundMaskService.ts | 4 +- .../services/stateful/FocusManagerService.ts | 4 +- .../dev/head/tests/FormBuilderTestPage.ts | 4 +- .../dev/head/tests/FormOverlayDirective.ts | 4 +- .../build_sources/templates/pages/Base.ts | 2 +- core/tests/karma.conf.ts | 1 + .../classifiers/CountVectorizerService.ts | 4 +- .../classifiers/PythonProgramTokenizer.ts | 4 +- .../classifiers/SVMPredictionService.ts | 4 +- extensions/classifiers/TextInputTokenizer.ts | 4 +- .../WinnowingPreprocessingService.ts | 4 +- .../classifiers-extension.constants.ts | 4 +- .../CodeRepl/CodeReplPredictionService.ts | 4 +- .../directives/CodeReplRulesService.ts | 4 +- .../directives/CodeReplValidationService.ts | 4 +- .../OppiaInteractiveCodeReplDirective.ts | 4 +- .../OppiaResponseCodeReplDirective.ts | 4 +- .../OppiaShortResponseCodeReplDirective.ts | 4 +- .../directives/ContinueRulesService.ts | 4 +- .../directives/ContinueValidationService.ts | 4 +- .../OppiaInteractiveContinueDirective.ts | 4 +- .../OppiaResponseContinueDirective.ts | 4 +- .../OppiaShortResponseContinueDirective.ts | 4 +- .../DragAndDropSortInputRulesService.ts | 116 +- .../DragAndDropSortInputValidationService.ts | 4 +- ...nteractiveDragAndDropSortInputDirective.ts | 4 +- ...iaResponseDragAndDropSortInputDirective.ts | 4 +- ...rtResponseDragAndDropSortInputDirective.ts | 4 +- .../directives/EndExplorationRulesService.ts | 4 +- .../EndExplorationValidationService.ts | 4 +- ...OppiaInteractiveEndExplorationDirective.ts | 4 +- .../OppiaResponseEndExplorationDirective.ts | 4 +- ...piaShortResponseEndExplorationDirective.ts | 23 +- .../directives/FractionInputRulesService.ts | 4 +- .../FractionInputValidationService.ts | 4 +- .../OppiaInteractiveFractionInputDirective.ts | 4 +- .../OppiaResponseFractionInputDirective.ts | 4 +- ...ppiaShortResponseFractionInputDirective.ts | 4 +- .../directives/GraphDetailService.ts | 5 +- .../directives/GraphInputRulesService.ts | 4 +- .../directives/GraphInputValidationService.ts | 4 +- .../directives/GraphUtilsService.ts | 5 +- .../directives/GraphVizDirective.ts | 4 +- .../OppiaInteractiveGraphInputDirective.ts | 8 +- .../OppiaResponseGraphInputDirective.ts | 4 +- .../OppiaShortResponseGraphInputDirective.ts | 4 +- .../directives/ImageClickInputRulesService.ts | 4 +- .../ImageClickInputValidationService.ts | 8 +- ...ppiaInteractiveImageClickInputDirective.ts | 8 +- .../OppiaResponseImageClickInputDirective.ts | 4 +- ...iaShortResponseImageClickInputDirective.ts | 4 +- .../directives/InteractiveMapRulesService.ts | 4 +- .../InteractiveMapValidationService.ts | 4 +- ...OppiaInteractiveInteractiveMapDirective.ts | 4 +- .../OppiaResponseInteractiveMapDirective.ts | 4 +- ...piaShortResponseInteractiveMapDirective.ts | 4 +- .../ItemSelectionInputRulesService.ts | 79 +- .../ItemSelectionInputValidationService.ts | 8 +- ...aInteractiveItemSelectionInputDirective.ts | 4 +- ...ppiaResponseItemSelectionInputDirective.ts | 4 +- ...hortResponseItemSelectionInputDirective.ts | 4 +- .../directives/LogicProofRulesService.ts | 4 +- .../directives/LogicProofValidationService.ts | 4 +- .../OppiaInteractiveLogicProofDirective.ts | 4 +- .../OppiaResponseLogicProofDirective.ts | 4 +- .../OppiaShortResponseLogicProofDirective.ts | 4 +- .../MathExpressionInputRulesService.ts | 4 +- .../MathExpressionInputValidationService.ts | 4 +- ...InteractiveMathExpressionInputDirective.ts | 8 +- ...piaResponseMathExpressionInputDirective.ts | 4 +- ...ortResponseMathExpressionInputDirective.ts | 4 +- .../MultipleChoiceInputRulesService.ts | 4 +- .../MultipleChoiceInputValidationService.ts | 4 +- ...InteractiveMultipleChoiceInputDirective.ts | 4 +- ...piaResponseMultipleChoiceInputDirective.ts | 4 +- ...ortResponseMultipleChoiceInputDirective.ts | 4 +- .../directives/MusicNotesInputRulesService.ts | 4 +- .../MusicNotesInputValidationService.ts | 4 +- .../directives/MusicPhrasePlayerService.ts | 69 +- ...ppiaInteractiveMusicNotesInputDirective.ts | 8 +- .../OppiaResponseMusicNotesInputDirective.ts | 4 +- ...iaShortResponseMusicNotesInputDirective.ts | 4 +- .../directives/NumberWithUnitsRulesService.ts | 8 +- .../NumberWithUnitsValidationService.ts | 4 +- ...ppiaInteractiveNumberWithUnitsDirective.ts | 8 +- .../OppiaResponseNumberWithUnitsDirective.ts | 4 +- ...iaShortResponseNumberWithUnitsDirective.ts | 4 +- .../directives/NumericInputRulesService.ts | 4 +- .../NumericInputValidationService.ts | 4 +- .../OppiaInteractiveNumericInputDirective.ts | 4 +- .../OppiaResponseNumericInputDirective.ts | 4 +- ...OppiaShortResponseNumericInputDirective.ts | 4 +- ...piaInteractivePencilCodeEditorDirective.ts | 4 +- .../OppiaResponsePencilCodeEditorDirective.ts | 4 +- ...aShortResponsePencilCodeEditorDirective.ts | 4 +- .../PencilCodeEditorRulesService.ts | 4 +- .../PencilCodeEditorValidationService.ts | 4 +- .../OppiaInteractiveSetInputDirective.ts | 4 +- .../OppiaResponseSetInputDirective.ts | 4 +- .../OppiaShortResponseSetInputDirective.ts | 4 +- .../directives/SetInputRulesService.ts | 4 +- .../directives/SetInputValidationService.ts | 4 +- .../TextInput/TextInputPredictionService.ts | 4 +- .../OppiaInteractiveTextInputDirective.ts | 4 +- .../OppiaResponseTextInputDirective.ts | 4 +- .../OppiaShortResponseTextInputDirective.ts | 4 +- .../directives/TextInputRulesService.ts | 103 +- .../directives/TextInputValidationService.ts | 4 +- .../baseInteractionValidationService.ts | 6 +- .../interactions-extension.constants.ts | 11 +- .../templates/BooleanEditorDirective.ts | 8 +- .../templates/CodeStringEditorDirective.ts | 8 +- .../templates/CoordTwoDimEditorDirective.ts | 8 +- .../DragAndDropHtmlStringEditorDirective.ts | 8 +- .../DragAndDropPositiveIntEditorDirective.ts | 8 +- .../templates/FilepathEditorDirective.ts | 12 +- .../templates/FractionEditorDirective.ts | 8 +- .../objects/templates/GraphEditorDirective.ts | 8 +- .../templates/GraphPropertyEditorDirective.ts | 8 +- .../objects/templates/HtmlEditorDirective.ts | 8 +- .../ImageWithRegionsEditorDirective.ts | 12 +- .../objects/templates/IntEditorDirective.ts | 8 +- .../ListOfSetsOfHtmlStringsEditorDirective.ts | 8 +- .../templates/ListOfTabsEditorDirective.ts | 8 +- .../ListOfUnicodeStringEditorDirective.ts | 8 +- .../LogicErrorCategoryEditorDirective.ts | 8 +- .../templates/LogicQuestionEditorDirective.ts | 8 +- .../MathLatexStringEditorDirective.ts | 8 +- .../templates/MusicPhraseEditorDirective.ts | 8 +- .../NonnegativeIntEditorDirective.ts | 8 +- .../NormalizedStringEditorDirective.ts | 8 +- .../NumberWithUnitsEditorDirective.ts | 8 +- .../templates/ParameterNameEditorDirective.ts | 8 +- .../objects/templates/RealEditorDirective.ts | 8 +- .../templates/SanitizedUrlEditorDirective.ts | 8 +- .../SetOfHtmlStringEditorDirective.ts | 8 +- .../SetOfUnicodeStringEditorDirective.ts | 8 +- .../templates/UnicodeStringEditorDirective.ts | 8 +- ...OppiaNoninteractiveCollapsibleDirective.ts | 8 +- .../OppiaNoninteractiveImageDirective.ts | 8 +- .../OppiaNoninteractiveLinkDirective.ts | 4 +- .../OppiaNoninteractiveMathDirective.ts | 4 +- .../OppiaNoninteractiveTabsDirective.ts | 4 +- .../OppiaNoninteractiveVideoDirective.ts | 4 +- .../templates/CopierDirective.ts | 4 +- .../templates/RandomSelectorDirective.ts | 67 +- .../OppiaVisualizationBarChartDirective.ts | 4 +- ...zationEnumeratedFrequencyTableDirective.ts | 61 +- ...piaVisualizationFrequencyTableDirective.ts | 4 +- scripts/create_expression_parser.sh | 2 +- webpack.config.ts | 10 +- 740 files changed, 7204 insertions(+), 8302 deletions(-) create mode 100644 core/templates/dev/head/pages/about-page/about-page.module.ts create mode 100644 core/templates/dev/head/pages/learner-dashboard-page/learner-dashboard-page.scripts.ts create mode 100644 core/templates/dev/head/pages/maintenance-page/maintenance-page.scripts.ts rename core/templates/dev/head/pages/privacy-page/{privacy-page.controller.ts => privacy-page.scripts.ts} (97%) rename core/templates/dev/head/pages/terms-page/{terms-page.controller.ts => terms-page.scripts.ts} (97%) create mode 100644 core/templates/dev/head/pages/thanks-page/thanks-page.scripts.ts diff --git a/.eslintrc b/.eslintrc index e6a35c2ce3fb..198cc974a0e3 100644 --- a/.eslintrc +++ b/.eslintrc @@ -23,7 +23,6 @@ "error", "array", ], - "angular/di-order": "error", "angular/di-unused": "error", "angular/directive-restrict": [ "error", diff --git a/core/templates/dev/head/App.ts b/core/templates/dev/head/App.ts index a673126ab203..10fce7ce0958 100644 --- a/core/templates/dev/head/App.ts +++ b/core/templates/dev/head/App.ts @@ -69,9 +69,7 @@ require('app.constants.ts'); // loaded after app.constants.ts require('I18nFooter.ts'); -var oppia = require('AppInit.ts').module; - -oppia.config([ +angular.module('oppia').config([ '$compileProvider', '$cookiesProvider', '$httpProvider', '$interpolateProvider', '$locationProvider', function( @@ -148,7 +146,7 @@ oppia.config([ } ]); -oppia.config(['$provide', function($provide) { +angular.module('oppia').config(['$provide', function($provide) { $provide.decorator('$log', ['$delegate', 'DEV_MODE', function($delegate, DEV_MODE) { var _originalError = $delegate.error; @@ -172,7 +170,7 @@ oppia.config(['$provide', function($provide) { ]); }]); -oppia.config(['toastrConfig', function(toastrConfig) { +angular.module('oppia').config(['toastrConfig', function(toastrConfig) { angular.extend(toastrConfig, { allowHtml: false, iconClasses: { @@ -191,8 +189,8 @@ oppia.config(['toastrConfig', function(toastrConfig) { // Overwrite the built-in exceptionHandler service to log errors to the backend // (so that they can be fixed). -oppia.factory('$exceptionHandler', ['$log', 'CsrfTokenService', - function($log, CsrfTokenService) { +angular.module('oppia').factory('$exceptionHandler', [ + '$log', 'CsrfTokenService', function($log, CsrfTokenService) { var MIN_TIME_BETWEEN_ERRORS_MSEC = 5000; var timeOfLastPostedError = Date.now() - MIN_TIME_BETWEEN_ERRORS_MSEC; diff --git a/core/templates/dev/head/AppInit.ts b/core/templates/dev/head/AppInit.ts index c099ffd8e92f..56d2ab015d64 100644 --- a/core/templates/dev/head/AppInit.ts +++ b/core/templates/dev/head/AppInit.ts @@ -60,14 +60,13 @@ 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', - downgradedModule - ].concat( +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', + downgradedModule +].concat( window.GLOBALS ? (window.GLOBALS.ADDITIONAL_ANGULAR_MODULES || []) : [])) // This directive is the downgraded version of the Angular component to // bootstrap the Angular 8. @@ -76,5 +75,3 @@ var oppia = angular.module( downgradeComponent({ component: ServiceBootstrapComponent }) as angular.IDirectiveFactory); - -exports.module = oppia; diff --git a/core/templates/dev/head/I18nFooter.ts b/core/templates/dev/head/I18nFooter.ts index 89a01f7602bb..e6ba7370fcdf 100755 --- a/core/templates/dev/head/I18nFooter.ts +++ b/core/templates/dev/head/I18nFooter.ts @@ -18,14 +18,11 @@ * @author milagro.teruel@gmail.com (Milagro Teruel) */ -var oppia = require('AppInit.ts').module; +require('services/TranslationFileHashLoaderService.ts'); -oppia.controller('I18nFooter', [ - '$cookies', '$http', '$rootScope', '$scope', '$timeout', '$translate', - 'UserService', - function( - $cookies, $http, $rootScope, $scope, $timeout, $translate, - UserService) { +angular.module('oppia').controller('I18nFooter', [ + '$http', '$scope', '$timeout', '$translate', 'UserService', + function($http, $scope, $timeout, $translate, UserService) { // Changes the language of the translations. var preferencesDataUrl = '/preferenceshandler/data'; var siteLanguageUrl = '/save_site_language'; @@ -55,7 +52,7 @@ oppia.controller('I18nFooter', [ } ]); -oppia.config([ +angular.module('oppia').config([ '$translateProvider', 'DEFAULT_TRANSLATIONS', function($translateProvider, DEFAULT_TRANSLATIONS) { var availableLanguageKeys = []; diff --git a/core/templates/dev/head/app.constants.ts b/core/templates/dev/head/app.constants.ts index 38efec231200..3e0ce98830b6 100644 --- a/core/templates/dev/head/app.constants.ts +++ b/core/templates/dev/head/app.constants.ts @@ -16,17 +16,15 @@ * @fileoverview Shared constants for the Oppia module. */ -var oppia = require('AppInit.ts').module; - for (var constantName in constants) { - oppia.constant(constantName, constants[constantName]); + angular.module('oppia').constant(constantName, constants[constantName]); } // Translations of strings that are loaded in the front page. They are listed // here to be loaded synchronously with the script to prevent a FOUC or // Flash of Untranslated Content. // See http://angular-translate.github.io/docs/#/guide/12_asynchronous-loading -oppia.constant('DEFAULT_TRANSLATIONS', { +angular.module('oppia').constant('DEFAULT_TRANSLATIONS', { I18N_LIBRARY_PAGE_TITLE: 'Library', I18N_LIBRARY_LOADING: 'Loading', I18N_SIGNUP_PAGE_SUBTITLE: 'Registration', @@ -41,38 +39,40 @@ oppia.constant('DEFAULT_TRANSLATIONS', { I18N_SIGNUP_LOADING: 'Loading' }); -oppia.constant('RULE_SUMMARY_WRAP_CHARACTER_COUNT', 30); +angular.module('oppia').constant('RULE_SUMMARY_WRAP_CHARACTER_COUNT', 30); -oppia.constant( +angular.module('oppia').constant( 'FEEDBACK_SUBJECT_MAX_CHAR_LIMIT', constants.FEEDBACK_SUBJECT_MAX_CHAR_LIMIT); /* Called always when learner moves to a new card. Also called when card is selected by clicking on progress dots */ -oppia.constant('EVENT_ACTIVE_CARD_CHANGED', 'activeCardChanged'); +angular.module('oppia').constant( + 'EVENT_ACTIVE_CARD_CHANGED', 'activeCardChanged'); /* Called when the learner moves to a new card that they haven't seen before. */ -oppia.constant('EVENT_NEW_CARD_OPENED', 'newCardOpened'); -oppia.constant( +angular.module('oppia').constant('EVENT_NEW_CARD_OPENED', 'newCardOpened'); +angular.module('oppia').constant( 'EDITABLE_EXPLORATION_DATA_DRAFT_URL_TEMPLATE', '/createhandler/data/?apply_draft='); -oppia.constant( +angular.module('oppia').constant( 'EDITABLE_EXPLORATION_DATA_URL_TEMPLATE', '/createhandler/data/'); -oppia.constant( +angular.module('oppia').constant( 'EXPLORATION_DATA_URL_TEMPLATE', '/explorehandler/init/'); -oppia.constant( +angular.module('oppia').constant( 'EXPLORATION_VERSION_DATA_URL_TEMPLATE', '/explorehandler/init/?v='); -oppia.constant( +angular.module('oppia').constant( 'VOICEOVER_EXPLORATION_DATA_URL_TEMPLATE', '/createhandler/voiceover/'); /* New card is available but user hasn't gone to it yet (when oppia gives a feedback and waits for user to press 'continue'). Not called when a card is selected by clicking progress dots */ -oppia.constant('EVENT_NEW_CARD_AVAILABLE', 'newCardAvailable'); +angular.module('oppia').constant( + 'EVENT_NEW_CARD_AVAILABLE', 'newCardAvailable'); -oppia.constant('WARNING_TYPES', { +angular.module('oppia').constant('WARNING_TYPES', { // These must be fixed before the exploration can be saved. CRITICAL: 'critical', // These must be fixed before publishing an exploration to the public @@ -80,7 +80,7 @@ oppia.constant('WARNING_TYPES', { ERROR: 'error' }); -oppia.constant('STATE_ERROR_MESSAGES', { +angular.module('oppia').constant('STATE_ERROR_MESSAGES', { ADD_INTERACTION: 'Please add an interaction to this card.', STATE_UNREACHABLE: 'This card is unreachable.', UNABLE_TO_END_EXPLORATION: ( @@ -93,72 +93,82 @@ oppia.constant('STATE_ERROR_MESSAGES', { 'There is an answer among the top 10 which has no explicit feedback.') }); -oppia.constant( +angular.module('oppia').constant( 'EXPLORATION_SUMMARY_DATA_URL_TEMPLATE', '/explorationsummarieshandler/data'); -oppia.constant('EXPLORATION_AND_SKILL_ID_PATTERN', /^[a-zA-Z0-9_-]+$/); +angular.module('oppia').constant( + 'EXPLORATION_AND_SKILL_ID_PATTERN', /^[a-zA-Z0-9_-]+$/); // We use a slash because this character is forbidden in a state name. -oppia.constant('PLACEHOLDER_OUTCOME_DEST', '/'); -oppia.constant('INTERACTION_DISPLAY_MODE_INLINE', 'inline'); -oppia.constant('LOADING_INDICATOR_URL', '/activity/loadingIndicator.gif'); -oppia.constant('OBJECT_EDITOR_URL_PREFIX', '/object_editor_template/'); +angular.module('oppia').constant('PLACEHOLDER_OUTCOME_DEST', '/'); +angular.module('oppia').constant('INTERACTION_DISPLAY_MODE_INLINE', 'inline'); +angular.module('oppia').constant( + 'LOADING_INDICATOR_URL', '/activity/loadingIndicator.gif'); +angular.module('oppia').constant( + 'OBJECT_EDITOR_URL_PREFIX', '/object_editor_template/'); // Feature still in development. // NOTE TO DEVELOPERS: This should be synchronized with the value in feconf. -oppia.constant('ENABLE_ML_CLASSIFIERS', false); +angular.module('oppia').constant('ENABLE_ML_CLASSIFIERS', false); // Feature still in development. -oppia.constant('INFO_MESSAGE_SOLUTION_IS_INVALID_FOR_EXPLORATION', +angular.module('oppia').constant( + 'INFO_MESSAGE_SOLUTION_IS_INVALID_FOR_EXPLORATION', 'The current solution does not lead to another card.'); -oppia.constant('PARAMETER_TYPES', { +angular.module('oppia').constant('PARAMETER_TYPES', { REAL: 'Real', UNICODE_STRING: 'UnicodeString' }); // The maximum number of nodes to show in a row of the state graph. -oppia.constant('MAX_NODES_PER_ROW', 4); +angular.module('oppia').constant('MAX_NODES_PER_ROW', 4); // The following variable must be at least 3. It represents the maximum length, // in characters, for the name of each node label in the state graph. -oppia.constant('MAX_NODE_LABEL_LENGTH', 15); +angular.module('oppia').constant('MAX_NODE_LABEL_LENGTH', 15); // If an $http request fails with the following error codes, a warning is // displayed. -oppia.constant('FATAL_ERROR_CODES', [400, 401, 404, 500]); +angular.module('oppia').constant('FATAL_ERROR_CODES', [400, 401, 404, 500]); // Do not modify these, for backwards-compatibility reasons. -oppia.constant('COMPONENT_NAME_CONTENT', 'content'); -oppia.constant('COMPONENT_NAME_HINT', 'hint'); -oppia.constant('COMPONENT_NAME_SOLUTION', 'solution'); -oppia.constant('COMPONENT_NAME_FEEDBACK', 'feedback'); -oppia.constant('COMPONENT_NAME_EXPLANATION', 'explanation'); -oppia.constant('COMPONENT_NAME_WORKED_EXAMPLE', 'worked_example'); - -oppia.constant('ACTION_TYPE_EXPLORATION_START', 'ExplorationStart'); -oppia.constant('ACTION_TYPE_ANSWER_SUBMIT', 'AnswerSubmit'); -oppia.constant('ACTION_TYPE_EXPLORATION_QUIT', 'ExplorationQuit'); - -oppia.constant('ISSUE_TYPE_EARLY_QUIT', 'EarlyQuit'); -oppia.constant( +angular.module('oppia').constant('COMPONENT_NAME_CONTENT', 'content'); +angular.module('oppia').constant('COMPONENT_NAME_HINT', 'hint'); +angular.module('oppia').constant('COMPONENT_NAME_SOLUTION', 'solution'); +angular.module('oppia').constant('COMPONENT_NAME_FEEDBACK', 'feedback'); +angular.module('oppia').constant('COMPONENT_NAME_EXPLANATION', 'explanation'); +angular.module('oppia').constant( + 'COMPONENT_NAME_WORKED_EXAMPLE', 'worked_example'); + +angular.module('oppia').constant( + 'ACTION_TYPE_EXPLORATION_START', 'ExplorationStart'); +angular.module('oppia').constant('ACTION_TYPE_ANSWER_SUBMIT', 'AnswerSubmit'); +angular.module('oppia').constant( + 'ACTION_TYPE_EXPLORATION_QUIT', 'ExplorationQuit'); + +angular.module('oppia').constant('ISSUE_TYPE_EARLY_QUIT', 'EarlyQuit'); +angular.module('oppia').constant( 'ISSUE_TYPE_MULTIPLE_INCORRECT_SUBMISSIONS', 'MultipleIncorrectSubmissions'); -oppia.constant('ISSUE_TYPE_CYCLIC_STATE_TRANSITIONS', 'CyclicStateTransitions'); -oppia.constant('SITE_NAME', 'Oppia.org'); +angular.module('oppia').constant( + 'ISSUE_TYPE_CYCLIC_STATE_TRANSITIONS', 'CyclicStateTransitions'); +angular.module('oppia').constant('SITE_NAME', 'Oppia.org'); -oppia.constant('DEFAULT_PROFILE_IMAGE_PATH', '/avatar/user_blue_72px.png'); +angular.module('oppia').constant( + 'DEFAULT_PROFILE_IMAGE_PATH', '/avatar/user_blue_72px.png'); -oppia.constant('LOGOUT_URL', '/logout'); +angular.module('oppia').constant('LOGOUT_URL', '/logout'); -oppia.constant( +angular.module('oppia').constant( 'EVENT_QUESTION_SUMMARIES_INITIALIZED', 'questionSummariesInitialized'); // TODO(vojtechjelinek): Move these to separate file later, after we establish // process to follow for Angular constants (#6731). -oppia.constant( +angular.module('oppia').constant( 'SUBTOPIC_PAGE_EDITOR_DATA_URL_TEMPLATE', '/subtopic_page_editor_handler/data//'); -oppia.constant( +angular.module('oppia').constant( 'EDITABLE_TOPIC_DATA_URL_TEMPLATE', '/topic_editor_handler/data/'); -oppia.constant('LABEL_FOR_CLEARING_FOCUS', 'labelForClearingFocus'); +angular.module('oppia').constant( + 'LABEL_FOR_CLEARING_FOCUS', 'labelForClearingFocus'); // TODO(bhenning): This constant should be provided by the backend. -oppia.constant( +angular.module('oppia').constant( 'COLLECTION_DATA_URL_TEMPLATE', '/collection_handler/data/'); diff --git a/core/templates/dev/head/base_components/BaseContentDirective.ts b/core/templates/dev/head/base_components/BaseContentDirective.ts index c1abd18f8147..187ae732f80c 100644 --- a/core/templates/dev/head/base_components/BaseContentDirective.ts +++ b/core/templates/dev/head/base_components/BaseContentDirective.ts @@ -24,9 +24,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/contextual/UrlService.ts'); require('services/stateful/BackgroundMaskService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('baseContent', [ +angular.module('oppia').directive('baseContent', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { diff --git a/core/templates/dev/head/base_components/WarningLoaderDirective.ts b/core/templates/dev/head/base_components/WarningLoaderDirective.ts index 85cce73033e9..99c3abc7f513 100644 --- a/core/templates/dev/head/base_components/WarningLoaderDirective.ts +++ b/core/templates/dev/head/base_components/WarningLoaderDirective.ts @@ -19,9 +19,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/AlertsService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('warningLoader', [ +angular.module('oppia').directive('warningLoader', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { diff --git a/core/templates/dev/head/components/button-directives/create-activity-button.directive.ts b/core/templates/dev/head/components/button-directives/create-activity-button.directive.ts index 1167c77556cd..91adfe889c83 100644 --- a/core/templates/dev/head/components/button-directives/create-activity-button.directive.ts +++ b/core/templates/dev/head/components/button-directives/create-activity-button.directive.ts @@ -23,9 +23,7 @@ require('services/contextual/UrlService.ts'); require('services/SiteAnalyticsService.ts'); require('services/UserService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('createActivityButton', [ +angular.module('oppia').directive('createActivityButton', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/components/button-directives/exploration-embed-button.service.ts b/core/templates/dev/head/components/button-directives/exploration-embed-button.service.ts index 7d3ae62ccc80..df405f8eac75 100644 --- a/core/templates/dev/head/components/button-directives/exploration-embed-button.service.ts +++ b/core/templates/dev/head/components/button-directives/exploration-embed-button.service.ts @@ -19,9 +19,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/SiteAnalyticsService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ExplorationEmbedButtonService', [ +angular.module('oppia').factory('ExplorationEmbedButtonService', [ '$uibModal', 'SiteAnalyticsService', 'UrlInterpolationService', function($uibModal, SiteAnalyticsService, UrlInterpolationService) { return { diff --git a/core/templates/dev/head/components/button-directives/hint-and-solution-buttons.directive.ts b/core/templates/dev/head/components/button-directives/hint-and-solution-buttons.directive.ts index 9172e7bc3201..8659fba05f9b 100644 --- a/core/templates/dev/head/components/button-directives/hint-and-solution-buttons.directive.ts +++ b/core/templates/dev/head/components/button-directives/hint-and-solution-buttons.directive.ts @@ -31,9 +31,7 @@ require('services/contextual/DeviceInfoService.ts'); require('pages/exploration-player-page/exploration-player-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('hintAndSolutionButtons', [ +angular.module('oppia').directive('hintAndSolutionButtons', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/components/button-directives/social-buttons.directive.ts b/core/templates/dev/head/components/button-directives/social-buttons.directive.ts index 389673a033c8..115565b59cd1 100644 --- a/core/templates/dev/head/components/button-directives/social-buttons.directive.ts +++ b/core/templates/dev/head/components/button-directives/social-buttons.directive.ts @@ -18,9 +18,7 @@ require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('socialButtons', [ +angular.module('oppia').directive('socialButtons', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/components/ck-editor-helpers/ck-editor-4-rte.directive.ts b/core/templates/dev/head/components/ck-editor-helpers/ck-editor-4-rte.directive.ts index 024b50d09cea..dd2ea72e1906 100644 --- a/core/templates/dev/head/components/ck-editor-helpers/ck-editor-4-rte.directive.ts +++ b/core/templates/dev/head/components/ck-editor-helpers/ck-editor-4-rte.directive.ts @@ -19,9 +19,7 @@ require('services/ContextService.ts'); require('services/RteHelperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('ckEditor4Rte', [ +angular.module('oppia').directive('ckEditor4Rte', [ 'ContextService', 'RteHelperService', 'PAGE_CONTEXT', function(ContextService, RteHelperService, PAGE_CONTEXT) { return { diff --git a/core/templates/dev/head/components/ck-editor-helpers/ck-editor-4-widgets.initializer.ts b/core/templates/dev/head/components/ck-editor-helpers/ck-editor-4-widgets.initializer.ts index 9a913e344b9d..6b90b0b2fb66 100644 --- a/core/templates/dev/head/components/ck-editor-helpers/ck-editor-4-widgets.initializer.ts +++ b/core/templates/dev/head/components/ck-editor-helpers/ck-editor-4-widgets.initializer.ts @@ -21,12 +21,10 @@ 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', +angular.module('oppia').run([ + '$timeout', '$compile', '$rootScope', 'RteHelperService', 'HtmlEscaperService', - function($timeout, $compile, $rootScope, $uibModal, RteHelperService, + function($timeout, $compile, $rootScope, RteHelperService, HtmlEscaperService) { var _RICH_TEXT_COMPONENTS = RteHelperService.getRichTextComponents(); _RICH_TEXT_COMPONENTS.forEach(function(componentDefn) { diff --git a/core/templates/dev/head/components/common-layout-directives/common-elements/alert-message.directive.ts b/core/templates/dev/head/components/common-layout-directives/common-elements/alert-message.directive.ts index 389cd863cdc0..e29088be040a 100644 --- a/core/templates/dev/head/components/common-layout-directives/common-elements/alert-message.directive.ts +++ b/core/templates/dev/head/components/common-layout-directives/common-elements/alert-message.directive.ts @@ -18,9 +18,7 @@ require('services/AlertsService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('alertMessage', [function() { +angular.module('oppia').directive('alertMessage', [function() { return { restrict: 'E', scope: { diff --git a/core/templates/dev/head/components/common-layout-directives/common-elements/attribution-guide.directive.ts b/core/templates/dev/head/components/common-layout-directives/common-elements/attribution-guide.directive.ts index 2c38f75048da..8b930d260e35 100644 --- a/core/templates/dev/head/components/common-layout-directives/common-elements/attribution-guide.directive.ts +++ b/core/templates/dev/head/components/common-layout-directives/common-elements/attribution-guide.directive.ts @@ -19,9 +19,7 @@ require('domain/utilities/BrowserCheckerService.ts'); require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('attributionGuide', [ +angular.module('oppia').directive('attributionGuide', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/components/common-layout-directives/common-elements/background-banner.directive.ts b/core/templates/dev/head/components/common-layout-directives/common-elements/background-banner.directive.ts index 0f57c54bb9d5..412d532cd6ec 100644 --- a/core/templates/dev/head/components/common-layout-directives/common-elements/background-banner.directive.ts +++ b/core/templates/dev/head/components/common-layout-directives/common-elements/background-banner.directive.ts @@ -18,9 +18,7 @@ require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('backgroundBanner', [ +angular.module('oppia').directive('backgroundBanner', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/components/common-layout-directives/common-elements/loading-dots.directive.ts b/core/templates/dev/head/components/common-layout-directives/common-elements/loading-dots.directive.ts index 4c29013c5e3d..d16f13cf035b 100644 --- a/core/templates/dev/head/components/common-layout-directives/common-elements/loading-dots.directive.ts +++ b/core/templates/dev/head/components/common-layout-directives/common-elements/loading-dots.directive.ts @@ -18,9 +18,7 @@ require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('loadingDots', [ +angular.module('oppia').directive('loadingDots', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/components/common-layout-directives/common-elements/promo-bar.directive.ts b/core/templates/dev/head/components/common-layout-directives/common-elements/promo-bar.directive.ts index bfe1ee3ab9eb..a940a5855cff 100644 --- a/core/templates/dev/head/components/common-layout-directives/common-elements/promo-bar.directive.ts +++ b/core/templates/dev/head/components/common-layout-directives/common-elements/promo-bar.directive.ts @@ -21,9 +21,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/PromoBarService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('promoBar', [ +angular.module('oppia').directive('promoBar', [ '$window', 'PromoBarService', 'UrlInterpolationService', function($window, PromoBarService, UrlInterpolationService) { return { diff --git a/core/templates/dev/head/components/common-layout-directives/common-elements/sharing-links.directive.ts b/core/templates/dev/head/components/common-layout-directives/common-elements/sharing-links.directive.ts index 4aca10cd2c4d..2ac5bfaeecf4 100644 --- a/core/templates/dev/head/components/common-layout-directives/common-elements/sharing-links.directive.ts +++ b/core/templates/dev/head/components/common-layout-directives/common-elements/sharing-links.directive.ts @@ -21,9 +21,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/HtmlEscaperService.ts'); require('services/SiteAnalyticsService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('sharingLinks', [ +angular.module('oppia').directive('sharingLinks', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/components/common-layout-directives/navigation-bars/side-navigation-bar.directive.ts b/core/templates/dev/head/components/common-layout-directives/navigation-bars/side-navigation-bar.directive.ts index 92b6b71ee1f4..286c942267d4 100644 --- a/core/templates/dev/head/components/common-layout-directives/navigation-bars/side-navigation-bar.directive.ts +++ b/core/templates/dev/head/components/common-layout-directives/navigation-bars/side-navigation-bar.directive.ts @@ -18,9 +18,7 @@ require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('sideNavigationBar', [ +angular.module('oppia').directive('sideNavigationBar', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/components/common-layout-directives/navigation-bars/top-navigation-bar.directive.ts b/core/templates/dev/head/components/common-layout-directives/navigation-bars/top-navigation-bar.directive.ts index 7e2098396ef9..e9b6bc0a4822 100644 --- a/core/templates/dev/head/components/common-layout-directives/navigation-bars/top-navigation-bar.directive.ts +++ b/core/templates/dev/head/components/common-layout-directives/navigation-bars/top-navigation-bar.directive.ts @@ -27,9 +27,7 @@ require('services/UserService.ts'); require('services/contextual/DeviceInfoService.ts'); require('services/contextual/WindowDimensionsService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('topNavigationBar', [ +angular.module('oppia').directive('topNavigationBar', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/components/concept-card/concept-card.directive.ts b/core/templates/dev/head/components/concept-card/concept-card.directive.ts index 94a75388ab25..c9b7e5d0d6e9 100644 --- a/core/templates/dev/head/components/concept-card/concept-card.directive.ts +++ b/core/templates/dev/head/components/concept-card/concept-card.directive.ts @@ -20,9 +20,7 @@ require('domain/skill/ConceptCardBackendApiService.ts'); require('domain/skill/ConceptCardObjectFactory.ts'); require('filters/format-rte-preview.filter.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('conceptCard', [ +angular.module('oppia').directive('conceptCard', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/components/entity-creation-services/collection-creation.service.ts b/core/templates/dev/head/components/entity-creation-services/collection-creation.service.ts index 7b1e19d1f94f..6bfef55ad1b3 100644 --- a/core/templates/dev/head/components/entity-creation-services/collection-creation.service.ts +++ b/core/templates/dev/head/components/entity-creation-services/collection-creation.service.ts @@ -24,9 +24,7 @@ require('services/SiteAnalyticsService.ts'); // duplicated code between CollectionCreationService and // ExplorationCreationService. -var oppia = require('AppInit.ts').module; - -oppia.factory('CollectionCreationService', [ +angular.module('oppia').factory('CollectionCreationService', [ '$http', '$rootScope', '$timeout', '$window', 'AlertsService', 'SiteAnalyticsService', 'UrlInterpolationService', function( diff --git a/core/templates/dev/head/components/entity-creation-services/exploration-creation.service.ts b/core/templates/dev/head/components/entity-creation-services/exploration-creation.service.ts index 24b249635231..d24e8c16c10b 100644 --- a/core/templates/dev/head/components/entity-creation-services/exploration-creation.service.ts +++ b/core/templates/dev/head/components/entity-creation-services/exploration-creation.service.ts @@ -22,9 +22,7 @@ require('services/AlertsService.ts'); require('services/CsrfTokenService.ts'); require('services/SiteAnalyticsService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ExplorationCreationService', [ +angular.module('oppia').factory('ExplorationCreationService', [ '$http', '$rootScope', '$timeout', '$uibModal', '$window', 'AlertsService', 'CsrfTokenService', 'SiteAnalyticsService', 'UrlInterpolationService', diff --git a/core/templates/dev/head/components/entity-creation-services/question-creation.service.ts b/core/templates/dev/head/components/entity-creation-services/question-creation.service.ts index ca3da1c07ea4..6d61ad3c965c 100644 --- a/core/templates/dev/head/components/entity-creation-services/question-creation.service.ts +++ b/core/templates/dev/head/components/entity-creation-services/question-creation.service.ts @@ -18,11 +18,9 @@ require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('QuestionCreationService', [ - '$http', '$q', 'UrlInterpolationService', - function($http, $q, UrlInterpolationService) { +angular.module('oppia').factory('QuestionCreationService', [ + '$http', '$q', + function($http, $q) { var QUESTION_CREATOR_URL = '/question_editor_handler/create_new'; var _createNew = function( diff --git a/core/templates/dev/head/components/entity-creation-services/skill-creation.service.ts b/core/templates/dev/head/components/entity-creation-services/skill-creation.service.ts index 12b74f807b56..79dee4dd61de 100644 --- a/core/templates/dev/head/components/entity-creation-services/skill-creation.service.ts +++ b/core/templates/dev/head/components/entity-creation-services/skill-creation.service.ts @@ -19,9 +19,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/AlertsService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('SkillCreationService', [ +angular.module('oppia').factory('SkillCreationService', [ '$http', '$rootScope', '$timeout', '$window', 'AlertsService', 'UrlInterpolationService', function( diff --git a/core/templates/dev/head/components/entity-creation-services/story-creation.service.ts b/core/templates/dev/head/components/entity-creation-services/story-creation.service.ts index 766d351d744b..e8a7fb23763f 100644 --- a/core/templates/dev/head/components/entity-creation-services/story-creation.service.ts +++ b/core/templates/dev/head/components/entity-creation-services/story-creation.service.ts @@ -21,9 +21,7 @@ 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', [ +angular.module('oppia').factory('StoryCreationService', [ '$http', '$rootScope', '$timeout', '$uibModal', '$window', 'AlertsService', 'TopicEditorStateService', 'TopicUpdateService', 'UrlInterpolationService', function( diff --git a/core/templates/dev/head/components/entity-creation-services/topic-creation.service.ts.ts b/core/templates/dev/head/components/entity-creation-services/topic-creation.service.ts.ts index 5d3974b38091..1016c6c52029 100644 --- a/core/templates/dev/head/components/entity-creation-services/topic-creation.service.ts.ts +++ b/core/templates/dev/head/components/entity-creation-services/topic-creation.service.ts.ts @@ -19,9 +19,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/AlertsService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('TopicCreationService', [ +angular.module('oppia').factory('TopicCreationService', [ '$http', '$rootScope', '$timeout', '$uibModal', '$window', 'AlertsService', 'UrlInterpolationService', function( diff --git a/core/templates/dev/head/components/forms/custom-forms-directives/apply-validation.directive.ts b/core/templates/dev/head/components/forms/custom-forms-directives/apply-validation.directive.ts index af173e9c7f7b..8177f7ed9f71 100644 --- a/core/templates/dev/head/components/forms/custom-forms-directives/apply-validation.directive.ts +++ b/core/templates/dev/head/components/forms/custom-forms-directives/apply-validation.directive.ts @@ -19,53 +19,52 @@ require('filters/string-utility-filters/underscores-to-camel-case.filter.ts'); /* eslint-disable angular/directive-restrict */ -var oppia = require('AppInit.ts').module; +angular.module('oppia').directive('applyValidation', [ + '$filter', function($filter) { + return { + require: 'ngModel', + restrict: 'A', + scope: {}, + bindToController: { + validators: '&' + }, + controllerAs: '$ctrl', + controller: [function() {}], + link: function(scope: ICustomScope, elm, attrs, ctrl) { + // Add validators in reverse order. + if (scope.$ctrl.validators()) { + scope.$ctrl.validators().forEach(function(validatorSpec) { + var frontendName = $filter('underscoresToCamelCase')( + validatorSpec.id); -oppia.directive('applyValidation', ['$filter', function($filter) { - return { - require: 'ngModel', - restrict: 'A', - scope: {}, - bindToController: { - validators: '&' - }, - controllerAs: '$ctrl', - controller: [function() {}], - link: function(scope: ICustomScope, elm, attrs, ctrl) { - // Add validators in reverse order. - if (scope.$ctrl.validators()) { - scope.$ctrl.validators().forEach(function(validatorSpec) { - var frontendName = $filter('underscoresToCamelCase')( - validatorSpec.id); - - // Note that there may not be a corresponding frontend filter for - // each backend validator. - try { - $filter(frontendName); - } catch (err) { - return; - } + // Note that there may not be a corresponding frontend filter for + // each backend validator. + try { + $filter(frontendName); + } catch (err) { + return; + } - var filterArgs = {}; - for (var key in validatorSpec) { - if (key !== 'id') { - filterArgs[$filter('underscoresToCamelCase')(key)] = - angular.copy(validatorSpec[key]); + var filterArgs = {}; + for (var key in validatorSpec) { + if (key !== 'id') { + filterArgs[$filter('underscoresToCamelCase')(key)] = + angular.copy(validatorSpec[key]); + } } - } - var customValidator = function(viewValue) { - ctrl.$setValidity( - frontendName, $filter(frontendName)(viewValue, - filterArgs)); - return viewValue; - }; + var customValidator = function(viewValue) { + ctrl.$setValidity( + frontendName, $filter(frontendName)(viewValue, + filterArgs)); + return viewValue; + }; - ctrl.$parsers.unshift(customValidator); - ctrl.$formatters.unshift(customValidator); - }); + ctrl.$parsers.unshift(customValidator); + ctrl.$formatters.unshift(customValidator); + }); + } } - } - }; -}]); + }; + }]); /* eslint-enable angular/directive-restrict */ diff --git a/core/templates/dev/head/components/forms/custom-forms-directives/audio-file-uploader.directive.ts b/core/templates/dev/head/components/forms/custom-forms-directives/audio-file-uploader.directive.ts index 28f9a6816d47..e7f2943c0f22 100644 --- a/core/templates/dev/head/components/forms/custom-forms-directives/audio-file-uploader.directive.ts +++ b/core/templates/dev/head/components/forms/custom-forms-directives/audio-file-uploader.directive.ts @@ -19,9 +19,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/IdGenerationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('audioFileUploader', [ +angular.module('oppia').directive('audioFileUploader', [ 'IdGenerationService', 'UrlInterpolationService', function(IdGenerationService, UrlInterpolationService) { return { diff --git a/core/templates/dev/head/components/forms/custom-forms-directives/html-select.directive.ts b/core/templates/dev/head/components/forms/custom-forms-directives/html-select.directive.ts index c9dbaa47ce1f..f6bb5ce25bd4 100644 --- a/core/templates/dev/head/components/forms/custom-forms-directives/html-select.directive.ts +++ b/core/templates/dev/head/components/forms/custom-forms-directives/html-select.directive.ts @@ -23,9 +23,7 @@ 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', [ +angular.module('oppia').directive('htmlSelect', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/components/forms/custom-forms-directives/image-uploader.directive.ts b/core/templates/dev/head/components/forms/custom-forms-directives/image-uploader.directive.ts index 189c5531e7e0..085fc46f9792 100644 --- a/core/templates/dev/head/components/forms/custom-forms-directives/image-uploader.directive.ts +++ b/core/templates/dev/head/components/forms/custom-forms-directives/image-uploader.directive.ts @@ -19,9 +19,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/IdGenerationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('imageUploader', [ +angular.module('oppia').directive('imageUploader', [ 'IdGenerationService', 'UrlInterpolationService', function(IdGenerationService, UrlInterpolationService) { return { diff --git a/core/templates/dev/head/components/forms/custom-forms-directives/object-editor.directive.ts b/core/templates/dev/head/components/forms/custom-forms-directives/object-editor.directive.ts index 8ae0c0b47ebf..1f6b11f64435 100644 --- a/core/templates/dev/head/components/forms/custom-forms-directives/object-editor.directive.ts +++ b/core/templates/dev/head/components/forms/custom-forms-directives/object-editor.directive.ts @@ -18,42 +18,42 @@ // 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: { - alwaysEditable: '@', - initArgs: '=', - isEditable: '@', - objType: '@', - value: '=' - }, - link: function(scope: ICustomScope, element) { - // Converts a camel-cased string to a lower-case hyphen-separated string. - var directiveName = scope.objType.replace( - /([a-z])([A-Z])/g, '$1-$2').toLowerCase(); - scope.getInitArgs = function() { - return scope.initArgs; - }; - scope.getAlwaysEditable = function() { - return scope.alwaysEditable; - }; - scope.getIsEditable = function() { - return scope.isEditable; - }; - if (directiveName) { - element.html( - '<' + directiveName + - '-editor get-always-editable="getAlwaysEditable()"' + - ' get-init-args="getInitArgs()" get-is-editable="getIsEditable()"' + - ' obj-type="objType" value="value">'); - $compile(element.contents())(scope); - } else { - $log.error('Error in objectEditor: no editor type supplied.'); - } - }, - restrict: 'E' - }; -}]); +angular.module('oppia').directive('objectEditor', [ + '$compile', '$log', function($compile, $log) { + return { + scope: { + alwaysEditable: '@', + initArgs: '=', + isEditable: '@', + objType: '@', + value: '=' + }, + link: function(scope: ICustomScope, element) { + // Converts a camel-cased string to a lower-case hyphen-separated + // string. + var directiveName = scope.objType.replace( + /([a-z])([A-Z])/g, '$1-$2').toLowerCase(); + scope.getInitArgs = function() { + return scope.initArgs; + }; + scope.getAlwaysEditable = function() { + return scope.alwaysEditable; + }; + scope.getIsEditable = function() { + return scope.isEditable; + }; + if (directiveName) { + element.html( + '<' + directiveName + + '-editor get-always-editable="getAlwaysEditable()"' + + ' get-init-args="getInitArgs()" get-is-editable="getIsEditable()"' + + ' obj-type="objType" value="value">'); + $compile(element.contents())(scope); + } else { + $log.error('Error in objectEditor: no editor type supplied.'); + } + }, + restrict: 'E' + }; + }]); diff --git a/core/templates/dev/head/components/forms/custom-forms-directives/require-is-float.directive.ts b/core/templates/dev/head/components/forms/custom-forms-directives/require-is-float.directive.ts index 332909a25242..1b0f5937af69 100644 --- a/core/templates/dev/head/components/forms/custom-forms-directives/require-is-float.directive.ts +++ b/core/templates/dev/head/components/forms/custom-forms-directives/require-is-float.directive.ts @@ -22,22 +22,21 @@ require('components/forms/validators/is-float.filter.ts'); /* eslint-disable angular/directive-restrict */ -var oppia = require('AppInit.ts').module; +angular.module('oppia').directive('requireIsFloat', [ + '$filter', function($filter) { + return { + require: 'ngModel', + restrict: 'A', + link: function(scope, elm, attrs, ctrl) { + var floatValidator = function(viewValue) { + var filteredValue = $filter('isFloat')(viewValue); + ctrl.$setValidity('isFloat', filteredValue !== undefined); + return filteredValue; + }; -oppia.directive('requireIsFloat', ['$filter', function($filter) { - return { - require: 'ngModel', - restrict: 'A', - link: function(scope, elm, attrs, ctrl) { - var floatValidator = function(viewValue) { - var filteredValue = $filter('isFloat')(viewValue); - ctrl.$setValidity('isFloat', filteredValue !== undefined); - return filteredValue; - }; - - ctrl.$parsers.unshift(floatValidator); - ctrl.$formatters.unshift(floatValidator); - } - }; -}]); + ctrl.$parsers.unshift(floatValidator); + ctrl.$formatters.unshift(floatValidator); + } + }; + }]); /* eslint-enable angular/directive-restrict */ diff --git a/core/templates/dev/head/components/forms/custom-forms-directives/select2-dropdown.directive.ts b/core/templates/dev/head/components/forms/custom-forms-directives/select2-dropdown.directive.ts index 05c54686eeb2..81179a569f25 100644 --- a/core/templates/dev/head/components/forms/custom-forms-directives/select2-dropdown.directive.ts +++ b/core/templates/dev/head/components/forms/custom-forms-directives/select2-dropdown.directive.ts @@ -18,9 +18,7 @@ require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('select2Dropdown', [ +angular.module('oppia').directive('select2Dropdown', [ 'UrlInterpolationService', function(UrlInterpolationService) { // Directive for incorporating select2 dropdowns. return { diff --git a/core/templates/dev/head/components/forms/forms-templates/mark-all-audio-and-translations-as-needing-update.controller.ts b/core/templates/dev/head/components/forms/forms-templates/mark-all-audio-and-translations-as-needing-update.controller.ts index dd9018433eab..2c2359bb3e2e 100644 --- a/core/templates/dev/head/components/forms/forms-templates/mark-all-audio-and-translations-as-needing-update.controller.ts +++ b/core/templates/dev/head/components/forms/forms-templates/mark-all-audio-and-translations-as-needing-update.controller.ts @@ -17,17 +17,16 @@ * mark_all_audio_and_translations_as_needing_update modal. */ -var oppia = require('AppInit.ts').module; +angular.module('oppia').controller( + 'MarkAllAudioAndTranslationsAsNeedingUpdateController', [ + '$scope', '$uibModalInstance', + function($scope, $uibModalInstance) { + $scope.flagAll = function() { + $uibModalInstance.close(); + }; -oppia.controller('MarkAllAudioAndTranslationsAsNeedingUpdateController', [ - '$scope', '$uibModalInstance', - function($scope, $uibModalInstance) { - $scope.flagAll = function() { - $uibModalInstance.close(); - }; - - $scope.cancel = function() { - $uibModalInstance.dismiss('cancel'); - }; - } -]); + $scope.cancel = function() { + $uibModalInstance.dismiss('cancel'); + }; + } + ]); diff --git a/core/templates/dev/head/components/forms/schema-based-editors/schema-based-bool-editor.directive.ts b/core/templates/dev/head/components/forms/schema-based-editors/schema-based-bool-editor.directive.ts index d6f4940718ac..65060ca3a256 100644 --- a/core/templates/dev/head/components/forms/schema-based-editors/schema-based-bool-editor.directive.ts +++ b/core/templates/dev/head/components/forms/schema-based-editors/schema-based-bool-editor.directive.ts @@ -18,9 +18,7 @@ require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('schemaBasedBoolEditor', [ +angular.module('oppia').directive('schemaBasedBoolEditor', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { diff --git a/core/templates/dev/head/components/forms/schema-based-editors/schema-based-choices-editor.directive.ts b/core/templates/dev/head/components/forms/schema-based-editors/schema-based-choices-editor.directive.ts index c479c9acf6d5..d14c612ba695 100644 --- a/core/templates/dev/head/components/forms/schema-based-editors/schema-based-choices-editor.directive.ts +++ b/core/templates/dev/head/components/forms/schema-based-editors/schema-based-choices-editor.directive.ts @@ -19,9 +19,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/NestedDirectivesRecursionTimeoutPreventionService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('schemaBasedChoicesEditor', [ +angular.module('oppia').directive('schemaBasedChoicesEditor', [ 'NestedDirectivesRecursionTimeoutPreventionService', 'UrlInterpolationService', function( diff --git a/core/templates/dev/head/components/forms/schema-based-editors/schema-based-custom-editor.directive.ts b/core/templates/dev/head/components/forms/schema-based-editors/schema-based-custom-editor.directive.ts index c322a8a359cf..4cbc1558c6a0 100644 --- a/core/templates/dev/head/components/forms/schema-based-editors/schema-based-custom-editor.directive.ts +++ b/core/templates/dev/head/components/forms/schema-based-editors/schema-based-custom-editor.directive.ts @@ -19,9 +19,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/NestedDirectivesRecursionTimeoutPreventionService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('schemaBasedCustomEditor', [ +angular.module('oppia').directive('schemaBasedCustomEditor', [ 'NestedDirectivesRecursionTimeoutPreventionService', 'UrlInterpolationService', function( diff --git a/core/templates/dev/head/components/forms/schema-based-editors/schema-based-dict-editor.directive.ts b/core/templates/dev/head/components/forms/schema-based-editors/schema-based-dict-editor.directive.ts index 4f57da46448a..b3bb6ad417bb 100644 --- a/core/templates/dev/head/components/forms/schema-based-editors/schema-based-dict-editor.directive.ts +++ b/core/templates/dev/head/components/forms/schema-based-editors/schema-based-dict-editor.directive.ts @@ -23,9 +23,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/IdGenerationService.ts'); require('services/NestedDirectivesRecursionTimeoutPreventionService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('schemaBasedDictEditor', [ +angular.module('oppia').directive('schemaBasedDictEditor', [ 'NestedDirectivesRecursionTimeoutPreventionService', 'UrlInterpolationService', function( diff --git a/core/templates/dev/head/components/forms/schema-based-editors/schema-based-editor.directive.ts b/core/templates/dev/head/components/forms/schema-based-editors/schema-based-editor.directive.ts index 84d200d64546..50b7126ba1ec 100644 --- a/core/templates/dev/head/components/forms/schema-based-editors/schema-based-editor.directive.ts +++ b/core/templates/dev/head/components/forms/schema-based-editors/schema-based-editor.directive.ts @@ -45,9 +45,7 @@ require( require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('schemaBasedEditor', [ +angular.module('oppia').directive('schemaBasedEditor', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/components/forms/schema-based-editors/schema-based-expression-editor.directive.ts b/core/templates/dev/head/components/forms/schema-based-editors/schema-based-expression-editor.directive.ts index 5f756b07b1a8..439e3f76292a 100644 --- a/core/templates/dev/head/components/forms/schema-based-editors/schema-based-expression-editor.directive.ts +++ b/core/templates/dev/head/components/forms/schema-based-editors/schema-based-expression-editor.directive.ts @@ -18,9 +18,7 @@ require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('schemaBasedExpressionEditor', [ +angular.module('oppia').directive('schemaBasedExpressionEditor', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { scope: { diff --git a/core/templates/dev/head/components/forms/schema-based-editors/schema-based-float-editor.directive.ts b/core/templates/dev/head/components/forms/schema-based-editors/schema-based-float-editor.directive.ts index bca3ac2c1bde..6d9cb5c93d42 100644 --- a/core/templates/dev/head/components/forms/schema-based-editors/schema-based-float-editor.directive.ts +++ b/core/templates/dev/head/components/forms/schema-based-editors/schema-based-float-editor.directive.ts @@ -20,9 +20,7 @@ require('components/forms/validators/is-float.filter.ts'); require('domain/utilities/UrlInterpolationService.ts'); require('services/stateful/FocusManagerService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('schemaBasedFloatEditor', [ +angular.module('oppia').directive('schemaBasedFloatEditor', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/components/forms/schema-based-editors/schema-based-html-editor.directive.ts b/core/templates/dev/head/components/forms/schema-based-editors/schema-based-html-editor.directive.ts index 87718b5c6512..154c73602e8f 100644 --- a/core/templates/dev/head/components/forms/schema-based-editors/schema-based-html-editor.directive.ts +++ b/core/templates/dev/head/components/forms/schema-based-editors/schema-based-html-editor.directive.ts @@ -18,9 +18,7 @@ require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('schemaBasedHtmlEditor', [ +angular.module('oppia').directive('schemaBasedHtmlEditor', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/components/forms/schema-based-editors/schema-based-int-editor.directive.ts b/core/templates/dev/head/components/forms/schema-based-editors/schema-based-int-editor.directive.ts index 9e2815fe7f04..adf026616b83 100644 --- a/core/templates/dev/head/components/forms/schema-based-editors/schema-based-int-editor.directive.ts +++ b/core/templates/dev/head/components/forms/schema-based-editors/schema-based-int-editor.directive.ts @@ -18,9 +18,7 @@ require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('schemaBasedIntEditor', [ +angular.module('oppia').directive('schemaBasedIntEditor', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/components/forms/schema-based-editors/schema-based-list-editor.directive.ts b/core/templates/dev/head/components/forms/schema-based-editors/schema-based-list-editor.directive.ts index 1797a7db6bd4..a1b7194ece8d 100644 --- a/core/templates/dev/head/components/forms/schema-based-editors/schema-based-list-editor.directive.ts +++ b/core/templates/dev/head/components/forms/schema-based-editors/schema-based-list-editor.directive.ts @@ -26,9 +26,7 @@ require('services/SchemaDefaultValueService.ts'); require('services/SchemaUndefinedLastElementService.ts'); require('services/stateful/FocusManagerService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('schemaBasedListEditor', [ +angular.module('oppia').directive('schemaBasedListEditor', [ 'FocusManagerService', 'IdGenerationService', 'NestedDirectivesRecursionTimeoutPreventionService', 'SchemaDefaultValueService', 'SchemaUndefinedLastElementService', diff --git a/core/templates/dev/head/components/forms/schema-based-editors/schema-based-unicode-editor.directive.ts b/core/templates/dev/head/components/forms/schema-based-editors/schema-based-unicode-editor.directive.ts index 5b8525f1c701..f284c4d00dcc 100644 --- a/core/templates/dev/head/components/forms/schema-based-editors/schema-based-unicode-editor.directive.ts +++ b/core/templates/dev/head/components/forms/schema-based-editors/schema-based-unicode-editor.directive.ts @@ -20,9 +20,7 @@ require('filters/convert-unicode-with-params-to-html.filter.ts'); require('domain/utilities/UrlInterpolationService.ts'); require('services/contextual/DeviceInfoService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('schemaBasedUnicodeEditor', [ +angular.module('oppia').directive('schemaBasedUnicodeEditor', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/components/forms/schema-viewers/schema-based-custom-viewer.directive.ts b/core/templates/dev/head/components/forms/schema-viewers/schema-based-custom-viewer.directive.ts index 3d98a768ae5a..931093c9cf18 100644 --- a/core/templates/dev/head/components/forms/schema-viewers/schema-based-custom-viewer.directive.ts +++ b/core/templates/dev/head/components/forms/schema-viewers/schema-based-custom-viewer.directive.ts @@ -19,9 +19,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/NestedDirectivesRecursionTimeoutPreventionService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('schemaBasedCustomViewer', [ +angular.module('oppia').directive('schemaBasedCustomViewer', [ 'NestedDirectivesRecursionTimeoutPreventionService', 'UrlInterpolationService', function( diff --git a/core/templates/dev/head/components/forms/schema-viewers/schema-based-dict-viewer.directive.ts b/core/templates/dev/head/components/forms/schema-viewers/schema-based-dict-viewer.directive.ts index c8db4da49a52..94df0b6a5276 100644 --- a/core/templates/dev/head/components/forms/schema-viewers/schema-based-dict-viewer.directive.ts +++ b/core/templates/dev/head/components/forms/schema-viewers/schema-based-dict-viewer.directive.ts @@ -19,9 +19,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/NestedDirectivesRecursionTimeoutPreventionService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('schemaBasedDictViewer', [ +angular.module('oppia').directive('schemaBasedDictViewer', [ 'NestedDirectivesRecursionTimeoutPreventionService', 'UrlInterpolationService', function( diff --git a/core/templates/dev/head/components/forms/schema-viewers/schema-based-html-viewer.directive.ts b/core/templates/dev/head/components/forms/schema-viewers/schema-based-html-viewer.directive.ts index cd1b5f3a55ba..188f33688280 100644 --- a/core/templates/dev/head/components/forms/schema-viewers/schema-based-html-viewer.directive.ts +++ b/core/templates/dev/head/components/forms/schema-viewers/schema-based-html-viewer.directive.ts @@ -18,9 +18,7 @@ require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('schemaBasedHtmlViewer', [ +angular.module('oppia').directive('schemaBasedHtmlViewer', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { scope: { diff --git a/core/templates/dev/head/components/forms/schema-viewers/schema-based-list-viewer.directive.ts b/core/templates/dev/head/components/forms/schema-viewers/schema-based-list-viewer.directive.ts index b5b022c04c42..03e4bb7b626d 100644 --- a/core/templates/dev/head/components/forms/schema-viewers/schema-based-list-viewer.directive.ts +++ b/core/templates/dev/head/components/forms/schema-viewers/schema-based-list-viewer.directive.ts @@ -19,9 +19,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/NestedDirectivesRecursionTimeoutPreventionService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('schemaBasedListViewer', [ +angular.module('oppia').directive('schemaBasedListViewer', [ 'NestedDirectivesRecursionTimeoutPreventionService', 'UrlInterpolationService', function( diff --git a/core/templates/dev/head/components/forms/schema-viewers/schema-based-primitive-viewer.directive.ts b/core/templates/dev/head/components/forms/schema-viewers/schema-based-primitive-viewer.directive.ts index 0a982d56c069..cbedc610ecb6 100644 --- a/core/templates/dev/head/components/forms/schema-viewers/schema-based-primitive-viewer.directive.ts +++ b/core/templates/dev/head/components/forms/schema-viewers/schema-based-primitive-viewer.directive.ts @@ -18,9 +18,7 @@ require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('schemaBasedPrimitiveViewer', [ +angular.module('oppia').directive('schemaBasedPrimitiveViewer', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { scope: { diff --git a/core/templates/dev/head/components/forms/schema-viewers/schema-based-unicode-viewer.directive.ts b/core/templates/dev/head/components/forms/schema-viewers/schema-based-unicode-viewer.directive.ts index 9103e29fdffb..ba14912e0f09 100644 --- a/core/templates/dev/head/components/forms/schema-viewers/schema-based-unicode-viewer.directive.ts +++ b/core/templates/dev/head/components/forms/schema-viewers/schema-based-unicode-viewer.directive.ts @@ -19,9 +19,7 @@ require('filters/convert-unicode-with-params-to-html.filter.ts'); require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('schemaBasedUnicodeViewer', [ +angular.module('oppia').directive('schemaBasedUnicodeViewer', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { scope: { diff --git a/core/templates/dev/head/components/forms/schema-viewers/schema-based-viewer.directive.ts b/core/templates/dev/head/components/forms/schema-viewers/schema-based-viewer.directive.ts index 5a0b9fdb56ad..eb78010f9f1c 100644 --- a/core/templates/dev/head/components/forms/schema-viewers/schema-based-viewer.directive.ts +++ b/core/templates/dev/head/components/forms/schema-viewers/schema-based-viewer.directive.ts @@ -18,9 +18,7 @@ require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('schemaBasedViewer', [ +angular.module('oppia').directive('schemaBasedViewer', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/components/forms/validators/is-at-least.filter.ts b/core/templates/dev/head/components/forms/validators/is-at-least.filter.ts index 67c621c91e3c..0fe3db54035f 100644 --- a/core/templates/dev/head/components/forms/validators/is-at-least.filter.ts +++ b/core/templates/dev/head/components/forms/validators/is-at-least.filter.ts @@ -17,9 +17,7 @@ args. */ -var oppia = require('AppInit.ts').module; - -oppia.filter('isAtLeast', [function() { +angular.module('oppia').filter('isAtLeast', [function() { return function(input, args) { return (input >= args.minValue); }; diff --git a/core/templates/dev/head/components/forms/validators/is-at-most.filter.ts b/core/templates/dev/head/components/forms/validators/is-at-most.filter.ts index 3938c2572814..370795febffd 100644 --- a/core/templates/dev/head/components/forms/validators/is-at-most.filter.ts +++ b/core/templates/dev/head/components/forms/validators/is-at-most.filter.ts @@ -17,9 +17,7 @@ args. */ -var oppia = require('AppInit.ts').module; - -oppia.filter('isAtMost', [function() { +angular.module('oppia').filter('isAtMost', [function() { return function(input, args) { return (input <= args.maxValue); }; diff --git a/core/templates/dev/head/components/forms/validators/is-float.filter.ts b/core/templates/dev/head/components/forms/validators/is-float.filter.ts index f5cf900e7421..42244fd6179e 100644 --- a/core/templates/dev/head/components/forms/validators/is-float.filter.ts +++ b/core/templates/dev/head/components/forms/validators/is-float.filter.ts @@ -16,9 +16,7 @@ * @fileoverview Validator to check if input is float. */ -var oppia = require('AppInit.ts').module; - -oppia.filter('isFloat', [function() { +angular.module('oppia').filter('isFloat', [function() { return function(input) { var FLOAT_REGEXP = /(?=.*\d)^\-?\d*(\.|\,)?\d*\%?$/; // This regex accepts floats in the following formats: diff --git a/core/templates/dev/head/components/forms/validators/is-integer.filter.ts b/core/templates/dev/head/components/forms/validators/is-integer.filter.ts index 4e727303dabe..345ec8a4c514 100644 --- a/core/templates/dev/head/components/forms/validators/is-integer.filter.ts +++ b/core/templates/dev/head/components/forms/validators/is-integer.filter.ts @@ -16,9 +16,7 @@ * @fileoverview Validator to check if input is integer. */ -var oppia = require('AppInit.ts').module; - -oppia.filter('isInteger', [function() { +angular.module('oppia').filter('isInteger', [function() { return function(input) { return Number.isInteger(Number(input)); }; diff --git a/core/templates/dev/head/components/forms/validators/is-nonempty.filter.ts b/core/templates/dev/head/components/forms/validators/is-nonempty.filter.ts index 0f4a023dc8ac..66b45b3eec8b 100644 --- a/core/templates/dev/head/components/forms/validators/is-nonempty.filter.ts +++ b/core/templates/dev/head/components/forms/validators/is-nonempty.filter.ts @@ -16,9 +16,7 @@ * @fileoverview Validator to check if input is nonempty. */ -var oppia = require('AppInit.ts').module; - -oppia.filter('isNonempty', [function() { +angular.module('oppia').filter('isNonempty', [function() { return function(input) { return Boolean(input); }; diff --git a/core/templates/dev/head/components/graph-services/graph-layout.service.ts b/core/templates/dev/head/components/graph-services/graph-layout.service.ts index 5fdc1e0b62f9..79e2b80971ec 100644 --- a/core/templates/dev/head/components/graph-services/graph-layout.service.ts +++ b/core/templates/dev/head/components/graph-services/graph-layout.service.ts @@ -17,11 +17,9 @@ */ // Service for computing layout of state graph nodes. -var oppia = require('AppInit.ts').module; - -oppia.factory('StateGraphLayoutService', [ - '$filter', '$log', 'MAX_NODES_PER_ROW', - function($filter, $log, MAX_NODES_PER_ROW) { +angular.module('oppia').factory('StateGraphLayoutService', [ + 'MAX_NODES_PER_ROW', + function(MAX_NODES_PER_ROW) { var MAX_INDENTATION_LEVEL = 2.5; // The last result of a call to computeLayout(). Used for determining the diff --git a/core/templates/dev/head/components/profile-link-directives/circular-image.directive.ts b/core/templates/dev/head/components/profile-link-directives/circular-image.directive.ts index 045d9604b7ef..d6d65cc81218 100644 --- a/core/templates/dev/head/components/profile-link-directives/circular-image.directive.ts +++ b/core/templates/dev/head/components/profile-link-directives/circular-image.directive.ts @@ -18,9 +18,7 @@ require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('circularImage', [ +angular.module('oppia').directive('circularImage', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/components/profile-link-directives/profile-link-image.directive.ts b/core/templates/dev/head/components/profile-link-directives/profile-link-image.directive.ts index 39443a25f527..d09107005cb3 100644 --- a/core/templates/dev/head/components/profile-link-directives/profile-link-image.directive.ts +++ b/core/templates/dev/head/components/profile-link-directives/profile-link-image.directive.ts @@ -18,9 +18,7 @@ require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('profileLinkImage', [ +angular.module('oppia').directive('profileLinkImage', [ 'UrlInterpolationService', 'SYSTEM_USER_IDS', function(UrlInterpolationService, SYSTEM_USER_IDS) { return { diff --git a/core/templates/dev/head/components/profile-link-directives/profile-link-text.directive.ts b/core/templates/dev/head/components/profile-link-directives/profile-link-text.directive.ts index a10e5bee20e1..383a9ae754d5 100644 --- a/core/templates/dev/head/components/profile-link-directives/profile-link-text.directive.ts +++ b/core/templates/dev/head/components/profile-link-directives/profile-link-text.directive.ts @@ -18,9 +18,7 @@ require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('profileLinkText', [ +angular.module('oppia').directive('profileLinkText', [ 'UrlInterpolationService', 'SYSTEM_USER_IDS', function(UrlInterpolationService, SYSTEM_USER_IDS) { return { diff --git a/core/templates/dev/head/components/question-directives/question-editor/question-editor.directive.ts b/core/templates/dev/head/components/question-directives/question-editor/question-editor.directive.ts index c711cd823686..782ae6fdf0dd 100644 --- a/core/templates/dev/head/components/question-directives/question-editor/question-editor.directive.ts +++ b/core/templates/dev/head/components/question-directives/question-editor/question-editor.directive.ts @@ -37,9 +37,7 @@ require('services/EditabilityService.ts'); require('pages/interaction-specs.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('questionEditor', [ +angular.module('oppia').directive('questionEditor', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/components/question-directives/question-player/question-player.constants.ts b/core/templates/dev/head/components/question-directives/question-player/question-player.constants.ts index 7d9a4bfe85d3..60257e35d282 100644 --- a/core/templates/dev/head/components/question-directives/question-player/question-player.constants.ts +++ b/core/templates/dev/head/components/question-directives/question-player/question-player.constants.ts @@ -16,9 +16,7 @@ * @fileoverview Constants for the question player directive. */ -var oppia = require('AppInit.ts').module; - -oppia.constant( +angular.module('oppia').constant( 'COLORS_FOR_PASS_FAIL_MODE', { // color orange FAILED_COLOR: 'rgb(217, 92, 12)', @@ -31,16 +29,16 @@ oppia.constant( } ); -oppia.constant('HASH_PARAM', 'question-player-result='); +angular.module('oppia').constant('HASH_PARAM', 'question-player-result='); -oppia.constant('MAX_SCORE_PER_QUESTION', 1.0); +angular.module('oppia').constant('MAX_SCORE_PER_QUESTION', 1.0); -oppia.constant( +angular.module('oppia').constant( 'QUESTION_PLAYER_MODE', { PASS_FAIL_MODE: 'PASS_FAIL' } ); -oppia.constant('VIEW_HINT_PENALTY', 0.1); +angular.module('oppia').constant('VIEW_HINT_PENALTY', 0.1); -oppia.constant('WRONG_ANSWER_PENALTY', 0.1); +angular.module('oppia').constant('WRONG_ANSWER_PENALTY', 0.1); diff --git a/core/templates/dev/head/components/question-directives/question-player/question-player.directive.ts b/core/templates/dev/head/components/question-directives/question-player/question-player.directive.ts index 176113beea59..7fffcfd5feef 100644 --- a/core/templates/dev/head/components/question-directives/question-player/question-player.directive.ts +++ b/core/templates/dev/head/components/question-directives/question-player/question-player.directive.ts @@ -107,12 +107,10 @@ require('services/contextual/UrlService.ts'); require('pages/interaction-specs.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('questionPlayer', [ - '$http', 'UrlInterpolationService', +angular.module('oppia').directive('questionPlayer', [ + 'UrlInterpolationService', function( - $http, UrlInterpolationService) { + UrlInterpolationService) { return { restrict: 'E', scope: {}, diff --git a/core/templates/dev/head/components/question-directives/question-player/services/question-player-state.service.ts b/core/templates/dev/head/components/question-directives/question-player/services/question-player-state.service.ts index 22a0d66cc036..99d4bcea51bc 100644 --- a/core/templates/dev/head/components/question-directives/question-player/services/question-player-state.service.ts +++ b/core/templates/dev/head/components/question-directives/question-player/services/question-player-state.service.ts @@ -17,9 +17,7 @@ * in the test session. */ -var oppia = require('AppInit.ts').module; - -oppia.factory('QuestionPlayerStateService', [ +angular.module('oppia').factory('QuestionPlayerStateService', [ function() { var questionPlayerState = {}; diff --git a/core/templates/dev/head/components/question-directives/questions-list/questions-list.constants.ts b/core/templates/dev/head/components/question-directives/questions-list/questions-list.constants.ts index c402d1cc8dbc..25a42c9f033a 100644 --- a/core/templates/dev/head/components/question-directives/questions-list/questions-list.constants.ts +++ b/core/templates/dev/head/components/question-directives/questions-list/questions-list.constants.ts @@ -16,8 +16,7 @@ * @fileoverview Constants for the question player directive. */ -var oppia = require('AppInit.ts').module; - -oppia.constant('DEFAULT_SKILL_DIFFICULTY', '0.3'); -oppia.constant('MODE_SELECT_DIFFICULTY', 'MODE_SELECT_DIFFICULTY'); -oppia.constant('MODE_SELECT_SKILL', 'MODE_SELECT_SKILL'); +angular.module('oppia').constant('DEFAULT_SKILL_DIFFICULTY', '0.3'); +angular.module('oppia').constant( + 'MODE_SELECT_DIFFICULTY', 'MODE_SELECT_DIFFICULTY'); +angular.module('oppia').constant('MODE_SELECT_SKILL', 'MODE_SELECT_SKILL'); diff --git a/core/templates/dev/head/components/question-directives/questions-list/questions-list.directive.ts b/core/templates/dev/head/components/question-directives/questions-list/questions-list.directive.ts index 5be2d940f994..345a30e80588 100644 --- a/core/templates/dev/head/components/question-directives/questions-list/questions-list.directive.ts +++ b/core/templates/dev/head/components/question-directives/questions-list/questions-list.directive.ts @@ -41,9 +41,7 @@ require( require('services/AlertsService.ts'); require('services/contextual/UrlService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('questionsList', [ +angular.module('oppia').directive('questionsList', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/components/ratings/rating-computation/rating-computation.service.ts b/core/templates/dev/head/components/ratings/rating-computation/rating-computation.service.ts index 2bc6068075ba..915b933f0f75 100644 --- a/core/templates/dev/head/components/ratings/rating-computation/rating-computation.service.ts +++ b/core/templates/dev/head/components/ratings/rating-computation/rating-computation.service.ts @@ -58,7 +58,5 @@ export class RatingComputationService { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'RatingComputationService', downgradeInjectable(RatingComputationService)); diff --git a/core/templates/dev/head/components/ratings/rating-display/rating-display.directive.ts b/core/templates/dev/head/components/ratings/rating-display/rating-display.directive.ts index c402274b9cd1..5edef84aacc6 100644 --- a/core/templates/dev/head/components/ratings/rating-display/rating-display.directive.ts +++ b/core/templates/dev/head/components/ratings/rating-display/rating-display.directive.ts @@ -18,9 +18,7 @@ require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('ratingDisplay', [ +angular.module('oppia').directive('ratingDisplay', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { // This will display a star-rating based on the given data. The attributes diff --git a/core/templates/dev/head/components/score-ring/score-ring.directive.ts b/core/templates/dev/head/components/score-ring/score-ring.directive.ts index 179321d7693b..93c1db16b3ca 100644 --- a/core/templates/dev/head/components/score-ring/score-ring.directive.ts +++ b/core/templates/dev/head/components/score-ring/score-ring.directive.ts @@ -16,9 +16,7 @@ * @fileoverview Directive for the animated score ring. */ -var oppia = require('AppInit.ts').module; - -oppia.directive('scoreRing', [ +angular.module('oppia').directive('scoreRing', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/components/state-directives/answer-group-editor/answer-group-editor.directive.ts b/core/templates/dev/head/components/state-directives/answer-group-editor/answer-group-editor.directive.ts index c766f7cbab45..df1e0fdd2ae1 100644 --- a/core/templates/dev/head/components/state-directives/answer-group-editor/answer-group-editor.directive.ts +++ b/core/templates/dev/head/components/state-directives/answer-group-editor/answer-group-editor.directive.ts @@ -37,9 +37,7 @@ require( require('services/AlertsService.ts'); require('services/ContextService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('answerGroupEditor', [ +angular.module('oppia').directive('answerGroupEditor', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/components/state-directives/answer-group-editor/summary-list-header.directive.ts b/core/templates/dev/head/components/state-directives/answer-group-editor/summary-list-header.directive.ts index 71598b94c3c9..26b411571261 100644 --- a/core/templates/dev/head/components/state-directives/answer-group-editor/summary-list-header.directive.ts +++ b/core/templates/dev/head/components/state-directives/answer-group-editor/summary-list-header.directive.ts @@ -18,9 +18,7 @@ require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('summaryListHeader', [ +angular.module('oppia').directive('summaryListHeader', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/components/state-directives/hint-editor/hint-editor.directive.ts b/core/templates/dev/head/components/state-directives/hint-editor/hint-editor.directive.ts index 1650d96b360b..0cf48b4a493c 100644 --- a/core/templates/dev/head/components/state-directives/hint-editor/hint-editor.directive.ts +++ b/core/templates/dev/head/components/state-directives/hint-editor/hint-editor.directive.ts @@ -26,9 +26,7 @@ require( 'state-property.service.ts'); require('services/EditabilityService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('hintEditor', [ +angular.module('oppia').directive('hintEditor', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/components/state-directives/outcome-editor/outcome-destination-editor.directive.ts b/core/templates/dev/head/components/state-directives/outcome-editor/outcome-destination-editor.directive.ts index 62b981d77fb6..61b7d2b45604 100644 --- a/core/templates/dev/head/components/state-directives/outcome-editor/outcome-destination-editor.directive.ts +++ b/core/templates/dev/head/components/state-directives/outcome-editor/outcome-destination-editor.directive.ts @@ -27,9 +27,7 @@ require('services/EditabilityService.ts'); require('services/UserService.ts'); require('services/stateful/FocusManagerService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('outcomeDestinationEditor', [ +angular.module('oppia').directive('outcomeDestinationEditor', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/components/state-directives/outcome-editor/outcome-editor.directive.ts b/core/templates/dev/head/components/state-directives/outcome-editor/outcome-editor.directive.ts index 09016fd3ce30..773b596b621a 100644 --- a/core/templates/dev/head/components/state-directives/outcome-editor/outcome-editor.directive.ts +++ b/core/templates/dev/head/components/state-directives/outcome-editor/outcome-editor.directive.ts @@ -24,9 +24,7 @@ require( 'components/state-editor/state-editor-properties-services/' + 'state-property.service.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('outcomeEditor', [ +angular.module('oppia').directive('outcomeEditor', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/components/state-directives/outcome-editor/outcome-feedback-editor.directive.ts b/core/templates/dev/head/components/state-directives/outcome-editor/outcome-feedback-editor.directive.ts index e2557c740d23..a4d4d8821368 100644 --- a/core/templates/dev/head/components/state-directives/outcome-editor/outcome-feedback-editor.directive.ts +++ b/core/templates/dev/head/components/state-directives/outcome-editor/outcome-feedback-editor.directive.ts @@ -19,11 +19,9 @@ require('domain/exploration/SubtitledHtmlObjectFactory.ts'); require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('outcomeFeedbackEditor', [ - 'SubtitledHtmlObjectFactory', 'UrlInterpolationService', - function(SubtitledHtmlObjectFactory, UrlInterpolationService) { +angular.module('oppia').directive('outcomeFeedbackEditor', [ + 'UrlInterpolationService', + function(UrlInterpolationService) { return { restrict: 'E', scope: {}, diff --git a/core/templates/dev/head/components/state-directives/response-header/response-header.directive.ts b/core/templates/dev/head/components/state-directives/response-header/response-header.directive.ts index 579c2726eb20..cadb420b03b5 100644 --- a/core/templates/dev/head/components/state-directives/response-header/response-header.directive.ts +++ b/core/templates/dev/head/components/state-directives/response-header/response-header.directive.ts @@ -25,9 +25,7 @@ require( 'state-property.service.ts'); require('services/EditabilityService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('responseHeader', [ +angular.module('oppia').directive('responseHeader', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/components/state-directives/rule-editor/rule-editor.directive.ts b/core/templates/dev/head/components/state-directives/rule-editor/rule-editor.directive.ts index eeff61f7a758..aaef98c849eb 100644 --- a/core/templates/dev/head/components/state-directives/rule-editor/rule-editor.directive.ts +++ b/core/templates/dev/head/components/state-directives/rule-editor/rule-editor.directive.ts @@ -34,9 +34,7 @@ var DEFAULT_OBJECT_VALUES = require('objects/object_defaults.json'); // to a rule. It also includes 'Cancel' and 'Save Answer' buttons which call // respective 'onCancelRuleEdit' and 'onSaveRule' callbacks when called. These // buttons only show up if 'isEditingRuleInline' is true. -var oppia = require('AppInit.ts').module; - -oppia.directive('ruleEditor', [ +angular.module('oppia').directive('ruleEditor', [ '$log', 'UrlInterpolationService', function($log, UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/components/state-directives/rule-editor/rule-type-selector.directive.ts b/core/templates/dev/head/components/state-directives/rule-editor/rule-type-selector.directive.ts index 609b9d5d1ecd..a433ed535981 100644 --- a/core/templates/dev/head/components/state-directives/rule-editor/rule-type-selector.directive.ts +++ b/core/templates/dev/head/components/state-directives/rule-editor/rule-type-selector.directive.ts @@ -23,9 +23,7 @@ require( 'components/state-editor/state-editor-properties-services/' + 'state-property.service.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('ruleTypeSelector', [function() { +angular.module('oppia').directive('ruleTypeSelector', [function() { return { restrict: 'E', scope: {}, diff --git a/core/templates/dev/head/components/state-directives/solution-editor/solution-editor.directive.ts b/core/templates/dev/head/components/state-directives/solution-editor/solution-editor.directive.ts index 96149cc90fb2..aabbd163c411 100644 --- a/core/templates/dev/head/components/state-directives/solution-editor/solution-editor.directive.ts +++ b/core/templates/dev/head/components/state-directives/solution-editor/solution-editor.directive.ts @@ -36,19 +36,16 @@ require('services/AlertsService.ts'); require('services/ContextService.ts'); require('services/ExplorationHtmlFormatterService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('solutionEditor', [ - '$uibModal', 'AlertsService', 'ContextService', - 'ExplorationHtmlFormatterService', 'SolutionObjectFactory', - 'SolutionVerificationService', 'StateCustomizationArgsService', - 'StateEditorService', 'StateInteractionIdService', - 'StateSolutionService', 'UrlInterpolationService', - function($uibModal, AlertsService, ContextService, - ExplorationHtmlFormatterService, SolutionObjectFactory, - SolutionVerificationService, StateCustomizationArgsService, - StateEditorService, StateInteractionIdService, - StateSolutionService, UrlInterpolationService) { +angular.module('oppia').directive('solutionEditor', [ + 'ExplorationHtmlFormatterService', + 'StateCustomizationArgsService', + 'StateInteractionIdService', + 'UrlInterpolationService', + function( + ExplorationHtmlFormatterService, + StateCustomizationArgsService, + StateInteractionIdService, + UrlInterpolationService) { return { restrict: 'E', scope: {}, diff --git a/core/templates/dev/head/components/state-directives/solution-editor/solution-explanation-editor.directive.ts b/core/templates/dev/head/components/state-directives/solution-editor/solution-explanation-editor.directive.ts index 9cf8be42ba87..65a5290fe90c 100644 --- a/core/templates/dev/head/components/state-directives/solution-editor/solution-explanation-editor.directive.ts +++ b/core/templates/dev/head/components/state-directives/solution-editor/solution-explanation-editor.directive.ts @@ -22,11 +22,9 @@ require( 'state-property.service.ts'); require('services/EditabilityService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('solutionExplanationEditor', [ - 'StateSolutionService', 'UrlInterpolationService', - function(StateSolutionService, UrlInterpolationService) { +angular.module('oppia').directive('solutionExplanationEditor', [ + 'UrlInterpolationService', + function(UrlInterpolationService) { return { restrict: 'E', scope: {}, diff --git a/core/templates/dev/head/components/state-editor/state-content-editor/state-content-editor.directive.ts b/core/templates/dev/head/components/state-editor/state-content-editor/state-content-editor.directive.ts index 6050aa3a93a5..76b870831155 100644 --- a/core/templates/dev/head/components/state-editor/state-content-editor/state-content-editor.directive.ts +++ b/core/templates/dev/head/components/state-editor/state-content-editor/state-content-editor.directive.ts @@ -28,9 +28,7 @@ require( 'state-property.service.ts'); require('services/EditabilityService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('stateContentEditor', [ +angular.module('oppia').directive('stateContentEditor', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-content.service.ts b/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-content.service.ts index 204092414db9..ec782881d6f4 100644 --- a/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-content.service.ts +++ b/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-content.service.ts @@ -17,9 +17,7 @@ */ // TODO(sll): Add validation. -var oppia = require('AppInit.ts').module; - -oppia.factory('StateContentService', [ +angular.module('oppia').factory('StateContentService', [ 'StatePropertyService', function(StatePropertyService) { var child = Object.create(StatePropertyService); child.setterMethodKey = 'saveStateContent'; diff --git a/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-customization-args.service.ts b/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-customization-args.service.ts index 750fa1399823..9335dc5e2159 100644 --- a/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-customization-args.service.ts +++ b/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-customization-args.service.ts @@ -19,9 +19,7 @@ */ // TODO(sll): Add validation. -var oppia = require('AppInit.ts').module; - -oppia.factory('StateCustomizationArgsService', [ +angular.module('oppia').factory('StateCustomizationArgsService', [ 'StatePropertyService', function(StatePropertyService) { var child = Object.create(StatePropertyService); child.setterMethodKey = 'saveInteractionCustomizationArgs'; diff --git a/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-editor.service.ts b/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-editor.service.ts index 1c7ac4e8d767..ba1155a6ff9c 100644 --- a/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-editor.service.ts +++ b/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-editor.service.ts @@ -21,9 +21,7 @@ require( 'pages/exploration-editor-page/editor-tab/services/' + 'solution-validity.service.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('StateEditorService', [ +angular.module('oppia').factory('StateEditorService', [ '$log', 'SolutionValidityService', function( $log, SolutionValidityService) { diff --git a/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-hints.service.ts b/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-hints.service.ts index 442d2dd36411..a2614187ebb9 100644 --- a/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-hints.service.ts +++ b/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-hints.service.ts @@ -16,9 +16,7 @@ * @fileoverview A data service that stores the current interaction hints. */ -var oppia = require('AppInit.ts').module; - -oppia.factory('StateHintsService', [ +angular.module('oppia').factory('StateHintsService', [ 'StatePropertyService', function(StatePropertyService) { var child = Object.create(StatePropertyService); child.setterMethodKey = 'saveHints'; diff --git a/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-interaction-id.service.ts b/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-interaction-id.service.ts index bc05a2b0585c..1cb7d6866526 100644 --- a/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-interaction-id.service.ts +++ b/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-interaction-id.service.ts @@ -17,9 +17,7 @@ */ // TODO(sll): Add validation. -var oppia = require('AppInit.ts').module; - -oppia.factory('StateInteractionIdService', [ +angular.module('oppia').factory('StateInteractionIdService', [ 'StatePropertyService', function(StatePropertyService) { var child = Object.create(StatePropertyService); child.setterMethodKey = 'saveInteractionId'; diff --git a/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-param-changes.service.ts b/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-param-changes.service.ts index 2cf446e7043f..99aa42f75636 100644 --- a/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-param-changes.service.ts +++ b/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-param-changes.service.ts @@ -18,9 +18,7 @@ */ // TODO(sll): Add validation. -var oppia = require('AppInit.ts').module; - -oppia.factory('StateParamChangesService', [ +angular.module('oppia').factory('StateParamChangesService', [ 'StatePropertyService', function(StatePropertyService) { var child = Object.create(StatePropertyService); child.setterMethodKey = 'saveStateParamChanges'; diff --git a/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-property.service.ts b/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-property.service.ts index edba44594ea9..2478266442f5 100644 --- a/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-property.service.ts +++ b/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-property.service.ts @@ -18,11 +18,9 @@ require('services/AlertsService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('StatePropertyService', [ - '$log', 'AlertsService', - function($log, AlertsService) { +angular.module('oppia').factory('StatePropertyService', [ + 'AlertsService', + function(AlertsService) { // Public base API for data services corresponding to state properties // (interaction id, content, etc.) // WARNING: This should be initialized only in the context of the state diff --git a/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-recorded-voiceovers.service.ts b/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-recorded-voiceovers.service.ts index 9cbe67e2314f..4709973a1f63 100644 --- a/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-recorded-voiceovers.service.ts +++ b/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-recorded-voiceovers.service.ts @@ -21,9 +21,7 @@ require( 'components/state-editor/state-editor-properties-services/' + 'state-property.service.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('StateRecordedVoiceoversService', [ +angular.module('oppia').factory('StateRecordedVoiceoversService', [ 'StatePropertyService', function(StatePropertyService) { var child = Object.create(StatePropertyService); child.setterMethodKey = 'saveRecordedVoiceovers'; diff --git a/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-solicit-answer-details.service.ts b/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-solicit-answer-details.service.ts index 2a7af98a24f5..6d4c5faba6a4 100644 --- a/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-solicit-answer-details.service.ts +++ b/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-solicit-answer-details.service.ts @@ -20,9 +20,7 @@ require( 'components/state-editor/state-editor-properties-services/' + 'state-property.service.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('StateSolicitAnswerDetailsService', [ +angular.module('oppia').factory('StateSolicitAnswerDetailsService', [ 'StatePropertyService', function(StatePropertyService) { var child = Object.create(StatePropertyService); child.setterMethodKey = 'saveSolicitAnswerDetails'; diff --git a/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-solution.service.ts b/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-solution.service.ts index 976e7ebf0549..f480ee0930bf 100644 --- a/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-solution.service.ts +++ b/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-solution.service.ts @@ -16,9 +16,7 @@ * @fileoverview A data service that stores the current interaction solution. */ -var oppia = require('AppInit.ts').module; - -oppia.factory('StateSolutionService', [ +angular.module('oppia').factory('StateSolutionService', [ 'StatePropertyService', function(StatePropertyService) { var child = Object.create(StatePropertyService); child.setterMethodKey = 'saveSolution'; diff --git a/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-written-translations.service.ts b/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-written-translations.service.ts index 46ce1a1b2324..c2bc9ec9efa8 100644 --- a/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-written-translations.service.ts +++ b/core/templates/dev/head/components/state-editor/state-editor-properties-services/state-written-translations.service.ts @@ -16,9 +16,7 @@ * @fileoverview A data service that stores the written translations. */ -var oppia = require('AppInit.ts').module; - -oppia.factory('StateWrittenTranslationsService', [ +angular.module('oppia').factory('StateWrittenTranslationsService', [ 'StatePropertyService', function(StatePropertyService) { var child = Object.create(StatePropertyService); child.setterMethodKey = 'saveWrittenTranslations'; diff --git a/core/templates/dev/head/components/state-editor/state-editor.constants.ts b/core/templates/dev/head/components/state-editor/state-editor.constants.ts index 0a5feb08472f..fc881fc58872 100644 --- a/core/templates/dev/head/components/state-editor/state-editor.constants.ts +++ b/core/templates/dev/head/components/state-editor/state-editor.constants.ts @@ -16,7 +16,6 @@ * @fileoverview Constants for the state editor directive. */ -var oppia = require('AppInit.ts').module; - -oppia.constant('INFO_MESSAGE_SOLUTION_IS_INVALID_FOR_QUESTION', +angular.module('oppia').constant( + 'INFO_MESSAGE_SOLUTION_IS_INVALID_FOR_QUESTION', 'The current solution does not correspond to a correct answer.'); diff --git a/core/templates/dev/head/components/state-editor/state-editor.directive.ts b/core/templates/dev/head/components/state-editor/state-editor.directive.ts index 5ab024e3d6c1..550cef417eab 100644 --- a/core/templates/dev/head/components/state-editor/state-editor.directive.ts +++ b/core/templates/dev/head/components/state-editor/state-editor.directive.ts @@ -42,9 +42,7 @@ require( 'components/state-editor/state-editor-properties-services/' + 'state-solicit-answer-details.service.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('stateEditor', [ +angular.module('oppia').directive('stateEditor', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/components/state-editor/state-hints-editor/state-hints-editor.directive.ts b/core/templates/dev/head/components/state-editor/state-hints-editor/state-hints-editor.directive.ts index c3d97a85cf22..019156964421 100644 --- a/core/templates/dev/head/components/state-editor/state-hints-editor/state-hints-editor.directive.ts +++ b/core/templates/dev/head/components/state-editor/state-hints-editor/state-hints-editor.directive.ts @@ -39,9 +39,7 @@ require('services/AlertsService.ts'); require('services/EditabilityService.ts'); require('services/GenerateContentIdService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('stateHintsEditor', [ +angular.module('oppia').directive('stateHintsEditor', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/components/state-editor/state-interaction-editor/state-interaction-editor.directive.ts b/core/templates/dev/head/components/state-editor/state-interaction-editor/state-interaction-editor.directive.ts index 6e5aef4f900d..38e41b031897 100644 --- a/core/templates/dev/head/components/state-editor/state-interaction-editor/state-interaction-editor.directive.ts +++ b/core/templates/dev/head/components/state-editor/state-interaction-editor/state-interaction-editor.directive.ts @@ -49,9 +49,7 @@ require('services/EditabilityService.ts'); require('services/ExplorationHtmlFormatterService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('stateInteractionEditor', [ +angular.module('oppia').directive('stateInteractionEditor', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/components/state-editor/state-responses-editor/state-responses.directive.ts b/core/templates/dev/head/components/state-editor/state-responses-editor/state-responses.directive.ts index 87ef81012c71..f2fc6cf7ab70 100644 --- a/core/templates/dev/head/components/state-editor/state-responses-editor/state-responses.directive.ts +++ b/core/templates/dev/head/components/state-editor/state-responses-editor/state-responses.directive.ts @@ -67,9 +67,7 @@ require('services/ExplorationHtmlFormatterService.ts'); require('services/GenerateContentIdService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('stateResponses', [ +angular.module('oppia').directive('stateResponses', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/components/state-editor/state-solution-editor/state-solution-editor.directive.ts b/core/templates/dev/head/components/state-editor/state-solution-editor/state-solution-editor.directive.ts index dc4c5223e764..07593423a497 100644 --- a/core/templates/dev/head/components/state-editor/state-solution-editor/state-solution-editor.directive.ts +++ b/core/templates/dev/head/components/state-editor/state-solution-editor/state-solution-editor.directive.ts @@ -58,9 +58,7 @@ require('services/GenerateContentIdService.ts'); require('components/state-editor/state-editor.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('stateSolutionEditor', [ +angular.module('oppia').directive('stateSolutionEditor', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/components/summary-tile/collection-summary-tile.constants.ts b/core/templates/dev/head/components/summary-tile/collection-summary-tile.constants.ts index 9136fcb2152a..c70ce20356ff 100644 --- a/core/templates/dev/head/components/summary-tile/collection-summary-tile.constants.ts +++ b/core/templates/dev/head/components/summary-tile/collection-summary-tile.constants.ts @@ -16,9 +16,7 @@ * @fileoverview Constants for summary tile for collections. */ -var oppia = require('AppInit.ts').module; - -oppia.constant( +angular.module('oppia').constant( 'COLLECTION_VIEWER_URL', '/collection/'); -oppia.constant( +angular.module('oppia').constant( 'COLLECTION_EDITOR_URL', '/collection_editor/create/'); diff --git a/core/templates/dev/head/components/summary-tile/collection-summary-tile.directive.ts b/core/templates/dev/head/components/summary-tile/collection-summary-tile.directive.ts index dcb74c535164..5ad801e0a9ca 100644 --- a/core/templates/dev/head/components/summary-tile/collection-summary-tile.directive.ts +++ b/core/templates/dev/head/components/summary-tile/collection-summary-tile.directive.ts @@ -25,9 +25,7 @@ require('services/UserService.ts'); require('components/summary-tile/collection-summary-tile.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('collectionSummaryTile', [ +angular.module('oppia').directive('collectionSummaryTile', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/components/summary-tile/exploration-summary-tile.directive.ts b/core/templates/dev/head/components/summary-tile/exploration-summary-tile.directive.ts index 166ec56a0a7c..e915e2a87e89 100644 --- a/core/templates/dev/head/components/summary-tile/exploration-summary-tile.directive.ts +++ b/core/templates/dev/head/components/summary-tile/exploration-summary-tile.directive.ts @@ -29,9 +29,7 @@ require('services/UserService.ts'); require('services/contextual/UrlService.ts'); require('services/contextual/WindowDimensionsService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('explorationSummaryTile', [ +angular.module('oppia').directive('explorationSummaryTile', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/components/summary-tile/story-summary-tile.directive.ts b/core/templates/dev/head/components/summary-tile/story-summary-tile.directive.ts index 0e8967b36b7d..909cc8f10533 100644 --- a/core/templates/dev/head/components/summary-tile/story-summary-tile.directive.ts +++ b/core/templates/dev/head/components/summary-tile/story-summary-tile.directive.ts @@ -18,9 +18,7 @@ require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('storySummaryTile', [ +angular.module('oppia').directive('storySummaryTile', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/components/version-diff-visualization/codemirror-mergeview.directive.ts b/core/templates/dev/head/components/version-diff-visualization/codemirror-mergeview.directive.ts index a5a88d57b763..d9fac4e58442 100644 --- a/core/templates/dev/head/components/version-diff-visualization/codemirror-mergeview.directive.ts +++ b/core/templates/dev/head/components/version-diff-visualization/codemirror-mergeview.directive.ts @@ -16,9 +16,7 @@ * @fileoverview Directive for the codemirror mergeview component. */ -var oppia = require('AppInit.ts').module; - -oppia.directive('codemirrorMergeview', [ +angular.module('oppia').directive('codemirrorMergeview', [ function() { return { restrict: 'E', diff --git a/core/templates/dev/head/components/version-diff-visualization/version-diff-visualization.directive.ts b/core/templates/dev/head/components/version-diff-visualization/version-diff-visualization.directive.ts index 535fb101daa7..cefdc05c3c6d 100644 --- a/core/templates/dev/head/components/version-diff-visualization/version-diff-visualization.directive.ts +++ b/core/templates/dev/head/components/version-diff-visualization/version-diff-visualization.directive.ts @@ -23,9 +23,7 @@ require( require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('versionDiffVisualization', [ +angular.module('oppia').directive('versionDiffVisualization', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/directives/angular-html-bind.directive.ts b/core/templates/dev/head/directives/angular-html-bind.directive.ts index 3bf3095a82ae..dbea6b41230b 100644 --- a/core/templates/dev/head/directives/angular-html-bind.directive.ts +++ b/core/templates/dev/head/directives/angular-html-bind.directive.ts @@ -20,24 +20,23 @@ // HTML bind directive that trusts the value it is given and also evaluates // custom directive tags in the provided value. -var oppia = require('AppInit.ts').module; - -oppia.directive('angularHtmlBind', ['$compile', function($compile) { - return { - restrict: 'E', - link: function(scope, elm, attrs) { - // Clean up old scopes if the html changes. - // Reference: https://stackoverflow.com/a/42927814 - var newScope; - scope.$watch(attrs.htmlData, function(newValue) { - if (newScope) { - newScope.$destroy(); - } - elm.empty(); - newScope = scope.$new(); - elm.html(newValue); - $compile(elm.contents())(newScope); - }); - } - }; -}]); +angular.module('oppia').directive('angularHtmlBind', [ + '$compile', function($compile) { + return { + restrict: 'E', + link: function(scope, elm, attrs) { + // Clean up old scopes if the html changes. + // Reference: https://stackoverflow.com/a/42927814 + var newScope; + scope.$watch(attrs.htmlData, function(newValue) { + if (newScope) { + newScope.$destroy(); + } + elm.empty(); + newScope = scope.$new(); + elm.html(newValue); + $compile(elm.contents())(newScope); + }); + } + }; + }]); diff --git a/core/templates/dev/head/directives/focus-on.directive.ts b/core/templates/dev/head/directives/focus-on.directive.ts index a69f58588465..b4b6ceac1db2 100644 --- a/core/templates/dev/head/directives/focus-on.directive.ts +++ b/core/templates/dev/head/directives/focus-on.directive.ts @@ -18,11 +18,9 @@ * NB: Reusable component directives should go in the components/ folder. */ -var oppia = require('AppInit.ts').module; - // When set as an attr of an element, moves focus to that element // when a 'focusOn' event is broadcast. -oppia.directive('focusOn', [ +angular.module('oppia').directive('focusOn', [ 'LABEL_FOR_CLEARING_FOCUS', function(LABEL_FOR_CLEARING_FOCUS) { return function(scope, elt, attrs) { scope.$on('focusOn', function(e, name) { diff --git a/core/templates/dev/head/directives/mathjax-bind.directive.ts b/core/templates/dev/head/directives/mathjax-bind.directive.ts index 0c972bdc2a33..eb5516d6d385 100644 --- a/core/templates/dev/head/directives/mathjax-bind.directive.ts +++ b/core/templates/dev/head/directives/mathjax-bind.directive.ts @@ -18,9 +18,7 @@ * NB: Reusable component directives should go in the components/ folder. */ -var oppia = require('AppInit.ts').module; - -oppia.directive('mathjaxBind', [function() { +angular.module('oppia').directive('mathjaxBind', [function() { return { restrict: 'E', controller: [ diff --git a/core/templates/dev/head/domain/classifier/AnswerClassificationResultObjectFactory.ts b/core/templates/dev/head/domain/classifier/AnswerClassificationResultObjectFactory.ts index 10f3de7d1444..097e3a9436fd 100644 --- a/core/templates/dev/head/domain/classifier/AnswerClassificationResultObjectFactory.ts +++ b/core/templates/dev/head/domain/classifier/AnswerClassificationResultObjectFactory.ts @@ -54,8 +54,6 @@ export class AnswerClassificationResultObjectFactory { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'AnswerClassificationResultObjectFactory', downgradeInjectable(AnswerClassificationResultObjectFactory)); diff --git a/core/templates/dev/head/domain/classifier/ClassifierObjectFactory.ts b/core/templates/dev/head/domain/classifier/ClassifierObjectFactory.ts index 5503ac26b334..7c9090a79787 100644 --- a/core/templates/dev/head/domain/classifier/ClassifierObjectFactory.ts +++ b/core/templates/dev/head/domain/classifier/ClassifierObjectFactory.ts @@ -50,8 +50,6 @@ export class ClassifierObjectFactory { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'ClassifierObjectFactory', downgradeInjectable(ClassifierObjectFactory)); diff --git a/core/templates/dev/head/domain/classifier/PredictionResultObjectFactory.ts b/core/templates/dev/head/domain/classifier/PredictionResultObjectFactory.ts index ed6367e2e68b..bdf1d102cfbe 100644 --- a/core/templates/dev/head/domain/classifier/PredictionResultObjectFactory.ts +++ b/core/templates/dev/head/domain/classifier/PredictionResultObjectFactory.ts @@ -55,8 +55,6 @@ export class PredictionResultObjectFactory extends PredictionResult { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'PredictionResultObjectFactory', downgradeInjectable(PredictionResultObjectFactory)); diff --git a/core/templates/dev/head/domain/collection/CollectionNodeObjectFactory.ts b/core/templates/dev/head/domain/collection/CollectionNodeObjectFactory.ts index 7a3372db6fee..0459807b9763 100644 --- a/core/templates/dev/head/domain/collection/CollectionNodeObjectFactory.ts +++ b/core/templates/dev/head/domain/collection/CollectionNodeObjectFactory.ts @@ -17,9 +17,7 @@ * collection node domain objects. */ -var oppia = require('AppInit.ts').module; - -oppia.factory('CollectionNodeObjectFactory', [ +angular.module('oppia').factory('CollectionNodeObjectFactory', [ 'ACTIVITY_STATUS_PRIVATE', function(ACTIVITY_STATUS_PRIVATE) { var CollectionNode = function(collectionNodeBackendObject) { diff --git a/core/templates/dev/head/domain/collection/CollectionObjectFactory.ts b/core/templates/dev/head/domain/collection/CollectionObjectFactory.ts index 160204dc1196..ef1e974ade51 100644 --- a/core/templates/dev/head/domain/collection/CollectionObjectFactory.ts +++ b/core/templates/dev/head/domain/collection/CollectionObjectFactory.ts @@ -19,9 +19,7 @@ require('domain/collection/CollectionNodeObjectFactory.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('CollectionObjectFactory', [ +angular.module('oppia').factory('CollectionObjectFactory', [ 'CollectionNodeObjectFactory', function(CollectionNodeObjectFactory) { var Collection = function(collectionBackendObject) { diff --git a/core/templates/dev/head/domain/collection/CollectionPlaythroughObjectFactory.ts b/core/templates/dev/head/domain/collection/CollectionPlaythroughObjectFactory.ts index b8f36e6f8c0f..8711826438bd 100644 --- a/core/templates/dev/head/domain/collection/CollectionPlaythroughObjectFactory.ts +++ b/core/templates/dev/head/domain/collection/CollectionPlaythroughObjectFactory.ts @@ -95,8 +95,6 @@ export class CollectionPlaythroughObjectFactory { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'CollectionPlaythroughObjectFactory', downgradeInjectable(CollectionPlaythroughObjectFactory)); diff --git a/core/templates/dev/head/domain/collection/CollectionRightsBackendApiService.ts b/core/templates/dev/head/domain/collection/CollectionRightsBackendApiService.ts index 4803f0adc165..46392c0d34fe 100644 --- a/core/templates/dev/head/domain/collection/CollectionRightsBackendApiService.ts +++ b/core/templates/dev/head/domain/collection/CollectionRightsBackendApiService.ts @@ -18,12 +18,10 @@ require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('CollectionRightsBackendApiService', [ - '$http', '$log', '$q', 'UrlInterpolationService', +angular.module('oppia').factory('CollectionRightsBackendApiService', [ + '$http', '$q', 'UrlInterpolationService', 'COLLECTION_RIGHTS_URL_TEMPLATE', - function($http, $log, $q, UrlInterpolationService, + function($http, $q, UrlInterpolationService, COLLECTION_RIGHTS_URL_TEMPLATE) { // Maps previously loaded collection rights to their IDs. var collectionRightsCache = {}; diff --git a/core/templates/dev/head/domain/collection/CollectionRightsObjectFactory.ts b/core/templates/dev/head/domain/collection/CollectionRightsObjectFactory.ts index 23c3b1f46855..fffaf7bb9e13 100644 --- a/core/templates/dev/head/domain/collection/CollectionRightsObjectFactory.ts +++ b/core/templates/dev/head/domain/collection/CollectionRightsObjectFactory.ts @@ -146,8 +146,6 @@ export class CollectionRightsObjectFactory { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'CollectionRightsObjectFactory', downgradeInjectable(CollectionRightsObjectFactory)); diff --git a/core/templates/dev/head/domain/collection/CollectionUpdateService.ts b/core/templates/dev/head/domain/collection/CollectionUpdateService.ts index 168ac0b48096..e3e52363faf9 100644 --- a/core/templates/dev/head/domain/collection/CollectionUpdateService.ts +++ b/core/templates/dev/head/domain/collection/CollectionUpdateService.ts @@ -25,30 +25,25 @@ require('domain/editor/undo_redo/UndoRedoService.ts'); require('domain/collection/collection-domain.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('CollectionUpdateService', [ +angular.module('oppia').factory('CollectionUpdateService', [ 'ChangeObjectFactory', 'CollectionNodeObjectFactory', 'UndoRedoService', - 'CMD_ADD_COLLECTION_NODE', 'CMD_ADD_COLLECTION_SKILL', - 'CMD_DELETE_COLLECTION_NODE', 'CMD_DELETE_COLLECTION_SKILL', - 'CMD_EDIT_COLLECTION_NODE_PROPERTY', 'CMD_EDIT_COLLECTION_PROPERTY', - 'CMD_SWAP_COLLECTION_NODES', 'COLLECTION_NODE_PROPERTY_ACQUIRED_SKILL_IDS', - 'COLLECTION_NODE_PROPERTY_PREREQUISITE_SKILL_IDS', + 'CMD_ADD_COLLECTION_NODE', + 'CMD_DELETE_COLLECTION_NODE', + 'CMD_EDIT_COLLECTION_NODE_PROPERTY', + 'CMD_EDIT_COLLECTION_PROPERTY', 'CMD_SWAP_COLLECTION_NODES', 'COLLECTION_PROPERTY_CATEGORY', 'COLLECTION_PROPERTY_LANGUAGE_CODE', 'COLLECTION_PROPERTY_OBJECTIVE', 'COLLECTION_PROPERTY_TAGS', 'COLLECTION_PROPERTY_TITLE', function( ChangeObjectFactory, CollectionNodeObjectFactory, UndoRedoService, - CMD_ADD_COLLECTION_NODE, CMD_ADD_COLLECTION_SKILL, - CMD_DELETE_COLLECTION_NODE, CMD_DELETE_COLLECTION_SKILL, + CMD_ADD_COLLECTION_NODE, + CMD_DELETE_COLLECTION_NODE, CMD_EDIT_COLLECTION_NODE_PROPERTY, CMD_EDIT_COLLECTION_PROPERTY, CMD_SWAP_COLLECTION_NODES, - COLLECTION_NODE_PROPERTY_ACQUIRED_SKILL_IDS, - COLLECTION_NODE_PROPERTY_PREREQUISITE_SKILL_IDS, COLLECTION_PROPERTY_CATEGORY, COLLECTION_PROPERTY_LANGUAGE_CODE, - COLLECTION_PROPERTY_OBJECTIVE, COLLECTION_PROPERTY_TAGS, - COLLECTION_PROPERTY_TITLE) { + COLLECTION_PROPERTY_OBJECTIVE, + COLLECTION_PROPERTY_TAGS, COLLECTION_PROPERTY_TITLE) { // Creates a change using an apply function, reverse function, a change // command and related parameters. The change is applied to a given // collection. diff --git a/core/templates/dev/head/domain/collection/CollectionValidationService.ts b/core/templates/dev/head/domain/collection/CollectionValidationService.ts index 7f29ee8dabc1..0ab70f5a4ffb 100644 --- a/core/templates/dev/head/domain/collection/CollectionValidationService.ts +++ b/core/templates/dev/head/domain/collection/CollectionValidationService.ts @@ -22,11 +22,8 @@ require( 'pages/collection-editor-page/services/collection-linearizer.service.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('CollectionValidationService', [ - 'CollectionLinearizerService', - function(CollectionLinearizerService) { +angular.module('oppia').factory('CollectionValidationService', [ + function() { var _getNonexistentExplorationIds = function(collection) { return collection.getCollectionNodes().filter(function(collectionNode) { return !collectionNode.doesExplorationExist(); diff --git a/core/templates/dev/head/domain/collection/EditableCollectionBackendApiService.ts b/core/templates/dev/head/domain/collection/EditableCollectionBackendApiService.ts index e34fedb68ce7..c07546982f43 100644 --- a/core/templates/dev/head/domain/collection/EditableCollectionBackendApiService.ts +++ b/core/templates/dev/head/domain/collection/EditableCollectionBackendApiService.ts @@ -31,14 +31,12 @@ require('domain/utilities/UrlInterpolationService.ts'); // Discuss and decide whether this is a good approach and then remove this TODO // after deciding and acting upon the decision (which would mean implementing // it if it's agreed upon). -var oppia = require('AppInit.ts').module; - -oppia.factory('EditableCollectionBackendApiService', [ +angular.module('oppia').factory('EditableCollectionBackendApiService', [ '$http', '$q', 'ReadOnlyCollectionBackendApiService', - 'UrlInterpolationService', 'COLLECTION_DATA_URL_TEMPLATE', + 'UrlInterpolationService', 'EDITABLE_COLLECTION_DATA_URL_TEMPLATE', function($http, $q, ReadOnlyCollectionBackendApiService, - UrlInterpolationService, COLLECTION_DATA_URL_TEMPLATE, + UrlInterpolationService, EDITABLE_COLLECTION_DATA_URL_TEMPLATE) { var _fetchCollection = function( collectionId, successCallback, errorCallback) { diff --git a/core/templates/dev/head/domain/collection/GuestCollectionProgressObjectFactory.ts b/core/templates/dev/head/domain/collection/GuestCollectionProgressObjectFactory.ts index 1bf50932b557..85e5e13e121e 100644 --- a/core/templates/dev/head/domain/collection/GuestCollectionProgressObjectFactory.ts +++ b/core/templates/dev/head/domain/collection/GuestCollectionProgressObjectFactory.ts @@ -83,8 +83,6 @@ export class GuestCollectionProgressObjectFactory { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'GuestCollectionProgressObjectFactory', downgradeInjectable(GuestCollectionProgressObjectFactory)); diff --git a/core/templates/dev/head/domain/collection/GuestCollectionProgressService.ts b/core/templates/dev/head/domain/collection/GuestCollectionProgressService.ts index cc560be8433b..d9a3795fd83e 100644 --- a/core/templates/dev/head/domain/collection/GuestCollectionProgressService.ts +++ b/core/templates/dev/head/domain/collection/GuestCollectionProgressService.ts @@ -27,9 +27,7 @@ require('domain/collection/GuestCollectionProgressObjectFactory.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('GuestCollectionProgressService', [ +angular.module('oppia').factory('GuestCollectionProgressService', [ '$window', 'GuestCollectionProgressObjectFactory', function($window, GuestCollectionProgressObjectFactory) { var COLLECTION_STORAGE_KEY = 'collectionProgressStore_v1'; diff --git a/core/templates/dev/head/domain/collection/ReadOnlyCollectionBackendApiService.ts b/core/templates/dev/head/domain/collection/ReadOnlyCollectionBackendApiService.ts index 0040a05e8587..840b30579b19 100644 --- a/core/templates/dev/head/domain/collection/ReadOnlyCollectionBackendApiService.ts +++ b/core/templates/dev/head/domain/collection/ReadOnlyCollectionBackendApiService.ts @@ -23,13 +23,11 @@ require('domain/utilities/UrlInterpolationService.ts'); // separate CollectionDataService implementation which returns a local copy of // the collection instead. This file should not be included on the page in that // scenario. -var oppia = require('AppInit.ts').module; - -oppia.factory('ReadOnlyCollectionBackendApiService', [ - '$http', '$q', '$rootScope', 'UrlInterpolationService', +angular.module('oppia').factory('ReadOnlyCollectionBackendApiService', [ + '$http', '$q', 'UrlInterpolationService', 'COLLECTION_DATA_URL_TEMPLATE', function( - $http, $q, $rootScope, UrlInterpolationService, + $http, $q, UrlInterpolationService, COLLECTION_DATA_URL_TEMPLATE) { // Maps previously loaded collections to their IDs. var _collectionCache = []; diff --git a/core/templates/dev/head/domain/collection/SearchExplorationsBackendApiService.ts b/core/templates/dev/head/domain/collection/SearchExplorationsBackendApiService.ts index 6b0c5ee070dc..330582e6b5c5 100644 --- a/core/templates/dev/head/domain/collection/SearchExplorationsBackendApiService.ts +++ b/core/templates/dev/head/domain/collection/SearchExplorationsBackendApiService.ts @@ -19,13 +19,11 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/AlertsService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('SearchExplorationsBackendApiService', [ - '$http', '$q', 'AlertsService', 'UrlInterpolationService', +angular.module('oppia').factory('SearchExplorationsBackendApiService', [ + '$http', '$q', 'UrlInterpolationService', 'SEARCH_EXPLORATION_URL_TEMPLATE', function( - $http, $q, AlertsService, UrlInterpolationService, + $http, $q, UrlInterpolationService, SEARCH_EXPLORATION_URL_TEMPLATE) { var _fetchExplorations = function( searchQuery, successCallback, errorCallback) { diff --git a/core/templates/dev/head/domain/collection/collection-domain.constants.ts b/core/templates/dev/head/domain/collection/collection-domain.constants.ts index c5134133b0d8..02b2a0a643a3 100644 --- a/core/templates/dev/head/domain/collection/collection-domain.constants.ts +++ b/core/templates/dev/head/domain/collection/collection-domain.constants.ts @@ -21,22 +21,26 @@ // backend. // NOTE TO DEVELOPERS: the properties 'prerequisite_skills' and // 'acquired_skills' are deprecated. Do not use them. -var oppia = require('AppInit.ts').module; - -oppia.constant('CMD_ADD_COLLECTION_NODE', 'add_collection_node'); -oppia.constant('CMD_SWAP_COLLECTION_NODES', 'swap_nodes'); -oppia.constant('CMD_DELETE_COLLECTION_NODE', 'delete_collection_node'); -oppia.constant('CMD_EDIT_COLLECTION_PROPERTY', 'edit_collection_property'); -oppia.constant( +angular.module('oppia').constant( + 'CMD_ADD_COLLECTION_NODE', 'add_collection_node'); +angular.module('oppia').constant('CMD_SWAP_COLLECTION_NODES', 'swap_nodes'); +angular.module('oppia').constant( + 'CMD_DELETE_COLLECTION_NODE', 'delete_collection_node'); +angular.module('oppia').constant( + 'CMD_EDIT_COLLECTION_PROPERTY', 'edit_collection_property'); +angular.module('oppia').constant( 'CMD_EDIT_COLLECTION_NODE_PROPERTY', 'edit_collection_node_property'); -oppia.constant('COLLECTION_PROPERTY_TITLE', 'title'); -oppia.constant('COLLECTION_PROPERTY_CATEGORY', 'category'); -oppia.constant('COLLECTION_PROPERTY_OBJECTIVE', 'objective'); -oppia.constant('COLLECTION_PROPERTY_LANGUAGE_CODE', 'language_code'); -oppia.constant('COLLECTION_PROPERTY_TAGS', 'tags'); -oppia.constant('CMD_ADD_COLLECTION_SKILL', 'add_collection_skill'); -oppia.constant('CMD_DELETE_COLLECTION_SKILL', 'delete_collection_skill'); -oppia.constant( +angular.module('oppia').constant('COLLECTION_PROPERTY_TITLE', 'title'); +angular.module('oppia').constant('COLLECTION_PROPERTY_CATEGORY', 'category'); +angular.module('oppia').constant('COLLECTION_PROPERTY_OBJECTIVE', 'objective'); +angular.module('oppia').constant( + 'COLLECTION_PROPERTY_LANGUAGE_CODE', 'language_code'); +angular.module('oppia').constant('COLLECTION_PROPERTY_TAGS', 'tags'); +angular.module('oppia').constant( + 'CMD_ADD_COLLECTION_SKILL', 'add_collection_skill'); +angular.module('oppia').constant( + 'CMD_DELETE_COLLECTION_SKILL', 'delete_collection_skill'); +angular.module('oppia').constant( 'COLLECTION_NODE_PROPERTY_PREREQUISITE_SKILL_IDS', 'prerequisite_skill_ids'); -oppia.constant( +angular.module('oppia').constant( 'COLLECTION_NODE_PROPERTY_ACQUIRED_SKILL_IDS', 'acquired_skill_ids'); diff --git a/core/templates/dev/head/domain/creator_dashboard/CreatorDashboardBackendApiService.ts b/core/templates/dev/head/domain/creator_dashboard/CreatorDashboardBackendApiService.ts index 60ec29db2e53..d703d049cd3f 100644 --- a/core/templates/dev/head/domain/creator_dashboard/CreatorDashboardBackendApiService.ts +++ b/core/templates/dev/head/domain/creator_dashboard/CreatorDashboardBackendApiService.ts @@ -38,8 +38,6 @@ export class CreatorDashboardBackendApiService { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'CreatorDashboardBackendApiService', downgradeInjectable(CreatorDashboardBackendApiService)); diff --git a/core/templates/dev/head/domain/editor/editor-domain.constants.ts b/core/templates/dev/head/domain/editor/editor-domain.constants.ts index 6266ae1a25c5..2ca22890b220 100644 --- a/core/templates/dev/head/domain/editor/editor-domain.constants.ts +++ b/core/templates/dev/head/domain/editor/editor-domain.constants.ts @@ -16,7 +16,5 @@ * @fileoverview Constants for editor domain. */ -var oppia = require('AppInit.ts').module; - -oppia.constant( +angular.module('oppia').constant( 'EVENT_UNDO_REDO_SERVICE_CHANGE_APPLIED', 'undoRedoServiceChangeApplied'); diff --git a/core/templates/dev/head/domain/editor/undo_redo/BaseUndoRedoService.ts b/core/templates/dev/head/domain/editor/undo_redo/BaseUndoRedoService.ts index 49bac7873866..1ad2185598e5 100644 --- a/core/templates/dev/head/domain/editor/undo_redo/BaseUndoRedoService.ts +++ b/core/templates/dev/head/domain/editor/undo_redo/BaseUndoRedoService.ts @@ -24,9 +24,7 @@ require('domain/editor/editor-domain.constants.ts'); * instance of this service exists at a time, so multiple undo/redo stacks are * not currently supported. */ -var oppia = require('AppInit.ts').module; - -oppia.factory('BaseUndoRedoService', [ +angular.module('oppia').factory('BaseUndoRedoService', [ '$rootScope', 'EVENT_UNDO_REDO_SERVICE_CHANGE_APPLIED', function($rootScope, EVENT_UNDO_REDO_SERVICE_CHANGE_APPLIED) { var BaseUndoRedoService = {}; diff --git a/core/templates/dev/head/domain/editor/undo_redo/ChangeObjectFactory.ts b/core/templates/dev/head/domain/editor/undo_redo/ChangeObjectFactory.ts index 24d4678e049f..1892545c7c4b 100644 --- a/core/templates/dev/head/domain/editor/undo_redo/ChangeObjectFactory.ts +++ b/core/templates/dev/head/domain/editor/undo_redo/ChangeObjectFactory.ts @@ -119,6 +119,5 @@ export class ChangeObjectFactory { } } -var oppia = require('AppInit.ts').module; - -oppia.factory('ChangeObjectFactory', downgradeInjectable(ChangeObjectFactory)); +angular.module('oppia').factory( + 'ChangeObjectFactory', downgradeInjectable(ChangeObjectFactory)); diff --git a/core/templates/dev/head/domain/editor/undo_redo/QuestionUndoRedoService.ts b/core/templates/dev/head/domain/editor/undo_redo/QuestionUndoRedoService.ts index f01346def436..66937708a877 100644 --- a/core/templates/dev/head/domain/editor/undo_redo/QuestionUndoRedoService.ts +++ b/core/templates/dev/head/domain/editor/undo_redo/QuestionUndoRedoService.ts @@ -17,9 +17,7 @@ * domain object. */ -var oppia = require('AppInit.ts').module; - -oppia.factory('QuestionUndoRedoService', [ +angular.module('oppia').factory('QuestionUndoRedoService', [ 'BaseUndoRedoService', function(BaseUndoRedoService) { var child = Object.create(BaseUndoRedoService); child.init(); diff --git a/core/templates/dev/head/domain/editor/undo_redo/UndoRedoService.ts b/core/templates/dev/head/domain/editor/undo_redo/UndoRedoService.ts index 8b99dbb9f84f..1ef3244f5e5d 100644 --- a/core/templates/dev/head/domain/editor/undo_redo/UndoRedoService.ts +++ b/core/templates/dev/head/domain/editor/undo_redo/UndoRedoService.ts @@ -18,9 +18,7 @@ require('domain/editor/undo_redo/BaseUndoRedoService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('UndoRedoService', [ +angular.module('oppia').factory('UndoRedoService', [ 'BaseUndoRedoService', function(BaseUndoRedoService) { var child = Object.create(BaseUndoRedoService); child.init(); diff --git a/core/templates/dev/head/domain/exploration/AnswerGroupObjectFactory.ts b/core/templates/dev/head/domain/exploration/AnswerGroupObjectFactory.ts index 1e87d7ad18f0..710c4fe11522 100644 --- a/core/templates/dev/head/domain/exploration/AnswerGroupObjectFactory.ts +++ b/core/templates/dev/head/domain/exploration/AnswerGroupObjectFactory.ts @@ -20,9 +20,7 @@ require('domain/exploration/OutcomeObjectFactory.ts'); require('domain/exploration/RuleObjectFactory.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('AnswerGroupObjectFactory', [ +angular.module('oppia').factory('AnswerGroupObjectFactory', [ 'OutcomeObjectFactory', 'RuleObjectFactory', function(OutcomeObjectFactory, RuleObjectFactory) { var AnswerGroup = function( diff --git a/core/templates/dev/head/domain/exploration/AnswerStatsObjectFactory.ts b/core/templates/dev/head/domain/exploration/AnswerStatsObjectFactory.ts index 6ee50bd09173..00e350bcefa0 100644 --- a/core/templates/dev/head/domain/exploration/AnswerStatsObjectFactory.ts +++ b/core/templates/dev/head/domain/exploration/AnswerStatsObjectFactory.ts @@ -93,7 +93,5 @@ export class AnswerStatsObjectFactory { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'AnswerStatsObjectFactory', downgradeInjectable(AnswerStatsObjectFactory)); diff --git a/core/templates/dev/head/domain/exploration/EditableExplorationBackendApiService.ts b/core/templates/dev/head/domain/exploration/EditableExplorationBackendApiService.ts index 0cc9cf20d95d..521a548d67d1 100644 --- a/core/templates/dev/head/domain/exploration/EditableExplorationBackendApiService.ts +++ b/core/templates/dev/head/domain/exploration/EditableExplorationBackendApiService.ts @@ -21,20 +21,16 @@ require('domain/utilities/UrlInterpolationService.ts'); require('pages/exploration-player-page/exploration-player-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('EditableExplorationBackendApiService', [ +angular.module('oppia').factory('EditableExplorationBackendApiService', [ '$http', '$q', 'ReadOnlyExplorationBackendApiService', 'UrlInterpolationService', 'EDITABLE_EXPLORATION_DATA_DRAFT_URL_TEMPLATE', 'EDITABLE_EXPLORATION_DATA_URL_TEMPLATE', - 'EXPLORATION_DATA_URL_TEMPLATE', 'VOICEOVER_EXPLORATION_DATA_URL_TEMPLATE', function($http, $q, ReadOnlyExplorationBackendApiService, UrlInterpolationService, EDITABLE_EXPLORATION_DATA_DRAFT_URL_TEMPLATE, EDITABLE_EXPLORATION_DATA_URL_TEMPLATE, - EXPLORATION_DATA_URL_TEMPLATE, VOICEOVER_EXPLORATION_DATA_URL_TEMPLATE) { var _fetchExploration = function( explorationId, applyDraft, successCallback, errorCallback) { diff --git a/core/templates/dev/head/domain/exploration/ExplorationDraftObjectFactory.ts b/core/templates/dev/head/domain/exploration/ExplorationDraftObjectFactory.ts index 83686c4a6e74..4cccf77c849a 100644 --- a/core/templates/dev/head/domain/exploration/ExplorationDraftObjectFactory.ts +++ b/core/templates/dev/head/domain/exploration/ExplorationDraftObjectFactory.ts @@ -86,8 +86,6 @@ export class ExplorationDraftObjectFactory { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'ExplorationDraftObjectFactory', downgradeInjectable(ExplorationDraftObjectFactory)); diff --git a/core/templates/dev/head/domain/exploration/ExplorationObjectFactory.ts b/core/templates/dev/head/domain/exploration/ExplorationObjectFactory.ts index 4c1abba451b1..05293f1689f3 100644 --- a/core/templates/dev/head/domain/exploration/ExplorationObjectFactory.ts +++ b/core/templates/dev/head/domain/exploration/ExplorationObjectFactory.ts @@ -22,9 +22,7 @@ require('domain/exploration/ParamSpecsObjectFactory.ts'); require('domain/exploration/StatesObjectFactory.ts'); require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ExplorationObjectFactory', [ +angular.module('oppia').factory('ExplorationObjectFactory', [ '$log', 'ParamChangesObjectFactory', 'ParamSpecsObjectFactory', 'StatesObjectFactory', 'UrlInterpolationService', 'INTERACTION_DISPLAY_MODE_INLINE', diff --git a/core/templates/dev/head/domain/exploration/HintObjectFactory.ts b/core/templates/dev/head/domain/exploration/HintObjectFactory.ts index 09bca48ebbdf..80ee98a0dbee 100644 --- a/core/templates/dev/head/domain/exploration/HintObjectFactory.ts +++ b/core/templates/dev/head/domain/exploration/HintObjectFactory.ts @@ -19,9 +19,7 @@ require('domain/exploration/SubtitledHtmlObjectFactory.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('HintObjectFactory', [ +angular.module('oppia').factory('HintObjectFactory', [ 'SubtitledHtmlObjectFactory', function(SubtitledHtmlObjectFactory) { var Hint = function(hintContent) { diff --git a/core/templates/dev/head/domain/exploration/InteractionObjectFactory.ts b/core/templates/dev/head/domain/exploration/InteractionObjectFactory.ts index 20d61920ab70..6d503eb05b2f 100644 --- a/core/templates/dev/head/domain/exploration/InteractionObjectFactory.ts +++ b/core/templates/dev/head/domain/exploration/InteractionObjectFactory.ts @@ -22,9 +22,7 @@ require('domain/exploration/HintObjectFactory.ts'); require('domain/exploration/OutcomeObjectFactory.ts'); require('domain/exploration/SolutionObjectFactory.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('InteractionObjectFactory', [ +angular.module('oppia').factory('InteractionObjectFactory', [ 'AnswerGroupObjectFactory', 'HintObjectFactory', 'OutcomeObjectFactory', 'SolutionObjectFactory', function( diff --git a/core/templates/dev/head/domain/exploration/OutcomeObjectFactory.ts b/core/templates/dev/head/domain/exploration/OutcomeObjectFactory.ts index ae132178b18b..07d1181f787d 100644 --- a/core/templates/dev/head/domain/exploration/OutcomeObjectFactory.ts +++ b/core/templates/dev/head/domain/exploration/OutcomeObjectFactory.ts @@ -19,9 +19,7 @@ require('domain/exploration/SubtitledHtmlObjectFactory.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('OutcomeObjectFactory', [ +angular.module('oppia').factory('OutcomeObjectFactory', [ 'SubtitledHtmlObjectFactory', function(SubtitledHtmlObjectFactory) { var Outcome = function( diff --git a/core/templates/dev/head/domain/exploration/ParamChangeObjectFactory.ts b/core/templates/dev/head/domain/exploration/ParamChangeObjectFactory.ts index 0dd8c8586732..5084c54656b8 100644 --- a/core/templates/dev/head/domain/exploration/ParamChangeObjectFactory.ts +++ b/core/templates/dev/head/domain/exploration/ParamChangeObjectFactory.ts @@ -89,7 +89,5 @@ export class ParamChangeObjectFactory { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'ParamChangeObjectFactory', downgradeInjectable(ParamChangeObjectFactory)); diff --git a/core/templates/dev/head/domain/exploration/ParamChangesObjectFactory.ts b/core/templates/dev/head/domain/exploration/ParamChangesObjectFactory.ts index 0e3084f14122..a4b21bd30f92 100644 --- a/core/templates/dev/head/domain/exploration/ParamChangesObjectFactory.ts +++ b/core/templates/dev/head/domain/exploration/ParamChangesObjectFactory.ts @@ -19,9 +19,7 @@ require('domain/exploration/ParamChangeObjectFactory.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ParamChangesObjectFactory', [ +angular.module('oppia').factory('ParamChangesObjectFactory', [ 'ParamChangeObjectFactory', function(ParamChangeObjectFactory) { var createFromBackendList = function(paramChangeBackendList) { diff --git a/core/templates/dev/head/domain/exploration/ParamMetadataObjectFactory.ts b/core/templates/dev/head/domain/exploration/ParamMetadataObjectFactory.ts index bec7a660d560..242a0471c0da 100644 --- a/core/templates/dev/head/domain/exploration/ParamMetadataObjectFactory.ts +++ b/core/templates/dev/head/domain/exploration/ParamMetadataObjectFactory.ts @@ -19,9 +19,7 @@ require('pages/exploration-editor-page/services/parameter-metadata.service.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ParamMetadataObjectFactory', [ +angular.module('oppia').factory('ParamMetadataObjectFactory', [ 'PARAM_ACTION_GET', 'PARAM_ACTION_SET', function(PARAM_ACTION_GET, PARAM_ACTION_SET) { /** diff --git a/core/templates/dev/head/domain/exploration/ParamSpecObjectFactory.ts b/core/templates/dev/head/domain/exploration/ParamSpecObjectFactory.ts index ddafd3f4dd43..0f7d830976d1 100644 --- a/core/templates/dev/head/domain/exploration/ParamSpecObjectFactory.ts +++ b/core/templates/dev/head/domain/exploration/ParamSpecObjectFactory.ts @@ -19,9 +19,7 @@ require('domain/exploration/ParamTypeObjectFactory.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ParamSpecObjectFactory', [ +angular.module('oppia').factory('ParamSpecObjectFactory', [ 'ParamTypeObjectFactory', function(ParamTypeObjectFactory) { /** diff --git a/core/templates/dev/head/domain/exploration/ParamSpecsObjectFactory.ts b/core/templates/dev/head/domain/exploration/ParamSpecsObjectFactory.ts index 0639ccab682b..acf8e528b269 100644 --- a/core/templates/dev/head/domain/exploration/ParamSpecsObjectFactory.ts +++ b/core/templates/dev/head/domain/exploration/ParamSpecsObjectFactory.ts @@ -20,9 +20,7 @@ require('domain/exploration/ParamSpecObjectFactory.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ParamSpecsObjectFactory', [ +angular.module('oppia').factory('ParamSpecsObjectFactory', [ 'ParamSpecObjectFactory', function(ParamSpecObjectFactory) { /** diff --git a/core/templates/dev/head/domain/exploration/ParamTypeObjectFactory.ts b/core/templates/dev/head/domain/exploration/ParamTypeObjectFactory.ts index 5d9aca6a5e09..b9392d862b44 100644 --- a/core/templates/dev/head/domain/exploration/ParamTypeObjectFactory.ts +++ b/core/templates/dev/head/domain/exploration/ParamTypeObjectFactory.ts @@ -129,7 +129,5 @@ export class ParamTypeObjectFactory { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'ParamTypeObjectFactory', downgradeInjectable(ParamTypeObjectFactory)); diff --git a/core/templates/dev/head/domain/exploration/ReadOnlyExplorationBackendApiService.ts b/core/templates/dev/head/domain/exploration/ReadOnlyExplorationBackendApiService.ts index a9f0b394dab0..4d4ede1c152b 100644 --- a/core/templates/dev/head/domain/exploration/ReadOnlyExplorationBackendApiService.ts +++ b/core/templates/dev/head/domain/exploration/ReadOnlyExplorationBackendApiService.ts @@ -21,9 +21,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('pages/exploration-player-page/exploration-player-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ReadOnlyExplorationBackendApiService', [ +angular.module('oppia').factory('ReadOnlyExplorationBackendApiService', [ '$http', '$q', 'UrlInterpolationService', 'EXPLORATION_DATA_URL_TEMPLATE', 'EXPLORATION_VERSION_DATA_URL_TEMPLATE', function($http, $q, UrlInterpolationService, diff --git a/core/templates/dev/head/domain/exploration/RecordedVoiceoversObjectFactory.ts b/core/templates/dev/head/domain/exploration/RecordedVoiceoversObjectFactory.ts index 502b4717b837..25a868123366 100644 --- a/core/templates/dev/head/domain/exploration/RecordedVoiceoversObjectFactory.ts +++ b/core/templates/dev/head/domain/exploration/RecordedVoiceoversObjectFactory.ts @@ -19,12 +19,10 @@ require('domain/exploration/VoiceoverObjectFactory.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('RecordedVoiceoversObjectFactory', [ - 'VoiceoverObjectFactory', 'COMPONENT_NAME_FEEDBACK', +angular.module('oppia').factory('RecordedVoiceoversObjectFactory', [ + 'VoiceoverObjectFactory', function( - VoiceoverObjectFactory, COMPONENT_NAME_FEEDBACK) { + VoiceoverObjectFactory) { var RecordedVoiceovers = function(voiceoversMapping) { this.voiceoversMapping = voiceoversMapping; }; diff --git a/core/templates/dev/head/domain/exploration/RuleObjectFactory.ts b/core/templates/dev/head/domain/exploration/RuleObjectFactory.ts index cd6780ca0405..6b3978874486 100644 --- a/core/templates/dev/head/domain/exploration/RuleObjectFactory.ts +++ b/core/templates/dev/head/domain/exploration/RuleObjectFactory.ts @@ -56,8 +56,6 @@ export class RuleObjectFactory { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'RuleObjectFactory', downgradeInjectable(RuleObjectFactory)); diff --git a/core/templates/dev/head/domain/exploration/SolutionObjectFactory.ts b/core/templates/dev/head/domain/exploration/SolutionObjectFactory.ts index b70109aa598d..1f35e2f03978 100644 --- a/core/templates/dev/head/domain/exploration/SolutionObjectFactory.ts +++ b/core/templates/dev/head/domain/exploration/SolutionObjectFactory.ts @@ -24,9 +24,7 @@ require('filters/string-utility-filters/convert-to-plain-text.filter.ts'); require('services/ExplorationHtmlFormatterService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('SolutionObjectFactory', [ +angular.module('oppia').factory('SolutionObjectFactory', [ '$filter', 'ExplorationHtmlFormatterService', 'FractionObjectFactory', 'HtmlEscaperService', 'NumberWithUnitsObjectFactory', 'SubtitledHtmlObjectFactory', diff --git a/core/templates/dev/head/domain/exploration/StatesObjectFactory.ts b/core/templates/dev/head/domain/exploration/StatesObjectFactory.ts index 131dc7e78bfb..bf28d7751b4d 100644 --- a/core/templates/dev/head/domain/exploration/StatesObjectFactory.ts +++ b/core/templates/dev/head/domain/exploration/StatesObjectFactory.ts @@ -19,9 +19,7 @@ require('domain/state/StateObjectFactory.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('StatesObjectFactory', [ +angular.module('oppia').factory('StatesObjectFactory', [ 'StateObjectFactory', 'INTERACTION_SPECS', function(StateObjectFactory, INTERACTION_SPECS) { var States = function(states) { diff --git a/core/templates/dev/head/domain/exploration/SubtitledHtmlObjectFactory.ts b/core/templates/dev/head/domain/exploration/SubtitledHtmlObjectFactory.ts index d607bb4c34e0..6af4311a22ec 100644 --- a/core/templates/dev/head/domain/exploration/SubtitledHtmlObjectFactory.ts +++ b/core/templates/dev/head/domain/exploration/SubtitledHtmlObjectFactory.ts @@ -17,9 +17,7 @@ * domain objects. */ -var oppia = require('AppInit.ts').module; - -oppia.factory('SubtitledHtmlObjectFactory', [function() { +angular.module('oppia').factory('SubtitledHtmlObjectFactory', [function() { var SubtitledHtml = function(html, contentId) { this._html = html; this._contentId = contentId; diff --git a/core/templates/dev/head/domain/exploration/VoiceoverObjectFactory.ts b/core/templates/dev/head/domain/exploration/VoiceoverObjectFactory.ts index abf89deebcfc..3880daa440fe 100644 --- a/core/templates/dev/head/domain/exploration/VoiceoverObjectFactory.ts +++ b/core/templates/dev/head/domain/exploration/VoiceoverObjectFactory.ts @@ -76,7 +76,5 @@ export class VoiceoverObjectFactory { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'VoiceoverObjectFactory', downgradeInjectable(VoiceoverObjectFactory)); diff --git a/core/templates/dev/head/domain/exploration/WrittenTranslationObjectFactory.ts b/core/templates/dev/head/domain/exploration/WrittenTranslationObjectFactory.ts index 299bd99bc490..bbfc6b5869ac 100644 --- a/core/templates/dev/head/domain/exploration/WrittenTranslationObjectFactory.ts +++ b/core/templates/dev/head/domain/exploration/WrittenTranslationObjectFactory.ts @@ -68,8 +68,6 @@ export class WrittenTranslationObjectFactory { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'WrittenTranslationObjectFactory', downgradeInjectable(WrittenTranslationObjectFactory)); diff --git a/core/templates/dev/head/domain/exploration/WrittenTranslationsObjectFactory.ts b/core/templates/dev/head/domain/exploration/WrittenTranslationsObjectFactory.ts index 8f7c423b33cd..0df03bee36e5 100644 --- a/core/templates/dev/head/domain/exploration/WrittenTranslationsObjectFactory.ts +++ b/core/templates/dev/head/domain/exploration/WrittenTranslationsObjectFactory.ts @@ -20,9 +20,7 @@ require('domain/exploration/WrittenTranslationObjectFactory.ts'); require('domain/utilities/LanguageUtilService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('WrittenTranslationsObjectFactory', [ +angular.module('oppia').factory('WrittenTranslationsObjectFactory', [ 'WrittenTranslationObjectFactory', function(WrittenTranslationObjectFactory) { var WrittenTranslations = function(translationsMapping) { this.translationsMapping = translationsMapping; diff --git a/core/templates/dev/head/domain/feedback_message/FeedbackMessageSummaryObjectFactory.ts b/core/templates/dev/head/domain/feedback_message/FeedbackMessageSummaryObjectFactory.ts index f46178083346..9a11c12e09db 100644 --- a/core/templates/dev/head/domain/feedback_message/FeedbackMessageSummaryObjectFactory.ts +++ b/core/templates/dev/head/domain/feedback_message/FeedbackMessageSummaryObjectFactory.ts @@ -77,8 +77,6 @@ export class FeedbackMessageSummaryObjectFactory { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'FeedbackMessageSummaryObjectFactory', downgradeInjectable(FeedbackMessageSummaryObjectFactory)); diff --git a/core/templates/dev/head/domain/feedback_thread/FeedbackThreadObjectFactory.ts b/core/templates/dev/head/domain/feedback_thread/FeedbackThreadObjectFactory.ts index 650d5cc39361..ff62af03a176 100644 --- a/core/templates/dev/head/domain/feedback_thread/FeedbackThreadObjectFactory.ts +++ b/core/templates/dev/head/domain/feedback_thread/FeedbackThreadObjectFactory.ts @@ -80,8 +80,6 @@ export class FeedbackThreadObjectFactory { feedbackThreadBackendDict.thread_id); } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'FeedbackThreadObjectFactory', downgradeInjectable(FeedbackThreadObjectFactory)); diff --git a/core/templates/dev/head/domain/feedback_thread/FeedbackThreadSummaryObjectFactory.ts b/core/templates/dev/head/domain/feedback_thread/FeedbackThreadSummaryObjectFactory.ts index 85890409f471..af91b163c597 100644 --- a/core/templates/dev/head/domain/feedback_thread/FeedbackThreadSummaryObjectFactory.ts +++ b/core/templates/dev/head/domain/feedback_thread/FeedbackThreadSummaryObjectFactory.ts @@ -106,8 +106,6 @@ export class FeedbackThreadSummaryObjectFactory { feedbackThreadSummaryBackendDict.thread_id); } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'FeedbackThreadSummaryObjectFactory', downgradeInjectable(FeedbackThreadSummaryObjectFactory)); diff --git a/core/templates/dev/head/domain/learner_dashboard/LearnerDashboardActivityIdsObjectFactory.ts b/core/templates/dev/head/domain/learner_dashboard/LearnerDashboardActivityIdsObjectFactory.ts index 5780b79c7b33..4fb055fbdb4f 100644 --- a/core/templates/dev/head/domain/learner_dashboard/LearnerDashboardActivityIdsObjectFactory.ts +++ b/core/templates/dev/head/domain/learner_dashboard/LearnerDashboardActivityIdsObjectFactory.ts @@ -144,8 +144,6 @@ export class LearnerDashboardActivityIdsObjectFactory { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'LearnerDashboardActivityIdsObjectFactory', downgradeInjectable(LearnerDashboardActivityIdsObjectFactory)); diff --git a/core/templates/dev/head/domain/learner_dashboard/LearnerDashboardBackendApiService.ts b/core/templates/dev/head/domain/learner_dashboard/LearnerDashboardBackendApiService.ts index b0bba7644ba3..46b769d80054 100644 --- a/core/templates/dev/head/domain/learner_dashboard/LearnerDashboardBackendApiService.ts +++ b/core/templates/dev/head/domain/learner_dashboard/LearnerDashboardBackendApiService.ts @@ -38,8 +38,6 @@ export class LearnerDashboardBackendApiService { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'LearnerDashboardBackendApiService', downgradeInjectable(LearnerDashboardBackendApiService)); diff --git a/core/templates/dev/head/domain/learner_dashboard/LearnerDashboardIconsDirective.ts b/core/templates/dev/head/domain/learner_dashboard/LearnerDashboardIconsDirective.ts index 52ac980077b8..2860f2c6ec42 100644 --- a/core/templates/dev/head/domain/learner_dashboard/LearnerDashboardIconsDirective.ts +++ b/core/templates/dev/head/domain/learner_dashboard/LearnerDashboardIconsDirective.ts @@ -18,9 +18,7 @@ require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('learnerDashboardIcons', [ +angular.module('oppia').directive('learnerDashboardIcons', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/domain/learner_dashboard/LearnerDashboardIdsBackendApiService.ts b/core/templates/dev/head/domain/learner_dashboard/LearnerDashboardIdsBackendApiService.ts index 451d82f6f119..18d7ba052992 100644 --- a/core/templates/dev/head/domain/learner_dashboard/LearnerDashboardIdsBackendApiService.ts +++ b/core/templates/dev/head/domain/learner_dashboard/LearnerDashboardIdsBackendApiService.ts @@ -38,8 +38,6 @@ export class LearnerDashboardIdsBackendApiService { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'LearnerDashboardIdsBackendApiService', downgradeInjectable(LearnerDashboardIdsBackendApiService)); diff --git a/core/templates/dev/head/domain/learner_dashboard/LearnerPlaylistService.ts b/core/templates/dev/head/domain/learner_dashboard/LearnerPlaylistService.ts index b523be4ba298..afe6e9eeb81e 100644 --- a/core/templates/dev/head/domain/learner_dashboard/LearnerPlaylistService.ts +++ b/core/templates/dev/head/domain/learner_dashboard/LearnerPlaylistService.ts @@ -19,9 +19,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/AlertsService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('LearnerPlaylistService', [ +angular.module('oppia').factory('LearnerPlaylistService', [ '$http', '$uibModal', 'AlertsService', 'UrlInterpolationService', function($http, $uibModal, AlertsService, UrlInterpolationService) { var _addToLearnerPlaylist = function(activityId, activityType) { diff --git a/core/templates/dev/head/domain/objects/FractionObjectFactory.ts b/core/templates/dev/head/domain/objects/FractionObjectFactory.ts index 07ed5acfb91b..12962a5c57a3 100644 --- a/core/templates/dev/head/domain/objects/FractionObjectFactory.ts +++ b/core/templates/dev/head/domain/objects/FractionObjectFactory.ts @@ -19,9 +19,7 @@ require('domain/objects/objects-domain.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('FractionObjectFactory', [ +angular.module('oppia').factory('FractionObjectFactory', [ 'FRACTION_PARSING_ERRORS', function(FRACTION_PARSING_ERRORS) { var Fraction = function(isNegative, wholeNumber, numerator, denominator) { this.isNegative = isNegative; diff --git a/core/templates/dev/head/domain/objects/NumberWithUnitsObjectFactory.ts b/core/templates/dev/head/domain/objects/NumberWithUnitsObjectFactory.ts index be9f248b1e58..fded8f3fd6f9 100644 --- a/core/templates/dev/head/domain/objects/NumberWithUnitsObjectFactory.ts +++ b/core/templates/dev/head/domain/objects/NumberWithUnitsObjectFactory.ts @@ -35,9 +35,7 @@ require('domain/objects/objects-domain.constants.ts'); base_unit: Define the unit in terms of base unit only if the defined custom unit is a sub unit else assign it 'null' value.*/ -var oppia = require('AppInit.ts').module; - -oppia.factory('NumberWithUnitsObjectFactory', [ +angular.module('oppia').factory('NumberWithUnitsObjectFactory', [ 'FractionObjectFactory', 'UnitsObjectFactory', 'CURRENCY_UNITS', 'NUMBER_WITH_UNITS_PARSING_ERRORS', function( FractionObjectFactory, UnitsObjectFactory, CURRENCY_UNITS, diff --git a/core/templates/dev/head/domain/objects/UnitsObjectFactory.ts b/core/templates/dev/head/domain/objects/UnitsObjectFactory.ts index 1d3db6b797bf..91e71d114a4b 100644 --- a/core/templates/dev/head/domain/objects/UnitsObjectFactory.ts +++ b/core/templates/dev/head/domain/objects/UnitsObjectFactory.ts @@ -16,9 +16,7 @@ * @fileoverview Factory for creating instances of Units domain objects. */ -var oppia = require('AppInit.ts').module; - -oppia.factory('UnitsObjectFactory', ['CURRENCY_UNITS', +angular.module('oppia').factory('UnitsObjectFactory', ['CURRENCY_UNITS', function(CURRENCY_UNITS) { var Units = function(unitsList) { this.units = unitsList; diff --git a/core/templates/dev/head/domain/objects/objects-domain.constants.ts b/core/templates/dev/head/domain/objects/objects-domain.constants.ts index 9745cab50af5..0c5136f9a940 100644 --- a/core/templates/dev/head/domain/objects/objects-domain.constants.ts +++ b/core/templates/dev/head/domain/objects/objects-domain.constants.ts @@ -16,9 +16,7 @@ * @fileoverview Constants for objects domain. */ -var oppia = require('AppInit.ts').module; - -oppia.constant('FRACTION_PARSING_ERRORS', { +angular.module('oppia').constant('FRACTION_PARSING_ERRORS', { INVALID_CHARS: 'Please only use numerical digits, spaces or forward slashes (/)', INVALID_FORMAT: @@ -26,7 +24,7 @@ oppia.constant('FRACTION_PARSING_ERRORS', { DIVISION_BY_ZERO: 'Please do not put 0 in the denominator' }); -oppia.constant('NUMBER_WITH_UNITS_PARSING_ERRORS', { +angular.module('oppia').constant('NUMBER_WITH_UNITS_PARSING_ERRORS', { INVALID_VALUE: 'Please ensure that value is either a fraction or a number', INVALID_CURRENCY: @@ -36,7 +34,7 @@ oppia.constant('NUMBER_WITH_UNITS_PARSING_ERRORS', { 'Please ensure that unit only contains numbers, alphabets, (, ), *, ^, /, -' }); -oppia.constant('CURRENCY_UNITS', { +angular.module('oppia').constant('CURRENCY_UNITS', { dollar: { name: 'dollar', aliases: ['$', 'dollars', 'Dollars', 'Dollar', 'USD'], diff --git a/core/templates/dev/head/domain/question/EditableQuestionBackendApiService.ts b/core/templates/dev/head/domain/question/EditableQuestionBackendApiService.ts index a5fa16789758..ff45d2043156 100644 --- a/core/templates/dev/head/domain/question/EditableQuestionBackendApiService.ts +++ b/core/templates/dev/head/domain/question/EditableQuestionBackendApiService.ts @@ -28,9 +28,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('domain/question/question-domain.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('EditableQuestionBackendApiService', [ +angular.module('oppia').factory('EditableQuestionBackendApiService', [ '$http', '$q', 'UrlInterpolationService', 'EDITABLE_QUESTION_DATA_URL_TEMPLATE', 'QUESTION_CREATION_URL', 'QUESTION_SKILL_LINK_URL_TEMPLATE', diff --git a/core/templates/dev/head/domain/question/PretestQuestionBackendApiService.ts b/core/templates/dev/head/domain/question/PretestQuestionBackendApiService.ts index 8942a1bea986..320ffb640f97 100644 --- a/core/templates/dev/head/domain/question/PretestQuestionBackendApiService.ts +++ b/core/templates/dev/head/domain/question/PretestQuestionBackendApiService.ts @@ -20,9 +20,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('domain/question/question-domain.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('PretestQuestionBackendApiService', [ +angular.module('oppia').factory('PretestQuestionBackendApiService', [ '$http', '$q', 'UrlInterpolationService', 'PRETEST_QUESTIONS_URL_TEMPLATE', function( $http, $q, UrlInterpolationService, PRETEST_QUESTIONS_URL_TEMPLATE) { diff --git a/core/templates/dev/head/domain/question/QuestionBackendApiService.ts b/core/templates/dev/head/domain/question/QuestionBackendApiService.ts index f23c04566b7a..d42553e4fe8f 100644 --- a/core/templates/dev/head/domain/question/QuestionBackendApiService.ts +++ b/core/templates/dev/head/domain/question/QuestionBackendApiService.ts @@ -18,9 +18,7 @@ require('domain/question/question-domain.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('QuestionBackendApiService', [ +angular.module('oppia').factory('QuestionBackendApiService', [ '$http', '$q', 'UrlInterpolationService', 'QUESTIONS_LIST_URL_TEMPLATE', 'QUESTION_PLAYER_URL_TEMPLATE', function( diff --git a/core/templates/dev/head/domain/question/QuestionObjectFactory.ts b/core/templates/dev/head/domain/question/QuestionObjectFactory.ts index 57384f0e4654..6909b3126173 100644 --- a/core/templates/dev/head/domain/question/QuestionObjectFactory.ts +++ b/core/templates/dev/head/domain/question/QuestionObjectFactory.ts @@ -19,9 +19,7 @@ require('domain/state/StateObjectFactory.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('QuestionObjectFactory', [ +angular.module('oppia').factory('QuestionObjectFactory', [ 'StateObjectFactory', 'INTERACTION_SPECS', function(StateObjectFactory, INTERACTION_SPECS) { var Question = function(id, stateData, languageCode, version, diff --git a/core/templates/dev/head/domain/question/QuestionUpdateService.ts b/core/templates/dev/head/domain/question/QuestionUpdateService.ts index 193c10539789..c3aea083f3f8 100644 --- a/core/templates/dev/head/domain/question/QuestionUpdateService.ts +++ b/core/templates/dev/head/domain/question/QuestionUpdateService.ts @@ -23,14 +23,12 @@ require('domain/question/QuestionObjectFactory.ts'); require('domain/question/question-domain.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('QuestionUpdateService', [ - 'ChangeObjectFactory', 'QuestionObjectFactory', 'QuestionUndoRedoService', +angular.module('oppia').factory('QuestionUpdateService', [ + 'ChangeObjectFactory', 'QuestionUndoRedoService', 'CMD_UPDATE_QUESTION_PROPERTY', 'QUESTION_PROPERTY_LANGUAGE_CODE', 'QUESTION_PROPERTY_QUESTION_STATE_DATA', function( - ChangeObjectFactory, QuestionObjectFactory, QuestionUndoRedoService, + ChangeObjectFactory, QuestionUndoRedoService, CMD_UPDATE_QUESTION_PROPERTY, QUESTION_PROPERTY_LANGUAGE_CODE, QUESTION_PROPERTY_QUESTION_STATE_DATA) { var _applyChange = function(question, command, params, apply, reverse) { diff --git a/core/templates/dev/head/domain/question/question-domain.constants.ts b/core/templates/dev/head/domain/question/question-domain.constants.ts index 63c3c5c10eef..e28eef9b66a4 100644 --- a/core/templates/dev/head/domain/question/question-domain.constants.ts +++ b/core/templates/dev/head/domain/question/question-domain.constants.ts @@ -16,32 +16,33 @@ * @fileoverview Constants for question domain. */ -var oppia = require('AppInit.ts').module; - -oppia.constant( +angular.module('oppia').constant( 'EDITABLE_QUESTION_DATA_URL_TEMPLATE', '/question_editor_handler/data/'); -oppia.constant( +angular.module('oppia').constant( 'QUESTION_CREATION_URL', '/question_editor_handler/create_new'); -oppia.constant( +angular.module('oppia').constant( 'QUESTION_SKILL_LINK_URL_TEMPLATE', '/manage_question_skill_link//'); -oppia.constant( +angular.module('oppia').constant( 'PRETEST_QUESTIONS_URL_TEMPLATE', '/pretest_handler/?story_id=&cursor='); -oppia.constant( +angular.module('oppia').constant( 'QUESTIONS_LIST_URL_TEMPLATE', '/questions_list_handler/?cursor='); -oppia.constant( +angular.module('oppia').constant( 'QUESTION_PLAYER_URL_TEMPLATE', '/question_player_handler?skill_ids=&question_count' + '='); -oppia.constant('QUESTION_PROPERTY_LANGUAGE_CODE', 'language_code'); -oppia.constant('QUESTION_PROPERTY_QUESTION_STATE_DATA', 'question_state_data'); +angular.module('oppia').constant( + 'QUESTION_PROPERTY_LANGUAGE_CODE', 'language_code'); +angular.module('oppia').constant( + 'QUESTION_PROPERTY_QUESTION_STATE_DATA', 'question_state_data'); -oppia.constant('CMD_UPDATE_QUESTION_PROPERTY', 'update_question_property'); +angular.module('oppia').constant( + 'CMD_UPDATE_QUESTION_PROPERTY', 'update_question_property'); diff --git a/core/templates/dev/head/domain/sidebar/SidebarStatusService.ts b/core/templates/dev/head/domain/sidebar/SidebarStatusService.ts index 9854d7dc5ca2..ab340db56cba 100644 --- a/core/templates/dev/head/domain/sidebar/SidebarStatusService.ts +++ b/core/templates/dev/head/domain/sidebar/SidebarStatusService.ts @@ -19,9 +19,7 @@ require('services/contextual/WindowDimensionsService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('SidebarStatusService', [ +angular.module('oppia').factory('SidebarStatusService', [ 'WindowDimensionsService', function(WindowDimensionsService) { var pendingSidebarClick = false; var sidebarIsShown = false; diff --git a/core/templates/dev/head/domain/skill/ConceptCardBackendApiService.ts b/core/templates/dev/head/domain/skill/ConceptCardBackendApiService.ts index 1dff3a50f177..7ad88f3e5519 100644 --- a/core/templates/dev/head/domain/skill/ConceptCardBackendApiService.ts +++ b/core/templates/dev/head/domain/skill/ConceptCardBackendApiService.ts @@ -21,9 +21,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('domain/skill/skill-domain.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ConceptCardBackendApiService', [ +angular.module('oppia').factory('ConceptCardBackendApiService', [ '$http', '$q', 'UrlInterpolationService', 'CONCEPT_CARD_DATA_URL_TEMPLATE', function($http, $q, UrlInterpolationService, CONCEPT_CARD_DATA_URL_TEMPLATE) { // Maps previously loaded concept cards to their IDs. diff --git a/core/templates/dev/head/domain/skill/ConceptCardObjectFactory.ts b/core/templates/dev/head/domain/skill/ConceptCardObjectFactory.ts index 6d5afc26f573..48622b56bf87 100644 --- a/core/templates/dev/head/domain/skill/ConceptCardObjectFactory.ts +++ b/core/templates/dev/head/domain/skill/ConceptCardObjectFactory.ts @@ -20,9 +20,7 @@ require('domain/exploration/RecordedVoiceoversObjectFactory.ts'); require('domain/exploration/SubtitledHtmlObjectFactory.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ConceptCardObjectFactory', [ +angular.module('oppia').factory('ConceptCardObjectFactory', [ 'RecordedVoiceoversObjectFactory', 'SubtitledHtmlObjectFactory', 'COMPONENT_NAME_EXPLANATION', function( diff --git a/core/templates/dev/head/domain/skill/EditableSkillBackendApiService.ts b/core/templates/dev/head/domain/skill/EditableSkillBackendApiService.ts index 1c8b5a128464..32d951008c99 100644 --- a/core/templates/dev/head/domain/skill/EditableSkillBackendApiService.ts +++ b/core/templates/dev/head/domain/skill/EditableSkillBackendApiService.ts @@ -20,9 +20,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('domain/skill/skill-domain.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('EditableSkillBackendApiService', [ +angular.module('oppia').factory('EditableSkillBackendApiService', [ '$http', '$q', 'UrlInterpolationService', 'EDITABLE_SKILL_DATA_URL_TEMPLATE', 'SKILL_DATA_URL_TEMPLATE', function( diff --git a/core/templates/dev/head/domain/skill/MisconceptionObjectFactory.ts b/core/templates/dev/head/domain/skill/MisconceptionObjectFactory.ts index 23bf83cfee06..5a72d7cb097a 100644 --- a/core/templates/dev/head/domain/skill/MisconceptionObjectFactory.ts +++ b/core/templates/dev/head/domain/skill/MisconceptionObjectFactory.ts @@ -92,8 +92,6 @@ export class MisconceptionObjectFactory { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'MisconceptionObjectFactory', downgradeInjectable(MisconceptionObjectFactory)); diff --git a/core/templates/dev/head/domain/skill/SkillDifficultyObjectFactory.ts b/core/templates/dev/head/domain/skill/SkillDifficultyObjectFactory.ts index 046318f94746..f37ae70bdd3e 100644 --- a/core/templates/dev/head/domain/skill/SkillDifficultyObjectFactory.ts +++ b/core/templates/dev/head/domain/skill/SkillDifficultyObjectFactory.ts @@ -75,8 +75,6 @@ export class SkillDifficultyObjectFactory { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'SkillDifficultyObjectFactory', downgradeInjectable(SkillDifficultyObjectFactory)); diff --git a/core/templates/dev/head/domain/skill/SkillObjectFactory.ts b/core/templates/dev/head/domain/skill/SkillObjectFactory.ts index 11be3257f0bc..5d51beaaecda 100644 --- a/core/templates/dev/head/domain/skill/SkillObjectFactory.ts +++ b/core/templates/dev/head/domain/skill/SkillObjectFactory.ts @@ -21,9 +21,7 @@ require('domain/skill/ConceptCardObjectFactory.ts'); require('domain/skill/MisconceptionObjectFactory.ts'); require('services/ValidatorsService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('SkillObjectFactory', [ +angular.module('oppia').factory('SkillObjectFactory', [ 'ConceptCardObjectFactory', 'MisconceptionObjectFactory', 'ValidatorsService', function( ConceptCardObjectFactory, MisconceptionObjectFactory, ValidatorsService) { diff --git a/core/templates/dev/head/domain/skill/SkillRightsBackendApiService.ts b/core/templates/dev/head/domain/skill/SkillRightsBackendApiService.ts index 80b97c2e03fb..9b9f70796c7e 100644 --- a/core/templates/dev/head/domain/skill/SkillRightsBackendApiService.ts +++ b/core/templates/dev/head/domain/skill/SkillRightsBackendApiService.ts @@ -18,9 +18,7 @@ require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('SkillRightsBackendApiService', [ +angular.module('oppia').factory('SkillRightsBackendApiService', [ '$http', '$q', 'UrlInterpolationService', 'SKILL_PUBLISH_URL_TEMPLATE', 'SKILL_RIGHTS_URL_TEMPLATE', function($http, $q, UrlInterpolationService, diff --git a/core/templates/dev/head/domain/skill/SkillRightsObjectFactory.ts b/core/templates/dev/head/domain/skill/SkillRightsObjectFactory.ts index 0ba215d8fe24..b4573736cc76 100644 --- a/core/templates/dev/head/domain/skill/SkillRightsObjectFactory.ts +++ b/core/templates/dev/head/domain/skill/SkillRightsObjectFactory.ts @@ -91,8 +91,6 @@ export class SkillRightsObjectFactory { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'SkillRightsObjectFactory', downgradeInjectable(SkillRightsObjectFactory)); diff --git a/core/templates/dev/head/domain/skill/SkillSummaryObjectFactory.ts b/core/templates/dev/head/domain/skill/SkillSummaryObjectFactory.ts index cb3a2a1d94d8..caa9ddeafe24 100644 --- a/core/templates/dev/head/domain/skill/SkillSummaryObjectFactory.ts +++ b/core/templates/dev/head/domain/skill/SkillSummaryObjectFactory.ts @@ -46,8 +46,6 @@ export class SkillSummaryObjectFactory { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'SkillSummaryObjectFactory', downgradeInjectable(SkillSummaryObjectFactory)); diff --git a/core/templates/dev/head/domain/skill/SkillUpdateService.ts b/core/templates/dev/head/domain/skill/SkillUpdateService.ts index 29e2dde75bf9..8db117f07e05 100644 --- a/core/templates/dev/head/domain/skill/SkillUpdateService.ts +++ b/core/templates/dev/head/domain/skill/SkillUpdateService.ts @@ -22,10 +22,8 @@ require('domain/skill/SkillObjectFactory.ts'); require('domain/skill/skill-domain.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('SkillUpdateService', [ - 'ChangeObjectFactory', 'SkillObjectFactory', +angular.module('oppia').factory('SkillUpdateService', [ + 'ChangeObjectFactory', 'UndoRedoService', 'CMD_ADD_SKILL_MISCONCEPTION', 'CMD_DELETE_SKILL_MISCONCEPTION', 'CMD_UPDATE_SKILL_CONTENTS_PROPERTY', 'CMD_UPDATE_SKILL_MISCONCEPTIONS_PROPERTY', @@ -35,9 +33,8 @@ oppia.factory('SkillUpdateService', [ 'SKILL_MISCONCEPTIONS_PROPERTY_FEEDBACK', 'SKILL_MISCONCEPTIONS_PROPERTY_NAME', 'SKILL_MISCONCEPTIONS_PROPERTY_NOTES', 'SKILL_PROPERTY_DESCRIPTION', - 'SKILL_PROPERTY_LANGUAGE_CODE', function( - ChangeObjectFactory, SkillObjectFactory, + ChangeObjectFactory, UndoRedoService, CMD_ADD_SKILL_MISCONCEPTION, CMD_DELETE_SKILL_MISCONCEPTION, CMD_UPDATE_SKILL_CONTENTS_PROPERTY, CMD_UPDATE_SKILL_MISCONCEPTIONS_PROPERTY, @@ -46,8 +43,7 @@ oppia.factory('SkillUpdateService', [ SKILL_CONTENTS_PROPERTY_WORKED_EXAMPLES, SKILL_MISCONCEPTIONS_PROPERTY_FEEDBACK, SKILL_MISCONCEPTIONS_PROPERTY_NAME, - SKILL_MISCONCEPTIONS_PROPERTY_NOTES, SKILL_PROPERTY_DESCRIPTION, - SKILL_PROPERTY_LANGUAGE_CODE) { + SKILL_MISCONCEPTIONS_PROPERTY_NOTES, SKILL_PROPERTY_DESCRIPTION) { var _applyChange = function(skill, command, params, apply, reverse) { var changeDict = angular.copy(params); changeDict.cmd = command; diff --git a/core/templates/dev/head/domain/skill/skill-domain.constants.ts b/core/templates/dev/head/domain/skill/skill-domain.constants.ts index 74467271236b..7892d2502d7a 100644 --- a/core/templates/dev/head/domain/skill/skill-domain.constants.ts +++ b/core/templates/dev/head/domain/skill/skill-domain.constants.ts @@ -16,40 +16,45 @@ * @fileoverview Constants for skill domain. */ -var oppia = require('AppInit.ts').module; - -oppia.constant( +angular.module('oppia').constant( 'CONCEPT_CARD_DATA_URL_TEMPLATE', '/concept_card_handler/'); -oppia.constant( +angular.module('oppia').constant( 'EDITABLE_SKILL_DATA_URL_TEMPLATE', '/skill_editor_handler/data/'); -oppia.constant( +angular.module('oppia').constant( 'SKILL_DATA_URL_TEMPLATE', '/skill_data_handler/'); -oppia.constant( +angular.module('oppia').constant( 'SKILL_EDITOR_QUESTION_URL_TEMPLATE', '/skill_editor_question_handler/?cursor='); -oppia.constant('SKILL_PROPERTY_DESCRIPTION', 'description'); -oppia.constant('SKILL_PROPERTY_LANGUAGE_CODE', 'language_code'); -oppia.constant('SKILL_CONTENTS_PROPERTY_EXPLANATION', 'explanation'); -oppia.constant('SKILL_CONTENTS_PROPERTY_WORKED_EXAMPLES', 'worked_examples'); -oppia.constant('SKILL_MISCONCEPTIONS_PROPERTY_NAME', 'name'); -oppia.constant('SKILL_MISCONCEPTIONS_PROPERTY_NOTES', 'notes'); -oppia.constant('SKILL_MISCONCEPTIONS_PROPERTY_FEEDBACK', 'feedback'); - -oppia.constant('CMD_UPDATE_SKILL_PROPERTY', +angular.module('oppia').constant( + 'SKILL_PROPERTY_DESCRIPTION', 'description'); +angular.module('oppia').constant( + 'SKILL_PROPERTY_LANGUAGE_CODE', 'language_code'); +angular.module('oppia').constant( + 'SKILL_CONTENTS_PROPERTY_EXPLANATION', 'explanation'); +angular.module('oppia').constant( + 'SKILL_CONTENTS_PROPERTY_WORKED_EXAMPLES', 'worked_examples'); +angular.module('oppia').constant( + 'SKILL_MISCONCEPTIONS_PROPERTY_NAME', 'name'); +angular.module('oppia').constant( + 'SKILL_MISCONCEPTIONS_PROPERTY_NOTES', 'notes'); +angular.module('oppia').constant( + 'SKILL_MISCONCEPTIONS_PROPERTY_FEEDBACK', 'feedback'); + +angular.module('oppia').constant('CMD_UPDATE_SKILL_PROPERTY', 'update_skill_property'); -oppia.constant('CMD_UPDATE_SKILL_CONTENTS_PROPERTY', +angular.module('oppia').constant('CMD_UPDATE_SKILL_CONTENTS_PROPERTY', 'update_skill_contents_property'); -oppia.constant('CMD_UPDATE_SKILL_MISCONCEPTIONS_PROPERTY', +angular.module('oppia').constant('CMD_UPDATE_SKILL_MISCONCEPTIONS_PROPERTY', 'update_skill_misconceptions_property'); -oppia.constant('CMD_ADD_SKILL_MISCONCEPTION', +angular.module('oppia').constant('CMD_ADD_SKILL_MISCONCEPTION', 'add_skill_misconception'); -oppia.constant('CMD_DELETE_SKILL_MISCONCEPTION', +angular.module('oppia').constant('CMD_DELETE_SKILL_MISCONCEPTION', 'delete_skill_misconception'); diff --git a/core/templates/dev/head/domain/state/StateObjectFactory.ts b/core/templates/dev/head/domain/state/StateObjectFactory.ts index d14113cd1191..b4ca96bc02cf 100644 --- a/core/templates/dev/head/domain/state/StateObjectFactory.ts +++ b/core/templates/dev/head/domain/state/StateObjectFactory.ts @@ -23,9 +23,7 @@ require('domain/exploration/ParamChangesObjectFactory.ts'); require('domain/exploration/SubtitledHtmlObjectFactory.ts'); require('domain/exploration/WrittenTranslationsObjectFactory.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('StateObjectFactory', [ +angular.module('oppia').factory('StateObjectFactory', [ 'InteractionObjectFactory', 'ParamChangesObjectFactory', 'RecordedVoiceoversObjectFactory', 'SubtitledHtmlObjectFactory', 'WrittenTranslationsObjectFactory', function( diff --git a/core/templates/dev/head/domain/state_card/StateCardObjectFactory.ts b/core/templates/dev/head/domain/state_card/StateCardObjectFactory.ts index 713e36375157..8cce3a55c517 100644 --- a/core/templates/dev/head/domain/state_card/StateCardObjectFactory.ts +++ b/core/templates/dev/head/domain/state_card/StateCardObjectFactory.ts @@ -22,13 +22,11 @@ require( 'audio-translation-language.service.ts'); require('services/ExplorationHtmlFormatterService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('StateCardObjectFactory', [ - 'AudioTranslationLanguageService', 'ExplorationHtmlFormatterService', +angular.module('oppia').factory('StateCardObjectFactory', [ + 'AudioTranslationLanguageService', 'INTERACTION_DISPLAY_MODE_INLINE', 'INTERACTION_SPECS', function( - AudioTranslationLanguageService, ExplorationHtmlFormatterService, + AudioTranslationLanguageService, INTERACTION_DISPLAY_MODE_INLINE, INTERACTION_SPECS) { var StateCard = function( stateName, contentHtml, interactionHtml, interaction, diff --git a/core/templates/dev/head/domain/statistics/FeedbackImprovementCardObjectFactory.ts b/core/templates/dev/head/domain/statistics/FeedbackImprovementCardObjectFactory.ts index cb99c6b6bf80..c996faa8b055 100644 --- a/core/templates/dev/head/domain/statistics/FeedbackImprovementCardObjectFactory.ts +++ b/core/templates/dev/head/domain/statistics/FeedbackImprovementCardObjectFactory.ts @@ -24,9 +24,7 @@ require( 'pages/exploration-editor-page/feedback-tab/services/thread-data.service.ts'); require('domain/statistics/statistics-domain.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('FeedbackImprovementCardObjectFactory', [ +angular.module('oppia').factory('FeedbackImprovementCardObjectFactory', [ '$q', 'ImprovementActionButtonObjectFactory', 'ImprovementModalService', 'ThreadDataService', 'FEEDBACK_IMPROVEMENT_CARD_TYPE', function( diff --git a/core/templates/dev/head/domain/statistics/ImprovementActionButtonObjectFactory.ts b/core/templates/dev/head/domain/statistics/ImprovementActionButtonObjectFactory.ts index 3ed207619e45..8d6b4d6b8bcc 100644 --- a/core/templates/dev/head/domain/statistics/ImprovementActionButtonObjectFactory.ts +++ b/core/templates/dev/head/domain/statistics/ImprovementActionButtonObjectFactory.ts @@ -86,8 +86,6 @@ export class ImprovementActionButtonObjectFactory { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'ImprovementActionButtonObjectFactory', downgradeInjectable(ImprovementActionButtonObjectFactory)); diff --git a/core/templates/dev/head/domain/statistics/LearnerActionObjectFactory.ts b/core/templates/dev/head/domain/statistics/LearnerActionObjectFactory.ts index 50319d949d71..69fa7d948c35 100644 --- a/core/templates/dev/head/domain/statistics/LearnerActionObjectFactory.ts +++ b/core/templates/dev/head/domain/statistics/LearnerActionObjectFactory.ts @@ -19,9 +19,7 @@ require('domain/statistics/statistics-domain.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('LearnerActionObjectFactory', [ +angular.module('oppia').factory('LearnerActionObjectFactory', [ 'LEARNER_ACTION_SCHEMA_LATEST_VERSION', function(LEARNER_ACTION_SCHEMA_LATEST_VERSION) { /** diff --git a/core/templates/dev/head/domain/statistics/LearnerAnswerDetailsBackendApiService.ts b/core/templates/dev/head/domain/statistics/LearnerAnswerDetailsBackendApiService.ts index 2405ec84d17c..e243112f9f7a 100644 --- a/core/templates/dev/head/domain/statistics/LearnerAnswerDetailsBackendApiService.ts +++ b/core/templates/dev/head/domain/statistics/LearnerAnswerDetailsBackendApiService.ts @@ -20,9 +20,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('domain/statistics/statistics-domain.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('LearnerAnswerDetailsBackendApiService', [ +angular.module('oppia').factory('LearnerAnswerDetailsBackendApiService', [ '$http', '$q', 'UrlInterpolationService', 'SUBMIT_LEARNER_ANSWER_DETAILS_URL', function( $http, $q, UrlInterpolationService, SUBMIT_LEARNER_ANSWER_DETAILS_URL) { diff --git a/core/templates/dev/head/domain/statistics/LearnerAnswerInfoObjectFactory.ts b/core/templates/dev/head/domain/statistics/LearnerAnswerInfoObjectFactory.ts index a62b57f6bb6d..dd493cb21157 100644 --- a/core/templates/dev/head/domain/statistics/LearnerAnswerInfoObjectFactory.ts +++ b/core/templates/dev/head/domain/statistics/LearnerAnswerInfoObjectFactory.ts @@ -17,9 +17,7 @@ * domain objects. */ -var oppia = require('AppInit.ts').module; - -oppia.factory('LearnerAnswerInfoObjectFactory', [ +angular.module('oppia').factory('LearnerAnswerInfoObjectFactory', [ function() { var LearnerAnswerInfo = function(learnerAnswerInfoId, answer, answerDetails, createdOn) { diff --git a/core/templates/dev/head/domain/statistics/PlaythroughImprovementCardObjectFactory.ts b/core/templates/dev/head/domain/statistics/PlaythroughImprovementCardObjectFactory.ts index 296764fe3945..6efb517ce296 100644 --- a/core/templates/dev/head/domain/statistics/PlaythroughImprovementCardObjectFactory.ts +++ b/core/templates/dev/head/domain/statistics/PlaythroughImprovementCardObjectFactory.ts @@ -22,9 +22,7 @@ require('services/PlaythroughIssuesService.ts'); require('domain/statistics/statistics-domain.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('PlaythroughImprovementCardObjectFactory', [ +angular.module('oppia').factory('PlaythroughImprovementCardObjectFactory', [ '$uibModal', 'ImprovementActionButtonObjectFactory', 'PlaythroughIssuesService', 'UrlInterpolationService', 'PLAYTHROUGH_IMPROVEMENT_CARD_TYPE', diff --git a/core/templates/dev/head/domain/statistics/PlaythroughIssueObjectFactory.ts b/core/templates/dev/head/domain/statistics/PlaythroughIssueObjectFactory.ts index c7fe42cabc6b..8f6c013b8d8d 100644 --- a/core/templates/dev/head/domain/statistics/PlaythroughIssueObjectFactory.ts +++ b/core/templates/dev/head/domain/statistics/PlaythroughIssueObjectFactory.ts @@ -107,8 +107,6 @@ export class PlaythroughIssueObjectFactory { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'PlaythroughIssueObjectFactory', downgradeInjectable(PlaythroughIssueObjectFactory)); diff --git a/core/templates/dev/head/domain/statistics/PlaythroughObjectFactory.ts b/core/templates/dev/head/domain/statistics/PlaythroughObjectFactory.ts index 27c4f2a2cbff..4e8f5c8de195 100644 --- a/core/templates/dev/head/domain/statistics/PlaythroughObjectFactory.ts +++ b/core/templates/dev/head/domain/statistics/PlaythroughObjectFactory.ts @@ -19,9 +19,7 @@ require('domain/statistics/LearnerActionObjectFactory.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('PlaythroughObjectFactory', [ +angular.module('oppia').factory('PlaythroughObjectFactory', [ 'LearnerActionObjectFactory', function(LearnerActionObjectFactory) { /** * @constructor diff --git a/core/templates/dev/head/domain/statistics/SuggestionImprovementCardObjectFactory.ts b/core/templates/dev/head/domain/statistics/SuggestionImprovementCardObjectFactory.ts index b1f4cd2a05f8..8e02b73a9e4f 100644 --- a/core/templates/dev/head/domain/statistics/SuggestionImprovementCardObjectFactory.ts +++ b/core/templates/dev/head/domain/statistics/SuggestionImprovementCardObjectFactory.ts @@ -27,9 +27,7 @@ require( 'suggestion-modal-for-exploration-editor.service.ts'); require('domain/statistics/statistics-domain.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('SuggestionImprovementCardObjectFactory', [ +angular.module('oppia').factory('SuggestionImprovementCardObjectFactory', [ '$q', 'ImprovementActionButtonObjectFactory', 'ImprovementModalService', 'ThreadDataService', 'SUGGESTION_IMPROVEMENT_CARD_TYPE', function( diff --git a/core/templates/dev/head/domain/statistics/statistics-domain.constants.ts b/core/templates/dev/head/domain/statistics/statistics-domain.constants.ts index 5c952f85a0a2..b09e54f0d8b8 100644 --- a/core/templates/dev/head/domain/statistics/statistics-domain.constants.ts +++ b/core/templates/dev/head/domain/statistics/statistics-domain.constants.ts @@ -16,13 +16,13 @@ * @fileoverview Constants for the statistics domain. */ -var oppia = require('AppInit.ts').module; +angular.module('oppia').constant('LEARNER_ACTION_SCHEMA_LATEST_VERSION', 1); -oppia.constant('LEARNER_ACTION_SCHEMA_LATEST_VERSION', 1); - -oppia.constant('FEEDBACK_IMPROVEMENT_CARD_TYPE', 'feedback'); -oppia.constant('PLAYTHROUGH_IMPROVEMENT_CARD_TYPE', 'playthrough'); -oppia.constant( +angular.module('oppia').constant('FEEDBACK_IMPROVEMENT_CARD_TYPE', 'feedback'); +angular.module('oppia').constant( + 'PLAYTHROUGH_IMPROVEMENT_CARD_TYPE', 'playthrough'); +angular.module('oppia').constant( 'SUBMIT_LEARNER_ANSWER_DETAILS_URL', '/explorehandler/learner_answer_details//'); -oppia.constant('SUGGESTION_IMPROVEMENT_CARD_TYPE', 'suggestion'); +angular.module('oppia').constant( + 'SUGGESTION_IMPROVEMENT_CARD_TYPE', 'suggestion'); diff --git a/core/templates/dev/head/domain/story/EditableStoryBackendApiService.ts b/core/templates/dev/head/domain/story/EditableStoryBackendApiService.ts index 8a53d2145679..9417fc062f3a 100644 --- a/core/templates/dev/head/domain/story/EditableStoryBackendApiService.ts +++ b/core/templates/dev/head/domain/story/EditableStoryBackendApiService.ts @@ -20,9 +20,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('domain/story/story-domain.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('EditableStoryBackendApiService', [ +angular.module('oppia').factory('EditableStoryBackendApiService', [ '$http', '$q', 'UrlInterpolationService', 'EDITABLE_STORY_DATA_URL_TEMPLATE', function($http, $q, UrlInterpolationService, diff --git a/core/templates/dev/head/domain/story/StoryContentsObjectFactory.ts b/core/templates/dev/head/domain/story/StoryContentsObjectFactory.ts index a062154597e5..2543e015c38c 100644 --- a/core/templates/dev/head/domain/story/StoryContentsObjectFactory.ts +++ b/core/templates/dev/head/domain/story/StoryContentsObjectFactory.ts @@ -20,9 +20,7 @@ require('domain/story/StoryNodeObjectFactory.ts'); require('pages/story-editor-page/story-editor-page.controller.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('StoryContentsObjectFactory', [ +angular.module('oppia').factory('StoryContentsObjectFactory', [ 'StoryNodeObjectFactory', 'NODE_ID_PREFIX', function(StoryNodeObjectFactory, NODE_ID_PREFIX) { var _disconnectedNodeIds = []; diff --git a/core/templates/dev/head/domain/story/StoryNodeObjectFactory.ts b/core/templates/dev/head/domain/story/StoryNodeObjectFactory.ts index 48cab696bc53..ee2c9464e988 100644 --- a/core/templates/dev/head/domain/story/StoryNodeObjectFactory.ts +++ b/core/templates/dev/head/domain/story/StoryNodeObjectFactory.ts @@ -19,9 +19,7 @@ require('pages/story-editor-page/story-editor-page.controller.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('StoryNodeObjectFactory', ['NODE_ID_PREFIX', +angular.module('oppia').factory('StoryNodeObjectFactory', ['NODE_ID_PREFIX', function(NODE_ID_PREFIX) { var StoryNode = function( id, title, destinationNodeIds, prerequisiteSkillIds, acquiredSkillIds, diff --git a/core/templates/dev/head/domain/story/StoryObjectFactory.ts b/core/templates/dev/head/domain/story/StoryObjectFactory.ts index 9bd6f1618637..6ed7fcb8fa22 100644 --- a/core/templates/dev/head/domain/story/StoryObjectFactory.ts +++ b/core/templates/dev/head/domain/story/StoryObjectFactory.ts @@ -19,10 +19,8 @@ require('domain/story/StoryContentsObjectFactory.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('StoryObjectFactory', ['StoryContentsObjectFactory', - function(StoryContentsObjectFactory) { +angular.module('oppia').factory('StoryObjectFactory', [ + 'StoryContentsObjectFactory', function(StoryContentsObjectFactory) { var Story = function( id, title, description, notes, storyContents, languageCode, version) { this._id = id; diff --git a/core/templates/dev/head/domain/story/StoryUpdateService.ts b/core/templates/dev/head/domain/story/StoryUpdateService.ts index 1b13ac4ccf83..b6141da15006 100644 --- a/core/templates/dev/head/domain/story/StoryUpdateService.ts +++ b/core/templates/dev/head/domain/story/StoryUpdateService.ts @@ -24,9 +24,7 @@ require('domain/editor/undo_redo/UndoRedoService.ts'); require('domain/story/story-domain.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('StoryUpdateService', [ +angular.module('oppia').factory('StoryUpdateService', [ 'ChangeObjectFactory', 'UndoRedoService', 'CMD_ADD_STORY_NODE', 'CMD_DELETE_STORY_NODE', 'CMD_UPDATE_STORY_CONTENTS_PROPERTY', 'CMD_UPDATE_STORY_NODE_OUTLINE_STATUS', diff --git a/core/templates/dev/head/domain/story/story-domain.constants.ts b/core/templates/dev/head/domain/story/story-domain.constants.ts index a0274ab2c960..afcd3e4b6e4e 100644 --- a/core/templates/dev/head/domain/story/story-domain.constants.ts +++ b/core/templates/dev/head/domain/story/story-domain.constants.ts @@ -16,35 +16,38 @@ * @fileoverview Constants for story domain. */ -var oppia = require('AppInit.ts').module; - -oppia.constant( +angular.module('oppia').constant( 'EDITABLE_STORY_DATA_URL_TEMPLATE', '/story_editor_handler/data//'); // These should match the constants defined in core.domain.story_domain. -oppia.constant('CMD_ADD_STORY_NODE', 'add_story_node'); -oppia.constant('CMD_DELETE_STORY_NODE', 'delete_story_node'); -oppia.constant( +angular.module('oppia').constant('CMD_ADD_STORY_NODE', 'add_story_node'); +angular.module('oppia').constant('CMD_DELETE_STORY_NODE', 'delete_story_node'); +angular.module('oppia').constant( 'CMD_UPDATE_STORY_NODE_OUTLINE_STATUS', 'update_story_node_outline_status'); -oppia.constant('CMD_UPDATE_STORY_PROPERTY', 'update_story_property'); -oppia.constant('CMD_UPDATE_STORY_NODE_PROPERTY', 'update_story_node_property'); -oppia.constant( +angular.module('oppia').constant( + 'CMD_UPDATE_STORY_PROPERTY', 'update_story_property'); +angular.module('oppia').constant( + 'CMD_UPDATE_STORY_NODE_PROPERTY', 'update_story_node_property'); +angular.module('oppia').constant( 'CMD_UPDATE_STORY_CONTENTS_PROPERTY', 'update_story_contents_property'); -oppia.constant('STORY_PROPERTY_TITLE', 'title'); -oppia.constant('STORY_PROPERTY_DESCRIPTION', 'description'); -oppia.constant('STORY_PROPERTY_NOTES', 'notes'); -oppia.constant('STORY_PROPERTY_LANGUAGE_CODE', 'language_code'); +angular.module('oppia').constant('STORY_PROPERTY_TITLE', 'title'); +angular.module('oppia').constant('STORY_PROPERTY_DESCRIPTION', 'description'); +angular.module('oppia').constant('STORY_PROPERTY_NOTES', 'notes'); +angular.module('oppia').constant( + 'STORY_PROPERTY_LANGUAGE_CODE', 'language_code'); -oppia.constant('INITIAL_NODE_ID', 'initial_node_id'); +angular.module('oppia').constant('INITIAL_NODE_ID', 'initial_node_id'); -oppia.constant('STORY_NODE_PROPERTY_TITLE', 'title'); -oppia.constant('STORY_NODE_PROPERTY_OUTLINE', 'outline'); -oppia.constant('STORY_NODE_PROPERTY_EXPLORATION_ID', 'exploration_id'); -oppia.constant( +angular.module('oppia').constant('STORY_NODE_PROPERTY_TITLE', 'title'); +angular.module('oppia').constant('STORY_NODE_PROPERTY_OUTLINE', 'outline'); +angular.module('oppia').constant( + 'STORY_NODE_PROPERTY_EXPLORATION_ID', 'exploration_id'); +angular.module('oppia').constant( 'STORY_NODE_PROPERTY_DESTINATION_NODE_IDS', 'destination_node_ids'); -oppia.constant('STORY_NODE_PROPERTY_ACQUIRED_SKILL_IDS', 'acquired_skill_ids'); -oppia.constant( +angular.module('oppia').constant( + 'STORY_NODE_PROPERTY_ACQUIRED_SKILL_IDS', 'acquired_skill_ids'); +angular.module('oppia').constant( 'STORY_NODE_PROPERTY_PREREQUISITE_SKILL_IDS', 'prerequisite_skill_ids'); diff --git a/core/templates/dev/head/domain/story_viewer/ReadOnlyStoryNodeObjectFactory.ts b/core/templates/dev/head/domain/story_viewer/ReadOnlyStoryNodeObjectFactory.ts index f5a88f36244a..1f4332a8ac10 100644 --- a/core/templates/dev/head/domain/story_viewer/ReadOnlyStoryNodeObjectFactory.ts +++ b/core/templates/dev/head/domain/story_viewer/ReadOnlyStoryNodeObjectFactory.ts @@ -17,9 +17,7 @@ * story viewer. */ -var oppia = require('AppInit.ts').module; - -oppia.factory('ReadOnlyStoryNodeObjectFactory', [function() { +angular.module('oppia').factory('ReadOnlyStoryNodeObjectFactory', [function() { var StoryNode = function( id, title, destinationNodeIds, prerequisiteSkillIds, acquiredSkillIds, outline, outlineIsFinalized, explorationId, explorationSummary, diff --git a/core/templates/dev/head/domain/story_viewer/StoryPlaythroughObjectFactory.ts b/core/templates/dev/head/domain/story_viewer/StoryPlaythroughObjectFactory.ts index b8e405f20b3a..e06f7430e6cc 100644 --- a/core/templates/dev/head/domain/story_viewer/StoryPlaythroughObjectFactory.ts +++ b/core/templates/dev/head/domain/story_viewer/StoryPlaythroughObjectFactory.ts @@ -19,9 +19,7 @@ require('domain/story_viewer/ReadOnlyStoryNodeObjectFactory.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('StoryPlaythroughObjectFactory', [ +angular.module('oppia').factory('StoryPlaythroughObjectFactory', [ 'ReadOnlyStoryNodeObjectFactory', function(ReadOnlyStoryNodeObjectFactory) { // Stores information about a current playthrough of a story for a // user. diff --git a/core/templates/dev/head/domain/story_viewer/StoryViewerBackendApiService.ts b/core/templates/dev/head/domain/story_viewer/StoryViewerBackendApiService.ts index 995e1102d81d..fa6431562e9f 100644 --- a/core/templates/dev/head/domain/story_viewer/StoryViewerBackendApiService.ts +++ b/core/templates/dev/head/domain/story_viewer/StoryViewerBackendApiService.ts @@ -20,9 +20,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('domain/story_viewer/story-viewer-domain.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('StoryViewerBackendApiService', [ +angular.module('oppia').factory('StoryViewerBackendApiService', [ '$http', '$q', 'UrlInterpolationService', 'STORY_DATA_URL_TEMPLATE', 'STORY_NODE_COMPLETION_URL_TEMPLATE', function($http, $q, UrlInterpolationService, STORY_DATA_URL_TEMPLATE, diff --git a/core/templates/dev/head/domain/story_viewer/story-viewer-domain.constants.ts b/core/templates/dev/head/domain/story_viewer/story-viewer-domain.constants.ts index d8a1c5f79891..8b16f9f02ce4 100644 --- a/core/templates/dev/head/domain/story_viewer/story-viewer-domain.constants.ts +++ b/core/templates/dev/head/domain/story_viewer/story-viewer-domain.constants.ts @@ -16,11 +16,9 @@ * @fileoverview Constants for story viewer domain. */ -var oppia = require('AppInit.ts').module; - -oppia.constant( +angular.module('oppia').constant( 'STORY_DATA_URL_TEMPLATE', '/story_data_handler/'); -oppia.constant( +angular.module('oppia').constant( 'STORY_NODE_COMPLETION_URL_TEMPLATE', '/story_node_completion_handler//'); diff --git a/core/templates/dev/head/domain/suggestion/SuggestionObjectFactory.ts b/core/templates/dev/head/domain/suggestion/SuggestionObjectFactory.ts index 5cf04addb59a..f376bc721862 100644 --- a/core/templates/dev/head/domain/suggestion/SuggestionObjectFactory.ts +++ b/core/templates/dev/head/domain/suggestion/SuggestionObjectFactory.ts @@ -75,8 +75,6 @@ export class SuggestionObjectFactory { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'SuggestionObjectFactory', downgradeInjectable(SuggestionObjectFactory)); diff --git a/core/templates/dev/head/domain/suggestion/SuggestionThreadObjectFactory.ts b/core/templates/dev/head/domain/suggestion/SuggestionThreadObjectFactory.ts index 1d19a4d83f67..1766187d1782 100644 --- a/core/templates/dev/head/domain/suggestion/SuggestionThreadObjectFactory.ts +++ b/core/templates/dev/head/domain/suggestion/SuggestionThreadObjectFactory.ts @@ -19,9 +19,7 @@ require('domain/suggestion/SuggestionObjectFactory.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('SuggestionThreadObjectFactory', [ +angular.module('oppia').factory('SuggestionThreadObjectFactory', [ 'SuggestionObjectFactory', function(SuggestionObjectFactory) { var SuggestionThread = function( status, subject, summary, originalAuthorName, lastUpdated, messageCount, diff --git a/core/templates/dev/head/domain/summary/ExplorationSummaryBackendApiService.ts b/core/templates/dev/head/domain/summary/ExplorationSummaryBackendApiService.ts index 5820ae825806..c9d5734fbcd3 100644 --- a/core/templates/dev/head/domain/summary/ExplorationSummaryBackendApiService.ts +++ b/core/templates/dev/head/domain/summary/ExplorationSummaryBackendApiService.ts @@ -20,9 +20,7 @@ require('services/AlertsService.ts'); require('services/ValidatorsService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ExplorationSummaryBackendApiService', [ +angular.module('oppia').factory('ExplorationSummaryBackendApiService', [ '$http', '$q', 'AlertsService', 'ValidatorsService', 'EXPLORATION_SUMMARY_DATA_URL_TEMPLATE', function( diff --git a/core/templates/dev/head/domain/topic/EditableTopicBackendApiService.ts b/core/templates/dev/head/domain/topic/EditableTopicBackendApiService.ts index 1129b1344e06..4fa464856cff 100644 --- a/core/templates/dev/head/domain/topic/EditableTopicBackendApiService.ts +++ b/core/templates/dev/head/domain/topic/EditableTopicBackendApiService.ts @@ -20,15 +20,13 @@ require('domain/utilities/UrlInterpolationService.ts'); require('domain/topic/topic-domain.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('EditableTopicBackendApiService', [ +angular.module('oppia').factory('EditableTopicBackendApiService', [ '$http', '$q', 'UrlInterpolationService', 'EDITABLE_TOPIC_DATA_URL_TEMPLATE', 'SUBTOPIC_PAGE_EDITOR_DATA_URL_TEMPLATE', - 'TOPIC_EDITOR_QUESTION_URL_TEMPLATE', 'TOPIC_EDITOR_STORY_URL_TEMPLATE', + 'TOPIC_EDITOR_STORY_URL_TEMPLATE', function($http, $q, UrlInterpolationService, EDITABLE_TOPIC_DATA_URL_TEMPLATE, SUBTOPIC_PAGE_EDITOR_DATA_URL_TEMPLATE, - TOPIC_EDITOR_QUESTION_URL_TEMPLATE, TOPIC_EDITOR_STORY_URL_TEMPLATE) { + TOPIC_EDITOR_STORY_URL_TEMPLATE) { var _fetchTopic = function( topicId, successCallback, errorCallback) { var topicDataUrl = UrlInterpolationService.interpolateUrl( diff --git a/core/templates/dev/head/domain/topic/SubtopicObjectFactory.ts b/core/templates/dev/head/domain/topic/SubtopicObjectFactory.ts index 85eb0589982b..e5a4eec440af 100644 --- a/core/templates/dev/head/domain/topic/SubtopicObjectFactory.ts +++ b/core/templates/dev/head/domain/topic/SubtopicObjectFactory.ts @@ -19,10 +19,8 @@ require('domain/skill/SkillSummaryObjectFactory.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('SubtopicObjectFactory', ['SkillSummaryObjectFactory', - function(SkillSummaryObjectFactory) { +angular.module('oppia').factory('SubtopicObjectFactory', [ + 'SkillSummaryObjectFactory', function(SkillSummaryObjectFactory) { var Subtopic = function( subtopicId, title, skillIds, skillIdToDescriptionMap) { this._id = subtopicId; diff --git a/core/templates/dev/head/domain/topic/SubtopicPageContentsObjectFactory.ts b/core/templates/dev/head/domain/topic/SubtopicPageContentsObjectFactory.ts index a65a4f1478bc..08379bfe272c 100644 --- a/core/templates/dev/head/domain/topic/SubtopicPageContentsObjectFactory.ts +++ b/core/templates/dev/head/domain/topic/SubtopicPageContentsObjectFactory.ts @@ -20,9 +20,7 @@ require('domain/exploration/RecordedVoiceoversObjectFactory.ts'); require('domain/exploration/SubtitledHtmlObjectFactory.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('SubtopicPageContentsObjectFactory', [ +angular.module('oppia').factory('SubtopicPageContentsObjectFactory', [ 'RecordedVoiceoversObjectFactory', 'SubtitledHtmlObjectFactory', function(RecordedVoiceoversObjectFactory, SubtitledHtmlObjectFactory) { var SubtopicPageContents = function(subtitledHtml, recordedVoiceovers) { diff --git a/core/templates/dev/head/domain/topic/SubtopicPageObjectFactory.ts b/core/templates/dev/head/domain/topic/SubtopicPageObjectFactory.ts index 243e86330991..a27fedc786a4 100644 --- a/core/templates/dev/head/domain/topic/SubtopicPageObjectFactory.ts +++ b/core/templates/dev/head/domain/topic/SubtopicPageObjectFactory.ts @@ -19,9 +19,7 @@ require('domain/topic/SubtopicPageContentsObjectFactory.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('SubtopicPageObjectFactory', [ +angular.module('oppia').factory('SubtopicPageObjectFactory', [ 'SubtopicPageContentsObjectFactory', function(SubtopicPageContentsObjectFactory) { var SubtopicPage = function( diff --git a/core/templates/dev/head/domain/topic/TopicObjectFactory.ts b/core/templates/dev/head/domain/topic/TopicObjectFactory.ts index 67c62b11ac96..fbea568fda17 100644 --- a/core/templates/dev/head/domain/topic/TopicObjectFactory.ts +++ b/core/templates/dev/head/domain/topic/TopicObjectFactory.ts @@ -20,9 +20,7 @@ require('domain/skill/SkillSummaryObjectFactory.ts'); require('domain/topic/SubtopicObjectFactory.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('TopicObjectFactory', [ +angular.module('oppia').factory('TopicObjectFactory', [ 'SkillSummaryObjectFactory', 'SubtopicObjectFactory', function(SkillSummaryObjectFactory, SubtopicObjectFactory) { var Topic = function( diff --git a/core/templates/dev/head/domain/topic/TopicRightsBackendApiService.ts b/core/templates/dev/head/domain/topic/TopicRightsBackendApiService.ts index fb6e515830c6..c54e9eeef327 100644 --- a/core/templates/dev/head/domain/topic/TopicRightsBackendApiService.ts +++ b/core/templates/dev/head/domain/topic/TopicRightsBackendApiService.ts @@ -20,13 +20,11 @@ require('domain/utilities/UrlInterpolationService.ts'); require('domain/topic/topic-domain.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('TopicRightsBackendApiService', [ - '$http', '$log', '$q', 'UrlInterpolationService', - 'TOPIC_MANAGER_RIGHTS_URL_TEMPLATE', 'TOPIC_RIGHTS_URL_TEMPLATE', - function($http, $log, $q, UrlInterpolationService, - TOPIC_MANAGER_RIGHTS_URL_TEMPLATE, TOPIC_RIGHTS_URL_TEMPLATE) { +angular.module('oppia').factory('TopicRightsBackendApiService', [ + '$http', '$q', 'UrlInterpolationService', + 'TOPIC_RIGHTS_URL_TEMPLATE', + function($http, $q, UrlInterpolationService, + TOPIC_RIGHTS_URL_TEMPLATE) { // Maps previously loaded topic rights to their IDs. var topicRightsCache = {}; diff --git a/core/templates/dev/head/domain/topic/TopicRightsObjectFactory.ts b/core/templates/dev/head/domain/topic/TopicRightsObjectFactory.ts index b9368703138d..f203536782e5 100644 --- a/core/templates/dev/head/domain/topic/TopicRightsObjectFactory.ts +++ b/core/templates/dev/head/domain/topic/TopicRightsObjectFactory.ts @@ -101,8 +101,6 @@ export class TopicRightsObjectFactory { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'TopicRightsObjectFactory', downgradeInjectable(TopicRightsObjectFactory)); diff --git a/core/templates/dev/head/domain/topic/TopicUpdateService.ts b/core/templates/dev/head/domain/topic/TopicUpdateService.ts index 60bf9c8dbcf2..4c3c7b498bc2 100644 --- a/core/templates/dev/head/domain/topic/TopicUpdateService.ts +++ b/core/templates/dev/head/domain/topic/TopicUpdateService.ts @@ -24,9 +24,7 @@ require('domain/editor/undo_redo/UndoRedoService.ts'); require('domain/topic/topic-domain.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('TopicUpdateService', [ +angular.module('oppia').factory('TopicUpdateService', [ 'ChangeObjectFactory', 'UndoRedoService', 'CMD_ADD_SUBTOPIC', 'CMD_ADD_UNCATEGORIZED_SKILL_ID', 'CMD_DELETE_SUBTOPIC', 'CMD_MOVE_SKILL_ID_TO_SUBTOPIC', diff --git a/core/templates/dev/head/domain/topic/topic-domain.constants.ts b/core/templates/dev/head/domain/topic/topic-domain.constants.ts index 5430eb7bdc9f..fa05a7543f9d 100644 --- a/core/templates/dev/head/domain/topic/topic-domain.constants.ts +++ b/core/templates/dev/head/domain/topic/topic-domain.constants.ts @@ -16,45 +16,50 @@ * @fileoverview Constants for topic domain. */ -var oppia = require('AppInit.ts').module; - -oppia.constant( +angular.module('oppia').constant( 'TOPIC_EDITOR_STORY_URL_TEMPLATE', '/topic_editor_story_handler/'); -oppia.constant( +angular.module('oppia').constant( 'TOPIC_EDITOR_QUESTION_URL_TEMPLATE', '/topic_editor_question_handler/?cursor='); -oppia.constant( +angular.module('oppia').constant( 'TOPIC_MANAGER_RIGHTS_URL_TEMPLATE', '/rightshandler/assign_topic_manager//'); -oppia.constant( +angular.module('oppia').constant( 'TOPIC_RIGHTS_URL_TEMPLATE', '/rightshandler/get_topic_rights/'); // These should match the constants defined in core.domain.topic_domain. -oppia.constant('CMD_ADD_SUBTOPIC', 'add_subtopic'); -oppia.constant('CMD_DELETE_SUBTOPIC', 'delete_subtopic'); -oppia.constant('CMD_ADD_UNCATEGORIZED_SKILL_ID', 'add_uncategorized_skill_id'); -oppia.constant( +angular.module('oppia').constant('CMD_ADD_SUBTOPIC', 'add_subtopic'); +angular.module('oppia').constant('CMD_DELETE_SUBTOPIC', 'delete_subtopic'); +angular.module('oppia').constant( + 'CMD_ADD_UNCATEGORIZED_SKILL_ID', 'add_uncategorized_skill_id'); +angular.module('oppia').constant( 'CMD_REMOVE_UNCATEGORIZED_SKILL_ID', 'remove_uncategorized_skill_id'); -oppia.constant('CMD_MOVE_SKILL_ID_TO_SUBTOPIC', 'move_skill_id_to_subtopic'); -oppia.constant( +angular.module('oppia').constant( + 'CMD_MOVE_SKILL_ID_TO_SUBTOPIC', 'move_skill_id_to_subtopic'); +angular.module('oppia').constant( 'CMD_REMOVE_SKILL_ID_FROM_SUBTOPIC', 'remove_skill_id_from_subtopic'); -oppia.constant('CMD_UPDATE_TOPIC_PROPERTY', 'update_topic_property'); -oppia.constant('CMD_UPDATE_SUBTOPIC_PROPERTY', 'update_subtopic_property'); -oppia.constant( +angular.module('oppia').constant( + 'CMD_UPDATE_TOPIC_PROPERTY', 'update_topic_property'); +angular.module('oppia').constant( + 'CMD_UPDATE_SUBTOPIC_PROPERTY', 'update_subtopic_property'); +angular.module('oppia').constant( 'CMD_UPDATE_SUBTOPIC_PAGE_PROPERTY', 'update_subtopic_page_property'); -oppia.constant('TOPIC_PROPERTY_NAME', 'name'); -oppia.constant('TOPIC_PROPERTY_DESCRIPTION', 'description'); -oppia.constant('TOPIC_PROPERTY_CANONICAL_STORY_IDS', 'canonical_story_ids'); -oppia.constant('TOPIC_PROPERTY_ADDITIONAL_STORY_IDS', 'additional_story_ids'); -oppia.constant('TOPIC_PROPERTY_LANGUAGE_CODE', 'language_code'); +angular.module('oppia').constant('TOPIC_PROPERTY_NAME', 'name'); +angular.module('oppia').constant('TOPIC_PROPERTY_DESCRIPTION', 'description'); +angular.module('oppia').constant( + 'TOPIC_PROPERTY_CANONICAL_STORY_IDS', 'canonical_story_ids'); +angular.module('oppia').constant( + 'TOPIC_PROPERTY_ADDITIONAL_STORY_IDS', 'additional_story_ids'); +angular.module('oppia').constant( + 'TOPIC_PROPERTY_LANGUAGE_CODE', 'language_code'); -oppia.constant('SUBTOPIC_PROPERTY_TITLE', 'title'); +angular.module('oppia').constant('SUBTOPIC_PROPERTY_TITLE', 'title'); -oppia.constant( +angular.module('oppia').constant( 'SUBTOPIC_PAGE_PROPERTY_PAGE_CONTENTS_HTML', 'page_contents_html'); -oppia.constant( +angular.module('oppia').constant( 'SUBTOPIC_PAGE_PROPERTY_PAGE_CONTENTS_AUDIO', 'page_contents_audio'); diff --git a/core/templates/dev/head/domain/topic_viewer/TopicViewerBackendApiService.ts b/core/templates/dev/head/domain/topic_viewer/TopicViewerBackendApiService.ts index 6543642d1a47..efe9d88082ea 100644 --- a/core/templates/dev/head/domain/topic_viewer/TopicViewerBackendApiService.ts +++ b/core/templates/dev/head/domain/topic_viewer/TopicViewerBackendApiService.ts @@ -20,9 +20,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('domain/topic_viewer/topic-viewer-domain.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('TopicViewerBackendApiService', [ +angular.module('oppia').factory('TopicViewerBackendApiService', [ '$http', '$q', 'UrlInterpolationService', 'TOPIC_DATA_URL_TEMPLATE', function($http, $q, UrlInterpolationService, TOPIC_DATA_URL_TEMPLATE) { var topicDataDict = null; diff --git a/core/templates/dev/head/domain/topic_viewer/topic-viewer-domain.constants.ts b/core/templates/dev/head/domain/topic_viewer/topic-viewer-domain.constants.ts index 3754d6b11949..ae1921307afb 100644 --- a/core/templates/dev/head/domain/topic_viewer/topic-viewer-domain.constants.ts +++ b/core/templates/dev/head/domain/topic_viewer/topic-viewer-domain.constants.ts @@ -16,7 +16,5 @@ * @fileoverview Constants for the topic viewer domain. */ -var oppia = require('AppInit.ts').module; - -oppia.constant( +angular.module('oppia').constant( 'TOPIC_DATA_URL_TEMPLATE', '/topic_data_handler/'); diff --git a/core/templates/dev/head/domain/topics_and_skills_dashboard/TopicsAndSkillsDashboardBackendApiService.ts b/core/templates/dev/head/domain/topics_and_skills_dashboard/TopicsAndSkillsDashboardBackendApiService.ts index 01215968add9..71822b9ce601 100644 --- a/core/templates/dev/head/domain/topics_and_skills_dashboard/TopicsAndSkillsDashboardBackendApiService.ts +++ b/core/templates/dev/head/domain/topics_and_skills_dashboard/TopicsAndSkillsDashboardBackendApiService.ts @@ -21,9 +21,7 @@ require( 'domain/topics_and_skills_dashboard/' + 'topics-and-skills-dashboard-domain.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('TopicsAndSkillsDashboardBackendApiService', [ +angular.module('oppia').factory('TopicsAndSkillsDashboardBackendApiService', [ '$http', 'MERGE_SKILLS_URL', function($http, MERGE_SKILLS_URL) { var _fetchDashboardData = function() { return $http.get('/topics_and_skills_dashboard/data'); diff --git a/core/templates/dev/head/domain/topics_and_skills_dashboard/topics-and-skills-dashboard-domain.constants.ts b/core/templates/dev/head/domain/topics_and_skills_dashboard/topics-and-skills-dashboard-domain.constants.ts index 01dea16b05d4..1439a57fffcf 100644 --- a/core/templates/dev/head/domain/topics_and_skills_dashboard/topics-and-skills-dashboard-domain.constants.ts +++ b/core/templates/dev/head/domain/topics_and_skills_dashboard/topics-and-skills-dashboard-domain.constants.ts @@ -16,6 +16,4 @@ * @fileoverview Constants for topics and skills dashboard domain. */ -var oppia = require('AppInit.ts').module; - -oppia.constant('MERGE_SKILLS_URL', '/merge_skills_handler'); +angular.module('oppia').constant('MERGE_SKILLS_URL', '/merge_skills_handler'); diff --git a/core/templates/dev/head/domain/user/UserInfoObjectFactory.ts b/core/templates/dev/head/domain/user/UserInfoObjectFactory.ts index e7c400872e8d..448b0f9dc531 100644 --- a/core/templates/dev/head/domain/user/UserInfoObjectFactory.ts +++ b/core/templates/dev/head/domain/user/UserInfoObjectFactory.ts @@ -96,8 +96,6 @@ export class UserInfoObjectFactory { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'UserInfoObjectFactory', downgradeInjectable(UserInfoObjectFactory)); diff --git a/core/templates/dev/head/domain/utilities/AudioFileObjectFactory.ts b/core/templates/dev/head/domain/utilities/AudioFileObjectFactory.ts index 8956ddfb392d..2fe731d0722e 100644 --- a/core/templates/dev/head/domain/utilities/AudioFileObjectFactory.ts +++ b/core/templates/dev/head/domain/utilities/AudioFileObjectFactory.ts @@ -38,8 +38,6 @@ export class AudioFileObjectFactory { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'AudioFileObjectFactory', downgradeInjectable(AudioFileObjectFactory)); diff --git a/core/templates/dev/head/domain/utilities/AudioLanguageObjectFactory.ts b/core/templates/dev/head/domain/utilities/AudioLanguageObjectFactory.ts index 97832f58f9ee..88dc34170283 100644 --- a/core/templates/dev/head/domain/utilities/AudioLanguageObjectFactory.ts +++ b/core/templates/dev/head/domain/utilities/AudioLanguageObjectFactory.ts @@ -46,8 +46,6 @@ export class AudioLanguageObjectFactory { audioLanguageDict.related_languages); } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'AudioLanguageObjectFactory', downgradeInjectable(AudioLanguageObjectFactory)); diff --git a/core/templates/dev/head/domain/utilities/AutogeneratedAudioLanguageObjectFactory.ts b/core/templates/dev/head/domain/utilities/AutogeneratedAudioLanguageObjectFactory.ts index aa94b24657a4..8a78bb34bc0f 100644 --- a/core/templates/dev/head/domain/utilities/AutogeneratedAudioLanguageObjectFactory.ts +++ b/core/templates/dev/head/domain/utilities/AutogeneratedAudioLanguageObjectFactory.ts @@ -55,8 +55,6 @@ export class AutogeneratedAudioLanguageObjectFactory { autogeneratedAudioLanguageDict.speech_synthesis_code_mobile); } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'AutogeneratedAudioLanguageObjectFactory', downgradeInjectable(AutogeneratedAudioLanguageObjectFactory)); diff --git a/core/templates/dev/head/domain/utilities/BrowserCheckerService.ts b/core/templates/dev/head/domain/utilities/BrowserCheckerService.ts index d95b2f0e1f89..1a456bf78912 100644 --- a/core/templates/dev/head/domain/utilities/BrowserCheckerService.ts +++ b/core/templates/dev/head/domain/utilities/BrowserCheckerService.ts @@ -16,9 +16,7 @@ * @fileoverview Utility service for checking web browser type. */ -var oppia = require('AppInit.ts').module; - -oppia.factory('BrowserCheckerService', [ +angular.module('oppia').factory('BrowserCheckerService', [ 'AUTOGENERATED_AUDIO_LANGUAGES', function(AUTOGENERATED_AUDIO_LANGUAGES) { // For details on the reliability of this check, see diff --git a/core/templates/dev/head/domain/utilities/FileDownloadRequestObjectFactory.ts b/core/templates/dev/head/domain/utilities/FileDownloadRequestObjectFactory.ts index 3ff08a80e461..67b27db60e80 100644 --- a/core/templates/dev/head/domain/utilities/FileDownloadRequestObjectFactory.ts +++ b/core/templates/dev/head/domain/utilities/FileDownloadRequestObjectFactory.ts @@ -43,8 +43,6 @@ export class FileDownloadRequestObjectFactory { return new FileDownloadRequest(filename, canceler); } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'FileDownloadRequestObjectFactory', downgradeInjectable(FileDownloadRequestObjectFactory)); diff --git a/core/templates/dev/head/domain/utilities/ImageFileObjectFactory.ts b/core/templates/dev/head/domain/utilities/ImageFileObjectFactory.ts index d0a1ffcbdc1d..9384ef686f9c 100644 --- a/core/templates/dev/head/domain/utilities/ImageFileObjectFactory.ts +++ b/core/templates/dev/head/domain/utilities/ImageFileObjectFactory.ts @@ -38,8 +38,6 @@ export class ImageFileObjectFactory { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'ImageFileObjectFactory', downgradeInjectable(ImageFileObjectFactory)); diff --git a/core/templates/dev/head/domain/utilities/LanguageUtilService.ts b/core/templates/dev/head/domain/utilities/LanguageUtilService.ts index 7d9972852ebd..e9ce79f45801 100644 --- a/core/templates/dev/head/domain/utilities/LanguageUtilService.ts +++ b/core/templates/dev/head/domain/utilities/LanguageUtilService.ts @@ -20,9 +20,7 @@ require('domain/utilities/AudioLanguageObjectFactory.ts'); require('domain/utilities/AutogeneratedAudioLanguageObjectFactory.ts'); require('domain/utilities/BrowserCheckerService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('LanguageUtilService', [ +angular.module('oppia').factory('LanguageUtilService', [ 'AudioLanguageObjectFactory', 'AutogeneratedAudioLanguageObjectFactory', 'BrowserCheckerService', 'ALL_LANGUAGE_CODES', 'AUTOGENERATED_AUDIO_LANGUAGES', 'SUPPORTED_AUDIO_LANGUAGES', diff --git a/core/templates/dev/head/domain/utilities/StopwatchObjectFactory.ts b/core/templates/dev/head/domain/utilities/StopwatchObjectFactory.ts index b46adf6d673f..371e745e8692 100644 --- a/core/templates/dev/head/domain/utilities/StopwatchObjectFactory.ts +++ b/core/templates/dev/head/domain/utilities/StopwatchObjectFactory.ts @@ -18,33 +18,32 @@ // A simple service that provides stopwatch instances. Each stopwatch can be // independently reset and queried for the current time. -var oppia = require('AppInit.ts').module; +angular.module('oppia').factory('StopwatchObjectFactory', [ + '$log', function($log) { + var Stopwatch = function() { + this.startTime = null; + }; -oppia.factory('StopwatchObjectFactory', ['$log', function($log) { - var Stopwatch = function() { - this.startTime = null; - }; - - Stopwatch.prototype = { - _getCurrentTime: function() { - return Date.now(); - }, - reset: function() { - this.startTime = this._getCurrentTime(); - }, - getTimeInSecs: function() { - if (this.startTime === null) { - $log.error( - 'Tried to retrieve the elapsed time, but no start time was set.'); - return null; + Stopwatch.prototype = { + _getCurrentTime: function() { + return Date.now(); + }, + reset: function() { + this.startTime = this._getCurrentTime(); + }, + getTimeInSecs: function() { + if (this.startTime === null) { + $log.error( + 'Tried to retrieve the elapsed time, but no start time was set.'); + return null; + } + return (this._getCurrentTime() - this.startTime) / 1000; } - return (this._getCurrentTime() - this.startTime) / 1000; - } - }; + }; - return { - create: function() { - return new Stopwatch(); - } - }; -}]); + return { + create: function() { + return new Stopwatch(); + } + }; + }]); diff --git a/core/templates/dev/head/domain/utilities/UrlInterpolationService.ts b/core/templates/dev/head/domain/utilities/UrlInterpolationService.ts index 90394f99097e..32954531baee 100644 --- a/core/templates/dev/head/domain/utilities/UrlInterpolationService.ts +++ b/core/templates/dev/head/domain/utilities/UrlInterpolationService.ts @@ -12,19 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -require('services/AlertsService.ts'); -require('services/contextual/UrlService.ts'); -require('services/UtilsService.ts'); - -require('app.constants.ts'); /** * @fileoverview Service to construct URLs by inserting variables within them as * necessary to have a fully-qualified URL. */ +require('services/AlertsService.ts'); +require('services/contextual/UrlService.ts'); +require('services/UtilsService.ts'); -var oppia = require('AppInit.ts').module; +require('app.constants.ts'); -oppia.factory('UrlInterpolationService', [ +angular.module('oppia').factory('UrlInterpolationService', [ 'AlertsService', 'UrlService', 'UtilsService', 'DEV_MODE', function(AlertsService, UrlService, UtilsService, DEV_MODE) { var validateResourcePath = function(resourcePath) { diff --git a/core/templates/dev/head/expressions/ExpressionEvaluatorService.ts b/core/templates/dev/head/expressions/ExpressionEvaluatorService.ts index 7b90cb328ed5..cb5c4c403a8e 100644 --- a/core/templates/dev/head/expressions/ExpressionEvaluatorService.ts +++ b/core/templates/dev/head/expressions/ExpressionEvaluatorService.ts @@ -66,11 +66,9 @@ require('expressions/ExpressionParserService.js'); require('expressions/ExpressionSyntaxTreeService.ts'); // Service for expression evaluation. -var oppia = require('AppInit.ts').module; - -oppia.factory('ExpressionEvaluatorService', [ - '$log', 'ExpressionParserService', 'ExpressionSyntaxTreeService', - function($log, ExpressionParserService, ExpressionSyntaxTreeService) { +angular.module('oppia').factory('ExpressionEvaluatorService', [ + 'ExpressionParserService', 'ExpressionSyntaxTreeService', + function(ExpressionParserService, ExpressionSyntaxTreeService) { var evaluateExpression = function(expression, envs) { return ExpressionSyntaxTreeService.applyFunctionToParseTree( ExpressionParserService.parse(expression), envs, evaluate); diff --git a/core/templates/dev/head/expressions/ExpressionInterpolationService.ts b/core/templates/dev/head/expressions/ExpressionInterpolationService.ts index 7f0d2caf161f..ca7218857e4d 100644 --- a/core/templates/dev/head/expressions/ExpressionInterpolationService.ts +++ b/core/templates/dev/head/expressions/ExpressionInterpolationService.ts @@ -35,9 +35,7 @@ require('services/HtmlEscaperService.ts'); // processUnicode('abc{{a}}', [{}]) returns null. // processUnicode('{[a}}', [{'a': ''}]) returns // ''. -var oppia = require('AppInit.ts').module; - -oppia.factory('ExpressionInterpolationService', [ +angular.module('oppia').factory('ExpressionInterpolationService', [ '$filter', 'ExpressionEvaluatorService', 'ExpressionParserService', 'ExpressionSyntaxTreeService', 'HtmlEscaperService', function( diff --git a/core/templates/dev/head/expressions/ExpressionParserService.js b/core/templates/dev/head/expressions/ExpressionParserService.js index b38049faab12..9435b8ec7892 100644 --- a/core/templates/dev/head/expressions/ExpressionParserService.js +++ b/core/templates/dev/head/expressions/ExpressionParserService.js @@ -1,6 +1,4 @@ -var oppia = require('AppInit.ts').module; - -oppia.factory('ExpressionParserService', ['$log', function($log) { +angular.module('oppia').factory('ExpressionParserService', ['$log', function($log) { /* * Generated by PEG.js 0.8.0. * diff --git a/core/templates/dev/head/expressions/ExpressionSyntaxTreeService.ts b/core/templates/dev/head/expressions/ExpressionSyntaxTreeService.ts index f6bf197fc30f..9618c5ad1e3c 100644 --- a/core/templates/dev/head/expressions/ExpressionSyntaxTreeService.ts +++ b/core/templates/dev/head/expressions/ExpressionSyntaxTreeService.ts @@ -18,11 +18,9 @@ require('expressions/ExpressionParserService.js'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ExpressionSyntaxTreeService', [ - '$log', 'ExpressionParserService', 'PARAMETER_TYPES', - function($log, ExpressionParserService, PARAMETER_TYPES) { +angular.module('oppia').factory('ExpressionSyntaxTreeService', [ + 'ExpressionParserService', 'PARAMETER_TYPES', + function(ExpressionParserService, PARAMETER_TYPES) { // Exceptions that can be thrown from the evaluation of expressions. const ExpressionError = function() {}; ExpressionError.prototype = new Error(); diff --git a/core/templates/dev/head/expressions/ExpressionTypeParserService.ts b/core/templates/dev/head/expressions/ExpressionTypeParserService.ts index c9021d650a7b..7ab7054f69ec 100644 --- a/core/templates/dev/head/expressions/ExpressionTypeParserService.ts +++ b/core/templates/dev/head/expressions/ExpressionTypeParserService.ts @@ -19,13 +19,11 @@ require('expressions/ExpressionParserService.js'); require('expressions/ExpressionSyntaxTreeService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ExpressionTypeParserService', [ - '$log', 'ExpressionParserService', 'ExpressionSyntaxTreeService', +angular.module('oppia').factory('ExpressionTypeParserService', [ + 'ExpressionParserService', 'ExpressionSyntaxTreeService', 'PARAMETER_TYPES', function( - $log, ExpressionParserService, ExpressionSyntaxTreeService, + ExpressionParserService, ExpressionSyntaxTreeService, PARAMETER_TYPES) { var getExpressionOutputType = function(expression, envs) { return ExpressionSyntaxTreeService.applyFunctionToParseTree( diff --git a/core/templates/dev/head/filters/convert-html-to-unicode.filter.ts b/core/templates/dev/head/filters/convert-html-to-unicode.filter.ts index 6547ac9ca96a..7af0e97ebb4c 100644 --- a/core/templates/dev/head/filters/convert-html-to-unicode.filter.ts +++ b/core/templates/dev/head/filters/convert-html-to-unicode.filter.ts @@ -16,9 +16,7 @@ * @fileoverview Converts HTML to unicode. */ -var oppia = require('AppInit.ts').module; - -oppia.filter('convertHtmlToUnicode', [function() { +angular.module('oppia').filter('convertHtmlToUnicode', [function() { return function(html) { return angular.element('
' + html + '
').text(); }; diff --git a/core/templates/dev/head/filters/convert-unicode-to-html.filter.ts b/core/templates/dev/head/filters/convert-unicode-to-html.filter.ts index 0bf8332de49c..2a4703de246d 100644 --- a/core/templates/dev/head/filters/convert-unicode-to-html.filter.ts +++ b/core/templates/dev/head/filters/convert-unicode-to-html.filter.ts @@ -18,9 +18,7 @@ require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.filter('convertUnicodeToHtml', [ +angular.module('oppia').filter('convertUnicodeToHtml', [ '$sanitize', 'HtmlEscaperService', function($sanitize, HtmlEscaperService) { return function(text) { diff --git a/core/templates/dev/head/filters/convert-unicode-with-params-to-html.filter.ts b/core/templates/dev/head/filters/convert-unicode-with-params-to-html.filter.ts index 2d730e42f244..fab7c3ac7c3d 100644 --- a/core/templates/dev/head/filters/convert-unicode-with-params-to-html.filter.ts +++ b/core/templates/dev/head/filters/convert-unicode-with-params-to-html.filter.ts @@ -23,77 +23,76 @@ require('filters/convert-unicode-to-html.filter.ts'); -var oppia = require('AppInit.ts').module; - -oppia.filter('convertUnicodeWithParamsToHtml', ['$filter', function($filter) { - var assert = function(text) { - if (!text) { - throw 'Invalid unicode-string-with-parameters: ' + text; - } - }; +angular.module('oppia').filter('convertUnicodeWithParamsToHtml', [ + '$filter', function($filter) { + var assert = function(text) { + if (!text) { + throw 'Invalid unicode-string-with-parameters: ' + text; + } + }; - return function(text) { - // The parsing here needs to be done with more care because we are replacing - // two-character strings. We can't naively break by {{ because in strings - // like \{{{ the second and third characters will be taken as the opening - // brackets, which is wrong. We can't unescape characters because then the - // { characters that remain will be ambiguous (they may either be the - // openings of parameters or literal '{' characters entered by the user. - // So we build a standard left-to-right parser which examines each - // character of the string in turn, and processes it accordingly. - var textFragments = []; - var currentFragment = ''; - var currentFragmentIsParam = false; - for (var i = 0; i < text.length; i++) { - if (text[i] === '\\') { - assert(!currentFragmentIsParam && text.length > i + 1 && { - '{': true, - '}': true, - '\\': true - }[text[i + 1]]); - currentFragment += text[i + 1]; - i++; - } else if (text[i] === '{') { - assert( - text.length > i + 1 && !currentFragmentIsParam && - text[i + 1] === '{'); - textFragments.push({ - type: 'text', - data: currentFragment - }); - currentFragment = ''; - currentFragmentIsParam = true; - i++; - } else if (text[i] === '}') { - assert( - text.length > i + 1 && currentFragmentIsParam && - text[i + 1] === '}'); - textFragments.push({ - type: 'parameter', - data: currentFragment - }); - currentFragment = ''; - currentFragmentIsParam = false; - i++; - } else { - currentFragment += text[i]; + return function(text) { + // The parsing here needs to be done with more care because we are + // replacing two-character strings. We can't naively break by {{ because + // in strings like \{{{ the second and third characters will be taken as + // the opening brackets, which is wrong. We can't unescape characters + // because then the { characters that remain will be ambiguous (they may + // either be the openings of parameters or literal '{' characters entered + // by the user. So we build a standard left-to-right parser which examines + // each character of the string in turn, and processes it accordingly. + var textFragments = []; + var currentFragment = ''; + var currentFragmentIsParam = false; + for (var i = 0; i < text.length; i++) { + if (text[i] === '\\') { + assert(!currentFragmentIsParam && text.length > i + 1 && { + '{': true, + '}': true, + '\\': true + }[text[i + 1]]); + currentFragment += text[i + 1]; + i++; + } else if (text[i] === '{') { + assert( + text.length > i + 1 && !currentFragmentIsParam && + text[i + 1] === '{'); + textFragments.push({ + type: 'text', + data: currentFragment + }); + currentFragment = ''; + currentFragmentIsParam = true; + i++; + } else if (text[i] === '}') { + assert( + text.length > i + 1 && currentFragmentIsParam && + text[i + 1] === '}'); + textFragments.push({ + type: 'parameter', + data: currentFragment + }); + currentFragment = ''; + currentFragmentIsParam = false; + i++; + } else { + currentFragment += text[i]; + } } - } - assert(!currentFragmentIsParam); - textFragments.push({ - type: 'text', - data: currentFragment - }); + assert(!currentFragmentIsParam); + textFragments.push({ + type: 'text', + data: currentFragment + }); - var result = ''; - textFragments.forEach(function(fragment) { - result += ( - fragment.type === 'text' ? - $filter('convertUnicodeToHtml')(fragment.data) : - '' + fragment.data + - ''); - }); - return result; - }; -}]); + var result = ''; + textFragments.forEach(function(fragment) { + result += ( + fragment.type === 'text' ? + $filter('convertUnicodeToHtml')(fragment.data) : + '' + fragment.data + + ''); + }); + return result; + }; + }]); diff --git a/core/templates/dev/head/filters/format-rte-preview.filter.ts b/core/templates/dev/head/filters/format-rte-preview.filter.ts index ccb49ef64f3b..4d7c9e829d22 100644 --- a/core/templates/dev/head/filters/format-rte-preview.filter.ts +++ b/core/templates/dev/head/filters/format-rte-preview.filter.ts @@ -22,22 +22,21 @@ eg:

Sample1 Sample2

will give as output: Sample1 [Math] Sample2 */ -var oppia = require('AppInit.ts').module; - -oppia.filter('formatRtePreview', ['$filter', function($filter) { - return function(html) { - html = html.replace(/ /ig, ' '); - html = html.replace(/"/ig, ''); - // Replace all html tags other than ones to ''. - html = html.replace(/<(?!oppia-noninteractive\s*?)[^>]+>/g, ''); - var formattedOutput = html.replace(/(<([^>]+)>)/g, function(rteTag) { - var replaceString = $filter( - 'capitalize')(rteTag.split('-')[2].split(' ')[0]); - if (replaceString[replaceString.length - 1] === '>') { - replaceString = replaceString.slice(0, -1); - } - return ' [' + replaceString + '] '; - }); - return formattedOutput.trim(); - }; -}]); +angular.module('oppia').filter('formatRtePreview', [ + '$filter', function($filter) { + return function(html) { + html = html.replace(/ /ig, ' '); + html = html.replace(/"/ig, ''); + // Replace all html tags other than ones to ''. + html = html.replace(/<(?!oppia-noninteractive\s*?)[^>]+>/g, ''); + var formattedOutput = html.replace(/(<([^>]+)>)/g, function(rteTag) { + var replaceString = $filter( + 'capitalize')(rteTag.split('-')[2].split(' ')[0]); + if (replaceString[replaceString.length - 1] === '>') { + replaceString = replaceString.slice(0, -1); + } + return ' [' + replaceString + '] '; + }); + return formattedOutput.trim(); + }; + }]); diff --git a/core/templates/dev/head/filters/format-timer.filter.ts b/core/templates/dev/head/filters/format-timer.filter.ts index 147ccdb8ecc5..76523d637ac5 100644 --- a/core/templates/dev/head/filters/format-timer.filter.ts +++ b/core/templates/dev/head/filters/format-timer.filter.ts @@ -16,9 +16,7 @@ * @fileoverview FormatTimer filter for Oppia. */ -var oppia = require('AppInit.ts').module; - -oppia.filter('formatTimer', [function() { +angular.module('oppia').filter('formatTimer', [function() { return function(input) { var formatNum = function(n) { return (n < 10 ? '0' : '') + n; diff --git a/core/templates/dev/head/filters/parameterize-rule-description.filter.ts b/core/templates/dev/head/filters/parameterize-rule-description.filter.ts index dad514050a18..e2d0c273d27a 100644 --- a/core/templates/dev/head/filters/parameterize-rule-description.filter.ts +++ b/core/templates/dev/head/filters/parameterize-rule-description.filter.ts @@ -23,9 +23,7 @@ require('filters/format-rte-preview.filter.ts'); // Filter that changes {{...}} tags into the corresponding parameter input // values. Note that this returns an HTML string to accommodate the case of // multiple-choice input and image-click input. -var oppia = require('AppInit.ts').module; - -oppia.filter('parameterizeRuleDescription', [ +angular.module('oppia').filter('parameterizeRuleDescription', [ '$filter', 'INTERACTION_SPECS', 'FractionObjectFactory', 'NumberWithUnitsObjectFactory', function( $filter, INTERACTION_SPECS, FractionObjectFactory, NumberWithUnitsObjectFactory) { diff --git a/core/templates/dev/head/filters/remove-duplicates-in-array.filter.ts b/core/templates/dev/head/filters/remove-duplicates-in-array.filter.ts index c705ba94abc9..607f0494619d 100644 --- a/core/templates/dev/head/filters/remove-duplicates-in-array.filter.ts +++ b/core/templates/dev/head/filters/remove-duplicates-in-array.filter.ts @@ -16,9 +16,7 @@ * @fileoverview RemoveDuplicatesInArray filter for Oppia. */ -var oppia = require('AppInit.ts').module; - -oppia.filter('removeDuplicatesInArray', [function() { +angular.module('oppia').filter('removeDuplicatesInArray', [function() { return function(input) { if (!input.filter) { throw Error( diff --git a/core/templates/dev/head/filters/string-utility-filters/camel-case-to-hyphens.filter.ts b/core/templates/dev/head/filters/string-utility-filters/camel-case-to-hyphens.filter.ts index 8abc6855860a..f955f2af2153 100644 --- a/core/templates/dev/head/filters/string-utility-filters/camel-case-to-hyphens.filter.ts +++ b/core/templates/dev/head/filters/string-utility-filters/camel-case-to-hyphens.filter.ts @@ -16,9 +16,7 @@ * @fileoverview CamelCaseToHyphens filter for Oppia. */ -var oppia = require('AppInit.ts').module; - -oppia.filter('camelCaseToHyphens', [function() { +angular.module('oppia').filter('camelCaseToHyphens', [function() { return function(input) { var result = input.replace(/([a-z])?([A-Z])/g, '$1-$2').toLowerCase(); if (result[0] === '-') { diff --git a/core/templates/dev/head/filters/string-utility-filters/capitalize.filter.ts b/core/templates/dev/head/filters/string-utility-filters/capitalize.filter.ts index 916165f1717e..6ecc74eb1995 100644 --- a/core/templates/dev/head/filters/string-utility-filters/capitalize.filter.ts +++ b/core/templates/dev/head/filters/string-utility-filters/capitalize.filter.ts @@ -16,9 +16,7 @@ * @fileoverview Capitalize filter for Oppia. */ -var oppia = require('AppInit.ts').module; - -oppia.filter('capitalize', [function() { +angular.module('oppia').filter('capitalize', [function() { return function(input) { if (!input) { return input; diff --git a/core/templates/dev/head/filters/string-utility-filters/convert-to-plain-text.filter.ts b/core/templates/dev/head/filters/string-utility-filters/convert-to-plain-text.filter.ts index 769d2360ad81..59469007ba8a 100644 --- a/core/templates/dev/head/filters/string-utility-filters/convert-to-plain-text.filter.ts +++ b/core/templates/dev/head/filters/string-utility-filters/convert-to-plain-text.filter.ts @@ -16,9 +16,7 @@ * @fileoverview ConvertToPlainText filter for Oppia. */ -var oppia = require('AppInit.ts').module; - -oppia.filter('convertToPlainText', [function() { +angular.module('oppia').filter('convertToPlainText', [function() { return function(input) { var strippedText = input.replace(/(<([^>]+)>)/ig, ''); strippedText = strippedText.replace(/ /ig, ' '); diff --git a/core/templates/dev/head/filters/string-utility-filters/get-abbreviated-text.filter.ts b/core/templates/dev/head/filters/string-utility-filters/get-abbreviated-text.filter.ts index d5a34752dfe2..3636e0730d32 100644 --- a/core/templates/dev/head/filters/string-utility-filters/get-abbreviated-text.filter.ts +++ b/core/templates/dev/head/filters/string-utility-filters/get-abbreviated-text.filter.ts @@ -16,9 +16,7 @@ * @fileoverview GetAbbreviatedText filter for Oppia. */ -var oppia = require('AppInit.ts').module; - -oppia.filter('getAbbreviatedText', [function() { +angular.module('oppia').filter('getAbbreviatedText', [function() { return function(text, characterCount) { if (text.length > characterCount) { var subject = text.substr(0, characterCount); diff --git a/core/templates/dev/head/filters/string-utility-filters/normalize-whitespace-punctuation-and-case.filter.ts b/core/templates/dev/head/filters/string-utility-filters/normalize-whitespace-punctuation-and-case.filter.ts index 4f5482669a55..8211ee12212b 100644 --- a/core/templates/dev/head/filters/string-utility-filters/normalize-whitespace-punctuation-and-case.filter.ts +++ b/core/templates/dev/head/filters/string-utility-filters/normalize-whitespace-punctuation-and-case.filter.ts @@ -20,44 +20,43 @@ // line, and removes blank lines. Note that any spaces whose removal does not // result in two alphanumeric "words" being joined together are also removed, // so "hello ? " becomes "hello?". -var oppia = require('AppInit.ts').module; +angular.module('oppia').filter('normalizeWhitespacePunctuationAndCase', [ + function() { + return function(input) { + if (typeof input === 'string' || input instanceof String) { + var isAlphanumeric = function(character) { + return 'qwertyuiopasdfghjklzxcvbnm0123456789'.indexOf( + character.toLowerCase()) !== -1; + }; -oppia.filter('normalizeWhitespacePunctuationAndCase', [function() { - return function(input) { - if (typeof input === 'string' || input instanceof String) { - var isAlphanumeric = function(character) { - return 'qwertyuiopasdfghjklzxcvbnm0123456789'.indexOf( - character.toLowerCase()) !== -1; - }; + input = input.trim(); + var inputLines = input.split('\n'); + var resultLines = []; + for (var i = 0; i < inputLines.length; i++) { + var result = ''; - input = input.trim(); - var inputLines = input.split('\n'); - var resultLines = []; - for (var i = 0; i < inputLines.length; i++) { - var result = ''; - - var inputLine = inputLines[i].trim().replace(/\s{2,}/g, ' '); - for (var j = 0; j < inputLine.length; j++) { - var currentChar = inputLine.charAt(j).toLowerCase(); - if (currentChar === ' ') { - if (j > 0 && j < inputLine.length - 1 && - isAlphanumeric(inputLine.charAt(j - 1)) && - isAlphanumeric(inputLine.charAt(j + 1))) { + var inputLine = inputLines[i].trim().replace(/\s{2,}/g, ' '); + for (var j = 0; j < inputLine.length; j++) { + var currentChar = inputLine.charAt(j).toLowerCase(); + if (currentChar === ' ') { + if (j > 0 && j < inputLine.length - 1 && + isAlphanumeric(inputLine.charAt(j - 1)) && + isAlphanumeric(inputLine.charAt(j + 1))) { + result += currentChar; + } + } else { result += currentChar; } - } else { - result += currentChar; } - } - if (result) { - resultLines.push(result); + if (result) { + resultLines.push(result); + } } - } - return resultLines.join('\n'); - } else { - return input; - } - }; -}]); + return resultLines.join('\n'); + } else { + return input; + } + }; + }]); diff --git a/core/templates/dev/head/filters/string-utility-filters/normalize-whitespace.filter.ts b/core/templates/dev/head/filters/string-utility-filters/normalize-whitespace.filter.ts index 4c7c52f0f523..317c88e64e12 100644 --- a/core/templates/dev/head/filters/string-utility-filters/normalize-whitespace.filter.ts +++ b/core/templates/dev/head/filters/string-utility-filters/normalize-whitespace.filter.ts @@ -20,18 +20,17 @@ require('services/UtilsService.ts'); // Filter that removes whitespace from the beginning and end of a string, and // replaces interior whitespace with a single space character. -var oppia = require('AppInit.ts').module; - -oppia.filter('normalizeWhitespace', ['UtilsService', function(UtilsService) { - return function(input) { - if (UtilsService.isString(input)) { - // Remove whitespace from the beginning and end of the string, and - // replace interior whitespace with a single space character. - input = input.trim(); - input = input.replace(/\s{2,}/g, ' '); - return input; - } else { - return input; - } - }; -}]); +angular.module('oppia').filter('normalizeWhitespace', [ + 'UtilsService', function(UtilsService) { + return function(input) { + if (UtilsService.isString(input)) { + // Remove whitespace from the beginning and end of the string, and + // replace interior whitespace with a single space character. + input = input.trim(); + input = input.replace(/\s{2,}/g, ' '); + return input; + } else { + return input; + } + }; + }]); diff --git a/core/templates/dev/head/filters/string-utility-filters/replace-inputs-with-ellipses.filter.ts b/core/templates/dev/head/filters/string-utility-filters/replace-inputs-with-ellipses.filter.ts index 4c569402511d..e80940654846 100644 --- a/core/templates/dev/head/filters/string-utility-filters/replace-inputs-with-ellipses.filter.ts +++ b/core/templates/dev/head/filters/string-utility-filters/replace-inputs-with-ellipses.filter.ts @@ -17,9 +17,7 @@ */ // Filter that replaces all {{...}} in a string with '...'. -var oppia = require('AppInit.ts').module; - -oppia.filter('replaceInputsWithEllipses', [function() { +angular.module('oppia').filter('replaceInputsWithEllipses', [function() { var pattern = /\{\{\s*(\w+)\s*(\|\s*\w+\s*)?\}\}/g; return function(input) { return input ? input.replace(pattern, '...') : ''; diff --git a/core/templates/dev/head/filters/string-utility-filters/truncate-and-capitalize.filter.ts b/core/templates/dev/head/filters/string-utility-filters/truncate-and-capitalize.filter.ts index 2e2de68bc209..937cd858119b 100644 --- a/core/templates/dev/head/filters/string-utility-filters/truncate-and-capitalize.filter.ts +++ b/core/templates/dev/head/filters/string-utility-filters/truncate-and-capitalize.filter.ts @@ -17,9 +17,7 @@ */ // Note that this filter does not truncate at the middle of a word. -var oppia = require('AppInit.ts').module; - -oppia.filter('truncateAndCapitalize', [function() { +angular.module('oppia').filter('truncateAndCapitalize', [function() { return function(input, maxNumberOfCharacters) { if (!input) { return input; diff --git a/core/templates/dev/head/filters/string-utility-filters/truncate-at-first-ellipsis.filter.ts b/core/templates/dev/head/filters/string-utility-filters/truncate-at-first-ellipsis.filter.ts index 15310b2c87b7..d9ded878c43c 100644 --- a/core/templates/dev/head/filters/string-utility-filters/truncate-at-first-ellipsis.filter.ts +++ b/core/templates/dev/head/filters/string-utility-filters/truncate-at-first-ellipsis.filter.ts @@ -17,9 +17,7 @@ */ // Filter that truncates a string at the first '...'. -var oppia = require('AppInit.ts').module; - -oppia.filter('truncateAtFirstEllipsis', [function() { +angular.module('oppia').filter('truncateAtFirstEllipsis', [function() { var pattern = /\.\.\./g; return function(input) { if (!input) { diff --git a/core/templates/dev/head/filters/string-utility-filters/truncate-at-first-line.filter.ts b/core/templates/dev/head/filters/string-utility-filters/truncate-at-first-line.filter.ts index 222d2eb5a390..0bb784339f1c 100644 --- a/core/templates/dev/head/filters/string-utility-filters/truncate-at-first-line.filter.ts +++ b/core/templates/dev/head/filters/string-utility-filters/truncate-at-first-line.filter.ts @@ -16,9 +16,7 @@ * @fileoverview TruncateAtFirstLine filter for Oppia. */ -var oppia = require('AppInit.ts').module; - -oppia.filter('truncateAtFirstLine', [function() { +angular.module('oppia').filter('truncateAtFirstLine', [function() { return function(input) { if (!input) { return input; diff --git a/core/templates/dev/head/filters/string-utility-filters/truncate.filter.ts b/core/templates/dev/head/filters/string-utility-filters/truncate.filter.ts index 88acb543893c..5b15c2a759bb 100644 --- a/core/templates/dev/head/filters/string-utility-filters/truncate.filter.ts +++ b/core/templates/dev/head/filters/string-utility-filters/truncate.filter.ts @@ -19,9 +19,7 @@ require('filters/string-utility-filters/convert-to-plain-text.filter.ts'); // Filter that truncates long descriptors. -var oppia = require('AppInit.ts').module; - -oppia.filter('truncate', ['$filter', function($filter) { +angular.module('oppia').filter('truncate', ['$filter', function($filter) { return function(input, length, suffix) { if (!input) { return ''; diff --git a/core/templates/dev/head/filters/string-utility-filters/underscores-to-camel-case.filter.ts b/core/templates/dev/head/filters/string-utility-filters/underscores-to-camel-case.filter.ts index e57313a25457..c0d6661bc997 100644 --- a/core/templates/dev/head/filters/string-utility-filters/underscores-to-camel-case.filter.ts +++ b/core/templates/dev/head/filters/string-utility-filters/underscores-to-camel-case.filter.ts @@ -16,9 +16,7 @@ * @fileoverview UnderscoresToCamelCase filter for Oppia. */ -var oppia = require('AppInit.ts').module; - -oppia.filter('underscoresToCamelCase', [function() { +angular.module('oppia').filter('underscoresToCamelCase', [function() { return function(input) { return input.replace(/_+(.)/g, function(match, group1) { return group1.toUpperCase(); diff --git a/core/templates/dev/head/filters/string-utility-filters/wrap-text-with-ellipsis.filter.ts b/core/templates/dev/head/filters/string-utility-filters/wrap-text-with-ellipsis.filter.ts index b2e130c7ba33..af9e673e8d8c 100644 --- a/core/templates/dev/head/filters/string-utility-filters/wrap-text-with-ellipsis.filter.ts +++ b/core/templates/dev/head/filters/string-utility-filters/wrap-text-with-ellipsis.filter.ts @@ -19,9 +19,7 @@ require('filters/string-utility-filters/normalize-whitespace.filter.ts'); require('services/UtilsService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.filter('wrapTextWithEllipsis', [ +angular.module('oppia').filter('wrapTextWithEllipsis', [ '$filter', 'UtilsService', function($filter, UtilsService) { return function(input, characterCount) { if (UtilsService.isString(input)) { diff --git a/core/templates/dev/head/filters/summarize-nonnegative-number.filter.ts b/core/templates/dev/head/filters/summarize-nonnegative-number.filter.ts index ae731d97629b..77b69cd6702d 100644 --- a/core/templates/dev/head/filters/summarize-nonnegative-number.filter.ts +++ b/core/templates/dev/head/filters/summarize-nonnegative-number.filter.ts @@ -20,9 +20,7 @@ // the appropriate metric prefix (K, M or B). For example, 167656 // becomes 167.7K. // Users of this filter should ensure that the input is a non-negative number. -var oppia = require('AppInit.ts').module; - -oppia.filter('summarizeNonnegativeNumber', [function() { +angular.module('oppia').filter('summarizeNonnegativeNumber', [function() { return function(input) { input = Number(input); // Nine zeros for billions (e.g. 146008788788 --> 146.0B). diff --git a/core/templates/dev/head/filters/truncate-input-based-on-interaction-answer-type.filter.ts b/core/templates/dev/head/filters/truncate-input-based-on-interaction-answer-type.filter.ts index c7186c85bb71..abb963bf5ae1 100644 --- a/core/templates/dev/head/filters/truncate-input-based-on-interaction-answer-type.filter.ts +++ b/core/templates/dev/head/filters/truncate-input-based-on-interaction-answer-type.filter.ts @@ -24,9 +24,7 @@ require('filters/string-utility-filters/truncate.filter.ts'); truncated. * @param {integer} length - Truncated length of answer. */ -var oppia = require('AppInit.ts').module; - -oppia.filter('truncateInputBasedOnInteractionAnswerType', [ +angular.module('oppia').filter('truncateInputBasedOnInteractionAnswerType', [ '$filter', 'INTERACTION_SPECS', function($filter, INTERACTION_SPECS) { return function(input, interactionId, length) { var answerType = INTERACTION_SPECS[interactionId].answer_type; diff --git a/core/templates/dev/head/pages/Base.ts b/core/templates/dev/head/pages/Base.ts index 9196b971b1de..8be01391a110 100644 --- a/core/templates/dev/head/pages/Base.ts +++ b/core/templates/dev/head/pages/Base.ts @@ -23,9 +23,7 @@ require('app.constants.ts'); * @fileoverview Oppia's base controller. */ -var oppia = require('AppInit.ts').module; - -oppia.controller('Base', [ +angular.module('oppia').controller('Base', [ '$document', '$rootScope', '$scope', 'CsrfTokenService', 'SidebarStatusService', 'UrlInterpolationService', 'UrlService', 'DEV_MODE', 'SITE_NAME', diff --git a/core/templates/dev/head/pages/OppiaFooterDirective.ts b/core/templates/dev/head/pages/OppiaFooterDirective.ts index 14235b782b85..6bdc00809cf3 100644 --- a/core/templates/dev/head/pages/OppiaFooterDirective.ts +++ b/core/templates/dev/head/pages/OppiaFooterDirective.ts @@ -18,19 +18,18 @@ require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaFooter', ['UrlInterpolationService', function( - UrlInterpolationService) { - return { - restrict: 'E', - scope: {}, - bindToController: {}, - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/oppia_footer_directive.html'), - controllerAs: '$ctrl', - controller: [ - function() {} - ] - }; -}]); +angular.module('oppia').directive('oppiaFooter', [ + 'UrlInterpolationService', function( + UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: {}, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/oppia_footer_directive.html'), + controllerAs: '$ctrl', + controller: [ + function() {} + ] + }; + }]); diff --git a/core/templates/dev/head/pages/about-page/about-page.controller.ts b/core/templates/dev/head/pages/about-page/about-page.controller.ts index aefbe76c1800..2ee4d3adb692 100644 --- a/core/templates/dev/head/pages/about-page/about-page.controller.ts +++ b/core/templates/dev/head/pages/about-page/about-page.controller.ts @@ -22,10 +22,8 @@ require( require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('aboutPage', ['UrlInterpolationService', - function(UrlInterpolationService) { +angular.module('oppia').directive('aboutPage', [ + 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', scope: {}, diff --git a/core/templates/dev/head/pages/about-page/about-page.module.ts b/core/templates/dev/head/pages/about-page/about-page.module.ts new file mode 100644 index 000000000000..874958a332e4 --- /dev/null +++ b/core/templates/dev/head/pages/about-page/about-page.module.ts @@ -0,0 +1,77 @@ +// Copyright 2019 The Oppia Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS-IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * @fileoverview Module for the about page. + */ + +import 'core-js/es7/reflect'; +import 'zone.js'; + +import { Component, NgModule, StaticProvider } from '@angular/core'; +import { BrowserModule } from '@angular/platform-browser'; +import { downgradeComponent } from '@angular/upgrade/static'; +import { HttpClientModule } from '@angular/common/http'; + +// This component is needed to force-bootstrap Angular at the beginning of the +// app. +@Component({ + selector: 'service-bootstrap', + template: '' +}) +export class ServiceBootstrapComponent {} + +@NgModule({ + imports: [ + BrowserModule, + HttpClientModule + ], + declarations: [ + ServiceBootstrapComponent + ], + entryComponents: [ + ServiceBootstrapComponent + ], +}) +class AboutPageModule { + // 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(AboutPageModule); +}; +const downgradedModule = downgradeModule(bootstrapFn); + +declare var angular: any; + +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', + downgradedModule +].concat( + window.GLOBALS ? (window.GLOBALS.ADDITIONAL_ANGULAR_MODULES || []) : [])) + // This directive is the downgraded version of the Angular component to + // bootstrap the Angular 8. + .directive( + 'serviceBootstrap', + downgradeComponent({ + component: ServiceBootstrapComponent + }) as angular.IDirectiveFactory); diff --git a/core/templates/dev/head/pages/about-page/about-page.scripts.ts b/core/templates/dev/head/pages/about-page/about-page.scripts.ts index 8e54dfdd50f2..c65be441172c 100644 --- a/core/templates/dev/head/pages/about-page/about-page.scripts.ts +++ b/core/templates/dev/head/pages/about-page/about-page.scripts.ts @@ -16,7 +16,7 @@ * @fileoverview Directive scripts for the about page. */ +require('pages/about-page/about-page.module.ts'); require('App.ts'); - -require('base_components/BaseContentDirective.ts'); require('pages/about-page/about-page.controller.ts'); +require('base_components/BaseContentDirective.ts'); diff --git a/core/templates/dev/head/pages/admin-page/activities-tab/admin-dev-mode-activities-tab.directive.ts b/core/templates/dev/head/pages/admin-page/activities-tab/admin-dev-mode-activities-tab.directive.ts index 009c2c603f1e..40dedec261a5 100644 --- a/core/templates/dev/head/pages/admin-page/activities-tab/admin-dev-mode-activities-tab.directive.ts +++ b/core/templates/dev/head/pages/admin-page/activities-tab/admin-dev-mode-activities-tab.directive.ts @@ -24,9 +24,7 @@ require('pages/admin-page/services/admin-task-manager.service.ts'); require('pages/admin-page/admin-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('adminDevModeActivitiesTab', [ +angular.module('oppia').directive('adminDevModeActivitiesTab', [ '$http', '$window', 'AdminDataService', 'AdminTaskManagerService', 'UrlInterpolationService', 'ADMIN_HANDLER_URL', function($http, $window, AdminDataService, AdminTaskManagerService, diff --git a/core/templates/dev/head/pages/admin-page/activities-tab/admin-prod-mode-activities-tab.directive.ts b/core/templates/dev/head/pages/admin-page/activities-tab/admin-prod-mode-activities-tab.directive.ts index da38158233b6..b63f755b810d 100644 --- a/core/templates/dev/head/pages/admin-page/activities-tab/admin-prod-mode-activities-tab.directive.ts +++ b/core/templates/dev/head/pages/admin-page/activities-tab/admin-prod-mode-activities-tab.directive.ts @@ -19,9 +19,7 @@ require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('adminProdModeActivitiesTab', [ +angular.module('oppia').directive('adminProdModeActivitiesTab', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/admin-page/admin-page.constants.ts b/core/templates/dev/head/pages/admin-page/admin-page.constants.ts index 58f941986473..8195240e57d7 100644 --- a/core/templates/dev/head/pages/admin-page/admin-page.constants.ts +++ b/core/templates/dev/head/pages/admin-page/admin-page.constants.ts @@ -16,19 +16,17 @@ * @fileoverview Constants for the Oppia admin page. */ -var oppia = require('AppInit.ts').module; - -oppia.constant( +angular.module('oppia').constant( 'ADMIN_ROLE_HANDLER_URL', '/adminrolehandler'); -oppia.constant('ADMIN_HANDLER_URL', '/adminhandler'); -oppia.constant( +angular.module('oppia').constant('ADMIN_HANDLER_URL', '/adminhandler'); +angular.module('oppia').constant( 'ADMIN_TOPICS_CSV_DOWNLOAD_HANDLER_URL', '/admintopicscsvdownloadhandler'); -oppia.constant( +angular.module('oppia').constant( 'ADMIN_JOB_OUTPUT_URL_TEMPLATE', '/adminjoboutput?job_id='); -oppia.constant('ADMIN_TAB_URLS', { +angular.module('oppia').constant('ADMIN_TAB_URLS', { ACTIVITIES: '#activities', JOBS: '#jobs', CONFIG: '#config', @@ -36,5 +34,5 @@ oppia.constant('ADMIN_TAB_URLS', { MISC: '#misc' }); -oppia.constant( +angular.module('oppia').constant( 'PROFILE_URL_TEMPLATE', '/profile/'); diff --git a/core/templates/dev/head/pages/admin-page/admin-page.directive.ts b/core/templates/dev/head/pages/admin-page/admin-page.directive.ts index 6c57a2069280..7056a9ae13da 100644 --- a/core/templates/dev/head/pages/admin-page/admin-page.directive.ts +++ b/core/templates/dev/head/pages/admin-page/admin-page.directive.ts @@ -81,9 +81,7 @@ require('pages/admin-page/services/admin-router.service.ts'); require('services/CsrfTokenService.ts'); require('services/UtilsService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('adminPage', ['UrlInterpolationService', +angular.module('oppia').directive('adminPage', ['UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/admin-page/admin-page.scripts.ts b/core/templates/dev/head/pages/admin-page/admin-page.scripts.ts index 5492fa5e19f9..1e838767af2c 100644 --- a/core/templates/dev/head/pages/admin-page/admin-page.scripts.ts +++ b/core/templates/dev/head/pages/admin-page/admin-page.scripts.ts @@ -16,6 +16,7 @@ * @fileoverview Directives required in admin panel. */ +require('AppInit.ts'); require('App.ts'); require('pages/admin-page/admin-page.directive.ts'); diff --git a/core/templates/dev/head/pages/admin-page/config-tab/admin-config-tab.directive.ts b/core/templates/dev/head/pages/admin-page/config-tab/admin-config-tab.directive.ts index a274c148ac0d..3d27ba4d8cf6 100644 --- a/core/templates/dev/head/pages/admin-page/config-tab/admin-config-tab.directive.ts +++ b/core/templates/dev/head/pages/admin-page/config-tab/admin-config-tab.directive.ts @@ -22,9 +22,7 @@ require('pages/admin-page/services/admin-task-manager.service.ts'); require('pages/admin-page/admin-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('adminConfigTab', [ +angular.module('oppia').directive('adminConfigTab', [ '$http', '$window', 'AdminDataService', 'AdminTaskManagerService', 'UrlInterpolationService', 'ADMIN_HANDLER_URL', function( diff --git a/core/templates/dev/head/pages/admin-page/jobs-tab/admin-jobs-tab.directive.ts b/core/templates/dev/head/pages/admin-page/jobs-tab/admin-jobs-tab.directive.ts index cf04fda2a145..9f755c7aaa97 100644 --- a/core/templates/dev/head/pages/admin-page/jobs-tab/admin-jobs-tab.directive.ts +++ b/core/templates/dev/head/pages/admin-page/jobs-tab/admin-jobs-tab.directive.ts @@ -21,9 +21,7 @@ require('pages/admin-page/services/admin-data.service.ts'); require('pages/admin-page/admin-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('adminJobsTab', [ +angular.module('oppia').directive('adminJobsTab', [ '$http', '$timeout', 'AdminDataService', 'UrlInterpolationService', 'ADMIN_HANDLER_URL', 'ADMIN_JOB_OUTPUT_URL_TEMPLATE', function( diff --git a/core/templates/dev/head/pages/admin-page/misc-tab/admin-misc-tab.directive.ts b/core/templates/dev/head/pages/admin-page/misc-tab/admin-misc-tab.directive.ts index dbd6d7742db3..457b32f12a81 100644 --- a/core/templates/dev/head/pages/admin-page/misc-tab/admin-misc-tab.directive.ts +++ b/core/templates/dev/head/pages/admin-page/misc-tab/admin-misc-tab.directive.ts @@ -21,9 +21,7 @@ require('pages/admin-page/services/admin-task-manager.service.ts'); require('pages/admin-page/admin-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('adminMiscTab', [ +angular.module('oppia').directive('adminMiscTab', [ '$http', '$window', 'AdminTaskManagerService', 'UrlInterpolationService', 'ADMIN_HANDLER_URL', 'ADMIN_TOPICS_CSV_DOWNLOAD_HANDLER_URL', function( diff --git a/core/templates/dev/head/pages/admin-page/navbar/admin-navbar.directive.ts b/core/templates/dev/head/pages/admin-page/navbar/admin-navbar.directive.ts index c00f77e63880..fe912e6684eb 100644 --- a/core/templates/dev/head/pages/admin-page/navbar/admin-navbar.directive.ts +++ b/core/templates/dev/head/pages/admin-page/navbar/admin-navbar.directive.ts @@ -22,9 +22,7 @@ require('services/UserService.ts'); require('pages/admin-page/admin-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('adminNavbar', [ +angular.module('oppia').directive('adminNavbar', [ 'AdminRouterService', 'UrlInterpolationService', 'ADMIN_TAB_URLS', 'LOGOUT_URL', 'PROFILE_URL_TEMPLATE', function( diff --git a/core/templates/dev/head/pages/admin-page/roles-tab/admin-roles-tab.directive.ts b/core/templates/dev/head/pages/admin-page/roles-tab/admin-roles-tab.directive.ts index 1755d075555a..eb6cc35e9127 100644 --- a/core/templates/dev/head/pages/admin-page/roles-tab/admin-roles-tab.directive.ts +++ b/core/templates/dev/head/pages/admin-page/roles-tab/admin-roles-tab.directive.ts @@ -24,9 +24,7 @@ require('pages/admin-page/services/admin-task-manager.service.ts'); require('pages/admin-page/admin-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('adminRolesTab', [ +angular.module('oppia').directive('adminRolesTab', [ '$http', 'AdminDataService', 'AdminTaskManagerService', 'UrlInterpolationService', 'ADMIN_ROLE_HANDLER_URL', function( diff --git a/core/templates/dev/head/pages/admin-page/roles-tab/role-graph.directive.ts b/core/templates/dev/head/pages/admin-page/roles-tab/role-graph.directive.ts index 3a73a0f223b2..50379f15b5a6 100644 --- a/core/templates/dev/head/pages/admin-page/roles-tab/role-graph.directive.ts +++ b/core/templates/dev/head/pages/admin-page/roles-tab/role-graph.directive.ts @@ -20,9 +20,7 @@ require('components/graph-services/graph-layout.service.ts'); require('domain/utilities/UrlInterpolationService.ts'); require('filters/string-utility-filters/truncate.filter.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('roleGraph', [ +angular.module('oppia').directive('roleGraph', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/admin-page/services/admin-data.service.ts b/core/templates/dev/head/pages/admin-page/services/admin-data.service.ts index 9dd970a7feb0..4923778d0c85 100644 --- a/core/templates/dev/head/pages/admin-page/services/admin-data.service.ts +++ b/core/templates/dev/head/pages/admin-page/services/admin-data.service.ts @@ -18,9 +18,7 @@ require('pages/admin-page/admin-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('AdminDataService', [ +angular.module('oppia').factory('AdminDataService', [ '$http', 'ADMIN_HANDLER_URL', function($http, ADMIN_HANDLER_URL) { var dataPromise = null; diff --git a/core/templates/dev/head/pages/admin-page/services/admin-router.service.ts b/core/templates/dev/head/pages/admin-page/services/admin-router.service.ts index c2462041a29c..2fa465e43dc2 100644 --- a/core/templates/dev/head/pages/admin-page/services/admin-router.service.ts +++ b/core/templates/dev/head/pages/admin-page/services/admin-router.service.ts @@ -19,9 +19,7 @@ require('pages/admin-page/admin-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('AdminRouterService', [ +angular.module('oppia').factory('AdminRouterService', [ 'ADMIN_TAB_URLS', function(ADMIN_TAB_URLS) { var currentTabHash = ADMIN_TAB_URLS.ACTIVITIES; diff --git a/core/templates/dev/head/pages/admin-page/services/admin-task-manager.service.ts b/core/templates/dev/head/pages/admin-page/services/admin-task-manager.service.ts index 0e6fc631f81c..257cd565ffd7 100644 --- a/core/templates/dev/head/pages/admin-page/services/admin-task-manager.service.ts +++ b/core/templates/dev/head/pages/admin-page/services/admin-task-manager.service.ts @@ -48,7 +48,5 @@ export class AdminTaskManagerService { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'AdminTaskManagerService', downgradeInjectable(AdminTaskManagerService)); diff --git a/core/templates/dev/head/pages/collection-editor-page/collection-editor-page.constants.ts b/core/templates/dev/head/pages/collection-editor-page/collection-editor-page.constants.ts index 603233c729f7..8c278f8339c1 100644 --- a/core/templates/dev/head/pages/collection-editor-page/collection-editor-page.constants.ts +++ b/core/templates/dev/head/pages/collection-editor-page/collection-editor-page.constants.ts @@ -17,21 +17,21 @@ */ // TODO(bhenning): These constants should be provided by the backend. -var oppia = require('AppInit.ts').module; - -oppia.constant( +angular.module('oppia').constant( 'EDITABLE_COLLECTION_DATA_URL_TEMPLATE', '/collection_editor_handler/data/'); -oppia.constant( +angular.module('oppia').constant( 'COLLECTION_RIGHTS_URL_TEMPLATE', '/collection_editor_handler/rights/'); -oppia.constant( +angular.module('oppia').constant( 'COLLECTION_TITLE_INPUT_FOCUS_LABEL', 'collectionTitleInputFocusLabel'); -oppia.constant( +angular.module('oppia').constant( 'SEARCH_EXPLORATION_URL_TEMPLATE', '/exploration/metadata_search?q='); -oppia.constant('EVENT_COLLECTION_INITIALIZED', 'collectionInitialized'); -oppia.constant('EVENT_COLLECTION_REINITIALIZED', 'collectionReinitialized'); +angular.module('oppia').constant( + 'EVENT_COLLECTION_INITIALIZED', 'collectionInitialized'); +angular.module('oppia').constant( + 'EVENT_COLLECTION_REINITIALIZED', 'collectionReinitialized'); diff --git a/core/templates/dev/head/pages/collection-editor-page/collection-editor-page.directive.ts b/core/templates/dev/head/pages/collection-editor-page/collection-editor-page.directive.ts index 1899feae0cf6..df4b325a2484 100644 --- a/core/templates/dev/head/pages/collection-editor-page/collection-editor-page.directive.ts +++ b/core/templates/dev/head/pages/collection-editor-page/collection-editor-page.directive.ts @@ -35,9 +35,7 @@ require('services/PageTitleService.ts'); require('pages/collection-editor-page/collection-editor-page.constants.ts'); require('pages/interaction-specs.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('collectionEditorPage', [ +angular.module('oppia').directive('collectionEditorPage', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/collection-editor-page/collection-editor-page.scripts.ts b/core/templates/dev/head/pages/collection-editor-page/collection-editor-page.scripts.ts index 0ca7311be811..1b1128a35f18 100644 --- a/core/templates/dev/head/pages/collection-editor-page/collection-editor-page.scripts.ts +++ b/core/templates/dev/head/pages/collection-editor-page/collection-editor-page.scripts.ts @@ -16,6 +16,7 @@ * @fileoverview Directives required in collection editor. */ +require('AppInit.ts'); require('App.ts'); require('base_components/BaseContentDirective.ts'); diff --git a/core/templates/dev/head/pages/collection-editor-page/editor-tab/collection-editor-tab.directive.ts b/core/templates/dev/head/pages/collection-editor-page/editor-tab/collection-editor-tab.directive.ts index 156a03fc87cd..d31b91f90fad 100644 --- a/core/templates/dev/head/pages/collection-editor-page/editor-tab/collection-editor-tab.directive.ts +++ b/core/templates/dev/head/pages/collection-editor-page/editor-tab/collection-editor-tab.directive.ts @@ -29,9 +29,7 @@ require( require( 'pages/collection-editor-page/services/collection-linearizer.service.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('collectionEditorTab', [ +angular.module('oppia').directive('collectionEditorTab', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/collection-editor-page/editor-tab/collection-node-creator.directive.ts b/core/templates/dev/head/pages/collection-editor-page/editor-tab/collection-node-creator.directive.ts index f88e92479dce..a3b0b5272ecd 100644 --- a/core/templates/dev/head/pages/collection-editor-page/editor-tab/collection-node-creator.directive.ts +++ b/core/templates/dev/head/pages/collection-editor-page/editor-tab/collection-node-creator.directive.ts @@ -30,9 +30,7 @@ require('services/AlertsService.ts'); require('services/SiteAnalyticsService.ts'); require('services/ValidatorsService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('collectionNodeCreator', [ +angular.module('oppia').directive('collectionNodeCreator', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/collection-editor-page/editor-tab/collection-node-editor.directive.ts b/core/templates/dev/head/pages/collection-editor-page/editor-tab/collection-node-editor.directive.ts index 92b2af8bb9bf..a151cb977848 100644 --- a/core/templates/dev/head/pages/collection-editor-page/editor-tab/collection-node-editor.directive.ts +++ b/core/templates/dev/head/pages/collection-editor-page/editor-tab/collection-node-editor.directive.ts @@ -26,9 +26,7 @@ require( 'pages/collection-editor-page/services/collection-linearizer.service.ts'); require('services/AlertsService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('collectionNodeEditor', [ +angular.module('oppia').directive('collectionNodeEditor', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/collection-editor-page/history-tab/collection-history-tab.directive.ts b/core/templates/dev/head/pages/collection-editor-page/history-tab/collection-history-tab.directive.ts index 7e645d5a4b16..ec0b28e57c62 100644 --- a/core/templates/dev/head/pages/collection-editor-page/history-tab/collection-history-tab.directive.ts +++ b/core/templates/dev/head/pages/collection-editor-page/history-tab/collection-history-tab.directive.ts @@ -18,9 +18,7 @@ require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('collectionHistoryTab', [ +angular.module('oppia').directive('collectionHistoryTab', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/collection-editor-page/navbar/collection-editor-navbar-breadcrumb.directive.ts b/core/templates/dev/head/pages/collection-editor-page/navbar/collection-editor-navbar-breadcrumb.directive.ts index 4a33b2f5fe4c..32c2ee572b41 100644 --- a/core/templates/dev/head/pages/collection-editor-page/navbar/collection-editor-navbar-breadcrumb.directive.ts +++ b/core/templates/dev/head/pages/collection-editor-page/navbar/collection-editor-navbar-breadcrumb.directive.ts @@ -28,9 +28,7 @@ require('services/stateful/FocusManagerService.ts'); // support both displaying the current title of the collection (or untitled if // it does not yet have one) or setting a new title in the case of an untitled // collection. -var oppia = require('AppInit.ts').module; - -oppia.directive('collectionEditorNavbarBreadcrumb', [ +angular.module('oppia').directive('collectionEditorNavbarBreadcrumb', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/collection-editor-page/navbar/collection-editor-navbar.directive.ts b/core/templates/dev/head/pages/collection-editor-page/navbar/collection-editor-navbar.directive.ts index 293f2ea1df76..c549d060a6ea 100644 --- a/core/templates/dev/head/pages/collection-editor-page/navbar/collection-editor-navbar.directive.ts +++ b/core/templates/dev/head/pages/collection-editor-page/navbar/collection-editor-navbar.directive.ts @@ -33,9 +33,7 @@ require( require('pages/exploration-editor-page/services/router.service.ts'); require('services/AlertsService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('collectionEditorNavbar', [ +angular.module('oppia').directive('collectionEditorNavbar', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/collection-editor-page/services/collection-editor-state.service.ts b/core/templates/dev/head/pages/collection-editor-page/services/collection-editor-state.service.ts index 99c90866bc9e..439076c5d3b8 100644 --- a/core/templates/dev/head/pages/collection-editor-page/services/collection-editor-state.service.ts +++ b/core/templates/dev/head/pages/collection-editor-page/services/collection-editor-state.service.ts @@ -27,9 +27,7 @@ require('services/AlertsService.ts'); require('pages/collection-editor-page/collection-editor-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('CollectionEditorStateService', [ +angular.module('oppia').factory('CollectionEditorStateService', [ '$rootScope', 'AlertsService', 'CollectionObjectFactory', 'CollectionRightsBackendApiService', 'CollectionRightsObjectFactory', 'EditableCollectionBackendApiService', 'UndoRedoService', diff --git a/core/templates/dev/head/pages/collection-editor-page/services/collection-linearizer.service.ts b/core/templates/dev/head/pages/collection-editor-page/services/collection-linearizer.service.ts index edfbbb80aa65..874da44e9442 100644 --- a/core/templates/dev/head/pages/collection-editor-page/services/collection-linearizer.service.ts +++ b/core/templates/dev/head/pages/collection-editor-page/services/collection-linearizer.service.ts @@ -20,9 +20,7 @@ require('domain/collection/CollectionUpdateService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('CollectionLinearizerService', [ +angular.module('oppia').factory('CollectionLinearizerService', [ 'CollectionUpdateService', function(CollectionUpdateService) { var _getNextExplorationId = function(collection, completedExpIds) { diff --git a/core/templates/dev/head/pages/collection-editor-page/settings-tab/collection-details-editor.directive.ts b/core/templates/dev/head/pages/collection-editor-page/settings-tab/collection-details-editor.directive.ts index 0a7fa509014c..3d88df150d70 100644 --- a/core/templates/dev/head/pages/collection-editor-page/settings-tab/collection-details-editor.directive.ts +++ b/core/templates/dev/head/pages/collection-editor-page/settings-tab/collection-details-editor.directive.ts @@ -29,9 +29,7 @@ require( 'pages/collection-editor-page/services/collection-editor-state.service.ts'); require('services/AlertsService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('collectionDetailsEditor', [ +angular.module('oppia').directive('collectionDetailsEditor', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/collection-editor-page/settings-tab/collection-permissions-card.directive.ts b/core/templates/dev/head/pages/collection-editor-page/settings-tab/collection-permissions-card.directive.ts index 0a9ed3507cbd..473701ba88e9 100644 --- a/core/templates/dev/head/pages/collection-editor-page/settings-tab/collection-permissions-card.directive.ts +++ b/core/templates/dev/head/pages/collection-editor-page/settings-tab/collection-permissions-card.directive.ts @@ -21,9 +21,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require( 'pages/collection-editor-page/services/collection-editor-state.service.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('collectionPermissionsCard', [ +angular.module('oppia').directive('collectionPermissionsCard', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/collection-editor-page/settings-tab/collection-settings-tab.directive.ts b/core/templates/dev/head/pages/collection-editor-page/settings-tab/collection-settings-tab.directive.ts index 858d17c0cadb..c793b1b9dbd9 100644 --- a/core/templates/dev/head/pages/collection-editor-page/settings-tab/collection-settings-tab.directive.ts +++ b/core/templates/dev/head/pages/collection-editor-page/settings-tab/collection-settings-tab.directive.ts @@ -25,9 +25,7 @@ require( require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('collectionSettingsTab', [ +angular.module('oppia').directive('collectionSettingsTab', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/collection-editor-page/statistics-tab/collection-statistics-tab.directive.ts b/core/templates/dev/head/pages/collection-editor-page/statistics-tab/collection-statistics-tab.directive.ts index 97fabf20b7ea..4458ce87a9d1 100644 --- a/core/templates/dev/head/pages/collection-editor-page/statistics-tab/collection-statistics-tab.directive.ts +++ b/core/templates/dev/head/pages/collection-editor-page/statistics-tab/collection-statistics-tab.directive.ts @@ -18,9 +18,7 @@ require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('collectionStatisticsTab', [ +angular.module('oppia').directive('collectionStatisticsTab', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/collection-player-page/collection-footer/collection-footer.directive.ts b/core/templates/dev/head/pages/collection-player-page/collection-footer/collection-footer.directive.ts index 6de3c0e7852c..a50f9a6b596d 100644 --- a/core/templates/dev/head/pages/collection-player-page/collection-footer/collection-footer.directive.ts +++ b/core/templates/dev/head/pages/collection-player-page/collection-footer/collection-footer.directive.ts @@ -24,9 +24,7 @@ require( require('domain/utilities/UrlInterpolationService.ts'); require('services/contextual/UrlService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('collectionFooter', [ +angular.module('oppia').directive('collectionFooter', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/collection-player-page/collection-local-nav/collection-local-nav.directive.ts b/core/templates/dev/head/pages/collection-player-page/collection-local-nav/collection-local-nav.directive.ts index e3e8873c8ab9..7152e5d87fd9 100644 --- a/core/templates/dev/head/pages/collection-player-page/collection-local-nav/collection-local-nav.directive.ts +++ b/core/templates/dev/head/pages/collection-player-page/collection-local-nav/collection-local-nav.directive.ts @@ -19,9 +19,7 @@ require('domain/collection/ReadOnlyCollectionBackendApiService.ts'); require('services/contextual/UrlService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('collectionLocalNav', [ +angular.module('oppia').directive('collectionLocalNav', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/collection-player-page/collection-navbar/collection-navbar.directive.ts b/core/templates/dev/head/pages/collection-player-page/collection-navbar/collection-navbar.directive.ts index a85e15d86217..fd9ef1c0d12e 100644 --- a/core/templates/dev/head/pages/collection-player-page/collection-navbar/collection-navbar.directive.ts +++ b/core/templates/dev/head/pages/collection-player-page/collection-navbar/collection-navbar.directive.ts @@ -20,10 +20,8 @@ require('domain/collection/ReadOnlyCollectionBackendApiService.ts'); require('domain/utilities/UrlInterpolationService.ts'); require('services/contextual/UrlService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('collectionNavbar', ['UrlInterpolationService', - function(UrlInterpolationService) { +angular.module('oppia').directive('collectionNavbar', [ + 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', scope: {}, diff --git a/core/templates/dev/head/pages/collection-player-page/collection-node-list/collection-node-list.directive.ts b/core/templates/dev/head/pages/collection-player-page/collection-node-list/collection-node-list.directive.ts index c7268b77bccd..b9e8a5ce7c8a 100644 --- a/core/templates/dev/head/pages/collection-player-page/collection-node-list/collection-node-list.directive.ts +++ b/core/templates/dev/head/pages/collection-player-page/collection-node-list/collection-node-list.directive.ts @@ -19,9 +19,7 @@ require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('collectionNodeList', [ +angular.module('oppia').directive('collectionNodeList', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/collection-player-page/collection-player-page.directive.ts b/core/templates/dev/head/pages/collection-player-page/collection-player-page.directive.ts index e3902a2e827d..1575b5a4bf90 100644 --- a/core/templates/dev/head/pages/collection-player-page/collection-player-page.directive.ts +++ b/core/templates/dev/head/pages/collection-player-page/collection-player-page.directive.ts @@ -41,21 +41,20 @@ require('services/PageTitleService.ts'); require('services/UserService.ts'); require('services/contextual/UrlService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.animation('.oppia-collection-animate-slide', function() { - return { - enter: function(element) { - element.hide().slideDown(); - }, - leave: function(element) { - element.slideUp(); - } - }; -}); +angular.module('oppia').animation( + '.oppia-collection-animate-slide', function() { + return { + enter: function(element) { + element.hide().slideDown(); + }, + leave: function(element) { + element.slideUp(); + } + }; + }); -oppia.directive('collectionPlayerPage', ['UrlInterpolationService', - function(UrlInterpolationService) { +angular.module('oppia').directive('collectionPlayerPage', [ + 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', scope: {}, diff --git a/core/templates/dev/head/pages/collection-player-page/collection-player-page.scripts.ts b/core/templates/dev/head/pages/collection-player-page/collection-player-page.scripts.ts index 62a10ead75ef..a1311bd818ae 100644 --- a/core/templates/dev/head/pages/collection-player-page/collection-player-page.scripts.ts +++ b/core/templates/dev/head/pages/collection-player-page/collection-player-page.scripts.ts @@ -16,6 +16,7 @@ * @fileoverview Directives required in collection player. */ +require('AppInit.ts'); require('App.ts'); require('base_components/BaseContentDirective.ts'); diff --git a/core/templates/dev/head/pages/contact-page/contact-page.scripts.ts b/core/templates/dev/head/pages/contact-page/contact-page.scripts.ts index 302a97e3f8a0..661be6df48a0 100644 --- a/core/templates/dev/head/pages/contact-page/contact-page.scripts.ts +++ b/core/templates/dev/head/pages/contact-page/contact-page.scripts.ts @@ -16,6 +16,7 @@ * @fileoverview File to import necessary scripts for contact page. */ +require('AppInit.ts'); require('App.ts'); require('base_components/BaseContentDirective.ts'); diff --git a/core/templates/dev/head/pages/creator-dashboard-page/creator-dashboard-page.constants.ts b/core/templates/dev/head/pages/creator-dashboard-page/creator-dashboard-page.constants.ts index 1eaa91af0064..503f0ef8986b 100644 --- a/core/templates/dev/head/pages/creator-dashboard-page/creator-dashboard-page.constants.ts +++ b/core/templates/dev/head/pages/creator-dashboard-page/creator-dashboard-page.constants.ts @@ -16,15 +16,13 @@ * @fileoverview Constants for the creator dashboard. */ -var oppia = require('AppInit.ts').module; - -oppia.constant( +angular.module('oppia').constant( 'EXPLORATION_DROPDOWN_STATS', { OPEN_FEEDBACK: 'open_feedback' } ); -oppia.constant( +angular.module('oppia').constant( 'EXPLORATIONS_SORT_BY_KEYS', { TITLE: 'title', RATING: 'ratings', @@ -34,7 +32,7 @@ oppia.constant( } ); -oppia.constant( +angular.module('oppia').constant( 'HUMAN_READABLE_EXPLORATIONS_SORT_BY_KEYS', { TITLE: 'I18N_DASHBOARD_EXPLORATIONS_SORT_BY_TITLE', RATING: 'I18N_DASHBOARD_EXPLORATIONS_SORT_BY_AVERAGE_RATING', @@ -44,14 +42,14 @@ oppia.constant( } ); -oppia.constant( +angular.module('oppia').constant( 'SUBSCRIPTION_SORT_BY_KEYS', { USERNAME: 'subscriber_username', IMPACT: 'subscriber_impact' } ); -oppia.constant( +angular.module('oppia').constant( 'HUMAN_READABLE_SUBSCRIPTION_SORT_BY_KEYS', { USERNAME: 'Username', IMPACT: 'Impact' diff --git a/core/templates/dev/head/pages/creator-dashboard-page/creator-dashboard-page.controller.ts b/core/templates/dev/head/pages/creator-dashboard-page/creator-dashboard-page.controller.ts index 23d50ab9686b..86b1b40849ea 100644 --- a/core/templates/dev/head/pages/creator-dashboard-page/creator-dashboard-page.controller.ts +++ b/core/templates/dev/head/pages/creator-dashboard-page/creator-dashboard-page.controller.ts @@ -86,345 +86,345 @@ require('services/UserService.ts'); require('pages/creator-dashboard-page/creator-dashboard-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('creatorDashboardPage', ['UrlInterpolationService', function( - UrlInterpolationService) { - return { - restrict: 'E', - scope: {}, - bindToController: {}, - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/creator-dashboard-page/creator-dashboard-page.directive.html'), - controllerAs: '$ctrl', - controller: [ - '$http', '$log', '$q', '$rootScope', '$window', - 'AlertsService', 'CreatorDashboardBackendApiService', - 'DateTimeFormatService', - 'ExplorationCreationService', 'RatingComputationService', - 'SuggestionModalForCreatorDashboardService', 'SuggestionObjectFactory', - 'SuggestionThreadObjectFactory', 'ThreadStatusDisplayService', - 'UrlInterpolationService', 'UserService', - 'DEFAULT_TWITTER_SHARE_MESSAGE_EDITOR', 'EXPLORATIONS_SORT_BY_KEYS', - 'EXPLORATION_DROPDOWN_STATS', 'FATAL_ERROR_CODES', - 'HUMAN_READABLE_EXPLORATIONS_SORT_BY_KEYS', - 'HUMAN_READABLE_SUBSCRIPTION_SORT_BY_KEYS', - 'SUBSCRIPTION_SORT_BY_KEYS', - function( - $http, $log, $q, $rootScope, $window, - AlertsService, CreatorDashboardBackendApiService, - DateTimeFormatService, - ExplorationCreationService, RatingComputationService, - SuggestionModalForCreatorDashboardService, SuggestionObjectFactory, - SuggestionThreadObjectFactory, ThreadStatusDisplayService, - UrlInterpolationService, UserService, - DEFAULT_TWITTER_SHARE_MESSAGE_EDITOR, EXPLORATIONS_SORT_BY_KEYS, - EXPLORATION_DROPDOWN_STATS, FATAL_ERROR_CODES, - HUMAN_READABLE_EXPLORATIONS_SORT_BY_KEYS, - HUMAN_READABLE_SUBSCRIPTION_SORT_BY_KEYS, - SUBSCRIPTION_SORT_BY_KEYS) { - var ctrl = this; - var EXP_PUBLISH_TEXTS = { - defaultText: ( - 'This exploration is private. Publish it to receive statistics.'), - smText: 'Publish the exploration to receive statistics.' - }; - - var userDashboardDisplayPreference = - constants.ALLOWED_CREATOR_DASHBOARD_DISPLAY_PREFS.CARD; - - ctrl.DEFAULT_EMPTY_TITLE = 'Untitled'; - ctrl.EXPLORATION_DROPDOWN_STATS = EXPLORATION_DROPDOWN_STATS; - ctrl.EXPLORATIONS_SORT_BY_KEYS = EXPLORATIONS_SORT_BY_KEYS; - ctrl.HUMAN_READABLE_EXPLORATIONS_SORT_BY_KEYS = ( - HUMAN_READABLE_EXPLORATIONS_SORT_BY_KEYS); - ctrl.SUBSCRIPTION_SORT_BY_KEYS = SUBSCRIPTION_SORT_BY_KEYS; - ctrl.HUMAN_READABLE_SUBSCRIPTION_SORT_BY_KEYS = ( - HUMAN_READABLE_SUBSCRIPTION_SORT_BY_KEYS); - ctrl.DEFAULT_TWITTER_SHARE_MESSAGE_DASHBOARD = ( - DEFAULT_TWITTER_SHARE_MESSAGE_EDITOR); - - ctrl.canCreateCollections = null; - $rootScope.loadingMessage = 'Loading'; - var userInfoPromise = UserService.getUserInfoAsync(); - userInfoPromise.then(function(userInfo) { - ctrl.canCreateCollections = userInfo.canCreateCollections(); - }); - - var dashboardDataPromise = ( - CreatorDashboardBackendApiService.fetchDashboardData()); - dashboardDataPromise.then( - function(response) { - // The following condition is required for Karma testing. The - // Angular HttpClient returns an Observable which when converted to - // a promise does not have the 'data' key but the AngularJS mocks of - // services using HttpClient use $http which return promise and the - // content is contained in the 'data' key. Therefore the following - // condition checks for presence of 'response.data' which would be - // the case in AngularJS testing but assigns 'response' if the - // former is not present which is the case with HttpClient. - var responseData = response.data ? response.data : response; - ctrl.currentSortType = EXPLORATIONS_SORT_BY_KEYS.OPEN_FEEDBACK; - ctrl.currentSubscribersSortType = - SUBSCRIPTION_SORT_BY_KEYS.USERNAME; - ctrl.isCurrentSortDescending = true; - ctrl.isCurrentSubscriptionSortDescending = true; - ctrl.explorationsList = responseData.explorations_list; - ctrl.collectionsList = responseData.collections_list; - ctrl.subscribersList = responseData.subscribers_list; - ctrl.dashboardStats = responseData.dashboard_stats; - ctrl.lastWeekStats = responseData.last_week_stats; - ctrl.myExplorationsView = responseData.display_preference; - var numberOfCreatedSuggestions = ( - responseData.threads_for_created_suggestions_list.length); - var numberOfSuggestionsToReview = ( - responseData.threads_for_suggestions_to_review_list.length); - ctrl.mySuggestionsList = []; - for (var i = 0; i < numberOfCreatedSuggestions; i++) { - if (responseData.created_suggestions_list.length !== - numberOfCreatedSuggestions) { - $log.error('Number of suggestions does not match number of ' + - 'suggestion threads'); +angular.module('oppia').directive('creatorDashboardPage', [ + 'UrlInterpolationService', function( + UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: {}, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/creator-dashboard-page/creator-dashboard-page.directive.html'), + controllerAs: '$ctrl', + controller: [ + '$http', '$log', '$q', '$rootScope', '$window', + 'AlertsService', 'CreatorDashboardBackendApiService', + 'DateTimeFormatService', + 'ExplorationCreationService', 'RatingComputationService', + 'SuggestionModalForCreatorDashboardService', 'SuggestionObjectFactory', + 'SuggestionThreadObjectFactory', 'ThreadStatusDisplayService', + 'UrlInterpolationService', 'UserService', + 'DEFAULT_TWITTER_SHARE_MESSAGE_EDITOR', 'EXPLORATIONS_SORT_BY_KEYS', + 'EXPLORATION_DROPDOWN_STATS', 'FATAL_ERROR_CODES', + 'HUMAN_READABLE_EXPLORATIONS_SORT_BY_KEYS', + 'HUMAN_READABLE_SUBSCRIPTION_SORT_BY_KEYS', + 'SUBSCRIPTION_SORT_BY_KEYS', + function( + $http, $log, $q, $rootScope, $window, + AlertsService, CreatorDashboardBackendApiService, + DateTimeFormatService, + ExplorationCreationService, RatingComputationService, + SuggestionModalForCreatorDashboardService, SuggestionObjectFactory, + SuggestionThreadObjectFactory, ThreadStatusDisplayService, + UrlInterpolationService, UserService, + DEFAULT_TWITTER_SHARE_MESSAGE_EDITOR, EXPLORATIONS_SORT_BY_KEYS, + EXPLORATION_DROPDOWN_STATS, FATAL_ERROR_CODES, + HUMAN_READABLE_EXPLORATIONS_SORT_BY_KEYS, + HUMAN_READABLE_SUBSCRIPTION_SORT_BY_KEYS, + SUBSCRIPTION_SORT_BY_KEYS) { + var ctrl = this; + var EXP_PUBLISH_TEXTS = { + defaultText: ( + 'This exploration is private. Publish it to receive statistics.'), + smText: 'Publish the exploration to receive statistics.' + }; + + var userDashboardDisplayPreference = + constants.ALLOWED_CREATOR_DASHBOARD_DISPLAY_PREFS.CARD; + + ctrl.DEFAULT_EMPTY_TITLE = 'Untitled'; + ctrl.EXPLORATION_DROPDOWN_STATS = EXPLORATION_DROPDOWN_STATS; + ctrl.EXPLORATIONS_SORT_BY_KEYS = EXPLORATIONS_SORT_BY_KEYS; + ctrl.HUMAN_READABLE_EXPLORATIONS_SORT_BY_KEYS = ( + HUMAN_READABLE_EXPLORATIONS_SORT_BY_KEYS); + ctrl.SUBSCRIPTION_SORT_BY_KEYS = SUBSCRIPTION_SORT_BY_KEYS; + ctrl.HUMAN_READABLE_SUBSCRIPTION_SORT_BY_KEYS = ( + HUMAN_READABLE_SUBSCRIPTION_SORT_BY_KEYS); + ctrl.DEFAULT_TWITTER_SHARE_MESSAGE_DASHBOARD = ( + DEFAULT_TWITTER_SHARE_MESSAGE_EDITOR); + + ctrl.canCreateCollections = null; + $rootScope.loadingMessage = 'Loading'; + var userInfoPromise = UserService.getUserInfoAsync(); + userInfoPromise.then(function(userInfo) { + ctrl.canCreateCollections = userInfo.canCreateCollections(); + }); + + var dashboardDataPromise = ( + CreatorDashboardBackendApiService.fetchDashboardData()); + dashboardDataPromise.then( + function(response) { + // The following condition is required for Karma testing. The + // Angular HttpClient returns an Observable which when converted + // to a promise does not have the 'data' key but the AngularJS + // mocks of services using HttpClient use $http which return + // promise and the content is contained in the 'data' key. + // Therefore the following condition checks for presence of + // 'response.data' which would be the case in AngularJS testing + // but assigns 'response' if the former is not present which is + // the case with HttpClient. + var responseData = response.data ? response.data : response; + ctrl.currentSortType = EXPLORATIONS_SORT_BY_KEYS.OPEN_FEEDBACK; + ctrl.currentSubscribersSortType = + SUBSCRIPTION_SORT_BY_KEYS.USERNAME; + ctrl.isCurrentSortDescending = true; + ctrl.isCurrentSubscriptionSortDescending = true; + ctrl.explorationsList = responseData.explorations_list; + ctrl.collectionsList = responseData.collections_list; + ctrl.subscribersList = responseData.subscribers_list; + ctrl.dashboardStats = responseData.dashboard_stats; + ctrl.lastWeekStats = responseData.last_week_stats; + ctrl.myExplorationsView = responseData.display_preference; + var numberOfCreatedSuggestions = ( + responseData.threads_for_created_suggestions_list.length); + var numberOfSuggestionsToReview = ( + responseData.threads_for_suggestions_to_review_list.length); + ctrl.mySuggestionsList = []; + for (var i = 0; i < numberOfCreatedSuggestions; i++) { + if (responseData.created_suggestions_list.length !== + numberOfCreatedSuggestions) { + $log.error('Number of suggestions does not match number of ' + + 'suggestion threads'); + } + for (var j = 0; j < numberOfCreatedSuggestions; j++) { + var suggestion = SuggestionObjectFactory + .createFromBackendDict( + responseData.created_suggestions_list[j]); + var threadDict = ( + responseData.threads_for_created_suggestions_list[i]); + if (threadDict.thread_id === suggestion.getThreadId()) { + var suggestionThread = ( + SuggestionThreadObjectFactory.createFromBackendDicts( + threadDict, responseData.created_suggestions_list[j])); + ctrl.mySuggestionsList.push(suggestionThread); + } + } } - for (var j = 0; j < numberOfCreatedSuggestions; j++) { - var suggestion = SuggestionObjectFactory - .createFromBackendDict( - responseData.created_suggestions_list[j]); - var threadDict = ( - responseData.threads_for_created_suggestions_list[i]); - if (threadDict.thread_id === suggestion.getThreadId()) { - var suggestionThread = ( - SuggestionThreadObjectFactory.createFromBackendDicts( - threadDict, responseData.created_suggestions_list[j])); - ctrl.mySuggestionsList.push(suggestionThread); + ctrl.suggestionsToReviewList = []; + for (var i = 0; i < numberOfSuggestionsToReview; i++) { + if (responseData.suggestions_to_review_list.length !== + numberOfSuggestionsToReview) { + $log.error('Number of suggestions does not match number of ' + + 'suggestion threads'); + } + for (var j = 0; j < numberOfSuggestionsToReview; j++) { + var suggestion = SuggestionObjectFactory + .createFromBackendDict( + responseData.suggestions_to_review_list[j]); + var threadDict = ( + responseData.threads_for_suggestions_to_review_list[i]); + if (threadDict.thread_id === suggestion.getThreadId()) { + var suggestionThread = ( + SuggestionThreadObjectFactory.createFromBackendDicts( + threadDict, + responseData.suggestions_to_review_list[j])); + ctrl.suggestionsToReviewList.push(suggestionThread); + } } } - } - ctrl.suggestionsToReviewList = []; - for (var i = 0; i < numberOfSuggestionsToReview; i++) { - if (responseData.suggestions_to_review_list.length !== - numberOfSuggestionsToReview) { - $log.error('Number of suggestions does not match number of ' + - 'suggestion threads'); + + if (ctrl.dashboardStats && ctrl.lastWeekStats) { + ctrl.relativeChangeInTotalPlays = ( + ctrl.dashboardStats.total_plays - ( + ctrl.lastWeekStats.total_plays) + ); } - for (var j = 0; j < numberOfSuggestionsToReview; j++) { - var suggestion = SuggestionObjectFactory - .createFromBackendDict( - responseData.suggestions_to_review_list[j]); - var threadDict = ( - responseData.threads_for_suggestions_to_review_list[i]); - if (threadDict.thread_id === suggestion.getThreadId()) { - var suggestionThread = ( - SuggestionThreadObjectFactory.createFromBackendDicts( - threadDict, - responseData.suggestions_to_review_list[j])); - ctrl.suggestionsToReviewList.push(suggestionThread); - } + + if (ctrl.explorationsList.length === 0 && + ctrl.collectionsList.length > 0) { + ctrl.activeTab = 'myCollections'; + } else if (ctrl.explorationsList.length === 0 && ( + ctrl.mySuggestionsList.length > 0 || + ctrl.suggestionsToReviewList.length > 0)) { + ctrl.activeTab = 'suggestions'; + } else { + ctrl.activeTab = 'myExplorations'; + } + }, + function(errorResponse) { + if (FATAL_ERROR_CODES.indexOf(errorResponse.status) !== -1) { + AlertsService.addWarning('Failed to get dashboard data'); } } + ); - if (ctrl.dashboardStats && ctrl.lastWeekStats) { - ctrl.relativeChangeInTotalPlays = ( - ctrl.dashboardStats.total_plays - ( - ctrl.lastWeekStats.total_plays) - ); - } + $q.all([userInfoPromise, dashboardDataPromise]).then(function() { + $rootScope.loadingMessage = ''; + }); - if (ctrl.explorationsList.length === 0 && - ctrl.collectionsList.length > 0) { - ctrl.activeTab = 'myCollections'; - } else if (ctrl.explorationsList.length === 0 && ( - ctrl.mySuggestionsList.length > 0 || - ctrl.suggestionsToReviewList.length > 0)) { - ctrl.activeTab = 'suggestions'; + ctrl.getAverageRating = RatingComputationService + .computeAverageRating; + ctrl.createNewExploration = ( + ExplorationCreationService.createNewExploration); + ctrl.getLocaleAbbreviatedDatetimeString = ( + DateTimeFormatService.getLocaleAbbreviatedDatetimeString); + ctrl.getHumanReadableStatus = ( + ThreadStatusDisplayService.getHumanReadableStatus); + + ctrl.emptyDashboardImgUrl = UrlInterpolationService + .getStaticImageUrl('/general/empty_dashboard.svg'); + ctrl.canReviewActiveThread = null; + + ctrl.setActiveTab = function(newActiveTabName) { + ctrl.activeTab = newActiveTabName; + }; + + ctrl.getExplorationUrl = function(explorationId) { + return '/create/' + explorationId; + }; + + ctrl.getCollectionUrl = function(collectionId) { + return '/collection_editor/create/' + collectionId; + }; + + ctrl.setMyExplorationsView = function(newViewType) { + $http.post('/creatordashboardhandler/data', { + display_preference: newViewType, + }).then(function() { + ctrl.myExplorationsView = newViewType; + }); + userDashboardDisplayPreference = newViewType; + }; + + ctrl.checkMobileView = function() { + return ($window.innerWidth < 500); + }; + + ctrl.showUsernamePopover = function(subscriberUsername) { + // The popover on the subscription card is only shown if the length + // of the subscriber username is greater than 10 and the user hovers + // over the truncated username. + if (subscriberUsername.length > 10) { + return 'mouseenter'; } else { - ctrl.activeTab = 'myExplorations'; + return 'none'; } - }, - function(errorResponse) { - if (FATAL_ERROR_CODES.indexOf(errorResponse.status) !== -1) { - AlertsService.addWarning('Failed to get dashboard data'); + }; + + ctrl.updatesGivenScreenWidth = function() { + if (ctrl.checkMobileView()) { + // For mobile users, the view of the creators + // exploration list is shown only in + // the card view and can't be switched to list view. + ctrl.myExplorationsView = ( + constants.ALLOWED_CREATOR_DASHBOARD_DISPLAY_PREFS.CARD); + ctrl.publishText = EXP_PUBLISH_TEXTS.smText; + } else { + // For computer users or users operating in larger screen size + // the creator exploration list will come back to its previously + // selected view (card or list) when resized from mobile view + ctrl.myExplorationsView = userDashboardDisplayPreference; + ctrl.publishText = EXP_PUBLISH_TEXTS.defaultText; } - } - ); - - $q.all([userInfoPromise, dashboardDataPromise]).then(function() { - $rootScope.loadingMessage = ''; - }); - - ctrl.getAverageRating = RatingComputationService - .computeAverageRating; - ctrl.createNewExploration = ( - ExplorationCreationService.createNewExploration); - ctrl.getLocaleAbbreviatedDatetimeString = ( - DateTimeFormatService.getLocaleAbbreviatedDatetimeString); - ctrl.getHumanReadableStatus = ( - ThreadStatusDisplayService.getHumanReadableStatus); - - ctrl.emptyDashboardImgUrl = UrlInterpolationService - .getStaticImageUrl('/general/empty_dashboard.svg'); - ctrl.canReviewActiveThread = null; - - ctrl.setActiveTab = function(newActiveTabName) { - ctrl.activeTab = newActiveTabName; - }; - - ctrl.getExplorationUrl = function(explorationId) { - return '/create/' + explorationId; - }; - - ctrl.getCollectionUrl = function(collectionId) { - return '/collection_editor/create/' + collectionId; - }; - - ctrl.setMyExplorationsView = function(newViewType) { - $http.post('/creatordashboardhandler/data', { - display_preference: newViewType, - }).then(function() { - ctrl.myExplorationsView = newViewType; - }); - userDashboardDisplayPreference = newViewType; - }; - - ctrl.checkMobileView = function() { - return ($window.innerWidth < 500); - }; - - ctrl.showUsernamePopover = function(subscriberUsername) { - // The popover on the subscription card is only shown if the length - // of the subscriber username is greater than 10 and the user hovers - // over the truncated username. - if (subscriberUsername.length > 10) { - return 'mouseenter'; - } else { - return 'none'; - } - }; - - ctrl.updatesGivenScreenWidth = function() { - if (ctrl.checkMobileView()) { - // For mobile users, the view of the creators - // exploration list is shown only in - // the card view and can't be switched to list view. - ctrl.myExplorationsView = ( - constants.ALLOWED_CREATOR_DASHBOARD_DISPLAY_PREFS.CARD); - ctrl.publishText = EXP_PUBLISH_TEXTS.smText; - } else { - // For computer users or users operating in larger screen size - // the creator exploration list will come back to its previously - // selected view (card or list) when resized from mobile view - ctrl.myExplorationsView = userDashboardDisplayPreference; - ctrl.publishText = EXP_PUBLISH_TEXTS.defaultText; - } - }; - - ctrl.updatesGivenScreenWidth(); - angular.element($window).bind('resize', function() { + }; + ctrl.updatesGivenScreenWidth(); - }); - - ctrl.setExplorationsSortingOptions = function(sortType) { - if (sortType === ctrl.currentSortType) { - ctrl.isCurrentSortDescending = !ctrl.isCurrentSortDescending; - } else { - ctrl.currentSortType = sortType; - } - }; - - ctrl.setSubscriptionSortingOptions = function(sortType) { - if (sortType === ctrl.currentSubscribersSortType) { - ctrl.isCurrentSubscriptionSortDescending = ( - !ctrl.isCurrentSubscriptionSortDescending); - } else { - ctrl.currentSubscribersSortType = sortType; - } - }; - - ctrl.sortSubscriptionFunction = function(entity) { - // This function is passed as a custom comparator function to - // `orderBy`, so that special cases can be handled while sorting - // subscriptions. - var value = entity[ctrl.currentSubscribersSortType]; - if (ctrl.currentSubscribersSortType === - SUBSCRIPTION_SORT_BY_KEYS.IMPACT) { - value = (value || 0); - } - return value; - }; - - var _fetchMessages = function(threadId) { - $http.get('/threadhandler/' + threadId).then(function(response) { - var allThreads = ctrl.mySuggestionsList.concat( - ctrl.suggestionsToReviewList); - for (var i = 0; i < allThreads.length; i++) { - if (allThreads[i].threadId === threadId) { - allThreads[i].setMessages(response.data.messages); - break; - } - } + angular.element($window).bind('resize', function() { + ctrl.updatesGivenScreenWidth(); }); - }; - - ctrl.clearActiveThread = function() { - ctrl.activeThread = null; - }; - - ctrl.setActiveThread = function(threadId) { - _fetchMessages(threadId); - for (var i = 0; i < ctrl.mySuggestionsList.length; i++) { - if (ctrl.mySuggestionsList[i].threadId === threadId) { - ctrl.activeThread = ctrl.mySuggestionsList[i]; - ctrl.canReviewActiveThread = false; - break; + + ctrl.setExplorationsSortingOptions = function(sortType) { + if (sortType === ctrl.currentSortType) { + ctrl.isCurrentSortDescending = !ctrl.isCurrentSortDescending; + } else { + ctrl.currentSortType = sortType; + } + }; + + ctrl.setSubscriptionSortingOptions = function(sortType) { + if (sortType === ctrl.currentSubscribersSortType) { + ctrl.isCurrentSubscriptionSortDescending = ( + !ctrl.isCurrentSubscriptionSortDescending); + } else { + ctrl.currentSubscribersSortType = sortType; } - } - if (!ctrl.activeThread) { - for (var i = 0; i < ctrl.suggestionsToReviewList.length; i++) { - if (ctrl.suggestionsToReviewList[i].threadId === threadId) { - ctrl.activeThread = ctrl.suggestionsToReviewList[i]; - ctrl.canReviewActiveThread = true; + }; + + ctrl.sortSubscriptionFunction = function(entity) { + // This function is passed as a custom comparator function to + // `orderBy`, so that special cases can be handled while sorting + // subscriptions. + var value = entity[ctrl.currentSubscribersSortType]; + if (ctrl.currentSubscribersSortType === + SUBSCRIPTION_SORT_BY_KEYS.IMPACT) { + value = (value || 0); + } + return value; + }; + + var _fetchMessages = function(threadId) { + $http.get('/threadhandler/' + threadId).then(function(response) { + var allThreads = ctrl.mySuggestionsList.concat( + ctrl.suggestionsToReviewList); + for (var i = 0; i < allThreads.length; i++) { + if (allThreads[i].threadId === threadId) { + allThreads[i].setMessages(response.data.messages); + break; + } + } + }); + }; + + ctrl.clearActiveThread = function() { + ctrl.activeThread = null; + }; + + ctrl.setActiveThread = function(threadId) { + _fetchMessages(threadId); + for (var i = 0; i < ctrl.mySuggestionsList.length; i++) { + if (ctrl.mySuggestionsList[i].threadId === threadId) { + ctrl.activeThread = ctrl.mySuggestionsList[i]; + ctrl.canReviewActiveThread = false; break; } } - } - }; - - ctrl.showSuggestionModal = function() { - SuggestionModalForCreatorDashboardService.showSuggestionModal( - ctrl.activeThread.suggestion.suggestionType, - { - activeThread: ctrl.activeThread, - suggestionsToReviewList: ctrl.suggestionsToReviewList, - clearActiveThread: ctrl.clearActiveThread, - canReviewActiveThread: ctrl.canReviewActiveThread + if (!ctrl.activeThread) { + for (var i = 0; i < ctrl.suggestionsToReviewList.length; i++) { + if (ctrl.suggestionsToReviewList[i].threadId === threadId) { + ctrl.activeThread = ctrl.suggestionsToReviewList[i]; + ctrl.canReviewActiveThread = true; + break; + } + } } - ); - }; - - ctrl.sortByFunction = function(entity) { - // This function is passed as a custom comparator function to - // `orderBy`, so that special cases can be handled while sorting - // explorations. - var value = entity[ctrl.currentSortType]; - if (entity.status === 'private') { - if (ctrl.currentSortType === EXPLORATIONS_SORT_BY_KEYS.TITLE) { - value = (value || ctrl.DEFAULT_EMPTY_TITLE); - } else if (ctrl.currentSortType !== - EXPLORATIONS_SORT_BY_KEYS.LAST_UPDATED) { - value = 0; + }; + + ctrl.showSuggestionModal = function() { + SuggestionModalForCreatorDashboardService.showSuggestionModal( + ctrl.activeThread.suggestion.suggestionType, + { + activeThread: ctrl.activeThread, + suggestionsToReviewList: ctrl.suggestionsToReviewList, + clearActiveThread: ctrl.clearActiveThread, + canReviewActiveThread: ctrl.canReviewActiveThread + } + ); + }; + + ctrl.sortByFunction = function(entity) { + // This function is passed as a custom comparator function to + // `orderBy`, so that special cases can be handled while sorting + // explorations. + var value = entity[ctrl.currentSortType]; + if (entity.status === 'private') { + if (ctrl.currentSortType === EXPLORATIONS_SORT_BY_KEYS.TITLE) { + value = (value || ctrl.DEFAULT_EMPTY_TITLE); + } else if (ctrl.currentSortType !== + EXPLORATIONS_SORT_BY_KEYS.LAST_UPDATED) { + value = 0; + } + } else if ( + ctrl.currentSortType === EXPLORATIONS_SORT_BY_KEYS.RATING) { + var averageRating = ctrl.getAverageRating(value); + value = (averageRating || 0); } - } else if ( - ctrl.currentSortType === EXPLORATIONS_SORT_BY_KEYS.RATING) { - var averageRating = ctrl.getAverageRating(value); - value = (averageRating || 0); - } - return value; - }; - - ctrl.getCompleteThumbnailIconUrl = function(iconUrl) { - return UrlInterpolationService.getStaticImageUrl(iconUrl); - }; - } - ] - }; -}]); + return value; + }; + + ctrl.getCompleteThumbnailIconUrl = function(iconUrl) { + return UrlInterpolationService.getStaticImageUrl(iconUrl); + }; + } + ] + }; + }]); diff --git a/core/templates/dev/head/pages/creator-dashboard-page/creator-dashboard-page.scripts.ts b/core/templates/dev/head/pages/creator-dashboard-page/creator-dashboard-page.scripts.ts index 6718f7447b6c..b6fafea56004 100644 --- a/core/templates/dev/head/pages/creator-dashboard-page/creator-dashboard-page.scripts.ts +++ b/core/templates/dev/head/pages/creator-dashboard-page/creator-dashboard-page.scripts.ts @@ -16,6 +16,7 @@ * @fileoverview Directive scripts for the creator dashboard. */ +require('AppInit.ts'); require('App.ts'); require('pages/creator-dashboard-page/creator-dashboard-page.controller.ts'); diff --git a/core/templates/dev/head/pages/creator-dashboard-page/suggestion-modal-for-creator-view/suggestion-modal-for-creator-view.service.ts b/core/templates/dev/head/pages/creator-dashboard-page/suggestion-modal-for-creator-view/suggestion-modal-for-creator-view.service.ts index 00ba75317c4f..a236cbf2808d 100644 --- a/core/templates/dev/head/pages/creator-dashboard-page/suggestion-modal-for-creator-view/suggestion-modal-for-creator-view.service.ts +++ b/core/templates/dev/head/pages/creator-dashboard-page/suggestion-modal-for-creator-view/suggestion-modal-for-creator-view.service.ts @@ -19,12 +19,10 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/SuggestionModalService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('SuggestionModalForCreatorDashboardService', [ - '$http', '$log', '$rootScope', +angular.module('oppia').factory('SuggestionModalForCreatorDashboardService', [ + '$http', '$log', '$uibModal', 'UrlInterpolationService', - function($http, $log, $rootScope, + function($http, $log, $uibModal, UrlInterpolationService) { var _templateUrl = UrlInterpolationService.getDirectiveTemplateUrl( '/pages/creator-dashboard-page/suggestion-modal-for-creator-view/' + diff --git a/core/templates/dev/head/pages/donate-page/donate-page.controller.ts b/core/templates/dev/head/pages/donate-page/donate-page.controller.ts index 5cfe5e58b57d..bdc963ed53e3 100644 --- a/core/templates/dev/head/pages/donate-page/donate-page.controller.ts +++ b/core/templates/dev/head/pages/donate-page/donate-page.controller.ts @@ -22,48 +22,47 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/SiteAnalyticsService.ts'); require('services/contextual/WindowDimensionsService.ts'); -var oppia = require('AppInit.ts').module; +angular.module('oppia').directive('donatePage', [ + 'UrlInterpolationService', function( + UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: {}, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/donate-page/donate-page.directive.html'), + controllerAs: '$ctrl', + controller: [ + '$http', '$timeout', '$window', 'SiteAnalyticsService', + 'UrlInterpolationService', 'WindowDimensionsService', + function( + $http, $timeout, $window, SiteAnalyticsService, + UrlInterpolationService, WindowDimensionsService) { + var ctrl = this; + ctrl.windowIsNarrow = WindowDimensionsService.isWindowNarrow(); + ctrl.donateImgUrl = UrlInterpolationService.getStaticImageUrl( + '/general/opp_donate_text.svg'); -oppia.directive('donatePage', ['UrlInterpolationService', function( - UrlInterpolationService) { - return { - restrict: 'E', - scope: {}, - bindToController: {}, - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/donate-page/donate-page.directive.html'), - controllerAs: '$ctrl', - controller: [ - '$http', '$timeout', '$window', 'SiteAnalyticsService', - 'UrlInterpolationService', 'WindowDimensionsService', - function( - $http, $timeout, $window, SiteAnalyticsService, - UrlInterpolationService, WindowDimensionsService) { - var ctrl = this; - ctrl.windowIsNarrow = WindowDimensionsService.isWindowNarrow(); - ctrl.donateImgUrl = UrlInterpolationService.getStaticImageUrl( - '/general/opp_donate_text.svg'); + ctrl.onDonateThroughAmazon = function() { + SiteAnalyticsService.registerGoToDonationSiteEvent('Amazon'); + $timeout(function() { + $window.location = 'https://smile.amazon.com/ch/81-1740068'; + }, 150); + return false; + }; - ctrl.onDonateThroughAmazon = function() { - SiteAnalyticsService.registerGoToDonationSiteEvent('Amazon'); - $timeout(function() { - $window.location = 'https://smile.amazon.com/ch/81-1740068'; - }, 150); - return false; - }; - - ctrl.onDonateThroughPayPal = function() { - // Redirection to PayPal will be initiated at the same time as this - // function is run, but should be slow enough to allow this function - // time to complete. It is not possible to do $http.post() in - // javascript after a delay because cross-site POSTing is not - // permitted in scripts; see - // https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CO - // RS - // for more information. - SiteAnalyticsService.registerGoToDonationSiteEvent('PayPal'); - }; - } - ] - }; -}]); + ctrl.onDonateThroughPayPal = function() { + // Redirection to PayPal will be initiated at the same time as this + // function is run, but should be slow enough to allow this function + // time to complete. It is not possible to do $http.post() in + // javascript after a delay because cross-site POSTing is not + // permitted in scripts; see + // https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control + // _CORS + // for more information. + SiteAnalyticsService.registerGoToDonationSiteEvent('PayPal'); + }; + } + ] + }; + }]); diff --git a/core/templates/dev/head/pages/donate-page/donate-page.scripts.ts b/core/templates/dev/head/pages/donate-page/donate-page.scripts.ts index d8bb231a9f33..2948082fc7f5 100644 --- a/core/templates/dev/head/pages/donate-page/donate-page.scripts.ts +++ b/core/templates/dev/head/pages/donate-page/donate-page.scripts.ts @@ -16,6 +16,7 @@ * @fileoverview Directive scripts for the donate page. */ +require('AppInit.ts'); require('App.ts'); require('pages/OppiaFooterDirective.ts'); diff --git a/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-data.service.ts b/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-data.service.ts index 9665daa67f76..8de9a8c43b6e 100644 --- a/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-data.service.ts +++ b/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-data.service.ts @@ -16,9 +16,7 @@ * @fileoverview Services for oppia email dashboard page. */ -var oppia = require('AppInit.ts').module; - -oppia.factory('EmailDashboardDataService', [ +angular.module('oppia').factory('EmailDashboardDataService', [ '$http', '$q', function($http, $q) { var QUERY_DATA_URL = '/emaildashboarddatahandler'; var QUERY_STATUS_CHECK_URL = '/querystatuscheck'; diff --git a/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-page.controller.ts b/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-page.controller.ts index 5b20e39125e3..368de41e790f 100644 --- a/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-page.controller.ts +++ b/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-page.controller.ts @@ -21,92 +21,92 @@ require('base_components/BaseContentDirective.ts'); require('pages/email-dashboard-pages/email-dashboard-data.service.ts'); require('services/UserService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('emailDashboardPage', ['UrlInterpolationService', function( - UrlInterpolationService) { - return { - restrict: 'E', - scope: {}, - bindToController: {}, - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/email-dashboard-pages/email-dashboard-page.directive.html'), - controllerAs: '$ctrl', - controller: [ - '$rootScope', 'EmailDashboardDataService', 'UserService', - function($rootScope, EmailDashboardDataService, UserService) { - var ctrl = this; - ctrl.username = ''; - $rootScope.loadingMessage = 'Loading'; - UserService.getUserInfoAsync().then(function(userInfo) { - ctrl.username = userInfo.getUsername(); - $rootScope.loadingMessage = ''; - }); - - ctrl.currentPageOfQueries = []; +angular.module('oppia').directive('emailDashboardPage', [ + 'UrlInterpolationService', function( + UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: {}, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/email-dashboard-pages/email-dashboard-page.directive.html'), + controllerAs: '$ctrl', + controller: [ + '$rootScope', 'EmailDashboardDataService', 'UserService', + function($rootScope, EmailDashboardDataService, UserService) { + var ctrl = this; + ctrl.username = ''; + $rootScope.loadingMessage = 'Loading'; + UserService.getUserInfoAsync().then(function(userInfo) { + ctrl.username = userInfo.getUsername(); + $rootScope.loadingMessage = ''; + }); - ctrl.resetForm = function() { - ctrl.has_not_logged_in_for_n_days = null; - ctrl.inactive_in_last_n_days = null; - ctrl.created_at_least_n_exps = null; - ctrl.created_fewer_than_n_exps = null; - ctrl.edited_at_least_n_exps = null; - ctrl.edited_fewer_than_n_exps = null; - }; + ctrl.currentPageOfQueries = []; - ctrl.submitQuery = function() { - var data = { - has_not_logged_in_for_n_days: ctrl.has_not_logged_in_for_n_days, - inactive_in_last_n_days: ctrl.inactive_in_last_n_days, - created_at_least_n_exps: ctrl.created_at_least_n_exps, - created_fewer_than_n_exps: ctrl.created_fewer_than_n_exps, - edited_at_least_n_exps: ctrl.edited_at_least_n_exps, - edited_fewer_than_n_exps: ctrl.edited_fewer_than_n_exps + ctrl.resetForm = function() { + ctrl.has_not_logged_in_for_n_days = null; + ctrl.inactive_in_last_n_days = null; + ctrl.created_at_least_n_exps = null; + ctrl.created_fewer_than_n_exps = null; + ctrl.edited_at_least_n_exps = null; + ctrl.edited_fewer_than_n_exps = null; }; - EmailDashboardDataService.submitQuery(data).then(function(queries) { - ctrl.currentPageOfQueries = queries; - }); - ctrl.resetForm(); - ctrl.showSuccessMessage = true; - }; - ctrl.getNextPageOfQueries = function() { - if (EmailDashboardDataService.isNextPageAvailable()) { - EmailDashboardDataService.getNextQueries().then(function(queries) { + ctrl.submitQuery = function() { + var data = { + has_not_logged_in_for_n_days: ctrl.has_not_logged_in_for_n_days, + inactive_in_last_n_days: ctrl.inactive_in_last_n_days, + created_at_least_n_exps: ctrl.created_at_least_n_exps, + created_fewer_than_n_exps: ctrl.created_fewer_than_n_exps, + edited_at_least_n_exps: ctrl.edited_at_least_n_exps, + edited_fewer_than_n_exps: ctrl.edited_fewer_than_n_exps + }; + EmailDashboardDataService.submitQuery(data).then(function(queries) { ctrl.currentPageOfQueries = queries; }); - } - }; + ctrl.resetForm(); + ctrl.showSuccessMessage = true; + }; - ctrl.getPreviousPageOfQueries = function() { - if (EmailDashboardDataService.isPreviousPageAvailable()) { - ctrl.currentPageOfQueries = ( - EmailDashboardDataService.getPreviousQueries()); - } - }; + ctrl.getNextPageOfQueries = function() { + if (EmailDashboardDataService.isNextPageAvailable()) { + EmailDashboardDataService.getNextQueries().then( + function(queries) { + ctrl.currentPageOfQueries = queries; + }); + } + }; - ctrl.showNextButton = function() { - return EmailDashboardDataService.isNextPageAvailable(); - }; + ctrl.getPreviousPageOfQueries = function() { + if (EmailDashboardDataService.isPreviousPageAvailable()) { + ctrl.currentPageOfQueries = ( + EmailDashboardDataService.getPreviousQueries()); + } + }; - ctrl.showPreviousButton = function() { - return EmailDashboardDataService.isPreviousPageAvailable(); - }; + ctrl.showNextButton = function() { + return EmailDashboardDataService.isNextPageAvailable(); + }; - ctrl.recheckStatus = function(index) { - var queryId = ctrl.currentPageOfQueries[index].id; - EmailDashboardDataService.fetchQuery(queryId).then(function(query) { - ctrl.currentPageOfQueries[index] = query; - }); - }; + ctrl.showPreviousButton = function() { + return EmailDashboardDataService.isPreviousPageAvailable(); + }; + + ctrl.recheckStatus = function(index) { + var queryId = ctrl.currentPageOfQueries[index].id; + EmailDashboardDataService.fetchQuery(queryId).then(function(query) { + ctrl.currentPageOfQueries[index] = query; + }); + }; - ctrl.showLinkToResultPage = function(submitter, status) { - return (submitter === ctrl.username) && (status === 'completed'); - }; + ctrl.showLinkToResultPage = function(submitter, status) { + return (submitter === ctrl.username) && (status === 'completed'); + }; - EmailDashboardDataService.getNextQueries().then(function(queries) { - ctrl.currentPageOfQueries = queries; - }); - } - ]}; -}]); + EmailDashboardDataService.getNextQueries().then(function(queries) { + ctrl.currentPageOfQueries = queries; + }); + } + ]}; + }]); diff --git a/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-page.scripts.ts b/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-page.scripts.ts index eb8d71da237d..2c610fd910f2 100644 --- a/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-page.scripts.ts +++ b/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-page.scripts.ts @@ -16,6 +16,7 @@ * @fileoverview Directive scripts for oppia email dashboard page. */ +require('AppInit.ts'); require('App.ts'); require('pages/email-dashboard-pages/email-dashboard-page.controller.ts'); diff --git a/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-result.controller.ts b/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-result.controller.ts index ee24ada2c580..adb4501fbe31 100644 --- a/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-result.controller.ts +++ b/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-result.controller.ts @@ -20,9 +20,7 @@ require('base_components/BaseContentDirective.ts'); require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('emailDashboardResultPage', [ +angular.module('oppia').directive('emailDashboardResultPage', [ 'UrlInterpolationService', function( UrlInterpolationService) { return { diff --git a/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-result.scripts.ts b/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-result.scripts.ts index 213b5a4cee3d..e80bdafffa86 100644 --- a/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-result.scripts.ts +++ b/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-result.scripts.ts @@ -16,6 +16,7 @@ * @fileoverview Directive scripts for oppia email dashboard page. */ +require('AppInit.ts'); require('App.ts'); require('pages/email-dashboard-pages/email-dashboard-result.controller.ts'); diff --git a/core/templates/dev/head/pages/error-pages/error-page.controller.ts b/core/templates/dev/head/pages/error-pages/error-page.controller.ts index 652cd8744879..b4081324dcc0 100644 --- a/core/templates/dev/head/pages/error-pages/error-page.controller.ts +++ b/core/templates/dev/head/pages/error-pages/error-page.controller.ts @@ -19,28 +19,28 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/PageTitleService.ts'); -var oppia = require('AppInit.ts').module; +angular.module('oppia').directive('errorPage', [ + 'UrlInterpolationService', function( + UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: {}, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/error-pages/error-page.directive.html'), + controllerAs: '$ctrl', + controller: [ + 'PageTitleService', 'UrlInterpolationService', + function( + PageTitleService, UrlInterpolationService) { + var ctrl = this; + ctrl.oopsMintImgUrl = UrlInterpolationService.getStaticImageUrl( + '/general/oops_mint.png'); -oppia.directive('errorPage', ['UrlInterpolationService', function( - UrlInterpolationService) { - return { - restrict: 'E', - scope: {}, - bindToController: {}, - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/error-pages/error-page.directive.html'), - controllerAs: '$ctrl', - controller: [ - 'PageTitleService', 'UrlInterpolationService', - function( - PageTitleService, UrlInterpolationService) { - var ctrl = this; - ctrl.oopsMintImgUrl = UrlInterpolationService.getStaticImageUrl( - '/general/oops_mint.png'); + ctrl.statusCode = GLOBALS.status_code; - ctrl.statusCode = GLOBALS.status_code; - - PageTitleService.setPageTitle('Error ' + ctrl.statusCode + ' - Oppia'); - } - ]}; -}]); + PageTitleService.setPageTitle( + 'Error ' + ctrl.statusCode + ' - Oppia'); + } + ]}; + }]); diff --git a/core/templates/dev/head/pages/error-pages/error-page.scripts.ts b/core/templates/dev/head/pages/error-pages/error-page.scripts.ts index 4ae80df7c63e..095fa715526d 100644 --- a/core/templates/dev/head/pages/error-pages/error-page.scripts.ts +++ b/core/templates/dev/head/pages/error-pages/error-page.scripts.ts @@ -16,6 +16,7 @@ * @fileoverview Directive scripts for the error page. */ +require('AppInit.ts'); require('App.ts'); require('pages/OppiaFooterDirective.ts'); diff --git a/core/templates/dev/head/pages/exploration-editor-page/editor-navigation/editor-navbar-breadcrumb.directive.ts b/core/templates/dev/head/pages/exploration-editor-page/editor-navigation/editor-navbar-breadcrumb.directive.ts index fbe226d122c9..dbd621c0ec7f 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/editor-navigation/editor-navbar-breadcrumb.directive.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/editor-navigation/editor-navbar-breadcrumb.directive.ts @@ -22,9 +22,7 @@ require('pages/exploration-editor-page/services/exploration-title.service.ts'); require('pages/exploration-editor-page/services/router.service.ts'); require('services/stateful/FocusManagerService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('editorNavbarBreadcrumb', [ +angular.module('oppia').directive('editorNavbarBreadcrumb', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/exploration-editor-page/editor-navigation/editor-navigation.directive.ts b/core/templates/dev/head/pages/exploration-editor-page/editor-navigation/editor-navigation.directive.ts index d9edc5c42ddb..fc17dc973090 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/editor-navigation/editor-navigation.directive.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/editor-navigation/editor-navigation.directive.ts @@ -33,9 +33,7 @@ require('services/SiteAnalyticsService.ts'); require('services/UserService.ts'); require('services/contextual/WindowDimensionsService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('editorNavigation', [ +angular.module('oppia').directive('editorNavigation', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/exploration-editor-page/editor-tab/exploration-editor-tab.directive.ts b/core/templates/dev/head/pages/exploration-editor-page/editor-tab/exploration-editor-tab.directive.ts index d457e0cc55e9..7d3178d47e4b 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/editor-tab/exploration-editor-tab.directive.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/editor-tab/exploration-editor-tab.directive.ts @@ -49,193 +49,194 @@ require('services/AlertsService.ts'); require('services/ContextService.ts'); require('services/ExplorationFeaturesService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('explorationEditorTab', ['UrlInterpolationService', function( - UrlInterpolationService) { - return { - restrict: 'E', - scope: {}, - bindToController: {}, - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/exploration-editor-page/editor-tab/' + - 'exploration-editor-tab.directive.html'), - controllerAs: '$ctrl', - controller: [ - '$rootScope', '$scope', '$uibModal', 'AlertsService', 'ContextService', - 'ExplorationCorrectnessFeedbackService', 'ExplorationFeaturesService', - 'ExplorationInitStateNameService', 'ExplorationStatesService', - 'ExplorationWarningsService', 'GraphDataService', 'RouterService', - 'StateEditorService', 'UrlInterpolationService', - function( - $rootScope, $scope, $uibModal, AlertsService, ContextService, - ExplorationCorrectnessFeedbackService, ExplorationFeaturesService, - ExplorationInitStateNameService, ExplorationStatesService, - ExplorationWarningsService, GraphDataService, RouterService, - StateEditorService, UrlInterpolationService) { - var ctrl = this; - ctrl.areParametersEnabled = - ExplorationFeaturesService.areParametersEnabled; - - ctrl.interactionIsShown = false; - - $scope.$on('refreshStateEditor', function() { - ctrl.initStateEditor(); - }); - - $scope.$watch(ExplorationStatesService.getStates, function() { - if (ExplorationStatesService.getStates()) { - StateEditorService.setStateNames( - ExplorationStatesService.getStateNames()); - } - }, true); - - ctrl.getStateContentPlaceholder = function() { - if ( - StateEditorService.getActiveStateName() === - ExplorationInitStateNameService.savedMemento) { - return ( - 'This is the first card of your exploration. Use this space to ' + - 'introduce your topic and engage the learner, then ask them a ' + - 'question.'); - } else { - return ( - 'You can speak to the learner here, then ask them a question.'); - } - }; - - ctrl.addState = function(newStateName) { - ExplorationStatesService.addState(newStateName, null); - }; - - ctrl.refreshWarnings = function() { - ExplorationWarningsService.updateWarnings(); - }; - - ctrl.initStateEditor = function() { - ctrl.stateName = StateEditorService.getActiveStateName(); - StateEditorService.setStateNames( - ExplorationStatesService.getStateNames()); - StateEditorService.setCorrectnessFeedbackEnabled( - ExplorationCorrectnessFeedbackService.isEnabled()); - StateEditorService.setInQuestionMode(false); - var stateData = ExplorationStatesService.getState(ctrl.stateName); - if (ctrl.stateName && stateData) { - $rootScope.$broadcast('stateEditorInitialized', stateData); - - var content = ExplorationStatesService.getStateContentMemento( - ctrl.stateName); - if (content.getHtml() || stateData.interaction.id) { - ctrl.interactionIsShown = true; +angular.module('oppia').directive('explorationEditorTab', [ + 'UrlInterpolationService', function(UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: {}, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/exploration-editor-page/editor-tab/' + + 'exploration-editor-tab.directive.html'), + controllerAs: '$ctrl', + controller: [ + '$rootScope', '$scope', '$uibModal', + 'ExplorationCorrectnessFeedbackService', 'ExplorationFeaturesService', + 'ExplorationInitStateNameService', 'ExplorationStatesService', + 'ExplorationWarningsService', 'GraphDataService', 'RouterService', + 'StateEditorService', 'UrlInterpolationService', + function( + $rootScope, $scope, $uibModal, + ExplorationCorrectnessFeedbackService, ExplorationFeaturesService, + ExplorationInitStateNameService, ExplorationStatesService, + ExplorationWarningsService, GraphDataService, RouterService, + StateEditorService, UrlInterpolationService) { + var ctrl = this; + ctrl.areParametersEnabled = + ExplorationFeaturesService.areParametersEnabled; + + ctrl.interactionIsShown = false; + + $scope.$on('refreshStateEditor', function() { + ctrl.initStateEditor(); + }); + + $scope.$watch(ExplorationStatesService.getStates, function() { + if (ExplorationStatesService.getStates()) { + StateEditorService.setStateNames( + ExplorationStatesService.getStateNames()); + } + }, true); + + ctrl.getStateContentPlaceholder = function() { + if ( + StateEditorService.getActiveStateName() === + ExplorationInitStateNameService.savedMemento) { + return ( + 'This is the first card of your exploration. Use this space ' + + 'to introduce your topic and engage the learner, then ask ' + + 'them a question.'); + } else { + return ( + 'You can speak to the learner here, then ask them a question.'); } + }; - $rootScope.loadingMessage = ''; - } - }; - - ctrl.recomputeGraph = function() { - GraphDataService.recompute(); - }; - - ctrl.saveStateContent = function(displayedValue) { - ExplorationStatesService.saveStateContent( - ctrl.stateName, angular.copy(displayedValue)); - // Show the interaction when the text content is saved, even if no - // content is entered. - ctrl.interactionIsShown = true; - }; - - ctrl.saveInteractionId = function(displayedValue) { - ExplorationStatesService.saveInteractionId( - ctrl.stateName, angular.copy(displayedValue)); - StateEditorService.setInteractionId(angular.copy(displayedValue)); - }; - - ctrl.saveInteractionAnswerGroups = function(newAnswerGroups) { - ExplorationStatesService.saveInteractionAnswerGroups( - ctrl.stateName, angular.copy(newAnswerGroups)); - - StateEditorService.setInteractionAnswerGroups( - angular.copy(newAnswerGroups)); - ctrl.recomputeGraph(); - }; - - ctrl.saveInteractionDefaultOutcome = function(newOutcome) { - ExplorationStatesService.saveInteractionDefaultOutcome( - ctrl.stateName, angular.copy(newOutcome)); - - StateEditorService.setInteractionDefaultOutcome( - angular.copy(newOutcome)); - ctrl.recomputeGraph(); - }; - - ctrl.saveInteractionCustomizationArgs = function(displayedValue) { - ExplorationStatesService.saveInteractionCustomizationArgs( - ctrl.stateName, angular.copy(displayedValue)); - - StateEditorService.setInteractionCustomizationArgs( - angular.copy(displayedValue)); - }; - - ctrl.saveSolution = function(displayedValue) { - ExplorationStatesService.saveSolution( - ctrl.stateName, angular.copy(displayedValue)); - - StateEditorService.setInteractionSolution( - angular.copy(displayedValue)); - }; - - ctrl.saveHints = function(displayedValue) { - ExplorationStatesService.saveHints( - ctrl.stateName, angular.copy(displayedValue)); - - StateEditorService.setInteractionHints( - angular.copy(displayedValue)); - }; - - ctrl.saveSolicitAnswerDetails = function(displayedValue) { - ExplorationStatesService.saveSolicitAnswerDetails( - ctrl.stateName, angular.copy(displayedValue)); - - StateEditorService.setSolicitAnswerDetails( - angular.copy(displayedValue)); - }; - - ctrl.showMarkAllAudioAsNeedingUpdateModalIfRequired = function( - contentId) { - var stateName = StateEditorService.getActiveStateName(); - var state = ExplorationStatesService.getState(stateName); - var recordedVoiceovers = state.recordedVoiceovers; - var writtenTranslations = state.writtenTranslations; - if (recordedVoiceovers.hasUnflaggedVoiceovers(contentId) || - writtenTranslations.hasUnflaggedWrittenTranslations(contentId)) { - $uibModal.open({ - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/components/forms/forms-templates/mark-all-audio-and-' + - 'translations-as-needing-update-modal.directive.html'), - backdrop: true, - controller: 'MarkAllAudioAndTranslationsAsNeedingUpdateController' - }).result.then(function() { - if (recordedVoiceovers.hasUnflaggedVoiceovers(contentId)) { - recordedVoiceovers.markAllVoiceoversAsNeedingUpdate(contentId); - ExplorationStatesService.saveRecordedVoiceovers( - stateName, recordedVoiceovers); - } - if (writtenTranslations.hasUnflaggedWrittenTranslations( - contentId)) { - writtenTranslations.markAllTranslationsAsNeedingUpdate( - contentId); - ExplorationStatesService.saveWrittenTranslations( - stateName, writtenTranslations); + ctrl.addState = function(newStateName) { + ExplorationStatesService.addState(newStateName, null); + }; + + ctrl.refreshWarnings = function() { + ExplorationWarningsService.updateWarnings(); + }; + + ctrl.initStateEditor = function() { + ctrl.stateName = StateEditorService.getActiveStateName(); + StateEditorService.setStateNames( + ExplorationStatesService.getStateNames()); + StateEditorService.setCorrectnessFeedbackEnabled( + ExplorationCorrectnessFeedbackService.isEnabled()); + StateEditorService.setInQuestionMode(false); + var stateData = ExplorationStatesService.getState(ctrl.stateName); + if (ctrl.stateName && stateData) { + $rootScope.$broadcast('stateEditorInitialized', stateData); + + var content = ExplorationStatesService.getStateContentMemento( + ctrl.stateName); + if (content.getHtml() || stateData.interaction.id) { + ctrl.interactionIsShown = true; } - }); - } - }; - - ctrl.navigateToState = function(stateName) { - RouterService.navigateToMainTab(stateName); - }; - } - ] - }; -}]); + + $rootScope.loadingMessage = ''; + } + }; + + ctrl.recomputeGraph = function() { + GraphDataService.recompute(); + }; + + ctrl.saveStateContent = function(displayedValue) { + ExplorationStatesService.saveStateContent( + ctrl.stateName, angular.copy(displayedValue)); + // Show the interaction when the text content is saved, even if no + // content is entered. + ctrl.interactionIsShown = true; + }; + + ctrl.saveInteractionId = function(displayedValue) { + ExplorationStatesService.saveInteractionId( + ctrl.stateName, angular.copy(displayedValue)); + StateEditorService.setInteractionId(angular.copy(displayedValue)); + }; + + ctrl.saveInteractionAnswerGroups = function(newAnswerGroups) { + ExplorationStatesService.saveInteractionAnswerGroups( + ctrl.stateName, angular.copy(newAnswerGroups)); + + StateEditorService.setInteractionAnswerGroups( + angular.copy(newAnswerGroups)); + ctrl.recomputeGraph(); + }; + + ctrl.saveInteractionDefaultOutcome = function(newOutcome) { + ExplorationStatesService.saveInteractionDefaultOutcome( + ctrl.stateName, angular.copy(newOutcome)); + + StateEditorService.setInteractionDefaultOutcome( + angular.copy(newOutcome)); + ctrl.recomputeGraph(); + }; + + ctrl.saveInteractionCustomizationArgs = function(displayedValue) { + ExplorationStatesService.saveInteractionCustomizationArgs( + ctrl.stateName, angular.copy(displayedValue)); + + StateEditorService.setInteractionCustomizationArgs( + angular.copy(displayedValue)); + }; + + ctrl.saveSolution = function(displayedValue) { + ExplorationStatesService.saveSolution( + ctrl.stateName, angular.copy(displayedValue)); + + StateEditorService.setInteractionSolution( + angular.copy(displayedValue)); + }; + + ctrl.saveHints = function(displayedValue) { + ExplorationStatesService.saveHints( + ctrl.stateName, angular.copy(displayedValue)); + + StateEditorService.setInteractionHints( + angular.copy(displayedValue)); + }; + + ctrl.saveSolicitAnswerDetails = function(displayedValue) { + ExplorationStatesService.saveSolicitAnswerDetails( + ctrl.stateName, angular.copy(displayedValue)); + + StateEditorService.setSolicitAnswerDetails( + angular.copy(displayedValue)); + }; + + ctrl.showMarkAllAudioAsNeedingUpdateModalIfRequired = function( + contentId) { + var stateName = StateEditorService.getActiveStateName(); + var state = ExplorationStatesService.getState(stateName); + var recordedVoiceovers = state.recordedVoiceovers; + var writtenTranslations = state.writtenTranslations; + if (recordedVoiceovers.hasUnflaggedVoiceovers(contentId) || + writtenTranslations.hasUnflaggedWrittenTranslations( + contentId)) { + $uibModal.open({ + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/components/forms/forms-templates/mark-all-audio-and-' + + 'translations-as-needing-update-modal.directive.html'), + backdrop: true, + controller: ( + 'MarkAllAudioAndTranslationsAsNeedingUpdateController') + }).result.then(function() { + if (recordedVoiceovers.hasUnflaggedVoiceovers(contentId)) { + recordedVoiceovers.markAllVoiceoversAsNeedingUpdate( + contentId); + ExplorationStatesService.saveRecordedVoiceovers( + stateName, recordedVoiceovers); + } + if (writtenTranslations.hasUnflaggedWrittenTranslations( + contentId)) { + writtenTranslations.markAllTranslationsAsNeedingUpdate( + contentId); + ExplorationStatesService.saveWrittenTranslations( + stateName, writtenTranslations); + } + }); + } + }; + + ctrl.navigateToState = function(stateName) { + RouterService.navigateToMainTab(stateName); + }; + } + ] + }; + }]); diff --git a/core/templates/dev/head/pages/exploration-editor-page/editor-tab/graph-directives/exploration-graph.directive.ts b/core/templates/dev/head/pages/exploration-editor-page/editor-tab/graph-directives/exploration-graph.directive.ts index 9e0aaba61c7b..0a5a8f639fce 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/editor-tab/graph-directives/exploration-graph.directive.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/editor-tab/graph-directives/exploration-graph.directive.ts @@ -26,103 +26,101 @@ require( require('services/AlertsService.ts'); require('services/EditabilityService.ts'); -var oppia = require('AppInit.ts').module; +angular.module('oppia').directive('explorationGraph', [ + 'UrlInterpolationService', function(UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: {}, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/exploration-editor-page/editor-tab/graph-directives/' + + 'exploration-graph.directive.html'), + controllerAs: '$ctrl', + controller: [ + '$uibModal', 'AlertsService', 'EditabilityService', + 'ExplorationStatesService', 'GraphDataService', 'RouterService', + 'StateEditorService', 'UrlInterpolationService', + function( + $uibModal, AlertsService, EditabilityService, + ExplorationStatesService, GraphDataService, RouterService, + StateEditorService, UrlInterpolationService) { + var ctrl = this; + ctrl.getGraphData = GraphDataService.getGraphData; + ctrl.isEditable = EditabilityService.isEditable; -oppia.directive('explorationGraph', ['UrlInterpolationService', function( - UrlInterpolationService) { - return { - restrict: 'E', - scope: {}, - bindToController: {}, - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/exploration-editor-page/editor-tab/graph-directives/' + - 'exploration-graph.directive.html'), - controllerAs: '$ctrl', - controller: [ - '$uibModal', 'AlertsService', 'EditabilityService', - 'ExplorationStatesService', 'GraphDataService', 'RouterService', - 'StateEditorService', 'UrlInterpolationService', - function( - $uibModal, AlertsService, EditabilityService, - ExplorationStatesService, GraphDataService, RouterService, - StateEditorService, UrlInterpolationService) { - var ctrl = this; - ctrl.getGraphData = GraphDataService.getGraphData; - ctrl.isEditable = EditabilityService.isEditable; + // We hide the graph at the outset in order not to confuse new + // exploration creators. + ctrl.isGraphShown = function() { + return Boolean(ExplorationStatesService.isInitialized() && + ExplorationStatesService.getStateNames().length > 1); + }; - // We hide the graph at the outset in order not to confuse new - // exploration creators. - ctrl.isGraphShown = function() { - return Boolean(ExplorationStatesService.isInitialized() && - ExplorationStatesService.getStateNames().length > 1); - }; + ctrl.deleteState = function(deleteStateName) { + ExplorationStatesService.deleteState(deleteStateName); + }; - ctrl.deleteState = function(deleteStateName) { - ExplorationStatesService.deleteState(deleteStateName); - }; + ctrl.onClickStateInMinimap = function(stateName) { + RouterService.navigateToMainTab(stateName); + }; - ctrl.onClickStateInMinimap = function(stateName) { - RouterService.navigateToMainTab(stateName); - }; + ctrl.getActiveStateName = function() { + return StateEditorService.getActiveStateName(); + }; - ctrl.getActiveStateName = function() { - return StateEditorService.getActiveStateName(); - }; + ctrl.openStateGraphModal = function() { + AlertsService.clearWarnings(); - ctrl.openStateGraphModal = function() { - AlertsService.clearWarnings(); + $uibModal.open({ + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/exploration-editor-page/editor-tab/templates/' + + 'modal-templates/exploration-graph-modal.template.html'), + backdrop: true, + resolve: { + isEditable: function() { + return ctrl.isEditable; + } + }, + windowClass: 'oppia-large-modal-window', + controller: [ + '$scope', '$uibModalInstance', 'StateEditorService', + 'GraphDataService', 'isEditable', + function($scope, $uibModalInstance, StateEditorService, + GraphDataService, isEditable) { + $scope.currentStateName = StateEditorService + .getActiveStateName(); + $scope.graphData = GraphDataService.getGraphData(); + $scope.isEditable = isEditable; - $uibModal.open({ - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/exploration-editor-page/editor-tab/templates/' + - 'modal-templates/exploration-graph-modal.template.html'), - backdrop: true, - resolve: { - isEditable: function() { - return ctrl.isEditable; - } - }, - windowClass: 'oppia-large-modal-window', - controller: [ - '$scope', '$uibModalInstance', 'StateEditorService', - 'GraphDataService', 'isEditable', - function($scope, $uibModalInstance, StateEditorService, - GraphDataService, isEditable) { - $scope.currentStateName = StateEditorService - .getActiveStateName(); - $scope.graphData = GraphDataService.getGraphData(); - $scope.isEditable = isEditable; - - $scope.deleteState = function(stateName) { - $uibModalInstance.close({ - action: 'delete', - stateName: stateName - }); - }; + $scope.deleteState = function(stateName) { + $uibModalInstance.close({ + action: 'delete', + stateName: stateName + }); + }; - $scope.selectState = function(stateName) { - $uibModalInstance.close({ - action: 'navigate', - stateName: stateName - }); - }; + $scope.selectState = function(stateName) { + $uibModalInstance.close({ + action: 'navigate', + stateName: stateName + }); + }; - $scope.cancel = function() { - $uibModalInstance.dismiss('cancel'); - AlertsService.clearWarnings(); - }; + $scope.cancel = function() { + $uibModalInstance.dismiss('cancel'); + AlertsService.clearWarnings(); + }; + } + ] + }).result.then(function(closeDict) { + if (closeDict.action === 'delete') { + ExplorationStatesService.deleteState(closeDict.stateName); + } else if (closeDict.action === 'navigate') { + ctrl.onClickStateInMinimap(closeDict.stateName); + } else { + console.error('Invalid closeDict action: ' + closeDict.action); } - ] - }).result.then(function(closeDict) { - if (closeDict.action === 'delete') { - ExplorationStatesService.deleteState(closeDict.stateName); - } else if (closeDict.action === 'navigate') { - ctrl.onClickStateInMinimap(closeDict.stateName); - } else { - console.error('Invalid closeDict action: ' + closeDict.action); - } - }); - }; - }] - }; -}]); + }); + }; + }] + }; + }]); diff --git a/core/templates/dev/head/pages/exploration-editor-page/editor-tab/graph-directives/state-graph-visualization.directive.ts b/core/templates/dev/head/pages/exploration-editor-page/editor-tab/graph-directives/state-graph-visualization.directive.ts index e04c0ae3da89..1d1e9ddbe90f 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/editor-tab/graph-directives/state-graph-visualization.directive.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/editor-tab/graph-directives/state-graph-visualization.directive.ts @@ -26,9 +26,7 @@ require( 'translation-status.service.ts'); /* eslint-disable angular/directive-restrict */ -var oppia = require('AppInit.ts').module; - -oppia.directive('stateGraphVisualization', [ +angular.module('oppia').directive('stateGraphVisualization', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { // Note: This directive is used as attribute because pannability does not diff --git a/core/templates/dev/head/pages/exploration-editor-page/editor-tab/services/answer-groups-cache.service.ts b/core/templates/dev/head/pages/exploration-editor-page/editor-tab/services/answer-groups-cache.service.ts index cad925ac53b5..fe4204a5bbbc 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/editor-tab/services/answer-groups-cache.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/editor-tab/services/answer-groups-cache.service.ts @@ -53,7 +53,5 @@ export class AnswerGroupsCacheService { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'AnswerGroupsCacheService', downgradeInjectable(AnswerGroupsCacheService)); diff --git a/core/templates/dev/head/pages/exploration-editor-page/editor-tab/services/interaction-details-cache.service.ts b/core/templates/dev/head/pages/exploration-editor-page/editor-tab/services/interaction-details-cache.service.ts index b55eb09ac0c7..d57c65826a1b 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/editor-tab/services/interaction-details-cache.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/editor-tab/services/interaction-details-cache.service.ts @@ -62,8 +62,6 @@ export class InteractionDetailsCacheService { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'InteractionDetailsCacheService', downgradeInjectable(InteractionDetailsCacheService)); diff --git a/core/templates/dev/head/pages/exploration-editor-page/editor-tab/services/responses.service.ts b/core/templates/dev/head/pages/exploration-editor-page/editor-tab/services/responses.service.ts index 4f033b270ce0..4b1a02dbd0d5 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/editor-tab/services/responses.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/editor-tab/services/responses.service.ts @@ -38,11 +38,9 @@ require('services/ContextService.ts'); require('pages/exploration-editor-page/exploration-editor-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ResponsesService', [ +angular.module('oppia').factory('ResponsesService', [ '$rootScope', 'AlertsService', 'AnswerGroupsCacheService', - 'ContextService', 'OutcomeObjectFactory', + 'OutcomeObjectFactory', 'SolutionValidityService', 'SolutionVerificationService', 'StateEditorService', 'StateInteractionIdService', 'StateSolutionService', 'COMPONENT_NAME_DEFAULT_OUTCOME', @@ -51,7 +49,7 @@ oppia.factory('ResponsesService', [ 'INFO_MESSAGE_SOLUTION_IS_VALID', 'INTERACTION_SPECS', function( $rootScope, AlertsService, AnswerGroupsCacheService, - ContextService, OutcomeObjectFactory, + OutcomeObjectFactory, SolutionValidityService, SolutionVerificationService, StateEditorService, StateInteractionIdService, StateSolutionService, COMPONENT_NAME_DEFAULT_OUTCOME, diff --git a/core/templates/dev/head/pages/exploration-editor-page/editor-tab/services/solution-validity.service.ts b/core/templates/dev/head/pages/exploration-editor-page/editor-tab/services/solution-validity.service.ts index 653927d4c772..b30ef66bacdc 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/editor-tab/services/solution-validity.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/editor-tab/services/solution-validity.service.ts @@ -56,7 +56,5 @@ export class SolutionValidityService { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'SolutionValidityService', downgradeInjectable(SolutionValidityService)); diff --git a/core/templates/dev/head/pages/exploration-editor-page/editor-tab/services/solution-verification.service.ts b/core/templates/dev/head/pages/exploration-editor-page/editor-tab/services/solution-verification.service.ts index 36c384d2ae33..8f7f924ca26f 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/editor-tab/services/solution-verification.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/editor-tab/services/solution-verification.service.ts @@ -23,9 +23,7 @@ require( 'components/state-editor/state-editor-properties-services/' + 'state-editor.service.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('SolutionVerificationService', [ +angular.module('oppia').factory('SolutionVerificationService', [ '$injector', 'AngularNameService', 'AnswerClassificationService', 'StateEditorService', function( diff --git a/core/templates/dev/head/pages/exploration-editor-page/editor-tab/state-name-editor/state-name-editor.directive.ts b/core/templates/dev/head/pages/exploration-editor-page/editor-tab/state-name-editor/state-name-editor.directive.ts index 7c1ca42dcf4e..0fdffdec9779 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/editor-tab/state-name-editor/state-name-editor.directive.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/editor-tab/state-name-editor/state-name-editor.directive.ts @@ -27,9 +27,7 @@ require( require('services/EditabilityService.ts'); require('services/stateful/FocusManagerService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('stateNameEditor', [ +angular.module('oppia').directive('stateNameEditor', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/exploration-editor-page/editor-tab/state-param-changes-editor/state-param-changes-editor.directive.ts b/core/templates/dev/head/pages/exploration-editor-page/editor-tab/state-param-changes-editor/state-param-changes-editor.directive.ts index 934929024d8b..3cbf1b9c2f3c 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/editor-tab/state-param-changes-editor/state-param-changes-editor.directive.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/editor-tab/state-param-changes-editor/state-param-changes-editor.directive.ts @@ -28,9 +28,7 @@ require( 'components/state-editor/state-editor-properties-services/' + 'state-property.service.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('stateParamChangesEditor', [ +angular.module('oppia').directive('stateParamChangesEditor', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/exploration-editor-page/editor-tab/test-interaction-panel/test-interaction-panel.directive.ts b/core/templates/dev/head/pages/exploration-editor-page/editor-tab/test-interaction-panel/test-interaction-panel.directive.ts index 1632c4655bf9..1396873d8dd3 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/editor-tab/test-interaction-panel/test-interaction-panel.directive.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/editor-tab/test-interaction-panel/test-interaction-panel.directive.ts @@ -23,9 +23,7 @@ require( require('pages/exploration-editor-page/exploration-editor-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('testInteractionPanel', [ +angular.module('oppia').directive('testInteractionPanel', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/exploration-editor-page/editor-tab/training-panel/training-data-editor-panel.service.ts b/core/templates/dev/head/pages/exploration-editor-page/editor-tab/training-panel/training-data-editor-panel.service.ts index d45e2e6f00d9..1e73faa697b4 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/editor-tab/training-panel/training-data-editor-panel.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/editor-tab/training-panel/training-data-editor-panel.service.ts @@ -47,9 +47,7 @@ require('services/ContextService.ts'); require('services/ExplorationHtmlFormatterService.ts'); require('services/stateful/FocusManagerService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('TrainingDataEditorPanelService', [ +angular.module('oppia').factory('TrainingDataEditorPanelService', [ '$rootScope', '$uibModal', 'AlertsService', 'UrlInterpolationService', function($rootScope, $uibModal, AlertsService, UrlInterpolationService) { return { diff --git a/core/templates/dev/head/pages/exploration-editor-page/editor-tab/training-panel/training-data.service.ts b/core/templates/dev/head/pages/exploration-editor-page/editor-tab/training-panel/training-data.service.ts index dbc430649455..c0cf5f5c6ac0 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/editor-tab/training-panel/training-data.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/editor-tab/training-panel/training-data.service.ts @@ -27,14 +27,12 @@ require( 'components/state-editor/state-editor-properties-services/' + 'state-editor.service.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('TrainingDataService', [ - '$http', '$rootScope', 'ExplorationStatesService', 'GraphDataService', - 'ResponsesService', 'RuleObjectFactory', 'StateEditorService', +angular.module('oppia').factory('TrainingDataService', [ + 'ExplorationStatesService', 'GraphDataService', + 'ResponsesService', 'StateEditorService', function( - $http, $rootScope, ExplorationStatesService, GraphDataService, - ResponsesService, RuleObjectFactory, StateEditorService) { + ExplorationStatesService, GraphDataService, + ResponsesService, StateEditorService) { var _getIndexOfTrainingData = function(answer, trainingData) { var index = -1; for (var i = 0; i < trainingData.length; i++) { diff --git a/core/templates/dev/head/pages/exploration-editor-page/editor-tab/training-panel/training-modal.service.ts b/core/templates/dev/head/pages/exploration-editor-page/editor-tab/training-panel/training-modal.service.ts index 998329e9c80a..18ec824c8414 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/editor-tab/training-panel/training-modal.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/editor-tab/training-panel/training-modal.service.ts @@ -44,9 +44,7 @@ require( require('services/AlertsService.ts'); require('services/ContextService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('TrainingModalService', [ +angular.module('oppia').factory('TrainingModalService', [ '$rootScope', '$uibModal', 'AlertsService', 'UrlInterpolationService', function($rootScope, $uibModal, AlertsService, UrlInterpolationService) { return { diff --git a/core/templates/dev/head/pages/exploration-editor-page/editor-tab/training-panel/training-panel.directive.ts b/core/templates/dev/head/pages/exploration-editor-page/editor-tab/training-panel/training-panel.directive.ts index 7f77964e1a58..ffecdf8929fd 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/editor-tab/training-panel/training-panel.directive.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/editor-tab/training-panel/training-panel.directive.ts @@ -16,9 +16,7 @@ * @fileoverview Directive for the training panel in the state editor. */ -var oppia = require('AppInit.ts').module; - -oppia.directive('trainingPanel', [ +angular.module('oppia').directive('trainingPanel', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/exploration-editor-page/editor-tab/unresolved-answers-overview/unresolved-answers-overview.directive.ts b/core/templates/dev/head/pages/exploration-editor-page/editor-tab/unresolved-answers-overview/unresolved-answers-overview.directive.ts index e9e23cf532f8..0a15b95bd380 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/editor-tab/unresolved-answers-overview/unresolved-answers-overview.directive.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/editor-tab/unresolved-answers-overview/unresolved-answers-overview.directive.ts @@ -31,9 +31,7 @@ require('services/StateTopAnswersStatsService.ts'); require('pages/exploration-editor-page/exploration-editor-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('unresolvedAnswersOverview', [ +angular.module('oppia').directive('unresolvedAnswersOverview', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/exploration-editor-page/exploration-editor-page.constants.ts b/core/templates/dev/head/pages/exploration-editor-page/exploration-editor-page.constants.ts index dad3bd08051b..f359143d8dc7 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/exploration-editor-page.constants.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/exploration-editor-page.constants.ts @@ -17,48 +17,48 @@ * help tab in the navbar. */ -var oppia = require('AppInit.ts').module; - -oppia.constant( +angular.module('oppia').constant( 'EXPLORATION_TITLE_INPUT_FOCUS_LABEL', 'explorationTitleInputFocusLabel'); -oppia.constant( +angular.module('oppia').constant( 'EVENT_EXPLORATION_PROPERTY_CHANGED', 'explorationPropertyChanged'); -oppia.constant( +angular.module('oppia').constant( 'PARAM_ACTION_GET', 'get'); -oppia.constant( +angular.module('oppia').constant( 'PARAM_ACTION_SET', 'set'); -oppia.constant( +angular.module('oppia').constant( 'VOICEOVER_MODE', 'voiceoverMode'); -oppia.constant( +angular.module('oppia').constant( 'TRANSLATION_MODE', 'translationMode'); // When an unresolved answer's frequency exceeds this threshold, an exploration // will be blocked from being published until the answer is resolved. -oppia.constant( +angular.module('oppia').constant( 'UNRESOLVED_ANSWER_FREQUENCY_THRESHOLD', 5); // Constant for audio recording time limit. -oppia.constant( +angular.module('oppia').constant( 'RECORDING_TIME_LIMIT', 300); -oppia.constant( +angular.module('oppia').constant( 'IMPROVE_TYPE_INCOMPLETE', 'incomplete'); -oppia.constant('DEFAULT_AUDIO_LANGUAGE', 'en'); +angular.module('oppia').constant('DEFAULT_AUDIO_LANGUAGE', 'en'); -oppia.constant('INFO_MESSAGE_SOLUTION_IS_VALID', +angular.module('oppia').constant('INFO_MESSAGE_SOLUTION_IS_VALID', 'The solution is now valid!'); -oppia.constant('INFO_MESSAGE_SOLUTION_IS_INVALID_FOR_CURRENT_RULE', +angular.module('oppia').constant( + 'INFO_MESSAGE_SOLUTION_IS_INVALID_FOR_CURRENT_RULE', 'The current solution is no longer valid.'); -oppia.constant('ACTION_ACCEPT_SUGGESTION', 'accept'); -oppia.constant('ACTION_REJECT_SUGGESTION', 'reject'); +angular.module('oppia').constant('ACTION_ACCEPT_SUGGESTION', 'accept'); +angular.module('oppia').constant('ACTION_REJECT_SUGGESTION', 'reject'); -oppia.constant('COMPONENT_NAME_DEFAULT_OUTCOME', 'default_outcome'); +angular.module('oppia').constant( + 'COMPONENT_NAME_DEFAULT_OUTCOME', 'default_outcome'); diff --git a/core/templates/dev/head/pages/exploration-editor-page/exploration-editor-page.controller.ts b/core/templates/dev/head/pages/exploration-editor-page/exploration-editor-page.controller.ts index f7f95dc3111d..3dbc72462eb8 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/exploration-editor-page.controller.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/exploration-editor-page.controller.ts @@ -259,487 +259,490 @@ require('services/StateTopAnswersStatsService.ts'); require('pages/exploration-editor-page/exploration-editor-page.constants.ts'); require('pages/interaction-specs.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('explorationEditorPage', ['UrlInterpolationService', function( - UrlInterpolationService) { - return { - restrict: 'E', - scope: {}, - bindToController: {}, - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/exploration-editor-page/exploration-editor-page.directive.html'), - controllerAs: '$ctrl', - controller: [ - '$http', '$log', '$q', '$rootScope', '$scope', '$templateCache', - '$timeout', '$uibModal', '$window', 'AutosaveInfoModalsService', - 'ChangeListService', 'ContextService', 'EditabilityService', - 'ExplorationAutomaticTextToSpeechService', 'ExplorationCategoryService', - 'ExplorationCorrectnessFeedbackService', 'ExplorationDataService', - 'ExplorationFeaturesBackendApiService', 'ExplorationFeaturesService', - 'ExplorationInitStateNameService', 'ExplorationLanguageCodeService', - 'ExplorationObjectiveService', 'ExplorationParamChangesService', - 'ExplorationParamSpecsService', 'ExplorationRightsService', - 'ExplorationStatesService', 'ExplorationTagsService', - 'ExplorationTitleService', 'ExplorationWarningsService', - 'GraphDataService', 'PageTitleService', 'ParamChangesObjectFactory', - 'ParamSpecsObjectFactory', 'PlaythroughIssuesService', 'RouterService', - 'SiteAnalyticsService', 'StateClassifierMappingService', - 'StateEditorService', 'StateTopAnswersStatsBackendApiService', - 'StateTopAnswersStatsService', 'StateTutorialFirstTimeService', - 'ThreadDataService', 'UrlInterpolationService', - 'UserEmailPreferencesService', 'EVENT_EXPLORATION_PROPERTY_CHANGED', - function( - $http, $log, $q, $rootScope, $scope, $templateCache, - $timeout, $uibModal, $window, AutosaveInfoModalsService, - ChangeListService, ContextService, EditabilityService, - ExplorationAutomaticTextToSpeechService, ExplorationCategoryService, - ExplorationCorrectnessFeedbackService, ExplorationDataService, - ExplorationFeaturesBackendApiService, ExplorationFeaturesService, - ExplorationInitStateNameService, ExplorationLanguageCodeService, - ExplorationObjectiveService, ExplorationParamChangesService, - ExplorationParamSpecsService, ExplorationRightsService, - ExplorationStatesService, ExplorationTagsService, - ExplorationTitleService, ExplorationWarningsService, - GraphDataService, PageTitleService, ParamChangesObjectFactory, - ParamSpecsObjectFactory, PlaythroughIssuesService, RouterService, - SiteAnalyticsService, StateClassifierMappingService, - StateEditorService, StateTopAnswersStatsBackendApiService, - StateTopAnswersStatsService, StateTutorialFirstTimeService, - ThreadDataService, UrlInterpolationService, - UserEmailPreferencesService, EVENT_EXPLORATION_PROPERTY_CHANGED) { - var ctrl = this; - ctrl.EditabilityService = EditabilityService; - ctrl.StateEditorService = StateEditorService; - - /** ******************************************************** - * Called on initial load of the exploration editor page. - *********************************************************/ - $rootScope.loadingMessage = 'Loading'; - - ctrl.explorationId = ContextService.getExplorationId(); - ctrl.explorationUrl = '/create/' + ctrl.explorationId; - ctrl.explorationDownloadUrl = ( - '/createhandler/download/' + ctrl.explorationId); - ctrl.revertExplorationUrl = ( - '/createhandler/revert/' + ctrl.explorationId); - - var setPageTitle = function() { - if (ExplorationTitleService.savedMemento) { - PageTitleService.setPageTitle( - ExplorationTitleService.savedMemento + ' - Oppia Editor'); - } else { - PageTitleService.setPageTitle( - 'Untitled Exploration - Oppia Editor'); - } - }; - - $scope.$on(EVENT_EXPLORATION_PROPERTY_CHANGED, setPageTitle); - - ctrl.getActiveTabName = RouterService.getActiveTabName; - - /** ****************************************** - * Methods affecting the graph visualization. - ********************************************/ - ctrl.areExplorationWarningsVisible = false; - ctrl.toggleExplorationWarningVisibility = function() { - ctrl.areExplorationWarningsVisible = ( - !ctrl.areExplorationWarningsVisible); - }; - - $scope.$on('refreshGraph', function() { - GraphDataService.recompute(); - ExplorationWarningsService.updateWarnings(); - }); - - ctrl.getExplorationUrl = function(explorationId) { - return explorationId ? ('/explore/' + explorationId) : ''; - }; - - // Initializes the exploration page using data from the backend. Called - // on page load. - ctrl.initExplorationPage = function(successCallback) { - $q.all([ - ExplorationDataService.getData(function( - explorationId, lostChanges) { - if (!AutosaveInfoModalsService.isModalOpen()) { - AutosaveInfoModalsService.showLostChangesModal( - lostChanges, explorationId); - } - }), - ExplorationFeaturesBackendApiService.fetchExplorationFeatures( - ContextService.getExplorationId()), - ]).then(function(combinedData) { - var explorationData = combinedData[0]; - var featuresData = combinedData[1]; - - ExplorationFeaturesService.init(explorationData, featuresData); - - ExplorationStatesService.init(explorationData.states); - - ExplorationTitleService.init(explorationData.title); - ExplorationCategoryService.init(explorationData.category); - ExplorationObjectiveService.init(explorationData.objective); - ExplorationLanguageCodeService.init(explorationData.language_code); - ExplorationInitStateNameService.init( - explorationData.init_state_name); - ExplorationTagsService.init(explorationData.tags); - ExplorationParamSpecsService.init( - ParamSpecsObjectFactory.createFromBackendDict( - explorationData.param_specs)); - ExplorationParamChangesService.init( - ParamChangesObjectFactory.createFromBackendList( - explorationData.param_changes)); - ExplorationAutomaticTextToSpeechService.init( - explorationData.auto_tts_enabled); - ExplorationCorrectnessFeedbackService.init( - explorationData.correctness_feedback_enabled); - StateClassifierMappingService.init( - explorationData.state_classifier_mapping); - PlaythroughIssuesService.initSession( - explorationData.exploration_id, explorationData.version); - - ctrl.explorationTitleService = ExplorationTitleService; - ctrl.explorationCategoryService = ExplorationCategoryService; - ctrl.explorationObjectiveService = ExplorationObjectiveService; - ctrl.ExplorationRightsService = ExplorationRightsService; - ctrl.explorationInitStateNameService = ( - ExplorationInitStateNameService); - - ctrl.currentUserIsAdmin = explorationData.is_admin; - ctrl.currentUserIsModerator = explorationData.is_moderator; - - ctrl.currentUser = explorationData.user; - ctrl.currentVersion = explorationData.version; - - ExplorationRightsService.init( - explorationData.rights.owner_names, - explorationData.rights.editor_names, - explorationData.rights.voice_artist_names, - explorationData.rights.viewer_names, - explorationData.rights.status, - explorationData.rights.cloned_from, - explorationData.rights.community_owned, - explorationData.rights.viewable_if_private); - UserEmailPreferencesService.init( - explorationData.email_preferences.mute_feedback_notifications, - explorationData.email_preferences.mute_suggestion_notifications); - - if (GLOBALS.can_edit) { - EditabilityService.markEditable(); +angular.module('oppia').directive('explorationEditorPage', [ + 'UrlInterpolationService', function( + UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: {}, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/exploration-editor-page/' + + 'exploration-editor-page.directive.html'), + controllerAs: '$ctrl', + controller: [ + '$http', '$log', '$q', '$rootScope', '$scope', '$templateCache', + '$timeout', '$uibModal', '$window', 'AutosaveInfoModalsService', + 'ChangeListService', 'ContextService', 'EditabilityService', + 'ExplorationAutomaticTextToSpeechService', 'ExplorationCategoryService', + 'ExplorationCorrectnessFeedbackService', 'ExplorationDataService', + 'ExplorationFeaturesBackendApiService', 'ExplorationFeaturesService', + 'ExplorationInitStateNameService', 'ExplorationLanguageCodeService', + 'ExplorationObjectiveService', 'ExplorationParamChangesService', + 'ExplorationParamSpecsService', 'ExplorationRightsService', + 'ExplorationStatesService', 'ExplorationTagsService', + 'ExplorationTitleService', 'ExplorationWarningsService', + 'GraphDataService', 'PageTitleService', 'ParamChangesObjectFactory', + 'ParamSpecsObjectFactory', 'PlaythroughIssuesService', 'RouterService', + 'SiteAnalyticsService', 'StateClassifierMappingService', + 'StateEditorService', 'StateTopAnswersStatsBackendApiService', + 'StateTopAnswersStatsService', 'StateTutorialFirstTimeService', + 'ThreadDataService', 'UrlInterpolationService', + 'UserEmailPreferencesService', 'EVENT_EXPLORATION_PROPERTY_CHANGED', + function( + $http, $log, $q, $rootScope, $scope, $templateCache, + $timeout, $uibModal, $window, AutosaveInfoModalsService, + ChangeListService, ContextService, EditabilityService, + ExplorationAutomaticTextToSpeechService, ExplorationCategoryService, + ExplorationCorrectnessFeedbackService, ExplorationDataService, + ExplorationFeaturesBackendApiService, ExplorationFeaturesService, + ExplorationInitStateNameService, ExplorationLanguageCodeService, + ExplorationObjectiveService, ExplorationParamChangesService, + ExplorationParamSpecsService, ExplorationRightsService, + ExplorationStatesService, ExplorationTagsService, + ExplorationTitleService, ExplorationWarningsService, + GraphDataService, PageTitleService, ParamChangesObjectFactory, + ParamSpecsObjectFactory, PlaythroughIssuesService, RouterService, + SiteAnalyticsService, StateClassifierMappingService, + StateEditorService, StateTopAnswersStatsBackendApiService, + StateTopAnswersStatsService, StateTutorialFirstTimeService, + ThreadDataService, UrlInterpolationService, + UserEmailPreferencesService, EVENT_EXPLORATION_PROPERTY_CHANGED) { + var ctrl = this; + ctrl.EditabilityService = EditabilityService; + ctrl.StateEditorService = StateEditorService; + + /** ******************************************************** + * Called on initial load of the exploration editor page. + *********************************************************/ + $rootScope.loadingMessage = 'Loading'; + + ctrl.explorationId = ContextService.getExplorationId(); + ctrl.explorationUrl = '/create/' + ctrl.explorationId; + ctrl.explorationDownloadUrl = ( + '/createhandler/download/' + ctrl.explorationId); + ctrl.revertExplorationUrl = ( + '/createhandler/revert/' + ctrl.explorationId); + + var setPageTitle = function() { + if (ExplorationTitleService.savedMemento) { + PageTitleService.setPageTitle( + ExplorationTitleService.savedMemento + ' - Oppia Editor'); + } else { + PageTitleService.setPageTitle( + 'Untitled Exploration - Oppia Editor'); } + }; - if (GLOBALS.can_voiceover || GLOBALS.can_edit) { - EditabilityService.markTranslatable(); - } + $scope.$on(EVENT_EXPLORATION_PROPERTY_CHANGED, setPageTitle); + + ctrl.getActiveTabName = RouterService.getActiveTabName; - StateEditorService.updateExplorationWhitelistedStatus( - featuresData.is_exploration_whitelisted); + /** ****************************************** + * Methods affecting the graph visualization. + ********************************************/ + ctrl.areExplorationWarningsVisible = false; + ctrl.toggleExplorationWarningVisibility = function() { + ctrl.areExplorationWarningsVisible = ( + !ctrl.areExplorationWarningsVisible); + }; + $scope.$on('refreshGraph', function() { GraphDataService.recompute(); + ExplorationWarningsService.updateWarnings(); + }); - if (!StateEditorService.getActiveStateName() || - !ExplorationStatesService.getState( - StateEditorService.getActiveStateName())) { - StateEditorService.setActiveStateName( - ExplorationInitStateNameService.displayed); - } + ctrl.getExplorationUrl = function(explorationId) { + return explorationId ? ('/explore/' + explorationId) : ''; + }; + + // Initializes the exploration page using data from the backend. + // Called on page load. + ctrl.initExplorationPage = function(successCallback) { + $q.all([ + ExplorationDataService.getData(function( + explorationId, lostChanges) { + if (!AutosaveInfoModalsService.isModalOpen()) { + AutosaveInfoModalsService.showLostChangesModal( + lostChanges, explorationId); + } + }), + ExplorationFeaturesBackendApiService.fetchExplorationFeatures( + ContextService.getExplorationId()), + ]).then(function(combinedData) { + var explorationData = combinedData[0]; + var featuresData = combinedData[1]; + + ExplorationFeaturesService.init(explorationData, featuresData); + + ExplorationStatesService.init(explorationData.states); + + ExplorationTitleService.init(explorationData.title); + ExplorationCategoryService.init(explorationData.category); + ExplorationObjectiveService.init(explorationData.objective); + ExplorationLanguageCodeService.init( + explorationData.language_code); + ExplorationInitStateNameService.init( + explorationData.init_state_name); + ExplorationTagsService.init(explorationData.tags); + ExplorationParamSpecsService.init( + ParamSpecsObjectFactory.createFromBackendDict( + explorationData.param_specs)); + ExplorationParamChangesService.init( + ParamChangesObjectFactory.createFromBackendList( + explorationData.param_changes)); + ExplorationAutomaticTextToSpeechService.init( + explorationData.auto_tts_enabled); + ExplorationCorrectnessFeedbackService.init( + explorationData.correctness_feedback_enabled); + StateClassifierMappingService.init( + explorationData.state_classifier_mapping); + PlaythroughIssuesService.initSession( + explorationData.exploration_id, explorationData.version); + + ctrl.explorationTitleService = ExplorationTitleService; + ctrl.explorationCategoryService = ExplorationCategoryService; + ctrl.explorationObjectiveService = ExplorationObjectiveService; + ctrl.ExplorationRightsService = ExplorationRightsService; + ctrl.explorationInitStateNameService = ( + ExplorationInitStateNameService); + + ctrl.currentUserIsAdmin = explorationData.is_admin; + ctrl.currentUserIsModerator = explorationData.is_moderator; + + ctrl.currentUser = explorationData.user; + ctrl.currentVersion = explorationData.version; + + ExplorationRightsService.init( + explorationData.rights.owner_names, + explorationData.rights.editor_names, + explorationData.rights.voice_artist_names, + explorationData.rights.viewer_names, + explorationData.rights.status, + explorationData.rights.cloned_from, + explorationData.rights.community_owned, + explorationData.rights.viewable_if_private); + UserEmailPreferencesService.init( + explorationData.email_preferences.mute_feedback_notifications, + explorationData.email_preferences + .mute_suggestion_notifications); + + if (GLOBALS.can_edit) { + EditabilityService.markEditable(); + } - if (!RouterService.isLocationSetToNonStateEditorTab() && - !explorationData.states.hasOwnProperty( - RouterService.getCurrentStateFromLocationPath('gui'))) { - if (ThreadDataService.getOpenThreadsCount() > 0) { - RouterService.navigateToFeedbackTab(); - } else { - RouterService.navigateToMainTab(); + if (GLOBALS.can_voiceover || GLOBALS.can_edit) { + EditabilityService.markTranslatable(); } - } - ExplorationWarningsService.updateWarnings(); + StateEditorService.updateExplorationWhitelistedStatus( + featuresData.is_exploration_whitelisted); - // Initialize changeList by draft changes if they exist. - if (explorationData.draft_changes !== null) { - ChangeListService.loadAutosavedChangeList( - explorationData.draft_changes); - } + GraphDataService.recompute(); - if (explorationData.is_version_of_draft_valid === false && - explorationData.draft_changes !== null && - explorationData.draft_changes.length > 0) { - // Show modal displaying lost changes if the version of draft - // changes is invalid, and draft_changes is not `null`. - AutosaveInfoModalsService.showVersionMismatchModal( - ChangeListService.getChangeList()); - return; - } + if (!StateEditorService.getActiveStateName() || + !ExplorationStatesService.getState( + StateEditorService.getActiveStateName())) { + StateEditorService.setActiveStateName( + ExplorationInitStateNameService.displayed); + } - $scope.$broadcast('refreshStatisticsTab'); - $scope.$broadcast('refreshVersionHistory', { - forceRefresh: true - }); + if (!RouterService.isLocationSetToNonStateEditorTab() && + !explorationData.states.hasOwnProperty( + RouterService.getCurrentStateFromLocationPath('gui'))) { + if (ThreadDataService.getOpenThreadsCount() > 0) { + RouterService.navigateToFeedbackTab(); + } else { + RouterService.navigateToMainTab(); + } + } - if (ExplorationStatesService.getState( - StateEditorService.getActiveStateName())) { - $scope.$broadcast('refreshStateEditor'); - } + ExplorationWarningsService.updateWarnings(); - if (successCallback) { - successCallback(); - } + // Initialize changeList by draft changes if they exist. + if (explorationData.draft_changes !== null) { + ChangeListService.loadAutosavedChangeList( + explorationData.draft_changes); + } - StateTutorialFirstTimeService.initEditor( - explorationData.show_state_editor_tutorial_on_load, - ctrl.explorationId); + if (explorationData.is_version_of_draft_valid === false && + explorationData.draft_changes !== null && + explorationData.draft_changes.length > 0) { + // Show modal displaying lost changes if the version of draft + // changes is invalid, and draft_changes is not `null`. + AutosaveInfoModalsService.showVersionMismatchModal( + ChangeListService.getChangeList()); + return; + } - if (explorationData.show_state_translation_tutorial_on_load) { - StateTutorialFirstTimeService - .markTranslationTutorialNotSeenBefore(); - } + $scope.$broadcast('refreshStatisticsTab'); + $scope.$broadcast('refreshVersionHistory', { + forceRefresh: true + }); - if (ExplorationRightsService.isPublic()) { - // Stats are loaded asynchronously after the exploration data - // because they are not needed to interact with the editor. - StateTopAnswersStatsBackendApiService.fetchStats( - ctrl.explorationId - ).then(StateTopAnswersStatsService.init).then(function() { - ExplorationWarningsService.updateWarnings(); + if (ExplorationStatesService.getState( + StateEditorService.getActiveStateName())) { $scope.$broadcast('refreshStateEditor'); - }); - } + } + + if (successCallback) { + successCallback(); + } + + StateTutorialFirstTimeService.initEditor( + explorationData.show_state_editor_tutorial_on_load, + ctrl.explorationId); + + if (explorationData.show_state_translation_tutorial_on_load) { + StateTutorialFirstTimeService + .markTranslationTutorialNotSeenBefore(); + } + + if (ExplorationRightsService.isPublic()) { + // Stats are loaded asynchronously after the exploration data + // because they are not needed to interact with the editor. + StateTopAnswersStatsBackendApiService.fetchStats( + ctrl.explorationId + ).then(StateTopAnswersStatsService.init).then(function() { + ExplorationWarningsService.updateWarnings(); + $scope.$broadcast('refreshStateEditor'); + }); + } + }); + }; + + ctrl.initExplorationPage(); + + $scope.$on('initExplorationPage', function( + unusedEvtData, successCallback) { + ctrl.initExplorationPage(successCallback); }); - }; - - ctrl.initExplorationPage(); - - $scope.$on('initExplorationPage', function( - unusedEvtData, successCallback) { - ctrl.initExplorationPage(successCallback); - }); - - var _ID_TUTORIAL_STATE_CONTENT = '#tutorialStateContent'; - var _ID_TUTORIAL_STATE_INTERACTION = '#tutorialStateInteraction'; - var _ID_TUTORIAL_PREVIEW_TAB = '#tutorialPreviewTab'; - var _ID_TUTORIAL_SAVE_BUTTON = '#tutorialSaveButton'; - - var saveButtonTutorialElement = { - type: 'element', - selector: _ID_TUTORIAL_SAVE_BUTTON, - heading: 'Save', - text: ( - 'When you\'re done making changes, ' + - 'be sure to save your work.

'), - placement: 'bottom' - }; - - ctrl.EDITOR_TUTORIAL_OPTIONS = [{ - type: 'title', - heading: 'Creating in Oppia', - text: ( - 'Explorations are learning experiences that you create using ' + - 'Oppia. Think of explorations as a conversation between a ' + - 'student and a tutor.') - }, { - type: 'function', - fn: function(isGoingForward) { - $('html, body').animate({ - scrollTop: (isGoingForward ? 0 : 20) - }, 1000); - } - }, { - type: 'element', - selector: _ID_TUTORIAL_STATE_CONTENT, - heading: 'Content', - text: ( - '

An Oppia exploration is divided into several \'cards\'. ' + - 'The first part of a card is the content.

' + - '

Use the content section to set the scene. ' + - 'Tell the learner a story, give them some information, ' + - 'and then ask a relevant question.

'), - placement: 'bottom' - }, { - type: 'function', - fn: function(isGoingForward) { - var idToScrollTo = ( - isGoingForward ? _ID_TUTORIAL_STATE_INTERACTION : - _ID_TUTORIAL_STATE_CONTENT); - $('html, body').animate({ - scrollTop: angular.element(idToScrollTo).offset().top - 200 - }, 1000); - } - }, { - type: 'title', - selector: _ID_TUTORIAL_STATE_INTERACTION, - heading: 'Interaction', - text: ( - '

After you\'ve written the content of your conversation, ' + - 'choose an interaction type. ' + - 'An interaction is how you want your learner to respond ' + - 'to your question.

' + - '

Oppia has several built-in interactions, including:

' + - '
    ' + - '
  • ' + - ' Multiple Choice' + - '
  • ' + - '
  • ' + - ' Text/Number input' + - '
  • ' + - '
  • ' + - ' Code snippets' + - '
  • ' + - '
' + - 'and more.') - }, { - type: 'function', - fn: function(isGoingForward) { - var idToScrollTo = ( - isGoingForward ? _ID_TUTORIAL_PREVIEW_TAB : - _ID_TUTORIAL_STATE_INTERACTION); - $('html, body').animate({ - scrollTop: angular.element(idToScrollTo).offset().top - 200 - }, 1000); - } - }, { - type: 'title', - heading: 'Responses', - text: ( - 'After the learner uses the interaction you created, it\'s your ' + - 'turn again to choose how your exploration will respond to their ' + - 'input. You can send a learner to a new card or have them repeat ' + - 'the same card, depending on how they answer.') - }, { - type: 'function', - fn: function(isGoingForward) { - var idToScrollTo = ( - isGoingForward ? _ID_TUTORIAL_PREVIEW_TAB : - _ID_TUTORIAL_STATE_INTERACTION); - $('html, body').animate({ - scrollTop: angular.element(idToScrollTo).offset().top - 200 - }, 1000); + + var _ID_TUTORIAL_STATE_CONTENT = '#tutorialStateContent'; + var _ID_TUTORIAL_STATE_INTERACTION = '#tutorialStateInteraction'; + var _ID_TUTORIAL_PREVIEW_TAB = '#tutorialPreviewTab'; + var _ID_TUTORIAL_SAVE_BUTTON = '#tutorialSaveButton'; + + var saveButtonTutorialElement = { + type: 'element', + selector: _ID_TUTORIAL_SAVE_BUTTON, + heading: 'Save', + text: ( + 'When you\'re done making changes, ' + + 'be sure to save your work.

'), + placement: 'bottom' + }; + + ctrl.EDITOR_TUTORIAL_OPTIONS = [{ + type: 'title', + heading: 'Creating in Oppia', + text: ( + 'Explorations are learning experiences that you create using ' + + 'Oppia. Think of explorations as a conversation between a ' + + 'student and a tutor.') + }, { + type: 'function', + fn: function(isGoingForward) { + $('html, body').animate({ + scrollTop: (isGoingForward ? 0 : 20) + }, 1000); + } + }, { + type: 'element', + selector: _ID_TUTORIAL_STATE_CONTENT, + heading: 'Content', + text: ( + '

An Oppia exploration is divided into several \'cards\'. ' + + 'The first part of a card is the content.

' + + '

Use the content section to set the scene. ' + + 'Tell the learner a story, give them some information, ' + + 'and then ask a relevant question.

'), + placement: 'bottom' + }, { + type: 'function', + fn: function(isGoingForward) { + var idToScrollTo = ( + isGoingForward ? _ID_TUTORIAL_STATE_INTERACTION : + _ID_TUTORIAL_STATE_CONTENT); + $('html, body').animate({ + scrollTop: angular.element(idToScrollTo).offset().top - 200 + }, 1000); + } + }, { + type: 'title', + selector: _ID_TUTORIAL_STATE_INTERACTION, + heading: 'Interaction', + text: ( + '

After you\'ve written the content of your conversation, ' + + 'choose an interaction type. ' + + 'An interaction is how you want your learner to respond ' + + 'to your question.

' + + '

Oppia has several built-in interactions, including:

' + + '
    ' + + '
  • ' + + ' Multiple Choice' + + '
  • ' + + '
  • ' + + ' Text/Number input' + + '
  • ' + + '
  • ' + + ' Code snippets' + + '
  • ' + + '
' + + 'and more.') + }, { + type: 'function', + fn: function(isGoingForward) { + var idToScrollTo = ( + isGoingForward ? _ID_TUTORIAL_PREVIEW_TAB : + _ID_TUTORIAL_STATE_INTERACTION); + $('html, body').animate({ + scrollTop: angular.element(idToScrollTo).offset().top - 200 + }, 1000); + } + }, { + type: 'title', + heading: 'Responses', + text: ( + 'After the learner uses the interaction you created, it\'s ' + + 'your turn again to choose how your exploration will respond ' + + 'to their input. You can send a learner to a new card or have ' + + 'them repeat the same card, depending on how they answer.') + }, { + type: 'function', + fn: function(isGoingForward) { + var idToScrollTo = ( + isGoingForward ? _ID_TUTORIAL_PREVIEW_TAB : + _ID_TUTORIAL_STATE_INTERACTION); + $('html, body').animate({ + scrollTop: angular.element(idToScrollTo).offset().top - 200 + }, 1000); + } + }, { + type: 'element', + selector: _ID_TUTORIAL_PREVIEW_TAB, + heading: 'Preview', + text: ( + 'At any time, you can click the preview button to play ' + + 'through your exploration.'), + placement: 'bottom' + }, saveButtonTutorialElement, { + type: 'title', + heading: 'Tutorial Complete', + text: ( + '

Now for the fun part...

' + + 'That\'s the end of the tour! ' + + 'To finish up, here are some things we suggest: ' + + '
    ' + + '
  • ' + + ' Create your first card!' + + '
  • ' + + '
  • ' + + ' Preview your exploration.' + + '
  • ' + + '
  • ' + + ' Check out more resources in the ' + + ' ' + + ' Help Center.' + + ' ' + + '
  • ' + + '
') + }]; + + // Remove save from tutorial if user does not has edit rights for + // exploration since in that case Save Draft button will not be + // visible on the create page. + if (!GLOBALS.can_edit) { + var index = ctrl.EDITOR_TUTORIAL_OPTIONS.indexOf( + saveButtonTutorialElement); + ctrl.EDITOR_TUTORIAL_OPTIONS.splice(index, 1); } - }, { - type: 'element', - selector: _ID_TUTORIAL_PREVIEW_TAB, - heading: 'Preview', - text: ( - 'At any time, you can click the preview button to play ' + - 'through your exploration.'), - placement: 'bottom' - }, saveButtonTutorialElement, { - type: 'title', - heading: 'Tutorial Complete', - text: ( - '

Now for the fun part...

' + - 'That\'s the end of the tour! ' + - 'To finish up, here are some things we suggest: ' + - '
    ' + - '
  • ' + - ' Create your first card!' + - '
  • ' + - '
  • ' + - ' Preview your exploration.' + - '
  • ' + - '
  • ' + - ' Check out more resources in the ' + - ' ' + - ' Help Center.' + - ' ' + - '
  • ' + - '
') - }]; - - // Remove save from tutorial if user does not has edit rights for - // exploration since in that case Save Draft button will not be visible - // on the create page. - if (!GLOBALS.can_edit) { - var index = ctrl.EDITOR_TUTORIAL_OPTIONS.indexOf( - saveButtonTutorialElement); - ctrl.EDITOR_TUTORIAL_OPTIONS.splice(index, 1); - } - // Replace the ng-joyride template with one that uses <[...]> - // interpolators instead of/ {{...}} interpolators. - var ngJoyrideTemplate = $templateCache.get( - 'ng-joyride-title-tplv1.html'); - ngJoyrideTemplate = ngJoyrideTemplate.replace( - /\{\{/g, '<[').replace(/\}\}/g, ']>'); - $templateCache.put('ng-joyride-title-tplv1.html', ngJoyrideTemplate); - - var leaveTutorial = function() { - EditabilityService.onEndTutorial(); - $scope.$apply(); - StateTutorialFirstTimeService.markEditorTutorialFinished(); + // Replace the ng-joyride template with one that uses <[...]> + // interpolators instead of/ {{...}} interpolators. + var ngJoyrideTemplate = $templateCache.get( + 'ng-joyride-title-tplv1.html'); + ngJoyrideTemplate = ngJoyrideTemplate.replace( + /\{\{/g, '<[').replace(/\}\}/g, ']>'); + $templateCache.put('ng-joyride-title-tplv1.html', ngJoyrideTemplate); + + var leaveTutorial = function() { + EditabilityService.onEndTutorial(); + $scope.$apply(); + StateTutorialFirstTimeService.markEditorTutorialFinished(); + ctrl.tutorialInProgress = false; + }; + + ctrl.onSkipTutorial = function() { + SiteAnalyticsService.registerSkipTutorialEvent(ctrl.explorationId); + leaveTutorial(); + }; + + ctrl.onFinishTutorial = function() { + SiteAnalyticsService.registerFinishTutorialEvent( + ctrl.explorationId); + leaveTutorial(); + }; + ctrl.tutorialInProgress = false; - }; - - ctrl.onSkipTutorial = function() { - SiteAnalyticsService.registerSkipTutorialEvent(ctrl.explorationId); - leaveTutorial(); - }; - - ctrl.onFinishTutorial = function() { - SiteAnalyticsService.registerFinishTutorialEvent(ctrl.explorationId); - leaveTutorial(); - }; - - ctrl.tutorialInProgress = false; - ctrl.startTutorial = function() { - RouterService.navigateToMainTab(); - // The $timeout wrapper is needed for all components on the page to - // load, otherwise elements within ng-if's are not guaranteed to be - // present on the page. - $timeout(function() { - EditabilityService.onStartTutorial(); - ctrl.tutorialInProgress = true; - }); - }; - - ctrl.showWelcomeExplorationModal = function() { - var modalInstance = $uibModal.open({ - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/exploration-editor-page/modal-templates/' + - 'welcome-modal.template.html'), - backdrop: true, - controller: [ - '$scope', '$uibModalInstance', 'SiteAnalyticsService', - 'ContextService', - function($scope, $uibModalInstance, SiteAnalyticsService, - ContextService) { - var explorationId = ContextService.getExplorationId(); - - SiteAnalyticsService.registerTutorialModalOpenEvent( - explorationId); - - $scope.beginTutorial = function() { - SiteAnalyticsService.registerAcceptTutorialModalEvent( + ctrl.startTutorial = function() { + RouterService.navigateToMainTab(); + // The $timeout wrapper is needed for all components on the page to + // load, otherwise elements within ng-if's are not guaranteed to be + // present on the page. + $timeout(function() { + EditabilityService.onStartTutorial(); + ctrl.tutorialInProgress = true; + }); + }; + + ctrl.showWelcomeExplorationModal = function() { + var modalInstance = $uibModal.open({ + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/exploration-editor-page/modal-templates/' + + 'welcome-modal.template.html'), + backdrop: true, + controller: [ + '$scope', '$uibModalInstance', 'SiteAnalyticsService', + 'ContextService', + function($scope, $uibModalInstance, SiteAnalyticsService, + ContextService) { + var explorationId = ContextService.getExplorationId(); + + SiteAnalyticsService.registerTutorialModalOpenEvent( explorationId); - $uibModalInstance.close(); - }; - $scope.cancel = function() { - SiteAnalyticsService.registerDeclineTutorialModalEvent( - explorationId); - $uibModalInstance.dismiss('cancel'); - }; + $scope.beginTutorial = function() { + SiteAnalyticsService.registerAcceptTutorialModalEvent( + explorationId); + $uibModalInstance.close(); + }; + + $scope.cancel = function() { + SiteAnalyticsService.registerDeclineTutorialModalEvent( + explorationId); + $uibModalInstance.dismiss('cancel'); + }; + + $scope.editorWelcomeImgUrl = ( + UrlInterpolationService.getStaticImageUrl( + '/general/editor_welcome.svg')); + } + ], + windowClass: 'oppia-welcome-modal' + }); - $scope.editorWelcomeImgUrl = ( - UrlInterpolationService.getStaticImageUrl( - '/general/editor_welcome.svg')); - } - ], - windowClass: 'oppia-welcome-modal' - }); + modalInstance.result.then(function() { + ctrl.startTutorial(); + }, function() { + StateTutorialFirstTimeService.markEditorTutorialFinished(); + }); + }; - modalInstance.result.then(function() { - ctrl.startTutorial(); - }, function() { - StateTutorialFirstTimeService.markEditorTutorialFinished(); - }); - }; - - $scope.$on( - 'enterEditorForTheFirstTime', ctrl.showWelcomeExplorationModal); - $scope.$on('openEditorTutorial', ctrl.startTutorial); - } - ] - }; -}]); + $scope.$on( + 'enterEditorForTheFirstTime', ctrl.showWelcomeExplorationModal); + $scope.$on('openEditorTutorial', ctrl.startTutorial); + } + ] + }; + }]); diff --git a/core/templates/dev/head/pages/exploration-editor-page/exploration-editor-page.scripts.ts b/core/templates/dev/head/pages/exploration-editor-page/exploration-editor-page.scripts.ts index 5b0670aa3a94..2c77cbd50b27 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/exploration-editor-page.scripts.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/exploration-editor-page.scripts.ts @@ -17,6 +17,7 @@ * help tab in the navbar. */ +require('AppInit.ts'); require('App.ts'); require( diff --git a/core/templates/dev/head/pages/exploration-editor-page/exploration-objective-editor/exploration-objective-editor.directive.ts b/core/templates/dev/head/pages/exploration-editor-page/exploration-objective-editor/exploration-objective-editor.directive.ts index 4ddd29a52d8e..534ba2a6fd43 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/exploration-objective-editor/exploration-objective-editor.directive.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/exploration-objective-editor/exploration-objective-editor.directive.ts @@ -20,9 +20,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require( 'pages/exploration-editor-page/services/exploration-objective.service.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('explorationObjectiveEditor', [ +angular.module('oppia').directive('explorationObjectiveEditor', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/exploration-editor-page/exploration-save-and-publish-buttons/exploration-save-and-publish-buttons.directive.ts b/core/templates/dev/head/pages/exploration-editor-page/exploration-save-and-publish-buttons/exploration-save-and-publish-buttons.directive.ts index 8b0efa7b2721..7d1460f658ac 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/exploration-save-and-publish-buttons/exploration-save-and-publish-buttons.directive.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/exploration-save-and-publish-buttons/exploration-save-and-publish-buttons.directive.ts @@ -28,9 +28,7 @@ require( 'pages/exploration-editor-page/services/exploration-warnings.service.ts'); require('services/EditabilityService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('explorationSaveAndPublishButtons', [ +angular.module('oppia').directive('explorationSaveAndPublishButtons', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/exploration-editor-page/exploration-title-editor/exploration-title-editor.directive.ts b/core/templates/dev/head/pages/exploration-editor-page/exploration-title-editor/exploration-title-editor.directive.ts index b043cd962254..d2eaf2467ec5 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/exploration-title-editor/exploration-title-editor.directive.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/exploration-title-editor/exploration-title-editor.directive.ts @@ -18,9 +18,7 @@ require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('explorationTitleEditor', [ +angular.module('oppia').directive('explorationTitleEditor', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/exploration-editor-page/feedback-tab/feedback-tab.directive.ts b/core/templates/dev/head/pages/exploration-editor-page/feedback-tab/feedback-tab.directive.ts index 81648226e600..ad603fec6741 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/feedback-tab/feedback-tab.directive.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/feedback-tab/feedback-tab.directive.ts @@ -34,187 +34,192 @@ require('services/UserService.ts'); require('pages/exploration-editor-page/exploration-editor-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('feedbackTab', ['UrlInterpolationService', function( - UrlInterpolationService) { - return { - restrict: 'E', - scope: {}, - bindToController: {}, - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/exploration-editor-page/feedback-tab/' + - 'feedback-tab.directive.html'), - controllerAs: '$ctrl', - controller: [ - '$q', '$rootScope', '$uibModal', 'AlertsService', 'ChangeListService', - 'DateTimeFormatService', 'EditabilityService', 'ExplorationStatesService', - 'SuggestionModalForExplorationEditorService', 'ThreadDataService', - 'ThreadStatusDisplayService', 'UrlInterpolationService', 'UserService', - function( - $q, $rootScope, $uibModal, AlertsService, ChangeListService, - DateTimeFormatService, EditabilityService, ExplorationStatesService, - SuggestionModalForExplorationEditorService, ThreadDataService, - ThreadStatusDisplayService, UrlInterpolationService, UserService) { - var ctrl = this; - ctrl.STATUS_CHOICES = ThreadStatusDisplayService.STATUS_CHOICES; - ctrl.threadData = ThreadDataService.data; - ctrl.getLabelClass = ThreadStatusDisplayService.getLabelClass; - ctrl.getHumanReadableStatus = ( - ThreadStatusDisplayService.getHumanReadableStatus); - ctrl.getLocaleAbbreviatedDatetimeString = ( - DateTimeFormatService.getLocaleAbbreviatedDatetimeString); - - ctrl.activeThread = null; - ctrl.userIsLoggedIn = null; - ctrl.threadIsUpdated = false; - ctrl.isExplorationEditable = EditabilityService.isEditable; - $rootScope.loadingMessage = 'Loading'; - var userInfoPromise = UserService.getUserInfoAsync(); - userInfoPromise.then(function(userInfo) { - ctrl.userIsLoggedIn = userInfo.isLoggedIn(); - }); - - // Initial load of the thread list on page load. - ctrl.tmpMessage = { - status: null, - text: '' - }; - var _resetTmpMessageFields = function() { - ctrl.tmpMessage.status = ctrl.activeThread ? - ctrl.activeThread.status : null; - ctrl.tmpMessage.text = ''; - }; - ctrl.clearActiveThread = function() { - ctrl.activeThread = null; - _resetTmpMessageFields(); - }; - ctrl.clearActiveThread(); - ThreadDataService.fetchFeedbackStats(); - var threadPromise = ThreadDataService.fetchThreads(); - $q.all([userInfoPromise, threadPromise]).then(function() { - $rootScope.loadingMessage = ''; - }); - // Fetches the threads again if any thread is updated. - ctrl.fetchUpdatedThreads = function() { - ThreadDataService.fetchThreads(); +angular.module('oppia').directive('feedbackTab', [ + 'UrlInterpolationService', function( + UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: {}, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/exploration-editor-page/feedback-tab/' + + 'feedback-tab.directive.html'), + controllerAs: '$ctrl', + controller: [ + '$q', '$rootScope', '$uibModal', 'AlertsService', 'ChangeListService', + 'DateTimeFormatService', 'EditabilityService', + 'ExplorationStatesService', + 'SuggestionModalForExplorationEditorService', + 'ThreadDataService', 'ThreadStatusDisplayService', + 'UrlInterpolationService', 'UserService', + function( + $q, $rootScope, $uibModal, AlertsService, ChangeListService, + DateTimeFormatService, EditabilityService, + ExplorationStatesService, + SuggestionModalForExplorationEditorService, + ThreadDataService, ThreadStatusDisplayService, + UrlInterpolationService, UserService) { + var ctrl = this; + ctrl.STATUS_CHOICES = ThreadStatusDisplayService.STATUS_CHOICES; ctrl.threadData = ThreadDataService.data; + ctrl.getLabelClass = ThreadStatusDisplayService.getLabelClass; + ctrl.getHumanReadableStatus = ( + ThreadStatusDisplayService.getHumanReadableStatus); + ctrl.getLocaleAbbreviatedDatetimeString = ( + DateTimeFormatService.getLocaleAbbreviatedDatetimeString); + + ctrl.activeThread = null; + ctrl.userIsLoggedIn = null; ctrl.threadIsUpdated = false; - }; - ctrl.onBackButtonClicked = function() { + ctrl.isExplorationEditable = EditabilityService.isEditable; + $rootScope.loadingMessage = 'Loading'; + var userInfoPromise = UserService.getUserInfoAsync(); + userInfoPromise.then(function(userInfo) { + ctrl.userIsLoggedIn = userInfo.isLoggedIn(); + }); + + // Initial load of the thread list on page load. + ctrl.tmpMessage = { + status: null, + text: '' + }; + var _resetTmpMessageFields = function() { + ctrl.tmpMessage.status = ctrl.activeThread ? + ctrl.activeThread.status : null; + ctrl.tmpMessage.text = ''; + }; + ctrl.clearActiveThread = function() { + ctrl.activeThread = null; + _resetTmpMessageFields(); + }; ctrl.clearActiveThread(); - if (ctrl.threadIsUpdated) { - ctrl.fetchUpdatedThreads(); - } - }; - - ctrl.showCreateThreadModal = function() { - $uibModal.open({ - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/exploration-editor-page/feedback-tab/templates/' + - 'create-feedback-thread-modal.template.html'), - backdrop: true, - resolve: {}, - controller: ['$scope', '$uibModalInstance', function( - $scope, $uibModalInstance) { - $scope.newThreadSubject = ''; - $scope.newThreadText = ''; - - $scope.create = function(newThreadSubject, newThreadText) { - if (!newThreadSubject) { - AlertsService.addWarning('Please specify a thread subject.'); - return; - } - if (!newThreadText) { - AlertsService.addWarning('Please specify a message.'); - return; - } - - $uibModalInstance.close({ - newThreadSubject: newThreadSubject, - newThreadText: newThreadText - }); - }; - - $scope.cancel = function() { - $uibModalInstance.dismiss('cancel'); - }; - }] - }).result.then(function(result) { - ThreadDataService.createNewThread( - result.newThreadSubject, result.newThreadText, function() { - ctrl.clearActiveThread(); - AlertsService.addSuccessMessage('Feedback thread created.'); - }); + ThreadDataService.fetchFeedbackStats(); + var threadPromise = ThreadDataService.fetchThreads(); + $q.all([userInfoPromise, threadPromise]).then(function() { + $rootScope.loadingMessage = ''; }); - }; - - var _isSuggestionHandled = function() { - return ctrl.activeThread.isSuggestionHandled(); - }; - - var _isSuggestionValid = function() { - return ExplorationStatesService.hasState( - ctrl.activeThread.getSuggestionStateName()); - }; - - var _hasUnsavedChanges = function() { - return (ChangeListService.getChangeList().length > 0); - }; - - ctrl.getSuggestionButtonType = function() { - return (!_isSuggestionHandled() && _isSuggestionValid() && - !_hasUnsavedChanges() ? 'primary' : 'default'); - }; - - // TODO(Allan): Implement ability to edit suggestions before applying. - ctrl.showSuggestionModal = function() { - SuggestionModalForExplorationEditorService.showSuggestionModal( - ctrl.activeThread.suggestion.suggestionType, - { - activeThread: ctrl.activeThread, - setActiveThread: ctrl.setActiveThread, - isSuggestionHandled: _isSuggestionHandled, - hasUnsavedChanges: _hasUnsavedChanges, - isSuggestionValid: _isSuggestionValid + // Fetches the threads again if any thread is updated. + ctrl.fetchUpdatedThreads = function() { + ThreadDataService.fetchThreads(); + ctrl.threadData = ThreadDataService.data; + ctrl.threadIsUpdated = false; + }; + ctrl.onBackButtonClicked = function() { + ctrl.clearActiveThread(); + if (ctrl.threadIsUpdated) { + ctrl.fetchUpdatedThreads(); } - ); - }; - - ctrl.addNewMessage = function(threadId, tmpText, tmpStatus) { - if (threadId === null) { - AlertsService.addWarning( - 'Cannot add message to thread with ID: null.'); - return; - } - if (!tmpStatus) { - AlertsService.addWarning('Invalid message status: ' + tmpStatus); - return; - } - ctrl.threadIsUpdated = true; - ctrl.messageSendingInProgress = true; - ThreadDataService.addNewMessage( - threadId, tmpText, tmpStatus, function() { - _resetTmpMessageFields(); - ctrl.messageSendingInProgress = false; - }, function() { - ctrl.messageSendingInProgress = false; + }; + + ctrl.showCreateThreadModal = function() { + $uibModal.open({ + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/exploration-editor-page/feedback-tab/templates/' + + 'create-feedback-thread-modal.template.html'), + backdrop: true, + resolve: {}, + controller: ['$scope', '$uibModalInstance', function( + $scope, $uibModalInstance) { + $scope.newThreadSubject = ''; + $scope.newThreadText = ''; + + $scope.create = function(newThreadSubject, newThreadText) { + if (!newThreadSubject) { + AlertsService.addWarning( + 'Please specify a thread subject.'); + return; + } + if (!newThreadText) { + AlertsService.addWarning('Please specify a message.'); + return; + } + + $uibModalInstance.close({ + newThreadSubject: newThreadSubject, + newThreadText: newThreadText + }); + }; + + $scope.cancel = function() { + $uibModalInstance.dismiss('cancel'); + }; + }] + }).result.then(function(result) { + ThreadDataService.createNewThread( + result.newThreadSubject, result.newThreadText, function() { + ctrl.clearActiveThread(); + AlertsService.addSuccessMessage('Feedback thread created.'); + }); }); - }; - - ctrl.setActiveThread = function(threadId) { - ThreadDataService.fetchMessages(threadId); - ThreadDataService.markThreadAsSeen(threadId); - var allThreads = [].concat( - ctrl.threadData.feedbackThreads, ctrl.threadData.suggestionThreads); - for (var i = 0; i < allThreads.length; i++) { - if (allThreads[i].threadId === threadId) { - ctrl.activeThread = allThreads[i]; - break; + }; + + var _isSuggestionHandled = function() { + return ctrl.activeThread.isSuggestionHandled(); + }; + + var _isSuggestionValid = function() { + return ExplorationStatesService.hasState( + ctrl.activeThread.getSuggestionStateName()); + }; + + var _hasUnsavedChanges = function() { + return (ChangeListService.getChangeList().length > 0); + }; + + ctrl.getSuggestionButtonType = function() { + return (!_isSuggestionHandled() && _isSuggestionValid() && + !_hasUnsavedChanges() ? 'primary' : 'default'); + }; + + // TODO(Allan): Implement ability to edit suggestions before applying. + ctrl.showSuggestionModal = function() { + SuggestionModalForExplorationEditorService.showSuggestionModal( + ctrl.activeThread.suggestion.suggestionType, + { + activeThread: ctrl.activeThread, + setActiveThread: ctrl.setActiveThread, + isSuggestionHandled: _isSuggestionHandled, + hasUnsavedChanges: _hasUnsavedChanges, + isSuggestionValid: _isSuggestionValid + } + ); + }; + + ctrl.addNewMessage = function(threadId, tmpText, tmpStatus) { + if (threadId === null) { + AlertsService.addWarning( + 'Cannot add message to thread with ID: null.'); + return; + } + if (!tmpStatus) { + AlertsService.addWarning('Invalid message status: ' + tmpStatus); + return; + } + ctrl.threadIsUpdated = true; + ctrl.messageSendingInProgress = true; + ThreadDataService.addNewMessage( + threadId, tmpText, tmpStatus, function() { + _resetTmpMessageFields(); + ctrl.messageSendingInProgress = false; + }, function() { + ctrl.messageSendingInProgress = false; + }); + }; + + ctrl.setActiveThread = function(threadId) { + ThreadDataService.fetchMessages(threadId); + ThreadDataService.markThreadAsSeen(threadId); + var allThreads = [].concat( + ctrl.threadData.feedbackThreads, + ctrl.threadData.suggestionThreads); + for (var i = 0; i < allThreads.length; i++) { + if (allThreads[i].threadId === threadId) { + ctrl.activeThread = allThreads[i]; + break; + } } - } - ctrl.tmpMessage.status = ctrl.activeThread.status; - }; - } - ]}; -}]); + ctrl.tmpMessage.status = ctrl.activeThread.status; + }; + } + ]}; + }]); diff --git a/core/templates/dev/head/pages/exploration-editor-page/feedback-tab/services/thread-data.service.ts b/core/templates/dev/head/pages/exploration-editor-page/feedback-tab/services/thread-data.service.ts index a24fc50654d8..39177576580b 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/feedback-tab/services/thread-data.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/feedback-tab/services/thread-data.service.ts @@ -25,9 +25,7 @@ require('services/AlertsService.ts'); require('pages/exploration-editor-page/exploration-editor-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ThreadDataService', [ +angular.module('oppia').factory('ThreadDataService', [ '$http', '$log', '$q', 'AlertsService', 'ExplorationDataService', 'FeedbackThreadObjectFactory', 'SuggestionObjectFactory', 'SuggestionThreadObjectFactory', 'ACTION_ACCEPT_SUGGESTION', diff --git a/core/templates/dev/head/pages/exploration-editor-page/feedback-tab/services/thread-status-display.service.ts b/core/templates/dev/head/pages/exploration-editor-page/feedback-tab/services/thread-status-display.service.ts index a7fcdff8d455..921a63877ff7 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/feedback-tab/services/thread-status-display.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/feedback-tab/services/thread-status-display.service.ts @@ -66,8 +66,6 @@ export class ThreadStatusDisplayService { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'ThreadStatusDisplayService', downgradeInjectable(ThreadStatusDisplayService)); diff --git a/core/templates/dev/head/pages/exploration-editor-page/feedback-tab/thread-table/thread-table.directive.ts b/core/templates/dev/head/pages/exploration-editor-page/feedback-tab/thread-table/thread-table.directive.ts index 718203ce211f..073153a99f3e 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/feedback-tab/thread-table/thread-table.directive.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/feedback-tab/thread-table/thread-table.directive.ts @@ -25,9 +25,7 @@ require( 'thread-status-display.service.ts'); require('services/DateTimeFormatService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('threadTable', [ +angular.module('oppia').directive('threadTable', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/exploration-editor-page/history-tab/history-tab.directive.ts b/core/templates/dev/head/pages/exploration-editor-page/history-tab/history-tab.directive.ts index 3c5f03eaa610..010e4d836b60 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/history-tab/history-tab.directive.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/history-tab/history-tab.directive.ts @@ -31,288 +31,293 @@ require( require('services/DateTimeFormatService.ts'); require('services/EditabilityService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('historyTab', ['UrlInterpolationService', function( - UrlInterpolationService) { - return { - restrict: 'E', - scope: {}, - bindToController: {}, - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/exploration-editor-page/history-tab/history-tab.directive.html'), - controllerAs: '$ctrl', - controller: [ - '$http', '$log', '$rootScope', '$scope', - '$uibModal', '$window', 'CompareVersionsService', - 'DateTimeFormatService', 'EditabilityService', 'ExplorationDataService', - 'UrlInterpolationService', 'VersionTreeService', - function( - $http, $log, $rootScope, $scope, - $uibModal, $window, CompareVersionsService, - DateTimeFormatService, EditabilityService, ExplorationDataService, - UrlInterpolationService, VersionTreeService) { - var ctrl = this; - ctrl.EditabilityService = EditabilityService; - ctrl.explorationId = ExplorationDataService.explorationId; - ctrl.explorationAllSnapshotsUrl = - '/createhandler/snapshots/' + ctrl.explorationId; - ctrl.revertExplorationUrl = - '/createhandler/revert/' + ctrl.explorationId; - - /* Variable definitions: - * - * explorationSnapshots is a list of all snapshots for the exploration in - * ascending order. - * - * explorationVersionMetadata is an object whose keys are version numbers - * and whose values are objects containing data of that revision (that is - * to be displayed) with the keys 'committerId', 'createdOn', - * 'commitMessage', and 'versionNumber'. It contains a maximum of 30 - * versions. - * - * versionCheckboxArray is an array of the version numbers of the - * revisions to be displayed on the page, in the order they are displayed - * in. - * - * nodesData is an object whose keys are nodeIds (assigned in version - * comparison), and whose values are an object containing - * 'newestStateName', 'originalStateName' and 'stateProperty'. - */ - ctrl.explorationVersionMetadata = null; - ctrl.versionCheckboxArray = []; - var explorationSnapshots = null; - var versionTreeParents = null; - var nodesData = null; - var currentPage = 0; - ctrl.displayedCurrentPageNumber = currentPage + 1; - ctrl.versionNumbersToDisplay = []; - ctrl.VERSIONS_PER_PAGE = 30; - - $scope.$on('refreshVersionHistory', function(evt, data) { - // Uncheck all checkboxes when page is refreshed - angular.forEach(ctrl.versionCheckboxArray, function(versionCheckbox) { - versionCheckbox.selected = false; - }); - if (data.forceRefresh || ctrl.explorationVersionMetadata === null) { - ctrl.refreshVersionHistory(); - } - }); - - // Compares the two selected versions and displays the comparison - // results. - ctrl.compareSelectedVersions = function() { - if (ctrl.selectedVersionsArray.length === 2) { - ctrl.changeCompareVersion(); - ctrl.hideHistoryGraph = false; - ctrl.compareVersionsButtonIsHidden = true; - } - }; - // Changes the checkbox selection and provides an appropriate user - // prompt. - ctrl.changeSelectedVersions = function(evt, versionNumber) { - var checkbox = evt.target; - var selectedVersionsArrayPos = ctrl.selectedVersionsArray.indexOf( - versionNumber); - if (checkbox.checked && selectedVersionsArrayPos === -1) { - ctrl.selectedVersionsArray.push(versionNumber); - } - if (!checkbox.checked && selectedVersionsArrayPos !== -1) { - ctrl.selectedVersionsArray.splice(selectedVersionsArrayPos, 1); - } - - if (ctrl.selectedVersionsArray.length === 2) { - // Disable version count prompt if two checkboxes are selected. - ctrl.versionCountPrompt = ''; - } else if (!ctrl.comparisonsAreDisabled) { - ctrl.hideHistoryGraph = true; - ctrl.compareVersionsButtonIsHidden = false; - - if (ctrl.selectedVersionsArray.length === 0) { - ctrl.versionCountPrompt = 'Please select any two.'; - } else if (ctrl.selectedVersionsArray.length === 1) { - ctrl.versionCountPrompt = 'Please select one more.'; - } - } - }; - - // Refreshes the displayed version history log. - ctrl.refreshVersionHistory = function() { - $rootScope.loadingMessage = 'Loading'; - ExplorationDataService.getData().then(function(data) { - var currentVersion = data.version; - ctrl.currentVersion = currentVersion; - /** - * ctrl.compareVersionMetadata is an object with keys - * 'earlierVersion' and 'laterVersion' whose values are the metadata - * of the compared versions, containing 'committerId', 'createdOn', - * 'commitMessage', and 'versionNumber'. - */ - ctrl.compareVersions = {}; - ctrl.compareVersionMetadata = {}; - - // Contains the IDs of the versions selected for comparison. Should - // contain a maximum of two elements. - ctrl.selectedVersionsArray = []; - - ctrl.hideHistoryGraph = true; - - // Disable all comparisons if there are less than two revisions in - // total. - ctrl.comparisonsAreDisabled = (currentVersion < 2); - - ctrl.compareVersionsButtonIsHidden = ctrl.comparisonsAreDisabled; - - ctrl.versionCountPrompt = 'Please select any 2.'; - - $http.get(ctrl.explorationAllSnapshotsUrl).then(function(response) { - explorationSnapshots = response.data.snapshots; - VersionTreeService.init(explorationSnapshots); +angular.module('oppia').directive('historyTab', [ + 'UrlInterpolationService', function( + UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: {}, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/exploration-editor-page/history-tab/' + + 'history-tab.directive.html'), + controllerAs: '$ctrl', + controller: [ + '$http', '$log', '$rootScope', '$scope', + '$uibModal', '$window', 'CompareVersionsService', + 'DateTimeFormatService', 'EditabilityService', 'ExplorationDataService', + 'UrlInterpolationService', 'VersionTreeService', + function( + $http, $log, $rootScope, $scope, + $uibModal, $window, CompareVersionsService, + DateTimeFormatService, EditabilityService, ExplorationDataService, + UrlInterpolationService, VersionTreeService) { + var ctrl = this; + ctrl.EditabilityService = EditabilityService; + ctrl.explorationId = ExplorationDataService.explorationId; + ctrl.explorationAllSnapshotsUrl = + '/createhandler/snapshots/' + ctrl.explorationId; + ctrl.revertExplorationUrl = + '/createhandler/revert/' + ctrl.explorationId; + + /* Variable definitions: + * + * explorationSnapshots is a list of all snapshots for the exploration + * in ascending order. + * + * explorationVersionMetadata is an object whose keys are version + * numbers and whose values are objects containing data of that + * revision (that is to be displayed) with the keys 'committerId', + * 'createdOn', 'commitMessage', and 'versionNumber'. It contains a + * maximum of 30 versions. + * + * versionCheckboxArray is an array of the version numbers of the + * revisions to be displayed on the page, in the order they are + * displayed in. + * + * nodesData is an object whose keys are nodeIds (assigned in version + * comparison), and whose values are an object containing + * 'newestStateName', 'originalStateName' and 'stateProperty'. + */ + ctrl.explorationVersionMetadata = null; + ctrl.versionCheckboxArray = []; + var explorationSnapshots = null; + var versionTreeParents = null; + var nodesData = null; + var currentPage = 0; + ctrl.displayedCurrentPageNumber = currentPage + 1; + ctrl.versionNumbersToDisplay = []; + ctrl.VERSIONS_PER_PAGE = 30; - // Re-populate versionCheckboxArray and explorationVersionMetadata - // when history is refreshed. - ctrl.versionCheckboxArray = []; - ctrl.explorationVersionMetadata = {}; - var lowestVersionIndex = 0; - for (var i = currentVersion - 1; i >= lowestVersionIndex; i--) { - var versionNumber = explorationSnapshots[i].version_number; - ctrl.explorationVersionMetadata[versionNumber] = { - committerId: explorationSnapshots[i].committer_id, - createdOnStr: ( - DateTimeFormatService.getLocaleAbbreviatedDatetimeString( - explorationSnapshots[i].created_on_ms)), - commitMessage: explorationSnapshots[i].commit_message, - versionNumber: explorationSnapshots[i].version_number - }; - ctrl.versionCheckboxArray.push({ - vnum: explorationSnapshots[i].version_number, - selected: false - }); - } - $rootScope.loadingMessage = ''; - ctrl.computeVersionsToDisplay(); + $scope.$on('refreshVersionHistory', function(evt, data) { + // Uncheck all checkboxes when page is refreshed + angular.forEach(ctrl.versionCheckboxArray, function( + versionCheckbox) { + versionCheckbox.selected = false; }); + if (data.forceRefresh || ctrl.explorationVersionMetadata === null) { + ctrl.refreshVersionHistory(); + } }); - }; - - var getVersionHeader = function(versionMetadata) { - return ( - 'Revision #' + versionMetadata.versionNumber + - ' by ' + versionMetadata.committerId + - ' (' + versionMetadata.createdOnStr + - ')' + ( - versionMetadata.commitMessage ? - ': ' + versionMetadata.commitMessage : '')); - }; - // Function to set compared version metadata, download YAML and generate - // diff graph and legend when selection is changed - ctrl.changeCompareVersion = function() { - ctrl.diffData = null; - - var earlierComparedVersion = Math.min( - ctrl.selectedVersionsArray[0], ctrl.selectedVersionsArray[1]); - var laterComparedVersion = Math.max( - ctrl.selectedVersionsArray[0], ctrl.selectedVersionsArray[1]); - - ctrl.compareVersionMetadata.earlierVersion = - ctrl.explorationVersionMetadata[earlierComparedVersion]; - ctrl.compareVersionMetadata.laterVersion = - ctrl.explorationVersionMetadata[laterComparedVersion]; - - CompareVersionsService.getDiffGraphData(earlierComparedVersion, - laterComparedVersion).then( - function(response) { - $log.info('Retrieved version comparison data'); - $log.info(response); - - ctrl.diffData = response; - ctrl.earlierVersionHeader = getVersionHeader( - ctrl.compareVersionMetadata.earlierVersion); - ctrl.laterVersionHeader = getVersionHeader( - ctrl.compareVersionMetadata.laterVersion); + // Compares the two selected versions and displays the comparison + // results. + ctrl.compareSelectedVersions = function() { + if (ctrl.selectedVersionsArray.length === 2) { + ctrl.changeCompareVersion(); + ctrl.hideHistoryGraph = false; + ctrl.compareVersionsButtonIsHidden = true; + } + }; + // Changes the checkbox selection and provides an appropriate user + // prompt. + ctrl.changeSelectedVersions = function(evt, versionNumber) { + var checkbox = evt.target; + var selectedVersionsArrayPos = ctrl.selectedVersionsArray.indexOf( + versionNumber); + if (checkbox.checked && selectedVersionsArrayPos === -1) { + ctrl.selectedVersionsArray.push(versionNumber); + } + if (!checkbox.checked && selectedVersionsArrayPos !== -1) { + ctrl.selectedVersionsArray.splice(selectedVersionsArrayPos, 1); } - ); - }; - - // Check if valid versions were selected - ctrl.areCompareVersionsSelected = function() { - return ( - ctrl.compareVersions && ctrl.selectedVersionsArray.length === 2); - }; - - // Check if other checkboxes should be disabled once two are selected. - ctrl.isCheckboxDisabled = function(versionNumber) { - if (ctrl.selectedVersionsArray.length === 2) { - return (ctrl.selectedVersionsArray.indexOf(versionNumber) === -1); - } - return false; - }; - - // Downloads the zip file for an exploration. - ctrl.downloadExplorationWithVersion = function(versionNumber) { - // Note that this opens (and then immediately closes) a new tab. If we - // do this in the same tab, the beforeunload handler is triggered. - window.open( - ctrl.explorationDownloadUrl + '?v=' + versionNumber, - '&output_format=zip'); - }; - ctrl.showRevertExplorationModal = function(version) { - $uibModal.open({ - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/exploration-editor-page/history-tab/modal-templates/' + - 'revert-exploration-modal.template.html'), - backdrop: true, - resolve: { - version: function() { - return version; + if (ctrl.selectedVersionsArray.length === 2) { + // Disable version count prompt if two checkboxes are selected. + ctrl.versionCountPrompt = ''; + } else if (!ctrl.comparisonsAreDisabled) { + ctrl.hideHistoryGraph = true; + ctrl.compareVersionsButtonIsHidden = false; + + if (ctrl.selectedVersionsArray.length === 0) { + ctrl.versionCountPrompt = 'Please select any two.'; + } else if (ctrl.selectedVersionsArray.length === 1) { + ctrl.versionCountPrompt = 'Please select one more.'; } - }, - controller: [ - '$scope', '$uibModalInstance', 'version', - 'ExplorationDataService', - function( - $scope, $uibModalInstance, version, - ExplorationDataService) { - $scope.version = version; - - $scope.getExplorationUrl = function(version) { - return ( - '/explore/' + ExplorationDataService.explorationId + - '?v=' + version); - }; - - $scope.revert = function() { - $uibModalInstance.close(version); - }; - - $scope.cancel = function() { - $uibModalInstance.dismiss('cancel'); - }; + } + }; + + // Refreshes the displayed version history log. + ctrl.refreshVersionHistory = function() { + $rootScope.loadingMessage = 'Loading'; + ExplorationDataService.getData().then(function(data) { + var currentVersion = data.version; + ctrl.currentVersion = currentVersion; + /** + * ctrl.compareVersionMetadata is an object with keys + * 'earlierVersion' and 'laterVersion' whose values are the + * metadata of the compared versions, containing 'committerId', + * 'createdOn', 'commitMessage', and 'versionNumber'. + */ + ctrl.compareVersions = {}; + ctrl.compareVersionMetadata = {}; + + // Contains the IDs of the versions selected for comparison. + // Should contain a maximum of two elements. + ctrl.selectedVersionsArray = []; + + ctrl.hideHistoryGraph = true; + + // Disable all comparisons if there are less than two revisions in + // total. + ctrl.comparisonsAreDisabled = (currentVersion < 2); + + ctrl.compareVersionsButtonIsHidden = ctrl.comparisonsAreDisabled; + + ctrl.versionCountPrompt = 'Please select any 2.'; + + $http.get(ctrl.explorationAllSnapshotsUrl).then( + function(response) { + explorationSnapshots = response.data.snapshots; + VersionTreeService.init(explorationSnapshots); + + // Re-populate versionCheckboxArray and + // explorationVersionMetadata when history is refreshed. + ctrl.versionCheckboxArray = []; + ctrl.explorationVersionMetadata = {}; + var lowestVersionIndex = 0; + for ( + var i = currentVersion - 1; i >= lowestVersionIndex; i--) { + var versionNumber = explorationSnapshots[i].version_number; + ctrl.explorationVersionMetadata[versionNumber] = { + committerId: explorationSnapshots[i].committer_id, + createdOnStr: ( + DateTimeFormatService + .getLocaleAbbreviatedDatetimeString( + explorationSnapshots[i].created_on_ms)), + commitMessage: explorationSnapshots[i].commit_message, + versionNumber: explorationSnapshots[i].version_number + }; + ctrl.versionCheckboxArray.push({ + vnum: explorationSnapshots[i].version_number, + selected: false + }); + } + $rootScope.loadingMessage = ''; + ctrl.computeVersionsToDisplay(); + }); + }); + }; + + var getVersionHeader = function(versionMetadata) { + return ( + 'Revision #' + versionMetadata.versionNumber + + ' by ' + versionMetadata.committerId + + ' (' + versionMetadata.createdOnStr + + ')' + ( + versionMetadata.commitMessage ? + ': ' + versionMetadata.commitMessage : '')); + }; + + // Function to set compared version metadata, download YAML and + // generate diff graph and legend when selection is changed + ctrl.changeCompareVersion = function() { + ctrl.diffData = null; + + var earlierComparedVersion = Math.min( + ctrl.selectedVersionsArray[0], ctrl.selectedVersionsArray[1]); + var laterComparedVersion = Math.max( + ctrl.selectedVersionsArray[0], ctrl.selectedVersionsArray[1]); + + ctrl.compareVersionMetadata.earlierVersion = + ctrl.explorationVersionMetadata[earlierComparedVersion]; + ctrl.compareVersionMetadata.laterVersion = + ctrl.explorationVersionMetadata[laterComparedVersion]; + + CompareVersionsService.getDiffGraphData(earlierComparedVersion, + laterComparedVersion).then( + function(response) { + $log.info('Retrieved version comparison data'); + $log.info(response); + + ctrl.diffData = response; + ctrl.earlierVersionHeader = getVersionHeader( + ctrl.compareVersionMetadata.earlierVersion); + ctrl.laterVersionHeader = getVersionHeader( + ctrl.compareVersionMetadata.laterVersion); } - ] - }).result.then(function(version) { - $http.post(ctrl.revertExplorationUrl, { - current_version: ExplorationDataService.data.version, - revert_to_version: version - }).then(function() { - $window.location.reload(); + ); + }; + + // Check if valid versions were selected + ctrl.areCompareVersionsSelected = function() { + return ( + ctrl.compareVersions && ctrl.selectedVersionsArray.length === 2); + }; + + // Check if other checkboxes should be disabled once two are selected. + ctrl.isCheckboxDisabled = function(versionNumber) { + if (ctrl.selectedVersionsArray.length === 2) { + return (ctrl.selectedVersionsArray.indexOf(versionNumber) === -1); + } + return false; + }; + + // Downloads the zip file for an exploration. + ctrl.downloadExplorationWithVersion = function(versionNumber) { + // Note that this opens (and then immediately closes) a new tab. If + // we do this in the same tab, the beforeunload handler is + // triggered. + window.open( + ctrl.explorationDownloadUrl + '?v=' + versionNumber, + '&output_format=zip'); + }; + + ctrl.showRevertExplorationModal = function(version) { + $uibModal.open({ + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/exploration-editor-page/history-tab/modal-templates/' + + 'revert-exploration-modal.template.html'), + backdrop: true, + resolve: { + version: function() { + return version; + } + }, + controller: [ + '$scope', '$uibModalInstance', 'version', + 'ExplorationDataService', + function( + $scope, $uibModalInstance, version, + ExplorationDataService) { + $scope.version = version; + + $scope.getExplorationUrl = function(version) { + return ( + '/explore/' + ExplorationDataService.explorationId + + '?v=' + version); + }; + + $scope.revert = function() { + $uibModalInstance.close(version); + }; + + $scope.cancel = function() { + $uibModalInstance.dismiss('cancel'); + }; + } + ] + }).result.then(function(version) { + $http.post(ctrl.revertExplorationUrl, { + current_version: ExplorationDataService.data.version, + revert_to_version: version + }).then(function() { + $window.location.reload(); + }); }); - }); - }; - - ctrl.computeVersionsToDisplay = function() { - currentPage = ctrl.displayedCurrentPageNumber - 1; - var begin = (currentPage * ctrl.VERSIONS_PER_PAGE); - var end = Math.min( - begin + ctrl.VERSIONS_PER_PAGE, ctrl.versionCheckboxArray.length); - ctrl.versionNumbersToDisplay = []; - for (var i = begin; i < end; i++) { - ctrl.versionNumbersToDisplay.push( - ctrl.versionCheckboxArray[i].vnum); - } - }; - } - ]}; -}]); + }; + + ctrl.computeVersionsToDisplay = function() { + currentPage = ctrl.displayedCurrentPageNumber - 1; + var begin = (currentPage * ctrl.VERSIONS_PER_PAGE); + var end = Math.min( + begin + ctrl.VERSIONS_PER_PAGE, ctrl.versionCheckboxArray.length); + ctrl.versionNumbersToDisplay = []; + for (var i = begin; i < end; i++) { + ctrl.versionNumbersToDisplay.push( + ctrl.versionCheckboxArray[i].vnum); + } + }; + } + ]}; + }]); diff --git a/core/templates/dev/head/pages/exploration-editor-page/history-tab/services/compare-versions.service.ts b/core/templates/dev/head/pages/exploration-editor-page/history-tab/services/compare-versions.service.ts index cbb1d489ca3c..e0e62307bb50 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/history-tab/services/compare-versions.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/history-tab/services/compare-versions.service.ts @@ -24,15 +24,13 @@ require('pages/exploration-editor-page/services/exploration-diff.service.ts'); require( 'pages/exploration-editor-page/history-tab/services/version-tree.service.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('CompareVersionsService', [ - '$http', '$q', 'ExplorationDataService', 'ExplorationDiffService', - 'ReadOnlyExplorationBackendApiService', 'StateObjectFactory', +angular.module('oppia').factory('CompareVersionsService', [ + '$q', 'ExplorationDataService', 'ExplorationDiffService', + 'ReadOnlyExplorationBackendApiService', 'StatesObjectFactory', 'VersionTreeService', function( - $http, $q, ExplorationDataService, ExplorationDiffService, - ReadOnlyExplorationBackendApiService, StateObjectFactory, + $q, ExplorationDataService, ExplorationDiffService, + ReadOnlyExplorationBackendApiService, StatesObjectFactory, VersionTreeService) { /** * Constructs the combined list of changes needed to get from v1 to v2. diff --git a/core/templates/dev/head/pages/exploration-editor-page/history-tab/services/version-tree.service.ts b/core/templates/dev/head/pages/exploration-editor-page/history-tab/services/version-tree.service.ts index fed31263a5ec..63fb6d4e9d35 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/history-tab/services/version-tree.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/history-tab/services/version-tree.service.ts @@ -140,6 +140,5 @@ export class VersionTreeService { } } -var oppia = require('AppInit.ts').module; - -oppia.factory('VersionTreeService', downgradeInjectable(VersionTreeService)); +angular.module('oppia').factory( + 'VersionTreeService', downgradeInjectable(VersionTreeService)); diff --git a/core/templates/dev/head/pages/exploration-editor-page/improvements-tab/feedback-improvement-card/feedback-improvement-card.directive.ts b/core/templates/dev/head/pages/exploration-editor-page/improvements-tab/feedback-improvement-card/feedback-improvement-card.directive.ts index 032609729602..c6eda1ccd414 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/improvements-tab/feedback-improvement-card/feedback-improvement-card.directive.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/improvements-tab/feedback-improvement-card/feedback-improvement-card.directive.ts @@ -18,9 +18,7 @@ require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('feedbackImprovementCard', [ +angular.module('oppia').directive('feedbackImprovementCard', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/exploration-editor-page/improvements-tab/improvements-tab.directive.ts b/core/templates/dev/head/pages/exploration-editor-page/improvements-tab/improvements-tab.directive.ts index 2087f46e5a3d..6584e811c3ee 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/improvements-tab/improvements-tab.directive.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/improvements-tab/improvements-tab.directive.ts @@ -33,9 +33,7 @@ require( require('domain/utilities/UrlInterpolationService.ts'); require('services/ImprovementCardService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('improvementsTab', [ +angular.module('oppia').directive('improvementsTab', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/exploration-editor-page/improvements-tab/playthrough-improvement-card/playthrough-improvement-card.directive.ts b/core/templates/dev/head/pages/exploration-editor-page/improvements-tab/playthrough-improvement-card/playthrough-improvement-card.directive.ts index 0dc6c16fae2c..e0c65ada1e0e 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/improvements-tab/playthrough-improvement-card/playthrough-improvement-card.directive.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/improvements-tab/playthrough-improvement-card/playthrough-improvement-card.directive.ts @@ -19,9 +19,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/PlaythroughIssuesService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('playthroughImprovementCard', [ +angular.module('oppia').directive('playthroughImprovementCard', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/exploration-editor-page/improvements-tab/services/improvement-modal.service.ts b/core/templates/dev/head/pages/exploration-editor-page/improvements-tab/services/improvement-modal.service.ts index 55bc8f3f8c25..e27aa41bccf0 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/improvements-tab/services/improvement-modal.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/improvements-tab/services/improvement-modal.service.ts @@ -26,9 +26,7 @@ require( 'suggestion-modal-for-exploration-editor.service.ts'); require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ImprovementModalService', [ +angular.module('oppia').factory('ImprovementModalService', [ '$uibModal', 'AlertsService', 'ChangeListService', 'DateTimeFormatService', 'EditabilityService', 'ExplorationStatesService', 'SuggestionModalForExplorationEditorService', 'ThreadDataService', diff --git a/core/templates/dev/head/pages/exploration-editor-page/improvements-tab/suggestion-improvement-card/suggestion-improvement-card.directive.ts b/core/templates/dev/head/pages/exploration-editor-page/improvements-tab/suggestion-improvement-card/suggestion-improvement-card.directive.ts index e101edae3c84..2912293be60d 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/improvements-tab/suggestion-improvement-card/suggestion-improvement-card.directive.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/improvements-tab/suggestion-improvement-card/suggestion-improvement-card.directive.ts @@ -18,9 +18,7 @@ require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('suggestionImprovementCard', [ +angular.module('oppia').directive('suggestionImprovementCard', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/exploration-editor-page/param-changes-editor/param-changes-editor.directive.ts b/core/templates/dev/head/pages/exploration-editor-page/param-changes-editor/param-changes-editor.directive.ts index 5aa3255e8174..2b5c342a2a87 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/param-changes-editor/param-changes-editor.directive.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/param-changes-editor/param-changes-editor.directive.ts @@ -34,9 +34,7 @@ require( require('services/AlertsService.ts'); require('services/EditabilityService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('paramChangesEditor', [ +angular.module('oppia').directive('paramChangesEditor', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/exploration-editor-page/param-changes-editor/value-generator-editor.directive.ts b/core/templates/dev/head/pages/exploration-editor-page/param-changes-editor/value-generator-editor.directive.ts index 4eb8f6e98681..1ecacaf69383 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/param-changes-editor/value-generator-editor.directive.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/param-changes-editor/value-generator-editor.directive.ts @@ -19,39 +19,38 @@ // Individual value generator directives can be found in // extensions/value_generators/templates. -var oppia = require('AppInit.ts').module; - -oppia.directive('valueGeneratorEditor', ['$compile', function($compile) { - return { - restrict: 'E', - scope: { - customizationArgs: '=', - generatorId: '=', - initArgs: '=', - objType: '=' - }, - link: function(scope: ICustomScope, element) { - scope.$watch('generatorId', function() { - var directiveName = scope.generatorId.replace( - /([a-z])([A-Z])/g, '$1-$2').toLowerCase(); - scope.getGeneratorId = function() { - return scope.generatorId; - }; - scope.getInitArgs = function() { - return scope.initArgs; - }; - scope.getObjType = function() { - return scope.objType; - }; - element.html( - '<' + directiveName + - ' customization-args="customizationArgs"' + - ' get-generator-id="getGeneratorId()"' + - ' get-init-args="getInitArgs()"' + - ' get-obj-type="getObjType()"' + - '>'); - $compile(element.contents())(scope); - }); - } - }; -}]); +angular.module('oppia').directive('valueGeneratorEditor', [ + '$compile', function($compile) { + return { + restrict: 'E', + scope: { + customizationArgs: '=', + generatorId: '=', + initArgs: '=', + objType: '=' + }, + link: function(scope: ICustomScope, element) { + scope.$watch('generatorId', function() { + var directiveName = scope.generatorId.replace( + /([a-z])([A-Z])/g, '$1-$2').toLowerCase(); + scope.getGeneratorId = function() { + return scope.generatorId; + }; + scope.getInitArgs = function() { + return scope.initArgs; + }; + scope.getObjType = function() { + return scope.objType; + }; + element.html( + '<' + directiveName + + ' customization-args="customizationArgs"' + + ' get-generator-id="getGeneratorId()"' + + ' get-init-args="getInitArgs()"' + + ' get-obj-type="getObjType()"' + + '>'); + $compile(element.contents())(scope); + }); + } + }; + }]); diff --git a/core/templates/dev/head/pages/exploration-editor-page/preview-tab/preview-tab.directive.ts b/core/templates/dev/head/pages/exploration-editor-page/preview-tab/preview-tab.directive.ts index d3df38a982f6..c8b68a3d902d 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/preview-tab/preview-tab.directive.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/preview-tab/preview-tab.directive.ts @@ -46,161 +46,158 @@ require( require('services/ContextService.ts'); require('services/ExplorationFeaturesService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('previewTab', ['UrlInterpolationService', function( - UrlInterpolationService) { - return { - restrict: 'E', - scope: {}, - bindToController: {}, - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/exploration-editor-page/preview-tab/preview-tab.directive.html'), - controllerAs: '$ctrl', - controller: [ - '$q', '$scope', '$timeout', '$uibModal', 'ContextService', - 'EditableExplorationBackendApiService', 'ExplorationCategoryService', - 'ExplorationDataService', 'ExplorationEngineService', - 'ExplorationFeaturesService', 'ExplorationInitStateNameService', - 'ExplorationParamChangesService', 'ExplorationParamSpecsService', - 'ExplorationStatesService', 'ExplorationTitleService', - 'LearnerParamsService', 'NumberAttemptsService', - 'ParamChangeObjectFactory', 'ParameterMetadataService', - 'PlayerCorrectnessFeedbackEnabledService', 'StateEditorService', - 'UrlInterpolationService', - function( - $q, $scope, $timeout, $uibModal, ContextService, - EditableExplorationBackendApiService, ExplorationCategoryService, - ExplorationDataService, ExplorationEngineService, - ExplorationFeaturesService, ExplorationInitStateNameService, - ExplorationParamChangesService, ExplorationParamSpecsService, - ExplorationStatesService, ExplorationTitleService, - LearnerParamsService, NumberAttemptsService, - ParamChangeObjectFactory, ParameterMetadataService, - PlayerCorrectnessFeedbackEnabledService, StateEditorService, - UrlInterpolationService) { - var ctrl = this; - ctrl.isExplorationPopulated = false; - ExplorationDataService.getData().then(function() { - var initStateNameForPreview = StateEditorService.getActiveStateName(); - var manualParamChanges = []; - - // Show a warning message if preview doesn't start from the first - // state. - if (initStateNameForPreview !== - ExplorationInitStateNameService.savedMemento) { - ctrl.previewWarning = - 'Preview started from \"' + initStateNameForPreview + '\"'; - } else { - ctrl.previewWarning = ''; - } - - // Prompt user to enter any unset parameters, then populate - // exploration. - manualParamChanges = ctrl.getManualParamChanges( - initStateNameForPreview) - .then(function(manualParamChanges) { - ctrl.loadPreviewState( - initStateNameForPreview, manualParamChanges); - }); - }); - - ctrl.getManualParamChanges = function(initStateNameForPreview) { - var deferred = $q.defer(); - - var unsetParametersInfo = ParameterMetadataService - .getUnsetParametersInfo([initStateNameForPreview]); - - // Construct array to hold required parameter changes - var manualParamChanges = []; - for (var i = 0; i < unsetParametersInfo.length; i++) { - var newParamChange = ParamChangeObjectFactory.createEmpty( - unsetParametersInfo[i].paramName); - manualParamChanges.push(newParamChange); - } - - // Use modal to populate parameter change values - if (manualParamChanges.length > 0) { - ctrl.showSetParamsModal(manualParamChanges, function() { - deferred.resolve(manualParamChanges); - }); - } else { - deferred.resolve([]); - } - - return deferred.promise; - }; - - ctrl.showParameterSummary = function() { - return (ExplorationFeaturesService.areParametersEnabled() && - !angular.equals({}, ctrl.allParams)); - }; - - ctrl.showSetParamsModal = function(manualParamChanges, callback) { - var modalInstance = $uibModal.open({ - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/exploration-editor-page/preview-tab/templates/' + - 'preview-set-parameters-modal.template.html'), - backdrop: 'static', - windowClass: 'oppia-preview-set-params-modal', - controller: [ - '$scope', '$uibModalInstance', 'RouterService', - function($scope, $uibModalInstance, RouterService) { - $scope.manualParamChanges = manualParamChanges; - $scope.previewParamModalOk = $uibModalInstance.close; - $scope.previewParamModalCancel = function() { - $uibModalInstance.dismiss('cancel'); - RouterService.navigateToMainTab(); - }; - } - ] - }).result.then(function() { - if (callback) { - callback(); +angular.module('oppia').directive('previewTab', [ + 'UrlInterpolationService', function( + UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: {}, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/exploration-editor-page/preview-tab/' + + 'preview-tab.directive.html'), + controllerAs: '$ctrl', + controller: [ + '$q', '$scope', '$timeout', '$uibModal', 'ContextService', + 'EditableExplorationBackendApiService', + 'ExplorationDataService', 'ExplorationEngineService', + 'ExplorationFeaturesService', 'ExplorationInitStateNameService', + 'LearnerParamsService', 'NumberAttemptsService', + 'ParamChangeObjectFactory', 'ParameterMetadataService', + 'PlayerCorrectnessFeedbackEnabledService', 'StateEditorService', + 'UrlInterpolationService', + function( + $q, $scope, $timeout, $uibModal, ContextService, + EditableExplorationBackendApiService, + ExplorationDataService, ExplorationEngineService, + ExplorationFeaturesService, ExplorationInitStateNameService, + LearnerParamsService, NumberAttemptsService, + ParamChangeObjectFactory, ParameterMetadataService, + PlayerCorrectnessFeedbackEnabledService, StateEditorService, + UrlInterpolationService) { + var ctrl = this; + ctrl.isExplorationPopulated = false; + ExplorationDataService.getData().then(function() { + var initStateNameForPreview = StateEditorService + .getActiveStateName(); + var manualParamChanges = []; + + // Show a warning message if preview doesn't start from the first + // state. + if (initStateNameForPreview !== + ExplorationInitStateNameService.savedMemento) { + ctrl.previewWarning = + 'Preview started from \"' + initStateNameForPreview + '\"'; + } else { + ctrl.previewWarning = ''; } + + // Prompt user to enter any unset parameters, then populate + // exploration. + manualParamChanges = ctrl.getManualParamChanges( + initStateNameForPreview) + .then(function(manualParamChanges) { + ctrl.loadPreviewState( + initStateNameForPreview, manualParamChanges); + }); }); - }; - ctrl.loadPreviewState = function(stateName, manualParamChanges) { - ExplorationEngineService.initSettingsFromEditor( - stateName, manualParamChanges); - ctrl.isExplorationPopulated = true; - }; + ctrl.getManualParamChanges = function(initStateNameForPreview) { + var deferred = $q.defer(); - ctrl.resetPreview = function() { - ctrl.previewWarning = ''; - ctrl.isExplorationPopulated = false; - var initStateNameForPreview = ( - ExplorationInitStateNameService.savedMemento); - $timeout(function() { - var explorationId = ContextService.getExplorationId(); - EditableExplorationBackendApiService.fetchApplyDraftExploration( - explorationId).then(function(returnDict) { - ExplorationEngineService.init( - returnDict, null, null, null, - function( - unusedInitialStateName, unusedInitHtml, unusedNewParams) { - ctrl.loadPreviewState(initStateNameForPreview, []); - }); - PlayerCorrectnessFeedbackEnabledService.init( - returnDict.correctness_feedback_enabled); - NumberAttemptsService.reset(); + var unsetParametersInfo = ParameterMetadataService + .getUnsetParametersInfo([initStateNameForPreview]); + + // Construct array to hold required parameter changes + var manualParamChanges = []; + for (var i = 0; i < unsetParametersInfo.length; i++) { + var newParamChange = ParamChangeObjectFactory.createEmpty( + unsetParametersInfo[i].paramName); + manualParamChanges.push(newParamChange); + } + + // Use modal to populate parameter change values + if (manualParamChanges.length > 0) { + ctrl.showSetParamsModal(manualParamChanges, function() { + deferred.resolve(manualParamChanges); + }); + } else { + deferred.resolve([]); + } + + return deferred.promise; + }; + + ctrl.showParameterSummary = function() { + return (ExplorationFeaturesService.areParametersEnabled() && + !angular.equals({}, ctrl.allParams)); + }; + + ctrl.showSetParamsModal = function(manualParamChanges, callback) { + var modalInstance = $uibModal.open({ + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/exploration-editor-page/preview-tab/templates/' + + 'preview-set-parameters-modal.template.html'), + backdrop: 'static', + windowClass: 'oppia-preview-set-params-modal', + controller: [ + '$scope', '$uibModalInstance', 'RouterService', + function($scope, $uibModalInstance, RouterService) { + $scope.manualParamChanges = manualParamChanges; + $scope.previewParamModalOk = $uibModalInstance.close; + $scope.previewParamModalCancel = function() { + $uibModalInstance.dismiss('cancel'); + RouterService.navigateToMainTab(); + }; + } + ] + }).result.then(function() { + if (callback) { + callback(); + } }); - }, 200); - }; - - // This allows the active state to be kept up-to-date whilst navigating - // in preview mode, ensuring that the state does not change when - // toggling between editor and preview. - $scope.$on('updateActiveStateIfInEditor', function(evt, stateName) { - StateEditorService.setActiveStateName(stateName); - }); - - ctrl.allParams = {}; - $scope.$on('playerStateChange', function() { - ctrl.allParams = LearnerParamsService.getAllParams(); - }); - } - ] - }; -}]); + }; + + ctrl.loadPreviewState = function(stateName, manualParamChanges) { + ExplorationEngineService.initSettingsFromEditor( + stateName, manualParamChanges); + ctrl.isExplorationPopulated = true; + }; + + ctrl.resetPreview = function() { + ctrl.previewWarning = ''; + ctrl.isExplorationPopulated = false; + var initStateNameForPreview = ( + ExplorationInitStateNameService.savedMemento); + $timeout(function() { + var explorationId = ContextService.getExplorationId(); + EditableExplorationBackendApiService.fetchApplyDraftExploration( + explorationId).then(function(returnDict) { + ExplorationEngineService.init( + returnDict, null, null, null, + function( + unusedInitialStateName, unusedInitHtml, unusedNewParams) { + ctrl.loadPreviewState(initStateNameForPreview, []); + }); + PlayerCorrectnessFeedbackEnabledService.init( + returnDict.correctness_feedback_enabled); + NumberAttemptsService.reset(); + }); + }, 200); + }; + + // This allows the active state to be kept up-to-date whilst + // navigating in preview mode, ensuring that the state does not change + // when toggling between editor and preview. + $scope.$on('updateActiveStateIfInEditor', function(evt, stateName) { + StateEditorService.setActiveStateName(stateName); + }); + + ctrl.allParams = {}; + $scope.$on('playerStateChange', function() { + ctrl.allParams = LearnerParamsService.getAllParams(); + }); + } + ] + }; + }]); diff --git a/core/templates/dev/head/pages/exploration-editor-page/services/angular-name.service.ts b/core/templates/dev/head/pages/exploration-editor-page/services/angular-name.service.ts index 26f87094fcc1..e42ca4ca3ad5 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/services/angular-name.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/services/angular-name.service.ts @@ -32,6 +32,5 @@ export class AngularNameService { } } -var oppia = require('AppInit.ts').module; - -oppia.factory('AngularNameService', downgradeInjectable(AngularNameService)); +angular.module('oppia').factory( + 'AngularNameService', downgradeInjectable(AngularNameService)); diff --git a/core/templates/dev/head/pages/exploration-editor-page/services/autosave-info-modals.service.ts b/core/templates/dev/head/pages/exploration-editor-page/services/autosave-info-modals.service.ts index e047408c1251..c4f999421ab3 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/services/autosave-info-modals.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/services/autosave-info-modals.service.ts @@ -24,9 +24,7 @@ require( require('pages/exploration-editor-page/services/exploration-data.service.ts'); require('services/LocalStorageService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('AutosaveInfoModalsService', [ +angular.module('oppia').factory('AutosaveInfoModalsService', [ '$log', '$timeout', '$uibModal', '$window', 'ChangesInHumanReadableFormService', 'ExplorationDataService', 'LocalStorageService', 'UrlInterpolationService', diff --git a/core/templates/dev/head/pages/exploration-editor-page/services/change-list.service.ts b/core/templates/dev/head/pages/exploration-editor-page/services/change-list.service.ts index a58d2e5b3434..5852e5b66152 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/services/change-list.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/services/change-list.service.ts @@ -22,9 +22,7 @@ require( require('pages/exploration-editor-page/services/exploration-data.service.ts'); require('services/AlertsService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ChangeListService', [ +angular.module('oppia').factory('ChangeListService', [ '$log', '$rootScope', 'AlertsService', 'AutosaveInfoModalsService', 'ExplorationDataService', function( diff --git a/core/templates/dev/head/pages/exploration-editor-page/services/changes-in-human-readable-form.service.ts b/core/templates/dev/head/pages/exploration-editor-page/services/changes-in-human-readable-form.service.ts index 1be8ba30dc4d..79c7d29d243a 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/services/changes-in-human-readable-form.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/services/changes-in-human-readable-form.service.ts @@ -18,9 +18,7 @@ require('services/UtilsService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ChangesInHumanReadableFormService', [ +angular.module('oppia').factory('ChangesInHumanReadableFormService', [ 'UtilsService', function(UtilsService) { var CMD_ADD_STATE = 'add_state'; var CMD_RENAME_STATE = 'rename_state'; diff --git a/core/templates/dev/head/pages/exploration-editor-page/services/editor-first-time-events.service.ts b/core/templates/dev/head/pages/exploration-editor-page/services/editor-first-time-events.service.ts index c96ab713ddc0..6ff9a8accb21 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/services/editor-first-time-events.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/services/editor-first-time-events.service.ts @@ -20,9 +20,7 @@ require('services/SiteAnalyticsService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('EditorFirstTimeEventsService', [ +angular.module('oppia').factory('EditorFirstTimeEventsService', [ 'SiteAnalyticsService', function(SiteAnalyticsService) { var explorationId = null; diff --git a/core/templates/dev/head/pages/exploration-editor-page/services/exploration-automatic-text-to-speech.service.ts b/core/templates/dev/head/pages/exploration-editor-page/services/exploration-automatic-text-to-speech.service.ts index c1f99d3d865c..7e6c001e9821 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/services/exploration-automatic-text-to-speech.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/services/exploration-automatic-text-to-speech.service.ts @@ -20,9 +20,7 @@ require( 'pages/exploration-editor-page/services/exploration-property.service.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ExplorationAutomaticTextToSpeechService', [ +angular.module('oppia').factory('ExplorationAutomaticTextToSpeechService', [ 'ExplorationPropertyService', function(ExplorationPropertyService) { var child = Object.create(ExplorationPropertyService); child.propertyName = 'auto_tts_enabled'; diff --git a/core/templates/dev/head/pages/exploration-editor-page/services/exploration-category.service.ts b/core/templates/dev/head/pages/exploration-editor-page/services/exploration-category.service.ts index a667dafe5059..f109f959328d 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/services/exploration-category.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/services/exploration-category.service.ts @@ -23,9 +23,7 @@ require( require('pages/exploration-editor-page/services/exploration-rights.service.ts'); require('services/ValidatorsService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ExplorationCategoryService', [ +angular.module('oppia').factory('ExplorationCategoryService', [ '$filter', 'ExplorationPropertyService', 'ExplorationRightsService', 'ValidatorsService', function( diff --git a/core/templates/dev/head/pages/exploration-editor-page/services/exploration-correctness-feedback.service.ts b/core/templates/dev/head/pages/exploration-editor-page/services/exploration-correctness-feedback.service.ts index 7570397cf1e1..183764fb544d 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/services/exploration-correctness-feedback.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/services/exploration-correctness-feedback.service.ts @@ -20,9 +20,7 @@ require( 'pages/exploration-editor-page/services/exploration-property.service.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ExplorationCorrectnessFeedbackService', [ +angular.module('oppia').factory('ExplorationCorrectnessFeedbackService', [ 'ExplorationPropertyService', function(ExplorationPropertyService) { var child = Object.create(ExplorationPropertyService); child.propertyName = 'correctness_feedback_enabled'; diff --git a/core/templates/dev/head/pages/exploration-editor-page/services/exploration-data.service.ts b/core/templates/dev/head/pages/exploration-editor-page/services/exploration-data.service.ts index e9e662ed55a1..8bd9c3e12af6 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/services/exploration-data.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/services/exploration-data.service.ts @@ -23,9 +23,7 @@ require('services/AlertsService.ts'); require('services/LocalStorageService.ts'); require('services/contextual/UrlService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ExplorationDataService', [ +angular.module('oppia').factory('ExplorationDataService', [ '$http', '$log', '$q', '$window', 'AlertsService', 'EditableExplorationBackendApiService', 'LocalStorageService', 'ReadOnlyExplorationBackendApiService', 'UrlService', diff --git a/core/templates/dev/head/pages/exploration-editor-page/services/exploration-diff.service.ts b/core/templates/dev/head/pages/exploration-editor-page/services/exploration-diff.service.ts index 3b5827361738..5cce5aadcef2 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/services/exploration-diff.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/services/exploration-diff.service.ts @@ -18,9 +18,7 @@ require('pages/exploration-editor-page/exploration-editor-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ExplorationDiffService', [ +angular.module('oppia').factory('ExplorationDiffService', [ 'INTERACTION_SPECS', function(INTERACTION_SPECS) { var STATE_PROPERTY_ADDED = 'added'; var STATE_PROPERTY_DELETED = 'deleted'; diff --git a/core/templates/dev/head/pages/exploration-editor-page/services/exploration-init-state-name.service.ts b/core/templates/dev/head/pages/exploration-editor-page/services/exploration-init-state-name.service.ts index 06a2740831f3..4f43ed9b3d76 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/services/exploration-init-state-name.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/services/exploration-init-state-name.service.ts @@ -22,9 +22,7 @@ require( 'pages/exploration-editor-page/services/exploration-property.service.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ExplorationInitStateNameService', [ +angular.module('oppia').factory('ExplorationInitStateNameService', [ 'ExplorationPropertyService', function(ExplorationPropertyService) { var child = Object.create(ExplorationPropertyService); child.propertyName = 'init_state_name'; diff --git a/core/templates/dev/head/pages/exploration-editor-page/services/exploration-language-code.service.ts b/core/templates/dev/head/pages/exploration-editor-page/services/exploration-language-code.service.ts index 3dae8bb90179..f9ade555a4f3 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/services/exploration-language-code.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/services/exploration-language-code.service.ts @@ -19,9 +19,7 @@ require( 'pages/exploration-editor-page/services/exploration-property.service.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ExplorationLanguageCodeService', [ +angular.module('oppia').factory('ExplorationLanguageCodeService', [ 'ExplorationPropertyService', function(ExplorationPropertyService) { var child = Object.create(ExplorationPropertyService); child.propertyName = 'language_code'; diff --git a/core/templates/dev/head/pages/exploration-editor-page/services/exploration-objective.service.ts b/core/templates/dev/head/pages/exploration-editor-page/services/exploration-objective.service.ts index 23b473d06682..0628eb678d35 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/services/exploration-objective.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/services/exploration-objective.service.ts @@ -23,9 +23,7 @@ require( require('pages/exploration-editor-page/services/exploration-rights.service.ts'); require('services/ValidatorsService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ExplorationObjectiveService', [ +angular.module('oppia').factory('ExplorationObjectiveService', [ '$filter', 'ExplorationPropertyService', 'ExplorationRightsService', 'ValidatorsService', function( diff --git a/core/templates/dev/head/pages/exploration-editor-page/services/exploration-param-changes.service.ts b/core/templates/dev/head/pages/exploration-editor-page/services/exploration-param-changes.service.ts index 381ec2c2fce5..e2cb6c943086 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/services/exploration-param-changes.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/services/exploration-param-changes.service.ts @@ -20,9 +20,7 @@ require( 'pages/exploration-editor-page/services/exploration-property.service.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ExplorationParamChangesService', [ +angular.module('oppia').factory('ExplorationParamChangesService', [ 'ExplorationPropertyService', function(ExplorationPropertyService) { var child = Object.create(ExplorationPropertyService); child.propertyName = 'param_changes'; diff --git a/core/templates/dev/head/pages/exploration-editor-page/services/exploration-param-specs.service.ts b/core/templates/dev/head/pages/exploration-editor-page/services/exploration-param-specs.service.ts index d45365aad8cf..d8d37d8eb911 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/services/exploration-param-specs.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/services/exploration-param-specs.service.ts @@ -20,9 +20,7 @@ require( 'pages/exploration-editor-page/services/exploration-property.service.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ExplorationParamSpecsService', [ +angular.module('oppia').factory('ExplorationParamSpecsService', [ 'ExplorationPropertyService', function(ExplorationPropertyService) { var child = Object.create(ExplorationPropertyService); child.propertyName = 'param_specs'; diff --git a/core/templates/dev/head/pages/exploration-editor-page/services/exploration-property.service.ts b/core/templates/dev/head/pages/exploration-editor-page/services/exploration-property.service.ts index 5917270f033d..8026c891bec1 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/services/exploration-property.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/services/exploration-property.service.ts @@ -21,9 +21,7 @@ require('pages/exploration-editor-page/services/change-list.service.ts'); require('services/AlertsService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ExplorationPropertyService', [ +angular.module('oppia').factory('ExplorationPropertyService', [ '$log', '$rootScope', 'AlertsService', 'ChangeListService', function($log, $rootScope, AlertsService, ChangeListService) { // Public base API for data services corresponding to exploration properties diff --git a/core/templates/dev/head/pages/exploration-editor-page/services/exploration-rights.service.ts b/core/templates/dev/head/pages/exploration-editor-page/services/exploration-rights.service.ts index b7c958e54df2..a3cbea4683b8 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/services/exploration-rights.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/services/exploration-rights.service.ts @@ -20,9 +20,7 @@ require('pages/exploration-editor-page/services/exploration-data.service.ts'); require('services/AlertsService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ExplorationRightsService', [ +angular.module('oppia').factory('ExplorationRightsService', [ '$http', 'AlertsService', 'ExplorationDataService', 'ACTIVITY_STATUS_PRIVATE', 'ACTIVITY_STATUS_PUBLIC', function($http, AlertsService, ExplorationDataService, diff --git a/core/templates/dev/head/pages/exploration-editor-page/services/exploration-save.service.ts b/core/templates/dev/head/pages/exploration-editor-page/services/exploration-save.service.ts index bbd45bbd29bf..4f2f61f91b0e 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/services/exploration-save.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/services/exploration-save.service.ts @@ -51,9 +51,7 @@ require('services/ContextService.ts'); require('services/SiteAnalyticsService.ts'); require('services/stateful/FocusManagerService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ExplorationSaveService', [ +angular.module('oppia').factory('ExplorationSaveService', [ '$log', '$q', '$rootScope', '$timeout', '$uibModal', '$window', 'AlertsService', 'AutosaveInfoModalsService', 'ChangeListService', 'ExplorationCategoryService', 'ExplorationDataService', diff --git a/core/templates/dev/head/pages/exploration-editor-page/services/exploration-states.service.ts b/core/templates/dev/head/pages/exploration-editor-page/services/exploration-states.service.ts index f1091a9a5166..41312ea248a0 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/services/exploration-states.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/services/exploration-states.service.ts @@ -38,16 +38,14 @@ require('services/AlertsService.ts'); require('services/ContextService.ts'); require('services/ValidatorsService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ExplorationStatesService', [ - '$filter', '$injector', '$location', '$log', '$q', '$rootScope', '$uibModal', +angular.module('oppia').factory('ExplorationStatesService', [ + '$filter', '$injector', '$location', '$q', '$rootScope', '$uibModal', 'AlertsService', 'AngularNameService', 'AnswerClassificationService', 'ChangeListService', 'ContextService', 'ExplorationInitStateNameService', 'SolutionValidityService', 'StateEditorService', 'StatesObjectFactory', 'UrlInterpolationService', 'ValidatorsService', function( - $filter, $injector, $location, $log, $q, $rootScope, $uibModal, + $filter, $injector, $location, $q, $rootScope, $uibModal, AlertsService, AngularNameService, AnswerClassificationService, ChangeListService, ContextService, ExplorationInitStateNameService, SolutionValidityService, StateEditorService, StatesObjectFactory, diff --git a/core/templates/dev/head/pages/exploration-editor-page/services/exploration-tags.service.ts b/core/templates/dev/head/pages/exploration-editor-page/services/exploration-tags.service.ts index 5744da75dae0..805daa68348a 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/services/exploration-tags.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/services/exploration-tags.service.ts @@ -19,9 +19,7 @@ require( 'pages/exploration-editor-page/services/exploration-property.service.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ExplorationTagsService', [ +angular.module('oppia').factory('ExplorationTagsService', [ 'ExplorationPropertyService', function(ExplorationPropertyService) { var child = Object.create(ExplorationPropertyService); diff --git a/core/templates/dev/head/pages/exploration-editor-page/services/exploration-title.service.ts b/core/templates/dev/head/pages/exploration-editor-page/services/exploration-title.service.ts index e22daf066d96..e06f0fed05e9 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/services/exploration-title.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/services/exploration-title.service.ts @@ -23,9 +23,7 @@ require( require('pages/exploration-editor-page/services/exploration-rights.service.ts'); require('services/ValidatorsService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ExplorationTitleService', [ +angular.module('oppia').factory('ExplorationTitleService', [ '$filter', 'ExplorationPropertyService', 'ExplorationRightsService', 'ValidatorsService', function( diff --git a/core/templates/dev/head/pages/exploration-editor-page/services/exploration-warnings.service.ts b/core/templates/dev/head/pages/exploration-editor-page/services/exploration-warnings.service.ts index 54ba36348107..a65fac22d355 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/services/exploration-warnings.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/services/exploration-warnings.service.ts @@ -31,19 +31,17 @@ require('services/StateTopAnswersStatsService.ts'); require('pages/exploration-editor-page/exploration-editor-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ExplorationWarningsService', [ - '$injector', 'ExplorationParamChangesService', 'ExplorationStatesService', - 'ExpressionInterpolationService', 'GraphDataService', 'ImprovementsService', +angular.module('oppia').factory('ExplorationWarningsService', [ + '$injector', 'ExplorationStatesService', + 'GraphDataService', 'ImprovementsService', 'ParameterMetadataService', 'SolutionValidityService', - 'StateTopAnswersStatsService', 'INTERACTION_SPECS', 'STATE_ERROR_MESSAGES', + 'StateTopAnswersStatsService', 'STATE_ERROR_MESSAGES', 'UNRESOLVED_ANSWER_FREQUENCY_THRESHOLD', 'WARNING_TYPES', function( - $injector, ExplorationParamChangesService, ExplorationStatesService, - ExpressionInterpolationService, GraphDataService, ImprovementsService, + $injector, ExplorationStatesService, + GraphDataService, ImprovementsService, ParameterMetadataService, SolutionValidityService, - StateTopAnswersStatsService, INTERACTION_SPECS, STATE_ERROR_MESSAGES, + StateTopAnswersStatsService, STATE_ERROR_MESSAGES, UNRESOLVED_ANSWER_FREQUENCY_THRESHOLD, WARNING_TYPES) { var _warningsList = []; var stateWarnings = {}; diff --git a/core/templates/dev/head/pages/exploration-editor-page/services/graph-data.service.ts b/core/templates/dev/head/pages/exploration-editor-page/services/graph-data.service.ts index a6593ab30448..7675b2c66cb0 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/services/graph-data.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/services/graph-data.service.ts @@ -22,9 +22,7 @@ require( require('pages/exploration-editor-page/services/exploration-states.service.ts'); require('services/ComputeGraphService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('GraphDataService', [ +angular.module('oppia').factory('GraphDataService', [ 'ComputeGraphService', 'ExplorationInitStateNameService', 'ExplorationStatesService', function( diff --git a/core/templates/dev/head/pages/exploration-editor-page/services/parameter-metadata.service.ts b/core/templates/dev/head/pages/exploration-editor-page/services/parameter-metadata.service.ts index 6cad1cd7f492..c874f32aefb8 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/services/parameter-metadata.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/services/parameter-metadata.service.ts @@ -26,9 +26,7 @@ require('pages/exploration-editor-page/services/graph-data.service.ts'); require('pages/exploration-editor-page/exploration-editor-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ParameterMetadataService', [ +angular.module('oppia').factory('ParameterMetadataService', [ 'ExplorationParamChangesService', 'ExplorationStatesService', 'ExpressionInterpolationService', 'GraphDataService', 'ParamMetadataObjectFactory', 'PARAM_ACTION_GET', 'PARAM_ACTION_SET', diff --git a/core/templates/dev/head/pages/exploration-editor-page/services/router.service.ts b/core/templates/dev/head/pages/exploration-editor-page/services/router.service.ts index 965d4905a6ca..4cbbbb7da574 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/services/router.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/services/router.service.ts @@ -25,9 +25,7 @@ require( 'state-editor.service.ts'); require('services/ExplorationFeaturesService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('RouterService', [ +angular.module('oppia').factory('RouterService', [ '$interval', '$location', '$rootScope', '$timeout', '$window', 'ExplorationFeaturesService', 'ExplorationInitStateNameService', 'ExplorationStatesService', 'StateEditorService', diff --git a/core/templates/dev/head/pages/exploration-editor-page/services/state-tutorial-first-time.service.ts b/core/templates/dev/head/pages/exploration-editor-page/services/state-tutorial-first-time.service.ts index d506d5b97f7b..d03620f4399e 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/services/state-tutorial-first-time.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/services/state-tutorial-first-time.service.ts @@ -19,9 +19,7 @@ require( 'pages/exploration-editor-page/services/editor-first-time-events.service.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('StateTutorialFirstTimeService', [ +angular.module('oppia').factory('StateTutorialFirstTimeService', [ '$http', '$rootScope', 'EditorFirstTimeEventsService', function($http, $rootScope, EditorFirstTimeEventsService) { // Whether this is the first time the tutorial has been seen by this user. diff --git a/core/templates/dev/head/pages/exploration-editor-page/services/user-email-preferences.service.ts b/core/templates/dev/head/pages/exploration-editor-page/services/user-email-preferences.service.ts index a560a0b77a6f..2ce4483b1ce9 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/services/user-email-preferences.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/services/user-email-preferences.service.ts @@ -20,13 +20,11 @@ require('domain/utilities/UrlInterpolationService.ts'); require('pages/exploration-editor-page/services/exploration-data.service.ts'); require('services/AlertsService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('UserEmailPreferencesService', [ - '$http', '$q', 'AlertsService', 'ExplorationDataService', +angular.module('oppia').factory('UserEmailPreferencesService', [ + '$http', 'AlertsService', 'ExplorationDataService', 'UrlInterpolationService', function( - $http, $q, AlertsService, + $http, AlertsService, ExplorationDataService, UrlInterpolationService) { var MESSAGE_TYPE_SUGGESTION = 'suggestion'; var MESSAGE_TYPE_FEEDBACK = 'feedback'; diff --git a/core/templates/dev/head/pages/exploration-editor-page/settings-tab/settings-tab.directive.ts b/core/templates/dev/head/pages/exploration-editor-page/settings-tab/settings-tab.directive.ts index f5acebe084b3..e2ae37397a3b 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/settings-tab/settings-tab.directive.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/settings-tab/settings-tab.directive.ts @@ -68,409 +68,415 @@ require('services/ExplorationFeaturesService.ts'); require('pages/exploration-editor-page/exploration-editor-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('settingsTab', ['UrlInterpolationService', function( - UrlInterpolationService) { - return { - restrict: 'E', - scope: {}, - bindToController: { - currentUserIsAdmin: '=', - currentUserIsModerator: '=' - }, - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/exploration-editor-page/settings-tab/' + - 'settings-tab.directive.html'), - controllerAs: '$ctrl', - controller: [ - '$http', '$rootScope', '$scope', '$uibModal', '$window', 'AlertsService', - 'ChangeListService', 'EditableExplorationBackendApiService', - 'EditabilityService', 'ExplorationAutomaticTextToSpeechService', - 'ExplorationCategoryService', 'ExplorationCorrectnessFeedbackService', - 'ExplorationDataService', 'ExplorationFeaturesService', - 'ExplorationInitStateNameService', 'ExplorationLanguageCodeService', - 'ExplorationObjectiveService', 'ExplorationParamChangesService', - 'ExplorationParamSpecsService', 'ExplorationRightsService', - 'ExplorationStatesService', 'ExplorationTagsService', - 'ExplorationTitleService', 'ExplorationWarningsService', - 'UrlInterpolationService', 'UserEmailPreferencesService', - 'ALL_CATEGORIES', 'EXPLORATION_TITLE_INPUT_FOCUS_LABEL', - function( - $http, $rootScope, $scope, $uibModal, $window, AlertsService, - ChangeListService, EditableExplorationBackendApiService, - EditabilityService, ExplorationAutomaticTextToSpeechService, - ExplorationCategoryService, ExplorationCorrectnessFeedbackService, - ExplorationDataService, ExplorationFeaturesService, - ExplorationInitStateNameService, ExplorationLanguageCodeService, - ExplorationObjectiveService, ExplorationParamChangesService, - ExplorationParamSpecsService, ExplorationRightsService, - ExplorationStatesService, ExplorationTagsService, - ExplorationTitleService, ExplorationWarningsService, - UrlInterpolationService, UserEmailPreferencesService, - ALL_CATEGORIES, EXPLORATION_TITLE_INPUT_FOCUS_LABEL) { - var ctrl = this; - ctrl.EXPLORATION_TITLE_INPUT_FOCUS_LABEL = ( - EXPLORATION_TITLE_INPUT_FOCUS_LABEL); - ctrl.EditabilityService = EditabilityService; - ctrl.CATEGORY_LIST_FOR_SELECT2 = []; - for (var i = 0; i < ALL_CATEGORIES.length; i++) { - ctrl.CATEGORY_LIST_FOR_SELECT2.push({ - id: ALL_CATEGORIES[i], - text: ALL_CATEGORIES[i] - }); - } - - ctrl.isRolesFormOpen = false; - - ctrl.TAG_REGEX = constants.TAG_REGEX; - ctrl.canDelete = GLOBALS.canDelete; - ctrl.canModifyRoles = GLOBALS.canModifyRoles; - ctrl.canReleaseOwnership = GLOBALS.canReleaseOwnership; - ctrl.canUnpublish = GLOBALS.canUnpublish; - ctrl.explorationId = ExplorationDataService.explorationId; - - var CREATOR_DASHBOARD_PAGE_URL = '/creator_dashboard'; - var EXPLORE_PAGE_PREFIX = '/explore/'; - - ctrl.getExplorePageUrl = function() { - return ( - window.location.protocol + '//' + window.location.host + - EXPLORE_PAGE_PREFIX + ctrl.explorationId); - }; - - ctrl.initSettingsTab = function() { - ctrl.explorationTitleService = ExplorationTitleService; - ctrl.explorationCategoryService = ExplorationCategoryService; - ctrl.explorationObjectiveService = ExplorationObjectiveService; - ctrl.explorationLanguageCodeService = ExplorationLanguageCodeService; - ctrl.explorationTagsService = ExplorationTagsService; - ctrl.ExplorationRightsService = ExplorationRightsService; - ctrl.explorationInitStateNameService = ( - ExplorationInitStateNameService); - ctrl.explorationParamSpecsService = ExplorationParamSpecsService; - ctrl.explorationParamChangesService = ExplorationParamChangesService; - ctrl.UserEmailPreferencesService = UserEmailPreferencesService; - - ExplorationDataService.getData().then(function() { - ctrl.refreshSettingsTab(); - ctrl.hasPageLoaded = true; - }); - }; - - ctrl.refreshSettingsTab = function() { - // Ensure that ExplorationStatesService has been initialized before - // getting the state names from it. (Otherwise, navigating to the - // settings tab directly (by entering a URL that ends with /settings) - // results in a console error. - if (ExplorationStatesService.isInitialized()) { - var categoryIsInSelect2 = ctrl.CATEGORY_LIST_FOR_SELECT2.some( - function(categoryItem) { - return ( - categoryItem.id === ExplorationCategoryService.savedMemento); - } - ); - - // If the current category is not in the dropdown, add it - // as the first option. - if (!categoryIsInSelect2 && - ExplorationCategoryService.savedMemento) { - ctrl.CATEGORY_LIST_FOR_SELECT2.unshift({ - id: ExplorationCategoryService.savedMemento, - text: ExplorationCategoryService.savedMemento - }); - } - - ctrl.stateNames = ExplorationStatesService.getStateNames(); - } - }; - - $scope.$on('refreshSettingsTab', ctrl.refreshSettingsTab); - - ctrl.initSettingsTab(); - - ctrl.ROLES = [{ - name: 'Manager (can edit permissions)', - value: 'owner' - }, { - name: 'Collaborator (can make changes)', - value: 'editor' - }, { - name: 'Voice Artist (can do voiceover)', - value: 'voice artist' - }, { - name: 'Playtester (can give feedback)', - value: 'viewer' - }]; - - ctrl.formStyle = { - display: 'table-cell', - width: '16.66666667%', - 'vertical-align': 'top' - }; - - ctrl.saveExplorationTitle = function() { - ExplorationTitleService.saveDisplayedValue(); - }; - - ctrl.saveExplorationCategory = function() { - ExplorationCategoryService.saveDisplayedValue(); - }; - - ctrl.saveExplorationObjective = function() { - ExplorationObjectiveService.saveDisplayedValue(); - }; - - ctrl.saveExplorationLanguageCode = function() { - ExplorationLanguageCodeService.saveDisplayedValue(); - }; - - ctrl.saveExplorationTags = function() { - ExplorationTagsService.saveDisplayedValue(); - }; - - ctrl.saveExplorationInitStateName = function() { - var newInitStateName = ExplorationInitStateNameService.displayed; - - if (!ExplorationStatesService.getState(newInitStateName)) { - AlertsService.addWarning( - 'Invalid initial state name: ' + newInitStateName); - ExplorationInitStateNameService.restoreFromMemento(); - return; +angular.module('oppia').directive('settingsTab', [ + 'UrlInterpolationService', function(UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: { + currentUserIsAdmin: '=', + currentUserIsModerator: '=' + }, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/exploration-editor-page/settings-tab/' + + 'settings-tab.directive.html'), + controllerAs: '$ctrl', + controller: [ + '$http', '$rootScope', '$scope', '$uibModal', '$window', + 'AlertsService', + 'ChangeListService', 'EditableExplorationBackendApiService', + 'EditabilityService', 'ExplorationAutomaticTextToSpeechService', + 'ExplorationCategoryService', 'ExplorationCorrectnessFeedbackService', + 'ExplorationDataService', 'ExplorationFeaturesService', + 'ExplorationInitStateNameService', 'ExplorationLanguageCodeService', + 'ExplorationObjectiveService', 'ExplorationParamChangesService', + 'ExplorationParamSpecsService', 'ExplorationRightsService', + 'ExplorationStatesService', 'ExplorationTagsService', + 'ExplorationTitleService', 'ExplorationWarningsService', + 'UrlInterpolationService', 'UserEmailPreferencesService', + 'ALL_CATEGORIES', 'EXPLORATION_TITLE_INPUT_FOCUS_LABEL', + function( + $http, $rootScope, $scope, $uibModal, $window, + AlertsService, + ChangeListService, EditableExplorationBackendApiService, + EditabilityService, ExplorationAutomaticTextToSpeechService, + ExplorationCategoryService, ExplorationCorrectnessFeedbackService, + ExplorationDataService, ExplorationFeaturesService, + ExplorationInitStateNameService, ExplorationLanguageCodeService, + ExplorationObjectiveService, ExplorationParamChangesService, + ExplorationParamSpecsService, ExplorationRightsService, + ExplorationStatesService, ExplorationTagsService, + ExplorationTitleService, ExplorationWarningsService, + UrlInterpolationService, UserEmailPreferencesService, + ALL_CATEGORIES, EXPLORATION_TITLE_INPUT_FOCUS_LABEL) { + var ctrl = this; + ctrl.EXPLORATION_TITLE_INPUT_FOCUS_LABEL = ( + EXPLORATION_TITLE_INPUT_FOCUS_LABEL); + ctrl.EditabilityService = EditabilityService; + ctrl.CATEGORY_LIST_FOR_SELECT2 = []; + for (var i = 0; i < ALL_CATEGORIES.length; i++) { + ctrl.CATEGORY_LIST_FOR_SELECT2.push({ + id: ALL_CATEGORIES[i], + text: ALL_CATEGORIES[i] + }); } - ExplorationInitStateNameService.saveDisplayedValue(); - - $rootScope.$broadcast('refreshGraph'); - }; - - ctrl.postSaveParamChangesHook = function() { - ExplorationWarningsService.updateWarnings(); - }; - - // Methods for enabling advanced features. - ctrl.areParametersEnabled = - ExplorationFeaturesService.areParametersEnabled; - ctrl.enableParameters = ExplorationFeaturesService.enableParameters; - - ctrl.isAutomaticTextToSpeechEnabled = ( - ExplorationAutomaticTextToSpeechService - .isAutomaticTextToSpeechEnabled); - ctrl.toggleAutomaticTextToSpeech = ( - ExplorationAutomaticTextToSpeechService.toggleAutomaticTextToSpeech); - - ctrl.isCorrectnessFeedbackEnabled = ( - ExplorationCorrectnessFeedbackService.isEnabled); - ctrl.toggleCorrectnessFeedback = ( - ExplorationCorrectnessFeedbackService.toggleCorrectnessFeedback); - - // Methods for rights management. - ctrl.openEditRolesForm = function() { - ctrl.isRolesFormOpen = true; - ctrl.newMemberUsername = ''; - ctrl.newMemberRole = ctrl.ROLES[0]; - }; - - ctrl.closeEditRolesForm = function() { - ctrl.newMemberUsername = ''; - ctrl.newMemberRole = ctrl.ROLES[0]; - ctrl.closeRolesForm(); - }; - - ctrl.editRole = function(newMemberUsername, newMemberRole) { - ctrl.closeRolesForm(); - ExplorationRightsService.saveRoleChanges( - newMemberUsername, newMemberRole); - }; - - ctrl.toggleViewabilityIfPrivate = function() { - ExplorationRightsService.setViewability( - !ExplorationRightsService.viewableIfPrivate()); - }; - - // Methods for muting notifications. - ctrl.muteFeedbackNotifications = function() { - UserEmailPreferencesService.setFeedbackNotificationPreferences(true); - }; - ctrl.muteSuggestionNotifications = function() { - UserEmailPreferencesService.setSuggestionNotificationPreferences( - true); - }; - - ctrl.unmuteFeedbackNotifications = function() { - UserEmailPreferencesService.setFeedbackNotificationPreferences(false); - }; - ctrl.unmuteSuggestionNotifications = function() { - UserEmailPreferencesService.setSuggestionNotificationPreferences( - false); - }; - - // Methods relating to control buttons. - ctrl.previewSummaryTile = function() { - AlertsService.clearWarnings(); - $uibModal.open({ - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/exploration-editor-page/settings-tab/templates/' + - 'preview-summary-tile-modal.template.html'), - backdrop: true, - controller: [ - '$scope', '$uibModalInstance', function( - $scope, $uibModalInstance) { - $scope.getExplorationTitle = function() { - return ExplorationTitleService.displayed; - }; - $scope.getExplorationObjective = function() { - return ExplorationObjectiveService.displayed; - }; - $scope.getExplorationCategory = function() { - return ExplorationCategoryService.displayed; - }; - $scope.getThumbnailIconUrl = function() { - var category = ExplorationCategoryService.displayed; - if (constants.ALL_CATEGORIES.indexOf(category) === -1) { - category = constants.DEFAULT_CATEGORY_ICON; - } - return '/subjects/' + category + '.svg'; - }; - $scope.getThumbnailBgColor = function() { - var category = ExplorationCategoryService.displayed; - var color = null; - if (!constants.CATEGORIES_TO_COLORS.hasOwnProperty( - category)) { - color = constants.DEFAULT_COLOR; - } else { - color = constants.CATEGORIES_TO_COLORS[category]; - } - return color; - }; + ctrl.isRolesFormOpen = false; - $scope.close = function() { - $uibModalInstance.dismiss(); - AlertsService.clearWarnings(); - }; - } - ] - }); - }; - - ctrl.showTransferExplorationOwnershipModal = function() { - AlertsService.clearWarnings(); - $uibModal.open({ - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/exploration-editor-page/settings-tab/templates/' + - 'transfer-exploration-ownership-modal.template.html'), - backdrop: true, - controller: [ - '$scope', '$uibModalInstance', function( - $scope, $uibModalInstance) { - $scope.transfer = $uibModalInstance.close; - - $scope.cancel = function() { - $uibModalInstance.dismiss('cancel'); - AlertsService.clearWarnings(); - }; - } - ] - }).result.then(function() { - ExplorationRightsService.makeCommunityOwned(); - }); - }; - - ctrl.deleteExploration = function() { - AlertsService.clearWarnings(); - - $uibModal.open({ - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/exploration-editor-page/settings-tab/templates/' + - 'delete-exploration-modal.template.html'), - backdrop: true, - controller: [ - '$scope', '$uibModalInstance', function( - $scope, $uibModalInstance) { - $scope.reallyDelete = $uibModalInstance.close; - - $scope.cancel = function() { - $uibModalInstance.dismiss('cancel'); - AlertsService.clearWarnings(); - }; - } - ] - }).result.then(function() { - EditableExplorationBackendApiService.deleteExploration( - ctrl.explorationId).then(function() { - $window.location = CREATOR_DASHBOARD_PAGE_URL; + ctrl.TAG_REGEX = constants.TAG_REGEX; + ctrl.canDelete = GLOBALS.canDelete; + ctrl.canModifyRoles = GLOBALS.canModifyRoles; + ctrl.canReleaseOwnership = GLOBALS.canReleaseOwnership; + ctrl.canUnpublish = GLOBALS.canUnpublish; + ctrl.explorationId = ExplorationDataService.explorationId; + + var CREATOR_DASHBOARD_PAGE_URL = '/creator_dashboard'; + var EXPLORE_PAGE_PREFIX = '/explore/'; + + ctrl.getExplorePageUrl = function() { + return ( + window.location.protocol + '//' + window.location.host + + EXPLORE_PAGE_PREFIX + ctrl.explorationId); + }; + + ctrl.initSettingsTab = function() { + ctrl.explorationTitleService = ExplorationTitleService; + ctrl.explorationCategoryService = ExplorationCategoryService; + ctrl.explorationObjectiveService = ExplorationObjectiveService; + ctrl.explorationLanguageCodeService = + ExplorationLanguageCodeService; + ctrl.explorationTagsService = ExplorationTagsService; + ctrl.ExplorationRightsService = ExplorationRightsService; + ctrl.explorationInitStateNameService = ( + ExplorationInitStateNameService); + ctrl.explorationParamSpecsService = ExplorationParamSpecsService; + ctrl.explorationParamChangesService = + ExplorationParamChangesService; + ctrl.UserEmailPreferencesService = UserEmailPreferencesService; + + ExplorationDataService.getData().then(function() { + ctrl.refreshSettingsTab(); + ctrl.hasPageLoaded = true; }); - }); - }; + }; + + ctrl.refreshSettingsTab = function() { + // Ensure that ExplorationStatesService has been initialized before + // getting the state names from it. (Otherwise, navigating to the + // settings tab directly (by entering a URL that ends with + // /settings) results in a console error. + if (ExplorationStatesService.isInitialized()) { + var categoryIsInSelect2 = ctrl.CATEGORY_LIST_FOR_SELECT2.some( + function(categoryItem) { + return ( + categoryItem.id === ( + ExplorationCategoryService.savedMemento)); + } + ); + + // If the current category is not in the dropdown, add it + // as the first option. + if (!categoryIsInSelect2 && + ExplorationCategoryService.savedMemento) { + ctrl.CATEGORY_LIST_FOR_SELECT2.unshift({ + id: ExplorationCategoryService.savedMemento, + text: ExplorationCategoryService.savedMemento + }); + } - ctrl.unpublishExplorationAsModerator = function() { - AlertsService.clearWarnings(); + ctrl.stateNames = ExplorationStatesService.getStateNames(); + } + }; + + $scope.$on('refreshSettingsTab', ctrl.refreshSettingsTab); + + ctrl.initSettingsTab(); + + ctrl.ROLES = [{ + name: 'Manager (can edit permissions)', + value: 'owner' + }, { + name: 'Collaborator (can make changes)', + value: 'editor' + }, { + name: 'Voice Artist (can do voiceover)', + value: 'voice artist' + }, { + name: 'Playtester (can give feedback)', + value: 'viewer' + }]; + + ctrl.formStyle = { + display: 'table-cell', + width: '16.66666667%', + 'vertical-align': 'top' + }; + + ctrl.saveExplorationTitle = function() { + ExplorationTitleService.saveDisplayedValue(); + }; + + ctrl.saveExplorationCategory = function() { + ExplorationCategoryService.saveDisplayedValue(); + }; + + ctrl.saveExplorationObjective = function() { + ExplorationObjectiveService.saveDisplayedValue(); + }; + + ctrl.saveExplorationLanguageCode = function() { + ExplorationLanguageCodeService.saveDisplayedValue(); + }; + + ctrl.saveExplorationTags = function() { + ExplorationTagsService.saveDisplayedValue(); + }; + + ctrl.saveExplorationInitStateName = function() { + var newInitStateName = ExplorationInitStateNameService.displayed; + + if (!ExplorationStatesService.getState(newInitStateName)) { + AlertsService.addWarning( + 'Invalid initial state name: ' + newInitStateName); + ExplorationInitStateNameService.restoreFromMemento(); + return; + } - var moderatorEmailDraftUrl = '/moderatorhandler/email_draft'; + ExplorationInitStateNameService.saveDisplayedValue(); + + $rootScope.$broadcast('refreshGraph'); + }; + + ctrl.postSaveParamChangesHook = function() { + ExplorationWarningsService.updateWarnings(); + }; + + // Methods for enabling advanced features. + ctrl.areParametersEnabled = + ExplorationFeaturesService.areParametersEnabled; + ctrl.enableParameters = ExplorationFeaturesService.enableParameters; + + ctrl.isAutomaticTextToSpeechEnabled = ( + ExplorationAutomaticTextToSpeechService + .isAutomaticTextToSpeechEnabled); + ctrl.toggleAutomaticTextToSpeech = ( + ExplorationAutomaticTextToSpeechService + .toggleAutomaticTextToSpeech); + + ctrl.isCorrectnessFeedbackEnabled = ( + ExplorationCorrectnessFeedbackService.isEnabled); + ctrl.toggleCorrectnessFeedback = ( + ExplorationCorrectnessFeedbackService.toggleCorrectnessFeedback); + + // Methods for rights management. + ctrl.openEditRolesForm = function() { + ctrl.isRolesFormOpen = true; + ctrl.newMemberUsername = ''; + ctrl.newMemberRole = ctrl.ROLES[0]; + }; + + ctrl.closeEditRolesForm = function() { + ctrl.newMemberUsername = ''; + ctrl.newMemberRole = ctrl.ROLES[0]; + ctrl.closeRolesForm(); + }; + + ctrl.editRole = function(newMemberUsername, newMemberRole) { + ctrl.closeRolesForm(); + ExplorationRightsService.saveRoleChanges( + newMemberUsername, newMemberRole); + }; + + ctrl.toggleViewabilityIfPrivate = function() { + ExplorationRightsService.setViewability( + !ExplorationRightsService.viewableIfPrivate()); + }; + + // Methods for muting notifications. + ctrl.muteFeedbackNotifications = function() { + UserEmailPreferencesService.setFeedbackNotificationPreferences( + true); + }; + ctrl.muteSuggestionNotifications = function() { + UserEmailPreferencesService.setSuggestionNotificationPreferences( + true); + }; + + ctrl.unmuteFeedbackNotifications = function() { + UserEmailPreferencesService.setFeedbackNotificationPreferences( + false); + }; + ctrl.unmuteSuggestionNotifications = function() { + UserEmailPreferencesService.setSuggestionNotificationPreferences( + false); + }; + + // Methods relating to control buttons. + ctrl.previewSummaryTile = function() { + AlertsService.clearWarnings(); + $uibModal.open({ + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/exploration-editor-page/settings-tab/templates/' + + 'preview-summary-tile-modal.template.html'), + backdrop: true, + controller: [ + '$scope', '$uibModalInstance', function( + $scope, $uibModalInstance) { + $scope.getExplorationTitle = function() { + return ExplorationTitleService.displayed; + }; + $scope.getExplorationObjective = function() { + return ExplorationObjectiveService.displayed; + }; + $scope.getExplorationCategory = function() { + return ExplorationCategoryService.displayed; + }; + $scope.getThumbnailIconUrl = function() { + var category = ExplorationCategoryService.displayed; + if (constants.ALL_CATEGORIES.indexOf(category) === -1) { + category = constants.DEFAULT_CATEGORY_ICON; + } + return '/subjects/' + category + '.svg'; + }; + $scope.getThumbnailBgColor = function() { + var category = ExplorationCategoryService.displayed; + var color = null; + if (!constants.CATEGORIES_TO_COLORS.hasOwnProperty( + category)) { + color = constants.DEFAULT_COLOR; + } else { + color = constants.CATEGORIES_TO_COLORS[category]; + } + return color; + }; - $http.get(moderatorEmailDraftUrl).then(function(response) { - // If the draft email body is empty, email functionality will not be - // exposed to the mdoerator. - var draftEmailBody = response.data.draft_email_body; + $scope.close = function() { + $uibModalInstance.dismiss(); + AlertsService.clearWarnings(); + }; + } + ] + }); + }; + ctrl.showTransferExplorationOwnershipModal = function() { + AlertsService.clearWarnings(); $uibModal.open({ - bindToController: {}, templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( '/pages/exploration-editor-page/settings-tab/templates/' + - 'moderator-unpublish-exploration-modal.template.html'), + 'transfer-exploration-ownership-modal.template.html'), backdrop: true, - resolve: { - draftEmailBody: function() { - return draftEmailBody; - } - }, - controllerAs: '$ctrl', controller: [ - '$uibModalInstance', 'draftEmailBody', - function($uibModalInstance, draftEmailBody) { - var ctrl = this; - ctrl.willEmailBeSent = Boolean(draftEmailBody); - ctrl.emailBody = draftEmailBody; - - if (ctrl.willEmailBeSent) { - ctrl.EMAIL_BODY_SCHEMA = { - type: 'unicode', - ui_config: { - rows: 20 - } - }; - } + '$scope', '$uibModalInstance', function( + $scope, $uibModalInstance) { + $scope.transfer = $uibModalInstance.close; - ctrl.reallyTakeAction = function() { - $uibModalInstance.close({ - emailBody: ctrl.emailBody - }); + $scope.cancel = function() { + $uibModalInstance.dismiss('cancel'); + AlertsService.clearWarnings(); }; + } + ] + }).result.then(function() { + ExplorationRightsService.makeCommunityOwned(); + }); + }; + + ctrl.deleteExploration = function() { + AlertsService.clearWarnings(); - ctrl.cancel = function() { + $uibModal.open({ + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/exploration-editor-page/settings-tab/templates/' + + 'delete-exploration-modal.template.html'), + backdrop: true, + controller: [ + '$scope', '$uibModalInstance', function( + $scope, $uibModalInstance) { + $scope.reallyDelete = $uibModalInstance.close; + + $scope.cancel = function() { $uibModalInstance.dismiss('cancel'); AlertsService.clearWarnings(); }; } ] - }).result.then(function(result) { - ExplorationRightsService.saveModeratorChangeToBackend( - result.emailBody); + }).result.then(function() { + EditableExplorationBackendApiService.deleteExploration( + ctrl.explorationId).then(function() { + $window.location = CREATOR_DASHBOARD_PAGE_URL; + }); + }); + }; + + ctrl.unpublishExplorationAsModerator = function() { + AlertsService.clearWarnings(); + + var moderatorEmailDraftUrl = '/moderatorhandler/email_draft'; + + $http.get(moderatorEmailDraftUrl).then(function(response) { + // If the draft email body is empty, email functionality will not + // be exposed to the mdoerator. + var draftEmailBody = response.data.draft_email_body; + + $uibModal.open({ + bindToController: {}, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/exploration-editor-page/settings-tab/templates/' + + 'moderator-unpublish-exploration-modal.template.html'), + backdrop: true, + resolve: { + draftEmailBody: function() { + return draftEmailBody; + } + }, + controllerAs: '$ctrl', + controller: [ + '$uibModalInstance', 'draftEmailBody', + function($uibModalInstance, draftEmailBody) { + var ctrl = this; + ctrl.willEmailBeSent = Boolean(draftEmailBody); + ctrl.emailBody = draftEmailBody; + + if (ctrl.willEmailBeSent) { + ctrl.EMAIL_BODY_SCHEMA = { + type: 'unicode', + ui_config: { + rows: 20 + } + }; + } + + ctrl.reallyTakeAction = function() { + $uibModalInstance.close({ + emailBody: ctrl.emailBody + }); + }; + + ctrl.cancel = function() { + $uibModalInstance.dismiss('cancel'); + AlertsService.clearWarnings(); + }; + } + ] + }).result.then(function(result) { + ExplorationRightsService.saveModeratorChangeToBackend( + result.emailBody); + }); }); - }); - }; + }; - ctrl.isExplorationLockedForEditing = function() { - return ChangeListService.isExplorationLockedForEditing(); - }; + ctrl.isExplorationLockedForEditing = function() { + return ChangeListService.isExplorationLockedForEditing(); + }; - ctrl.closeRolesForm = function() { - ctrl.isRolesFormOpen = false; - }; - - ctrl.isTitlePresent = function() { - return ExplorationTitleService.savedMemento.length > 0; - }; - } - ]}; -}]); + ctrl.closeRolesForm = function() { + ctrl.isRolesFormOpen = false; + }; + + ctrl.isTitlePresent = function() { + return ExplorationTitleService.savedMemento.length > 0; + }; + } + ]}; + }]); diff --git a/core/templates/dev/head/pages/exploration-editor-page/statistics-tab/charts/bar-chart.directive.ts b/core/templates/dev/head/pages/exploration-editor-page/statistics-tab/charts/bar-chart.directive.ts index 7086a69e0cc1..44ac612e6d65 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/statistics-tab/charts/bar-chart.directive.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/statistics-tab/charts/bar-chart.directive.ts @@ -16,9 +16,7 @@ * @fileoverview Directive for bar chart visualization. */ -var oppia = require('AppInit.ts').module; - -oppia.directive('barChart', [function() { +angular.module('oppia').directive('barChart', [function() { return { restrict: 'E', scope: { diff --git a/core/templates/dev/head/pages/exploration-editor-page/statistics-tab/charts/pie-chart.directive.ts b/core/templates/dev/head/pages/exploration-editor-page/statistics-tab/charts/pie-chart.directive.ts index c63ac2fc1bfc..7b1491f030e5 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/statistics-tab/charts/pie-chart.directive.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/statistics-tab/charts/pie-chart.directive.ts @@ -16,9 +16,7 @@ * @fileoverview Directive for pie chart visualization. */ -var oppia = require('AppInit.ts').module; - -oppia.directive('pieChart', [function() { +angular.module('oppia').directive('pieChart', [function() { return { restrict: 'E', scope: { diff --git a/core/templates/dev/head/pages/exploration-editor-page/statistics-tab/issues/answer-submit-action.directive.ts b/core/templates/dev/head/pages/exploration-editor-page/statistics-tab/issues/answer-submit-action.directive.ts index a0d475d21c0e..ab4ba1bc5fcd 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/statistics-tab/issues/answer-submit-action.directive.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/statistics-tab/issues/answer-submit-action.directive.ts @@ -20,9 +20,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/ExplorationHtmlFormatterService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('answerSubmitAction', [ +angular.module('oppia').directive('answerSubmitAction', [ 'ExplorationHtmlFormatterService', 'HtmlEscaperService', 'UrlInterpolationService', function( diff --git a/core/templates/dev/head/pages/exploration-editor-page/statistics-tab/issues/cyclic-transitions-issue.directive.ts b/core/templates/dev/head/pages/exploration-editor-page/statistics-tab/issues/cyclic-transitions-issue.directive.ts index f190d1b4c0d8..6526176df8ce 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/statistics-tab/issues/cyclic-transitions-issue.directive.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/statistics-tab/issues/cyclic-transitions-issue.directive.ts @@ -20,9 +20,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/AlertsService.ts'); require('services/PlaythroughIssuesService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('cyclicTransitionsIssue', [ +angular.module('oppia').directive('cyclicTransitionsIssue', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/exploration-editor-page/statistics-tab/issues/early-quit-issue.directive.ts b/core/templates/dev/head/pages/exploration-editor-page/statistics-tab/issues/early-quit-issue.directive.ts index a123c43c4891..edbdceed9328 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/statistics-tab/issues/early-quit-issue.directive.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/statistics-tab/issues/early-quit-issue.directive.ts @@ -20,9 +20,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/AlertsService.ts'); require('services/PlaythroughIssuesService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('earlyQuitIssue', [ +angular.module('oppia').directive('earlyQuitIssue', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/exploration-editor-page/statistics-tab/issues/multiple-incorrect-issue.directive.ts b/core/templates/dev/head/pages/exploration-editor-page/statistics-tab/issues/multiple-incorrect-issue.directive.ts index 0fab6a558556..e507bf628681 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/statistics-tab/issues/multiple-incorrect-issue.directive.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/statistics-tab/issues/multiple-incorrect-issue.directive.ts @@ -20,9 +20,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/AlertsService.ts'); require('services/PlaythroughIssuesService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('multipleIncorrectIssue', [ +angular.module('oppia').directive('multipleIncorrectIssue', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/exploration-editor-page/statistics-tab/issues/playthrough-issues.directive.ts b/core/templates/dev/head/pages/exploration-editor-page/statistics-tab/issues/playthrough-issues.directive.ts index 615998f3af47..d36f8b08aec1 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/statistics-tab/issues/playthrough-issues.directive.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/statistics-tab/issues/playthrough-issues.directive.ts @@ -29,9 +29,7 @@ require( require('domain/utilities/UrlInterpolationService.ts'); require('services/PlaythroughIssuesService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('playthroughIssues', [ +angular.module('oppia').directive('playthroughIssues', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/exploration-editor-page/statistics-tab/services/learner-action-render.service.ts b/core/templates/dev/head/pages/exploration-editor-page/statistics-tab/services/learner-action-render.service.ts index 1b1d2788fc64..498c3eedb5ac 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/statistics-tab/services/learner-action-render.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/statistics-tab/services/learner-action-render.service.ts @@ -32,18 +32,14 @@ require( 'answer-submit-action.directive.ts'); require('services/ExplorationHtmlFormatterService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('LearnerActionRenderService', [ - '$sce', 'ExplorationHtmlFormatterService', 'ExplorationStatesService', +angular.module('oppia').factory('LearnerActionRenderService', [ + '$sce', 'ExplorationStatesService', 'HtmlEscaperService', 'ACTION_TYPE_ANSWER_SUBMIT', 'ACTION_TYPE_EXPLORATION_QUIT', 'ACTION_TYPE_EXPLORATION_START', - 'ISSUE_TYPE_MULTIPLE_INCORRECT_SUBMISSIONS', function( - $sce, ExplorationHtmlFormatterService, ExplorationStatesService, + $sce, ExplorationStatesService, HtmlEscaperService, ACTION_TYPE_ANSWER_SUBMIT, - ACTION_TYPE_EXPLORATION_QUIT, ACTION_TYPE_EXPLORATION_START, - ISSUE_TYPE_MULTIPLE_INCORRECT_SUBMISSIONS) { + ACTION_TYPE_EXPLORATION_QUIT, ACTION_TYPE_EXPLORATION_START) { var renderExplorationStartActionHTML = function(stateName, actionIndex) { var statement = actionIndex + '. Started exploration at card "' + stateName + '".'; diff --git a/core/templates/dev/head/pages/exploration-editor-page/statistics-tab/services/state-improvement-suggestion.service.ts b/core/templates/dev/head/pages/exploration-editor-page/statistics-tab/services/state-improvement-suggestion.service.ts index 86e255f3122c..40437717de28 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/statistics-tab/services/state-improvement-suggestion.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/statistics-tab/services/state-improvement-suggestion.service.ts @@ -18,9 +18,7 @@ require('pages/exploration-editor-page/exploration-editor-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('StateImprovementSuggestionService', [ +angular.module('oppia').factory('StateImprovementSuggestionService', [ 'IMPROVE_TYPE_INCOMPLETE', function(IMPROVE_TYPE_INCOMPLETE) { return { diff --git a/core/templates/dev/head/pages/exploration-editor-page/statistics-tab/statistics-tab.directive.ts b/core/templates/dev/head/pages/exploration-editor-page/statistics-tab/statistics-tab.directive.ts index 14b570e03bd3..3bfef65aff5d 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/statistics-tab/statistics-tab.directive.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/statistics-tab/statistics-tab.directive.ts @@ -36,257 +36,255 @@ require('services/StateRulesStatsService.ts'); require('pages/exploration-editor-page/exploration-editor-page.constants.ts'); -var oppia = require('AppInit.ts').module; +angular.module('oppia').directive('statisticsTab', [ + 'UrlInterpolationService', function(UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: {}, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/exploration-editor-page/statistics-tab/' + + 'statistics-tab.directive.html'), + controllerAs: '$ctrl', + controller: [ + '$http', '$scope', '$uibModal', 'AlertsService', 'ComputeGraphService', + 'DateTimeFormatService', 'ExplorationDataService', + 'ExplorationFeaturesService', + 'ExplorationStatesService', 'ReadOnlyExplorationBackendApiService', + 'RouterService', 'StateImprovementSuggestionService', + 'StateRulesStatsService', 'StatesObjectFactory', + 'UrlInterpolationService', 'IMPROVE_TYPE_INCOMPLETE', + function( + $http, $scope, $uibModal, AlertsService, ComputeGraphService, + DateTimeFormatService, ExplorationDataService, + ExplorationFeaturesService, + ExplorationStatesService, ReadOnlyExplorationBackendApiService, + RouterService, StateImprovementSuggestionService, + StateRulesStatsService, StatesObjectFactory, + UrlInterpolationService, IMPROVE_TYPE_INCOMPLETE) { + var ctrl = this; + ctrl.COMPLETION_RATE_CHART_OPTIONS = { + chartAreaWidth: 300, + colors: ['green', 'firebrick'], + height: 100, + legendPosition: 'right', + width: 500 + }; + ctrl.COMPLETION_RATE_PIE_CHART_OPTIONS = { + title: '', + left: 230, + pieHole: 0.6, + pieSliceTextStyleColor: 'black', + pieSliceBorderColor: 'black', + chartAreaWidth: 500, + colors: ['#008808', '#d8d8d8'], + height: 300, + legendPosition: 'right', + width: 600 + }; + var _EXPLORATION_STATS_VERSION_ALL = 'all'; + ctrl.currentVersion = _EXPLORATION_STATS_VERSION_ALL; -oppia.directive('statisticsTab', ['UrlInterpolationService', function( - UrlInterpolationService) { - return { - restrict: 'E', - scope: {}, - bindToController: {}, - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/exploration-editor-page/statistics-tab/' + - 'statistics-tab.directive.html'), - controllerAs: '$ctrl', - controller: [ - '$http', '$scope', '$uibModal', 'AlertsService', 'ComputeGraphService', - 'DateTimeFormatService', 'ExplorationDataService', - 'ExplorationFeaturesService', - 'ExplorationStatesService', 'ReadOnlyExplorationBackendApiService', - 'RouterService', 'StateImprovementSuggestionService', - 'StateRulesStatsService', 'StatesObjectFactory', - 'UrlInterpolationService', 'IMPROVE_TYPE_INCOMPLETE', - function( - $http, $scope, $uibModal, AlertsService, ComputeGraphService, - DateTimeFormatService, ExplorationDataService, - ExplorationFeaturesService, - ExplorationStatesService, ReadOnlyExplorationBackendApiService, - RouterService, StateImprovementSuggestionService, - StateRulesStatsService, StatesObjectFactory, - UrlInterpolationService, IMPROVE_TYPE_INCOMPLETE) { - var ctrl = this; - ctrl.COMPLETION_RATE_CHART_OPTIONS = { - chartAreaWidth: 300, - colors: ['green', 'firebrick'], - height: 100, - legendPosition: 'right', - width: 500 - }; - ctrl.COMPLETION_RATE_PIE_CHART_OPTIONS = { - title: '', - left: 230, - pieHole: 0.6, - pieSliceTextStyleColor: 'black', - pieSliceBorderColor: 'black', - chartAreaWidth: 500, - colors: ['#008808', '#d8d8d8'], - height: 300, - legendPosition: 'right', - width: 600 - }; - var _EXPLORATION_STATS_VERSION_ALL = 'all'; - ctrl.currentVersion = _EXPLORATION_STATS_VERSION_ALL; + ctrl.getLocaleAbbreviatedDatetimeString = function(millisSinceEpoch) { + return DateTimeFormatService.getLocaleAbbreviatedDatetimeString( + millisSinceEpoch); + }; - ctrl.getLocaleAbbreviatedDatetimeString = function(millisSinceEpoch) { - return DateTimeFormatService.getLocaleAbbreviatedDatetimeString( - millisSinceEpoch); - }; - - ctrl.hasTabLoaded = false; - $scope.$on('refreshStatisticsTab', function() { - ctrl.refreshExplorationStatistics(_EXPLORATION_STATS_VERSION_ALL); - }); + ctrl.hasTabLoaded = false; + $scope.$on('refreshStatisticsTab', function() { + ctrl.refreshExplorationStatistics(_EXPLORATION_STATS_VERSION_ALL); + }); - ctrl.explorationHasBeenVisited = false; - ctrl.refreshExplorationStatistics = function(version) { - ctrl.explorationStatisticsUrl = ( - '/createhandler/statistics/' + - ExplorationDataService.explorationId); + ctrl.explorationHasBeenVisited = false; + ctrl.refreshExplorationStatistics = function(version) { + ctrl.explorationStatisticsUrl = ( + '/createhandler/statistics/' + + ExplorationDataService.explorationId); - $http.get(ctrl.explorationStatisticsUrl).then(function( - statsResponse) { - var data = statsResponse.data; - var numStarts = data.num_starts; - var numActualStarts = data.num_actual_starts; - var numCompletions = data.num_completions; - ctrl.stateStats = data.state_stats_mapping; + $http.get(ctrl.explorationStatisticsUrl).then(function( + statsResponse) { + var data = statsResponse.data; + var numStarts = data.num_starts; + var numActualStarts = data.num_actual_starts; + var numCompletions = data.num_completions; + ctrl.stateStats = data.state_stats_mapping; - ReadOnlyExplorationBackendApiService.loadLatestExploration( - ExplorationDataService.explorationId).then(function(response) { - var statesDict = response.exploration.states; - var states = StatesObjectFactory.createFromBackendDict( - statesDict); - var initStateName = response.exploration.init_state_name; + ReadOnlyExplorationBackendApiService.loadLatestExploration( + ExplorationDataService.explorationId).then(function(response) { + var statesDict = response.exploration.states; + var states = StatesObjectFactory.createFromBackendDict( + statesDict); + var initStateName = response.exploration.init_state_name; - ctrl.playthroughsAreAvailable = - ExplorationFeaturesService.isPlaythroughRecordingEnabled() && - !ExplorationFeaturesService.isImprovementsTabEnabled(); - ctrl.statsGraphData = ComputeGraphService.compute( - initStateName, states); - var improvements = ( - StateImprovementSuggestionService.getStateImprovements( - states, ctrl.stateStats)); - ctrl.highlightStates = {}; - improvements.forEach(function(impItem) { - // TODO(bhenning): This is the feedback for improvement types - // and should be included with the definitions of the - // improvement types. - if (impItem.type === IMPROVE_TYPE_INCOMPLETE) { - ctrl.highlightStates[impItem.stateName] = ( - 'May be confusing'); - } + ctrl.playthroughsAreAvailable = + ExplorationFeaturesService.isPlaythroughRecordingEnabled() && + !ExplorationFeaturesService.isImprovementsTabEnabled(); + ctrl.statsGraphData = ComputeGraphService.compute( + initStateName, states); + var improvements = ( + StateImprovementSuggestionService.getStateImprovements( + states, ctrl.stateStats)); + ctrl.highlightStates = {}; + improvements.forEach(function(impItem) { + // TODO(bhenning): This is the feedback for improvement types + // and should be included with the definitions of the + // improvement types. + if (impItem.type === IMPROVE_TYPE_INCOMPLETE) { + ctrl.highlightStates[impItem.stateName] = ( + 'May be confusing'); + } + }); }); - }); - if (numActualStarts > 0) { - ctrl.explorationHasBeenVisited = true; - } + if (numActualStarts > 0) { + ctrl.explorationHasBeenVisited = true; + } - ctrl.numPassersby = numStarts - numActualStarts; - ctrl.pieChartData = [ - ['Type', 'Number'], - ['Completions', numCompletions], - ['Non-Completions', numActualStarts - numCompletions] - ]; - }); - }; + ctrl.numPassersby = numStarts - numActualStarts; + ctrl.pieChartData = [ + ['Type', 'Number'], + ['Completions', numCompletions], + ['Non-Completions', numActualStarts - numCompletions] + ]; + }); + }; - var stateStatsModalIsOpen = false; - ctrl.onClickStateInStatsGraph = function(stateName) { - if (!stateStatsModalIsOpen) { - stateStatsModalIsOpen = true; - ctrl.showStateStatsModal( - stateName, ctrl.highlightStates[stateName]); - } - }; + var stateStatsModalIsOpen = false; + ctrl.onClickStateInStatsGraph = function(stateName) { + if (!stateStatsModalIsOpen) { + stateStatsModalIsOpen = true; + ctrl.showStateStatsModal( + stateName, ctrl.highlightStates[stateName]); + } + }; - ctrl.showStateStatsModal = function(stateName, improvementType) { - AlertsService.clearWarnings(); + ctrl.showStateStatsModal = function(stateName, improvementType) { + AlertsService.clearWarnings(); - StateRulesStatsService.computeStateRulesStats( - ExplorationStatesService.getState(stateName) - ).then(function(stateRulesStats) { - $uibModal.open({ - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/exploration-editor-page/statistics-tab/templates/' + - 'state-stats-modal.template.html'), - backdrop: true, - resolve: { - stateName: function() { - return stateName; - }, - stateStats: function() { - return ctrl.stateStats[stateName]; - }, - improvementType: function() { - return improvementType; + StateRulesStatsService.computeStateRulesStats( + ExplorationStatesService.getState(stateName) + ).then(function(stateRulesStats) { + $uibModal.open({ + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/exploration-editor-page/statistics-tab/templates/' + + 'state-stats-modal.template.html'), + backdrop: true, + resolve: { + stateName: function() { + return stateName; + }, + stateStats: function() { + return ctrl.stateStats[stateName]; + }, + improvementType: function() { + return improvementType; + }, + visualizationsInfo: function() { + return stateRulesStats.visualizations_info; + } }, - visualizationsInfo: function() { - return stateRulesStats.visualizations_info; - } - }, - controller: [ - '$scope', '$uibModalInstance', '$filter', '$injector', - 'stateName', 'stateStats', 'improvementType', - 'visualizationsInfo', 'HtmlEscaperService', - 'AngularNameService', 'AnswerClassificationService', - function( - $scope, $uibModalInstance, $filter, $injector, - stateName, stateStats, improvementType, - visualizationsInfo, HtmlEscaperService, - AngularNameService, AnswerClassificationService) { - var COMPLETION_RATE_PIE_CHART_OPTIONS = { - left: 20, - pieHole: 0.6, - pieSliceTextStyleColor: 'black', - pieSliceBorderColor: 'black', - chartAreaWidth: 240, - colors: ['#d8d8d8', '#008808', 'blue'], - height: 270, - legendPosition: 'right', - width: 240 - }; + controller: [ + '$scope', '$uibModalInstance', '$filter', '$injector', + 'stateName', 'stateStats', 'improvementType', + 'visualizationsInfo', 'HtmlEscaperService', + 'AngularNameService', 'AnswerClassificationService', + function( + $scope, $uibModalInstance, $filter, $injector, + stateName, stateStats, improvementType, + visualizationsInfo, HtmlEscaperService, + AngularNameService, AnswerClassificationService) { + var COMPLETION_RATE_PIE_CHART_OPTIONS = { + left: 20, + pieHole: 0.6, + pieSliceTextStyleColor: 'black', + pieSliceBorderColor: 'black', + chartAreaWidth: 240, + colors: ['#d8d8d8', '#008808', 'blue'], + height: 270, + legendPosition: 'right', + width: 240 + }; - var title1 = 'Answer feedback statistics'; - $scope.COMPLETION_RATE_PIE_CHART_OPTIONS1 = angular.copy( - COMPLETION_RATE_PIE_CHART_OPTIONS); - $scope.COMPLETION_RATE_PIE_CHART_OPTIONS1.title = title1; + var title1 = 'Answer feedback statistics'; + $scope.COMPLETION_RATE_PIE_CHART_OPTIONS1 = angular.copy( + COMPLETION_RATE_PIE_CHART_OPTIONS); + $scope.COMPLETION_RATE_PIE_CHART_OPTIONS1.title = title1; - var title2 = 'Solution usage statistics'; - $scope.COMPLETION_RATE_PIE_CHART_OPTIONS2 = angular.copy( - COMPLETION_RATE_PIE_CHART_OPTIONS); - $scope.COMPLETION_RATE_PIE_CHART_OPTIONS2.title = title2; + var title2 = 'Solution usage statistics'; + $scope.COMPLETION_RATE_PIE_CHART_OPTIONS2 = angular.copy( + COMPLETION_RATE_PIE_CHART_OPTIONS); + $scope.COMPLETION_RATE_PIE_CHART_OPTIONS2.title = title2; - $scope.stateName = stateName; - $scope.stateStats = stateStats; - $scope.improvementType = improvementType; + $scope.stateName = stateName; + $scope.stateStats = stateStats; + $scope.improvementType = improvementType; - var usefulFeedbackCount = ( - $scope.stateStats.useful_feedback_count); - var totalAnswersCount = ( - $scope.stateStats.total_answers_count); - if (totalAnswersCount > 0) { - $scope.hasExplorationBeenAnswered = true; - } - $scope.pieChartData1 = [ - ['Type', 'Number'], - ['Default feedback', - totalAnswersCount - usefulFeedbackCount], - ['Specific feedback', usefulFeedbackCount], - ]; + var usefulFeedbackCount = ( + $scope.stateStats.useful_feedback_count); + var totalAnswersCount = ( + $scope.stateStats.total_answers_count); + if (totalAnswersCount > 0) { + $scope.hasExplorationBeenAnswered = true; + } + $scope.pieChartData1 = [ + ['Type', 'Number'], + ['Default feedback', + totalAnswersCount - usefulFeedbackCount], + ['Specific feedback', usefulFeedbackCount], + ]; - var numTimesSolutionViewed = ( - $scope.stateStats.num_times_solution_viewed); - $scope.pieChartData2 = [ - ['Type', 'Number'], - ['Solutions used to answer', numTimesSolutionViewed], - ['Solutions not used', totalAnswersCount - ( - numTimesSolutionViewed)] - ]; + var numTimesSolutionViewed = ( + $scope.stateStats.num_times_solution_viewed); + $scope.pieChartData2 = [ + ['Type', 'Number'], + ['Solutions used to answer', numTimesSolutionViewed], + ['Solutions not used', totalAnswersCount - ( + numTimesSolutionViewed)] + ]; - var _getVisualizationsHtml = function() { - var htmlSnippets = visualizationsInfo.map(function( - vizInfo) { - var escapedData = - HtmlEscaperService.objToEscapedJson(vizInfo.data); - var escapedOptions = - HtmlEscaperService.objToEscapedJson(vizInfo.options); + var _getVisualizationsHtml = function() { + var htmlSnippets = visualizationsInfo.map(function( + vizInfo) { + var escapedData = + HtmlEscaperService.objToEscapedJson(vizInfo.data); + var escapedOptions = + HtmlEscaperService.objToEscapedJson(vizInfo.options); - var el = $( - ''); - el.attr('escaped-data', escapedData); - el.attr('escaped-options', escapedOptions); - el.attr( - 'addressed-info-is-supported', - vizInfo.addressed_info_is_supported); - return el.get(0).outerHTML; - }); + var el = $( + ''); + el.attr('escaped-data', escapedData); + el.attr('escaped-options', escapedOptions); + el.attr( + 'addressed-info-is-supported', + vizInfo.addressed_info_is_supported); + return el.get(0).outerHTML; + }); - return htmlSnippets.join(''); - }; + return htmlSnippets.join(''); + }; - $scope.visualizationsHtml = _getVisualizationsHtml(); + $scope.visualizationsHtml = _getVisualizationsHtml(); - $scope.cancel = function() { - $uibModalInstance.dismiss('cancel'); - AlertsService.clearWarnings(); - }; + $scope.cancel = function() { + $uibModalInstance.dismiss('cancel'); + AlertsService.clearWarnings(); + }; - $scope.$on('$destroy', function() { - stateStatsModalIsOpen = false; - }); + $scope.$on('$destroy', function() { + stateStatsModalIsOpen = false; + }); - $scope.navigateToStateEditor = function() { - $scope.cancel(); - RouterService.navigateToMainTab(stateName); - }; - } - ] + $scope.navigateToStateEditor = function() { + $scope.cancel(); + RouterService.navigateToMainTab(stateName); + }; + } + ] + }); }); - }); - }; - } - ] - }; -}]); + }; + } + ] + }; + }]); diff --git a/core/templates/dev/head/pages/exploration-editor-page/suggestion-modal-for-editor-view/suggestion-modal-for-exploration-editor.service.ts b/core/templates/dev/head/pages/exploration-editor-page/suggestion-modal-for-editor-view/suggestion-modal-for-exploration-editor.service.ts index c3e8ce57e66e..2d9455e541ec 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/suggestion-modal-for-editor-view/suggestion-modal-for-exploration-editor.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/suggestion-modal-for-editor-view/suggestion-modal-for-exploration-editor.service.ts @@ -25,9 +25,7 @@ require( require('services/EditabilityService.ts'); require('services/SuggestionModalService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('SuggestionModalForExplorationEditorService', [ +angular.module('oppia').factory('SuggestionModalForExplorationEditorService', [ '$log', '$rootScope', '$uibModal', 'ExplorationDataService', 'ExplorationStatesService', 'StateObjectFactory', 'SuggestionModalService', diff --git a/core/templates/dev/head/pages/exploration-editor-page/translation-tab/audio-translation-bar/audio-translation-bar.directive.ts b/core/templates/dev/head/pages/exploration-editor-page/translation-tab/audio-translation-bar/audio-translation-bar.directive.ts index 1bd01ea726e7..f76f45fbdd6a 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/translation-tab/audio-translation-bar/audio-translation-bar.directive.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/translation-tab/audio-translation-bar/audio-translation-bar.directive.ts @@ -46,9 +46,7 @@ require('services/UserService.ts'); require('pages/exploration-editor-page/exploration-editor-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('audioTranslationBar', [ +angular.module('oppia').directive('audioTranslationBar', [ 'UrlInterpolationService', 'UserService', function(UrlInterpolationService, UserService) { return { diff --git a/core/templates/dev/head/pages/exploration-editor-page/translation-tab/services/translation-language.service.ts b/core/templates/dev/head/pages/exploration-editor-page/translation-tab/services/translation-language.service.ts index fc00a8f04752..c121a28915f0 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/translation-tab/services/translation-language.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/translation-tab/services/translation-language.service.ts @@ -19,9 +19,7 @@ require('domain/utilities/LanguageUtilService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('TranslationLanguageService', [ +angular.module('oppia').factory('TranslationLanguageService', [ '$log', '$rootScope', 'LanguageUtilService', function($log, $rootScope, LanguageUtilService) { var activeLanguageCode = null; diff --git a/core/templates/dev/head/pages/exploration-editor-page/translation-tab/services/translation-status.service.ts b/core/templates/dev/head/pages/exploration-editor-page/translation-tab/services/translation-status.service.ts index f66772abbc15..532bf724a5a0 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/translation-tab/services/translation-status.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/translation-tab/services/translation-status.service.ts @@ -36,9 +36,7 @@ require( require('pages/exploration-editor-page/exploration-editor-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('TranslationStatusService', [ +angular.module('oppia').factory('TranslationStatusService', [ 'ExplorationStatesService', 'StateRecordedVoiceoversService', 'StateWrittenTranslationsService', 'TranslationLanguageService', 'TranslationTabActiveModeService', 'INTERACTION_SPECS', function( diff --git a/core/templates/dev/head/pages/exploration-editor-page/translation-tab/services/translation-tab-active-content-id.service.ts b/core/templates/dev/head/pages/exploration-editor-page/translation-tab/services/translation-tab-active-content-id.service.ts index de10118c3f17..f3e4b9a65260 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/translation-tab/services/translation-tab-active-content-id.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/translation-tab/services/translation-tab-active-content-id.service.ts @@ -23,11 +23,9 @@ require( 'components/state-editor/state-editor-properties-services/' + 'state-recorded-voiceovers.service.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('TranslationTabActiveContentIdService', [ - '$log', '$rootScope', 'StateRecordedVoiceoversService', - function($log, $rootScope, StateRecordedVoiceoversService) { +angular.module('oppia').factory('TranslationTabActiveContentIdService', [ + '$rootScope', 'StateRecordedVoiceoversService', + function($rootScope, StateRecordedVoiceoversService) { var activeContentId = null; return { getActiveContentId: function() { diff --git a/core/templates/dev/head/pages/exploration-editor-page/translation-tab/services/translation-tab-active-mode.service.ts b/core/templates/dev/head/pages/exploration-editor-page/translation-tab/services/translation-tab-active-mode.service.ts index 5281e8f06da8..262ebca357c6 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/translation-tab/services/translation-tab-active-mode.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/translation-tab/services/translation-tab-active-mode.service.ts @@ -19,9 +19,7 @@ require('pages/exploration-editor-page/exploration-editor-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('TranslationTabActiveModeService', [ +angular.module('oppia').factory('TranslationTabActiveModeService', [ '$rootScope', 'TRANSLATION_MODE', 'VOICEOVER_MODE', function($rootScope, TRANSLATION_MODE, VOICEOVER_MODE) { var activeMode = null; diff --git a/core/templates/dev/head/pages/exploration-editor-page/translation-tab/services/voiceover-recording.service.ts b/core/templates/dev/head/pages/exploration-editor-page/translation-tab/services/voiceover-recording.service.ts index 06dedfaace5e..5f740c523a99 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/translation-tab/services/voiceover-recording.service.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/translation-tab/services/voiceover-recording.service.ts @@ -16,10 +16,8 @@ * @fileoverview Service for handling microphone data and mp3 audio processing. */ -var oppia = require('AppInit.ts').module; - -oppia.factory('VoiceoverRecordingService', ['$log', '$q', '$window', - function($log, $q, $window) { +angular.module('oppia').factory('VoiceoverRecordingService', [ + '$log', '$q', '$window', function($log, $q, $window) { var audioContextAvailable = null, defer = null, definedAudioContext = null, // Will be defined audio context diff --git a/core/templates/dev/head/pages/exploration-editor-page/translation-tab/state-translation-editor/state-translation-editor.directive.ts b/core/templates/dev/head/pages/exploration-editor-page/translation-tab/state-translation-editor/state-translation-editor.directive.ts index 29a9d8210362..b1c4198ed35b 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/translation-tab/state-translation-editor/state-translation-editor.directive.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/translation-tab/state-translation-editor/state-translation-editor.directive.ts @@ -16,9 +16,7 @@ * @fileoverview Directive for the state translation editor. */ -var oppia = require('AppInit.ts').module; - -oppia.directive('stateTranslationEditor', [ +angular.module('oppia').directive('stateTranslationEditor', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/exploration-editor-page/translation-tab/state-translation-status-graph/state-translation-status-graph.directive.ts b/core/templates/dev/head/pages/exploration-editor-page/translation-tab/state-translation-status-graph/state-translation-status-graph.directive.ts index 092d14055b32..ff063f4d7e11 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/translation-tab/state-translation-status-graph/state-translation-status-graph.directive.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/translation-tab/state-translation-status-graph/state-translation-status-graph.directive.ts @@ -39,9 +39,7 @@ require( 'components/state-editor/state-editor-properties-services/' + 'state-written-translations.service.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('stateTranslationStatusGraph', [ +angular.module('oppia').directive('stateTranslationStatusGraph', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/exploration-editor-page/translation-tab/state-translation/state-translation.directive.ts b/core/templates/dev/head/pages/exploration-editor-page/translation-tab/state-translation/state-translation.directive.ts index 21a43d0d90dd..9ee35fa59994 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/translation-tab/state-translation/state-translation.directive.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/translation-tab/state-translation/state-translation.directive.ts @@ -51,9 +51,7 @@ require( require('pages/exploration-editor-page/exploration-editor-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('stateTranslation', [ +angular.module('oppia').directive('stateTranslation', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/exploration-editor-page/translation-tab/translation-tab.directive.ts b/core/templates/dev/head/pages/exploration-editor-page/translation-tab/translation-tab.directive.ts index 4312842218cc..b22364b0125a 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/translation-tab/translation-tab.directive.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/translation-tab/translation-tab.directive.ts @@ -48,9 +48,7 @@ require( require('services/ContextService.ts'); require('services/EditabilityService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('translationTab', ['UrlInterpolationService', +angular.module('oppia').directive('translationTab', ['UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/exploration-editor-page/translation-tab/translator-overview/translator-overview.directive.ts b/core/templates/dev/head/pages/exploration-editor-page/translation-tab/translator-overview/translator-overview.directive.ts index 21d5fc13f953..01d89cd05461 100644 --- a/core/templates/dev/head/pages/exploration-editor-page/translation-tab/translator-overview/translator-overview.directive.ts +++ b/core/templates/dev/head/pages/exploration-editor-page/translation-tab/translator-overview/translator-overview.directive.ts @@ -28,9 +28,7 @@ require( require('pages/exploration-editor-page/exploration-editor-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('translatorOverview', [ +angular.module('oppia').directive('translatorOverview', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/exploration-player-page/exploration-player-page.constants.ts b/core/templates/dev/head/pages/exploration-player-page/exploration-player-page.constants.ts index f73768f70584..68d5aac7e522 100644 --- a/core/templates/dev/head/pages/exploration-player-page/exploration-player-page.constants.ts +++ b/core/templates/dev/head/pages/exploration-player-page/exploration-player-page.constants.ts @@ -16,51 +16,54 @@ * @fileoverview Constants to be used in the learner view. */ -var oppia = require('AppInit.ts').module; +angular.module('oppia').constant( + 'CONTENT_FOCUS_LABEL_PREFIX', 'content-focus-label-'); -oppia.constant('CONTENT_FOCUS_LABEL_PREFIX', 'content-focus-label-'); +angular.module('oppia').constant('TWO_CARD_THRESHOLD_PX', 960); -oppia.constant('TWO_CARD_THRESHOLD_PX', 960); - -oppia.constant('CONTINUE_BUTTON_FOCUS_LABEL', 'continueButton'); +angular.module('oppia').constant( + 'CONTINUE_BUTTON_FOCUS_LABEL', 'continueButton'); /* Called when a new audio-equippable component is loaded and displayed to the user, allowing for the automatic playing of audio if necessary. */ -oppia.constant('EVENT_AUTOPLAY_AUDIO', 'autoPlayAudio'); +angular.module('oppia').constant('EVENT_AUTOPLAY_AUDIO', 'autoPlayAudio'); // The enforced waiting period before the first hint request. -oppia.constant('WAIT_FOR_FIRST_HINT_MSEC', 60000); +angular.module('oppia').constant('WAIT_FOR_FIRST_HINT_MSEC', 60000); // The enforced waiting period before each of the subsequent hint requests. -oppia.constant('WAIT_FOR_SUBSEQUENT_HINTS_MSEC', 30000); +angular.module('oppia').constant('WAIT_FOR_SUBSEQUENT_HINTS_MSEC', 30000); // The time delay between the learner clicking the hint button // and the appearance of the hint. -oppia.constant('DELAY_FOR_HINT_FEEDBACK_MSEC', 100); +angular.module('oppia').constant('DELAY_FOR_HINT_FEEDBACK_MSEC', 100); // Array of i18n IDs for the possible hint request strings. -oppia.constant( +angular.module('oppia').constant( 'HINT_REQUEST_STRING_I18N_IDS', [ 'I18N_PLAYER_HINT_REQUEST_STRING_1', 'I18N_PLAYER_HINT_REQUEST_STRING_2', 'I18N_PLAYER_HINT_REQUEST_STRING_3']); /* This should match the CSS class defined in the tutor card directive. */ -oppia.constant( +angular.module('oppia').constant( 'AUDIO_HIGHLIGHT_CSS_CLASS', 'conversation-skin-audio-highlight'); -oppia.constant( +angular.module('oppia').constant( 'FLAG_EXPLORATION_URL_TEMPLATE', '/flagexplorationhandler/'); // TODO(bhenning): Find a better place for these constants. // NOTE TO DEVELOPERS: These constants must be the same (in name and value) as // the corresponding classification constants defined in core.domain.exp_domain. -oppia.constant('EXPLICIT_CLASSIFICATION', 'explicit'); -oppia.constant('TRAINING_DATA_CLASSIFICATION', 'training_data_match'); -oppia.constant('STATISTICAL_CLASSIFICATION', 'statistical_classifier'); -oppia.constant('DEFAULT_OUTCOME_CLASSIFICATION', 'default_outcome'); - -oppia.constant('EXPLORATION_MODE', { +angular.module('oppia').constant('EXPLICIT_CLASSIFICATION', 'explicit'); +angular.module('oppia').constant( + 'TRAINING_DATA_CLASSIFICATION', 'training_data_match'); +angular.module('oppia').constant( + 'STATISTICAL_CLASSIFICATION', 'statistical_classifier'); +angular.module('oppia').constant( + 'DEFAULT_OUTCOME_CLASSIFICATION', 'default_outcome'); + +angular.module('oppia').constant('EXPLORATION_MODE', { EXPLORATION: 'exploration', PRETEST: 'pretest', QUESTION_PLAYER: 'question_player', @@ -68,7 +71,7 @@ oppia.constant('EXPLORATION_MODE', { OTHER: 'other' }); -oppia.constant('STATS_EVENT_TYPES', { +angular.module('oppia').constant('STATS_EVENT_TYPES', { EVENT_TYPE_START_EXPLORATION: 'start', EVENT_TYPE_ACTUAL_START_EXPLORATION: 'actual_start', EVENT_TYPE_COMPLETE_EXPLORATION: 'complete', @@ -79,7 +82,7 @@ oppia.constant('STATS_EVENT_TYPES', { EVENT_TYPE_LEAVE_FOR_REFRESHER_EXP: 'leave_for_refresher_exp', }); -oppia.constant('STATS_REPORTING_URLS', { +angular.module('oppia').constant('STATS_REPORTING_URLS', { ANSWER_SUBMITTED: '/explorehandler/answer_submitted_event/', EXPLORATION_COMPLETED: ( '/explorehandler/exploration_complete_event/'), @@ -97,6 +100,6 @@ oppia.constant('STATS_REPORTING_URLS', { STATS_EVENTS: '/explorehandler/stats_events/' }); -oppia.constant('FEEDBACK_POPOVER_PATH', +angular.module('oppia').constant('FEEDBACK_POPOVER_PATH', '/pages/exploration-player-page/templates/' + 'feedback-popup-container.template.html'); diff --git a/core/templates/dev/head/pages/exploration-player-page/exploration-player-page.controller.ts b/core/templates/dev/head/pages/exploration-player-page/exploration-player-page.controller.ts index 0b2701b17ddc..20f46a8e4e5c 100644 --- a/core/templates/dev/head/pages/exploration-player-page/exploration-player-page.controller.ts +++ b/core/templates/dev/head/pages/exploration-player-page/exploration-player-page.controller.ts @@ -95,9 +95,7 @@ require('domain/exploration/ReadOnlyExplorationBackendApiService.ts'); require('services/ContextService.ts'); require('services/PageTitleService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('explorationPlayerPage', [ +angular.module('oppia').directive('explorationPlayerPage', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/exploration-player-page/exploration-player-page.scripts.ts b/core/templates/dev/head/pages/exploration-player-page/exploration-player-page.scripts.ts index 916a9f76bdc0..b2bf085a3e8b 100644 --- a/core/templates/dev/head/pages/exploration-player-page/exploration-player-page.scripts.ts +++ b/core/templates/dev/head/pages/exploration-player-page/exploration-player-page.scripts.ts @@ -16,6 +16,7 @@ * @fileoverview Directive scripts to be used in the learner view. */ +require('AppInit.ts'); require('App.ts'); require('pages/exploration-player-page/exploration-player-page.controller.ts'); diff --git a/core/templates/dev/head/pages/exploration-player-page/layout-directives/audio-bar.directive.ts b/core/templates/dev/head/pages/exploration-player-page/layout-directives/audio-bar.directive.ts index a72f56bf6000..94411e220e6a 100644 --- a/core/templates/dev/head/pages/exploration-player-page/layout-directives/audio-bar.directive.ts +++ b/core/templates/dev/head/pages/exploration-player-page/layout-directives/audio-bar.directive.ts @@ -33,9 +33,7 @@ require('services/AudioPlayerService.ts'); require('services/AutogeneratedAudioPlayerService.ts'); require('services/contextual/WindowDimensionsService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('audioBar', [ +angular.module('oppia').directive('audioBar', [ 'AudioPreloaderService', 'UrlInterpolationService', function(AudioPreloaderService, UrlInterpolationService) { return { diff --git a/core/templates/dev/head/pages/exploration-player-page/layout-directives/correctness-footer.directive.ts b/core/templates/dev/head/pages/exploration-player-page/layout-directives/correctness-footer.directive.ts index 18d30548db7e..e6ffd67a9f47 100644 --- a/core/templates/dev/head/pages/exploration-player-page/layout-directives/correctness-footer.directive.ts +++ b/core/templates/dev/head/pages/exploration-player-page/layout-directives/correctness-footer.directive.ts @@ -18,9 +18,7 @@ require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('correctnessFooter', [ +angular.module('oppia').directive('correctnessFooter', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/exploration-player-page/layout-directives/exploration-footer.directive.ts b/core/templates/dev/head/pages/exploration-player-page/layout-directives/exploration-footer.directive.ts index 2a303872f44a..acba89c22041 100644 --- a/core/templates/dev/head/pages/exploration-player-page/layout-directives/exploration-footer.directive.ts +++ b/core/templates/dev/head/pages/exploration-player-page/layout-directives/exploration-footer.directive.ts @@ -25,9 +25,7 @@ require('services/ContextService.ts'); require('services/contextual/UrlService.ts'); require('services/contextual/WindowDimensionsService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('explorationFooter', [ +angular.module('oppia').directive('explorationFooter', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/exploration-player-page/layout-directives/feedback-popup.directive.ts b/core/templates/dev/head/pages/exploration-player-page/layout-directives/feedback-popup.directive.ts index dc6a57b52972..a7a4fe7fa4f4 100644 --- a/core/templates/dev/head/pages/exploration-player-page/layout-directives/feedback-popup.directive.ts +++ b/core/templates/dev/head/pages/exploration-player-page/layout-directives/feedback-popup.directive.ts @@ -36,9 +36,7 @@ require('services/stateful/FocusManagerService.ts'); // // The state-name argument is optional. If it is not provided, the feedback is // assumed to apply to the exploration as a whole. -var oppia = require('AppInit.ts').module; - -oppia.directive('feedbackPopup', [ +angular.module('oppia').directive('feedbackPopup', [ 'ExplorationEngineService', 'UrlInterpolationService', function(ExplorationEngineService, UrlInterpolationService) { return { diff --git a/core/templates/dev/head/pages/exploration-player-page/layout-directives/learner-local-nav.directive.ts b/core/templates/dev/head/pages/exploration-player-page/layout-directives/learner-local-nav.directive.ts index d215b6a09cc2..45629acbca61 100644 --- a/core/templates/dev/head/pages/exploration-player-page/layout-directives/learner-local-nav.directive.ts +++ b/core/templates/dev/head/pages/exploration-player-page/layout-directives/learner-local-nav.directive.ts @@ -33,114 +33,113 @@ require('services/stateful/FocusManagerService.ts'); require('pages/exploration-player-page/exploration-player-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('learnerLocalNav', ['UrlInterpolationService', function( - UrlInterpolationService) { - return { - restrict: 'E', - scope: {}, - bindToController: {}, - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/exploration-player-page/layout-directives/' + - 'learner-local-nav.directive.html'), - controllerAs: '$ctrl', - controller: [ - '$http', '$rootScope', '$uibModal', 'AlertsService', - 'ExplorationEngineService', 'ExplorationPlayerStateService', - 'FocusManagerService', 'SuggestionModalForExplorationPlayerService', - 'UrlInterpolationService', 'UserService', 'FEEDBACK_POPOVER_PATH', - 'FLAG_EXPLORATION_URL_TEMPLATE', - function( - $http, $rootScope, $uibModal, AlertsService, - ExplorationEngineService, ExplorationPlayerStateService, - FocusManagerService, SuggestionModalForExplorationPlayerService, - UrlInterpolationService, UserService, FEEDBACK_POPOVER_PATH, - FLAG_EXPLORATION_URL_TEMPLATE) { - var ctrl = this; - ctrl.explorationId = ExplorationEngineService.getExplorationId(); - ctrl.canEdit = GLOBALS.canEdit; - ctrl.username = ''; - $rootScope.loadingMessage = 'Loading'; - UserService.getUserInfoAsync().then(function(userInfo) { - ctrl.username = userInfo.getUsername(); - $rootScope.loadingMessage = ''; - }); - - ctrl.getFeedbackPopoverUrl = function() { - return UrlInterpolationService.getDirectiveTemplateUrl( - FEEDBACK_POPOVER_PATH); - }; - - ctrl.showLearnerSuggestionModal = function() { - SuggestionModalForExplorationPlayerService.showSuggestionModal( - 'edit_exploration_state_content', {}); - }; - ctrl.showFlagExplorationModal = function() { - $uibModal.open({ - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/exploration-player-page/templates/' + - 'flag-exploration-modal.template.html'), - backdrop: true, - controller: [ - '$scope', '$uibModalInstance', 'PlayerPositionService', - function($scope, $uibModalInstance, PlayerPositionService) { - $scope.flagMessageTextareaIsShown = false; - var stateName = PlayerPositionService.getCurrentStateName(); - - $scope.showFlagMessageTextarea = function(value) { - if (value) { - $scope.flagMessageTextareaIsShown = true; - FocusManagerService.setFocus('flagMessageTextarea'); - } - }; +angular.module('oppia').directive('learnerLocalNav', [ + 'UrlInterpolationService', function( + UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: {}, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/exploration-player-page/layout-directives/' + + 'learner-local-nav.directive.html'), + controllerAs: '$ctrl', + controller: [ + '$http', '$rootScope', '$uibModal', 'AlertsService', + 'ExplorationEngineService', 'ExplorationPlayerStateService', + 'FocusManagerService', 'SuggestionModalForExplorationPlayerService', + 'UrlInterpolationService', 'UserService', 'FEEDBACK_POPOVER_PATH', + 'FLAG_EXPLORATION_URL_TEMPLATE', + function( + $http, $rootScope, $uibModal, AlertsService, + ExplorationEngineService, ExplorationPlayerStateService, + FocusManagerService, SuggestionModalForExplorationPlayerService, + UrlInterpolationService, UserService, FEEDBACK_POPOVER_PATH, + FLAG_EXPLORATION_URL_TEMPLATE) { + var ctrl = this; + ctrl.explorationId = ExplorationEngineService.getExplorationId(); + ctrl.canEdit = GLOBALS.canEdit; + ctrl.username = ''; + $rootScope.loadingMessage = 'Loading'; + UserService.getUserInfoAsync().then(function(userInfo) { + ctrl.username = userInfo.getUsername(); + $rootScope.loadingMessage = ''; + }); - $scope.submitReport = function() { - if ($scope.flagMessage) { - $uibModalInstance.close({ - report_type: $scope.flag, - report_text: $scope.flagMessage, - state: stateName - }); - } - }; + ctrl.getFeedbackPopoverUrl = function() { + return UrlInterpolationService.getDirectiveTemplateUrl( + FEEDBACK_POPOVER_PATH); + }; - $scope.cancel = function() { - $uibModalInstance.dismiss('cancel'); - }; - } - ] - }).result.then(function(result) { - var flagExplorationUrl = UrlInterpolationService.interpolateUrl( - FLAG_EXPLORATION_URL_TEMPLATE, { - exploration_id: ctrl.explorationId - } - ); - var report = ( - '[' + result.state + '] (' + result.report_type + ') ' + - result.report_text); - $http.post(flagExplorationUrl, { - report_text: report - }).error(function(error) { - AlertsService.addWarning(error); - }); + ctrl.showLearnerSuggestionModal = function() { + SuggestionModalForExplorationPlayerService.showSuggestionModal( + 'edit_exploration_state_content', {}); + }; + ctrl.showFlagExplorationModal = function() { $uibModal.open({ templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( '/pages/exploration-player-page/templates/' + - 'exploration-successfully-flagged-modal.template.html'), + 'flag-exploration-modal.template.html'), backdrop: true, controller: [ - '$scope', '$uibModalInstance', - function($scope, $uibModalInstance) { - $scope.close = function() { + '$scope', '$uibModalInstance', 'PlayerPositionService', + function($scope, $uibModalInstance, PlayerPositionService) { + $scope.flagMessageTextareaIsShown = false; + var stateName = PlayerPositionService.getCurrentStateName(); + + $scope.showFlagMessageTextarea = function(value) { + if (value) { + $scope.flagMessageTextareaIsShown = true; + FocusManagerService.setFocus('flagMessageTextarea'); + } + }; + + $scope.submitReport = function() { + if ($scope.flagMessage) { + $uibModalInstance.close({ + report_type: $scope.flag, + report_text: $scope.flagMessage, + state: stateName + }); + } + }; + + $scope.cancel = function() { $uibModalInstance.dismiss('cancel'); }; } ] + }).result.then(function(result) { + var flagExplorationUrl = UrlInterpolationService.interpolateUrl( + FLAG_EXPLORATION_URL_TEMPLATE, { + exploration_id: ctrl.explorationId + } + ); + var report = ( + '[' + result.state + '] (' + result.report_type + ') ' + + result.report_text); + $http.post(flagExplorationUrl, { + report_text: report + }).error(function(error) { + AlertsService.addWarning(error); + }); + $uibModal.open({ + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/exploration-player-page/templates/' + + 'exploration-successfully-flagged-modal.template.html'), + backdrop: true, + controller: [ + '$scope', '$uibModalInstance', + function($scope, $uibModalInstance) { + $scope.close = function() { + $uibModalInstance.dismiss('cancel'); + }; + } + ] + }); }); - }); - }; - } - ] - }; -}]); + }; + } + ] + }; + }]); diff --git a/core/templates/dev/head/pages/exploration-player-page/layout-directives/learner-view-info.directive.ts b/core/templates/dev/head/pages/exploration-player-page/layout-directives/learner-view-info.directive.ts index 82c508880264..54b5de08af51 100644 --- a/core/templates/dev/head/pages/exploration-player-page/layout-directives/learner-view-info.directive.ts +++ b/core/templates/dev/head/pages/exploration-player-page/layout-directives/learner-view-info.directive.ts @@ -29,138 +29,141 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/ContextService.ts'); require('services/DateTimeFormatService.ts'); -var oppia = require('AppInit.ts').module; +angular.module('oppia').directive('learnerViewInfo', [ + 'UrlInterpolationService', function( + UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: { + explorationTitle: '@' + }, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/exploration-player-page/layout-directives/' + + 'learner-view-info.directive.html'), + controllerAs: '$ctrl', + controller: [ + '$http', '$log', '$uibModal', 'ContextService', + 'UrlInterpolationService', 'DEFAULT_TWITTER_SHARE_MESSAGE_EDITOR', + 'EXPLORATION_SUMMARY_DATA_URL_TEMPLATE', + function($http, $log, $uibModal, ContextService, + UrlInterpolationService, DEFAULT_TWITTER_SHARE_MESSAGE_EDITOR, + EXPLORATION_SUMMARY_DATA_URL_TEMPLATE) { + var ctrl = this; + var explorationId = ContextService.getExplorationId(); + var expInfo = null; -oppia.directive('learnerViewInfo', ['UrlInterpolationService', function( - UrlInterpolationService) { - return { - restrict: 'E', - scope: {}, - bindToController: { - explorationTitle: '@' - }, - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/exploration-player-page/layout-directives/' + - 'learner-view-info.directive.html'), - controllerAs: '$ctrl', - controller: [ - '$http', '$log', '$uibModal', 'ContextService', - 'UrlInterpolationService', 'DEFAULT_TWITTER_SHARE_MESSAGE_EDITOR', - 'EXPLORATION_SUMMARY_DATA_URL_TEMPLATE', - function($http, $log, $uibModal, ContextService, - UrlInterpolationService, DEFAULT_TWITTER_SHARE_MESSAGE_EDITOR, - EXPLORATION_SUMMARY_DATA_URL_TEMPLATE) { - var ctrl = this; - var explorationId = ContextService.getExplorationId(); - var expInfo = null; - - ctrl.showInformationCard = function() { - if (expInfo) { - openInformationCardModal(); - } else { - $http.get(EXPLORATION_SUMMARY_DATA_URL_TEMPLATE, { - params: { - stringified_exp_ids: JSON.stringify([explorationId]), - include_private_explorations: JSON.stringify( - true) - } - }).then(function(response) { - expInfo = response.data.summaries[0]; + ctrl.showInformationCard = function() { + if (expInfo) { openInformationCardModal(); - }, function() { - $log.error( - 'Information card failed to load for exploration ' + - explorationId); - }); - } - }; + } else { + $http.get(EXPLORATION_SUMMARY_DATA_URL_TEMPLATE, { + params: { + stringified_exp_ids: JSON.stringify([explorationId]), + include_private_explorations: JSON.stringify( + true) + } + }).then(function(response) { + expInfo = response.data.summaries[0]; + openInformationCardModal(); + }, function() { + $log.error( + 'Information card failed to load for exploration ' + + explorationId); + }); + } + }; - var openInformationCardModal = function() { - $uibModal.open({ - animation: true, - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/exploration-player-page/templates/' + - 'information-card-modal.directive.html'), - windowClass: 'oppia-modal-information-card', - resolve: { - expInfo: function() { - return expInfo; - } - }, - controller: [ - '$scope', '$window', '$uibModalInstance', 'DateTimeFormatService', - 'RatingComputationService', 'expInfo', 'UrlInterpolationService', - function( - $scope, $window, $uibModalInstance, DateTimeFormatService, - RatingComputationService, expInfo, UrlInterpolationService) { - var getExplorationTagsSummary = function(arrayOfTags) { - var tagsToShow = []; - var tagsInTooltip = []; - var MAX_CHARS_TO_SHOW = 45; + var openInformationCardModal = function() { + $uibModal.open({ + animation: true, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/exploration-player-page/templates/' + + 'information-card-modal.directive.html'), + windowClass: 'oppia-modal-information-card', + resolve: { + expInfo: function() { + return expInfo; + } + }, + controller: [ + '$scope', '$uibModalInstance', + 'DateTimeFormatService', 'RatingComputationService', 'expInfo', + 'UrlInterpolationService', + function( + $scope, $uibModalInstance, + DateTimeFormatService, RatingComputationService, expInfo, + UrlInterpolationService) { + var getExplorationTagsSummary = function(arrayOfTags) { + var tagsToShow = []; + var tagsInTooltip = []; + var MAX_CHARS_TO_SHOW = 45; - for (var i = 0; i < arrayOfTags.length; i++) { - var newLength = ( - tagsToShow.toString() + arrayOfTags[i]).length; + for (var i = 0; i < arrayOfTags.length; i++) { + var newLength = ( + tagsToShow.toString() + arrayOfTags[i]).length; - if (newLength < MAX_CHARS_TO_SHOW) { - tagsToShow.push(arrayOfTags[i]); - } else { - tagsInTooltip.push(arrayOfTags[i]); + if (newLength < MAX_CHARS_TO_SHOW) { + tagsToShow.push(arrayOfTags[i]); + } else { + tagsInTooltip.push(arrayOfTags[i]); + } } - } - return { - tagsToShow: tagsToShow, - tagsInTooltip: tagsInTooltip + return { + tagsToShow: tagsToShow, + tagsInTooltip: tagsInTooltip + }; }; - }; - var getLastUpdatedString = function(millisSinceEpoch) { - return DateTimeFormatService - .getLocaleAbbreviatedDatetimeString( - millisSinceEpoch); - }; + var getLastUpdatedString = function(millisSinceEpoch) { + return DateTimeFormatService + .getLocaleAbbreviatedDatetimeString( + millisSinceEpoch); + }; - $scope.DEFAULT_TWITTER_SHARE_MESSAGE_PLAYER = ( - DEFAULT_TWITTER_SHARE_MESSAGE_EDITOR); - $scope.averageRating = ( - RatingComputationService.computeAverageRating( - expInfo.ratings)); - var contributorsSummary = ( - expInfo.human_readable_contributors_summary || {}); - $scope.contributorNames = Object.keys(contributorsSummary).sort( - function(contributorUsername1, contributorUsername2) { - var commitsOfContributor1 = contributorsSummary[ - contributorUsername1].num_commits; - var commitsOfContributor2 = contributorsSummary[ - contributorUsername2].num_commits; - return commitsOfContributor2 - commitsOfContributor1; - } - ); - $scope.explorationId = expInfo.id; - $scope.explorationTags = getExplorationTagsSummary( - expInfo.tags); - $scope.explorationTitle = expInfo.title; - $scope.infoCardBackgroundCss = { - 'background-color': expInfo.thumbnail_bg_color - }; - $scope.infoCardBackgroundImageUrl = expInfo.thumbnail_icon_url; - $scope.getStaticImageUrl = ( - UrlInterpolationService.getStaticImageUrl); - $scope.lastUpdatedString = getLastUpdatedString( - expInfo.last_updated_msec); - $scope.numViews = expInfo.num_views; - $scope.objective = expInfo.objective; - $scope.explorationIsPrivate = (expInfo.status === 'private'); + $scope.DEFAULT_TWITTER_SHARE_MESSAGE_PLAYER = ( + DEFAULT_TWITTER_SHARE_MESSAGE_EDITOR); + $scope.averageRating = ( + RatingComputationService.computeAverageRating( + expInfo.ratings)); + var contributorsSummary = ( + expInfo.human_readable_contributors_summary || {}); + $scope.contributorNames = Object.keys( + contributorsSummary).sort( + function(contributorUsername1, contributorUsername2) { + var commitsOfContributor1 = contributorsSummary[ + contributorUsername1].num_commits; + var commitsOfContributor2 = contributorsSummary[ + contributorUsername2].num_commits; + return commitsOfContributor2 - commitsOfContributor1; + } + ); + $scope.explorationId = expInfo.id; + $scope.explorationTags = getExplorationTagsSummary( + expInfo.tags); + $scope.explorationTitle = expInfo.title; + $scope.infoCardBackgroundCss = { + 'background-color': expInfo.thumbnail_bg_color + }; + $scope.infoCardBackgroundImageUrl = expInfo + .thumbnail_icon_url; + $scope.getStaticImageUrl = ( + UrlInterpolationService.getStaticImageUrl); + $scope.lastUpdatedString = getLastUpdatedString( + expInfo.last_updated_msec); + $scope.numViews = expInfo.num_views; + $scope.objective = expInfo.objective; + $scope.explorationIsPrivate = (expInfo.status === 'private'); - $scope.cancel = function() { - $uibModalInstance.dismiss(); - }; - } - ] - }); - }; - } - ] - }; -}]); + $scope.cancel = function() { + $uibModalInstance.dismiss(); + }; + } + ] + }); + }; + } + ] + }; + }]); diff --git a/core/templates/dev/head/pages/exploration-player-page/layout-directives/progress-nav.directive.ts b/core/templates/dev/head/pages/exploration-player-page/layout-directives/progress-nav.directive.ts index 4ebf7e797c8d..5d55d4d0841d 100644 --- a/core/templates/dev/head/pages/exploration-player-page/layout-directives/progress-nav.directive.ts +++ b/core/templates/dev/head/pages/exploration-player-page/layout-directives/progress-nav.directive.ts @@ -32,9 +32,7 @@ require('services/contextual/WindowDimensionsService.ts'); require('pages/exploration-player-page/exploration-player-page.constants.ts'); require('pages/interaction-specs.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('progressNav', [ +angular.module('oppia').directive('progressNav', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/exploration-player-page/learner-experience/continue-button.directive.ts b/core/templates/dev/head/pages/exploration-player-page/learner-experience/continue-button.directive.ts index 28b1b40abff0..c3a06c7981db 100644 --- a/core/templates/dev/head/pages/exploration-player-page/learner-experience/continue-button.directive.ts +++ b/core/templates/dev/head/pages/exploration-player-page/learner-experience/continue-button.directive.ts @@ -19,9 +19,7 @@ require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('continueButton', [ +angular.module('oppia').directive('continueButton', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/exploration-player-page/learner-experience/conversation-skin.directive.ts b/core/templates/dev/head/pages/exploration-player-page/learner-experience/conversation-skin.directive.ts index 7a273a7cc67c..906abc5d322c 100644 --- a/core/templates/dev/head/pages/exploration-player-page/learner-experience/conversation-skin.directive.ts +++ b/core/templates/dev/head/pages/exploration-player-page/learner-experience/conversation-skin.directive.ts @@ -102,79 +102,49 @@ var TIME_HEIGHT_CHANGE_MSEC = 500; var TIME_FADEIN_MSEC = 100; var TIME_NUM_CARDS_CHANGE_MSEC = 500; -var oppia = require('AppInit.ts').module; - -oppia.animation('.conversation-skin-animate-tutor-card-on-narrow', function() { - var tutorCardLeft, tutorCardWidth, tutorCardHeight, oppiaAvatarLeft; - var tutorCardAnimatedLeft, tutorCardAnimatedWidth; - - var beforeAddClass = function(element, className, done) { - if (className !== 'ng-hide') { - done(); - return; - } - var tutorCard = element; - var supplementalCard = $('.conversation-skin-supplemental-card-container'); - var oppiaAvatar = $('.conversation-skin-oppia-avatar.show-tutor-card'); - oppiaAvatarLeft = supplementalCard.position().left + - supplementalCard.width() - oppiaAvatar.width(); - tutorCardLeft = tutorCard.position().left; - tutorCardWidth = tutorCard.width(); - tutorCardHeight = tutorCard.height(); - - if (tutorCard.offset().left + tutorCardWidth > oppiaAvatar.offset().left) { - var animationLength = Math.min( - oppiaAvatarLeft - tutorCard.offset().left, - tutorCardWidth); - tutorCardAnimatedLeft = tutorCardLeft + animationLength; - tutorCardAnimatedWidth = tutorCardWidth - animationLength; - } else { - tutorCardAnimatedLeft = oppiaAvatarLeft; - tutorCardAnimatedWidth = 0; - } - - oppiaAvatar.hide(); - tutorCard.css({ - 'min-width': 0 - }); - tutorCard.animate({ - left: tutorCardAnimatedLeft, - width: tutorCardAnimatedWidth, - height: 0, - opacity: 1 - }, 500, function() { - oppiaAvatar.show(); +angular.module('oppia').animation( + '.conversation-skin-animate-tutor-card-on-narrow', function() { + var tutorCardLeft, tutorCardWidth, tutorCardHeight, oppiaAvatarLeft; + var tutorCardAnimatedLeft, tutorCardAnimatedWidth; + + var beforeAddClass = function(element, className, done) { + if (className !== 'ng-hide') { + done(); + return; + } + var tutorCard = element; + var supplementalCard = + $('.conversation-skin-supplemental-card-container'); + var oppiaAvatar = $('.conversation-skin-oppia-avatar.show-tutor-card'); + oppiaAvatarLeft = supplementalCard.position().left + + supplementalCard.width() - oppiaAvatar.width(); + tutorCardLeft = tutorCard.position().left; + tutorCardWidth = tutorCard.width(); + tutorCardHeight = tutorCard.height(); + + if ( + tutorCard.offset().left + tutorCardWidth > oppiaAvatar.offset().left) { + var animationLength = Math.min( + oppiaAvatarLeft - tutorCard.offset().left, + tutorCardWidth); + tutorCardAnimatedLeft = tutorCardLeft + animationLength; + tutorCardAnimatedWidth = tutorCardWidth - animationLength; + } else { + tutorCardAnimatedLeft = oppiaAvatarLeft; + tutorCardAnimatedWidth = 0; + } + + oppiaAvatar.hide(); tutorCard.css({ - left: '', - width: '', - height: '', - opacity: '', - 'min-width': '' + 'min-width': 0 }); - done(); - }); - }; - - var removeClass = function(element, className, done) { - if (className !== 'ng-hide') { - done(); - return; - } - var tutorCard = element; - $('.conversation-skin-oppia-avatar.show-tutor-card').hide(0, function() { - tutorCard.css({ + tutorCard.animate({ left: tutorCardAnimatedLeft, width: tutorCardAnimatedWidth, height: 0, - opacity: 0, - 'min-width': 0 - }); - tutorCard.animate({ - left: tutorCardLeft, - width: tutorCardWidth, - height: tutorCardHeight, opacity: 1 }, 500, function() { + oppiaAvatar.show(); tutorCard.css({ left: '', width: '', @@ -184,135 +154,168 @@ oppia.animation('.conversation-skin-animate-tutor-card-on-narrow', function() { }); done(); }); - }); - }; - - return { - beforeAddClass: beforeAddClass, - removeClass: removeClass - }; -}); - -oppia.animation('.conversation-skin-animate-tutor-card-content', function() { - var animateCardChange = function(element, className, done) { - if (className !== 'animate-card-change') { - return; - } - - var currentHeight = element.height(); - var expectedNextHeight = $( - '.conversation-skin-future-tutor-card ' + - '.oppia-learner-view-card-content' - ).height(); - - // Fix the current card height, so that it does not change during the - // animation, even though its contents might. - element.css('height', currentHeight); - - jQuery(element).animate({ - opacity: 0 - }, TIME_FADEOUT_MSEC).animate({ - height: expectedNextHeight - }, TIME_HEIGHT_CHANGE_MSEC).animate({ - opacity: 1 - }, TIME_FADEIN_MSEC, function() { - element.css('height', ''); - done(); - }); - - return function(cancel) { - if (cancel) { - element.css('opacity', '1.0'); - element.css('height', ''); - element.stop(); - } }; - }; - - return { - addClass: animateCardChange - }; -}); - -oppia.animation('.conversation-skin-animate-cards', function() { - // This removes the newly-added class once the animation is finished. - var animateCards = function(element, className, done) { - var tutorCardElt = jQuery(element).find( - '.conversation-skin-main-tutor-card'); - var supplementalCardElt = jQuery(element).find( - '.conversation-skin-supplemental-card-container'); - - if (className === 'animate-to-two-cards') { - var supplementalWidth = supplementalCardElt.width(); - supplementalCardElt.css({ - width: 0, - 'min-width': '0', - opacity: '0' - }); - supplementalCardElt.animate({ - width: supplementalWidth - }, TIME_NUM_CARDS_CHANGE_MSEC, function() { - supplementalCardElt.animate({ - opacity: '1' - }, TIME_FADEIN_MSEC, function() { - supplementalCardElt.css({ + + var removeClass = function(element, className, done) { + if (className !== 'ng-hide') { + done(); + return; + } + var tutorCard = element; + $('.conversation-skin-oppia-avatar.show-tutor-card').hide(0, function() { + tutorCard.css({ + left: tutorCardAnimatedLeft, + width: tutorCardAnimatedWidth, + height: 0, + opacity: 0, + 'min-width': 0 + }); + tutorCard.animate({ + left: tutorCardLeft, + width: tutorCardWidth, + height: tutorCardHeight, + opacity: 1 + }, 500, function() { + tutorCard.css({ + left: '', width: '', - 'min-width': '', - opacity: '' + height: '', + opacity: '', + 'min-width': '' }); - jQuery(element).removeClass('animate-to-two-cards'); done(); }); }); + }; - return function(cancel) { - if (cancel) { - supplementalCardElt.css({ - width: '', - 'min-width': '', - opacity: '' - }); - supplementalCardElt.stop(); - jQuery(element).removeClass('animate-to-two-cards'); - } - }; - } else if (className === 'animate-to-one-card') { - supplementalCardElt.css({ - opacity: 0, - 'min-width': 0 - }); - supplementalCardElt.animate({ - width: 0 - }, TIME_NUM_CARDS_CHANGE_MSEC, function() { - jQuery(element).removeClass('animate-to-one-card'); + return { + beforeAddClass: beforeAddClass, + removeClass: removeClass + }; + }); + +angular.module('oppia').animation( + '.conversation-skin-animate-tutor-card-content', function() { + var animateCardChange = function(element, className, done) { + if (className !== 'animate-card-change') { + return; + } + + var currentHeight = element.height(); + var expectedNextHeight = $( + '.conversation-skin-future-tutor-card ' + + '.oppia-learner-view-card-content' + ).height(); + + // Fix the current card height, so that it does not change during the + // animation, even though its contents might. + element.css('height', currentHeight); + + jQuery(element).animate({ + opacity: 0 + }, TIME_FADEOUT_MSEC).animate({ + height: expectedNextHeight + }, TIME_HEIGHT_CHANGE_MSEC).animate({ + opacity: 1 + }, TIME_FADEIN_MSEC, function() { + element.css('height', ''); done(); }); return function(cancel) { if (cancel) { - supplementalCardElt.css({ - opacity: '', - 'min-width': '', - width: '' + element.css('opacity', '1.0'); + element.css('height', ''); + element.stop(); + } + }; + }; + + return { + addClass: animateCardChange + }; + }); + +angular.module('oppia').animation( + '.conversation-skin-animate-cards', function() { + // This removes the newly-added class once the animation is finished. + var animateCards = function(element, className, done) { + var tutorCardElt = jQuery(element).find( + '.conversation-skin-main-tutor-card'); + var supplementalCardElt = jQuery(element).find( + '.conversation-skin-supplemental-card-container'); + + if (className === 'animate-to-two-cards') { + var supplementalWidth = supplementalCardElt.width(); + supplementalCardElt.css({ + width: 0, + 'min-width': '0', + opacity: '0' + }); + supplementalCardElt.animate({ + width: supplementalWidth + }, TIME_NUM_CARDS_CHANGE_MSEC, function() { + supplementalCardElt.animate({ + opacity: '1' + }, TIME_FADEIN_MSEC, function() { + supplementalCardElt.css({ + width: '', + 'min-width': '', + opacity: '' + }); + jQuery(element).removeClass('animate-to-two-cards'); + done(); }); - supplementalCardElt.stop(); + }); + return function(cancel) { + if (cancel) { + supplementalCardElt.css({ + width: '', + 'min-width': '', + opacity: '' + }); + supplementalCardElt.stop(); + jQuery(element).removeClass('animate-to-two-cards'); + } + }; + } else if (className === 'animate-to-one-card') { + supplementalCardElt.css({ + opacity: 0, + 'min-width': 0 + }); + supplementalCardElt.animate({ + width: 0 + }, TIME_NUM_CARDS_CHANGE_MSEC, function() { jQuery(element).removeClass('animate-to-one-card'); - } - }; - } else { - return; - } - }; - - return { - addClass: animateCards - }; -}); - -oppia.directive('conversationSkin', [ - 'UrlInterpolationService', 'UrlService', 'UserService', - function(UrlInterpolationService, UrlService, UserService) { + done(); + }); + + return function(cancel) { + if (cancel) { + supplementalCardElt.css({ + opacity: '', + 'min-width': '', + width: '' + }); + supplementalCardElt.stop(); + + jQuery(element).removeClass('animate-to-one-card'); + } + }; + } else { + return; + } + }; + + return { + addClass: animateCards + }; + }); + +angular.module('oppia').directive('conversationSkin', [ + 'UrlInterpolationService', 'UrlService', + function(UrlInterpolationService, UrlService) { return { restrict: 'E', scope: { diff --git a/core/templates/dev/head/pages/exploration-player-page/learner-experience/input-response-pair.directive.ts b/core/templates/dev/head/pages/exploration-player-page/learner-experience/input-response-pair.directive.ts index cbfd09af6825..da3fc3f76bf2 100644 --- a/core/templates/dev/head/pages/exploration-player-page/learner-experience/input-response-pair.directive.ts +++ b/core/templates/dev/head/pages/exploration-player-page/learner-experience/input-response-pair.directive.ts @@ -30,9 +30,7 @@ require('services/ExplorationHtmlFormatterService.ts'); require('pages/interaction-specs.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('inputResponsePair', [ +angular.module('oppia').directive('inputResponsePair', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/exploration-player-page/learner-experience/supplemental-card.directive.ts b/core/templates/dev/head/pages/exploration-player-page/learner-experience/supplemental-card.directive.ts index bcd619bc7e09..3968418aa201 100644 --- a/core/templates/dev/head/pages/exploration-player-page/learner-experience/supplemental-card.directive.ts +++ b/core/templates/dev/head/pages/exploration-player-page/learner-experience/supplemental-card.directive.ts @@ -29,9 +29,7 @@ require('services/contextual/WindowDimensionsService.ts'); require('pages/exploration-player-page/exploration-player-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('supplementalCard', [ +angular.module('oppia').directive('supplementalCard', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/exploration-player-page/learner-experience/tutor-card.directive.ts b/core/templates/dev/head/pages/exploration-player-page/learner-experience/tutor-card.directive.ts index 00f204b6154c..307d9e87431c 100644 --- a/core/templates/dev/head/pages/exploration-player-page/learner-experience/tutor-card.directive.ts +++ b/core/templates/dev/head/pages/exploration-player-page/learner-experience/tutor-card.directive.ts @@ -45,28 +45,27 @@ require('services/contextual/WindowDimensionsService.ts'); require('pages/exploration-player-page/exploration-player-page.constants.ts'); require('pages/interaction-specs.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.animation('.conversation-skin-responses-animate-slide', function() { - return { - removeClass: function(element, className, done) { - if (className !== 'ng-hide') { - done(); - return; - } - element.hide().slideDown(400, <(this: HTMLElement) => void>done); - }, - addClass: function(element, className, done) { - if (className !== 'ng-hide') { - done(); - return; +angular.module('oppia').animation( + '.conversation-skin-responses-animate-slide', function() { + return { + removeClass: function(element, className, done) { + if (className !== 'ng-hide') { + done(); + return; + } + element.hide().slideDown(400, <(this: HTMLElement) => void>done); + }, + addClass: function(element, className, done) { + if (className !== 'ng-hide') { + done(); + return; + } + element.slideUp(400, <(this: HTMLElement) => void>done); } - element.slideUp(400, <(this: HTMLElement) => void>done); - } - }; -}); + }; + }); -oppia.directive('tutorCard', [ +angular.module('oppia').directive('tutorCard', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', @@ -127,7 +126,8 @@ oppia.directive('tutorCard', [ $scope.getDisplayedCard().getInteractionInstructions()); $scope.contentAudioTranslations = ( $scope.getDisplayedCard().getVoiceovers()); - AudioTranslationManagerService.clearSecondaryAudioTranslations(); + AudioTranslationManagerService + .clearSecondaryAudioTranslations(); AudioTranslationManagerService.setContentAudioTranslations( angular.copy($scope.contentAudioTranslations), $scope.getDisplayedCard().getContentHtml(), @@ -187,7 +187,7 @@ oppia.directive('tutorCard', [ $scope.toggleShowPreviousResponses = function() { $scope.arePreviousResponsesShown = - !$scope.arePreviousResponsesShown; + !$scope.arePreviousResponsesShown; }; $scope.isWindowNarrow = function() { @@ -237,8 +237,8 @@ oppia.directive('tutorCard', [ var latestFeedbackIndex = ( $scope.getDisplayedCard().getInputResponsePairs().length - 1); /* Reference: https://stackoverflow.com/questions/40134381 - $anchorScroll() without changing actual hash value of url works - only when written inside a timeout of 0 ms. */ + $anchorScroll() without changing actual hash value of url + works only when written inside a timeout of 0 ms. */ $anchorScroll.yOffset = 80; $location.hash( $scope.getInputResponsePairId(latestFeedbackIndex)); diff --git a/core/templates/dev/head/pages/exploration-player-page/services/answer-classification.service.ts b/core/templates/dev/head/pages/exploration-player-page/services/answer-classification.service.ts index ca3fcaaeb912..7d5bd868d258 100644 --- a/core/templates/dev/head/pages/exploration-player-page/services/answer-classification.service.ts +++ b/core/templates/dev/head/pages/exploration-player-page/services/answer-classification.service.ts @@ -27,9 +27,7 @@ require('services/AlertsService.ts'); require('pages/exploration-player-page/exploration-player-page.constants.ts'); require('pages/interaction-specs.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('AnswerClassificationService', [ +angular.module('oppia').factory('AnswerClassificationService', [ 'AlertsService', 'AnswerClassificationResultObjectFactory', 'PredictionAlgorithmRegistryService', 'StateClassifierMappingService', 'DEFAULT_OUTCOME_CLASSIFICATION', 'ENABLE_ML_CLASSIFIERS', diff --git a/core/templates/dev/head/pages/exploration-player-page/services/audio-preloader.service.ts b/core/templates/dev/head/pages/exploration-player-page/services/audio-preloader.service.ts index 392a817d9c8d..3135c4ab7f82 100644 --- a/core/templates/dev/head/pages/exploration-player-page/services/audio-preloader.service.ts +++ b/core/templates/dev/head/pages/exploration-player-page/services/audio-preloader.service.ts @@ -25,15 +25,11 @@ require('services/AssetsBackendApiService.ts'); require('services/ComputeGraphService.ts'); require('services/ContextService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('AudioPreloaderService', [ - '$uibModal', 'AssetsBackendApiService', 'AudioTranslationLanguageService', +angular.module('oppia').factory('AudioPreloaderService', [ + 'AssetsBackendApiService', 'AudioTranslationLanguageService', 'ComputeGraphService', 'ContextService', - 'LanguageUtilService', 'UrlInterpolationService', - function($uibModal, AssetsBackendApiService, AudioTranslationLanguageService, - ComputeGraphService, ContextService, - LanguageUtilService, UrlInterpolationService) { + function(AssetsBackendApiService, AudioTranslationLanguageService, + ComputeGraphService, ContextService) { var MAX_NUM_AUDIO_FILES_TO_DOWNLOAD_SIMULTANEOUSLY = 3; var _filenamesOfAudioCurrentlyDownloading = []; diff --git a/core/templates/dev/head/pages/exploration-player-page/services/audio-translation-language.service.ts b/core/templates/dev/head/pages/exploration-player-page/services/audio-translation-language.service.ts index ad3b0164fd8e..3ba8faf4f16d 100644 --- a/core/templates/dev/head/pages/exploration-player-page/services/audio-translation-language.service.ts +++ b/core/templates/dev/head/pages/exploration-player-page/services/audio-translation-language.service.ts @@ -20,9 +20,7 @@ require('domain/utilities/BrowserCheckerService.ts'); require('domain/utilities/LanguageUtilService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('AudioTranslationLanguageService', [ +angular.module('oppia').factory('AudioTranslationLanguageService', [ 'BrowserCheckerService', 'LanguageUtilService', function( BrowserCheckerService, LanguageUtilService) { diff --git a/core/templates/dev/head/pages/exploration-player-page/services/audio-translation-manager.service.ts b/core/templates/dev/head/pages/exploration-player-page/services/audio-translation-manager.service.ts index 935812f466e3..571c69e131bc 100644 --- a/core/templates/dev/head/pages/exploration-player-page/services/audio-translation-manager.service.ts +++ b/core/templates/dev/head/pages/exploration-player-page/services/audio-translation-manager.service.ts @@ -87,8 +87,6 @@ export class AudioTranslationManagerService { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'AudioTranslationManagerService', downgradeInjectable(AudioTranslationManagerService)); diff --git a/core/templates/dev/head/pages/exploration-player-page/services/current-interaction.service.ts b/core/templates/dev/head/pages/exploration-player-page/services/current-interaction.service.ts index b88a5f37cc12..b8e397751973 100644 --- a/core/templates/dev/head/pages/exploration-player-page/services/current-interaction.service.ts +++ b/core/templates/dev/head/pages/exploration-player-page/services/current-interaction.service.ts @@ -30,9 +30,7 @@ require( 'state-property.service.ts'); require('services/ContextService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('CurrentInteractionService', [ +angular.module('oppia').factory('CurrentInteractionService', [ 'ContextService', 'StateEditorService', 'StateInteractionIdService', function( ContextService, StateEditorService, StateInteractionIdService) { var _submitAnswerFn = null; diff --git a/core/templates/dev/head/pages/exploration-player-page/services/exploration-engine.service.ts b/core/templates/dev/head/pages/exploration-player-page/services/exploration-engine.service.ts index b67c86ec4f88..f9cbdcbecca0 100644 --- a/core/templates/dev/head/pages/exploration-player-page/services/exploration-engine.service.ts +++ b/core/templates/dev/head/pages/exploration-player-page/services/exploration-engine.service.ts @@ -52,34 +52,20 @@ require('pages/interaction-specs.constants.ts'); // The URL determines which of these it is. Some methods may need to be // implemented differently depending on whether the skin is being played // in the learner view, or whether it is being previewed in the editor view. -var oppia = require('AppInit.ts').module; - -oppia.factory('ExplorationEngineService', [ - '$http', '$q', '$rootScope', 'AlertsService', 'AnswerClassificationService', +angular.module('oppia').factory('ExplorationEngineService', [ + '$rootScope', 'AlertsService', 'AnswerClassificationService', 'AudioPreloaderService', 'AudioTranslationLanguageService', 'ContextService', - 'EditableExplorationBackendApiService', 'ExplorationHtmlFormatterService', - 'ExplorationObjectFactory', 'ExpressionInterpolationService', - 'FocusManagerService', 'GuestCollectionProgressService', - 'ImagePreloaderService', 'LanguageUtilService', 'LearnerParamsService', - 'NumberAttemptsService', 'PlayerTranscriptService', - 'ReadOnlyExplorationBackendApiService', 'StateCardObjectFactory', - 'StateClassifierMappingService', 'StatsReportingService', - 'UrlInterpolationService', 'UserService', 'WindowDimensionsService', - 'DEFAULT_PROFILE_IMAGE_PATH', 'INTERACTION_SPECS', 'PAGE_CONTEXT', - 'WHITELISTED_COLLECTION_IDS_FOR_SAVING_GUEST_PROGRESS', + 'ExplorationHtmlFormatterService', 'ExplorationObjectFactory', + 'ExpressionInterpolationService', 'FocusManagerService', + 'ImagePreloaderService', 'LearnerParamsService', 'PlayerTranscriptService', + 'StateCardObjectFactory', 'StatsReportingService', function( - $http, $q, $rootScope, AlertsService, AnswerClassificationService, + $rootScope, AlertsService, AnswerClassificationService, AudioPreloaderService, AudioTranslationLanguageService, ContextService, - EditableExplorationBackendApiService, ExplorationHtmlFormatterService, - ExplorationObjectFactory, ExpressionInterpolationService, - FocusManagerService, GuestCollectionProgressService, - ImagePreloaderService, LanguageUtilService, LearnerParamsService, - NumberAttemptsService, PlayerTranscriptService, - ReadOnlyExplorationBackendApiService, StateCardObjectFactory, - StateClassifierMappingService, StatsReportingService, - UrlInterpolationService, UserService, WindowDimensionsService, - DEFAULT_PROFILE_IMAGE_PATH, INTERACTION_SPECS, PAGE_CONTEXT, - WHITELISTED_COLLECTION_IDS_FOR_SAVING_GUEST_PROGRESS) { + ExplorationHtmlFormatterService, ExplorationObjectFactory, + ExpressionInterpolationService, FocusManagerService, + ImagePreloaderService, LearnerParamsService, PlayerTranscriptService, + StateCardObjectFactory, StatsReportingService) { var _explorationId = ContextService.getExplorationId(); var _editorPreviewMode = ContextService.isInExplorationEditorPage(); var answerIsBeingProcessed = false; diff --git a/core/templates/dev/head/pages/exploration-player-page/services/exploration-player-state.service.ts b/core/templates/dev/head/pages/exploration-player-page/services/exploration-player-state.service.ts index e78261243fff..97710b18fca1 100644 --- a/core/templates/dev/head/pages/exploration-player-page/services/exploration-player-state.service.ts +++ b/core/templates/dev/head/pages/exploration-player-page/services/exploration-player-state.service.ts @@ -39,25 +39,23 @@ require('services/contextual/UrlService.ts'); require('pages/exploration-player-page/exploration-player-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ExplorationPlayerStateService', [ - '$log', '$q', '$rootScope', 'ContextService', +angular.module('oppia').factory('ExplorationPlayerStateService', [ + '$q', '$rootScope', 'ContextService', 'EditableExplorationBackendApiService', 'ExplorationEngineService', 'ExplorationFeaturesBackendApiService', 'ExplorationFeaturesService', 'NumberAttemptsService', - 'PlayerCorrectnessFeedbackEnabledService', 'PlayerPositionService', + 'PlayerCorrectnessFeedbackEnabledService', 'PlayerTranscriptService', 'PlaythroughIssuesService', 'PlaythroughService', 'PretestQuestionBackendApiService', 'QuestionBackendApiService', 'QuestionPlayerEngineService', 'ReadOnlyExplorationBackendApiService', 'StateClassifierMappingService', 'StatsReportingService', 'UrlService', 'EXPLORATION_MODE', function( - $log, $q, $rootScope, ContextService, + $q, $rootScope, ContextService, EditableExplorationBackendApiService, ExplorationEngineService, ExplorationFeaturesBackendApiService, ExplorationFeaturesService, NumberAttemptsService, - PlayerCorrectnessFeedbackEnabledService, PlayerPositionService, + PlayerCorrectnessFeedbackEnabledService, PlayerTranscriptService, PlaythroughIssuesService, PlaythroughService, PretestQuestionBackendApiService, QuestionBackendApiService, QuestionPlayerEngineService, diff --git a/core/templates/dev/head/pages/exploration-player-page/services/exploration-recommendations.service.ts b/core/templates/dev/head/pages/exploration-player-page/services/exploration-recommendations.service.ts index 80a32f594b99..1719ff43f070 100644 --- a/core/templates/dev/head/pages/exploration-player-page/services/exploration-recommendations.service.ts +++ b/core/templates/dev/head/pages/exploration-player-page/services/exploration-recommendations.service.ts @@ -20,9 +20,7 @@ require('services/ContextService.ts'); require('services/contextual/UrlService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ExplorationRecommendationsService', [ +angular.module('oppia').factory('ExplorationRecommendationsService', [ '$http', 'ContextService', 'UrlService', 'EXPLORATION_EDITOR_TAB_CONTEXT', 'PAGE_CONTEXT', function( diff --git a/core/templates/dev/head/pages/exploration-player-page/services/extract-image-filenames-from-state.service.ts b/core/templates/dev/head/pages/exploration-player-page/services/extract-image-filenames-from-state.service.ts index 5842e1101937..18169af3ff81 100644 --- a/core/templates/dev/head/pages/exploration-player-page/services/extract-image-filenames-from-state.service.ts +++ b/core/templates/dev/head/pages/exploration-player-page/services/extract-image-filenames-from-state.service.ts @@ -18,9 +18,7 @@ require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ExtractImageFilenamesFromStateService', [ +angular.module('oppia').factory('ExtractImageFilenamesFromStateService', [ 'HtmlEscaperService', function(HtmlEscaperService) { var INTERACTION_TYPE_MULTIPLE_CHOICE = 'MultipleChoiceInput'; var INTERACTION_TYPE_ITEM_SELECTION = 'ItemSelectionInput'; diff --git a/core/templates/dev/head/pages/exploration-player-page/services/fatigue-detection.service.ts b/core/templates/dev/head/pages/exploration-player-page/services/fatigue-detection.service.ts index 43d8d7ff51e0..c4e327d413a7 100644 --- a/core/templates/dev/head/pages/exploration-player-page/services/fatigue-detection.service.ts +++ b/core/templates/dev/head/pages/exploration-player-page/services/fatigue-detection.service.ts @@ -18,9 +18,7 @@ require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('FatigueDetectionService', [ +angular.module('oppia').factory('FatigueDetectionService', [ '$uibModal', 'UrlInterpolationService', function($uibModal, UrlInterpolationService) { // 4 submissions in under 10 seconds triggers modal. diff --git a/core/templates/dev/head/pages/exploration-player-page/services/hint-and-solution-modal.service.ts b/core/templates/dev/head/pages/exploration-player-page/services/hint-and-solution-modal.service.ts index dad818af65d4..4499496772e6 100644 --- a/core/templates/dev/head/pages/exploration-player-page/services/hint-and-solution-modal.service.ts +++ b/core/templates/dev/head/pages/exploration-player-page/services/hint-and-solution-modal.service.ts @@ -31,9 +31,7 @@ require('services/AutogeneratedAudioPlayerService.ts'); require('pages/exploration-player-page/exploration-player-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('HintAndSolutionModalService', [ +angular.module('oppia').factory('HintAndSolutionModalService', [ '$uibModal', 'AudioPlayerService', 'AudioTranslationManagerService', 'AutogeneratedAudioPlayerService', diff --git a/core/templates/dev/head/pages/exploration-player-page/services/hints-and-solution-manager.service.ts b/core/templates/dev/head/pages/exploration-player-page/services/hints-and-solution-manager.service.ts index 8f06557635ac..59944b20ea5a 100644 --- a/core/templates/dev/head/pages/exploration-player-page/services/hints-and-solution-manager.service.ts +++ b/core/templates/dev/head/pages/exploration-player-page/services/hints-and-solution-manager.service.ts @@ -18,18 +18,12 @@ require('pages/exploration-player-page/exploration-player-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('HintsAndSolutionManagerService', [ - '$rootScope', '$timeout', - 'DELAY_FOR_HINT_FEEDBACK_MSEC', 'EVENT_NEW_CARD_AVAILABLE', - 'HINT_REQUEST_STRING_I18N_IDS', 'WAIT_FOR_FIRST_HINT_MSEC', - 'WAIT_FOR_SUBSEQUENT_HINTS_MSEC', +angular.module('oppia').factory('HintsAndSolutionManagerService', [ + '$rootScope', '$timeout', 'EVENT_NEW_CARD_AVAILABLE', + 'WAIT_FOR_FIRST_HINT_MSEC', 'WAIT_FOR_SUBSEQUENT_HINTS_MSEC', function( - $rootScope, $timeout, - DELAY_FOR_HINT_FEEDBACK_MSEC, EVENT_NEW_CARD_AVAILABLE, - HINT_REQUEST_STRING_I18N_IDS, WAIT_FOR_FIRST_HINT_MSEC, - WAIT_FOR_SUBSEQUENT_HINTS_MSEC) { + $rootScope, $timeout, EVENT_NEW_CARD_AVAILABLE, + WAIT_FOR_FIRST_HINT_MSEC, WAIT_FOR_SUBSEQUENT_HINTS_MSEC) { var timeout = null; var ACCELERATED_HINT_WAIT_TIME_MSEC = 10000; var WAIT_FOR_TOOLTIP_TO_BE_SHOWN_MSEC = 60000; diff --git a/core/templates/dev/head/pages/exploration-player-page/services/image-preloader.service.ts b/core/templates/dev/head/pages/exploration-player-page/services/image-preloader.service.ts index c29c9578def4..75728552fd63 100644 --- a/core/templates/dev/head/pages/exploration-player-page/services/image-preloader.service.ts +++ b/core/templates/dev/head/pages/exploration-player-page/services/image-preloader.service.ts @@ -24,15 +24,11 @@ require('services/AssetsBackendApiService.ts'); require('services/ComputeGraphService.ts'); require('services/ContextService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ImagePreloaderService', [ - '$q', '$uibModal', 'AssetsBackendApiService', 'ComputeGraphService', +angular.module('oppia').factory('ImagePreloaderService', [ + '$q', 'AssetsBackendApiService', 'ComputeGraphService', 'ContextService', 'ExtractImageFilenamesFromStateService', - 'UrlInterpolationService', - function($q, $uibModal, AssetsBackendApiService, ComputeGraphService, - ContextService, ExtractImageFilenamesFromStateService, - UrlInterpolationService) { + function($q, AssetsBackendApiService, ComputeGraphService, + ContextService, ExtractImageFilenamesFromStateService) { var MAX_NUM_IMAGE_FILES_TO_DOWNLOAD_SIMULTANEOUSLY = 3; var _filenamesOfImageCurrentlyDownloading = []; diff --git a/core/templates/dev/head/pages/exploration-player-page/services/learner-params.service.ts b/core/templates/dev/head/pages/exploration-player-page/services/learner-params.service.ts index fae93ac4159c..3b181663776b 100644 --- a/core/templates/dev/head/pages/exploration-player-page/services/learner-params.service.ts +++ b/core/templates/dev/head/pages/exploration-player-page/services/learner-params.service.ts @@ -65,7 +65,5 @@ export class LearnerParamsService { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'LearnerParamsService', downgradeInjectable(LearnerParamsService)); diff --git a/core/templates/dev/head/pages/exploration-player-page/services/learner-view-rating.service.ts b/core/templates/dev/head/pages/exploration-player-page/services/learner-view-rating.service.ts index 60dbef463f7c..f82c82f2a892 100644 --- a/core/templates/dev/head/pages/exploration-player-page/services/learner-view-rating.service.ts +++ b/core/templates/dev/head/pages/exploration-player-page/services/learner-view-rating.service.ts @@ -18,9 +18,7 @@ require('pages/exploration-player-page/services/exploration-engine.service.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('LearnerViewRatingService', [ +angular.module('oppia').factory('LearnerViewRatingService', [ '$http', '$rootScope', 'ExplorationEngineService', function($http, $rootScope, ExplorationEngineService) { var explorationId = ExplorationEngineService.getExplorationId(); diff --git a/core/templates/dev/head/pages/exploration-player-page/services/number-attempts.service.ts b/core/templates/dev/head/pages/exploration-player-page/services/number-attempts.service.ts index cdb2ceada462..7f70cf42acf4 100644 --- a/core/templates/dev/head/pages/exploration-player-page/services/number-attempts.service.ts +++ b/core/templates/dev/head/pages/exploration-player-page/services/number-attempts.service.ts @@ -37,7 +37,5 @@ export class NumberAttemptsService { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'NumberAttemptsService', downgradeInjectable(NumberAttemptsService)); diff --git a/core/templates/dev/head/pages/exploration-player-page/services/player-correctness-feedback-enabled.service.ts b/core/templates/dev/head/pages/exploration-player-page/services/player-correctness-feedback-enabled.service.ts index 16f091cf6769..ff64b4311cf9 100644 --- a/core/templates/dev/head/pages/exploration-player-page/services/player-correctness-feedback-enabled.service.ts +++ b/core/templates/dev/head/pages/exploration-player-page/services/player-correctness-feedback-enabled.service.ts @@ -40,8 +40,6 @@ export class PlayerCorrectnessFeedbackEnabledService { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'PlayerCorrectnessFeedbackEnabledService', downgradeInjectable(PlayerCorrectnessFeedbackEnabledService)); diff --git a/core/templates/dev/head/pages/exploration-player-page/services/player-position.service.ts b/core/templates/dev/head/pages/exploration-player-page/services/player-position.service.ts index a27c972c0312..be2c1705d78c 100644 --- a/core/templates/dev/head/pages/exploration-player-page/services/player-position.service.ts +++ b/core/templates/dev/head/pages/exploration-player-page/services/player-position.service.ts @@ -19,9 +19,7 @@ require('pages/exploration-player-page/services/player-transcript.service.ts'); require('services/ContextService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('PlayerPositionService', [ +angular.module('oppia').factory('PlayerPositionService', [ 'ContextService', 'PlayerTranscriptService', function( ContextService, PlayerTranscriptService) { var displayedCardIndex = null; diff --git a/core/templates/dev/head/pages/exploration-player-page/services/player-transcript.service.ts b/core/templates/dev/head/pages/exploration-player-page/services/player-transcript.service.ts index f3297c28e31d..72a511a47dd2 100644 --- a/core/templates/dev/head/pages/exploration-player-page/services/player-transcript.service.ts +++ b/core/templates/dev/head/pages/exploration-player-page/services/player-transcript.service.ts @@ -22,10 +22,8 @@ require('domain/state_card/StateCardObjectFactory.ts'); // are shown, what answers have been given, etc. Note that this service does // not maintain the currently-active card -- it's more like a log of what the // learner has 'discovered' so far. -var oppia = require('AppInit.ts').module; - -oppia.factory('PlayerTranscriptService', [ - '$log', 'StateCardObjectFactory', function($log, StateCardObjectFactory) { +angular.module('oppia').factory('PlayerTranscriptService', [ + '$log', function($log) { // Each element of this array represents a 'StateCard' domain object. // // Note that every card in this transcript is visible on the screen. The diff --git a/core/templates/dev/head/pages/exploration-player-page/services/prediction-algorithm-registry.service.ts b/core/templates/dev/head/pages/exploration-player-page/services/prediction-algorithm-registry.service.ts index a8c22f8bdc15..707c1b3af572 100644 --- a/core/templates/dev/head/pages/exploration-player-page/services/prediction-algorithm-registry.service.ts +++ b/core/templates/dev/head/pages/exploration-player-page/services/prediction-algorithm-registry.service.ts @@ -16,9 +16,7 @@ * @fileoverview Service for mapping algorithmId to PredictionAlgorithmService. */ -var oppia = require('AppInit.ts').module; - -oppia.factory('PredictionAlgorithmRegistryService', [ +angular.module('oppia').factory('PredictionAlgorithmRegistryService', [ '$injector', function($injector) { /** * This mapping needs to be updated whenever a new prediction service needs diff --git a/core/templates/dev/head/pages/exploration-player-page/services/question-player-engine.service.ts b/core/templates/dev/head/pages/exploration-player-page/services/question-player-engine.service.ts index efe0e30c8085..76c8bff2aa30 100644 --- a/core/templates/dev/head/pages/exploration-player-page/services/question-player-engine.service.ts +++ b/core/templates/dev/head/pages/exploration-player-page/services/question-player-engine.service.ts @@ -29,16 +29,14 @@ require('services/stateful/FocusManagerService.ts'); require('pages/exploration-player-page/exploration-player-page.constants.ts'); require('pages/interaction-specs.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('QuestionPlayerEngineService', [ - '$http', '$q', '$rootScope', 'AlertsService', 'AnswerClassificationService', +angular.module('oppia').factory('QuestionPlayerEngineService', [ + 'AlertsService', 'AnswerClassificationService', 'ContextService', 'ExplorationHtmlFormatterService', 'ExpressionInterpolationService', 'FocusManagerService', 'QuestionObjectFactory', 'StateCardObjectFactory', 'INTERACTION_DISPLAY_MODE_INLINE', 'INTERACTION_SPECS', function( - $http, $q, $rootScope, AlertsService, AnswerClassificationService, + AlertsService, AnswerClassificationService, ContextService, ExplorationHtmlFormatterService, ExpressionInterpolationService, FocusManagerService, QuestionObjectFactory, StateCardObjectFactory, diff --git a/core/templates/dev/head/pages/exploration-player-page/services/refresher-exploration-confirmation-modal.service.ts b/core/templates/dev/head/pages/exploration-player-page/services/refresher-exploration-confirmation-modal.service.ts index b68c85973942..697e7317ab37 100644 --- a/core/templates/dev/head/pages/exploration-player-page/services/refresher-exploration-confirmation-modal.service.ts +++ b/core/templates/dev/head/pages/exploration-player-page/services/refresher-exploration-confirmation-modal.service.ts @@ -21,64 +21,65 @@ require('domain/utilities/UrlInterpolationService.ts'); require('pages/exploration-player-page/services/exploration-engine.service.ts'); require('services/contextual/UrlService.ts'); -var oppia = require('AppInit.ts').module; +angular.module('oppia').factory( + 'RefresherExplorationConfirmationModalService', [ + '$uibModal', 'ExplorationEngineService', 'UrlInterpolationService', + 'UrlService', + function( + $uibModal, ExplorationEngineService, UrlInterpolationService, + UrlService) { + return { + displayRedirectConfirmationModal: function( + refresherExplorationId, redirectConfirmationCallback) { + $uibModal.open({ + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/exploration-player-page/templates/' + + 'refresher-exploration-confirmation-modal.template.html'), + backdrop: 'static', + controller: [ + '$scope', '$uibModalInstance', '$window', '$timeout', + function($scope, $uibModalInstance, $window, $timeout) { + $scope.confirmRedirect = function() { + redirectConfirmationCallback(); -oppia.factory('RefresherExplorationConfirmationModalService', [ - '$uibModal', 'ExplorationEngineService', 'UrlInterpolationService', - 'UrlService', - function($uibModal, ExplorationEngineService, UrlInterpolationService, - UrlService) { - return { - displayRedirectConfirmationModal: function( - refresherExplorationId, redirectConfirmationCallback) { - $uibModal.open({ - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/exploration-player-page/templates/' + - 'refresher-exploration-confirmation-modal.template.html'), - backdrop: 'static', - controller: [ - '$scope', '$uibModalInstance', '$window', '$timeout', - function($scope, $uibModalInstance, $window, $timeout) { - $scope.confirmRedirect = function() { - redirectConfirmationCallback(); + var collectionId = UrlService.getUrlParams().collection_id; + var parentIdList = UrlService.getQueryFieldValuesAsList( + 'parent'); + var EXPLORATION_URL_TEMPLATE = '/explore/'; + var url = UrlInterpolationService.interpolateUrl( + EXPLORATION_URL_TEMPLATE, { + exploration_id: refresherExplorationId + }); + if (collectionId) { + url = UrlService.addField( + url, 'collection_id', collectionId); + } + for (var i = 0; i < parentIdList.length; i++) { + url = UrlService.addField(url, 'parent', parentIdList[i]); + } + url = UrlService.addField( + url, 'parent', ExplorationEngineService.getExplorationId()); - var collectionId = UrlService.getUrlParams().collection_id; - var parentIdList = UrlService.getQueryFieldValuesAsList( - 'parent'); - var EXPLORATION_URL_TEMPLATE = '/explore/'; - var url = UrlInterpolationService.interpolateUrl( - EXPLORATION_URL_TEMPLATE, { - exploration_id: refresherExplorationId - }); - if (collectionId) { - url = UrlService.addField(url, 'collection_id', collectionId); - } - for (var i = 0; i < parentIdList.length; i++) { - url = UrlService.addField(url, 'parent', parentIdList[i]); - } - url = UrlService.addField( - url, 'parent', ExplorationEngineService.getExplorationId()); + // Wait a little before redirecting the page to ensure other + // tasks started here (e.g. event recording) have sufficient + // time to complete. + // TODO(bhenning): Find a reliable way to send events that + // does not get interrupted with browser redirection. + $timeout(function() { + $window.open(url, '_self'); + }, 150); - // Wait a little before redirecting the page to ensure other - // tasks started here (e.g. event recording) have sufficient - // time to complete. - // TODO(bhenning): Find a reliable way to send events that does - // not get interrupted with browser redirection. - $timeout(function() { - $window.open(url, '_self'); - }, 150); - - // Close the dialog to ensure the confirmation cannot be called - // multiple times. - $uibModalInstance.close(); - }; - $scope.cancelRedirect = function() { - $uibModalInstance.dismiss('cancel'); - }; - } - ] - }); - } - }; - } -]); + // Close the dialog to ensure the confirmation cannot be + // called multiple times. + $uibModalInstance.close(); + }; + $scope.cancelRedirect = function() { + $uibModalInstance.dismiss('cancel'); + }; + } + ] + }); + } + }; + } + ]); diff --git a/core/templates/dev/head/pages/exploration-player-page/services/state-classifier-mapping.service.ts b/core/templates/dev/head/pages/exploration-player-page/services/state-classifier-mapping.service.ts index 112695c01f50..ecea19eaf9c2 100644 --- a/core/templates/dev/head/pages/exploration-player-page/services/state-classifier-mapping.service.ts +++ b/core/templates/dev/head/pages/exploration-player-page/services/state-classifier-mapping.service.ts @@ -18,9 +18,7 @@ require('domain/classifier/ClassifierObjectFactory.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('StateClassifierMappingService', [ +angular.module('oppia').factory('StateClassifierMappingService', [ 'ClassifierObjectFactory', function(ClassifierObjectFactory) { var stateClassifierMapping = null; diff --git a/core/templates/dev/head/pages/exploration-player-page/services/stats-reporting.service.ts b/core/templates/dev/head/pages/exploration-player-page/services/stats-reporting.service.ts index 148c2d5deced..6f553b26f16e 100644 --- a/core/templates/dev/head/pages/exploration-player-page/services/stats-reporting.service.ts +++ b/core/templates/dev/head/pages/exploration-player-page/services/stats-reporting.service.ts @@ -27,18 +27,14 @@ require('services/SiteAnalyticsService.ts'); require('pages/exploration-player-page/exploration-player-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('StatsReportingService', [ +angular.module('oppia').factory('StatsReportingService', [ '$http', '$interval', 'ContextService', 'MessengerService', 'PlaythroughService', 'SiteAnalyticsService', 'StopwatchObjectFactory', - 'UrlInterpolationService', 'DEFAULT_OUTCOME_CLASSIFICATION', - 'PAGE_CONTEXT', 'STATS_EVENT_TYPES', 'STATS_REPORTING_URLS', + 'UrlInterpolationService', 'STATS_REPORTING_URLS', function( $http, $interval, ContextService, MessengerService, PlaythroughService, SiteAnalyticsService, StopwatchObjectFactory, - UrlInterpolationService, DEFAULT_OUTCOME_CLASSIFICATION, - PAGE_CONTEXT, STATS_EVENT_TYPES, STATS_REPORTING_URLS) { + UrlInterpolationService, STATS_REPORTING_URLS) { var explorationId = null; var explorationTitle = null; var explorationVersion = null; diff --git a/core/templates/dev/head/pages/exploration-player-page/suggestion-modal-for-learner-local-view/suggestion-modal-for-exploration-player.service.ts b/core/templates/dev/head/pages/exploration-player-page/suggestion-modal-for-learner-local-view/suggestion-modal-for-exploration-player.service.ts index 060d9cdf8ebc..63dbf96f609b 100644 --- a/core/templates/dev/head/pages/exploration-player-page/suggestion-modal-for-learner-local-view/suggestion-modal-for-exploration-player.service.ts +++ b/core/templates/dev/head/pages/exploration-player-page/suggestion-modal-for-learner-local-view/suggestion-modal-for-exploration-player.service.ts @@ -23,9 +23,7 @@ require('pages/exploration-player-page/services/player-transcript.service.ts'); require('services/AlertsService.ts'); require('services/SuggestionModalService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('SuggestionModalForExplorationPlayerService', [ +angular.module('oppia').factory('SuggestionModalForExplorationPlayerService', [ '$http', '$uibModal', 'AlertsService', 'UrlInterpolationService', function($http, $uibModal, AlertsService, UrlInterpolationService) { var _templateUrl = UrlInterpolationService.getDirectiveTemplateUrl( diff --git a/core/templates/dev/head/pages/get-started-page/get-started-page.scripts.ts b/core/templates/dev/head/pages/get-started-page/get-started-page.scripts.ts index bbbbf4fcb946..beb0db1832e2 100644 --- a/core/templates/dev/head/pages/get-started-page/get-started-page.scripts.ts +++ b/core/templates/dev/head/pages/get-started-page/get-started-page.scripts.ts @@ -16,6 +16,7 @@ * @fileoverview File to import necessary scripts for get_started page. */ +require('AppInit.ts'); require('App.ts'); require('base_components/BaseContentDirective.ts'); diff --git a/core/templates/dev/head/pages/interaction-specs.constants.ts b/core/templates/dev/head/pages/interaction-specs.constants.ts index 264923565e0b..83c63b131b16 100644 --- a/core/templates/dev/head/pages/interaction-specs.constants.ts +++ b/core/templates/dev/head/pages/interaction-specs.constants.ts @@ -16,6 +16,5 @@ * @fileoverview Constant file for the INTERACTION_SPECS constant. */ -var oppia = require('AppInit.ts').module; - -oppia.constant('INTERACTION_SPECS', GLOBALS.INTERACTION_SPECS); +angular.module('oppia').constant( + 'INTERACTION_SPECS', GLOBALS.INTERACTION_SPECS); diff --git a/core/templates/dev/head/pages/landing-pages/stewards-landing-page/stewards-landing-page.controller.ts b/core/templates/dev/head/pages/landing-pages/stewards-landing-page/stewards-landing-page.controller.ts index 23a6b7427e7c..3405c42bd86c 100644 --- a/core/templates/dev/head/pages/landing-pages/stewards-landing-page/stewards-landing-page.controller.ts +++ b/core/templates/dev/head/pages/landing-pages/stewards-landing-page/stewards-landing-page.controller.ts @@ -23,131 +23,130 @@ require('services/SiteAnalyticsService.ts'); require('services/contextual/UrlService.ts'); require('services/contextual/WindowDimensionsService.ts'); -var oppia = require('AppInit.ts').module; +angular.module('oppia').directive('stewardsLandingPage', [ + 'UrlInterpolationService', function(UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: {}, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/landing-pages/stewards-landing-page/' + + 'stewards-landing-page.directive.html'), + controllerAs: '$ctrl', + controller: [ + '$scope', '$timeout', '$window', 'SiteAnalyticsService', + 'UrlInterpolationService', 'UrlService', 'WindowDimensionsService', + function( + $scope, $timeout, $window, SiteAnalyticsService, + UrlInterpolationService, UrlService, WindowDimensionsService) { + var ctrl = this; + ctrl.TAB_NAME_PARENTS = 'Parents'; + ctrl.TAB_NAME_TEACHERS = 'Teachers'; + ctrl.TAB_NAME_NONPROFITS = 'NGOs'; + ctrl.TAB_NAME_VOLUNTEERS = 'Volunteers'; + + var URL_PATTERNS_TO_TAB_NAMES = { + '/parents': ctrl.TAB_NAME_PARENTS, + '/teachers': ctrl.TAB_NAME_TEACHERS, + '/partners': ctrl.TAB_NAME_NONPROFITS, + '/nonprofits': ctrl.TAB_NAME_NONPROFITS, + '/volunteers': ctrl.TAB_NAME_VOLUNTEERS + }; + + ctrl.setActiveTabName = function(newActiveTabName) { + ctrl.activeTabName = newActiveTabName; + ctrl.buttonDefinitions = getButtonDefinitions(newActiveTabName); + }; + + ctrl.isActiveTab = function(tabName) { + return ctrl.activeTabName === tabName; + }; + + ctrl.getActiveTabNameInSingularForm = function() { + if (ctrl.activeTabName === ctrl.TAB_NAME_PARENTS) { + return 'Parent'; + } else if (ctrl.activeTabName === ctrl.TAB_NAME_TEACHERS) { + return 'Teacher'; + } else if (ctrl.activeTabName === ctrl.TAB_NAME_NONPROFITS) { + return 'Nonprofit'; + } else if (ctrl.activeTabName === ctrl.TAB_NAME_VOLUNTEERS) { + return 'Volunteer'; + } else { + throw Error('Invalid active tab name: ' + ctrl.activeTabName); + } + }; + + var getButtonDefinitions = function(tabName) { + if (tabName === ctrl.TAB_NAME_PARENTS || + tabName === ctrl.TAB_NAME_TEACHERS) { + return [{ + text: 'Browse Lessons', + href: '/library' + }, { + text: 'Subscribe to our Newsletter', + href: 'https://tinyletter.com/oppia' + }]; + } else if (tabName === ctrl.TAB_NAME_NONPROFITS) { + return [{ + text: 'Get Involved', + href: ( + 'https://www.oppiafoundation.org/partnerships#get-in-touch') + }, { + text: 'Browse Lessons', + href: '/library' + }]; + } else if (tabName === ctrl.TAB_NAME_VOLUNTEERS) { + // TODO(sll): Add "Get in Touch" link that points to contact form. + return [{ + text: 'Browse Volunteer Opportunities', + href: 'https://www.oppiafoundation.org/volunteer' + }]; + } else { + throw Error('Invalid tab name: ' + tabName); + } + }; + + ctrl.getStaticImageUrl = UrlInterpolationService.getStaticImageUrl; + + ctrl.getStaticSubjectImageUrl = function(subjectName) { + return UrlInterpolationService.getStaticImageUrl('/subjects/' + + subjectName + '.svg'); + }; + + ctrl.onClickButton = function(buttonDefinition) { + SiteAnalyticsService.registerStewardsLandingPageEvent( + ctrl.activeTabName, buttonDefinition.text); + $timeout(function() { + $window.location = buttonDefinition.href; + }, 150); + }; + + // Note: This should be kept in sync with the CSS media query on + // stewards-landing-page.mainpage.html. + var isWindowNarrow = function(windowWidthPx) { + return windowWidthPx <= 890; + }; -oppia.directive('stewardsLandingPage', ['UrlInterpolationService', function( - UrlInterpolationService) { - return { - restrict: 'E', - scope: {}, - bindToController: {}, - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/landing-pages/stewards-landing-page/' + - 'stewards-landing-page.directive.html'), - controllerAs: '$ctrl', - controller: [ - '$scope', '$timeout', '$window', 'SiteAnalyticsService', - 'UrlInterpolationService', 'UrlService', 'WindowDimensionsService', - function( - $scope, $timeout, $window, SiteAnalyticsService, - UrlInterpolationService, UrlService, WindowDimensionsService) { - var ctrl = this; - ctrl.TAB_NAME_PARENTS = 'Parents'; - ctrl.TAB_NAME_TEACHERS = 'Teachers'; - ctrl.TAB_NAME_NONPROFITS = 'NGOs'; - ctrl.TAB_NAME_VOLUNTEERS = 'Volunteers'; - - var URL_PATTERNS_TO_TAB_NAMES = { - '/parents': ctrl.TAB_NAME_PARENTS, - '/teachers': ctrl.TAB_NAME_TEACHERS, - '/partners': ctrl.TAB_NAME_NONPROFITS, - '/nonprofits': ctrl.TAB_NAME_NONPROFITS, - '/volunteers': ctrl.TAB_NAME_VOLUNTEERS - }; - - ctrl.setActiveTabName = function(newActiveTabName) { - ctrl.activeTabName = newActiveTabName; - ctrl.buttonDefinitions = getButtonDefinitions(newActiveTabName); - }; - - ctrl.isActiveTab = function(tabName) { - return ctrl.activeTabName === tabName; - }; - - ctrl.getActiveTabNameInSingularForm = function() { - if (ctrl.activeTabName === ctrl.TAB_NAME_PARENTS) { - return 'Parent'; - } else if (ctrl.activeTabName === ctrl.TAB_NAME_TEACHERS) { - return 'Teacher'; - } else if (ctrl.activeTabName === ctrl.TAB_NAME_NONPROFITS) { - return 'Nonprofit'; - } else if (ctrl.activeTabName === ctrl.TAB_NAME_VOLUNTEERS) { - return 'Volunteer'; - } else { - throw Error('Invalid active tab name: ' + ctrl.activeTabName); - } - }; - - var getButtonDefinitions = function(tabName) { - if (tabName === ctrl.TAB_NAME_PARENTS || - tabName === ctrl.TAB_NAME_TEACHERS) { - return [{ - text: 'Browse Lessons', - href: '/library' - }, { - text: 'Subscribe to our Newsletter', - href: 'https://tinyletter.com/oppia' - }]; - } else if (tabName === ctrl.TAB_NAME_NONPROFITS) { - return [{ - text: 'Get Involved', - href: 'https://www.oppiafoundation.org/partnerships#get-in-touch' - }, { - text: 'Browse Lessons', - href: '/library' - }]; - } else if (tabName === ctrl.TAB_NAME_VOLUNTEERS) { - // TODO(sll): Add "Get in Touch" link that points to contact form. - return [{ - text: 'Browse Volunteer Opportunities', - href: 'https://www.oppiafoundation.org/volunteer' - }]; - } else { - throw Error('Invalid tab name: ' + tabName); - } - }; - - ctrl.getStaticImageUrl = UrlInterpolationService.getStaticImageUrl; - - ctrl.getStaticSubjectImageUrl = function(subjectName) { - return UrlInterpolationService.getStaticImageUrl('/subjects/' + - subjectName + '.svg'); - }; - - ctrl.onClickButton = function(buttonDefinition) { - SiteAnalyticsService.registerStewardsLandingPageEvent( - ctrl.activeTabName, buttonDefinition.text); - $timeout(function() { - $window.location = buttonDefinition.href; - }, 150); - }; - - // Note: This should be kept in sync with the CSS media query on - // stewards-landing-page.mainpage.html. - var isWindowNarrow = function(windowWidthPx) { - return windowWidthPx <= 890; - }; - - ctrl.windowIsNarrow = isWindowNarrow( - WindowDimensionsService.getWidth()); - WindowDimensionsService.registerOnResizeHook(function() { ctrl.windowIsNarrow = isWindowNarrow( WindowDimensionsService.getWidth()); - $scope.$apply(); - }); - - // Set the initial tab name based on the URL; default to - // TAB_NAME_PARENTS. - var initialPathname = UrlService.getPathname(); - ctrl.activeTabName = ctrl.TAB_NAME_PARENTS; - for (var urlPattern in URL_PATTERNS_TO_TAB_NAMES) { - if (initialPathname.indexOf(urlPattern) === 0) { - ctrl.activeTabName = URL_PATTERNS_TO_TAB_NAMES[urlPattern]; - break; + WindowDimensionsService.registerOnResizeHook(function() { + ctrl.windowIsNarrow = isWindowNarrow( + WindowDimensionsService.getWidth()); + $scope.$apply(); + }); + + // Set the initial tab name based on the URL; default to + // TAB_NAME_PARENTS. + var initialPathname = UrlService.getPathname(); + ctrl.activeTabName = ctrl.TAB_NAME_PARENTS; + for (var urlPattern in URL_PATTERNS_TO_TAB_NAMES) { + if (initialPathname.indexOf(urlPattern) === 0) { + ctrl.activeTabName = URL_PATTERNS_TO_TAB_NAMES[urlPattern]; + break; + } } + ctrl.buttonDefinitions = getButtonDefinitions(ctrl.activeTabName); } - ctrl.buttonDefinitions = getButtonDefinitions(ctrl.activeTabName); - } - ] - }; -}]); + ] + }; + }]); diff --git a/core/templates/dev/head/pages/landing-pages/stewards-landing-page/stewards-landing-page.scripts.ts b/core/templates/dev/head/pages/landing-pages/stewards-landing-page/stewards-landing-page.scripts.ts index 2b366079c89d..7d9670e394fa 100644 --- a/core/templates/dev/head/pages/landing-pages/stewards-landing-page/stewards-landing-page.scripts.ts +++ b/core/templates/dev/head/pages/landing-pages/stewards-landing-page/stewards-landing-page.scripts.ts @@ -16,6 +16,7 @@ * @fileoverview Directive scripts for the stewards landing page. */ +require('AppInit.ts'); require('App.ts'); require( diff --git a/core/templates/dev/head/pages/landing-pages/topic-landing-page/topic-landing-page.constants.ts b/core/templates/dev/head/pages/landing-pages/topic-landing-page/topic-landing-page.constants.ts index b42c9a4589ee..b723257341db 100644 --- a/core/templates/dev/head/pages/landing-pages/topic-landing-page/topic-landing-page.constants.ts +++ b/core/templates/dev/head/pages/landing-pages/topic-landing-page/topic-landing-page.constants.ts @@ -18,9 +18,7 @@ // Note: This oppia constant needs to be keep in sync with // AVAILABLE_LANDING_PAGES constant defined in feconf.py file. -var oppia = require('AppInit.ts').module; - -oppia.constant('TOPIC_LANDING_PAGE_DATA', { +angular.module('oppia').constant('TOPIC_LANDING_PAGE_DATA', { maths: { fractions: { topic_title: 'Fractions', diff --git a/core/templates/dev/head/pages/landing-pages/topic-landing-page/topic-landing-page.controller.ts b/core/templates/dev/head/pages/landing-pages/topic-landing-page/topic-landing-page.controller.ts index fb1f1bdad511..99c4fef26486 100644 --- a/core/templates/dev/head/pages/landing-pages/topic-landing-page/topic-landing-page.controller.ts +++ b/core/templates/dev/head/pages/landing-pages/topic-landing-page/topic-landing-page.controller.ts @@ -30,97 +30,95 @@ require('services/SiteAnalyticsService.ts'); require( 'pages/landing-pages/topic-landing-page/topic-landing-page.constants.ts'); -var oppia = require('AppInit.ts').module; +angular.module('oppia').directive('topicLandingPage', [ + 'UrlInterpolationService', function(UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: {}, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/landing-pages/topic-landing-page/' + + 'topic-landing-page.directive.html'), + controllerAs: '$ctrl', + controller: [ + '$filter', '$timeout', '$window', 'PageTitleService', + 'SiteAnalyticsService', 'UrlInterpolationService', + 'TOPIC_LANDING_PAGE_DATA', + function( + $filter, $timeout, $window, PageTitleService, + SiteAnalyticsService, UrlInterpolationService, + TOPIC_LANDING_PAGE_DATA) { + var ctrl = this; + var pathArray = $window.location.pathname.split('/'); + ctrl.subject = pathArray[2]; + var topic = pathArray[3]; + var topicData = TOPIC_LANDING_PAGE_DATA[ctrl.subject][topic]; + var landingPageData = topicData.page_data; + var assetsPathFormat = '/landing///'; + ctrl.topicTitle = topicData.topic_title; + ctrl.lessons = landingPageData.lessons; + var pageTitle = 'Learn ' + ctrl.topicTitle + ' - Oppia'; + PageTitleService.setPageTitle(pageTitle); + ctrl.bookImageUrl = UrlInterpolationService.getStaticImageUrl( + '/splash/books.svg'); -oppia.directive('topicLandingPage', ['UrlInterpolationService', function( - UrlInterpolationService) { - return { - restrict: 'E', - scope: {}, - bindToController: {}, - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/landing-pages/topic-landing-page/' + - 'topic-landing-page.directive.html'), - controllerAs: '$ctrl', - controller: [ - '$filter', '$timeout', '$window', 'PageTitleService', - 'SiteAnalyticsService', 'UrlInterpolationService', - 'TOPIC_LANDING_PAGE_DATA', - function( - $filter, $timeout, $window, PageTitleService, - SiteAnalyticsService, UrlInterpolationService, - TOPIC_LANDING_PAGE_DATA) { - var ctrl = this; - var pathArray = $window.location.pathname.split('/'); - ctrl.subject = pathArray[2]; - var topic = pathArray[3]; - var topicData = TOPIC_LANDING_PAGE_DATA[ctrl.subject][topic]; - var landingPageData = topicData.page_data; - var assetsPathFormat = '/landing///'; - ctrl.topicTitle = topicData.topic_title; - ctrl.lessons = landingPageData.lessons; - var pageTitle = 'Learn ' + ctrl.topicTitle + ' - Oppia'; - PageTitleService.setPageTitle(pageTitle); - ctrl.bookImageUrl = UrlInterpolationService.getStaticImageUrl( - '/splash/books.svg'); + var getImageData = function(index) { + var imageKey = 'image_' + index; + if (landingPageData[imageKey]) { + var imagePath = UrlInterpolationService.interpolateUrl( + angular.copy(assetsPathFormat), { + subject: ctrl.subject, + topic: topic, + file_name: landingPageData[imageKey].file_name + }); + return { + src: UrlInterpolationService.getStaticImageUrl(imagePath), + alt: landingPageData[imageKey].alt + }; + } + }; - var getImageData = function(index) { - var imageKey = 'image_' + index; - if (landingPageData[imageKey]) { - var imagePath = UrlInterpolationService.interpolateUrl( - angular.copy(assetsPathFormat), { - subject: ctrl.subject, - topic: topic, - file_name: landingPageData[imageKey].file_name - }); - return { - src: UrlInterpolationService.getStaticImageUrl(imagePath), - alt: landingPageData[imageKey].alt - }; - } - }; + ctrl.image1 = getImageData(1); + ctrl.image2 = getImageData(2); - ctrl.image1 = getImageData(1); - ctrl.image2 = getImageData(2); + ctrl.getVideoUrl = function() { + if (landingPageData.video) { + var videoPath = UrlInterpolationService.interpolateUrl( + angular.copy(assetsPathFormat), { + subject: ctrl.subject, + topic: topic, + file_name: landingPageData.video + }); + return UrlInterpolationService.getStaticVideoUrl(videoPath); + } else { + throw Error( + 'There is no video data available for this landing page.'); + } + }; - ctrl.getVideoUrl = function() { - if (landingPageData.video) { - var videoPath = UrlInterpolationService.interpolateUrl( - angular.copy(assetsPathFormat), { - subject: ctrl.subject, - topic: topic, - file_name: landingPageData.video - }); - return UrlInterpolationService.getStaticVideoUrl(videoPath); - } else { - throw Error( - 'There is no video data available for this landing page.'); - } - }; + ctrl.onClickGetStartedButton = function() { + var collectionId = topicData.collection_id; + SiteAnalyticsService.registerOpenCollectionFromLandingPageEvent( + collectionId); + $timeout(function() { + $window.location = UrlInterpolationService.interpolateUrl( + '/collection/', { + collection_id: collectionId + }); + }, 150); + }; - ctrl.onClickGetStartedButton = function() { - var collectionId = topicData.collection_id; - SiteAnalyticsService.registerOpenCollectionFromLandingPageEvent( - collectionId); - $timeout(function() { - $window.location = UrlInterpolationService.interpolateUrl( - '/collection/', { - collection_id: collectionId - }); - }, 150); - }; + ctrl.onClickLearnMoreButton = function() { + $timeout(function() { + $window.location = '/splash'; + }, 150); + }; - ctrl.onClickLearnMoreButton = function() { - $timeout(function() { - $window.location = '/splash'; - }, 150); - }; - - ctrl.onClickExploreLessonsButton = function() { - $timeout(function() { - $window.location = '/library'; - }, 150); - }; - } - ]}; -}]); + ctrl.onClickExploreLessonsButton = function() { + $timeout(function() { + $window.location = '/library'; + }, 150); + }; + } + ]}; + }]); diff --git a/core/templates/dev/head/pages/landing-pages/topic-landing-page/topic-landing-page.scripts.ts b/core/templates/dev/head/pages/landing-pages/topic-landing-page/topic-landing-page.scripts.ts index c0229e80bc1b..54b99f130856 100644 --- a/core/templates/dev/head/pages/landing-pages/topic-landing-page/topic-landing-page.scripts.ts +++ b/core/templates/dev/head/pages/landing-pages/topic-landing-page/topic-landing-page.scripts.ts @@ -16,6 +16,7 @@ * @fileoverview Directive scripts for landing page. */ +require('AppInit.ts'); require('App.ts'); require( diff --git a/core/templates/dev/head/pages/learner-dashboard-page/learner-dashboard-page.constants.ts b/core/templates/dev/head/pages/learner-dashboard-page/learner-dashboard-page.constants.ts index 99065336327a..71763ae73d87 100644 --- a/core/templates/dev/head/pages/learner-dashboard-page/learner-dashboard-page.constants.ts +++ b/core/templates/dev/head/pages/learner-dashboard-page/learner-dashboard-page.constants.ts @@ -16,9 +16,7 @@ * @fileoverview Constants for the Learner dashboard. */ -var oppia = require('AppInit.ts').module; - -oppia.constant('LEARNER_DASHBOARD_SECTION_I18N_IDS', { +angular.module('oppia').constant('LEARNER_DASHBOARD_SECTION_I18N_IDS', { INCOMPLETE: 'I18N_LEARNER_DASHBOARD_INCOMPLETE_SECTION', COMPLETED: 'I18N_LEARNER_DASHBOARD_COMPLETED_SECTION', SUBSCRIPTIONS: 'I18N_LEARNER_DASHBOARD_SUBSCRIPTIONS_SECTION', @@ -26,12 +24,12 @@ oppia.constant('LEARNER_DASHBOARD_SECTION_I18N_IDS', { PLAYLIST: 'I18N_LEARNER_DASHBOARD_PLAYLIST_SECTION' }); -oppia.constant('LEARNER_DASHBOARD_SUBSECTION_I18N_IDS', { +angular.module('oppia').constant('LEARNER_DASHBOARD_SUBSECTION_I18N_IDS', { EXPLORATIONS: 'I18N_DASHBOARD_EXPLORATIONS', COLLECTIONS: 'I18N_DASHBOARD_COLLECTIONS' }); -oppia.constant('EXPLORATIONS_SORT_BY_KEYS_AND_I18N_IDS', { +angular.module('oppia').constant('EXPLORATIONS_SORT_BY_KEYS_AND_I18N_IDS', { LAST_PLAYED: { key: 'last_played', i18nId: 'I18N_LEARNER_DASHBOARD_EXPLORATIONS_SORT_BY_LAST_PLAYED' @@ -46,7 +44,7 @@ oppia.constant('EXPLORATIONS_SORT_BY_KEYS_AND_I18N_IDS', { } }); -oppia.constant('SUBSCRIPTION_SORT_BY_KEYS_AND_I18N_IDS', { +angular.module('oppia').constant('SUBSCRIPTION_SORT_BY_KEYS_AND_I18N_IDS', { USERNAME: { key: 'subscriber_username', i18nId: 'I18N_PREFERENCES_USERNAME' @@ -57,7 +55,7 @@ oppia.constant('SUBSCRIPTION_SORT_BY_KEYS_AND_I18N_IDS', { } }); -oppia.constant('FEEDBACK_THREADS_SORT_BY_KEYS_AND_I18N_IDS', { +angular.module('oppia').constant('FEEDBACK_THREADS_SORT_BY_KEYS_AND_I18N_IDS', { LAST_UPDATED: { key: 'last_updated', i18nId: 'I18N_DASHBOARD_EXPLORATIONS_SORT_BY_LAST_UPDATED' diff --git a/core/templates/dev/head/pages/learner-dashboard-page/learner-dashboard-page.controller.ts b/core/templates/dev/head/pages/learner-dashboard-page/learner-dashboard-page.controller.ts index 06f2a871c322..75b547dba264 100644 --- a/core/templates/dev/head/pages/learner-dashboard-page/learner-dashboard-page.controller.ts +++ b/core/templates/dev/head/pages/learner-dashboard-page/learner-dashboard-page.controller.ts @@ -16,9 +16,6 @@ * @fileoverview Controllers for the creator dashboard. */ -require('App.ts'); - -require('base_components/BaseContentDirective.ts'); require( 'components/common-layout-directives/common-elements/' + 'background-banner.directive.ts'); @@ -46,552 +43,562 @@ require('services/UserService.ts'); require('pages/learner-dashboard-page/learner-dashboard-page.constants.ts'); -var oppia = require('AppInit.ts').module; +angular.module('oppia').directive('learnerDashboardPage', [ + 'UrlInterpolationService', function(UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: {}, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/learner-dashboard-page/learner-dashboard-page.directive.html'), + controllerAs: '$ctrl', + controller: [ + '$scope', '$rootScope', '$q', '$window', '$http', '$uibModal', + 'AlertsService', 'EXPLORATIONS_SORT_BY_KEYS_AND_I18N_IDS', + 'SUBSCRIPTION_SORT_BY_KEYS_AND_I18N_IDS', 'FATAL_ERROR_CODES', + 'LearnerDashboardBackendApiService', 'UrlInterpolationService', + 'LEARNER_DASHBOARD_SECTION_I18N_IDS', + 'LEARNER_DASHBOARD_SUBSECTION_I18N_IDS', 'ThreadStatusDisplayService', + 'DateTimeFormatService', 'FEEDBACK_THREADS_SORT_BY_KEYS_AND_I18N_IDS', + 'FeedbackThreadSummaryObjectFactory', + 'FeedbackMessageSummaryObjectFactory', + 'SuggestionModalForLearnerDashboardService', 'UserService', + function( + $scope, $rootScope, $q, $window, $http, $uibModal, + AlertsService, EXPLORATIONS_SORT_BY_KEYS_AND_I18N_IDS, + SUBSCRIPTION_SORT_BY_KEYS_AND_I18N_IDS, FATAL_ERROR_CODES, + LearnerDashboardBackendApiService, UrlInterpolationService, + LEARNER_DASHBOARD_SECTION_I18N_IDS, + LEARNER_DASHBOARD_SUBSECTION_I18N_IDS, ThreadStatusDisplayService, + DateTimeFormatService, FEEDBACK_THREADS_SORT_BY_KEYS_AND_I18N_IDS, + FeedbackThreadSummaryObjectFactory, + FeedbackMessageSummaryObjectFactory, + SuggestionModalForLearnerDashboardService, UserService) { + var ctrl = this; + ctrl.EXPLORATIONS_SORT_BY_KEYS_AND_I18N_IDS = ( + EXPLORATIONS_SORT_BY_KEYS_AND_I18N_IDS); + ctrl.SUBSCRIPTION_SORT_BY_KEYS_AND_I18N_IDS = ( + SUBSCRIPTION_SORT_BY_KEYS_AND_I18N_IDS); + ctrl.FEEDBACK_THREADS_SORT_BY_KEYS_AND_I18N_IDS = ( + FEEDBACK_THREADS_SORT_BY_KEYS_AND_I18N_IDS); + ctrl.LEARNER_DASHBOARD_SECTION_I18N_IDS = ( + LEARNER_DASHBOARD_SECTION_I18N_IDS); + ctrl.LEARNER_DASHBOARD_SUBSECTION_I18N_IDS = ( + LEARNER_DASHBOARD_SUBSECTION_I18N_IDS); + ctrl.getStaticImageUrl = UrlInterpolationService.getStaticImageUrl; + ctrl.PAGE_SIZE = 8; + ctrl.Math = window.Math; + UserService.getProfileImageDataUrlAsync().then(function(dataUrl) { + ctrl.profilePictureDataUrl = dataUrl; + }); -oppia.directive('learnerDashboardPage', ['UrlInterpolationService', function( - UrlInterpolationService) { - return { - restrict: 'E', - scope: {}, - bindToController: {}, - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/learner-dashboard-page/learner-dashboard-page.directive.html'), - controllerAs: '$ctrl', - controller: [ - '$scope', '$rootScope', '$q', '$window', '$http', '$uibModal', - 'AlertsService', 'EXPLORATIONS_SORT_BY_KEYS_AND_I18N_IDS', - 'SUBSCRIPTION_SORT_BY_KEYS_AND_I18N_IDS', 'FATAL_ERROR_CODES', - 'LearnerDashboardBackendApiService', 'UrlInterpolationService', - 'LEARNER_DASHBOARD_SECTION_I18N_IDS', - 'LEARNER_DASHBOARD_SUBSECTION_I18N_IDS', 'ThreadStatusDisplayService', - 'DateTimeFormatService', 'FEEDBACK_THREADS_SORT_BY_KEYS_AND_I18N_IDS', - 'FeedbackThreadSummaryObjectFactory', - 'FeedbackMessageSummaryObjectFactory', - 'SuggestionModalForLearnerDashboardService', 'UserService', - function( - $scope, $rootScope, $q, $window, $http, $uibModal, - AlertsService, EXPLORATIONS_SORT_BY_KEYS_AND_I18N_IDS, - SUBSCRIPTION_SORT_BY_KEYS_AND_I18N_IDS, FATAL_ERROR_CODES, - LearnerDashboardBackendApiService, UrlInterpolationService, - LEARNER_DASHBOARD_SECTION_I18N_IDS, - LEARNER_DASHBOARD_SUBSECTION_I18N_IDS, ThreadStatusDisplayService, - DateTimeFormatService, FEEDBACK_THREADS_SORT_BY_KEYS_AND_I18N_IDS, - FeedbackThreadSummaryObjectFactory, - FeedbackMessageSummaryObjectFactory, - SuggestionModalForLearnerDashboardService, UserService) { - var ctrl = this; - ctrl.EXPLORATIONS_SORT_BY_KEYS_AND_I18N_IDS = ( - EXPLORATIONS_SORT_BY_KEYS_AND_I18N_IDS); - ctrl.SUBSCRIPTION_SORT_BY_KEYS_AND_I18N_IDS = ( - SUBSCRIPTION_SORT_BY_KEYS_AND_I18N_IDS); - ctrl.FEEDBACK_THREADS_SORT_BY_KEYS_AND_I18N_IDS = ( - FEEDBACK_THREADS_SORT_BY_KEYS_AND_I18N_IDS); - ctrl.LEARNER_DASHBOARD_SECTION_I18N_IDS = ( - LEARNER_DASHBOARD_SECTION_I18N_IDS); - ctrl.LEARNER_DASHBOARD_SUBSECTION_I18N_IDS = ( - LEARNER_DASHBOARD_SUBSECTION_I18N_IDS); - ctrl.getStaticImageUrl = UrlInterpolationService.getStaticImageUrl; - ctrl.PAGE_SIZE = 8; - ctrl.Math = window.Math; - UserService.getProfileImageDataUrlAsync().then(function(dataUrl) { - ctrl.profilePictureDataUrl = dataUrl; - }); - - $rootScope.loadingMessage = 'Loading'; - ctrl.username = ''; - var userInfoPromise = UserService.getUserInfoAsync(); - userInfoPromise.then(function(userInfo) { - ctrl.username = userInfo.getUsername(); - }); - - var dashboardDataPromise = ( - LearnerDashboardBackendApiService.fetchLearnerDashboardData()); - dashboardDataPromise.then( - function(responseData) { - ctrl.isCurrentExpSortDescending = true; - ctrl.isCurrentSubscriptionSortDescending = true; - ctrl.isCurrentFeedbackSortDescending = true; - ctrl.currentExpSortType = ( - EXPLORATIONS_SORT_BY_KEYS_AND_I18N_IDS.LAST_PLAYED.key); - ctrl.currentSubscribersSortType = ( - SUBSCRIPTION_SORT_BY_KEYS_AND_I18N_IDS.USERNAME.key); - ctrl.currentFeedbackThreadsSortType = ( - FEEDBACK_THREADS_SORT_BY_KEYS_AND_I18N_IDS.LAST_UPDATED.key); - ctrl.startIncompleteExpIndex = 0; - ctrl.startCompletedExpIndex = 0; - ctrl.startIncompleteCollectionIndex = 0; - ctrl.startCompletedCollectionIndex = 0; - ctrl.completedExplorationsList = ( - responseData.completed_explorations_list - ); - ctrl.completedCollectionsList = ( - responseData.completed_collections_list - ); - ctrl.incompleteExplorationsList = ( - responseData.incomplete_explorations_list - ); - ctrl.incompleteCollectionsList = ( - responseData.incomplete_collections_list - ); - ctrl.subscriptionsList = ( - responseData.subscription_list - ); - ctrl.numberNonexistentIncompleteExplorations = ( - responseData.number_of_nonexistent_activities - .incomplete_explorations - ); - ctrl.numberNonexistentIncompleteCollections = ( - responseData.number_of_nonexistent_activities - .incomplete_collections - ); - ctrl.numberNonexistentCompletedExplorations = ( - responseData.number_of_nonexistent_activities - .completed_explorations - ); - ctrl.numberNonexistentCompletedCollections = ( - responseData.number_of_nonexistent_activities - .completed_collections - ); - ctrl.numberNonexistentExplorationsFromPlaylist = ( - responseData.number_of_nonexistent_activities.exploration_playlist - ); - ctrl.numberNonexistentCollectionsFromPlaylist = ( - responseData.number_of_nonexistent_activities.collection_playlist - ); - ctrl.completedToIncompleteCollections = ( - responseData.completed_to_incomplete_collections - ); - var threadSummaryDicts = responseData.thread_summaries; - ctrl.threadSummaries = []; - for (var index = 0; index < threadSummaryDicts.length; index++) { - ctrl.threadSummaries.push( - FeedbackThreadSummaryObjectFactory.createFromBackendDict( - threadSummaryDicts[index])); - } - ctrl.numberOfUnreadThreads = responseData.number_of_unread_threads; - ctrl.explorationPlaylist = responseData.exploration_playlist; - ctrl.collectionPlaylist = responseData.collection_playlist; - ctrl.activeSection = LEARNER_DASHBOARD_SECTION_I18N_IDS.INCOMPLETE; - ctrl.activeSubsection = ( - LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.EXPLORATIONS); - ctrl.feedbackThreadActive = false; + $rootScope.loadingMessage = 'Loading'; + ctrl.username = ''; + var userInfoPromise = UserService.getUserInfoAsync(); + userInfoPromise.then(function(userInfo) { + ctrl.username = userInfo.getUsername(); + }); - ctrl.noExplorationActivity = ( - (ctrl.completedExplorationsList.length === 0) && - (ctrl.incompleteExplorationsList.length === 0)); - ctrl.noCollectionActivity = ( - (ctrl.completedCollectionsList.length === 0) && - (ctrl.incompleteCollectionsList.length === 0)); - ctrl.noActivity = ( - (ctrl.noExplorationActivity) && (ctrl.noCollectionActivity) && - (ctrl.explorationPlaylist.length === 0) && - (ctrl.collectionPlaylist.length === 0)); - }, - function(errorResponse) { - if (FATAL_ERROR_CODES.indexOf(errorResponse.status) !== -1) { - AlertsService.addWarning('Failed to get learner dashboard data'); + var dashboardDataPromise = ( + LearnerDashboardBackendApiService.fetchLearnerDashboardData()); + dashboardDataPromise.then( + function(responseData) { + ctrl.isCurrentExpSortDescending = true; + ctrl.isCurrentSubscriptionSortDescending = true; + ctrl.isCurrentFeedbackSortDescending = true; + ctrl.currentExpSortType = ( + EXPLORATIONS_SORT_BY_KEYS_AND_I18N_IDS.LAST_PLAYED.key); + ctrl.currentSubscribersSortType = ( + SUBSCRIPTION_SORT_BY_KEYS_AND_I18N_IDS.USERNAME.key); + ctrl.currentFeedbackThreadsSortType = ( + FEEDBACK_THREADS_SORT_BY_KEYS_AND_I18N_IDS.LAST_UPDATED.key); + ctrl.startIncompleteExpIndex = 0; + ctrl.startCompletedExpIndex = 0; + ctrl.startIncompleteCollectionIndex = 0; + ctrl.startCompletedCollectionIndex = 0; + ctrl.completedExplorationsList = ( + responseData.completed_explorations_list + ); + ctrl.completedCollectionsList = ( + responseData.completed_collections_list + ); + ctrl.incompleteExplorationsList = ( + responseData.incomplete_explorations_list + ); + ctrl.incompleteCollectionsList = ( + responseData.incomplete_collections_list + ); + ctrl.subscriptionsList = ( + responseData.subscription_list + ); + ctrl.numberNonexistentIncompleteExplorations = ( + responseData.number_of_nonexistent_activities + .incomplete_explorations + ); + ctrl.numberNonexistentIncompleteCollections = ( + responseData.number_of_nonexistent_activities + .incomplete_collections + ); + ctrl.numberNonexistentCompletedExplorations = ( + responseData.number_of_nonexistent_activities + .completed_explorations + ); + ctrl.numberNonexistentCompletedCollections = ( + responseData.number_of_nonexistent_activities + .completed_collections + ); + ctrl.numberNonexistentExplorationsFromPlaylist = ( + responseData.number_of_nonexistent_activities + .exploration_playlist + ); + ctrl.numberNonexistentCollectionsFromPlaylist = ( + responseData.number_of_nonexistent_activities + .collection_playlist + ); + ctrl.completedToIncompleteCollections = ( + responseData.completed_to_incomplete_collections + ); + var threadSummaryDicts = responseData.thread_summaries; + ctrl.threadSummaries = []; + for (var index = 0; index < threadSummaryDicts.length; index++) { + ctrl.threadSummaries.push( + FeedbackThreadSummaryObjectFactory.createFromBackendDict( + threadSummaryDicts[index])); + } + ctrl.numberOfUnreadThreads = + responseData.number_of_unread_threads; + ctrl.explorationPlaylist = responseData.exploration_playlist; + ctrl.collectionPlaylist = responseData.collection_playlist; + ctrl.activeSection = + LEARNER_DASHBOARD_SECTION_I18N_IDS.INCOMPLETE; + ctrl.activeSubsection = ( + LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.EXPLORATIONS); + ctrl.feedbackThreadActive = false; + + ctrl.noExplorationActivity = ( + (ctrl.completedExplorationsList.length === 0) && + (ctrl.incompleteExplorationsList.length === 0)); + ctrl.noCollectionActivity = ( + (ctrl.completedCollectionsList.length === 0) && + (ctrl.incompleteCollectionsList.length === 0)); + ctrl.noActivity = ( + (ctrl.noExplorationActivity) && (ctrl.noCollectionActivity) && + (ctrl.explorationPlaylist.length === 0) && + (ctrl.collectionPlaylist.length === 0)); + }, + function(errorResponse) { + if (FATAL_ERROR_CODES.indexOf(errorResponse.status) !== -1) { + AlertsService.addWarning( + 'Failed to get learner dashboard data'); + } } - } - ); - - $q.all([userInfoPromise, dashboardDataPromise]).then(function() { - $rootScope.loadingMessage = ''; - }); - - ctrl.loadingFeedbacks = false; - var threadIndex = null; - - ctrl.newMessage = { - text: '' - }; - - ctrl.getLabelClass = ThreadStatusDisplayService.getLabelClass; - ctrl.getHumanReadableStatus = ( - ThreadStatusDisplayService.getHumanReadableStatus); - ctrl.getLocaleAbbreviatedDatetimeString = ( - DateTimeFormatService.getLocaleAbbreviatedDatetimeString); - - ctrl.setActiveSection = function(newActiveSectionName) { - ctrl.activeSection = newActiveSectionName; - if (ctrl.activeSection === - LEARNER_DASHBOARD_SECTION_I18N_IDS.FEEDBACK && - ctrl.feedbackThreadActive === true) { - ctrl.feedbackThreadActive = false; - } - }; - - ctrl.setActiveSubsection = function(newActiveSubsectionName) { - ctrl.activeSubsection = newActiveSubsectionName; - }; - - ctrl.getExplorationUrl = function(explorationId) { - return '/explore/' + explorationId; - }; - - ctrl.getCollectionUrl = function(collectionId) { - return '/collection/' + collectionId; - }; - - ctrl.checkMobileView = function() { - return ($window.innerWidth < 500); - }; - - ctrl.getVisibleExplorationList = function(startCompletedExpIndex) { - return ctrl.completedExplorationsList.slice( - startCompletedExpIndex, Math.min( - startCompletedExpIndex + ctrl.PAGE_SIZE, - ctrl.completedExplorationsList.length)); - }; - - ctrl.showUsernamePopover = function(subscriberUsername) { - // The popover on the subscription card is only shown if the length of - // the subscriber username is greater than 10 and the user hovers over - // the truncated username. - if (subscriberUsername.length > 10) { - return 'mouseenter'; - } else { - return 'none'; - } - }; - - ctrl.goToPreviousPage = function(section, subsection) { - if (section === LEARNER_DASHBOARD_SECTION_I18N_IDS.INCOMPLETE) { - if (subsection === ( - LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.EXPLORATIONS)) { - ctrl.startIncompleteExpIndex = Math.max( - ctrl.startIncompleteExpIndex - ctrl.PAGE_SIZE, 0); - } else if ( - subsection === ( - LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.COLLECTIONS)) { - ctrl.startIncompleteCollectionIndex = Math.max( - ctrl.startIncompleteCollectionIndex - ctrl.PAGE_SIZE, 0); + ); + + $q.all([userInfoPromise, dashboardDataPromise]).then(function() { + $rootScope.loadingMessage = ''; + }); + + ctrl.loadingFeedbacks = false; + var threadIndex = null; + + ctrl.newMessage = { + text: '' + }; + + ctrl.getLabelClass = ThreadStatusDisplayService.getLabelClass; + ctrl.getHumanReadableStatus = ( + ThreadStatusDisplayService.getHumanReadableStatus); + ctrl.getLocaleAbbreviatedDatetimeString = ( + DateTimeFormatService.getLocaleAbbreviatedDatetimeString); + + ctrl.setActiveSection = function(newActiveSectionName) { + ctrl.activeSection = newActiveSectionName; + if (ctrl.activeSection === + LEARNER_DASHBOARD_SECTION_I18N_IDS.FEEDBACK && + ctrl.feedbackThreadActive === true) { + ctrl.feedbackThreadActive = false; } - } else if (section === LEARNER_DASHBOARD_SECTION_I18N_IDS.COMPLETED) { - if (subsection === ( - LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.EXPLORATIONS)) { - ctrl.startCompletedExpIndex = Math.max( - ctrl.startCompletedExpIndex - ctrl.PAGE_SIZE, 0); - } else if ( - subsection === ( - LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.COLLECTIONS)) { - ctrl.startCompletedCollectionIndex = Math.max( - ctrl.startCompletedCollectionIndex - ctrl.PAGE_SIZE, 0); + }; + + ctrl.setActiveSubsection = function(newActiveSubsectionName) { + ctrl.activeSubsection = newActiveSubsectionName; + }; + + ctrl.getExplorationUrl = function(explorationId) { + return '/explore/' + explorationId; + }; + + ctrl.getCollectionUrl = function(collectionId) { + return '/collection/' + collectionId; + }; + + ctrl.checkMobileView = function() { + return ($window.innerWidth < 500); + }; + + ctrl.getVisibleExplorationList = function(startCompletedExpIndex) { + return ctrl.completedExplorationsList.slice( + startCompletedExpIndex, Math.min( + startCompletedExpIndex + ctrl.PAGE_SIZE, + ctrl.completedExplorationsList.length)); + }; + + ctrl.showUsernamePopover = function(subscriberUsername) { + // The popover on the subscription card is only shown if the length + // of the subscriber username is greater than 10 and the user hovers + // over the truncated username. + if (subscriberUsername.length > 10) { + return 'mouseenter'; + } else { + return 'none'; } - } - }; - - ctrl.goToNextPage = function(section, subsection) { - if (section === LEARNER_DASHBOARD_SECTION_I18N_IDS.INCOMPLETE) { - if (subsection === ( - LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.EXPLORATIONS)) { - if (ctrl.startIncompleteExpIndex + - ctrl.PAGE_SIZE <= ctrl.incompleteExplorationsList.length) { - ctrl.startIncompleteExpIndex += ctrl.PAGE_SIZE; + }; + + ctrl.goToPreviousPage = function(section, subsection) { + if (section === LEARNER_DASHBOARD_SECTION_I18N_IDS.INCOMPLETE) { + if (subsection === ( + LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.EXPLORATIONS)) { + ctrl.startIncompleteExpIndex = Math.max( + ctrl.startIncompleteExpIndex - ctrl.PAGE_SIZE, 0); + } else if ( + subsection === ( + LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.COLLECTIONS)) { + ctrl.startIncompleteCollectionIndex = Math.max( + ctrl.startIncompleteCollectionIndex - ctrl.PAGE_SIZE, 0); } } else if ( - subsection === ( - LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.COLLECTIONS)) { - if (ctrl.startIncompleteCollectionIndex + - ctrl.PAGE_SIZE <= ctrl.startIncompleteCollectionIndex.length) { - ctrl.startIncompleteCollectionIndex += ctrl.PAGE_SIZE; + section === LEARNER_DASHBOARD_SECTION_I18N_IDS.COMPLETED) { + if (subsection === ( + LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.EXPLORATIONS)) { + ctrl.startCompletedExpIndex = Math.max( + ctrl.startCompletedExpIndex - ctrl.PAGE_SIZE, 0); + } else if ( + subsection === ( + LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.COLLECTIONS)) { + ctrl.startCompletedCollectionIndex = Math.max( + ctrl.startCompletedCollectionIndex - ctrl.PAGE_SIZE, 0); } } - } else if (section === LEARNER_DASHBOARD_SECTION_I18N_IDS.COMPLETED) { - if (subsection === ( - LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.EXPLORATIONS)) { - if (ctrl.startCompletedExpIndex + - ctrl.PAGE_SIZE <= ctrl.completedExplorationsList.length) { - ctrl.startCompletedExpIndex += ctrl.PAGE_SIZE; + }; + + ctrl.goToNextPage = function(section, subsection) { + if (section === LEARNER_DASHBOARD_SECTION_I18N_IDS.INCOMPLETE) { + if (subsection === ( + LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.EXPLORATIONS)) { + if (ctrl.startIncompleteExpIndex + + ctrl.PAGE_SIZE <= ctrl.incompleteExplorationsList.length) { + ctrl.startIncompleteExpIndex += ctrl.PAGE_SIZE; + } + } else if ( + subsection === ( + LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.COLLECTIONS)) { + if (ctrl.startIncompleteCollectionIndex + + ctrl.PAGE_SIZE <= + ctrl.startIncompleteCollectionIndex.length) { + ctrl.startIncompleteCollectionIndex += ctrl.PAGE_SIZE; + } } } else if ( - subsection === ( - LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.COLLECTIONS)) { - if (ctrl.startCompletedCollectionIndex + - ctrl.PAGE_SIZE <= ctrl.startCompletedCollectionIndex.length) { - ctrl.startCompletedCollectionIndex += ctrl.PAGE_SIZE; + section === LEARNER_DASHBOARD_SECTION_I18N_IDS.COMPLETED) { + if (subsection === ( + LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.EXPLORATIONS)) { + if (ctrl.startCompletedExpIndex + + ctrl.PAGE_SIZE <= ctrl.completedExplorationsList.length) { + ctrl.startCompletedExpIndex += ctrl.PAGE_SIZE; + } + } else if ( + subsection === ( + LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.COLLECTIONS)) { + if (ctrl.startCompletedCollectionIndex + + ctrl.PAGE_SIZE <= ctrl.startCompletedCollectionIndex.length) { + ctrl.startCompletedCollectionIndex += ctrl.PAGE_SIZE; + } } } - } - }; - - ctrl.setExplorationsSortingOptions = function(sortType) { - if (sortType === ctrl.currentExpSortType) { - ctrl.isCurrentExpSortDescending = !ctrl.isCurrentExpSortDescending; - } else { - ctrl.currentExpSortType = sortType; - } - }; - - ctrl.setSubscriptionSortingOptions = function(sortType) { - if (sortType === ctrl.currentSubscriptionSortType) { - ctrl.isCurrentSubscriptionSortDescending = ( - !ctrl.isCurrentSubscriptionSortDescending); - } else { - ctrl.currentSubscriptionSortType = sortType; - } - }; - - ctrl.setFeedbackSortingOptions = function(sortType) { - if (sortType === ctrl.currentFeedbackThreadsSortType) { - ctrl.isCurrentFeedbackSortDescending = ( - !ctrl.isCurrentFeedbackSortDescending); - } else { - ctrl.currentFeedbackThreadsSortType = sortType; - } - }; - - ctrl.getValueOfExplorationSortKey = function(exploration) { - // This function is passed as a custom comparator function to - // `orderBy`, so that special cases can be handled while sorting - // explorations. - if (ctrl.currentExpSortType === - EXPLORATIONS_SORT_BY_KEYS_AND_I18N_IDS.LAST_PLAYED.key) { - return null; - } else { - return exploration[ctrl.currentExpSortType]; - } - }; - - ctrl.getValueOfSubscriptionSortKey = function(subscription) { - // This function is passed as a custom comparator function to - // `orderBy`, so that special cases can be handled while sorting - // subscriptions. - var value = subscription[ctrl.currentSubscribersSortType]; - if (ctrl.currentSubscribersSortType === - SUBSCRIPTION_SORT_BY_KEYS_AND_I18N_IDS.IMPACT.key) { - value = (value || 0); - } - return value; - }; - - ctrl.sortFeedbackThreadsFunction = function(feedbackThread) { - return feedbackThread[ctrl.currentFeedbackThreadsSortType]; - }; - - var getPlaylistSortableOptions = function(activityType) { - return { - 'ui-floating': 'auto', - start: function(e, ui) { - ui.placeholder.height(ui.item.height()); - $scope.$apply(); - }, - sort: function(e, ui) { - /* eslint-disable quote-props */ - // Making top : 0px to avoid irregular change in position. - ui.helper.css( - {'top': '0 px'}); - /* eslint-enable quote-props */ - }, - update: function(e, ui) { - var insertExpInLearnerPlaylistUrl = ( - UrlInterpolationService.interpolateUrl( - ('/learnerplaylistactivityhandler//' + - ''), { - activityType: activityType, - activityId: ( - ctrl.explorationPlaylist[ui.item.sortable.index].id) - })); - - $http.post(insertExpInLearnerPlaylistUrl, { - index: ui.item.sortable.dropindex - }); - $scope.$apply(); - }, - stop: function(e, ui) { - $scope.$apply(); - }, - axis: 'y' }; - }; - - ctrl.collectionPlaylistSortableOptions = getPlaylistSortableOptions( - constants.ACTIVITY_TYPE_COLLECTION); - ctrl.explorationPlaylistSortableOptions = getPlaylistSortableOptions( - constants.ACTIVITY_TYPE_EXPLORATION); - - ctrl.onClickThread = function( - threadStatus, explorationId, threadId, explorationTitle) { - ctrl.loadingFeedbacks = true; - var threadDataUrl = UrlInterpolationService.interpolateUrl( - '/learnerdashboardthreadhandler/', { - threadId: threadId - }); - ctrl.explorationTitle = explorationTitle; - ctrl.feedbackThreadActive = true; - ctrl.threadStatus = threadStatus; - ctrl.explorationId = explorationId; - ctrl.threadId = threadId; - - for (var index = 0; index < ctrl.threadSummaries.length; index++) { - if (ctrl.threadSummaries[index].threadId === threadId) { - threadIndex = index; - var threadSummary = ctrl.threadSummaries[index]; - threadSummary.markTheLastTwoMessagesAsRead(); - if (!threadSummary.lastMessageRead) { - ctrl.numberOfUnreadThreads -= 1; - } + + ctrl.setExplorationsSortingOptions = function(sortType) { + if (sortType === ctrl.currentExpSortType) { + ctrl.isCurrentExpSortDescending = + !ctrl.isCurrentExpSortDescending; + } else { + ctrl.currentExpSortType = sortType; } - } - - $http.get(threadDataUrl).then(function(response) { - var messageSummaryDicts = response.data.message_summary_list; - ctrl.messageSummaries = []; - for (index = 0; index < messageSummaryDicts.length; index++) { - ctrl.messageSummaries.push( - FeedbackMessageSummaryObjectFactory.createFromBackendDict( - messageSummaryDicts[index])); + }; + + ctrl.setSubscriptionSortingOptions = function(sortType) { + if (sortType === ctrl.currentSubscriptionSortType) { + ctrl.isCurrentSubscriptionSortDescending = ( + !ctrl.isCurrentSubscriptionSortDescending); + } else { + ctrl.currentSubscriptionSortType = sortType; } - ctrl.loadingFeedbacks = false; - }); - }; + }; - ctrl.showAllThreads = function() { - ctrl.feedbackThreadActive = false; - threadIndex = null; - }; + ctrl.setFeedbackSortingOptions = function(sortType) { + if (sortType === ctrl.currentFeedbackThreadsSortType) { + ctrl.isCurrentFeedbackSortDescending = ( + !ctrl.isCurrentFeedbackSortDescending); + } else { + ctrl.currentFeedbackThreadsSortType = sortType; + } + }; - ctrl.addNewMessage = function(threadId, newMessage) { - var url = UrlInterpolationService.interpolateUrl( - '/threadhandler/', { - threadId: threadId - }); - var payload = { - updated_status: null, - updated_subject: null, - text: newMessage + ctrl.getValueOfExplorationSortKey = function(exploration) { + // This function is passed as a custom comparator function to + // `orderBy`, so that special cases can be handled while sorting + // explorations. + if (ctrl.currentExpSortType === + EXPLORATIONS_SORT_BY_KEYS_AND_I18N_IDS.LAST_PLAYED.key) { + return null; + } else { + return exploration[ctrl.currentExpSortType]; + } }; - ctrl.messageSendingInProgress = true; - $http.post(url, payload).success(function() { - ctrl.threadSummary = ctrl.threadSummaries[threadIndex]; - ctrl.threadSummary.appendNewMessage( - newMessage, ctrl.username); - ctrl.messageSendingInProgress = false; - ctrl.newMessage.text = null; - var newMessageSummary = ( - FeedbackMessageSummaryObjectFactory.createNewMessage( - ctrl.threadSummary.totalMessageCount, newMessage, ctrl.username, - ctrl.profilePictureDataUrl)); - ctrl.messageSummaries.push(newMessageSummary); - }); - }; - - ctrl.showSuggestionModal = function( - newContent, oldContent, description) { - SuggestionModalForLearnerDashboardService.showSuggestionModal( - 'edit_exploration_state_content', - { - newContent: newContent, - oldContent: oldContent, - description: description + + ctrl.getValueOfSubscriptionSortKey = function(subscription) { + // This function is passed as a custom comparator function to + // `orderBy`, so that special cases can be handled while sorting + // subscriptions. + var value = subscription[ctrl.currentSubscribersSortType]; + if (ctrl.currentSubscribersSortType === + SUBSCRIPTION_SORT_BY_KEYS_AND_I18N_IDS.IMPACT.key) { + value = (value || 0); } - ); - }; - - ctrl.openRemoveActivityModal = function( - sectionNameI18nId, subsectionName, activity) { - $uibModal.open({ - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/learner-dashboard-page/modal-templates/' + - 'remove-activity-from-learner-dashboard-modal.template.html'), - backdrop: true, - resolve: { - sectionNameI18nId: function() { - return sectionNameI18nId; + return value; + }; + + ctrl.sortFeedbackThreadsFunction = function(feedbackThread) { + return feedbackThread[ctrl.currentFeedbackThreadsSortType]; + }; + + var getPlaylistSortableOptions = function(activityType) { + return { + 'ui-floating': 'auto', + start: function(e, ui) { + ui.placeholder.height(ui.item.height()); + $scope.$apply(); + }, + sort: function(e, ui) { + /* eslint-disable quote-props */ + // Making top : 0px to avoid irregular change in position. + ui.helper.css( + {'top': '0 px'}); + /* eslint-enable quote-props */ + }, + update: function(e, ui) { + var insertExpInLearnerPlaylistUrl = ( + UrlInterpolationService.interpolateUrl( + ('/learnerplaylistactivityhandler//' + + ''), { + activityType: activityType, + activityId: ( + ctrl.explorationPlaylist[ui.item.sortable.index].id) + })); + + $http.post(insertExpInLearnerPlaylistUrl, { + index: ui.item.sortable.dropindex + }); + $scope.$apply(); }, - subsectionName: function() { - return subsectionName; + stop: function(e, ui) { + $scope.$apply(); }, - activity: function() { - return activity; + axis: 'y' + }; + }; + + ctrl.collectionPlaylistSortableOptions = getPlaylistSortableOptions( + constants.ACTIVITY_TYPE_COLLECTION); + ctrl.explorationPlaylistSortableOptions = getPlaylistSortableOptions( + constants.ACTIVITY_TYPE_EXPLORATION); + + ctrl.onClickThread = function( + threadStatus, explorationId, threadId, explorationTitle) { + ctrl.loadingFeedbacks = true; + var threadDataUrl = UrlInterpolationService.interpolateUrl( + '/learnerdashboardthreadhandler/', { + threadId: threadId + }); + ctrl.explorationTitle = explorationTitle; + ctrl.feedbackThreadActive = true; + ctrl.threadStatus = threadStatus; + ctrl.explorationId = explorationId; + ctrl.threadId = threadId; + + for (var index = 0; index < ctrl.threadSummaries.length; index++) { + if (ctrl.threadSummaries[index].threadId === threadId) { + threadIndex = index; + var threadSummary = ctrl.threadSummaries[index]; + threadSummary.markTheLastTwoMessagesAsRead(); + if (!threadSummary.lastMessageRead) { + ctrl.numberOfUnreadThreads -= 1; + } } - }, - controller: [ - '$scope', '$uibModalInstance', '$http', 'sectionNameI18nId', - 'subsectionName', - function( - $scope, $uibModalInstance, $http, sectionNameI18nId, - subsectionName) { - $scope.sectionNameI18nId = sectionNameI18nId; - $scope.subsectionName = subsectionName; - $scope.activityTitle = activity.title; - $scope.remove = function() { - var activityType = ''; - if (subsectionName === - LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.EXPLORATIONS) { - activityType = constants.ACTIVITY_TYPE_EXPLORATION; - } else if (subsectionName === - LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.COLLECTIONS) { - activityType = constants.ACTIVITY_TYPE_COLLECTION; - } else { - throw new Error('Subsection name is not valid.'); - } + } - var removeActivityUrlPrefix = ''; - if (sectionNameI18nId === - LEARNER_DASHBOARD_SECTION_I18N_IDS.PLAYLIST) { - removeActivityUrlPrefix = - '/learnerplaylistactivityhandler/'; - } else if (sectionNameI18nId === - LEARNER_DASHBOARD_SECTION_I18N_IDS.INCOMPLETE) { - removeActivityUrlPrefix = - '/learnerincompleteactivityhandler/'; - } else { - throw new Error('Section name is not valid.'); - } + $http.get(threadDataUrl).then(function(response) { + var messageSummaryDicts = response.data.message_summary_list; + ctrl.messageSummaries = []; + for (index = 0; index < messageSummaryDicts.length; index++) { + ctrl.messageSummaries.push( + FeedbackMessageSummaryObjectFactory.createFromBackendDict( + messageSummaryDicts[index])); + } + ctrl.loadingFeedbacks = false; + }); + }; - var removeActivityUrl = ( - UrlInterpolationService.interpolateUrl( - removeActivityUrlPrefix + '/', { - activityType: activityType, - activityId: activity.id - })); + ctrl.showAllThreads = function() { + ctrl.feedbackThreadActive = false; + threadIndex = null; + }; - $http['delete'](removeActivityUrl); - $uibModalInstance.close(); - }; + ctrl.addNewMessage = function(threadId, newMessage) { + var url = UrlInterpolationService.interpolateUrl( + '/threadhandler/', { + threadId: threadId + }); + var payload = { + updated_status: null, + updated_subject: null, + text: newMessage + }; + ctrl.messageSendingInProgress = true; + $http.post(url, payload).success(function() { + ctrl.threadSummary = ctrl.threadSummaries[threadIndex]; + ctrl.threadSummary.appendNewMessage( + newMessage, ctrl.username); + ctrl.messageSendingInProgress = false; + ctrl.newMessage.text = null; + var newMessageSummary = ( + FeedbackMessageSummaryObjectFactory.createNewMessage( + ctrl.threadSummary.totalMessageCount, newMessage, + ctrl.username, + ctrl.profilePictureDataUrl)); + ctrl.messageSummaries.push(newMessageSummary); + }); + }; - $scope.cancel = function() { - $uibModalInstance.dismiss('cancel'); - }; + ctrl.showSuggestionModal = function( + newContent, oldContent, description) { + SuggestionModalForLearnerDashboardService.showSuggestionModal( + 'edit_exploration_state_content', + { + newContent: newContent, + oldContent: oldContent, + description: description } - ] - }).result.then(function() { - if (sectionNameI18nId === - LEARNER_DASHBOARD_SECTION_I18N_IDS.INCOMPLETE) { - if (subsectionName === - LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.EXPLORATIONS) { - var index = ctrl.incompleteExplorationsList.indexOf(activity); - if (index !== -1) { - ctrl.incompleteExplorationsList.splice(index, 1); + ); + }; + + ctrl.openRemoveActivityModal = function( + sectionNameI18nId, subsectionName, activity) { + $uibModal.open({ + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/learner-dashboard-page/modal-templates/' + + 'remove-activity-from-learner-dashboard-modal.template.html'), + backdrop: true, + resolve: { + sectionNameI18nId: function() { + return sectionNameI18nId; + }, + subsectionName: function() { + return subsectionName; + }, + activity: function() { + return activity; } - } else if (subsectionName === - LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.COLLECTIONS) { - var index = ctrl.incompleteCollectionsList.indexOf(activity); - if (index !== -1) { - ctrl.incompleteCollectionsList.splice(index, 1); + }, + controller: [ + '$scope', '$uibModalInstance', '$http', 'sectionNameI18nId', + 'subsectionName', + function( + $scope, $uibModalInstance, $http, sectionNameI18nId, + subsectionName) { + $scope.sectionNameI18nId = sectionNameI18nId; + $scope.subsectionName = subsectionName; + $scope.activityTitle = activity.title; + $scope.remove = function() { + var activityType = ''; + if (subsectionName === + LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.EXPLORATIONS) { + activityType = constants.ACTIVITY_TYPE_EXPLORATION; + } else if (subsectionName === + LEARNER_DASHBOARD_SUBSECTION_I18N_IDS + .COLLECTIONS) { + activityType = constants.ACTIVITY_TYPE_COLLECTION; + } else { + throw new Error('Subsection name is not valid.'); + } + + var removeActivityUrlPrefix = ''; + if (sectionNameI18nId === + LEARNER_DASHBOARD_SECTION_I18N_IDS.PLAYLIST) { + removeActivityUrlPrefix = + '/learnerplaylistactivityhandler/'; + } else if (sectionNameI18nId === + LEARNER_DASHBOARD_SECTION_I18N_IDS.INCOMPLETE) { + removeActivityUrlPrefix = + '/learnerincompleteactivityhandler/'; + } else { + throw new Error('Section name is not valid.'); + } + + var removeActivityUrl = ( + UrlInterpolationService.interpolateUrl( + removeActivityUrlPrefix + + '/', { + activityType: activityType, + activityId: activity.id + })); + + $http['delete'](removeActivityUrl); + $uibModalInstance.close(); + }; + + $scope.cancel = function() { + $uibModalInstance.dismiss('cancel'); + }; } - } - } else if (sectionNameI18nId === - LEARNER_DASHBOARD_SECTION_I18N_IDS.PLAYLIST) { - if (subsectionName === - LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.EXPLORATIONS) { - var index = ctrl.explorationPlaylist.indexOf(activity); - if (index !== -1) { - ctrl.explorationPlaylist.splice(index, 1); + ] + }).result.then(function() { + if (sectionNameI18nId === + LEARNER_DASHBOARD_SECTION_I18N_IDS.INCOMPLETE) { + if (subsectionName === + LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.EXPLORATIONS) { + var index = ctrl.incompleteExplorationsList.indexOf(activity); + if (index !== -1) { + ctrl.incompleteExplorationsList.splice(index, 1); + } + } else if (subsectionName === + LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.COLLECTIONS) { + var index = ctrl.incompleteCollectionsList.indexOf(activity); + if (index !== -1) { + ctrl.incompleteCollectionsList.splice(index, 1); + } } - } else if (subsectionName === - LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.COLLECTIONS) { - var index = ctrl.collectionPlaylist.indexOf(activity); - if (index !== -1) { - ctrl.collectionPlaylist.splice(index, 1); + } else if (sectionNameI18nId === + LEARNER_DASHBOARD_SECTION_I18N_IDS.PLAYLIST) { + if (subsectionName === + LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.EXPLORATIONS) { + var index = ctrl.explorationPlaylist.indexOf(activity); + if (index !== -1) { + ctrl.explorationPlaylist.splice(index, 1); + } + } else if (subsectionName === + LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.COLLECTIONS) { + var index = ctrl.collectionPlaylist.indexOf(activity); + if (index !== -1) { + ctrl.collectionPlaylist.splice(index, 1); + } } } - } - }); - }; - } - ]}; -}]).animation('.menu-sub-section', function() { + }); + }; + } + ]}; + }]).animation('.menu-sub-section', function() { var NG_HIDE_CLASS = 'ng-hide'; return { beforeAddClass: function(element, className, done) { diff --git a/core/templates/dev/head/pages/learner-dashboard-page/learner-dashboard-page.scripts.ts b/core/templates/dev/head/pages/learner-dashboard-page/learner-dashboard-page.scripts.ts new file mode 100644 index 000000000000..97e8af07416c --- /dev/null +++ b/core/templates/dev/head/pages/learner-dashboard-page/learner-dashboard-page.scripts.ts @@ -0,0 +1,23 @@ +// Copyright 2019 The Oppia Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS-IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * @fileoverview Scripts required in Learner dashboard page. + */ + +require('AppInit.ts'); +require('App.ts'); + +require('base_components/BaseContentDirective.ts'); +require('pages/learner-dashboard-page/learner-dashboard-page.controller.ts'); diff --git a/core/templates/dev/head/pages/learner-dashboard-page/suggestion-modal/suggestion-modal-for-learner-dashboard.service.ts b/core/templates/dev/head/pages/learner-dashboard-page/suggestion-modal/suggestion-modal-for-learner-dashboard.service.ts index 3b28dbc2d1cf..a312cb1e68fe 100644 --- a/core/templates/dev/head/pages/learner-dashboard-page/suggestion-modal/suggestion-modal-for-learner-dashboard.service.ts +++ b/core/templates/dev/head/pages/learner-dashboard-page/suggestion-modal/suggestion-modal-for-learner-dashboard.service.ts @@ -19,11 +19,9 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/SuggestionModalService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('SuggestionModalForLearnerDashboardService', [ - '$rootScope', '$uibModal', 'UrlInterpolationService', - function($rootScope, $uibModal, UrlInterpolationService) { +angular.module('oppia').factory('SuggestionModalForLearnerDashboardService', [ + '$uibModal', 'UrlInterpolationService', + function($uibModal, UrlInterpolationService) { var _templateUrl = UrlInterpolationService.getDirectiveTemplateUrl( '/pages/learner-dashboard-page/suggestion-modal/' + 'learner-dashboard-suggestion-modal.directive.html' diff --git a/core/templates/dev/head/pages/library-page/library-footer/library-footer.directive.ts b/core/templates/dev/head/pages/library-page/library-footer/library-footer.directive.ts index 39f3e6cd4399..e28a972c7d83 100644 --- a/core/templates/dev/head/pages/library-page/library-footer/library-footer.directive.ts +++ b/core/templates/dev/head/pages/library-page/library-footer/library-footer.directive.ts @@ -20,24 +20,22 @@ require('pages/OppiaFooterDirective.ts'); require('pages/library-page/library-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('libraryFooter', ['UrlInterpolationService', function( - UrlInterpolationService) { - return { - restrict: 'E', - scope: {}, - bindToController: {}, - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/library-page/library-footer/library-footer.directive.html'), - controllerAs: '$ctrl', - controller: [ - '$window', 'LIBRARY_PAGE_MODES', 'LIBRARY_PATHS_TO_MODES', - function($window, LIBRARY_PAGE_MODES, LIBRARY_PATHS_TO_MODES) { - var ctrl = this; - var pageMode = LIBRARY_PATHS_TO_MODES[$window.location.pathname]; - ctrl.footerIsDisplayed = (pageMode !== LIBRARY_PAGE_MODES.SEARCH); - } - ] - }; -}]); +angular.module('oppia').directive('libraryFooter', [ + 'UrlInterpolationService', function(UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: {}, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/library-page/library-footer/library-footer.directive.html'), + controllerAs: '$ctrl', + controller: [ + '$window', 'LIBRARY_PAGE_MODES', 'LIBRARY_PATHS_TO_MODES', + function($window, LIBRARY_PAGE_MODES, LIBRARY_PATHS_TO_MODES) { + var ctrl = this; + var pageMode = LIBRARY_PATHS_TO_MODES[$window.location.pathname]; + ctrl.footerIsDisplayed = (pageMode !== LIBRARY_PAGE_MODES.SEARCH); + } + ] + }; + }]); diff --git a/core/templates/dev/head/pages/library-page/library-page.constants.ts b/core/templates/dev/head/pages/library-page/library-page.constants.ts index 32be86aebf44..2b4b3ffa03a2 100644 --- a/core/templates/dev/head/pages/library-page/library-page.constants.ts +++ b/core/templates/dev/head/pages/library-page/library-page.constants.ts @@ -20,15 +20,13 @@ // be same as the LIBRARY_PAGE_MODE constants defined in feconf.py. For example // LIBRARY_PAGE_MODES.GROUP should have the same value as // LIBRARY_PAGE_MODE_GROUP in feconf.py. -var oppia = require('AppInit.ts').module; - -oppia.constant('LIBRARY_PAGE_MODES', { +angular.module('oppia').constant('LIBRARY_PAGE_MODES', { GROUP: 'group', INDEX: 'index', SEARCH: 'search' }); -oppia.constant('LIBRARY_PATHS_TO_MODES', { +angular.module('oppia').constant('LIBRARY_PATHS_TO_MODES', { '/library': 'index', '/library/top_rated': 'group', '/library/recently_published': 'group', diff --git a/core/templates/dev/head/pages/library-page/library-page.directive.ts b/core/templates/dev/head/pages/library-page/library-page.directive.ts index 72606b2d6199..14b7223126ca 100755 --- a/core/templates/dev/head/pages/library-page/library-page.directive.ts +++ b/core/templates/dev/head/pages/library-page/library-page.directive.ts @@ -38,9 +38,7 @@ require('services/contextual/WindowDimensionsService.ts'); require('pages/library-page/library-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('libraryPage', [ +angular.module('oppia').directive('libraryPage', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/library-page/library-page.scripts.ts b/core/templates/dev/head/pages/library-page/library-page.scripts.ts index 895443dc024d..9675cb002e30 100644 --- a/core/templates/dev/head/pages/library-page/library-page.scripts.ts +++ b/core/templates/dev/head/pages/library-page/library-page.scripts.ts @@ -16,6 +16,7 @@ * @fileoverview Directives required in library. */ +require('AppInit.ts'); require('App.ts'); require('pages/library-page/library-page.directive.ts'); diff --git a/core/templates/dev/head/pages/library-page/search-bar/search-bar.directive.ts b/core/templates/dev/head/pages/library-page/search-bar/search-bar.directive.ts index 617da95cc6c8..a8f5260a69d1 100755 --- a/core/templates/dev/head/pages/library-page/search-bar/search-bar.directive.ts +++ b/core/templates/dev/head/pages/library-page/search-bar/search-bar.directive.ts @@ -27,9 +27,7 @@ require('services/NavigationService.ts'); require('services/SearchService.ts'); require('services/contextual/UrlService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('searchBar', [ +angular.module('oppia').directive('searchBar', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/library-page/search-results/activity-tiles-infinity-grid.directive.ts b/core/templates/dev/head/pages/library-page/search-results/activity-tiles-infinity-grid.directive.ts index 93088d714a46..1556cd7a8cb9 100644 --- a/core/templates/dev/head/pages/library-page/search-results/activity-tiles-infinity-grid.directive.ts +++ b/core/templates/dev/head/pages/library-page/search-results/activity-tiles-infinity-grid.directive.ts @@ -20,9 +20,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/SearchService.ts'); require('services/contextual/WindowDimensionsService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('activityTilesInfinityGrid', [ +angular.module('oppia').directive('activityTilesInfinityGrid', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/library-page/search-results/search-results.directive.ts b/core/templates/dev/head/pages/library-page/search-results/search-results.directive.ts index 04b3731afaaf..8d2e348fb22e 100644 --- a/core/templates/dev/head/pages/library-page/search-results/search-results.directive.ts +++ b/core/templates/dev/head/pages/library-page/search-results/search-results.directive.ts @@ -24,10 +24,8 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/SiteAnalyticsService.ts'); require('services/UserService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('searchResults', [ - '$q', 'UrlInterpolationService', function($q, UrlInterpolationService) { +angular.module('oppia').directive('searchResults', [ + 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', scope: {}, diff --git a/core/templates/dev/head/pages/maintenance-page/maintenance-page.controller.ts b/core/templates/dev/head/pages/maintenance-page/maintenance-page.controller.ts index ad83d7ead0f4..37c5a1229c3b 100644 --- a/core/templates/dev/head/pages/maintenance-page/maintenance-page.controller.ts +++ b/core/templates/dev/head/pages/maintenance-page/maintenance-page.controller.ts @@ -16,13 +16,9 @@ * @fileoverview The controller for the maintenance page. */ -require('App.ts'); - require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.controller('Maintenance', [ +angular.module('oppia').controller('Maintenance', [ '$rootScope', '$scope', 'UrlInterpolationService', 'DEV_MODE', function($rootScope, $scope, UrlInterpolationService, DEV_MODE) { $scope.currentLang = 'en'; diff --git a/core/templates/dev/head/pages/maintenance-page/maintenance-page.scripts.ts b/core/templates/dev/head/pages/maintenance-page/maintenance-page.scripts.ts new file mode 100644 index 000000000000..82dcb10fea03 --- /dev/null +++ b/core/templates/dev/head/pages/maintenance-page/maintenance-page.scripts.ts @@ -0,0 +1,22 @@ +// Copyright 2019 The Oppia Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS-IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * @fileoverview Scripts required in maintenance page. + */ + +require('AppInit.ts'); +require('App.ts'); + +require('pages/maintenance-page/maintenance-page.controller.ts'); diff --git a/core/templates/dev/head/pages/moderator-page/moderator-page.controller.ts b/core/templates/dev/head/pages/moderator-page/moderator-page.controller.ts index 7b2bb337d920..7c3dab475d58 100644 --- a/core/templates/dev/head/pages/moderator-page/moderator-page.controller.ts +++ b/core/templates/dev/head/pages/moderator-page/moderator-page.controller.ts @@ -53,113 +53,112 @@ require('base_components/BaseContentDirective.ts'); require('services/AlertsService.ts'); require('services/DateTimeFormatService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('moderatorPage', ['UrlInterpolationService', function( - UrlInterpolationService) { - return { - restrict: 'E', - scope: {}, - bindToController: {}, - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/moderator-page/moderator-page.directive.html'), - controllerAs: '$ctrl', - controller: [ - '$http', '$rootScope', 'AlertsService', 'DateTimeFormatService', - function($http, $rootScope, AlertsService, DateTimeFormatService) { - var ctrl = this; - $rootScope.loadingMessage = 'Loading'; - ctrl.getDatetimeAsString = function(millisSinceEpoch) { - return DateTimeFormatService.getLocaleAbbreviatedDatetimeString( - millisSinceEpoch); - }; - - ctrl.getExplorationCreateUrl = function(explorationId) { - return '/create/' + explorationId; - }; - - ctrl.getActivityCreateUrl = function(reference) { - return ( - (reference.type === ( - 'exploration' ? '/create' : '/create_collection')) + - '/' + reference.id); - }; - - ctrl.allCommits = []; - ctrl.allFeedbackMessages = []; - // Map of exploration ids to objects containing a single key: title. - ctrl.explorationData = {}; - - ctrl.displayedFeaturedActivityReferences = []; - ctrl.lastSavedFeaturedActivityReferences = []; - ctrl.FEATURED_ACTIVITY_REFERENCES_SCHEMA = { - type: 'list', - items: { - type: 'dict', - properties: [{ - name: 'type', - schema: { - type: 'unicode', - choices: ['exploration', 'collection'] - } - }, { - name: 'id', - schema: { - type: 'unicode' +angular.module('oppia').directive('moderatorPage', [ + 'UrlInterpolationService', function(UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: {}, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/moderator-page/moderator-page.directive.html'), + controllerAs: '$ctrl', + controller: [ + '$http', '$rootScope', 'AlertsService', 'DateTimeFormatService', + function($http, $rootScope, AlertsService, DateTimeFormatService) { + var ctrl = this; + $rootScope.loadingMessage = 'Loading'; + ctrl.getDatetimeAsString = function(millisSinceEpoch) { + return DateTimeFormatService.getLocaleAbbreviatedDatetimeString( + millisSinceEpoch); + }; + + ctrl.getExplorationCreateUrl = function(explorationId) { + return '/create/' + explorationId; + }; + + ctrl.getActivityCreateUrl = function(reference) { + return ( + (reference.type === ( + 'exploration' ? '/create' : '/create_collection')) + + '/' + reference.id); + }; + + ctrl.allCommits = []; + ctrl.allFeedbackMessages = []; + // Map of exploration ids to objects containing a single key: title. + ctrl.explorationData = {}; + + ctrl.displayedFeaturedActivityReferences = []; + ctrl.lastSavedFeaturedActivityReferences = []; + ctrl.FEATURED_ACTIVITY_REFERENCES_SCHEMA = { + type: 'list', + items: { + type: 'dict', + properties: [{ + name: 'type', + schema: { + type: 'unicode', + choices: ['exploration', 'collection'] + } + }, { + name: 'id', + schema: { + type: 'unicode' + } + }] + } + }; + + var RECENT_COMMITS_URL = ( + '/recentcommitshandler/recent_commits' + + '?query_type=all_non_private_commits'); + // TODO(sll): Update this to also support collections. + $http.get(RECENT_COMMITS_URL).then(function(response) { + // Update the explorationData object with information about newly- + // discovered explorations. + var data = response.data; + var explorationIdsToExplorationData = data.exp_ids_to_exp_data; + for (var expId in explorationIdsToExplorationData) { + if (!ctrl.explorationData.hasOwnProperty(expId)) { + ctrl.explorationData[expId] = ( + explorationIdsToExplorationData[expId]); } - }] - } - }; - - var RECENT_COMMITS_URL = ( - '/recentcommitshandler/recent_commits' + - '?query_type=all_non_private_commits'); - // TODO(sll): Update this to also support collections. - $http.get(RECENT_COMMITS_URL).then(function(response) { - // Update the explorationData object with information about newly- - // discovered explorations. - var data = response.data; - var explorationIdsToExplorationData = data.exp_ids_to_exp_data; - for (var expId in explorationIdsToExplorationData) { - if (!ctrl.explorationData.hasOwnProperty(expId)) { - ctrl.explorationData[expId] = ( - explorationIdsToExplorationData[expId]); } - } - ctrl.allCommits = data.results; - $rootScope.loadingMessage = ''; - }); - - $http.get('/recent_feedback_messages').then(function(response) { - ctrl.allFeedbackMessages = response.data.results; - }); - - $http.get('/moderatorhandler/featured').then(function(response) { - ctrl.displayedFeaturedActivityReferences = ( - response.data.featured_activity_references); - ctrl.lastSavedFeaturedActivityReferences = angular.copy( - ctrl.displayedFeaturedActivityReferences); - }); - - ctrl.isSaveFeaturedActivitiesButtonDisabled = function() { - return angular.equals( - ctrl.displayedFeaturedActivityReferences, - ctrl.lastSavedFeaturedActivityReferences); - }; + ctrl.allCommits = data.results; + $rootScope.loadingMessage = ''; + }); - ctrl.saveFeaturedActivityReferences = function() { - AlertsService.clearWarnings(); + $http.get('/recent_feedback_messages').then(function(response) { + ctrl.allFeedbackMessages = response.data.results; + }); - var activityReferencesToSave = angular.copy( - ctrl.displayedFeaturedActivityReferences); - $http.post('/moderatorhandler/featured', { - featured_activity_reference_dicts: activityReferencesToSave - }).then(function() { - ctrl.lastSavedFeaturedActivityReferences = activityReferencesToSave; - AlertsService.addSuccessMessage('Featured activities saved.'); + $http.get('/moderatorhandler/featured').then(function(response) { + ctrl.displayedFeaturedActivityReferences = ( + response.data.featured_activity_references); + ctrl.lastSavedFeaturedActivityReferences = angular.copy( + ctrl.displayedFeaturedActivityReferences); }); - }; - } - ] - }; -}]); + + ctrl.isSaveFeaturedActivitiesButtonDisabled = function() { + return angular.equals( + ctrl.displayedFeaturedActivityReferences, + ctrl.lastSavedFeaturedActivityReferences); + }; + + ctrl.saveFeaturedActivityReferences = function() { + AlertsService.clearWarnings(); + + var activityReferencesToSave = angular.copy( + ctrl.displayedFeaturedActivityReferences); + $http.post('/moderatorhandler/featured', { + featured_activity_reference_dicts: activityReferencesToSave + }).then(function() { + ctrl.lastSavedFeaturedActivityReferences = ( + activityReferencesToSave); + AlertsService.addSuccessMessage('Featured activities saved.'); + }); + }; + } + ] + }; + }]); diff --git a/core/templates/dev/head/pages/moderator-page/moderator-page.scripts.ts b/core/templates/dev/head/pages/moderator-page/moderator-page.scripts.ts index faa0013d1e1b..dd9d608b0e55 100644 --- a/core/templates/dev/head/pages/moderator-page/moderator-page.scripts.ts +++ b/core/templates/dev/head/pages/moderator-page/moderator-page.scripts.ts @@ -16,6 +16,7 @@ * @fileoverview Scripts for the Oppia moderator page. */ +require('AppInit.ts'); require('App.ts'); require('pages/moderator-page/moderator-page.controller.ts'); diff --git a/core/templates/dev/head/pages/notifications-dashboard-page/notifications-dashboard-page.controller.ts b/core/templates/dev/head/pages/notifications-dashboard-page/notifications-dashboard-page.controller.ts index 0872452a4534..bb354dcd6a6b 100644 --- a/core/templates/dev/head/pages/notifications-dashboard-page/notifications-dashboard-page.controller.ts +++ b/core/templates/dev/head/pages/notifications-dashboard-page/notifications-dashboard-page.controller.ts @@ -20,9 +20,7 @@ require('base_components/BaseContentDirective.ts'); require('services/DateTimeFormatService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('notificationsDashboardPage', [ +angular.module('oppia').directive('notificationsDashboardPage', [ 'UrlInterpolationService', function( UrlInterpolationService) { return { diff --git a/core/templates/dev/head/pages/notifications-dashboard-page/notifications-dashboard-page.scripts.ts b/core/templates/dev/head/pages/notifications-dashboard-page/notifications-dashboard-page.scripts.ts index d53631fe5ff1..9b7102571e6f 100644 --- a/core/templates/dev/head/pages/notifications-dashboard-page/notifications-dashboard-page.scripts.ts +++ b/core/templates/dev/head/pages/notifications-dashboard-page/notifications-dashboard-page.scripts.ts @@ -16,6 +16,7 @@ * @fileoverview Directive scripts for the user's notifications dashboard. */ +require('AppInit.ts'); require('App.ts'); require( diff --git a/core/templates/dev/head/pages/practice-session-page/practice-session-page.constants.ts b/core/templates/dev/head/pages/practice-session-page/practice-session-page.constants.ts index 48792da91315..75da4b62f96e 100644 --- a/core/templates/dev/head/pages/practice-session-page/practice-session-page.constants.ts +++ b/core/templates/dev/head/pages/practice-session-page/practice-session-page.constants.ts @@ -16,17 +16,15 @@ * @fileoverview Constants for the practice session. */ -var oppia = require('AppInit.ts').module; +angular.module('oppia').constant('TOTAL_QUESTIONS', 20); -oppia.constant('TOTAL_QUESTIONS', 20); - -oppia.constant( +angular.module('oppia').constant( 'PRACTICE_SESSIONS_DATA_URL', '/practice_session/data/'); -oppia.constant( +angular.module('oppia').constant( 'TOPIC_VIEWER_PAGE', '/topic/'); -oppia.constant( +angular.module('oppia').constant( 'PRACTICE_SESSIONS_URL', '/practice_session/'); diff --git a/core/templates/dev/head/pages/practice-session-page/practice-session-page.controller.ts b/core/templates/dev/head/pages/practice-session-page/practice-session-page.controller.ts index 19ff5fdc4607..83ac9b2f2b42 100644 --- a/core/templates/dev/head/pages/practice-session-page/practice-session-page.controller.ts +++ b/core/templates/dev/head/pages/practice-session-page/practice-session-page.controller.ts @@ -33,81 +33,81 @@ require('services/PageTitleService.ts'); require('pages/practice-session-page/practice-session-page.constants.ts'); require('pages/interaction-specs.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('practiceSessionPage', ['UrlInterpolationService', function( - UrlInterpolationService) { - return { - restrict: 'E', - scope: {}, - bindToController: {}, - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/practice-session-page/practice-session-page.directive.html'), - controllerAs: '$ctrl', - controller: [ - '$http', '$rootScope', 'AlertsService', 'PageTitleService', - 'UrlInterpolationService', 'UrlService', - 'FATAL_ERROR_CODES', 'PRACTICE_SESSIONS_DATA_URL', - 'PRACTICE_SESSIONS_URL', - 'TOPIC_VIEWER_PAGE', 'TOTAL_QUESTIONS', - function( - $http, $rootScope, AlertsService, PageTitleService, - UrlInterpolationService, UrlService, - FATAL_ERROR_CODES, PRACTICE_SESSIONS_DATA_URL, - PRACTICE_SESSIONS_URL, - TOPIC_VIEWER_PAGE, TOTAL_QUESTIONS - ) { - var ctrl = this; - ctrl.topicName = UrlService.getTopicNameFromLearnerUrl(); - var _fetchSkillDetails = function() { - var practiceSessionsDataUrl = UrlInterpolationService.interpolateUrl( - PRACTICE_SESSIONS_DATA_URL, { - topic_name: ctrl.topicName - }); - var practiceSessionsUrl = UrlInterpolationService.interpolateUrl( - PRACTICE_SESSIONS_URL, { - topic_name: ctrl.topicName - }); - var topicViewerUrl = UrlInterpolationService.interpolateUrl( - TOPIC_VIEWER_PAGE, { - topic_name: ctrl.topicName +angular.module('oppia').directive('practiceSessionPage', [ + 'UrlInterpolationService', function( + UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: {}, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/practice-session-page/practice-session-page.directive.html'), + controllerAs: '$ctrl', + controller: [ + '$http', '$rootScope', 'AlertsService', 'PageTitleService', + 'UrlInterpolationService', 'UrlService', + 'FATAL_ERROR_CODES', 'PRACTICE_SESSIONS_DATA_URL', + 'PRACTICE_SESSIONS_URL', + 'TOPIC_VIEWER_PAGE', 'TOTAL_QUESTIONS', + function( + $http, $rootScope, AlertsService, PageTitleService, + UrlInterpolationService, UrlService, + FATAL_ERROR_CODES, PRACTICE_SESSIONS_DATA_URL, + PRACTICE_SESSIONS_URL, + TOPIC_VIEWER_PAGE, TOTAL_QUESTIONS + ) { + var ctrl = this; + ctrl.topicName = UrlService.getTopicNameFromLearnerUrl(); + var _fetchSkillDetails = function() { + var practiceSessionsDataUrl = UrlInterpolationService + .interpolateUrl( + PRACTICE_SESSIONS_DATA_URL, { + topic_name: ctrl.topicName + }); + var practiceSessionsUrl = UrlInterpolationService.interpolateUrl( + PRACTICE_SESSIONS_URL, { + topic_name: ctrl.topicName + }); + var topicViewerUrl = UrlInterpolationService.interpolateUrl( + TOPIC_VIEWER_PAGE, { + topic_name: ctrl.topicName + }); + $http.get(practiceSessionsDataUrl).then(function(result) { + var skillList = []; + var skillDescriptions = []; + for (var skillId in result.data.skill_descriptions) { + skillList.push(skillId); + skillDescriptions.push( + result.data.skill_descriptions[skillId]); + } + var questionPlayerConfig = { + resultActionButtons: [ + { + type: 'BOOST_SCORE', + text: 'Boost My Score' + }, + { + type: 'RETRY_SESSION', + text: 'New Session', + url: practiceSessionsUrl + }, + { + type: 'DASHBOARD', + text: 'My Dashboard', + url: topicViewerUrl + } + ], + skillList: skillList, + skillDescriptions: skillDescriptions, + questionCount: TOTAL_QUESTIONS + }; + ctrl.questionPlayerConfig = questionPlayerConfig; }); - $http.get(practiceSessionsDataUrl).then(function(result) { - var skillList = []; - var skillDescriptions = []; - for (var skillId in result.data.skill_descriptions) { - skillList.push(skillId); - skillDescriptions.push( - result.data.skill_descriptions[skillId]); - } - var questionPlayerConfig = { - resultActionButtons: [ - { - type: 'BOOST_SCORE', - text: 'Boost My Score' - }, - { - type: 'RETRY_SESSION', - text: 'New Session', - url: practiceSessionsUrl - }, - { - type: 'DASHBOARD', - text: 'My Dashboard', - url: topicViewerUrl - } - ], - skillList: skillList, - skillDescriptions: skillDescriptions, - questionCount: TOTAL_QUESTIONS - }; - ctrl.questionPlayerConfig = questionPlayerConfig; - }); - }; - _fetchSkillDetails(); - PageTitleService.setPageTitle( - 'Practice Session: ' + ctrl.topicName + ' - Oppia'); - } - ] - }; -}]); + }; + _fetchSkillDetails(); + PageTitleService.setPageTitle( + 'Practice Session: ' + ctrl.topicName + ' - Oppia'); + } + ] + }; + }]); diff --git a/core/templates/dev/head/pages/practice-session-page/practice-session-page.scripts.ts b/core/templates/dev/head/pages/practice-session-page/practice-session-page.scripts.ts index b23454b3eaff..a8126f5a8b79 100644 --- a/core/templates/dev/head/pages/practice-session-page/practice-session-page.scripts.ts +++ b/core/templates/dev/head/pages/practice-session-page/practice-session-page.scripts.ts @@ -16,6 +16,7 @@ * @fileoverview Directive scripts for the practice session. */ +require('AppInit.ts'); require('App.ts'); require('pages/practice-session-page/practice-session-page.controller.ts'); diff --git a/core/templates/dev/head/pages/preferences-page/preferences-page.controller.ts b/core/templates/dev/head/pages/preferences-page/preferences-page.controller.ts index ff7f7e6cd7bb..585c338a97f5 100644 --- a/core/templates/dev/head/pages/preferences-page/preferences-page.controller.ts +++ b/core/templates/dev/head/pages/preferences-page/preferences-page.controller.ts @@ -31,255 +31,254 @@ require('services/AlertsService.ts'); require('services/UserService.ts'); require('services/UtilsService.ts'); -var oppia = require('AppInit.ts').module; +angular.module('oppia').directive('preferencesPage', [ + 'UrlInterpolationService', function(UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: { + subjectInterests: '=', + preferredLanguageCodes: '=', + preferredSiteLanguageCode: '=', + preferredAudioLanguageCode: '=' + }, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/preferences-page/preferences-page.directive.html'), + controllerAs: '$ctrl', + controller: [ + '$http', '$q', '$rootScope', '$scope', '$timeout', '$translate', + '$window', '$uibModal', 'AlertsService', 'LanguageUtilService', + 'UrlInterpolationService', 'UserService', 'UtilsService', + 'DASHBOARD_TYPE_CREATOR', 'DASHBOARD_TYPE_LEARNER', + 'SUPPORTED_AUDIO_LANGUAGES', 'SUPPORTED_SITE_LANGUAGES', + function( + $http, $q, $rootScope, $scope, $timeout, $translate, + $window, $uibModal, AlertsService, LanguageUtilService, + UrlInterpolationService, UserService, UtilsService, + DASHBOARD_TYPE_CREATOR, DASHBOARD_TYPE_LEARNER, + SUPPORTED_AUDIO_LANGUAGES, SUPPORTED_SITE_LANGUAGES) { + var ctrl = this; + var _PREFERENCES_DATA_URL = '/preferenceshandler/data'; + ctrl.profilePictureDataUrl = ''; + ctrl.DASHBOARD_TYPE_CREATOR = DASHBOARD_TYPE_CREATOR; + ctrl.DASHBOARD_TYPE_LEARNER = DASHBOARD_TYPE_LEARNER; -oppia.directive('preferencesPage', ['UrlInterpolationService', function( - UrlInterpolationService) { - return { - restrict: 'E', - scope: {}, - bindToController: { - subjectInterests: '=', - preferredLanguageCodes: '=', - preferredSiteLanguageCode: '=', - preferredAudioLanguageCode: '=' - }, - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/preferences-page/preferences-page.directive.html'), - controllerAs: '$ctrl', - controller: [ - '$http', '$q', '$rootScope', '$scope', '$timeout', '$translate', - '$window', '$uibModal', 'AlertsService', 'LanguageUtilService', - 'UrlInterpolationService', 'UserService', 'UtilsService', - 'DASHBOARD_TYPE_CREATOR', 'DASHBOARD_TYPE_LEARNER', - 'SUPPORTED_AUDIO_LANGUAGES', 'SUPPORTED_SITE_LANGUAGES', - function( - $http, $q, $rootScope, $scope, $timeout, $translate, - $window, $uibModal, AlertsService, LanguageUtilService, - UrlInterpolationService, UserService, UtilsService, - DASHBOARD_TYPE_CREATOR, DASHBOARD_TYPE_LEARNER, - SUPPORTED_AUDIO_LANGUAGES, SUPPORTED_SITE_LANGUAGES) { - var ctrl = this; - var _PREFERENCES_DATA_URL = '/preferenceshandler/data'; - ctrl.profilePictureDataUrl = ''; - ctrl.DASHBOARD_TYPE_CREATOR = DASHBOARD_TYPE_CREATOR; - ctrl.DASHBOARD_TYPE_LEARNER = DASHBOARD_TYPE_LEARNER; - - ctrl.username = ''; - $rootScope.loadingMessage = 'Loading'; - var userInfoPromise = UserService.getUserInfoAsync(); - userInfoPromise.then(function(userInfo) { - ctrl.username = userInfo.getUsername(); - }); + ctrl.username = ''; + $rootScope.loadingMessage = 'Loading'; + var userInfoPromise = UserService.getUserInfoAsync(); + userInfoPromise.then(function(userInfo) { + ctrl.username = userInfo.getUsername(); + }); - ctrl.hasPageLoaded = false; - var preferencesPromise = $http.get(_PREFERENCES_DATA_URL); - preferencesPromise.then(function(response) { - var data = response.data; - ctrl.userBio = data.user_bio; - ctrl.subjectInterests = data.subject_interests; - ctrl.preferredLanguageCodes = data.preferred_language_codes; - ctrl.profilePictureDataUrl = data.profile_picture_data_url; - ctrl.defaultDashboard = data.default_dashboard; - ctrl.canReceiveEmailUpdates = data.can_receive_email_updates; - ctrl.canReceiveEditorRoleEmail = data.can_receive_editor_role_email; - ctrl.canReceiveSubscriptionEmail = - data.can_receive_subscription_email; - ctrl.canReceiveFeedbackMessageEmail = ( - data.can_receive_feedback_message_email); - ctrl.preferredSiteLanguageCode = data.preferred_site_language_code; - ctrl.preferredAudioLanguageCode = - data.preferred_audio_language_code; - ctrl.subscriptionList = data.subscription_list; - ctrl.hasPageLoaded = true; - _forceSelect2Refresh(); - }); + ctrl.hasPageLoaded = false; + var preferencesPromise = $http.get(_PREFERENCES_DATA_URL); + preferencesPromise.then(function(response) { + var data = response.data; + ctrl.userBio = data.user_bio; + ctrl.subjectInterests = data.subject_interests; + ctrl.preferredLanguageCodes = data.preferred_language_codes; + ctrl.profilePictureDataUrl = data.profile_picture_data_url; + ctrl.defaultDashboard = data.default_dashboard; + ctrl.canReceiveEmailUpdates = data.can_receive_email_updates; + ctrl.canReceiveEditorRoleEmail = data.can_receive_editor_role_email; + ctrl.canReceiveSubscriptionEmail = + data.can_receive_subscription_email; + ctrl.canReceiveFeedbackMessageEmail = ( + data.can_receive_feedback_message_email); + ctrl.preferredSiteLanguageCode = data.preferred_site_language_code; + ctrl.preferredAudioLanguageCode = + data.preferred_audio_language_code; + ctrl.subscriptionList = data.subscription_list; + ctrl.hasPageLoaded = true; + _forceSelect2Refresh(); + }); - $q.all([userInfoPromise, preferencesPromise]).then(function() { - $rootScope.loadingMessage = ''; - }); + $q.all([userInfoPromise, preferencesPromise]).then(function() { + $rootScope.loadingMessage = ''; + }); - ctrl.getStaticImageUrl = UrlInterpolationService.getStaticImageUrl; + ctrl.getStaticImageUrl = UrlInterpolationService.getStaticImageUrl; - var _saveDataItem = function(updateType, data) { - $http.put(_PREFERENCES_DATA_URL, { - update_type: updateType, - data: data - }); - }; + var _saveDataItem = function(updateType, data) { + $http.put(_PREFERENCES_DATA_URL, { + update_type: updateType, + data: data + }); + }; - // Select2 dropdown cannot automatically refresh its display - // after being translated. - // Use ctrl.select2DropdownIsShown in its ng-if attribute - // and this function to force it to reload - var _forceSelect2Refresh = function() { - ctrl.select2DropdownIsShown = false; - $timeout(function() { - ctrl.select2DropdownIsShown = true; - }, 100); - }; + // Select2 dropdown cannot automatically refresh its display + // after being translated. + // Use ctrl.select2DropdownIsShown in its ng-if attribute + // and this function to force it to reload + var _forceSelect2Refresh = function() { + ctrl.select2DropdownIsShown = false; + $timeout(function() { + ctrl.select2DropdownIsShown = true; + }, 100); + }; - ctrl.saveUserBio = function(userBio) { - _saveDataItem('user_bio', userBio); - }; + ctrl.saveUserBio = function(userBio) { + _saveDataItem('user_bio', userBio); + }; - ctrl.subjectInterestsChangedAtLeastOnce = false; - ctrl.subjectInterestsWarningText = null; - ctrl.TAG_REGEX_STRING = '^[a-z ]+$'; + ctrl.subjectInterestsChangedAtLeastOnce = false; + ctrl.subjectInterestsWarningText = null; + ctrl.TAG_REGEX_STRING = '^[a-z ]+$'; - ctrl.updateSubjectInterestsWarning = function(subjectInterests) { - var TAG_REGEX = new RegExp(ctrl.TAG_REGEX_STRING); + ctrl.updateSubjectInterestsWarning = function(subjectInterests) { + var TAG_REGEX = new RegExp(ctrl.TAG_REGEX_STRING); - if (subjectInterests instanceof Array) { - for (var i = 0; i < subjectInterests.length; i++) { - if (UtilsService.isString(subjectInterests[i])) { - if (!TAG_REGEX.test(subjectInterests[i])) { - ctrl.subjectInterestsWarningText = ( - 'Subject interests should use only lowercase letters.'); + if (subjectInterests instanceof Array) { + for (var i = 0; i < subjectInterests.length; i++) { + if (UtilsService.isString(subjectInterests[i])) { + if (!TAG_REGEX.test(subjectInterests[i])) { + ctrl.subjectInterestsWarningText = ( + 'Subject interests should use only lowercase letters.'); + } + } else { + console.error( + 'Error: received bad value for a subject interest.' + + ' Expected a string, got ', subjectInterests[i]); + throw Error( + 'Error: received bad value for a subject interest.'); } - } else { - console.error( - 'Error: received bad value for a subject interest. Expected' + - ' a string, got ', subjectInterests[i]); - throw Error( - 'Error: received bad value for a subject interest.'); } + } else { + console.error( + 'Error: received bad value for subject interests. Expected' + + ' list of strings, got ', subjectInterests); + throw Error('Error: received bad value for subject interests.'); } - } else { - console.error( - 'Error: received bad value for subject interests. Expected list' + - ' of strings, got ', subjectInterests); - throw Error('Error: received bad value for subject interests.'); - } - }; + }; - ctrl.onSubjectInterestsSelectionChange = function(subjectInterests) { - AlertsService.clearWarnings(); - ctrl.subjectInterestsChangedAtLeastOnce = true; - ctrl.subjectInterestsWarningText = null; - ctrl.updateSubjectInterestsWarning(subjectInterests); - if (ctrl.subjectInterestsWarningText === null) { - _saveDataItem('subject_interests', subjectInterests); - } - }; + ctrl.onSubjectInterestsSelectionChange = function(subjectInterests) { + AlertsService.clearWarnings(); + ctrl.subjectInterestsChangedAtLeastOnce = true; + ctrl.subjectInterestsWarningText = null; + ctrl.updateSubjectInterestsWarning(subjectInterests); + if (ctrl.subjectInterestsWarningText === null) { + _saveDataItem('subject_interests', subjectInterests); + } + }; - ctrl.savePreferredSiteLanguageCodes = function( - preferredSiteLanguageCode) { - $translate.use(preferredSiteLanguageCode); - _forceSelect2Refresh(); - _saveDataItem( - 'preferred_site_language_code', preferredSiteLanguageCode); - }; + ctrl.savePreferredSiteLanguageCodes = function( + preferredSiteLanguageCode) { + $translate.use(preferredSiteLanguageCode); + _forceSelect2Refresh(); + _saveDataItem( + 'preferred_site_language_code', preferredSiteLanguageCode); + }; - ctrl.savePreferredAudioLanguageCode = function( - preferredAudioLanguageCode) { - _saveDataItem( - 'preferred_audio_language_code', preferredAudioLanguageCode); - }; + ctrl.savePreferredAudioLanguageCode = function( + preferredAudioLanguageCode) { + _saveDataItem( + 'preferred_audio_language_code', preferredAudioLanguageCode); + }; - ctrl.showUsernamePopover = function(creatorUsername) { - // The popover on the subscription card is only shown if the length of - // the creator username is greater than 10 and the user hovers over - // the truncated username. - if (creatorUsername.length > 10) { - return 'mouseenter'; - } else { - return 'none'; - } - }; + ctrl.showUsernamePopover = function(creatorUsername) { + // The popover on the subscription card is only shown if the length + // of the creator username is greater than 10 and the user hovers + // over the truncated username. + if (creatorUsername.length > 10) { + return 'mouseenter'; + } else { + return 'none'; + } + }; - ctrl.saveEmailPreferences = function( - canReceiveEmailUpdates, canReceiveEditorRoleEmail, - canReceiveFeedbackMessageEmail, canReceiveSubscriptionEmail) { - var data = { - can_receive_email_updates: canReceiveEmailUpdates, - can_receive_editor_role_email: canReceiveEditorRoleEmail, - can_receive_feedback_message_email: canReceiveFeedbackMessageEmail, - can_receive_subscription_email: canReceiveSubscriptionEmail + ctrl.saveEmailPreferences = function( + canReceiveEmailUpdates, canReceiveEditorRoleEmail, + canReceiveFeedbackMessageEmail, canReceiveSubscriptionEmail) { + var data = { + can_receive_email_updates: canReceiveEmailUpdates, + can_receive_editor_role_email: canReceiveEditorRoleEmail, + can_receive_feedback_message_email: ( + canReceiveFeedbackMessageEmail), + can_receive_subscription_email: canReceiveSubscriptionEmail + }; + _saveDataItem('email_preferences', data); }; - _saveDataItem('email_preferences', data); - }; - ctrl.savePreferredLanguageCodes = function(preferredLanguageCodes) { - _saveDataItem('preferred_language_codes', preferredLanguageCodes); - }; + ctrl.savePreferredLanguageCodes = function(preferredLanguageCodes) { + _saveDataItem('preferred_language_codes', preferredLanguageCodes); + }; - ctrl.saveDefaultDashboard = function(defaultDashboard) { - _saveDataItem('default_dashboard', defaultDashboard); - }; + ctrl.saveDefaultDashboard = function(defaultDashboard) { + _saveDataItem('default_dashboard', defaultDashboard); + }; - ctrl.showEditProfilePictureModal = function() { - $uibModal.open({ - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/preferences-page/modal-templates/' + - 'edit-profile-picture-modal.directive.html'), - backdrop: true, - controller: [ - '$scope', '$uibModalInstance', function( - $scope, $uibModalInstance) { - $scope.uploadedImage = null; - $scope.croppedImageDataUrl = ''; - $scope.invalidImageWarningIsShown = false; + ctrl.showEditProfilePictureModal = function() { + $uibModal.open({ + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/preferences-page/modal-templates/' + + 'edit-profile-picture-modal.directive.html'), + backdrop: true, + controller: [ + '$scope', '$uibModalInstance', function( + $scope, $uibModalInstance) { + $scope.uploadedImage = null; + $scope.croppedImageDataUrl = ''; + $scope.invalidImageWarningIsShown = false; - $scope.onFileChanged = function(file) { - $('.oppia-profile-image-uploader').fadeOut(function() { - $scope.invalidImageWarningIsShown = false; + $scope.onFileChanged = function(file) { + $('.oppia-profile-image-uploader').fadeOut(function() { + $scope.invalidImageWarningIsShown = false; - var reader = new FileReader(); - reader.onload = function(e) { - $scope.$apply(function() { - $scope.uploadedImage = (e.target).result; - }); - }; - reader.readAsDataURL(file); + var reader = new FileReader(); + reader.onload = function(e) { + $scope.$apply(function() { + $scope.uploadedImage = (e.target).result; + }); + }; + reader.readAsDataURL(file); - $timeout(function() { - $('.oppia-profile-image-uploader').fadeIn(); - }, 100); - }); - }; + $timeout(function() { + $('.oppia-profile-image-uploader').fadeIn(); + }, 100); + }); + }; - $scope.reset = function() { - $scope.uploadedImage = null; - $scope.croppedImageDataUrl = ''; - }; + $scope.reset = function() { + $scope.uploadedImage = null; + $scope.croppedImageDataUrl = ''; + }; - $scope.onInvalidImageLoaded = function() { - $scope.uploadedImage = null; - $scope.croppedImageDataUrl = ''; - $scope.invalidImageWarningIsShown = true; - }; + $scope.onInvalidImageLoaded = function() { + $scope.uploadedImage = null; + $scope.croppedImageDataUrl = ''; + $scope.invalidImageWarningIsShown = true; + }; - $scope.confirm = function() { - $uibModalInstance.close($scope.croppedImageDataUrl); - }; + $scope.confirm = function() { + $uibModalInstance.close($scope.croppedImageDataUrl); + }; - $scope.cancel = function() { - $uibModalInstance.dismiss('cancel'); - }; - } - ] - }).result.then(function(newProfilePictureDataUrl) { - UserService.setProfileImageDataUrlAsync(newProfilePictureDataUrl) - .then(function() { - // The reload is needed in order to update the profile picture - // in the top-right corner. - $window.reload(); - }); - }); - }; + $scope.cancel = function() { + $uibModalInstance.dismiss('cancel'); + }; + } + ] + }).result.then(function(newProfilePictureDataUrl) { + UserService.setProfileImageDataUrlAsync(newProfilePictureDataUrl) + .then(function() { + // The reload is needed in order to update the profile picture + // in the top-right corner. + $window.reload(); + }); + }); + }; - ctrl.LANGUAGE_CHOICES = LanguageUtilService.getLanguageIdsAndTexts(); - ctrl.SITE_LANGUAGE_CHOICES = SUPPORTED_SITE_LANGUAGES; - ctrl.AUDIO_LANGUAGE_CHOICES = SUPPORTED_AUDIO_LANGUAGES.map( - function(languageItem) { - return { - id: languageItem.id, - text: languageItem.description - }; - } - ); - } - ] - }; -}]); + ctrl.LANGUAGE_CHOICES = LanguageUtilService.getLanguageIdsAndTexts(); + ctrl.SITE_LANGUAGE_CHOICES = SUPPORTED_SITE_LANGUAGES; + ctrl.AUDIO_LANGUAGE_CHOICES = SUPPORTED_AUDIO_LANGUAGES.map( + function(languageItem) { + return { + id: languageItem.id, + text: languageItem.description + }; + } + ); + } + ] + }; + }]); diff --git a/core/templates/dev/head/pages/preferences-page/preferences-page.scripts.ts b/core/templates/dev/head/pages/preferences-page/preferences-page.scripts.ts index 44a32ff12369..1c425089065c 100644 --- a/core/templates/dev/head/pages/preferences-page/preferences-page.scripts.ts +++ b/core/templates/dev/head/pages/preferences-page/preferences-page.scripts.ts @@ -16,6 +16,7 @@ * @fileoverview Directive scripts for the Oppia 'edit preferences' page. */ +require('AppInit.ts'); require('App.ts'); require('pages/OppiaFooterDirective.ts'); diff --git a/core/templates/dev/head/pages/privacy-page/privacy-page.controller.ts b/core/templates/dev/head/pages/privacy-page/privacy-page.scripts.ts similarity index 97% rename from core/templates/dev/head/pages/privacy-page/privacy-page.controller.ts rename to core/templates/dev/head/pages/privacy-page/privacy-page.scripts.ts index d77a7bdf4464..008a151246a6 100644 --- a/core/templates/dev/head/pages/privacy-page/privacy-page.controller.ts +++ b/core/templates/dev/head/pages/privacy-page/privacy-page.scripts.ts @@ -16,6 +16,7 @@ * @fileoverview Directives required in privacy page. */ +require('AppInit.ts'); require('App.ts'); require('pages/OppiaFooterDirective.ts'); diff --git a/core/templates/dev/head/pages/profile-page/profile-page-navbar.directive.ts b/core/templates/dev/head/pages/profile-page/profile-page-navbar.directive.ts index 9f9cafb16227..fa2ca31270f4 100644 --- a/core/templates/dev/head/pages/profile-page/profile-page-navbar.directive.ts +++ b/core/templates/dev/head/pages/profile-page/profile-page-navbar.directive.ts @@ -19,10 +19,8 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/contextual/UrlService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('profilePageNavbar', ['UrlInterpolationService', - function(UrlInterpolationService) { +angular.module('oppia').directive('profilePageNavbar', [ + 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', scope: {}, diff --git a/core/templates/dev/head/pages/profile-page/profile-page.controller.ts b/core/templates/dev/head/pages/profile-page/profile-page.controller.ts index eadfb24d5d74..0761a6936ce6 100644 --- a/core/templates/dev/head/pages/profile-page/profile-page.controller.ts +++ b/core/templates/dev/head/pages/profile-page/profile-page.controller.ts @@ -29,190 +29,191 @@ require('services/contextual/UrlService.ts'); require('services/UserService.ts'); require('services/DateTimeFormatService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('profilePage', ['UrlInterpolationService', function( - UrlInterpolationService) { - return { - restrict: 'E', - scope: {}, - bindToController: {}, - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/profile-page/profile-page.directive.html'), - controllerAs: '$ctrl', - controller: [ - '$http', '$log', '$rootScope', '$window', 'DateTimeFormatService', - 'UrlInterpolationService', 'UrlService', 'UserService', - function($http, $log, $rootScope, $window, DateTimeFormatService, - UrlInterpolationService, UrlService, UserService) { - var ctrl = this; - var profileDataUrl = ( - '/profilehandler/data/' + UrlService.getUsernameFromProfileUrl()); - var DEFAULT_PROFILE_PICTURE_URL = UrlInterpolationService - .getStaticImageUrl('/general/no_profile_picture.png'); - - ctrl.getLocaleDateString = function(millisSinceEpoch) { - return DateTimeFormatService.getLocaleDateString(millisSinceEpoch); - }; - - $rootScope.loadingMessage = 'Loading'; - $http.get(profileDataUrl).then(function(response) { - var data = response.data; - $rootScope.loadingMessage = ''; - ctrl.username = { - title: 'Username', - value: data.profile_username, - helpText: (data.profile_username) +angular.module('oppia').directive('profilePage', [ + 'UrlInterpolationService', function( + UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: {}, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/profile-page/profile-page.directive.html'), + controllerAs: '$ctrl', + controller: [ + '$http', '$log', '$rootScope', '$window', 'DateTimeFormatService', + 'UrlInterpolationService', 'UrlService', 'UserService', + function($http, $log, $rootScope, $window, DateTimeFormatService, + UrlInterpolationService, UrlService, UserService) { + var ctrl = this; + var profileDataUrl = ( + '/profilehandler/data/' + UrlService.getUsernameFromProfileUrl()); + var DEFAULT_PROFILE_PICTURE_URL = UrlInterpolationService + .getStaticImageUrl('/general/no_profile_picture.png'); + + ctrl.getLocaleDateString = function(millisSinceEpoch) { + return DateTimeFormatService.getLocaleDateString(millisSinceEpoch); }; - ctrl.usernameIsLong = data.profile_username.length > 16; - ctrl.userBio = data.user_bio; - ctrl.userDisplayedStatistics = [{ - title: 'Impact', - value: data.user_impact_score, - helpText: ( - 'A rough measure of the impact of explorations created by this ' + - 'user. Better ratings and more playthroughs improve this score.') - }, { - title: 'Created', - value: data.created_exp_summary_dicts.length - }, { - title: 'Edited', - value: data.edited_exp_summary_dicts.length - }]; - - ctrl.userEditedExplorations = data.edited_exp_summary_dicts.sort( - function(exploration1, exploration2) { - if (exploration1.ratings > exploration2.ratings) { - return 1; - } else if (exploration1.ratings === exploration2.ratings) { - if (exploration1.playthroughs > exploration2.playthroughs) { + + $rootScope.loadingMessage = 'Loading'; + $http.get(profileDataUrl).then(function(response) { + var data = response.data; + $rootScope.loadingMessage = ''; + ctrl.username = { + title: 'Username', + value: data.profile_username, + helpText: (data.profile_username) + }; + ctrl.usernameIsLong = data.profile_username.length > 16; + ctrl.userBio = data.user_bio; + ctrl.userDisplayedStatistics = [{ + title: 'Impact', + value: data.user_impact_score, + helpText: ( + 'A rough measure of the impact of explorations created by ' + + 'this user. Better ratings and more playthroughs improve ' + + 'this score.') + }, { + title: 'Created', + value: data.created_exp_summary_dicts.length + }, { + title: 'Edited', + value: data.edited_exp_summary_dicts.length + }]; + + ctrl.userEditedExplorations = data.edited_exp_summary_dicts.sort( + function(exploration1, exploration2) { + if (exploration1.ratings > exploration2.ratings) { return 1; - } else if ( - exploration1.playthroughs > exploration2.playthroughs) { - return 0; + } else if (exploration1.ratings === exploration2.ratings) { + if (exploration1.playthroughs > exploration2.playthroughs) { + return 1; + } else if ( + exploration1.playthroughs > exploration2.playthroughs) { + return 0; + } else { + return -1; + } } else { return -1; } - } else { - return -1; } - } - ); - - ctrl.userNotLoggedIn = !data.username; - - ctrl.isAlreadySubscribed = data.is_already_subscribed; - ctrl.isUserVisitingOwnProfile = data.is_user_visiting_own_profile; - - ctrl.subscriptionButtonPopoverText = ''; - - ctrl.currentPageNumber = 0; - ctrl.PAGE_SIZE = 6; - ctrl.startingExplorationNumber = 1; - ctrl.endingExplorationNumber = 6; - ctrl.Math = window.Math; - ctrl.profileIsOfCurrentUser = data.profile_is_of_current_user; - - ctrl.changeSubscriptionStatus = function() { - if (ctrl.userNotLoggedIn) { - UserService.getLoginUrlAsync().then( - function(loginUrl) { - if (loginUrl) { - window.location.href = loginUrl; - } else { - throw Error('Login url not found.'); + ); + + ctrl.userNotLoggedIn = !data.username; + + ctrl.isAlreadySubscribed = data.is_already_subscribed; + ctrl.isUserVisitingOwnProfile = data.is_user_visiting_own_profile; + + ctrl.subscriptionButtonPopoverText = ''; + + ctrl.currentPageNumber = 0; + ctrl.PAGE_SIZE = 6; + ctrl.startingExplorationNumber = 1; + ctrl.endingExplorationNumber = 6; + ctrl.Math = window.Math; + ctrl.profileIsOfCurrentUser = data.profile_is_of_current_user; + + ctrl.changeSubscriptionStatus = function() { + if (ctrl.userNotLoggedIn) { + UserService.getLoginUrlAsync().then( + function(loginUrl) { + if (loginUrl) { + window.location.href = loginUrl; + } else { + throw Error('Login url not found.'); + } } + ); + } else { + if (!ctrl.isAlreadySubscribed) { + ctrl.isAlreadySubscribed = true; + $http.post('/subscribehandler', { + creator_username: data.profile_username + }); + } else { + ctrl.isAlreadySubscribed = false; + $http.post('/unsubscribehandler', { + creator_username: data.profile_username + }); } - ); - } else { - if (!ctrl.isAlreadySubscribed) { - ctrl.isAlreadySubscribed = true; - $http.post('/subscribehandler', { - creator_username: data.profile_username - }); + ctrl.updateSubscriptionButtonPopoverText(); + } + }; + + ctrl.updateSubscriptionButtonPopoverText = function() { + if (ctrl.userNotLoggedIn) { + ctrl.subscriptionButtonPopoverText = ( + 'Log in or sign up to subscribe to your favorite creators.'); + } else if (ctrl.isAlreadySubscribed) { + ctrl.subscriptionButtonPopoverText = ( + 'Unsubscribe to stop receiving email notifications ' + + 'regarding new explorations published by ' + + ctrl.username.value + '.'); } else { - ctrl.isAlreadySubscribed = false; - $http.post('/unsubscribehandler', { - creator_username: data.profile_username - }); + ctrl.subscriptionButtonPopoverText = ( + 'Receive email notifications, whenever ' + + ctrl.username.value + ' publishes a new exploration.'); } - ctrl.updateSubscriptionButtonPopoverText(); - } - }; + }; + ctrl.updateSubscriptionButtonPopoverText(); - ctrl.updateSubscriptionButtonPopoverText = function() { - if (ctrl.userNotLoggedIn) { - ctrl.subscriptionButtonPopoverText = ( - 'Log in or sign up to subscribe to your favorite creators.'); - } else if (ctrl.isAlreadySubscribed) { - ctrl.subscriptionButtonPopoverText = ( - 'Unsubscribe to stop receiving email notifications regarding ' + - 'new explorations published by ' + ctrl.username.value + '.'); - } else { - ctrl.subscriptionButtonPopoverText = ( - 'Receive email notifications, whenever ' + - ctrl.username.value + ' publishes a new exploration.'); - } - }; - ctrl.updateSubscriptionButtonPopoverText(); - - ctrl.goToPreviousPage = function() { - if (ctrl.currentPageNumber === 0) { - $log.error('Error: cannot decrement page'); - } else { - ctrl.currentPageNumber--; - ctrl.startingExplorationNumber = ( - ctrl.currentPageNumber * ctrl.PAGE_SIZE + 1 - ); - ctrl.endingExplorationNumber = ( - (ctrl.currentPageNumber + 1) * ctrl.PAGE_SIZE - ); - } - }; - ctrl.goToNextPage = function() { - if ((ctrl.currentPageNumber + 1) * ctrl.PAGE_SIZE >= ( - data.edited_exp_summary_dicts.length)) { - $log.error('Error: Cannot increment page'); - } else { - ctrl.currentPageNumber++; - ctrl.startingExplorationNumber = ( - ctrl.currentPageNumber * ctrl.PAGE_SIZE + 1 - ); - ctrl.endingExplorationNumber = ( - Math.min(ctrl.numUserPortfolioExplorations, - (ctrl.currentPageNumber + 1) * ctrl.PAGE_SIZE) - ); - } - }; - - ctrl.getExplorationsToDisplay = function() { - ctrl.explorationsOnPage = []; - if (ctrl.userEditedExplorations.length === 0) { - return ctrl.explorationsOnPage; - } - ctrl.explorationIndexStart = ( - ctrl.currentPageNumber * ctrl.PAGE_SIZE); - ctrl.explorationIndexEnd = ( - ctrl.explorationIndexStart + ctrl.PAGE_SIZE - 1); - for (var ind = ctrl.explorationIndexStart; - ind <= ctrl.explorationIndexEnd; ind++) { - ctrl.explorationsOnPage.push(ctrl.userEditedExplorations[ind]); - if (ind === ctrl.userEditedExplorations.length - 1) { - break; + ctrl.goToPreviousPage = function() { + if (ctrl.currentPageNumber === 0) { + $log.error('Error: cannot decrement page'); + } else { + ctrl.currentPageNumber--; + ctrl.startingExplorationNumber = ( + ctrl.currentPageNumber * ctrl.PAGE_SIZE + 1 + ); + ctrl.endingExplorationNumber = ( + (ctrl.currentPageNumber + 1) * ctrl.PAGE_SIZE + ); } - } - return ctrl.explorationsOnPage; - }; + }; + ctrl.goToNextPage = function() { + if ((ctrl.currentPageNumber + 1) * ctrl.PAGE_SIZE >= ( + data.edited_exp_summary_dicts.length)) { + $log.error('Error: Cannot increment page'); + } else { + ctrl.currentPageNumber++; + ctrl.startingExplorationNumber = ( + ctrl.currentPageNumber * ctrl.PAGE_SIZE + 1 + ); + ctrl.endingExplorationNumber = ( + Math.min(ctrl.numUserPortfolioExplorations, + (ctrl.currentPageNumber + 1) * ctrl.PAGE_SIZE) + ); + } + }; - ctrl.numUserPortfolioExplorations = ( - data.edited_exp_summary_dicts.length); - ctrl.subjectInterests = data.subject_interests; - ctrl.firstContributionMsec = data.first_contribution_msec; - ctrl.profilePictureDataUrl = ( - data.profile_picture_data_url || DEFAULT_PROFILE_PICTURE_URL); - $rootScope.loadingMessage = ''; - }); - } - ] - }; -}]); + ctrl.getExplorationsToDisplay = function() { + ctrl.explorationsOnPage = []; + if (ctrl.userEditedExplorations.length === 0) { + return ctrl.explorationsOnPage; + } + ctrl.explorationIndexStart = ( + ctrl.currentPageNumber * ctrl.PAGE_SIZE); + ctrl.explorationIndexEnd = ( + ctrl.explorationIndexStart + ctrl.PAGE_SIZE - 1); + for (var ind = ctrl.explorationIndexStart; + ind <= ctrl.explorationIndexEnd; ind++) { + ctrl.explorationsOnPage.push(ctrl.userEditedExplorations[ind]); + if (ind === ctrl.userEditedExplorations.length - 1) { + break; + } + } + return ctrl.explorationsOnPage; + }; + + ctrl.numUserPortfolioExplorations = ( + data.edited_exp_summary_dicts.length); + ctrl.subjectInterests = data.subject_interests; + ctrl.firstContributionMsec = data.first_contribution_msec; + ctrl.profilePictureDataUrl = ( + data.profile_picture_data_url || DEFAULT_PROFILE_PICTURE_URL); + $rootScope.loadingMessage = ''; + }); + } + ] + }; + }]); diff --git a/core/templates/dev/head/pages/profile-page/profile-page.scripts.ts b/core/templates/dev/head/pages/profile-page/profile-page.scripts.ts index 6599293a0778..23eb29c23b0e 100644 --- a/core/templates/dev/head/pages/profile-page/profile-page.scripts.ts +++ b/core/templates/dev/head/pages/profile-page/profile-page.scripts.ts @@ -16,6 +16,7 @@ * @fileoverview Directive scripts for the Oppia profile page. */ +require('AppInit.ts'); require('App.ts'); require('pages/OppiaFooterDirective.ts'); diff --git a/core/templates/dev/head/pages/review-test-page/review-test-engine.service.ts b/core/templates/dev/head/pages/review-test-page/review-test-engine.service.ts index bea3d7f74664..aa71adb4ab84 100644 --- a/core/templates/dev/head/pages/review-test-page/review-test-engine.service.ts +++ b/core/templates/dev/head/pages/review-test-page/review-test-engine.service.ts @@ -16,9 +16,7 @@ * @fileoverview Utility service for the review tests. */ -var oppia = require('AppInit.ts').module; - -oppia.factory('ReviewTestEngineService', [ +angular.module('oppia').factory('ReviewTestEngineService', [ function() { return { getReviewTestQuestionCount: function(numOfSkills) { diff --git a/core/templates/dev/head/pages/review-test-page/review-test-page.constants.ts b/core/templates/dev/head/pages/review-test-page/review-test-page.constants.ts index c035d55715f9..9ed7b738c464 100644 --- a/core/templates/dev/head/pages/review-test-page/review-test-page.constants.ts +++ b/core/templates/dev/head/pages/review-test-page/review-test-page.constants.ts @@ -16,10 +16,11 @@ * @fileoverview Constants for the review tests. */ -var oppia = require('AppInit.ts').module; +angular.module('oppia').constant( + 'REVIEW_TEST_DATA_URL', '/review_test_handler/data/'); -oppia.constant('REVIEW_TEST_DATA_URL', '/review_test_handler/data/'); +angular.module('oppia').constant( + 'REVIEW_TESTS_URL', '/review_test/'); -oppia.constant('REVIEW_TESTS_URL', '/review_test/'); - -oppia.constant('STORY_VIEWER_PAGE', '/story/'); +angular.module('oppia').constant( + 'STORY_VIEWER_PAGE', '/story/'); diff --git a/core/templates/dev/head/pages/review-test-page/review-test-page.directive.ts b/core/templates/dev/head/pages/review-test-page/review-test-page.directive.ts index c7cd58e99020..6db66ca7f2aa 100644 --- a/core/templates/dev/head/pages/review-test-page/review-test-page.directive.ts +++ b/core/templates/dev/head/pages/review-test-page/review-test-page.directive.ts @@ -31,86 +31,85 @@ require('services/AlertsService.ts'); require('services/PageTitleService.ts'); require('services/contextual/UrlService.ts'); -var oppia = require('AppInit.ts').module; +angular.module('oppia').directive('reviewTestPage', [ + 'UrlInterpolationService', function( + UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: {}, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/review-test-page/review-test-page.directive.html'), + controllerAs: '$ctrl', + controller: [ + '$http', '$rootScope', 'AlertsService', 'PageTitleService', + 'ReviewTestEngineService', 'UrlInterpolationService', 'UrlService', + 'FATAL_ERROR_CODES', 'QUESTION_PLAYER_MODE', 'REVIEW_TEST_DATA_URL', + 'REVIEW_TESTS_URL', 'STORY_VIEWER_PAGE', + function( + $http, $rootScope, AlertsService, PageTitleService, + ReviewTestEngineService, UrlInterpolationService, UrlService, + FATAL_ERROR_CODES, QUESTION_PLAYER_MODE, REVIEW_TEST_DATA_URL, + REVIEW_TESTS_URL, STORY_VIEWER_PAGE + ) { + var ctrl = this; + ctrl.storyId = UrlService.getStoryIdFromUrl(); + ctrl.questionPlayerConfig = null; -oppia.directive('reviewTestPage', ['UrlInterpolationService', function( - UrlInterpolationService) { - return { - restrict: 'E', - scope: {}, - bindToController: {}, - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/review-test-page/review-test-page.directive.html'), - controllerAs: '$ctrl', - controller: [ - '$http', '$rootScope', 'AlertsService', 'PageTitleService', - 'ReviewTestEngineService', 'UrlInterpolationService', 'UrlService', - 'FATAL_ERROR_CODES', 'QUESTION_PLAYER_MODE', 'REVIEW_TEST_DATA_URL', - 'REVIEW_TESTS_URL', 'STORY_VIEWER_PAGE', - function( - $http, $rootScope, AlertsService, PageTitleService, - ReviewTestEngineService, UrlInterpolationService, UrlService, - FATAL_ERROR_CODES, QUESTION_PLAYER_MODE, REVIEW_TEST_DATA_URL, - REVIEW_TESTS_URL, STORY_VIEWER_PAGE - ) { - var ctrl = this; - ctrl.storyId = UrlService.getStoryIdFromUrl(); - ctrl.questionPlayerConfig = null; - - var _fetchSkillDetails = function() { - var reviewTestsDataUrl = UrlInterpolationService.interpolateUrl( - REVIEW_TEST_DATA_URL, { - story_id: ctrl.storyId - }); - var reviewTestsUrl = UrlInterpolationService.interpolateUrl( - REVIEW_TESTS_URL, { - story_id: ctrl.storyId - }); - var storyViewerUrl = UrlInterpolationService.interpolateUrl( - STORY_VIEWER_PAGE, { - story_id: ctrl.storyId - }); - $http.get(reviewTestsDataUrl).then(function(result) { - var skillIdList = []; - var skillDescriptions = []; - PageTitleService.setPageTitle( - 'Review Test: ' + result.data.story_name + ' - Oppia'); - for (var skillId in result.data.skill_descriptions) { - skillIdList.push(skillId); - skillDescriptions.push( - result.data.skill_descriptions[skillId]); - } - var questionPlayerConfig = { - resultActionButtons: [ - { - type: 'BOOST_SCORE', - text: 'Boost My Score' - }, - { - type: 'RETRY_SESSION', - text: 'Retry Test', - url: reviewTestsUrl - }, - { - type: 'DASHBOARD', - text: 'Return To Story', - url: storyViewerUrl - } - ], - skillList: skillIdList, - skillDescriptions: skillDescriptions, - questionCount: ReviewTestEngineService.getReviewTestQuestionCount( - skillIdList.length), - questionPlayerMode: { - modeType: QUESTION_PLAYER_MODE.PASS_FAIL_MODE, - passCutoff: 0.75 + var _fetchSkillDetails = function() { + var reviewTestsDataUrl = UrlInterpolationService.interpolateUrl( + REVIEW_TEST_DATA_URL, { + story_id: ctrl.storyId + }); + var reviewTestsUrl = UrlInterpolationService.interpolateUrl( + REVIEW_TESTS_URL, { + story_id: ctrl.storyId + }); + var storyViewerUrl = UrlInterpolationService.interpolateUrl( + STORY_VIEWER_PAGE, { + story_id: ctrl.storyId + }); + $http.get(reviewTestsDataUrl).then(function(result) { + var skillIdList = []; + var skillDescriptions = []; + PageTitleService.setPageTitle( + 'Review Test: ' + result.data.story_name + ' - Oppia'); + for (var skillId in result.data.skill_descriptions) { + skillIdList.push(skillId); + skillDescriptions.push( + result.data.skill_descriptions[skillId]); } - }; - ctrl.questionPlayerConfig = questionPlayerConfig; - }); - }; - _fetchSkillDetails(); - } - ] - }; -}]); + var questionPlayerConfig = { + resultActionButtons: [ + { + type: 'BOOST_SCORE', + text: 'Boost My Score' + }, + { + type: 'RETRY_SESSION', + text: 'Retry Test', + url: reviewTestsUrl + }, + { + type: 'DASHBOARD', + text: 'Return To Story', + url: storyViewerUrl + } + ], + skillList: skillIdList, + skillDescriptions: skillDescriptions, + questionCount: ReviewTestEngineService + .getReviewTestQuestionCount(skillIdList.length), + questionPlayerMode: { + modeType: QUESTION_PLAYER_MODE.PASS_FAIL_MODE, + passCutoff: 0.75 + } + }; + ctrl.questionPlayerConfig = questionPlayerConfig; + }); + }; + _fetchSkillDetails(); + } + ] + }; + }]); diff --git a/core/templates/dev/head/pages/review-test-page/review-test-page.scripts.ts b/core/templates/dev/head/pages/review-test-page/review-test-page.scripts.ts index 895e7d2aeb3a..9dc53cd71682 100644 --- a/core/templates/dev/head/pages/review-test-page/review-test-page.scripts.ts +++ b/core/templates/dev/head/pages/review-test-page/review-test-page.scripts.ts @@ -16,6 +16,7 @@ * @fileoverview Directive scripts for the review tests. */ +require('AppInit.ts'); require('App.ts'); require('base_components/BaseContentDirective.ts'); diff --git a/core/templates/dev/head/pages/signup-page/signup-page.controller.ts b/core/templates/dev/head/pages/signup-page/signup-page.controller.ts index 8153e63a9d4b..ba2f786cba6d 100644 --- a/core/templates/dev/head/pages/signup-page/signup-page.controller.ts +++ b/core/templates/dev/head/pages/signup-page/signup-page.controller.ts @@ -26,216 +26,215 @@ require('services/UserService.ts'); require('services/contextual/UrlService.ts'); require('services/stateful/FocusManagerService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('signupPage', ['UrlInterpolationService', function( - UrlInterpolationService) { - return { - restrict: 'E', - scope: {}, - bindToController: {}, - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/signup-page/signup-page.directive.html'), - controllerAs: '$ctrl', - controller: [ - '$http', '$rootScope', '$uibModal', 'AlertsService', - 'FocusManagerService', - 'SiteAnalyticsService', 'UrlInterpolationService', 'UrlService', - 'SITE_NAME', - function( - $http, $rootScope, $uibModal, AlertsService, - FocusManagerService, - SiteAnalyticsService, UrlInterpolationService, UrlService, - SITE_NAME) { - var ctrl = this; - var _SIGNUP_DATA_URL = '/signuphandler/data'; - $rootScope.loadingMessage = 'I18N_SIGNUP_LOADING'; - ctrl.warningI18nCode = ''; - ctrl.siteName = SITE_NAME; - ctrl.submissionInProcess = false; - - $http.get(_SIGNUP_DATA_URL).then(function(response) { - var data = response.data; - $rootScope.loadingMessage = ''; - ctrl.username = data.username; - ctrl.hasEverRegistered = data.has_ever_registered; - ctrl.hasAgreedToLatestTerms = data.has_agreed_to_latest_terms; - ctrl.showEmailPreferencesForm = data.can_send_emails; - ctrl.hasUsername = Boolean(ctrl.username); - FocusManagerService.setFocus('usernameInputField'); - }); - - ctrl.blurredAtLeastOnce = false; - ctrl.canReceiveEmailUpdates = null; - - ctrl.isFormValid = function() { - return ( - ctrl.hasAgreedToLatestTerms && - (ctrl.hasUsername || !ctrl.getWarningText(ctrl.username)) - ); - }; - - ctrl.showLicenseExplanationModal = function() { - $uibModal.open({ - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/signup-page/modal-templates/' + - 'licence-explanation-modal.template.directive.html'), - backdrop: true, - resolve: {}, - controller: [ - '$scope', '$uibModalInstance', 'SITE_NAME', - function($scope, $uibModalInstance, SITE_NAME) { - $scope.siteName = SITE_NAME; - $scope.close = function() { - $uibModalInstance.dismiss('cancel'); - }; - } - ] +angular.module('oppia').directive('signupPage', [ + 'UrlInterpolationService', function( + UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: {}, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/signup-page/signup-page.directive.html'), + controllerAs: '$ctrl', + controller: [ + '$http', '$rootScope', '$uibModal', 'AlertsService', + 'FocusManagerService', + 'SiteAnalyticsService', 'UrlInterpolationService', 'UrlService', + 'SITE_NAME', + function( + $http, $rootScope, $uibModal, AlertsService, + FocusManagerService, + SiteAnalyticsService, UrlInterpolationService, UrlService, + SITE_NAME) { + var ctrl = this; + var _SIGNUP_DATA_URL = '/signuphandler/data'; + $rootScope.loadingMessage = 'I18N_SIGNUP_LOADING'; + ctrl.warningI18nCode = ''; + ctrl.siteName = SITE_NAME; + ctrl.submissionInProcess = false; + + $http.get(_SIGNUP_DATA_URL).then(function(response) { + var data = response.data; + $rootScope.loadingMessage = ''; + ctrl.username = data.username; + ctrl.hasEverRegistered = data.has_ever_registered; + ctrl.hasAgreedToLatestTerms = data.has_agreed_to_latest_terms; + ctrl.showEmailPreferencesForm = data.can_send_emails; + ctrl.hasUsername = Boolean(ctrl.username); + FocusManagerService.setFocus('usernameInputField'); }); - }; - - ctrl.onUsernameInputFormBlur = function(username) { - if (ctrl.hasUsername) { - return; - } - AlertsService.clearWarnings(); - ctrl.blurredAtLeastOnce = true; - ctrl.updateWarningText(username); - if (!ctrl.warningI18nCode) { - $http.post('usernamehandler/data', { - username: ctrl.username - }).then(function(response) { - if (response.data.username_is_taken) { - ctrl.warningI18nCode = 'I18N_SIGNUP_ERROR_USERNAME_TAKEN'; - } - }); - } - }; - - // Returns the warning text corresponding to the validation error for - // the given username, or an empty string if the username is valid. - ctrl.updateWarningText = function(username) { - var alphanumeric = /^[A-Za-z0-9]+$/; - var admin = /admin/i; - var oppia = /oppia/i; - - if (!username) { - ctrl.warningI18nCode = 'I18N_SIGNUP_ERROR_NO_USERNAME'; - } else if (username.indexOf(' ') !== -1) { - ctrl.warningI18nCode = 'I18N_SIGNUP_ERROR_USERNAME_WITH_SPACES'; - } else if (username.length > 50) { - ctrl.warningI18nCode = 'I18N_SIGNUP_ERROR_USERNAME_MORE_50_CHARS'; - } else if (!alphanumeric.test(username)) { - ctrl.warningI18nCode = 'I18N_SIGNUP_ERROR_USERNAME_ONLY_ALPHANUM'; - } else if (admin.test(username)) { - ctrl.warningI18nCode = 'I18N_SIGNUP_ERROR_USERNAME_WITH_ADMIN'; - } else if (oppia.test(username)) { - ctrl.warningI18nCode = 'I18N_SIGNUP_ERROR_USERNAME_NOT_AVAILABLE'; - } else { - ctrl.warningI18nCode = ''; - } - }; - - ctrl.onSelectEmailPreference = function() { - ctrl.emailPreferencesWarningText = ''; - }; - - ctrl.submitPrerequisitesForm = function( - agreedToTerms, username, canReceiveEmailUpdates) { - if (!agreedToTerms) { - AlertsService.addWarning('I18N_SIGNUP_ERROR_MUST_AGREE_TO_TERMS'); - return; - } - - if (!ctrl.hasUsername && ctrl.warningI18nCode) { - return; - } - - var defaultDashboard = constants.DASHBOARD_TYPE_LEARNER; - var returnUrl = window.decodeURIComponent( - UrlService.getUrlParams().return_url); - - if (returnUrl.indexOf('creator_dashboard') !== -1) { - defaultDashboard = constants.DASHBOARD_TYPE_CREATOR; - } else { - defaultDashboard = constants.DASHBOARD_TYPE_LEARNER; - } - - var requestParams = { - agreed_to_terms: agreedToTerms, - can_receive_email_updates: null, - default_dashboard: defaultDashboard, - username: null + + ctrl.blurredAtLeastOnce = false; + ctrl.canReceiveEmailUpdates = null; + + ctrl.isFormValid = function() { + return ( + ctrl.hasAgreedToLatestTerms && + (ctrl.hasUsername || !ctrl.getWarningText(ctrl.username)) + ); }; - if (!ctrl.hasUsername) { - requestParams.username = username; - } + ctrl.showLicenseExplanationModal = function() { + $uibModal.open({ + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/signup-page/modal-templates/' + + 'licence-explanation-modal.template.directive.html'), + backdrop: true, + resolve: {}, + controller: [ + '$scope', '$uibModalInstance', 'SITE_NAME', + function($scope, $uibModalInstance, SITE_NAME) { + $scope.siteName = SITE_NAME; + $scope.close = function() { + $uibModalInstance.dismiss('cancel'); + }; + } + ] + }); + }; - if (ctrl.showEmailPreferencesForm && !ctrl.hasUsername) { - if (canReceiveEmailUpdates === null) { - ctrl.emailPreferencesWarningText = 'I18N_SIGNUP_FIELD_REQUIRED'; + ctrl.onUsernameInputFormBlur = function(username) { + if (ctrl.hasUsername) { return; } + AlertsService.clearWarnings(); + ctrl.blurredAtLeastOnce = true; + ctrl.updateWarningText(username); + if (!ctrl.warningI18nCode) { + $http.post('usernamehandler/data', { + username: ctrl.username + }).then(function(response) { + if (response.data.username_is_taken) { + ctrl.warningI18nCode = 'I18N_SIGNUP_ERROR_USERNAME_TAKEN'; + } + }); + } + }; - if (canReceiveEmailUpdates === 'yes') { - requestParams.can_receive_email_updates = true; - } else if (canReceiveEmailUpdates === 'no') { - requestParams.can_receive_email_updates = false; + // Returns the warning text corresponding to the validation error for + // the given username, or an empty string if the username is valid. + ctrl.updateWarningText = function(username) { + var alphanumeric = /^[A-Za-z0-9]+$/; + var admin = /admin/i; + var oppia = /oppia/i; + + if (!username) { + ctrl.warningI18nCode = 'I18N_SIGNUP_ERROR_NO_USERNAME'; + } else if (username.indexOf(' ') !== -1) { + ctrl.warningI18nCode = 'I18N_SIGNUP_ERROR_USERNAME_WITH_SPACES'; + } else if (username.length > 50) { + ctrl.warningI18nCode = 'I18N_SIGNUP_ERROR_USERNAME_MORE_50_CHARS'; + } else if (!alphanumeric.test(username)) { + ctrl.warningI18nCode = 'I18N_SIGNUP_ERROR_USERNAME_ONLY_ALPHANUM'; + } else if (admin.test(username)) { + ctrl.warningI18nCode = 'I18N_SIGNUP_ERROR_USERNAME_WITH_ADMIN'; + } else if (oppia.test(username)) { + ctrl.warningI18nCode = 'I18N_SIGNUP_ERROR_USERNAME_NOT_AVAILABLE'; } else { - throw Error( - 'Invalid value for email preferences: ' + - canReceiveEmailUpdates); + ctrl.warningI18nCode = ''; } - } + }; - SiteAnalyticsService.registerNewSignupEvent(); + ctrl.onSelectEmailPreference = function() { + ctrl.emailPreferencesWarningText = ''; + }; - ctrl.submissionInProcess = true; - $http.post(_SIGNUP_DATA_URL, requestParams).then(function() { - window.location = window.decodeURIComponent( + ctrl.submitPrerequisitesForm = function( + agreedToTerms, username, canReceiveEmailUpdates) { + if (!agreedToTerms) { + AlertsService.addWarning('I18N_SIGNUP_ERROR_MUST_AGREE_TO_TERMS'); + return; + } + + if (!ctrl.hasUsername && ctrl.warningI18nCode) { + return; + } + + var defaultDashboard = constants.DASHBOARD_TYPE_LEARNER; + var returnUrl = window.decodeURIComponent( UrlService.getUrlParams().return_url); - }, function(rejection) { - if ( - rejection.data && rejection.data.status_code === 401) { - ctrl.showRegistrationSessionExpiredModal(); + + if (returnUrl.indexOf('creator_dashboard') !== -1) { + defaultDashboard = constants.DASHBOARD_TYPE_CREATOR; + } else { + defaultDashboard = constants.DASHBOARD_TYPE_LEARNER; } - ctrl.submissionInProcess = false; - }); - }; - - ctrl.showRegistrationSessionExpiredModal = function() { - $uibModal.open({ - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/signup-page/modal-templates/' + - 'registration-session-expired-modal.template.html'), - backdrop: 'static', - keyboard: false, - resolve: {}, - controller: [ - '$scope', '$uibModalInstance', 'SiteAnalyticsService', - 'UserService', '$timeout', '$window', - function($scope, $uibModalInstance, SiteAnalyticsService, - UserService, $timeout, $window) { - $scope.continueRegistration = function() { - UserService.getLoginUrlAsync().then( - function(loginUrl) { - if (loginUrl) { - $timeout(function() { - $window.location = loginUrl; - }, 150); - } else { - throw Error('Login url not found.'); - } - } - ); - $uibModalInstance.dismiss('cancel'); - }; + + var requestParams = { + agreed_to_terms: agreedToTerms, + can_receive_email_updates: null, + default_dashboard: defaultDashboard, + username: null + }; + + if (!ctrl.hasUsername) { + requestParams.username = username; + } + + if (ctrl.showEmailPreferencesForm && !ctrl.hasUsername) { + if (canReceiveEmailUpdates === null) { + ctrl.emailPreferencesWarningText = 'I18N_SIGNUP_FIELD_REQUIRED'; + return; } - ] - }); - }; - } - ] - }; -}]); + + if (canReceiveEmailUpdates === 'yes') { + requestParams.can_receive_email_updates = true; + } else if (canReceiveEmailUpdates === 'no') { + requestParams.can_receive_email_updates = false; + } else { + throw Error( + 'Invalid value for email preferences: ' + + canReceiveEmailUpdates); + } + } + + SiteAnalyticsService.registerNewSignupEvent(); + + ctrl.submissionInProcess = true; + $http.post(_SIGNUP_DATA_URL, requestParams).then(function() { + window.location = window.decodeURIComponent( + UrlService.getUrlParams().return_url); + }, function(rejection) { + if ( + rejection.data && rejection.data.status_code === 401) { + ctrl.showRegistrationSessionExpiredModal(); + } + ctrl.submissionInProcess = false; + }); + }; + + ctrl.showRegistrationSessionExpiredModal = function() { + $uibModal.open({ + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/signup-page/modal-templates/' + + 'registration-session-expired-modal.template.html'), + backdrop: 'static', + keyboard: false, + resolve: {}, + controller: [ + '$scope', '$uibModalInstance', 'SiteAnalyticsService', + 'UserService', '$timeout', '$window', + function($scope, $uibModalInstance, SiteAnalyticsService, + UserService, $timeout, $window) { + $scope.continueRegistration = function() { + UserService.getLoginUrlAsync().then( + function(loginUrl) { + if (loginUrl) { + $timeout(function() { + $window.location = loginUrl; + }, 150); + } else { + throw Error('Login url not found.'); + } + } + ); + $uibModalInstance.dismiss('cancel'); + }; + } + ] + }); + }; + } + ] + }; + }]); diff --git a/core/templates/dev/head/pages/signup-page/signup-page.scripts.ts b/core/templates/dev/head/pages/signup-page/signup-page.scripts.ts index 1b8d865f179f..289b5d9a6c78 100644 --- a/core/templates/dev/head/pages/signup-page/signup-page.scripts.ts +++ b/core/templates/dev/head/pages/signup-page/signup-page.scripts.ts @@ -16,6 +16,7 @@ * @fileoverview Directive scripts for the Oppia profile page. */ +require('AppInit.ts'); require('App.ts'); require('pages/signup-page/signup-page.controller.ts'); diff --git a/core/templates/dev/head/pages/skill-editor-page/editor-tab/skill-concept-card-editor/skill-concept-card-editor.directive.ts b/core/templates/dev/head/pages/skill-editor-page/editor-tab/skill-concept-card-editor/skill-concept-card-editor.directive.ts index ef2564810e26..18d2eaf4b8b5 100644 --- a/core/templates/dev/head/pages/skill-editor-page/editor-tab/skill-concept-card-editor/skill-concept-card-editor.directive.ts +++ b/core/templates/dev/head/pages/skill-editor-page/editor-tab/skill-concept-card-editor/skill-concept-card-editor.directive.ts @@ -35,9 +35,7 @@ require('services/GenerateContentIdService.ts'); require('pages/skill-editor-page/skill-editor-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('skillConceptCardEditor', [ +angular.module('oppia').directive('skillConceptCardEditor', [ 'GenerateContentIdService', 'SkillEditorStateService', 'SkillUpdateService', 'SubtitledHtmlObjectFactory', 'UrlInterpolationService', 'COMPONENT_NAME_EXPLANATION', 'COMPONENT_NAME_WORKED_EXAMPLE', diff --git a/core/templates/dev/head/pages/skill-editor-page/editor-tab/skill-concept-card-editor/worked-example-editor.directive.ts b/core/templates/dev/head/pages/skill-editor-page/editor-tab/skill-concept-card-editor/worked-example-editor.directive.ts index 9a1d559d2da6..7065da39c942 100644 --- a/core/templates/dev/head/pages/skill-editor-page/editor-tab/skill-concept-card-editor/worked-example-editor.directive.ts +++ b/core/templates/dev/head/pages/skill-editor-page/editor-tab/skill-concept-card-editor/worked-example-editor.directive.ts @@ -20,9 +20,7 @@ require('domain/skill/SkillUpdateService.ts'); require('domain/utilities/UrlInterpolationService.ts'); require('pages/skill-editor-page/services/skill-editor-state.service.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('workedExampleEditor', [ +angular.module('oppia').directive('workedExampleEditor', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/skill-editor-page/editor-tab/skill-description-editor/skill-description-editor.directive.ts b/core/templates/dev/head/pages/skill-editor-page/editor-tab/skill-description-editor/skill-description-editor.directive.ts index 21d532b75f63..59031e909113 100644 --- a/core/templates/dev/head/pages/skill-editor-page/editor-tab/skill-description-editor/skill-description-editor.directive.ts +++ b/core/templates/dev/head/pages/skill-editor-page/editor-tab/skill-description-editor/skill-description-editor.directive.ts @@ -23,9 +23,7 @@ require('pages/skill-editor-page/services/skill-editor-state.service.ts'); require('pages/skill-editor-page/skill-editor-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('skillDescriptionEditor', [ +angular.module('oppia').directive('skillDescriptionEditor', [ 'SkillEditorStateService', 'SkillObjectFactory', 'SkillUpdateService', 'UrlInterpolationService', function( diff --git a/core/templates/dev/head/pages/skill-editor-page/editor-tab/skill-editor-main-tab.directive.ts b/core/templates/dev/head/pages/skill-editor-page/editor-tab/skill-editor-main-tab.directive.ts index 11ff15d34fb6..ed51633f6897 100644 --- a/core/templates/dev/head/pages/skill-editor-page/editor-tab/skill-editor-main-tab.directive.ts +++ b/core/templates/dev/head/pages/skill-editor-page/editor-tab/skill-editor-main-tab.directive.ts @@ -29,11 +29,9 @@ require( require('domain/utilities/UrlInterpolationService.ts'); require('pages/skill-editor-page/services/skill-editor-state.service.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('skillEditorMainTab', [ - 'SkillEditorStateService', 'UrlInterpolationService', - function(SkillEditorStateService, UrlInterpolationService) { +angular.module('oppia').directive('skillEditorMainTab', [ + 'UrlInterpolationService', + function(UrlInterpolationService) { return { restrict: 'E', scope: {}, diff --git a/core/templates/dev/head/pages/skill-editor-page/editor-tab/skill-misconceptions-editor/misconception-editor.directive.ts b/core/templates/dev/head/pages/skill-editor-page/editor-tab/skill-misconceptions-editor/misconception-editor.directive.ts index cb2134b51dc6..b66f623955d8 100644 --- a/core/templates/dev/head/pages/skill-editor-page/editor-tab/skill-misconceptions-editor/misconception-editor.directive.ts +++ b/core/templates/dev/head/pages/skill-editor-page/editor-tab/skill-misconceptions-editor/misconception-editor.directive.ts @@ -20,9 +20,7 @@ require('domain/skill/SkillUpdateService.ts'); require('domain/utilities/UrlInterpolationService.ts'); require('pages/skill-editor-page/services/skill-editor-state.service.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('misconceptionEditor', [ +angular.module('oppia').directive('misconceptionEditor', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { retrict: 'E', diff --git a/core/templates/dev/head/pages/skill-editor-page/editor-tab/skill-misconceptions-editor/skill-misconceptions-editor.directive.ts b/core/templates/dev/head/pages/skill-editor-page/editor-tab/skill-misconceptions-editor/skill-misconceptions-editor.directive.ts index f843aef785dd..6ee2b7cc31ff 100644 --- a/core/templates/dev/head/pages/skill-editor-page/editor-tab/skill-misconceptions-editor/skill-misconceptions-editor.directive.ts +++ b/core/templates/dev/head/pages/skill-editor-page/editor-tab/skill-misconceptions-editor/skill-misconceptions-editor.directive.ts @@ -30,9 +30,7 @@ require('pages/skill-editor-page/services/skill-editor-state.service.ts'); require('pages/skill-editor-page/skill-editor-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('skillMisconceptionsEditor', [ +angular.module('oppia').directive('skillMisconceptionsEditor', [ 'SkillEditorStateService', 'SkillUpdateService', 'UrlInterpolationService', function( SkillEditorStateService, SkillUpdateService, UrlInterpolationService) { diff --git a/core/templates/dev/head/pages/skill-editor-page/navbar/skill-editor-navbar-breadcrumb.directive.ts b/core/templates/dev/head/pages/skill-editor-page/navbar/skill-editor-navbar-breadcrumb.directive.ts index e6a9a3edb890..8264f8b4ad78 100644 --- a/core/templates/dev/head/pages/skill-editor-page/navbar/skill-editor-navbar-breadcrumb.directive.ts +++ b/core/templates/dev/head/pages/skill-editor-page/navbar/skill-editor-navbar-breadcrumb.directive.ts @@ -19,9 +19,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('pages/skill-editor-page/services/skill-editor-state.service.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('skillEditorNavbarBreadcrumb', [ +angular.module('oppia').directive('skillEditorNavbarBreadcrumb', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/skill-editor-page/navbar/skill-editor-navbar.directive.ts b/core/templates/dev/head/pages/skill-editor-page/navbar/skill-editor-navbar.directive.ts index bef17424815f..5e0d1d2f3815 100644 --- a/core/templates/dev/head/pages/skill-editor-page/navbar/skill-editor-navbar.directive.ts +++ b/core/templates/dev/head/pages/skill-editor-page/navbar/skill-editor-navbar.directive.ts @@ -28,9 +28,7 @@ require('services/AlertsService.ts'); require('pages/skill-editor-page/skill-editor-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('skillEditorNavbar', [ +angular.module('oppia').directive('skillEditorNavbar', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/skill-editor-page/questions-tab/questions-tab.directive.ts b/core/templates/dev/head/pages/skill-editor-page/questions-tab/questions-tab.directive.ts index d802236a4e58..764ba4cec5e0 100644 --- a/core/templates/dev/head/pages/skill-editor-page/questions-tab/questions-tab.directive.ts +++ b/core/templates/dev/head/pages/skill-editor-page/questions-tab/questions-tab.directive.ts @@ -35,9 +35,7 @@ require('services/AlertsService.ts'); require('services/QuestionsListService.ts'); require('services/contextual/UrlService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('questionsTab', [ +angular.module('oppia').directive('questionsTab', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/skill-editor-page/services/skill-editor-routing.service.ts b/core/templates/dev/head/pages/skill-editor-page/services/skill-editor-routing.service.ts index da4853ae9224..a254850a4e9c 100644 --- a/core/templates/dev/head/pages/skill-editor-page/services/skill-editor-routing.service.ts +++ b/core/templates/dev/head/pages/skill-editor-page/services/skill-editor-routing.service.ts @@ -16,12 +16,10 @@ * @fileoverview Service that handles routing for the skill editor page. */ -var oppia = require('AppInit.ts').module; - -oppia.factory('SkillEditorRoutingService', [ - '$interval', '$location', '$rootScope', '$timeout', '$window', +angular.module('oppia').factory('SkillEditorRoutingService', [ + '$location', '$rootScope', function( - $interval, $location, $rootScope, $timeout, $window) { + $location, $rootScope) { var MAIN_TAB = 'main'; var QUESTIONS_TAB = 'questions'; diff --git a/core/templates/dev/head/pages/skill-editor-page/services/skill-editor-state.service.ts b/core/templates/dev/head/pages/skill-editor-page/services/skill-editor-state.service.ts index 5499f64daa70..b01eca8e3986 100644 --- a/core/templates/dev/head/pages/skill-editor-page/services/skill-editor-state.service.ts +++ b/core/templates/dev/head/pages/skill-editor-page/services/skill-editor-state.service.ts @@ -28,21 +28,15 @@ require('services/QuestionsListService.ts'); require('pages/skill-editor-page/skill-editor-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('SkillEditorStateService', [ +angular.module('oppia').factory('SkillEditorStateService', [ '$rootScope', 'AlertsService', 'EditableSkillBackendApiService', - 'QuestionBackendApiService', 'QuestionsListService', - 'SkillObjectFactory', 'SkillRightsBackendApiService', + 'QuestionsListService', 'SkillObjectFactory', 'SkillRightsBackendApiService', 'SkillRightsObjectFactory', 'UndoRedoService', - 'EVENT_QUESTION_SUMMARIES_INITIALIZED', 'EVENT_SKILL_INITIALIZED', 'EVENT_SKILL_REINITIALIZED', function( $rootScope, AlertsService, EditableSkillBackendApiService, - QuestionBackendApiService, QuestionsListService, - SkillObjectFactory, SkillRightsBackendApiService, + QuestionsListService, SkillObjectFactory, SkillRightsBackendApiService, SkillRightsObjectFactory, UndoRedoService, - EVENT_QUESTION_SUMMARIES_INITIALIZED, EVENT_SKILL_INITIALIZED, EVENT_SKILL_REINITIALIZED) { var _skill = SkillObjectFactory.createInterstitialSkill(); var _skillRights = SkillRightsObjectFactory.createInterstitialSkillRights(); diff --git a/core/templates/dev/head/pages/skill-editor-page/skill-editor-page.constants.ts b/core/templates/dev/head/pages/skill-editor-page/skill-editor-page.constants.ts index b7977fbf93f6..4d8730972f14 100644 --- a/core/templates/dev/head/pages/skill-editor-page/skill-editor-page.constants.ts +++ b/core/templates/dev/head/pages/skill-editor-page/skill-editor-page.constants.ts @@ -16,15 +16,13 @@ * @fileoverview Constants for the skill editor page. */ -var oppia = require('AppInit.ts').module; - -oppia.constant( +angular.module('oppia').constant( 'SKILL_RIGHTS_URL_TEMPLATE', '/skill_editor_handler/rights/'); -oppia.constant( +angular.module('oppia').constant( 'SKILL_PUBLISH_URL_TEMPLATE', '/skill_editor_handler/publish_skill/'); -oppia.constant( +angular.module('oppia').constant( 'EVENT_SKILL_INITIALIZED', 'skillInitialized'); -oppia.constant( +angular.module('oppia').constant( 'EVENT_SKILL_REINITIALIZED', 'skillReinitialized'); diff --git a/core/templates/dev/head/pages/skill-editor-page/skill-editor-page.controller.ts b/core/templates/dev/head/pages/skill-editor-page/skill-editor-page.controller.ts index fe1ea464eddb..b13d78695cd6 100644 --- a/core/templates/dev/head/pages/skill-editor-page/skill-editor-page.controller.ts +++ b/core/templates/dev/head/pages/skill-editor-page/skill-editor-page.controller.ts @@ -108,24 +108,24 @@ require('pages/skill-editor-page/questions-tab/questions-tab.directive.ts'); require('pages/skill-editor-page/skill-editor-page.constants.ts'); require('pages/interaction-specs.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('skillEditorPage', ['UrlInterpolationService', function( - UrlInterpolationService) { - return { - restrict: 'E', - scope: {}, - bindToController: {}, - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/skill-editor-page/skill-editor-page.directive.html'), - controllerAs: '$ctrl', - controller: [ - 'SkillEditorRoutingService', 'SkillEditorStateService', 'UrlService', - function(SkillEditorRoutingService, SkillEditorStateService, UrlService) { - var ctrl = this; - ctrl.getActiveTabName = SkillEditorRoutingService.getActiveTabName; - SkillEditorStateService.loadSkill(UrlService.getSkillIdFromUrl()); - } - ] - }; -}]); +angular.module('oppia').directive('skillEditorPage', [ + 'UrlInterpolationService', function( + UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: {}, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/skill-editor-page/skill-editor-page.directive.html'), + controllerAs: '$ctrl', + controller: [ + 'SkillEditorRoutingService', 'SkillEditorStateService', 'UrlService', + function( + SkillEditorRoutingService, SkillEditorStateService, UrlService) { + var ctrl = this; + ctrl.getActiveTabName = SkillEditorRoutingService.getActiveTabName; + SkillEditorStateService.loadSkill(UrlService.getSkillIdFromUrl()); + } + ] + }; + }]); diff --git a/core/templates/dev/head/pages/skill-editor-page/skill-editor-page.scripts.ts b/core/templates/dev/head/pages/skill-editor-page/skill-editor-page.scripts.ts index bb5472c4667e..ff38cd0705af 100644 --- a/core/templates/dev/head/pages/skill-editor-page/skill-editor-page.scripts.ts +++ b/core/templates/dev/head/pages/skill-editor-page/skill-editor-page.scripts.ts @@ -16,6 +16,7 @@ * @fileoverview Directive scripts for the skill editor page. */ +require('AppInit.ts'); require('App.ts'); require('pages/skill-editor-page/navbar/skill-editor-navbar.directive.ts'); diff --git a/core/templates/dev/head/pages/splash-page/splash-page.controller.ts b/core/templates/dev/head/pages/splash-page/splash-page.controller.ts index bf9077724d14..6f9373d2ae9f 100644 --- a/core/templates/dev/head/pages/splash-page/splash-page.controller.ts +++ b/core/templates/dev/head/pages/splash-page/splash-page.controller.ts @@ -16,66 +16,65 @@ * @fileoverview Data and controllers for the Oppia splash page. */ -var oppia = require('AppInit.ts').module; - require('base_components/BaseContentDirective.ts'); require('domain/utilities/UrlInterpolationService.ts'); require('services/SiteAnalyticsService.ts'); require('services/UserService.ts'); -oppia.directive('splashPage', ['UrlInterpolationService', function( - UrlInterpolationService) { - return { - restrict: 'E', - scope: {}, - bindToController: {}, - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/splash-page/splash-page.directive.html'), - controllerAs: '$ctrl', - controller: [ - '$rootScope', '$timeout', '$window', 'SiteAnalyticsService', - 'UrlInterpolationService', 'UserService', - function($rootScope, $timeout, $window, SiteAnalyticsService, - UrlInterpolationService, UserService) { - var ctrl = this; - ctrl.userIsLoggedIn = null; - $rootScope.loadingMessage = 'Loading'; - UserService.getUserInfoAsync().then(function(userInfo) { - ctrl.userIsLoggedIn = userInfo.isLoggedIn(); - $rootScope.loadingMessage = ''; - }); - ctrl.getStaticImageUrl = UrlInterpolationService.getStaticImageUrl; - ctrl.getStaticSubjectImageUrl = function(subjectName) { - return UrlInterpolationService.getStaticImageUrl('/subjects/' + - subjectName + '.svg'); - }; +angular.module('oppia').directive('splashPage', [ + 'UrlInterpolationService', function( + UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: {}, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/splash-page/splash-page.directive.html'), + controllerAs: '$ctrl', + controller: [ + '$rootScope', '$timeout', '$window', 'SiteAnalyticsService', + 'UrlInterpolationService', 'UserService', + function($rootScope, $timeout, $window, SiteAnalyticsService, + UrlInterpolationService, UserService) { + var ctrl = this; + ctrl.userIsLoggedIn = null; + $rootScope.loadingMessage = 'Loading'; + UserService.getUserInfoAsync().then(function(userInfo) { + ctrl.userIsLoggedIn = userInfo.isLoggedIn(); + $rootScope.loadingMessage = ''; + }); + ctrl.getStaticImageUrl = UrlInterpolationService.getStaticImageUrl; + ctrl.getStaticSubjectImageUrl = function(subjectName) { + return UrlInterpolationService.getStaticImageUrl('/subjects/' + + subjectName + '.svg'); + }; - ctrl.onRedirectToLogin = function(destinationUrl) { - SiteAnalyticsService.registerStartLoginEvent( - 'splashPageCreateExplorationButton'); - $timeout(function() { - $window.location = destinationUrl; - }, 150); - return false; - }; + ctrl.onRedirectToLogin = function(destinationUrl) { + SiteAnalyticsService.registerStartLoginEvent( + 'splashPageCreateExplorationButton'); + $timeout(function() { + $window.location = destinationUrl; + }, 150); + return false; + }; - ctrl.onClickBrowseLibraryButton = function() { - SiteAnalyticsService.registerClickBrowseLibraryButtonEvent(); - $timeout(function() { - $window.location = '/library'; - }, 150); - return false; - }; + ctrl.onClickBrowseLibraryButton = function() { + SiteAnalyticsService.registerClickBrowseLibraryButtonEvent(); + $timeout(function() { + $window.location = '/library'; + }, 150); + return false; + }; - ctrl.onClickCreateExplorationButton = function() { - SiteAnalyticsService.registerClickCreateExplorationButtonEvent(); - $timeout(function() { - $window.location = '/creator_dashboard?mode=create'; - }, 150); - return false; - }; - } - ] - }; -}]); + ctrl.onClickCreateExplorationButton = function() { + SiteAnalyticsService.registerClickCreateExplorationButtonEvent(); + $timeout(function() { + $window.location = '/creator_dashboard?mode=create'; + }, 150); + return false; + }; + } + ] + }; + }]); diff --git a/core/templates/dev/head/pages/splash-page/splash-page.scripts.ts b/core/templates/dev/head/pages/splash-page/splash-page.scripts.ts index 77d45366571f..31f88e08e7ba 100644 --- a/core/templates/dev/head/pages/splash-page/splash-page.scripts.ts +++ b/core/templates/dev/head/pages/splash-page/splash-page.scripts.ts @@ -16,5 +16,6 @@ * @fileoverview Directive scripts for the Oppia splash page. */ +require('AppInit.ts'); require('App.ts'); require('pages/splash-page/splash-page.controller.ts'); diff --git a/core/templates/dev/head/pages/story-editor-page/editor-tab/story-editor.directive.ts b/core/templates/dev/head/pages/story-editor-page/editor-tab/story-editor.directive.ts index fbd4974d416b..1183292503f6 100644 --- a/core/templates/dev/head/pages/story-editor-page/editor-tab/story-editor.directive.ts +++ b/core/templates/dev/head/pages/story-editor-page/editor-tab/story-editor.directive.ts @@ -28,9 +28,7 @@ require('services/AlertsService.ts'); require('pages/story-editor-page/story-editor-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('storyEditor', [ +angular.module('oppia').directive('storyEditor', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/story-editor-page/editor-tab/story-node-editor.directive.ts b/core/templates/dev/head/pages/story-editor-page/editor-tab/story-node-editor.directive.ts index 197f53741352..35f53413c5ef 100644 --- a/core/templates/dev/head/pages/story-editor-page/editor-tab/story-node-editor.directive.ts +++ b/core/templates/dev/head/pages/story-editor-page/editor-tab/story-node-editor.directive.ts @@ -23,9 +23,7 @@ require('services/AlertsService.ts'); require('pages/story-editor-page/story-editor-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('storyNodeEditor', [ +angular.module('oppia').directive('storyNodeEditor', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/story-editor-page/navbar/story-editor-navbar-breadcrumb.directive.ts b/core/templates/dev/head/pages/story-editor-page/navbar/story-editor-navbar-breadcrumb.directive.ts index 315372c3b24a..c9b05dd3b1ec 100644 --- a/core/templates/dev/head/pages/story-editor-page/navbar/story-editor-navbar-breadcrumb.directive.ts +++ b/core/templates/dev/head/pages/story-editor-page/navbar/story-editor-navbar-breadcrumb.directive.ts @@ -24,9 +24,7 @@ require('services/contextual/UrlService.ts'); require('pages/story-editor-page/story-editor-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('storyEditorNavbarBreadcrumb', [ +angular.module('oppia').directive('storyEditorNavbarBreadcrumb', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/story-editor-page/navbar/story-editor-navbar.directive.ts b/core/templates/dev/head/pages/story-editor-page/navbar/story-editor-navbar.directive.ts index 76b08876802f..bbb69f98458d 100644 --- a/core/templates/dev/head/pages/story-editor-page/navbar/story-editor-navbar.directive.ts +++ b/core/templates/dev/head/pages/story-editor-page/navbar/story-editor-navbar.directive.ts @@ -25,9 +25,7 @@ require('services/contextual/UrlService.ts'); require('pages/story-editor-page/story-editor-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('storyEditorNavbar', [ +angular.module('oppia').directive('storyEditorNavbar', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/story-editor-page/services/story-editor-state.service.ts b/core/templates/dev/head/pages/story-editor-page/services/story-editor-state.service.ts index 78994896117c..3bd2edb3e12a 100644 --- a/core/templates/dev/head/pages/story-editor-page/services/story-editor-state.service.ts +++ b/core/templates/dev/head/pages/story-editor-page/services/story-editor-state.service.ts @@ -25,9 +25,7 @@ require('services/AlertsService.ts'); require('pages/story-editor-page/story-editor-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('StoryEditorStateService', [ +angular.module('oppia').factory('StoryEditorStateService', [ '$rootScope', 'AlertsService', 'EditableStoryBackendApiService', 'StoryObjectFactory', 'UndoRedoService', 'EVENT_STORY_INITIALIZED', 'EVENT_STORY_REINITIALIZED', diff --git a/core/templates/dev/head/pages/story-editor-page/story-editor-page.constants.ts b/core/templates/dev/head/pages/story-editor-page/story-editor-page.constants.ts index c47b500e863e..197690bc510c 100644 --- a/core/templates/dev/head/pages/story-editor-page/story-editor-page.constants.ts +++ b/core/templates/dev/head/pages/story-editor-page/story-editor-page.constants.ts @@ -16,12 +16,10 @@ * @fileoverview Primary controller for the story editor page. */ -var oppia = require('AppInit.ts').module; - -oppia.constant('NODE_ID_PREFIX', 'node_'); -oppia.constant( +angular.module('oppia').constant('NODE_ID_PREFIX', 'node_'); +angular.module('oppia').constant( 'EVENT_STORY_INITIALIZED', 'storyInitialized'); -oppia.constant( +angular.module('oppia').constant( 'EVENT_STORY_REINITIALIZED', 'storyReinitialized'); -oppia.constant( +angular.module('oppia').constant( 'EVENT_VIEW_STORY_NODE_EDITOR', 'viewStoryNodeEditor'); diff --git a/core/templates/dev/head/pages/story-editor-page/story-editor-page.controller.ts b/core/templates/dev/head/pages/story-editor-page/story-editor-page.controller.ts index d7be5883babc..fceee4847246 100644 --- a/core/templates/dev/head/pages/story-editor-page/story-editor-page.controller.ts +++ b/core/templates/dev/head/pages/story-editor-page/story-editor-page.controller.ts @@ -107,66 +107,65 @@ require('services/contextual/UrlService.ts'); require('pages/story-editor-page/story-editor-page.constants.ts'); -var oppia = require('AppInit.ts').module; +angular.module('oppia').directive('storyEditorPage', [ + 'UrlInterpolationService', function( + UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: {}, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/story-editor-page/story-editor-page.directive.html'), + controllerAs: '$ctrl', + controller: [ + '$scope', '$uibModal', '$window', 'PageTitleService', + 'StoryEditorStateService', 'UndoRedoService', + 'UrlInterpolationService', 'UrlService', + 'EVENT_STORY_INITIALIZED', 'EVENT_STORY_REINITIALIZED', + function( + $scope, $uibModal, $window, PageTitleService, + StoryEditorStateService, UndoRedoService, + UrlInterpolationService, UrlService, + EVENT_STORY_INITIALIZED, EVENT_STORY_REINITIALIZED) { + var ctrl = this; + var TOPIC_EDITOR_URL_TEMPLATE = '/topic_editor/'; + var topicId = UrlService.getTopicIdFromUrl(); + StoryEditorStateService.loadStory( + topicId, UrlService.getStoryIdFromUrl()); -oppia.directive('storyEditorPage', ['UrlInterpolationService', function( - UrlInterpolationService) { - return { - restrict: 'E', - scope: {}, - bindToController: {}, - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/story-editor-page/story-editor-page.directive.html'), - controllerAs: '$ctrl', - controller: [ - '$scope', '$uibModal', '$window', 'PageTitleService', - 'StoryEditorStateService', 'UndoRedoService', - 'UrlInterpolationService', 'UrlService', - 'EVENT_STORY_INITIALIZED', 'EVENT_STORY_REINITIALIZED', - function( - $scope, $uibModal, $window, PageTitleService, - StoryEditorStateService, UndoRedoService, - UrlInterpolationService, UrlService, - EVENT_STORY_INITIALIZED, EVENT_STORY_REINITIALIZED) { - var ctrl = this; - var TOPIC_EDITOR_URL_TEMPLATE = '/topic_editor/'; - var topicId = UrlService.getTopicIdFromUrl(); - StoryEditorStateService.loadStory( - topicId, UrlService.getStoryIdFromUrl()); + ctrl.returnToTopicEditorPage = function() { + if (UndoRedoService.getChangeCount() > 0) { + var modalInstance = $uibModal.open({ + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/story-editor-page/modal-templates/' + + 'save-pending-changes-modal.template.html'), + backdrop: true, + controller: [ + '$scope', '$uibModalInstance', + function($scope, $uibModalInstance) { + $scope.cancel = function() { + $uibModalInstance.dismiss('cancel'); + }; + } + ] + }); + } else { + $window.open( + UrlInterpolationService.interpolateUrl( + TOPIC_EDITOR_URL_TEMPLATE, { + topicId: topicId + } + ), '_self'); + } + }; - ctrl.returnToTopicEditorPage = function() { - if (UndoRedoService.getChangeCount() > 0) { - var modalInstance = $uibModal.open({ - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/story-editor-page/modal-templates/' + - 'save-pending-changes-modal.template.html'), - backdrop: true, - controller: [ - '$scope', '$uibModalInstance', - function($scope, $uibModalInstance) { - $scope.cancel = function() { - $uibModalInstance.dismiss('cancel'); - }; - } - ] - }); - } else { - $window.open( - UrlInterpolationService.interpolateUrl( - TOPIC_EDITOR_URL_TEMPLATE, { - topicId: topicId - } - ), '_self'); - } - }; - - var setPageTitle = function() { - PageTitleService.setPageTitle( - StoryEditorStateService.getStory().getTitle() + ' - Oppia'); - }; - $scope.$on(EVENT_STORY_INITIALIZED, setPageTitle); - $scope.$on(EVENT_STORY_REINITIALIZED, setPageTitle); - } - ] - }; -}]); + var setPageTitle = function() { + PageTitleService.setPageTitle( + StoryEditorStateService.getStory().getTitle() + ' - Oppia'); + }; + $scope.$on(EVENT_STORY_INITIALIZED, setPageTitle); + $scope.$on(EVENT_STORY_REINITIALIZED, setPageTitle); + } + ] + }; + }]); diff --git a/core/templates/dev/head/pages/story-editor-page/story-editor-page.scripts.ts b/core/templates/dev/head/pages/story-editor-page/story-editor-page.scripts.ts index 9176955df7a6..ebbcf2ea1bc4 100644 --- a/core/templates/dev/head/pages/story-editor-page/story-editor-page.scripts.ts +++ b/core/templates/dev/head/pages/story-editor-page/story-editor-page.scripts.ts @@ -16,6 +16,7 @@ * @fileoverview Directive scripts for the story editor page. */ +require('AppInit.ts'); require('App.ts'); require('base_components/BaseContentDirective.ts'); diff --git a/core/templates/dev/head/pages/story-viewer-page/chapters-list/story-viewer-chapters-list.directive.ts b/core/templates/dev/head/pages/story-viewer-page/chapters-list/story-viewer-chapters-list.directive.ts index 4a9565cd8c4f..99f5f4df6453 100644 --- a/core/templates/dev/head/pages/story-viewer-page/chapters-list/story-viewer-chapters-list.directive.ts +++ b/core/templates/dev/head/pages/story-viewer-page/chapters-list/story-viewer-chapters-list.directive.ts @@ -27,9 +27,7 @@ require('services/AlertsService.ts'); require('services/PageTitleService.ts'); require('services/contextual/UrlService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.animation('.oppia-story-animate-slide', function() { +angular.module('oppia').animation('.oppia-story-animate-slide', function() { return { enter: function(element) { element.hide().slideDown(); @@ -40,8 +38,8 @@ oppia.animation('.oppia-story-animate-slide', function() { }; }); -oppia.directive('storyViewerChaptersList', ['UrlInterpolationService', - function(UrlInterpolationService) { +angular.module('oppia').directive('storyViewerChaptersList', [ + 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', scope: {}, diff --git a/core/templates/dev/head/pages/story-viewer-page/navbar-breadcrumb/story-viewer-navbar-breadcrumb.directive.ts b/core/templates/dev/head/pages/story-viewer-page/navbar-breadcrumb/story-viewer-navbar-breadcrumb.directive.ts index 8e3bd689f655..0809609fa9ee 100644 --- a/core/templates/dev/head/pages/story-viewer-page/navbar-breadcrumb/story-viewer-navbar-breadcrumb.directive.ts +++ b/core/templates/dev/head/pages/story-viewer-page/navbar-breadcrumb/story-viewer-navbar-breadcrumb.directive.ts @@ -20,9 +20,7 @@ require('domain/story_viewer/StoryViewerBackendApiService.ts'); require('domain/utilities/UrlInterpolationService.ts'); require('services/contextual/UrlService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('storyViewerNavbarBreadcrumb', [ +angular.module('oppia').directive('storyViewerNavbarBreadcrumb', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/story-viewer-page/story-viewer-page.directive.ts b/core/templates/dev/head/pages/story-viewer-page/story-viewer-page.directive.ts index c4fce18c1b88..35e09d5afb84 100644 --- a/core/templates/dev/head/pages/story-viewer-page/story-viewer-page.directive.ts +++ b/core/templates/dev/head/pages/story-viewer-page/story-viewer-page.directive.ts @@ -32,9 +32,7 @@ require('services/AlertsService.ts'); require('services/PageTitleService.ts'); require('services/contextual/UrlService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('storyViewerPage', [ +angular.module('oppia').directive('storyViewerPage', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/story-viewer-page/story-viewer-page.scripts.ts b/core/templates/dev/head/pages/story-viewer-page/story-viewer-page.scripts.ts index 21eb71711783..6edbdd1c76a7 100644 --- a/core/templates/dev/head/pages/story-viewer-page/story-viewer-page.scripts.ts +++ b/core/templates/dev/head/pages/story-viewer-page/story-viewer-page.scripts.ts @@ -16,6 +16,7 @@ * @fileoverview Directives required in story viewer. */ +require('AppInit.ts'); require('App.ts'); require('pages/story-viewer-page/story-viewer-page.directive.ts'); diff --git a/core/templates/dev/head/pages/teach-page/teach-page.controller.ts b/core/templates/dev/head/pages/teach-page/teach-page.controller.ts index 7f42bab25b9c..1326572296f8 100644 --- a/core/templates/dev/head/pages/teach-page/teach-page.controller.ts +++ b/core/templates/dev/head/pages/teach-page/teach-page.controller.ts @@ -24,73 +24,72 @@ require( require('domain/utilities/UrlInterpolationService.ts'); require('services/SiteAnalyticsService.ts'); -var oppia = require('AppInit.ts').module; +angular.module('oppia').directive('teachPage', [ + 'UrlInterpolationService', function( + UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: {}, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/teach-page/teach-page.directive.html'), + controllerAs: '$ctrl', + controller: [ + '$timeout', '$window', 'SiteAnalyticsService', + 'UrlInterpolationService', + function( + $timeout, $window, SiteAnalyticsService, + UrlInterpolationService) { + var ctrl = this; + // Define constants + ctrl.TAB_ID_TEACH = 'teach'; + ctrl.TAB_ID_PLAYBOOK = 'playbook'; + ctrl.TEACH_FORM_URL = 'https://goo.gl/forms/0p3Axuw5tLjTfiri1'; -oppia.directive('teachPage', ['UrlInterpolationService', function( - UrlInterpolationService) { - return { - restrict: 'E', - scope: {}, - bindToController: {}, - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/teach-page/teach-page.directive.html'), - controllerAs: '$ctrl', - controller: [ - '$timeout', '$window', 'SiteAnalyticsService', - 'UrlInterpolationService', - function( - $timeout, $window, SiteAnalyticsService, - UrlInterpolationService) { - var ctrl = this; - // Define constants - ctrl.TAB_ID_TEACH = 'teach'; - ctrl.TAB_ID_PLAYBOOK = 'playbook'; - ctrl.TEACH_FORM_URL = 'https://goo.gl/forms/0p3Axuw5tLjTfiri1'; + var activeTabClass = 'oppia-about-tabs-active'; + var hash = window.location.hash.slice(1); + var visibleContent = 'oppia-about-visible-content'; - var activeTabClass = 'oppia-about-tabs-active'; - var hash = window.location.hash.slice(1); - var visibleContent = 'oppia-about-visible-content'; + var activateTab = function(tabName) { + $("a[id='" + tabName + "']").parent().addClass( + activeTabClass + ).siblings().removeClass(activeTabClass); + $('.' + tabName).addClass(visibleContent).siblings().removeClass( + visibleContent + ); + }; - var activateTab = function(tabName) { - $("a[id='" + tabName + "']").parent().addClass( - activeTabClass - ).siblings().removeClass(activeTabClass); - $('.' + tabName).addClass(visibleContent).siblings().removeClass( - visibleContent - ); - }; - - if (hash === ctrl.TAB_ID_TEACH) { - activateTab(ctrl.TAB_ID_TEACH); - } else if (hash === ctrl.TAB_ID_PLAYBOOK) { - activateTab(ctrl.TAB_ID_PLAYBOOK); - } - - window.onhashchange = function() { - var hashChange = window.location.hash.slice(1); - if (hashChange === ctrl.TAB_ID_TEACH) { + if (hash === ctrl.TAB_ID_TEACH) { activateTab(ctrl.TAB_ID_TEACH); - } else if (hashChange === ctrl.TAB_ID_PLAYBOOK) { + } else if (hash === ctrl.TAB_ID_PLAYBOOK) { activateTab(ctrl.TAB_ID_PLAYBOOK); } - }; - ctrl.onTabClick = function(tabName) { - // Update hash - window.location.hash = '#' + tabName; - activateTab(tabName); - }; + window.onhashchange = function() { + var hashChange = window.location.hash.slice(1); + if (hashChange === ctrl.TAB_ID_TEACH) { + activateTab(ctrl.TAB_ID_TEACH); + } else if (hashChange === ctrl.TAB_ID_PLAYBOOK) { + activateTab(ctrl.TAB_ID_PLAYBOOK); + } + }; - ctrl.getStaticImageUrl = UrlInterpolationService.getStaticImageUrl; + ctrl.onTabClick = function(tabName) { + // Update hash + window.location.hash = '#' + tabName; + activateTab(tabName); + }; - ctrl.onApplyToTeachWithOppia = function() { - SiteAnalyticsService.registerApplyToTeachWithOppiaEvent(); - $timeout(function() { - $window.location = ctrl.TEACH_FORM_URL; - }, 150); - return false; - }; - } - ] - }; -}]); + ctrl.getStaticImageUrl = UrlInterpolationService.getStaticImageUrl; + + ctrl.onApplyToTeachWithOppia = function() { + SiteAnalyticsService.registerApplyToTeachWithOppiaEvent(); + $timeout(function() { + $window.location = ctrl.TEACH_FORM_URL; + }, 150); + return false; + }; + } + ] + }; + }]); diff --git a/core/templates/dev/head/pages/teach-page/teach-page.scripts.ts b/core/templates/dev/head/pages/teach-page/teach-page.scripts.ts index 4e6095da92f2..f66ef787a5a9 100644 --- a/core/templates/dev/head/pages/teach-page/teach-page.scripts.ts +++ b/core/templates/dev/head/pages/teach-page/teach-page.scripts.ts @@ -16,6 +16,7 @@ * @fileoverview Controllers for the teach page. */ +require('AppInit.ts'); require('App.ts'); require('pages/teach-page/teach-page.controller.ts'); diff --git a/core/templates/dev/head/pages/terms-page/terms-page.controller.ts b/core/templates/dev/head/pages/terms-page/terms-page.scripts.ts similarity index 97% rename from core/templates/dev/head/pages/terms-page/terms-page.controller.ts rename to core/templates/dev/head/pages/terms-page/terms-page.scripts.ts index 278be30d152c..408ac649e521 100644 --- a/core/templates/dev/head/pages/terms-page/terms-page.controller.ts +++ b/core/templates/dev/head/pages/terms-page/terms-page.scripts.ts @@ -16,6 +16,7 @@ * @fileoverview Directives required in terms page. */ +require('AppInit.ts'); require('App.ts'); require('base_components/BaseContentDirective.ts'); diff --git a/core/templates/dev/head/pages/thanks-page/thanks-page.controller.ts b/core/templates/dev/head/pages/thanks-page/thanks-page.controller.ts index 92a52e154ada..cb459a99bef5 100644 --- a/core/templates/dev/head/pages/thanks-page/thanks-page.controller.ts +++ b/core/templates/dev/head/pages/thanks-page/thanks-page.controller.ts @@ -16,18 +16,13 @@ * @fileoverview Controllers for the 'thanks' page. */ -require('App.ts'); - -require('base_components/BaseContentDirective.ts'); require( 'components/common-layout-directives/common-elements/' + 'background-banner.directive.ts'); require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.controller('Thanks', [ +angular.module('oppia').controller('Thanks', [ '$scope', 'UrlInterpolationService', function( $scope, UrlInterpolationService) { diff --git a/core/templates/dev/head/pages/thanks-page/thanks-page.scripts.ts b/core/templates/dev/head/pages/thanks-page/thanks-page.scripts.ts new file mode 100644 index 000000000000..675cb8c497a7 --- /dev/null +++ b/core/templates/dev/head/pages/thanks-page/thanks-page.scripts.ts @@ -0,0 +1,23 @@ +// Copyright 2019 The Oppia Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS-IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * @fileoverview Scripts for the thanks page. + */ + +require('AppInit.ts'); +require('App.ts'); + +require('base_components/BaseContentDirective.ts'); +require('pages/thanks-page/thanks-page.controller.ts'); diff --git a/core/templates/dev/head/pages/topic-editor-page/editor-tab/stories-list.directive.ts b/core/templates/dev/head/pages/topic-editor-page/editor-tab/stories-list.directive.ts index 1d81cd1c1df9..a130a1a36690 100644 --- a/core/templates/dev/head/pages/topic-editor-page/editor-tab/stories-list.directive.ts +++ b/core/templates/dev/head/pages/topic-editor-page/editor-tab/stories-list.directive.ts @@ -23,9 +23,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('pages/topic-editor-page/services/topic-editor-state.service.ts'); require('services/contextual/UrlService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('storiesList', [ +angular.module('oppia').directive('storiesList', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/topic-editor-page/editor-tab/topic-editor-tab.directive.ts b/core/templates/dev/head/pages/topic-editor-page/editor-tab/topic-editor-tab.directive.ts index bb57e9eb6db9..76f1715a7fcd 100644 --- a/core/templates/dev/head/pages/topic-editor-page/editor-tab/topic-editor-tab.directive.ts +++ b/core/templates/dev/head/pages/topic-editor-page/editor-tab/topic-editor-tab.directive.ts @@ -24,9 +24,7 @@ require('domain/topic/TopicUpdateService.ts'); require('domain/utilities/UrlInterpolationService.ts'); require('pages/topic-editor-page/services/topic-editor-state.service.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('topicEditorTab', [ +angular.module('oppia').directive('topicEditorTab', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/topic-editor-page/navbar/topic-editor-navbar-breadcrumb.directive.ts b/core/templates/dev/head/pages/topic-editor-page/navbar/topic-editor-navbar-breadcrumb.directive.ts index 3d0663f893ef..923916bef21b 100644 --- a/core/templates/dev/head/pages/topic-editor-page/navbar/topic-editor-navbar-breadcrumb.directive.ts +++ b/core/templates/dev/head/pages/topic-editor-page/navbar/topic-editor-navbar-breadcrumb.directive.ts @@ -20,9 +20,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('pages/topic-editor-page/services/topic-editor-state.service.ts'); require('services/stateful/FocusManagerService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('topicEditorNavbarBreadcrumb', [ +angular.module('oppia').directive('topicEditorNavbarBreadcrumb', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/topic-editor-page/navbar/topic-editor-navbar.directive.ts b/core/templates/dev/head/pages/topic-editor-page/navbar/topic-editor-navbar.directive.ts index ca95e6d85007..015f07c9d084 100644 --- a/core/templates/dev/head/pages/topic-editor-page/navbar/topic-editor-navbar.directive.ts +++ b/core/templates/dev/head/pages/topic-editor-page/navbar/topic-editor-navbar.directive.ts @@ -27,9 +27,7 @@ require('pages/topic-editor-page/services/topic-editor-state.service.ts'); require('services/AlertsService.ts'); require('services/contextual/UrlService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('topicEditorNavbar', [ +angular.module('oppia').directive('topicEditorNavbar', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/topic-editor-page/questions-tab/questions-tab.directive.ts b/core/templates/dev/head/pages/topic-editor-page/questions-tab/questions-tab.directive.ts index bbe190424919..b6a9854d5404 100644 --- a/core/templates/dev/head/pages/topic-editor-page/questions-tab/questions-tab.directive.ts +++ b/core/templates/dev/head/pages/topic-editor-page/questions-tab/questions-tab.directive.ts @@ -36,9 +36,7 @@ require('services/AlertsService.ts'); require('services/contextual/UrlService.ts'); require('services/QuestionsListService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('questionsTab', [ +angular.module('oppia').directive('questionsTab', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/topic-editor-page/services/topic-editor-routing.service.ts b/core/templates/dev/head/pages/topic-editor-page/services/topic-editor-routing.service.ts index 14e3ed84839f..edbae1baac44 100644 --- a/core/templates/dev/head/pages/topic-editor-page/services/topic-editor-routing.service.ts +++ b/core/templates/dev/head/pages/topic-editor-page/services/topic-editor-routing.service.ts @@ -16,12 +16,10 @@ * @fileoverview Service that handles routing for the topic editor page. */ -var oppia = require('AppInit.ts').module; - -oppia.factory('TopicEditorRoutingService', [ - '$interval', '$location', '$rootScope', '$timeout', '$window', +angular.module('oppia').factory('TopicEditorRoutingService', [ + '$location', '$rootScope', function( - $interval, $location, $rootScope, $timeout, $window) { + $location, $rootScope) { var MAIN_TAB = 'main'; var SUBTOPICS_TAB = 'subtopics'; var QUESTIONS_TAB = 'questions'; diff --git a/core/templates/dev/head/pages/topic-editor-page/services/topic-editor-state.service.ts b/core/templates/dev/head/pages/topic-editor-page/services/topic-editor-state.service.ts index 4240301d9354..f08c217b18ae 100644 --- a/core/templates/dev/head/pages/topic-editor-page/services/topic-editor-state.service.ts +++ b/core/templates/dev/head/pages/topic-editor-page/services/topic-editor-state.service.ts @@ -31,25 +31,21 @@ require('services/QuestionsListService.ts'); require('pages/topic-editor-page/topic-editor-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('TopicEditorStateService', [ +angular.module('oppia').factory('TopicEditorStateService', [ '$rootScope', 'AlertsService', 'EditableStoryBackendApiService', 'EditableTopicBackendApiService', - 'QuestionBackendApiService', 'QuestionsListService', - 'SubtopicPageObjectFactory', + 'QuestionsListService', 'SubtopicPageObjectFactory', 'TopicObjectFactory', 'TopicRightsBackendApiService', 'TopicRightsObjectFactory', 'UndoRedoService', - 'EVENT_QUESTION_SUMMARIES_INITIALIZED', 'EVENT_STORY_SUMMARIES_INITIALIZED', + 'EVENT_STORY_SUMMARIES_INITIALIZED', 'EVENT_SUBTOPIC_PAGE_LOADED', 'EVENT_TOPIC_INITIALIZED', 'EVENT_TOPIC_REINITIALIZED', function( $rootScope, AlertsService, EditableStoryBackendApiService, EditableTopicBackendApiService, - QuestionBackendApiService, QuestionsListService, - SubtopicPageObjectFactory, + QuestionsListService, SubtopicPageObjectFactory, TopicObjectFactory, TopicRightsBackendApiService, TopicRightsObjectFactory, UndoRedoService, - EVENT_QUESTION_SUMMARIES_INITIALIZED, EVENT_STORY_SUMMARIES_INITIALIZED, + EVENT_STORY_SUMMARIES_INITIALIZED, EVENT_SUBTOPIC_PAGE_LOADED, EVENT_TOPIC_INITIALIZED, EVENT_TOPIC_REINITIALIZED) { var _topic = TopicObjectFactory.createInterstitialTopic(); diff --git a/core/templates/dev/head/pages/topic-editor-page/subtopics-list-tab/subtopics-list-tab.directive.ts b/core/templates/dev/head/pages/topic-editor-page/subtopics-list-tab/subtopics-list-tab.directive.ts index 3aaf248adead..466828d7c8be 100644 --- a/core/templates/dev/head/pages/topic-editor-page/subtopics-list-tab/subtopics-list-tab.directive.ts +++ b/core/templates/dev/head/pages/topic-editor-page/subtopics-list-tab/subtopics-list-tab.directive.ts @@ -22,9 +22,7 @@ require('domain/topic/TopicUpdateService.ts'); require('domain/utilities/UrlInterpolationService.ts'); require('pages/topic-editor-page/services/topic-editor-state.service.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('subtopicsListTab', [ +angular.module('oppia').directive('subtopicsListTab', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/topic-editor-page/topic-editor-page.constants.ts b/core/templates/dev/head/pages/topic-editor-page/topic-editor-page.constants.ts index 0ba03fd07e61..c15a98dfb340 100644 --- a/core/templates/dev/head/pages/topic-editor-page/topic-editor-page.constants.ts +++ b/core/templates/dev/head/pages/topic-editor-page/topic-editor-page.constants.ts @@ -16,13 +16,13 @@ * @fileoverview Constants for the topic editor page. */ -var oppia = require('AppInit.ts').module; - -oppia.constant( +angular.module('oppia').constant( 'TOPIC_NAME_INPUT_FOCUS_LABEL', 'topicNameInputFocusLabel'); -oppia.constant('EVENT_TOPIC_INITIALIZED', 'topicInitialized'); -oppia.constant('EVENT_TOPIC_REINITIALIZED', 'topicReinitialized'); -oppia.constant('EVENT_SUBTOPIC_PAGE_LOADED', 'subtopicPageLoaded'); -oppia.constant( +angular.module('oppia').constant('EVENT_TOPIC_INITIALIZED', 'topicInitialized'); +angular.module('oppia').constant( + 'EVENT_TOPIC_REINITIALIZED', 'topicReinitialized'); +angular.module('oppia').constant( + 'EVENT_SUBTOPIC_PAGE_LOADED', 'subtopicPageLoaded'); +angular.module('oppia').constant( 'EVENT_STORY_SUMMARIES_INITIALIZED', 'storySummariesInitialized'); diff --git a/core/templates/dev/head/pages/topic-editor-page/topic-editor-page.controller.ts b/core/templates/dev/head/pages/topic-editor-page/topic-editor-page.controller.ts index ebdf2c03cac0..865304cc426d 100644 --- a/core/templates/dev/head/pages/topic-editor-page/topic-editor-page.controller.ts +++ b/core/templates/dev/head/pages/topic-editor-page/topic-editor-page.controller.ts @@ -124,35 +124,34 @@ require('services/contextual/UrlService.ts'); require('pages/topic-editor-page/topic-editor-page.constants.ts'); require('pages/interaction-specs.constants.ts'); -var oppia = require('AppInit.ts').module; +angular.module('oppia').directive('topicEditorPage', [ + 'UrlInterpolationService', function( + UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: {}, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/topic-editor-page/topic-editor-page.directive.html'), + controllerAs: '$ctrl', + controller: [ + '$scope', 'PageTitleService', 'TopicEditorRoutingService', + 'TopicEditorStateService', 'UrlService', + 'EVENT_TOPIC_INITIALIZED', 'EVENT_TOPIC_REINITIALIZED', + function($scope, PageTitleService, TopicEditorRoutingService, + TopicEditorStateService, UrlService, + EVENT_TOPIC_INITIALIZED, EVENT_TOPIC_REINITIALIZED) { + var ctrl = this; + ctrl.getActiveTabName = TopicEditorRoutingService.getActiveTabName; + TopicEditorStateService.loadTopic(UrlService.getTopicIdFromUrl()); -oppia.directive('topicEditorPage', ['UrlInterpolationService', function( - UrlInterpolationService) { - return { - restrict: 'E', - scope: {}, - bindToController: {}, - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/topic-editor-page/topic-editor-page.directive.html'), - controllerAs: '$ctrl', - controller: [ - '$scope', 'PageTitleService', 'TopicEditorRoutingService', - 'TopicEditorStateService', 'UrlService', - 'EVENT_TOPIC_INITIALIZED', 'EVENT_TOPIC_REINITIALIZED', - function($scope, PageTitleService, TopicEditorRoutingService, - TopicEditorStateService, UrlService, - EVENT_TOPIC_INITIALIZED, EVENT_TOPIC_REINITIALIZED) { - var ctrl = this; - ctrl.getActiveTabName = TopicEditorRoutingService.getActiveTabName; - TopicEditorStateService.loadTopic(UrlService.getTopicIdFromUrl()); - - var setPageTitle = function() { - PageTitleService.setPageTitle( - TopicEditorStateService.getTopic().getName() + ' - Oppia'); - }; - $scope.$on(EVENT_TOPIC_INITIALIZED, setPageTitle); - $scope.$on(EVENT_TOPIC_REINITIALIZED, setPageTitle); - } - ] - }; -}]); + var setPageTitle = function() { + PageTitleService.setPageTitle( + TopicEditorStateService.getTopic().getName() + ' - Oppia'); + }; + $scope.$on(EVENT_TOPIC_INITIALIZED, setPageTitle); + $scope.$on(EVENT_TOPIC_REINITIALIZED, setPageTitle); + } + ] + }; + }]); diff --git a/core/templates/dev/head/pages/topic-editor-page/topic-editor-page.scripts.ts b/core/templates/dev/head/pages/topic-editor-page/topic-editor-page.scripts.ts index 0756796220d4..71530c26456a 100644 --- a/core/templates/dev/head/pages/topic-editor-page/topic-editor-page.scripts.ts +++ b/core/templates/dev/head/pages/topic-editor-page/topic-editor-page.scripts.ts @@ -16,6 +16,7 @@ * @fileoverview Directive scripts for the topic editor page. */ +require('AppInit.ts'); require('App.ts'); require( diff --git a/core/templates/dev/head/pages/topic-viewer-page/navbar-breadcrumb/topic-viewer-navbar-breadcrumb.directive.ts b/core/templates/dev/head/pages/topic-viewer-page/navbar-breadcrumb/topic-viewer-navbar-breadcrumb.directive.ts index e9a7ba4c76b5..a46422adea01 100644 --- a/core/templates/dev/head/pages/topic-viewer-page/navbar-breadcrumb/topic-viewer-navbar-breadcrumb.directive.ts +++ b/core/templates/dev/head/pages/topic-viewer-page/navbar-breadcrumb/topic-viewer-navbar-breadcrumb.directive.ts @@ -19,9 +19,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/contextual/UrlService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('topicViewerNavbarBreadcrumb', [ +angular.module('oppia').directive('topicViewerNavbarBreadcrumb', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/topic-viewer-page/practice-tab/practice-tab.directive.ts b/core/templates/dev/head/pages/topic-viewer-page/practice-tab/practice-tab.directive.ts index 724499f0aadd..730c8efc49e1 100644 --- a/core/templates/dev/head/pages/topic-viewer-page/practice-tab/practice-tab.directive.ts +++ b/core/templates/dev/head/pages/topic-viewer-page/practice-tab/practice-tab.directive.ts @@ -21,13 +21,11 @@ require('pages/practice-session-page/practice-session-page.constants.ts'); require('domain/utilities/UrlInterpolationService.ts'); require('services/contextual/WindowDimensionsService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('practiceTab', [ - '$http', '$window', 'UrlInterpolationService', +angular.module('oppia').directive('practiceTab', [ + '$window', 'UrlInterpolationService', 'PRACTICE_SESSIONS_URL', function( - $http, $window, UrlInterpolationService, + $window, UrlInterpolationService, PRACTICE_SESSIONS_URL) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/topic-viewer-page/stories-list/stories-list.directive.ts b/core/templates/dev/head/pages/topic-viewer-page/stories-list/stories-list.directive.ts index 279edfa98279..e5361bb6f23b 100644 --- a/core/templates/dev/head/pages/topic-viewer-page/stories-list/stories-list.directive.ts +++ b/core/templates/dev/head/pages/topic-viewer-page/stories-list/stories-list.directive.ts @@ -21,9 +21,7 @@ require('components/summary-tile/story-summary-tile.directive.ts'); require('domain/utilities/UrlInterpolationService.ts'); require('services/contextual/WindowDimensionsService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('storiesList', [ +angular.module('oppia').directive('storiesList', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/topic-viewer-page/topic-viewer-page.controller.ts b/core/templates/dev/head/pages/topic-viewer-page/topic-viewer-page.controller.ts index f83679393f57..d51fa156f28a 100644 --- a/core/templates/dev/head/pages/topic-viewer-page/topic-viewer-page.controller.ts +++ b/core/templates/dev/head/pages/topic-viewer-page/topic-viewer-page.controller.ts @@ -27,53 +27,52 @@ require('services/AlertsService.ts'); require('services/PageTitleService.ts'); require('services/contextual/UrlService.ts'); -var oppia = require('AppInit.ts').module; +angular.module('oppia').directive('topicViewerPage', [ + 'UrlInterpolationService', function( + UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: {}, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/topic-viewer-page/topic-viewer-page.directive.html'), + controllerAs: '$ctrl', + controller: [ + '$rootScope', '$window', 'AlertsService', + 'PageTitleService', 'TopicViewerBackendApiService', + 'UrlService', 'FATAL_ERROR_CODES', + function( + $rootScope, $window, AlertsService, + PageTitleService, TopicViewerBackendApiService, + UrlService, FATAL_ERROR_CODES) { + var ctrl = this; + ctrl.setActiveTab = function(newActiveTabName) { + ctrl.activeTab = newActiveTabName; + }; + ctrl.setActiveTab('story'); -oppia.directive('topicViewerPage', ['UrlInterpolationService', function( - UrlInterpolationService) { - return { - restrict: 'E', - scope: {}, - bindToController: {}, - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/topic-viewer-page/topic-viewer-page.directive.html'), - controllerAs: '$ctrl', - controller: [ - '$rootScope', '$window', 'AlertsService', - 'PageTitleService', 'TopicViewerBackendApiService', - 'UrlService', 'FATAL_ERROR_CODES', - function( - $rootScope, $window, AlertsService, - PageTitleService, TopicViewerBackendApiService, - UrlService, FATAL_ERROR_CODES) { - var ctrl = this; - ctrl.setActiveTab = function(newActiveTabName) { - ctrl.activeTab = newActiveTabName; - }; - ctrl.setActiveTab('story'); + ctrl.checkMobileView = function() { + return ($window.innerWidth < 500); + }; + ctrl.topicName = UrlService.getTopicNameFromLearnerUrl(); - ctrl.checkMobileView = function() { - return ($window.innerWidth < 500); - }; - ctrl.topicName = UrlService.getTopicNameFromLearnerUrl(); + PageTitleService.setPageTitle(ctrl.topicName + ' - Oppia'); - PageTitleService.setPageTitle(ctrl.topicName + ' - Oppia'); - - $rootScope.loadingMessage = 'Loading'; - TopicViewerBackendApiService.fetchTopicData(ctrl.topicName).then( - function(topicDataDict) { - ctrl.topicId = topicDataDict.topic_id; - ctrl.canonicalStoriesList = topicDataDict.canonical_story_dicts; - $rootScope.loadingMessage = ''; - ctrl.topicId = topicDataDict.id; - }, - function(errorResponse) { - if (FATAL_ERROR_CODES.indexOf(errorResponse.status) !== -1) { - AlertsService.addWarning('Failed to get dashboard data'); + $rootScope.loadingMessage = 'Loading'; + TopicViewerBackendApiService.fetchTopicData(ctrl.topicName).then( + function(topicDataDict) { + ctrl.topicId = topicDataDict.topic_id; + ctrl.canonicalStoriesList = topicDataDict.canonical_story_dicts; + $rootScope.loadingMessage = ''; + ctrl.topicId = topicDataDict.id; + }, + function(errorResponse) { + if (FATAL_ERROR_CODES.indexOf(errorResponse.status) !== -1) { + AlertsService.addWarning('Failed to get dashboard data'); + } } - } - ); - } - ] - }; -}]); + ); + } + ] + }; + }]); diff --git a/core/templates/dev/head/pages/topic-viewer-page/topic-viewer-page.scripts.ts b/core/templates/dev/head/pages/topic-viewer-page/topic-viewer-page.scripts.ts index 2d7e4c300018..1447bcb9d1da 100644 --- a/core/templates/dev/head/pages/topic-viewer-page/topic-viewer-page.scripts.ts +++ b/core/templates/dev/head/pages/topic-viewer-page/topic-viewer-page.scripts.ts @@ -16,6 +16,7 @@ * @fileoverview Directive scripts for the topic viewer. */ +require('AppInit.ts'); require('App.ts'); require( diff --git a/core/templates/dev/head/pages/topics-and-skills-dashboard-page/navbar/topics-and-skills-dashboard-navbar-breadcrumb.directive.ts b/core/templates/dev/head/pages/topics-and-skills-dashboard-page/navbar/topics-and-skills-dashboard-navbar-breadcrumb.directive.ts index aa16f791a97e..a6c15892efa2 100644 --- a/core/templates/dev/head/pages/topics-and-skills-dashboard-page/navbar/topics-and-skills-dashboard-navbar-breadcrumb.directive.ts +++ b/core/templates/dev/head/pages/topics-and-skills-dashboard-page/navbar/topics-and-skills-dashboard-navbar-breadcrumb.directive.ts @@ -18,9 +18,7 @@ require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('topicsAndSkillsDashboardNavbarBreadcrumb', [ +angular.module('oppia').directive('topicsAndSkillsDashboardNavbarBreadcrumb', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/topics-and-skills-dashboard-page/navbar/topics-and-skills-dashboard-navbar.directive.ts b/core/templates/dev/head/pages/topics-and-skills-dashboard-page/navbar/topics-and-skills-dashboard-navbar.directive.ts index 45f2fc7367b3..c04294a58e05 100644 --- a/core/templates/dev/head/pages/topics-and-skills-dashboard-page/navbar/topics-and-skills-dashboard-navbar.directive.ts +++ b/core/templates/dev/head/pages/topics-and-skills-dashboard-page/navbar/topics-and-skills-dashboard-navbar.directive.ts @@ -25,9 +25,7 @@ require( 'pages/topics-and-skills-dashboard-page/' + 'topics-and-skills-dashboard-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('topicsAndSkillsDashboardNavbar', [ +angular.module('oppia').directive('topicsAndSkillsDashboardNavbar', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/topics-and-skills-dashboard-page/skills-list/skills-list.directive.ts b/core/templates/dev/head/pages/topics-and-skills-dashboard-page/skills-list/skills-list.directive.ts index ecf957690ef3..157475d6686f 100644 --- a/core/templates/dev/head/pages/topics-and-skills-dashboard-page/skills-list/skills-list.directive.ts +++ b/core/templates/dev/head/pages/topics-and-skills-dashboard-page/skills-list/skills-list.directive.ts @@ -29,12 +29,10 @@ require( 'pages/topics-and-skills-dashboard-page/' + 'topics-and-skills-dashboard-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('skillsList', [ - '$http', 'AlertsService', 'UrlInterpolationService', +angular.module('oppia').directive('skillsList', [ + 'AlertsService', 'UrlInterpolationService', function( - $http, AlertsService, UrlInterpolationService) { + AlertsService, UrlInterpolationService) { return { restrict: 'E', scope: { diff --git a/core/templates/dev/head/pages/topics-and-skills-dashboard-page/topic-selector/topic-selector.directive.ts b/core/templates/dev/head/pages/topics-and-skills-dashboard-page/topic-selector/topic-selector.directive.ts index e89fd2d7959b..d37812136a8f 100644 --- a/core/templates/dev/head/pages/topics-and-skills-dashboard-page/topic-selector/topic-selector.directive.ts +++ b/core/templates/dev/head/pages/topics-and-skills-dashboard-page/topic-selector/topic-selector.directive.ts @@ -18,9 +18,7 @@ require('domain/utilities/UrlInterpolationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('selectTopics', [ +angular.module('oppia').directive('selectTopics', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/pages/topics-and-skills-dashboard-page/topics-and-skills-dashboard-page.constants.ts b/core/templates/dev/head/pages/topics-and-skills-dashboard-page/topics-and-skills-dashboard-page.constants.ts index 2ed50b677499..4466c52b7f5b 100644 --- a/core/templates/dev/head/pages/topics-and-skills-dashboard-page/topics-and-skills-dashboard-page.constants.ts +++ b/core/templates/dev/head/pages/topics-and-skills-dashboard-page/topics-and-skills-dashboard-page.constants.ts @@ -16,14 +16,12 @@ * @fileoverview Constants for the topics and skills dashboard. */ -var oppia = require('AppInit.ts').module; - -oppia.constant( +angular.module('oppia').constant( 'EVENT_TYPE_TOPIC_CREATION_ENABLED', 'topicCreationEnabled'); -oppia.constant( +angular.module('oppia').constant( 'EVENT_TYPE_SKILL_CREATION_ENABLED', 'skillCreationEnabled'); -oppia.constant( +angular.module('oppia').constant( 'EVENT_TOPICS_AND_SKILLS_DASHBOARD_REINITIALIZED', 'topicsAndSkillsDashboardReinitialized'); diff --git a/core/templates/dev/head/pages/topics-and-skills-dashboard-page/topics-and-skills-dashboard-page.controller.ts b/core/templates/dev/head/pages/topics-and-skills-dashboard-page/topics-and-skills-dashboard-page.controller.ts index 9ea9a8f7e810..5761b7ad40ef 100644 --- a/core/templates/dev/head/pages/topics-and-skills-dashboard-page/topics-and-skills-dashboard-page.controller.ts +++ b/core/templates/dev/head/pages/topics-and-skills-dashboard-page/topics-and-skills-dashboard-page.controller.ts @@ -40,9 +40,7 @@ require( 'pages/topics-and-skills-dashboard-page/' + 'topics-and-skills-dashboard-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('topicsAndSkillsDashboardPage', [ +angular.module('oppia').directive('topicsAndSkillsDashboardPage', [ 'UrlInterpolationService', function( UrlInterpolationService) { return { diff --git a/core/templates/dev/head/pages/topics-and-skills-dashboard-page/topics-and-skills-dashboard-page.scripts.ts b/core/templates/dev/head/pages/topics-and-skills-dashboard-page/topics-and-skills-dashboard-page.scripts.ts index 68242f665ff3..64c42337b986 100644 --- a/core/templates/dev/head/pages/topics-and-skills-dashboard-page/topics-and-skills-dashboard-page.scripts.ts +++ b/core/templates/dev/head/pages/topics-and-skills-dashboard-page/topics-and-skills-dashboard-page.scripts.ts @@ -16,6 +16,7 @@ * @fileoverview Directive scripts for the topics and skills dashboard. */ +require('AppInit.ts'); require('App.ts'); require( diff --git a/core/templates/dev/head/pages/topics-and-skills-dashboard-page/topics-list/topics-list.directive.ts b/core/templates/dev/head/pages/topics-and-skills-dashboard-page/topics-list/topics-list.directive.ts index da71b3aa06f7..f72f303b0fc0 100644 --- a/core/templates/dev/head/pages/topics-and-skills-dashboard-page/topics-list/topics-list.directive.ts +++ b/core/templates/dev/head/pages/topics-and-skills-dashboard-page/topics-list/topics-list.directive.ts @@ -24,9 +24,7 @@ require( 'pages/topics-and-skills-dashboard-page/' + 'topics-and-skills-dashboard-page.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('topicsList', [ +angular.module('oppia').directive('topicsList', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/core/templates/dev/head/services/AlertsService.ts b/core/templates/dev/head/services/AlertsService.ts index f74dad93b4f1..a3650a786fed 100644 --- a/core/templates/dev/head/services/AlertsService.ts +++ b/core/templates/dev/head/services/AlertsService.ts @@ -16,9 +16,7 @@ * @fileoverview Factory for handling warnings and info messages. */ -var oppia = require('AppInit.ts').module; - -oppia.factory('AlertsService', ['$log', function($log) { +angular.module('oppia').factory('AlertsService', ['$log', function($log) { var AlertsService = { /** * Each element in each of the arrays here is an object with two keys: diff --git a/core/templates/dev/head/services/AssetsBackendApiService.ts b/core/templates/dev/head/services/AssetsBackendApiService.ts index bc3478d8ff36..1350fcbf50db 100644 --- a/core/templates/dev/head/services/AssetsBackendApiService.ts +++ b/core/templates/dev/head/services/AssetsBackendApiService.ts @@ -23,9 +23,7 @@ require('domain/utilities/ImageFileObjectFactory.ts'); require('domain/utilities/UrlInterpolationService.ts'); require('services/CsrfTokenService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('AssetsBackendApiService', [ +angular.module('oppia').factory('AssetsBackendApiService', [ '$http', '$q', 'AudioFileObjectFactory', 'CsrfTokenService', 'FileDownloadRequestObjectFactory', 'ImageFileObjectFactory', 'UrlInterpolationService', 'DEV_MODE', diff --git a/core/templates/dev/head/services/AudioPlayerService.ts b/core/templates/dev/head/services/AudioPlayerService.ts index e9a7c67b4052..30a17a36ce60 100644 --- a/core/templates/dev/head/services/AudioPlayerService.ts +++ b/core/templates/dev/head/services/AudioPlayerService.ts @@ -16,9 +16,7 @@ * @fileoverview Service to operate the playback of audio. */ -var oppia = require('AppInit.ts').module; - -oppia.factory('AudioPlayerService', [ +angular.module('oppia').factory('AudioPlayerService', [ '$q', '$timeout', 'AssetsBackendApiService', 'AudioTranslationManagerService', 'ContextService', 'ngAudio', function( diff --git a/core/templates/dev/head/services/AutogeneratedAudioPlayerService.ts b/core/templates/dev/head/services/AutogeneratedAudioPlayerService.ts index 5aefb5a3a680..042f1f992fda 100644 --- a/core/templates/dev/head/services/AutogeneratedAudioPlayerService.ts +++ b/core/templates/dev/head/services/AutogeneratedAudioPlayerService.ts @@ -19,9 +19,7 @@ require('services/SpeechSynthesisChunkerService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('AutogeneratedAudioPlayerService', [ +angular.module('oppia').factory('AutogeneratedAudioPlayerService', [ 'SpeechSynthesisChunkerService', function(SpeechSynthesisChunkerService) { var DEFAULT_PLAYBACK_RATE = 0.92; diff --git a/core/templates/dev/head/services/AutoplayedVideosService.ts b/core/templates/dev/head/services/AutoplayedVideosService.ts index 92dd59a79cb0..d58c16d8acca 100644 --- a/core/templates/dev/head/services/AutoplayedVideosService.ts +++ b/core/templates/dev/head/services/AutoplayedVideosService.ts @@ -47,7 +47,5 @@ export class AutoplayedVideosService { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'AutoplayedVideosService', downgradeInjectable(AutoplayedVideosService)); diff --git a/core/templates/dev/head/services/CodeNormalizerService.ts b/core/templates/dev/head/services/CodeNormalizerService.ts index bbb7a8c8d4eb..eb465aafeec1 100644 --- a/core/templates/dev/head/services/CodeNormalizerService.ts +++ b/core/templates/dev/head/services/CodeNormalizerService.ts @@ -110,7 +110,5 @@ export class CodeNormalizerService { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'CodeNormalizerService', downgradeInjectable(CodeNormalizerService)); diff --git a/core/templates/dev/head/services/ComputeGraphService.ts b/core/templates/dev/head/services/ComputeGraphService.ts index 358a7da94702..5d092761117f 100644 --- a/core/templates/dev/head/services/ComputeGraphService.ts +++ b/core/templates/dev/head/services/ComputeGraphService.ts @@ -17,10 +17,8 @@ * exploration. */ -var oppia = require('AppInit.ts').module; - -oppia.factory('ComputeGraphService', [ - 'INTERACTION_SPECS', function(INTERACTION_SPECS) { +angular.module('oppia').factory('ComputeGraphService', [ + function() { var _computeGraphData = function(initStateId, states) { var nodes = {}; var links = []; diff --git a/core/templates/dev/head/services/ConstructTranslationIdsService.ts b/core/templates/dev/head/services/ConstructTranslationIdsService.ts index 73b9ba4bb2c3..bc6c0bfc2e93 100755 --- a/core/templates/dev/head/services/ConstructTranslationIdsService.ts +++ b/core/templates/dev/head/services/ConstructTranslationIdsService.ts @@ -16,9 +16,7 @@ * @fileoverview Service to dynamically construct translation ids for i18n. */ -var oppia = require('AppInit.ts').module; - -oppia.factory('ConstructTranslationIdsService', [ +angular.module('oppia').factory('ConstructTranslationIdsService', [ function() { return { // Construct a translation id for library from name and a prefix. diff --git a/core/templates/dev/head/services/ContextService.ts b/core/templates/dev/head/services/ContextService.ts index 4a94d7ed1c59..b86428dc3ba6 100644 --- a/core/templates/dev/head/services/ContextService.ts +++ b/core/templates/dev/head/services/ContextService.ts @@ -19,9 +19,7 @@ require('services/services.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ContextService', [ +angular.module('oppia').factory('ContextService', [ 'UrlService', 'EXPLORATION_EDITOR_TAB_CONTEXT', 'PAGE_CONTEXT', function(UrlService, EXPLORATION_EDITOR_TAB_CONTEXT, PAGE_CONTEXT) { var pageContext = null; diff --git a/core/templates/dev/head/services/CsrfTokenService.ts b/core/templates/dev/head/services/CsrfTokenService.ts index bbace67de74a..a1462feb5cfb 100644 --- a/core/templates/dev/head/services/CsrfTokenService.ts +++ b/core/templates/dev/head/services/CsrfTokenService.ts @@ -25,9 +25,7 @@ // libraries as well. import * as $ from 'jquery'; -var oppia = require('AppInit.ts').module; - -oppia.factory('CsrfTokenService', [function() { +angular.module('oppia').factory('CsrfTokenService', [function() { var tokenPromise = null; return { diff --git a/core/templates/dev/head/services/DateTimeFormatService.ts b/core/templates/dev/head/services/DateTimeFormatService.ts index eb652bb0d032..bf6363bddc0f 100644 --- a/core/templates/dev/head/services/DateTimeFormatService.ts +++ b/core/templates/dev/head/services/DateTimeFormatService.ts @@ -17,37 +17,36 @@ * since the Epoch to human-readable dates. */ -var oppia = require('AppInit.ts').module; - -oppia.factory('DateTimeFormatService', ['$filter', function($filter) { - return { - // Returns just the time if the local datetime representation has the - // same date as the current date. Otherwise, returns just the date if the - // local datetime representation has the same year as the current date. - // Otherwise, returns the full date (with the year abbreviated). - getLocaleAbbreviatedDatetimeString: function(millisSinceEpoch) { - var date = new Date(millisSinceEpoch); - if (date.toLocaleDateString() === new Date().toLocaleDateString()) { - return date.toLocaleTimeString([], { - hour: 'numeric', - minute: 'numeric', - hour12: true - }); - } else if (date.getFullYear() === new Date().getFullYear()) { - return $filter('date')(date, 'MMM d'); - } else { - return $filter('date')(date, 'shortDate'); +angular.module('oppia').factory('DateTimeFormatService', [ + '$filter', function($filter) { + return { + // Returns just the time if the local datetime representation has the + // same date as the current date. Otherwise, returns just the date if the + // local datetime representation has the same year as the current date. + // Otherwise, returns the full date (with the year abbreviated). + getLocaleAbbreviatedDatetimeString: function(millisSinceEpoch) { + var date = new Date(millisSinceEpoch); + if (date.toLocaleDateString() === new Date().toLocaleDateString()) { + return date.toLocaleTimeString([], { + hour: 'numeric', + minute: 'numeric', + hour12: true + }); + } else if (date.getFullYear() === new Date().getFullYear()) { + return $filter('date')(date, 'MMM d'); + } else { + return $filter('date')(date, 'shortDate'); + } + }, + // Returns just the date. + getLocaleDateString: function(millisSinceEpoch) { + var date = new Date(millisSinceEpoch); + return date.toLocaleDateString(); + }, + // Returns whether the date is at most one week before the current date. + isRecent: function(millisSinceEpoch) { + var ONE_WEEK_IN_MILLIS = 7 * 24 * 60 * 60 * 1000; + return new Date().getTime() - millisSinceEpoch < ONE_WEEK_IN_MILLIS; } - }, - // Returns just the date. - getLocaleDateString: function(millisSinceEpoch) { - var date = new Date(millisSinceEpoch); - return date.toLocaleDateString(); - }, - // Returns whether the date is at most one week before the current date. - isRecent: function(millisSinceEpoch) { - var ONE_WEEK_IN_MILLIS = 7 * 24 * 60 * 60 * 1000; - return new Date().getTime() - millisSinceEpoch < ONE_WEEK_IN_MILLIS; - } - }; -}]); + }; + }]); diff --git a/core/templates/dev/head/services/DebouncerService.ts b/core/templates/dev/head/services/DebouncerService.ts index a8e302bc877d..d5500d0d9554 100644 --- a/core/templates/dev/head/services/DebouncerService.ts +++ b/core/templates/dev/head/services/DebouncerService.ts @@ -16,9 +16,7 @@ * @fileoverview Service for debouncing function calls. */ -var oppia = require('AppInit.ts').module; - -oppia.factory('DebouncerService', [function() { +angular.module('oppia').factory('DebouncerService', [function() { return { // Returns a function that will not be triggered as long as it continues to // be invoked. The function only gets executed after it stops being called diff --git a/core/templates/dev/head/services/EditabilityService.ts b/core/templates/dev/head/services/EditabilityService.ts index 5e5a084fdba2..0e38eb1c6a04 100644 --- a/core/templates/dev/head/services/EditabilityService.ts +++ b/core/templates/dev/head/services/EditabilityService.ts @@ -66,6 +66,5 @@ export class EditabilityService { } } -var oppia = require('AppInit.ts').module; - -oppia.factory('EditabilityService', downgradeInjectable(EditabilityService)); +angular.module('oppia').factory( + 'EditabilityService', downgradeInjectable(EditabilityService)); diff --git a/core/templates/dev/head/services/ExplorationFeaturesBackendApiService.ts b/core/templates/dev/head/services/ExplorationFeaturesBackendApiService.ts index a48a50ca2927..e7b8c3f08c15 100644 --- a/core/templates/dev/head/services/ExplorationFeaturesBackendApiService.ts +++ b/core/templates/dev/head/services/ExplorationFeaturesBackendApiService.ts @@ -19,9 +19,7 @@ require('services/services.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ExplorationFeaturesBackendApiService', [ +angular.module('oppia').factory('ExplorationFeaturesBackendApiService', [ '$http', 'UrlInterpolationService', 'EXPLORATION_FEATURES_URL', function($http, UrlInterpolationService, EXPLORATION_FEATURES_URL) { return { diff --git a/core/templates/dev/head/services/ExplorationFeaturesService.ts b/core/templates/dev/head/services/ExplorationFeaturesService.ts index d0ed46ddff27..0cba4f8920f3 100644 --- a/core/templates/dev/head/services/ExplorationFeaturesService.ts +++ b/core/templates/dev/head/services/ExplorationFeaturesService.ts @@ -69,8 +69,6 @@ export class ExplorationFeaturesService { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'ExplorationFeaturesService', downgradeInjectable(ExplorationFeaturesService)); diff --git a/core/templates/dev/head/services/ExplorationHtmlFormatterService.ts b/core/templates/dev/head/services/ExplorationHtmlFormatterService.ts index 30d90dbcded7..87959469baa2 100644 --- a/core/templates/dev/head/services/ExplorationHtmlFormatterService.ts +++ b/core/templates/dev/head/services/ExplorationHtmlFormatterService.ts @@ -23,14 +23,10 @@ require('services/HtmlEscaperService.ts'); // A service that provides a number of utility functions useful to both the // editor and player. -var oppia = require('AppInit.ts').module; - -oppia.factory('ExplorationHtmlFormatterService', [ +angular.module('oppia').factory('ExplorationHtmlFormatterService', [ '$filter', 'ExtensionTagAssemblerService', 'HtmlEscaperService', - 'INTERACTION_SPECS', function( - $filter, ExtensionTagAssemblerService, HtmlEscaperService, - INTERACTION_SPECS) { + $filter, ExtensionTagAssemblerService, HtmlEscaperService) { return { /** * @param {string} interactionId - The interaction id. diff --git a/core/templates/dev/head/services/ExtensionTagAssemblerService.ts b/core/templates/dev/head/services/ExtensionTagAssemblerService.ts index 9bbdde99d164..be3fd56aa573 100644 --- a/core/templates/dev/head/services/ExtensionTagAssemblerService.ts +++ b/core/templates/dev/head/services/ExtensionTagAssemblerService.ts @@ -20,9 +20,7 @@ require('filters/string-utility-filters/camel-case-to-hyphens.filter.ts'); // Service for assembling extension tags (for interactions). -var oppia = require('AppInit.ts').module; - -oppia.factory('ExtensionTagAssemblerService', [ +angular.module('oppia').factory('ExtensionTagAssemblerService', [ '$filter', 'HtmlEscaperService', function($filter, HtmlEscaperService) { return { formatCustomizationArgAttrs: function(element, customizationArgSpecs) { diff --git a/core/templates/dev/head/services/GenerateContentIdService.ts b/core/templates/dev/head/services/GenerateContentIdService.ts index 982ca33eafd9..f1ab044120da 100644 --- a/core/templates/dev/head/services/GenerateContentIdService.ts +++ b/core/templates/dev/head/services/GenerateContentIdService.ts @@ -17,9 +17,7 @@ * SubtitledHtml domain objects. */ -var oppia = require('AppInit.ts').module; - -oppia.factory('GenerateContentIdService', [ +angular.module('oppia').factory('GenerateContentIdService', [ 'COMPONENT_NAME_FEEDBACK', 'COMPONENT_NAME_HINT', 'COMPONENT_NAME_WORKED_EXAMPLE', function( COMPONENT_NAME_FEEDBACK, COMPONENT_NAME_HINT, diff --git a/core/templates/dev/head/services/HtmlEscaperService.ts b/core/templates/dev/head/services/HtmlEscaperService.ts index 02ea2714810a..7a6d38ccc910 100644 --- a/core/templates/dev/head/services/HtmlEscaperService.ts +++ b/core/templates/dev/head/services/HtmlEscaperService.ts @@ -16,9 +16,7 @@ * @fileoverview Service for HTML serialization and escaping. */ -var oppia = require('AppInit.ts').module; - -oppia.factory('HtmlEscaperService', ['$log', function($log) { +angular.module('oppia').factory('HtmlEscaperService', ['$log', function($log) { var htmlEscaper = { objToEscapedJson: function(obj) { return this.unescapedStrToEscapedStr(JSON.stringify(obj)); diff --git a/core/templates/dev/head/services/IdGenerationService.ts b/core/templates/dev/head/services/IdGenerationService.ts index 4221a54f6775..30504b3814b5 100644 --- a/core/templates/dev/head/services/IdGenerationService.ts +++ b/core/templates/dev/head/services/IdGenerationService.ts @@ -16,9 +16,7 @@ * @fileoverview Service for generating random IDs. */ -var oppia = require('AppInit.ts').module; - -oppia.factory('IdGenerationService', [function() { +angular.module('oppia').factory('IdGenerationService', [function() { return { generateNewId: function() { // Generates random string using the last 10 digits of diff --git a/core/templates/dev/head/services/ImprovementCardService.ts b/core/templates/dev/head/services/ImprovementCardService.ts index 6d38df949b06..97cc1db4bd19 100644 --- a/core/templates/dev/head/services/ImprovementCardService.ts +++ b/core/templates/dev/head/services/ImprovementCardService.ts @@ -34,9 +34,7 @@ require('domain/statistics/FeedbackImprovementCardObjectFactory.ts'); require('domain/statistics/PlaythroughImprovementCardObjectFactory.ts'); require('domain/statistics/SuggestionImprovementCardObjectFactory.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ImprovementCardService', [ +angular.module('oppia').factory('ImprovementCardService', [ '$q', 'FeedbackImprovementCardObjectFactory', 'PlaythroughImprovementCardObjectFactory', 'SuggestionImprovementCardObjectFactory', diff --git a/core/templates/dev/head/services/ImprovementsService.ts b/core/templates/dev/head/services/ImprovementsService.ts index 6460f79da0ca..ccfd348c13de 100644 --- a/core/templates/dev/head/services/ImprovementsService.ts +++ b/core/templates/dev/head/services/ImprovementsService.ts @@ -36,6 +36,5 @@ export class ImprovementsService { } } -var oppia = require('AppInit.ts').module; - -oppia.factory('ImprovementsService', downgradeInjectable(ImprovementsService)); +angular.module('oppia').factory( + 'ImprovementsService', downgradeInjectable(ImprovementsService)); diff --git a/core/templates/dev/head/services/LocalStorageService.ts b/core/templates/dev/head/services/LocalStorageService.ts index c62e9d7b9ca6..c5ccd0eebc08 100644 --- a/core/templates/dev/head/services/LocalStorageService.ts +++ b/core/templates/dev/head/services/LocalStorageService.ts @@ -22,9 +22,7 @@ require('domain/exploration/ExplorationDraftObjectFactory.ts'); // // Note that the draft is only saved if localStorage exists and works // (i.e. has storage capacity). -var oppia = require('AppInit.ts').module; - -oppia.factory('LocalStorageService', [ +angular.module('oppia').factory('LocalStorageService', [ 'ExplorationDraftObjectFactory', function(ExplorationDraftObjectFactory) { // Check that local storage exists and works as expected. diff --git a/core/templates/dev/head/services/MessengerService.ts b/core/templates/dev/head/services/MessengerService.ts index c737e262ab7d..ae9defc0f4c2 100644 --- a/core/templates/dev/head/services/MessengerService.ts +++ b/core/templates/dev/head/services/MessengerService.ts @@ -19,147 +19,147 @@ * be attempted due to cross-domain security issues.) */ -var oppia = require('AppInit.ts').module; - -oppia.factory('MessengerService', ['$log', '$window', function($log, $window) { - var isPositiveInteger = function(n) { - return (typeof n === 'number' && n % 1 === 0 && n > 0); - }; - var isBoolean = function(b) { - return typeof b === 'boolean'; - }; - - var SUPPORTED_HASHDICT_VERSIONS = [ - '0.0.0', '0.0.1', '0.0.2', '0.0.3' - ]; - - var MESSAGE_VALIDATORS = { - heightChange: function(payload) { - return isPositiveInteger(payload.height) && isBoolean(payload.scroll); - }, - explorationLoaded: function() { - return true; - }, - stateTransition: function(payload) { - return Boolean(payload.oldStateName) || Boolean(payload.newStateName); - }, - explorationReset: function(payload) { - return Boolean(payload.stateName); - }, - explorationCompleted: function() { - return true; - } - }; - - var getPayload = { - heightChange: function(data) { - return { - height: data.height, - scroll: data.scroll - }; - }, - explorationLoaded: function(data) { - return { - explorationVersion: data.explorationVersion, - explorationTitle: data.explorationTitle - }; - }, - stateTransition: function(data) { - return { - explorationVersion: data.explorationVersion, - oldStateName: data.oldStateName, - jsonAnswer: data.jsonAnswer, - newStateName: data.newStateName - }; - }, - explorationCompleted: function(data) { - return { - explorationVersion: data.explorationVersion - }; - }, - // DEPRECATED - explorationReset: function(data) { - return { - stateName: data - }; - } - }; - - var messenger = { - HEIGHT_CHANGE: 'heightChange', - EXPLORATION_LOADED: 'explorationLoaded', - STATE_TRANSITION: 'stateTransition', - EXPLORATION_RESET: 'explorationReset', - EXPLORATION_COMPLETED: 'explorationCompleted', - sendMessage: function(messageTitle, messageData) { - // TODO(sll): For the stateTransition and explorationCompleted events, - // we now send paramValues in the messageData. We should broadcast these - // to the parent page as well. - // TODO(sll): Delete/deprecate 'reset exploration' from the list of - // events sent to a container page. +angular.module('oppia').factory('MessengerService', [ + '$log', '$window', function($log, $window) { + var isPositiveInteger = function(n) { + return (typeof n === 'number' && n % 1 === 0 && n > 0); + }; + var isBoolean = function(b) { + return typeof b === 'boolean'; + }; + + var SUPPORTED_HASHDICT_VERSIONS = [ + '0.0.0', '0.0.1', '0.0.2', '0.0.3' + ]; + + var MESSAGE_VALIDATORS = { + heightChange: function(payload) { + return isPositiveInteger(payload.height) && isBoolean(payload.scroll); + }, + explorationLoaded: function() { + return true; + }, + stateTransition: function(payload) { + return Boolean(payload.oldStateName) || Boolean(payload.newStateName); + }, + explorationReset: function(payload) { + return Boolean(payload.stateName); + }, + explorationCompleted: function() { + return true; + } + }; - // Only send a message to the parent if the oppia window is iframed and - // a hash is passed in. - var rawHash = $window.location.hash.substring(1); - if ($window.parent !== $window && rawHash && - MESSAGE_VALIDATORS.hasOwnProperty(messageTitle)) { - // Protractor tests may prepend a / to this hash, which we remove: - var hash = (rawHash.charAt(0) === '/') ? rawHash.substring(1) : rawHash; - var hashParts = hash.split('&'); - var hashDict = { - version: null, - secret: null, - tagid: null + var getPayload = { + heightChange: function(data) { + return { + height: data.height, + scroll: data.scroll }; - for (var i = 0; i < hashParts.length; i++) { - if (hashParts[i].indexOf('=') === -1) { - $log.error('Invalid hash for embedding: ' + hash); - return; + }, + explorationLoaded: function(data) { + return { + explorationVersion: data.explorationVersion, + explorationTitle: data.explorationTitle + }; + }, + stateTransition: function(data) { + return { + explorationVersion: data.explorationVersion, + oldStateName: data.oldStateName, + jsonAnswer: data.jsonAnswer, + newStateName: data.newStateName + }; + }, + explorationCompleted: function(data) { + return { + explorationVersion: data.explorationVersion + }; + }, + // DEPRECATED + explorationReset: function(data) { + return { + stateName: data + }; + } + }; + + var messenger = { + HEIGHT_CHANGE: 'heightChange', + EXPLORATION_LOADED: 'explorationLoaded', + STATE_TRANSITION: 'stateTransition', + EXPLORATION_RESET: 'explorationReset', + EXPLORATION_COMPLETED: 'explorationCompleted', + sendMessage: function(messageTitle, messageData) { + // TODO(sll): For the stateTransition and explorationCompleted events, + // we now send paramValues in the messageData. We should broadcast these + // to the parent page as well. + // TODO(sll): Delete/deprecate 'reset exploration' from the list of + // events sent to a container page. + + // Only send a message to the parent if the oppia window is iframed and + // a hash is passed in. + var rawHash = $window.location.hash.substring(1); + if ($window.parent !== $window && rawHash && + MESSAGE_VALIDATORS.hasOwnProperty(messageTitle)) { + // Protractor tests may prepend a / to this hash, which we remove: + var hash = + (rawHash.charAt(0) === '/') ? rawHash.substring(1) : rawHash; + var hashParts = hash.split('&'); + var hashDict = { + version: null, + secret: null, + tagid: null + }; + for (var i = 0; i < hashParts.length; i++) { + if (hashParts[i].indexOf('=') === -1) { + $log.error('Invalid hash for embedding: ' + hash); + return; + } + + var separatorLocation = hashParts[i].indexOf('='); + hashDict[hashParts[i].substring(0, separatorLocation)] = ( + hashParts[i].substring(separatorLocation + 1)); } - var separatorLocation = hashParts[i].indexOf('='); - hashDict[hashParts[i].substring(0, separatorLocation)] = ( - hashParts[i].substring(separatorLocation + 1)); - } - - if (!hashDict.version || !hashDict.secret) { - $log.error('Invalid hash for embedding: ' + hash); - return; - } - - if (SUPPORTED_HASHDICT_VERSIONS.indexOf(hashDict.version) !== -1) { - $log.info('Posting message to parent: ' + messageTitle); - - var payload = getPayload[messageTitle](messageData); - if (!MESSAGE_VALIDATORS[messageTitle](payload)) { - $log.error('Error validating payload: ' + payload); + if (!hashDict.version || !hashDict.secret) { + $log.error('Invalid hash for embedding: ' + hash); return; } - $log.info(payload); - - var objToSendToParent = { - title: messageTitle, - payload: payload, - sourceTagId: null, - secret: null - }; - if (hashDict.version === '0.0.0') { - // Ensure backwards-compatibility. - objToSendToParent.sourceTagId = hashDict.tagid; - objToSendToParent.secret = hashDict.secret; + if (SUPPORTED_HASHDICT_VERSIONS.indexOf(hashDict.version) !== -1) { + $log.info('Posting message to parent: ' + messageTitle); + + var payload = getPayload[messageTitle](messageData); + if (!MESSAGE_VALIDATORS[messageTitle](payload)) { + $log.error('Error validating payload: ' + payload); + return; + } + + $log.info(payload); + + var objToSendToParent = { + title: messageTitle, + payload: payload, + sourceTagId: null, + secret: null + }; + if (hashDict.version === '0.0.0') { + // Ensure backwards-compatibility. + objToSendToParent.sourceTagId = hashDict.tagid; + objToSendToParent.secret = hashDict.secret; + } + + // The targetOrigin needs to be * because any page can iframe an + // exploration. + $window.parent.postMessage(JSON.stringify(objToSendToParent), '*'); + } else { + $log.error('Unknown version for embedding: ' + hashDict.version); + return; } - - // The targetOrigin needs to be * because any page can iframe an - // exploration. - $window.parent.postMessage(JSON.stringify(objToSendToParent), '*'); - } else { - $log.error('Unknown version for embedding: ' + hashDict.version); - return; } } - } - }; + }; - return messenger; -}]); + return messenger; + }]); diff --git a/core/templates/dev/head/services/NavigationService.ts b/core/templates/dev/head/services/NavigationService.ts index 05a5507cc65a..a63be5bc2d4e 100644 --- a/core/templates/dev/head/services/NavigationService.ts +++ b/core/templates/dev/head/services/NavigationService.ts @@ -16,9 +16,7 @@ * @fileoverview Factory for navigating the top navigation bar with * tab and shift-tab. */ -var oppia = require('AppInit.ts').module; - -oppia.factory('NavigationService', [function() { +angular.module('oppia').factory('NavigationService', [function() { var navigation = { activeMenuName: '', ACTION_OPEN: 'open', diff --git a/core/templates/dev/head/services/NestedDirectivesRecursionTimeoutPreventionService.ts b/core/templates/dev/head/services/NestedDirectivesRecursionTimeoutPreventionService.ts index 65fa0217cf11..8c1d5b36462c 100644 --- a/core/templates/dev/head/services/NestedDirectivesRecursionTimeoutPreventionService.ts +++ b/core/templates/dev/head/services/NestedDirectivesRecursionTimeoutPreventionService.ts @@ -17,48 +17,46 @@ * in nested directives. See: http://stackoverflow.com/q/14430655 */ -var oppia = require('AppInit.ts').module; - -oppia.factory('NestedDirectivesRecursionTimeoutPreventionService', [ - '$compile', - function($compile) { - return { - /** - * Manually compiles the element, fixing the recursion loop. - * @param {DOM element} element - * @param {function|object} link - A post-link function, or an object with - * function(s) registered via pre and post properties. - * @return {object} An object containing the linking functions. - */ - compile: function(element, link) { - // Normalize the link parameter - if (angular.isFunction(link)) { - link = { - post: link - }; - } +angular.module('oppia').factory( + 'NestedDirectivesRecursionTimeoutPreventionService', [ + '$compile', function($compile) { + return { + /** + * Manually compiles the element, fixing the recursion loop. + * @param {DOM element} element + * @param {function|object} link - A post-link function, or an object + * with function(s) registered via pre and post properties. + * @return {object} An object containing the linking functions. + */ + compile: function(element, link) { + // Normalize the link parameter + if (angular.isFunction(link)) { + link = { + post: link + }; + } - // Break the recursion loop by removing the contents, - var contents = element.contents().remove(); - var compiledContents; - return { - pre: (link && link.pre) ? link.pre : null, - post: function(scope, element) { - // Compile the contents. - if (!compiledContents) { - compiledContents = $compile(contents); - } - // Re-add the compiled contents to the element. - compiledContents(scope, function(clone) { - element.append(clone); - }); + // Break the recursion loop by removing the contents, + var contents = element.contents().remove(); + var compiledContents; + return { + pre: (link && link.pre) ? link.pre : null, + post: function(scope, element) { + // Compile the contents. + if (!compiledContents) { + compiledContents = $compile(contents); + } + // Re-add the compiled contents to the element. + compiledContents(scope, function(clone) { + element.append(clone); + }); - // Call the post-linking function, if any. - if (link && link.post) { - link.post.apply(null, arguments); + // Call the post-linking function, if any. + if (link && link.post) { + link.post.apply(null, arguments); + } } - } - }; - } - }; - }]); + }; + } + }; + }]); diff --git a/core/templates/dev/head/services/PageTitleService.ts b/core/templates/dev/head/services/PageTitleService.ts index 0cfdd96d8fe9..90df191fb7ef 100644 --- a/core/templates/dev/head/services/PageTitleService.ts +++ b/core/templates/dev/head/services/PageTitleService.ts @@ -31,6 +31,5 @@ export class PageTitleService { } } -var oppia = require('AppInit.ts').module; - -oppia.factory('PageTitleService', downgradeInjectable(PageTitleService)); +angular.module('oppia').factory( + 'PageTitleService', downgradeInjectable(PageTitleService)); diff --git a/core/templates/dev/head/services/PlaythroughIssuesBackendApiService.ts b/core/templates/dev/head/services/PlaythroughIssuesBackendApiService.ts index 6b1a8952bc5c..e3ce04a6acfa 100644 --- a/core/templates/dev/head/services/PlaythroughIssuesBackendApiService.ts +++ b/core/templates/dev/head/services/PlaythroughIssuesBackendApiService.ts @@ -21,9 +21,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/services.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('PlaythroughIssuesBackendApiService', [ +angular.module('oppia').factory('PlaythroughIssuesBackendApiService', [ '$http', '$q', 'PlaythroughIssueObjectFactory', 'PlaythroughObjectFactory', 'UrlInterpolationService', 'FETCH_ISSUES_URL', 'FETCH_PLAYTHROUGH_URL', 'RESOLVE_ISSUE_URL', diff --git a/core/templates/dev/head/services/PlaythroughIssuesService.ts b/core/templates/dev/head/services/PlaythroughIssuesService.ts index 2a267d0678be..c8d654003a2a 100644 --- a/core/templates/dev/head/services/PlaythroughIssuesService.ts +++ b/core/templates/dev/head/services/PlaythroughIssuesService.ts @@ -22,9 +22,7 @@ require( 'pages/exploration-editor-page/statistics-tab/services/' + 'learner-action-render.service.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('PlaythroughIssuesService', [ +angular.module('oppia').factory('PlaythroughIssuesService', [ '$uibModal', 'PlaythroughIssuesBackendApiService', 'UrlInterpolationService', 'ISSUE_TYPE_CYCLIC_STATE_TRANSITIONS', 'ISSUE_TYPE_EARLY_QUIT', 'ISSUE_TYPE_MULTIPLE_INCORRECT_SUBMISSIONS', diff --git a/core/templates/dev/head/services/PlaythroughService.ts b/core/templates/dev/head/services/PlaythroughService.ts index e28c88479cc3..08340b969233 100644 --- a/core/templates/dev/head/services/PlaythroughService.ts +++ b/core/templates/dev/head/services/PlaythroughService.ts @@ -24,9 +24,7 @@ require('services/ExplorationFeaturesService.ts'); require('services/services.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('PlaythroughService', [ +angular.module('oppia').factory('PlaythroughService', [ '$http', 'ExplorationFeaturesService', 'LearnerActionObjectFactory', 'PlaythroughObjectFactory', 'StopwatchObjectFactory', 'UrlInterpolationService', 'ACTION_TYPE_ANSWER_SUBMIT', @@ -35,7 +33,7 @@ oppia.factory('PlaythroughService', [ 'EARLY_QUIT_THRESHOLD_IN_SECS', 'ISSUE_TYPE_CYCLIC_STATE_TRANSITIONS', 'ISSUE_TYPE_EARLY_QUIT', 'ISSUE_TYPE_MULTIPLE_INCORRECT_SUBMISSIONS', 'NUM_INCORRECT_ANSWERS_THRESHOLD', 'NUM_REPEATED_CYCLES_THRESHOLD', - 'PAGE_CONTEXT', 'STORE_PLAYTHROUGH_URL', + 'STORE_PLAYTHROUGH_URL', function( $http, ExplorationFeaturesService, LearnerActionObjectFactory, PlaythroughObjectFactory, StopwatchObjectFactory, @@ -45,7 +43,7 @@ oppia.factory('PlaythroughService', [ EARLY_QUIT_THRESHOLD_IN_SECS, ISSUE_TYPE_CYCLIC_STATE_TRANSITIONS, ISSUE_TYPE_EARLY_QUIT, ISSUE_TYPE_MULTIPLE_INCORRECT_SUBMISSIONS, NUM_INCORRECT_ANSWERS_THRESHOLD, NUM_REPEATED_CYCLES_THRESHOLD, - PAGE_CONTEXT, STORE_PLAYTHROUGH_URL) { + STORE_PLAYTHROUGH_URL) { var playthrough = null; var expStopwatch = null; var isLearnerInSamplePopulation = null; diff --git a/core/templates/dev/head/services/PromoBarService.ts b/core/templates/dev/head/services/PromoBarService.ts index c22526d4e4e5..f344c81b3e7a 100644 --- a/core/templates/dev/head/services/PromoBarService.ts +++ b/core/templates/dev/head/services/PromoBarService.ts @@ -18,9 +18,7 @@ require('services/services.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('PromoBarService', [ +angular.module('oppia').factory('PromoBarService', [ '$http', '$q', 'ENABLE_PROMO_BAR', function($http, $q, ENABLE_PROMO_BAR) { return { diff --git a/core/templates/dev/head/services/QuestionsListService.ts b/core/templates/dev/head/services/QuestionsListService.ts index 470a737a4af6..5b542f8113ad 100644 --- a/core/templates/dev/head/services/QuestionsListService.ts +++ b/core/templates/dev/head/services/QuestionsListService.ts @@ -21,9 +21,7 @@ require('domain/question/QuestionBackendApiService.ts'); require('services/ContextService.ts'); require('services/services.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('QuestionsListService', [ +angular.module('oppia').factory('QuestionsListService', [ '$rootScope', 'QuestionBackendApiService', 'EVENT_QUESTION_SUMMARIES_INITIALIZED', function( $rootScope, QuestionBackendApiService, diff --git a/core/templates/dev/head/services/RteHelperService.ts b/core/templates/dev/head/services/RteHelperService.ts index 31035ed4394b..2acfc6c37887 100644 --- a/core/templates/dev/head/services/RteHelperService.ts +++ b/core/templates/dev/head/services/RteHelperService.ts @@ -18,15 +18,13 @@ require('services/services.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('RteHelperService', [ - '$document', '$filter', '$interpolate', '$log', '$uibModal', - 'ContextService', 'FocusManagerService', 'HtmlEscaperService', +angular.module('oppia').factory('RteHelperService', [ + '$document', '$log', '$uibModal', + 'FocusManagerService', 'HtmlEscaperService', 'UrlInterpolationService', 'RTE_COMPONENT_SPECS', function( - $document, $filter, $interpolate, $log, $uibModal, - ContextService, FocusManagerService, HtmlEscaperService, + $document, $log, $uibModal, + FocusManagerService, HtmlEscaperService, UrlInterpolationService, RTE_COMPONENT_SPECS) { var _RICH_TEXT_COMPONENTS = []; diff --git a/core/templates/dev/head/services/SchemaDefaultValueService.ts b/core/templates/dev/head/services/SchemaDefaultValueService.ts index 8406969f197e..8c673edf2b70 100644 --- a/core/templates/dev/head/services/SchemaDefaultValueService.ts +++ b/core/templates/dev/head/services/SchemaDefaultValueService.ts @@ -53,7 +53,5 @@ export class SchemaDefaultValueService { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'SchemaDefaultValueService', downgradeInjectable(SchemaDefaultValueService)); diff --git a/core/templates/dev/head/services/SchemaUndefinedLastElementService.ts b/core/templates/dev/head/services/SchemaUndefinedLastElementService.ts index cae323913357..e2912763c848 100644 --- a/core/templates/dev/head/services/SchemaUndefinedLastElementService.ts +++ b/core/templates/dev/head/services/SchemaUndefinedLastElementService.ts @@ -38,8 +38,6 @@ export class SchemaUndefinedLastElementService { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'SchemaUndefinedLastElementService', downgradeInjectable(SchemaUndefinedLastElementService)); diff --git a/core/templates/dev/head/services/SearchService.ts b/core/templates/dev/head/services/SearchService.ts index 763cf464316f..7c64634b3475 100644 --- a/core/templates/dev/head/services/SearchService.ts +++ b/core/templates/dev/head/services/SearchService.ts @@ -18,9 +18,7 @@ require('services/services.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('SearchService', [ +angular.module('oppia').factory('SearchService', [ '$http', '$log', '$rootScope', '$translate', 'SEARCH_DATA_URL', function($http, $log, $rootScope, $translate, SEARCH_DATA_URL) { var _lastQuery = null; diff --git a/core/templates/dev/head/services/SiteAnalyticsService.ts b/core/templates/dev/head/services/SiteAnalyticsService.ts index 6a7966d8b0e1..29506149bd12 100644 --- a/core/templates/dev/head/services/SiteAnalyticsService.ts +++ b/core/templates/dev/head/services/SiteAnalyticsService.ts @@ -22,193 +22,193 @@ // Note that events are only sent if the CAN_SEND_ANALYTICS_EVENTS flag is // turned on. This flag must be turned on explicitly by the application // owner in feconf.py. -var oppia = require('AppInit.ts').module; - -oppia.factory('SiteAnalyticsService', ['$window', function($window) { - var CAN_SEND_ANALYTICS_EVENTS = constants.CAN_SEND_ANALYTICS_EVENTS; - // For definitions of the various arguments, please see: - // developers.google.com/analytics/devguides/collection/analyticsjs/events - var _sendEventToGoogleAnalytics = function( - eventCategory, eventAction, eventLabel) { - if ($window.ga && CAN_SEND_ANALYTICS_EVENTS) { - $window.ga('send', 'event', eventCategory, eventAction, eventLabel); - } - }; - - // For definitions of the various arguments, please see: - // developers.google.com/analytics/devguides/collection/analyticsjs/ - // social-interactions - var _sendSocialEventToGoogleAnalytics = function( - network, action, targetUrl) { - if ($window.ga && CAN_SEND_ANALYTICS_EVENTS) { - $window.ga('send', 'social', network, action, targetUrl); - } - }; +angular.module('oppia').factory('SiteAnalyticsService', [ + '$window', function($window) { + var CAN_SEND_ANALYTICS_EVENTS = constants.CAN_SEND_ANALYTICS_EVENTS; + // For definitions of the various arguments, please see: + // developers.google.com/analytics/devguides/collection/analyticsjs/events + var _sendEventToGoogleAnalytics = function( + eventCategory, eventAction, eventLabel) { + if ($window.ga && CAN_SEND_ANALYTICS_EVENTS) { + $window.ga('send', 'event', eventCategory, eventAction, eventLabel); + } + }; - return { - // The srcElement refers to the element on the page that is clicked. - registerStartLoginEvent: function(srcElement) { - _sendEventToGoogleAnalytics( - 'LoginButton', 'click', $window.location.pathname + ' ' + srcElement); - }, - registerNewSignupEvent: function() { - _sendEventToGoogleAnalytics('SignupButton', 'click', ''); - }, - registerClickBrowseLibraryButtonEvent: function() { - _sendEventToGoogleAnalytics( - 'BrowseLibraryButton', 'click', $window.location.pathname); - }, - registerGoToDonationSiteEvent: function(donationSiteName) { - _sendEventToGoogleAnalytics( - 'GoToDonationSite', 'click', donationSiteName); - }, - registerApplyToTeachWithOppiaEvent: function() { - _sendEventToGoogleAnalytics('ApplyToTeachWithOppia', 'click', ''); - }, - registerClickCreateExplorationButtonEvent: function() { - _sendEventToGoogleAnalytics( - 'CreateExplorationButton', 'click', $window.location.pathname); - }, - registerCreateNewExplorationEvent: function(explorationId) { - _sendEventToGoogleAnalytics('NewExploration', 'create', explorationId); - }, - registerCreateNewExplorationInCollectionEvent: function(explorationId) { - _sendEventToGoogleAnalytics( - 'NewExplorationFromCollection', 'create', explorationId); - }, - registerCreateNewCollectionEvent: function(collectionId) { - _sendEventToGoogleAnalytics('NewCollection', 'create', collectionId); - }, - registerCommitChangesToPrivateExplorationEvent: function(explorationId) { - _sendEventToGoogleAnalytics( - 'CommitToPrivateExploration', 'click', explorationId); - }, - registerShareExplorationEvent: function(network) { - _sendSocialEventToGoogleAnalytics( - network, 'share', $window.location.pathname); - }, - registerShareCollectionEvent: function(network) { - _sendSocialEventToGoogleAnalytics( - network, 'share', $window.location.pathname); - }, - registerOpenEmbedInfoEvent: function(explorationId) { - _sendEventToGoogleAnalytics('EmbedInfoModal', 'open', explorationId); - }, - registerCommitChangesToPublicExplorationEvent: function(explorationId) { - _sendEventToGoogleAnalytics( - 'CommitToPublicExploration', 'click', explorationId); - }, - // Metrics for tutorial on first creating exploration - registerTutorialModalOpenEvent: function(explorationId) { - _sendEventToGoogleAnalytics( - 'TutorialModalOpen', 'open', explorationId); - }, - registerDeclineTutorialModalEvent: function(explorationId) { - _sendEventToGoogleAnalytics( - 'DeclineTutorialModal', 'click', explorationId); - }, - registerAcceptTutorialModalEvent: function(explorationId) { - _sendEventToGoogleAnalytics( - 'AcceptTutorialModal', 'click', explorationId); - }, - // Metrics for visiting the help center - registerClickHelpButtonEvent: function(explorationId) { - _sendEventToGoogleAnalytics( - 'ClickHelpButton', 'click', explorationId); - }, - registerVisitHelpCenterEvent: function(explorationId) { - _sendEventToGoogleAnalytics( - 'VisitHelpCenter', 'click', explorationId); - }, - registerOpenTutorialFromHelpCenterEvent: function(explorationId) { - _sendEventToGoogleAnalytics( - 'OpenTutorialFromHelpCenter', 'click', explorationId); - }, - // Metrics for exiting the tutorial - registerSkipTutorialEvent: function(explorationId) { - _sendEventToGoogleAnalytics( - 'SkipTutorial', 'click', explorationId); - }, - registerFinishTutorialEvent: function(explorationId) { - _sendEventToGoogleAnalytics( - 'FinishTutorial', 'click', explorationId); - }, - // Metrics for first time editor use - registerEditorFirstEntryEvent: function(explorationId) { - _sendEventToGoogleAnalytics( - 'FirstEnterEditor', 'open', explorationId); - }, - registerFirstOpenContentBoxEvent: function(explorationId) { - _sendEventToGoogleAnalytics( - 'FirstOpenContentBox', 'open', explorationId); - }, - registerFirstSaveContentEvent: function(explorationId) { - _sendEventToGoogleAnalytics( - 'FirstSaveContent', 'click', explorationId); - }, - registerFirstClickAddInteractionEvent: function(explorationId) { - _sendEventToGoogleAnalytics( - 'FirstClickAddInteraction', 'click', explorationId); - }, - registerFirstSelectInteractionTypeEvent: function(explorationId) { - _sendEventToGoogleAnalytics( - 'FirstSelectInteractionType', 'click', explorationId); - }, - registerFirstSaveInteractionEvent: function(explorationId) { - _sendEventToGoogleAnalytics( - 'FirstSaveInteraction', 'click', explorationId); - }, - registerFirstSaveRuleEvent: function(explorationId) { - _sendEventToGoogleAnalytics( - 'FirstSaveRule', 'click', explorationId); - }, - registerFirstCreateSecondStateEvent: function(explorationId) { - _sendEventToGoogleAnalytics( - 'FirstCreateSecondState', 'create', explorationId); - }, - // Metrics for publishing explorations - registerSavePlayableExplorationEvent: function(explorationId) { - _sendEventToGoogleAnalytics( - 'SavePlayableExploration', 'save', explorationId); - }, - registerOpenPublishExplorationModalEvent: function(explorationId) { - _sendEventToGoogleAnalytics( - 'PublishExplorationModal', 'open', explorationId); - }, - registerPublishExplorationEvent: function(explorationId) { - _sendEventToGoogleAnalytics( - 'PublishExploration', 'click', explorationId); - }, - registerVisitOppiaFromIframeEvent: function(explorationId) { - _sendEventToGoogleAnalytics( - 'VisitOppiaFromIframe', 'click', explorationId); - }, - registerNewCard: function(cardNum) { - if (cardNum <= 10 || cardNum % 10 === 0) { - _sendEventToGoogleAnalytics('PlayerNewCard', 'click', cardNum); + // For definitions of the various arguments, please see: + // developers.google.com/analytics/devguides/collection/analyticsjs/ + // social-interactions + var _sendSocialEventToGoogleAnalytics = function( + network, action, targetUrl) { + if ($window.ga && CAN_SEND_ANALYTICS_EVENTS) { + $window.ga('send', 'social', network, action, targetUrl); } - }, - registerFinishExploration: function() { - _sendEventToGoogleAnalytics('PlayerFinishExploration', 'click', ''); - }, - registerOpenCollectionFromLandingPageEvent: function(collectionId) { - _sendEventToGoogleAnalytics( - 'OpenFractionsFromLandingPage', 'click', collectionId); - }, - registerStewardsLandingPageEvent: function(viewerType, buttonText) { - _sendEventToGoogleAnalytics( - 'ClickButtonOnStewardsPage', 'click', viewerType + ':' + buttonText); - }, - registerSaveRecordedAudioEvent: function(explorationId) { - _sendEventToGoogleAnalytics('SaveRecordedAudio', 'click', explorationId); - }, - registerStartAudioRecordingEvent: function(explorationId) { - _sendEventToGoogleAnalytics( - 'StartAudioRecording', 'click', explorationId); - }, - registerUploadAudioEvent: function(explorationId) { - _sendEventToGoogleAnalytics( - 'UploadRecordedAudio', 'click', explorationId); - }, - }; -}]); + }; + + return { + // The srcElement refers to the element on the page that is clicked. + registerStartLoginEvent: function(srcElement) { + _sendEventToGoogleAnalytics( + 'LoginButton', 'click', $window.location.pathname + ' ' + srcElement); + }, + registerNewSignupEvent: function() { + _sendEventToGoogleAnalytics('SignupButton', 'click', ''); + }, + registerClickBrowseLibraryButtonEvent: function() { + _sendEventToGoogleAnalytics( + 'BrowseLibraryButton', 'click', $window.location.pathname); + }, + registerGoToDonationSiteEvent: function(donationSiteName) { + _sendEventToGoogleAnalytics( + 'GoToDonationSite', 'click', donationSiteName); + }, + registerApplyToTeachWithOppiaEvent: function() { + _sendEventToGoogleAnalytics('ApplyToTeachWithOppia', 'click', ''); + }, + registerClickCreateExplorationButtonEvent: function() { + _sendEventToGoogleAnalytics( + 'CreateExplorationButton', 'click', $window.location.pathname); + }, + registerCreateNewExplorationEvent: function(explorationId) { + _sendEventToGoogleAnalytics('NewExploration', 'create', explorationId); + }, + registerCreateNewExplorationInCollectionEvent: function(explorationId) { + _sendEventToGoogleAnalytics( + 'NewExplorationFromCollection', 'create', explorationId); + }, + registerCreateNewCollectionEvent: function(collectionId) { + _sendEventToGoogleAnalytics('NewCollection', 'create', collectionId); + }, + registerCommitChangesToPrivateExplorationEvent: function(explorationId) { + _sendEventToGoogleAnalytics( + 'CommitToPrivateExploration', 'click', explorationId); + }, + registerShareExplorationEvent: function(network) { + _sendSocialEventToGoogleAnalytics( + network, 'share', $window.location.pathname); + }, + registerShareCollectionEvent: function(network) { + _sendSocialEventToGoogleAnalytics( + network, 'share', $window.location.pathname); + }, + registerOpenEmbedInfoEvent: function(explorationId) { + _sendEventToGoogleAnalytics('EmbedInfoModal', 'open', explorationId); + }, + registerCommitChangesToPublicExplorationEvent: function(explorationId) { + _sendEventToGoogleAnalytics( + 'CommitToPublicExploration', 'click', explorationId); + }, + // Metrics for tutorial on first creating exploration + registerTutorialModalOpenEvent: function(explorationId) { + _sendEventToGoogleAnalytics( + 'TutorialModalOpen', 'open', explorationId); + }, + registerDeclineTutorialModalEvent: function(explorationId) { + _sendEventToGoogleAnalytics( + 'DeclineTutorialModal', 'click', explorationId); + }, + registerAcceptTutorialModalEvent: function(explorationId) { + _sendEventToGoogleAnalytics( + 'AcceptTutorialModal', 'click', explorationId); + }, + // Metrics for visiting the help center + registerClickHelpButtonEvent: function(explorationId) { + _sendEventToGoogleAnalytics( + 'ClickHelpButton', 'click', explorationId); + }, + registerVisitHelpCenterEvent: function(explorationId) { + _sendEventToGoogleAnalytics( + 'VisitHelpCenter', 'click', explorationId); + }, + registerOpenTutorialFromHelpCenterEvent: function(explorationId) { + _sendEventToGoogleAnalytics( + 'OpenTutorialFromHelpCenter', 'click', explorationId); + }, + // Metrics for exiting the tutorial + registerSkipTutorialEvent: function(explorationId) { + _sendEventToGoogleAnalytics( + 'SkipTutorial', 'click', explorationId); + }, + registerFinishTutorialEvent: function(explorationId) { + _sendEventToGoogleAnalytics( + 'FinishTutorial', 'click', explorationId); + }, + // Metrics for first time editor use + registerEditorFirstEntryEvent: function(explorationId) { + _sendEventToGoogleAnalytics( + 'FirstEnterEditor', 'open', explorationId); + }, + registerFirstOpenContentBoxEvent: function(explorationId) { + _sendEventToGoogleAnalytics( + 'FirstOpenContentBox', 'open', explorationId); + }, + registerFirstSaveContentEvent: function(explorationId) { + _sendEventToGoogleAnalytics( + 'FirstSaveContent', 'click', explorationId); + }, + registerFirstClickAddInteractionEvent: function(explorationId) { + _sendEventToGoogleAnalytics( + 'FirstClickAddInteraction', 'click', explorationId); + }, + registerFirstSelectInteractionTypeEvent: function(explorationId) { + _sendEventToGoogleAnalytics( + 'FirstSelectInteractionType', 'click', explorationId); + }, + registerFirstSaveInteractionEvent: function(explorationId) { + _sendEventToGoogleAnalytics( + 'FirstSaveInteraction', 'click', explorationId); + }, + registerFirstSaveRuleEvent: function(explorationId) { + _sendEventToGoogleAnalytics( + 'FirstSaveRule', 'click', explorationId); + }, + registerFirstCreateSecondStateEvent: function(explorationId) { + _sendEventToGoogleAnalytics( + 'FirstCreateSecondState', 'create', explorationId); + }, + // Metrics for publishing explorations + registerSavePlayableExplorationEvent: function(explorationId) { + _sendEventToGoogleAnalytics( + 'SavePlayableExploration', 'save', explorationId); + }, + registerOpenPublishExplorationModalEvent: function(explorationId) { + _sendEventToGoogleAnalytics( + 'PublishExplorationModal', 'open', explorationId); + }, + registerPublishExplorationEvent: function(explorationId) { + _sendEventToGoogleAnalytics( + 'PublishExploration', 'click', explorationId); + }, + registerVisitOppiaFromIframeEvent: function(explorationId) { + _sendEventToGoogleAnalytics( + 'VisitOppiaFromIframe', 'click', explorationId); + }, + registerNewCard: function(cardNum) { + if (cardNum <= 10 || cardNum % 10 === 0) { + _sendEventToGoogleAnalytics('PlayerNewCard', 'click', cardNum); + } + }, + registerFinishExploration: function() { + _sendEventToGoogleAnalytics('PlayerFinishExploration', 'click', ''); + }, + registerOpenCollectionFromLandingPageEvent: function(collectionId) { + _sendEventToGoogleAnalytics( + 'OpenFractionsFromLandingPage', 'click', collectionId); + }, + registerStewardsLandingPageEvent: function(viewerType, buttonText) { + _sendEventToGoogleAnalytics( + 'ClickButtonOnStewardsPage', 'click', viewerType + ':' + buttonText); + }, + registerSaveRecordedAudioEvent: function(explorationId) { + _sendEventToGoogleAnalytics( + 'SaveRecordedAudio', 'click', explorationId); + }, + registerStartAudioRecordingEvent: function(explorationId) { + _sendEventToGoogleAnalytics( + 'StartAudioRecording', 'click', explorationId); + }, + registerUploadAudioEvent: function(explorationId) { + _sendEventToGoogleAnalytics( + 'UploadRecordedAudio', 'click', explorationId); + }, + }; + }]); diff --git a/core/templates/dev/head/services/SpeechSynthesisChunkerService.ts b/core/templates/dev/head/services/SpeechSynthesisChunkerService.ts index c725f96a0773..cbeb5a7ee891 100644 --- a/core/templates/dev/head/services/SpeechSynthesisChunkerService.ts +++ b/core/templates/dev/head/services/SpeechSynthesisChunkerService.ts @@ -23,9 +23,7 @@ * Credits to Peter Woolley and Brett Zamir. */ -var oppia = require('AppInit.ts').module; - -oppia.factory('SpeechSynthesisChunkerService', [ +angular.module('oppia').factory('SpeechSynthesisChunkerService', [ '$timeout', 'RTE_COMPONENT_SPECS', function($timeout, RTE_COMPONENT_SPECS) { // Max number of characters to fit into one chunk. var CHUNK_LENGTH = 160; diff --git a/core/templates/dev/head/services/StateRulesStatsService.ts b/core/templates/dev/head/services/StateRulesStatsService.ts index dbbde2bf9c21..683e61643e53 100644 --- a/core/templates/dev/head/services/StateRulesStatsService.ts +++ b/core/templates/dev/head/services/StateRulesStatsService.ts @@ -16,16 +16,12 @@ * @fileoverview Factory for calculating the statistics of a particular state. */ -var oppia = require('AppInit.ts').module; - -oppia.factory('StateRulesStatsService', [ +angular.module('oppia').factory('StateRulesStatsService', [ '$http', '$injector', '$q', 'AngularNameService', 'AnswerClassificationService', 'ContextService', 'FractionObjectFactory', - 'UrlInterpolationService', function( $http, $injector, $q, AngularNameService, - AnswerClassificationService, ContextService, FractionObjectFactory, - UrlInterpolationService) { + AnswerClassificationService, ContextService, FractionObjectFactory) { return { /** * TODO(brianrodri): Consider moving this into a visualization domain diff --git a/core/templates/dev/head/services/StateTopAnswersStatsBackendApiService.ts b/core/templates/dev/head/services/StateTopAnswersStatsBackendApiService.ts index dc6df08e1682..0047d09eec26 100644 --- a/core/templates/dev/head/services/StateTopAnswersStatsBackendApiService.ts +++ b/core/templates/dev/head/services/StateTopAnswersStatsBackendApiService.ts @@ -18,9 +18,7 @@ require('services/services.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('StateTopAnswersStatsBackendApiService', [ +angular.module('oppia').factory('StateTopAnswersStatsBackendApiService', [ '$http', 'UrlInterpolationService', 'STATE_ANSWER_STATS_URL', function($http, UrlInterpolationService, STATE_ANSWER_STATS_URL) { return { diff --git a/core/templates/dev/head/services/StateTopAnswersStatsService.ts b/core/templates/dev/head/services/StateTopAnswersStatsService.ts index 252834d9f92d..05bbc0f5c6f7 100644 --- a/core/templates/dev/head/services/StateTopAnswersStatsService.ts +++ b/core/templates/dev/head/services/StateTopAnswersStatsService.ts @@ -24,14 +24,12 @@ require( 'pages/exploration-player-page/services/answer-classification.service.ts'); require('services/ContextService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('StateTopAnswersStatsService', [ +angular.module('oppia').factory('StateTopAnswersStatsService', [ '$injector', 'AngularNameService', 'AnswerClassificationService', - 'AnswerStatsObjectFactory', 'ContextService', 'ExplorationStatesService', + 'AnswerStatsObjectFactory', 'ExplorationStatesService', function( $injector, AngularNameService, AnswerClassificationService, - AnswerStatsObjectFactory, ContextService, ExplorationStatesService) { + AnswerStatsObjectFactory, ExplorationStatesService) { /** * A collection of answers associated to a specific interaction id. * @typedef {Object} AnswerStatsCache diff --git a/core/templates/dev/head/services/SuggestionModalService.ts b/core/templates/dev/head/services/SuggestionModalService.ts index a75fab6e4a62..a14100b8a4b6 100644 --- a/core/templates/dev/head/services/SuggestionModalService.ts +++ b/core/templates/dev/head/services/SuggestionModalService.ts @@ -68,7 +68,5 @@ export class SuggestionModalService { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'SuggestionModalService', downgradeInjectable(SuggestionModalService)); diff --git a/core/templates/dev/head/services/TranslationFileHashLoaderService.ts b/core/templates/dev/head/services/TranslationFileHashLoaderService.ts index a8341204d5ff..c1fc37d0898b 100755 --- a/core/templates/dev/head/services/TranslationFileHashLoaderService.ts +++ b/core/templates/dev/head/services/TranslationFileHashLoaderService.ts @@ -16,9 +16,9 @@ * @fileoverview Service to load the i18n translation file. */ -var oppia = require('AppInit.ts').module; +require('domain/utilities/UrlInterpolationService.ts'); -oppia.factory('TranslationFileHashLoaderService', [ +angular.module('oppia').factory('TranslationFileHashLoaderService', [ '$http', '$q', 'UrlInterpolationService', function($http, $q, UrlInterpolationService) { /* Options object contains: diff --git a/core/templates/dev/head/services/UserService.ts b/core/templates/dev/head/services/UserService.ts index 99018501e51c..c3c53ba34dac 100644 --- a/core/templates/dev/head/services/UserService.ts +++ b/core/templates/dev/head/services/UserService.ts @@ -19,9 +19,7 @@ require('services/contextual/UrlService.ts'); * @fileoverview Service for user data. */ -var oppia = require('AppInit.ts').module; - -oppia.factory('UserService', [ +angular.module('oppia').factory('UserService', [ '$http', '$q', '$window', 'UrlInterpolationService', 'UrlService', 'UserInfoObjectFactory', 'DEFAULT_PROFILE_IMAGE_PATH', function($http, $q, $window, UrlInterpolationService, UrlService, diff --git a/core/templates/dev/head/services/UtilsService.ts b/core/templates/dev/head/services/UtilsService.ts index b75b2175ab6b..6f6e6601f2fa 100644 --- a/core/templates/dev/head/services/UtilsService.ts +++ b/core/templates/dev/head/services/UtilsService.ts @@ -17,9 +17,7 @@ * used at multiple places in the codebase. */ -var oppia = require('AppInit.ts').module; - -oppia.factory('UtilsService', [function() { +angular.module('oppia').factory('UtilsService', [function() { var utils = { isEmpty: function(obj) { for (var property in obj) { diff --git a/core/templates/dev/head/services/ValidatorsService.ts b/core/templates/dev/head/services/ValidatorsService.ts index 586b7f7d1691..b7f0795abecd 100644 --- a/core/templates/dev/head/services/ValidatorsService.ts +++ b/core/templates/dev/head/services/ValidatorsService.ts @@ -19,9 +19,7 @@ require('filters/string-utility-filters/normalize-whitespace.filter.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ValidatorsService', [ +angular.module('oppia').factory('ValidatorsService', [ '$filter', 'AlertsService', 'INVALID_NAME_CHARS', function($filter, AlertsService, INVALID_NAME_CHARS) { return { diff --git a/core/templates/dev/head/services/contextual/DeviceInfoService.ts b/core/templates/dev/head/services/contextual/DeviceInfoService.ts index da678b8b08ab..4c776f134dea 100644 --- a/core/templates/dev/head/services/contextual/DeviceInfoService.ts +++ b/core/templates/dev/head/services/contextual/DeviceInfoService.ts @@ -17,24 +17,23 @@ */ // See: https://stackoverflow.com/a/11381730 -var oppia = require('AppInit.ts').module; - -oppia.factory('DeviceInfoService', ['$window', function($window) { - return { - isMobileDevice: function() { - return Boolean(navigator.userAgent.match(/Android/i) || - navigator.userAgent.match(/webOS/i) || - navigator.userAgent.match(/iPhone/i) || - navigator.userAgent.match(/iPad/i) || - navigator.userAgent.match(/iPod/i) || - navigator.userAgent.match(/BlackBerry/i) || - navigator.userAgent.match(/Windows Phone/i)); - }, - isMobileUserAgent: function() { - return /Mobi/.test(navigator.userAgent); - }, - hasTouchEvents: function() { - return 'ontouchstart' in $window; - } - }; -}]); +angular.module('oppia').factory('DeviceInfoService', [ + '$window', function($window) { + return { + isMobileDevice: function() { + return Boolean(navigator.userAgent.match(/Android/i) || + navigator.userAgent.match(/webOS/i) || + navigator.userAgent.match(/iPhone/i) || + navigator.userAgent.match(/iPad/i) || + navigator.userAgent.match(/iPod/i) || + navigator.userAgent.match(/BlackBerry/i) || + navigator.userAgent.match(/Windows Phone/i)); + }, + isMobileUserAgent: function() { + return /Mobi/.test(navigator.userAgent); + }, + hasTouchEvents: function() { + return 'ontouchstart' in $window; + } + }; + }]); diff --git a/core/templates/dev/head/services/contextual/UrlService.ts b/core/templates/dev/head/services/contextual/UrlService.ts index 7c80d74ae03b..f3885420d76a 100644 --- a/core/templates/dev/head/services/contextual/UrlService.ts +++ b/core/templates/dev/head/services/contextual/UrlService.ts @@ -17,9 +17,7 @@ * functions on $window to be mocked in unit tests. */ -var oppia = require('AppInit.ts').module; - -oppia.factory('UrlService', ['$window', function($window) { +angular.module('oppia').factory('UrlService', ['$window', function($window) { return { // This function is for testing purposes (to mock $window.location) getCurrentLocation: function() { diff --git a/core/templates/dev/head/services/contextual/WindowDimensionsService.ts b/core/templates/dev/head/services/contextual/WindowDimensionsService.ts index 5740d16683b3..b99ca9ad3a41 100644 --- a/core/templates/dev/head/services/contextual/WindowDimensionsService.ts +++ b/core/templates/dev/head/services/contextual/WindowDimensionsService.ts @@ -16,27 +16,26 @@ * @fileoverview Service for computing the window dimensions. */ -var oppia = require('AppInit.ts').module; - -oppia.factory('WindowDimensionsService', ['$window', function($window) { - var onResizeHooks = []; - angular.element($window).bind('resize', function() { - onResizeHooks.forEach(function(hookFn) { - hookFn(); +angular.module('oppia').factory('WindowDimensionsService', [ + '$window', function($window) { + var onResizeHooks = []; + angular.element($window).bind('resize', function() { + onResizeHooks.forEach(function(hookFn) { + hookFn(); + }); }); - }); - return { - getWidth: function() { - return ( - $window.innerWidth || document.documentElement.clientWidth || - document.body.clientWidth); - }, - registerOnResizeHook: function(hookFn) { - onResizeHooks.push(hookFn); - }, - isWindowNarrow: function() { - var NORMAL_NAVBAR_CUTOFF_WIDTH_PX = 768; - return this.getWidth() <= NORMAL_NAVBAR_CUTOFF_WIDTH_PX; - } - }; -}]); + return { + getWidth: function() { + return ( + $window.innerWidth || document.documentElement.clientWidth || + document.body.clientWidth); + }, + registerOnResizeHook: function(hookFn) { + onResizeHooks.push(hookFn); + }, + isWindowNarrow: function() { + var NORMAL_NAVBAR_CUTOFF_WIDTH_PX = 768; + return this.getWidth() <= NORMAL_NAVBAR_CUTOFF_WIDTH_PX; + } + }; + }]); diff --git a/core/templates/dev/head/services/services.constants.ts b/core/templates/dev/head/services/services.constants.ts index 66720e652836..9e8f83fc9b86 100644 --- a/core/templates/dev/head/services/services.constants.ts +++ b/core/templates/dev/head/services/services.constants.ts @@ -16,9 +16,7 @@ * @fileoverview Constants for shared services across Oppia. */ -var oppia = require('AppInit.ts').module; - -oppia.constant('PAGE_CONTEXT', { +angular.module('oppia').constant('PAGE_CONTEXT', { EXPLORATION_EDITOR: 'editor', EXPLORATION_PLAYER: 'learner', QUESTION_EDITOR: 'question_editor', @@ -26,45 +24,45 @@ oppia.constant('PAGE_CONTEXT', { OTHER: 'other' }); -oppia.constant('EXPLORATION_EDITOR_TAB_CONTEXT', { +angular.module('oppia').constant('EXPLORATION_EDITOR_TAB_CONTEXT', { EDITOR: 'editor', PREVIEW: 'preview' }); -oppia.constant( +angular.module('oppia').constant( 'EXPLORATION_FEATURES_URL', '/explorehandler/features/'); -oppia.constant( +angular.module('oppia').constant( 'FETCH_ISSUES_URL', '/issuesdatahandler/'); -oppia.constant( +angular.module('oppia').constant( 'FETCH_PLAYTHROUGH_URL', '/playthroughdatahandler//'); -oppia.constant( +angular.module('oppia').constant( 'RESOLVE_ISSUE_URL', '/resolveissuehandler/'); -oppia.constant( +angular.module('oppia').constant( 'STORE_PLAYTHROUGH_URL', '/explorehandler/store_playthrough/'); // Enables recording playthroughs from learner sessions. -oppia.constant('EARLY_QUIT_THRESHOLD_IN_SECS', 45); -oppia.constant('NUM_INCORRECT_ANSWERS_THRESHOLD', 3); -oppia.constant('NUM_REPEATED_CYCLES_THRESHOLD', 3); -oppia.constant('CURRENT_ACTION_SCHEMA_VERSION', 1); -oppia.constant('CURRENT_ISSUE_SCHEMA_VERSION', 1); +angular.module('oppia').constant('EARLY_QUIT_THRESHOLD_IN_SECS', 45); +angular.module('oppia').constant('NUM_INCORRECT_ANSWERS_THRESHOLD', 3); +angular.module('oppia').constant('NUM_REPEATED_CYCLES_THRESHOLD', 3); +angular.module('oppia').constant('CURRENT_ACTION_SCHEMA_VERSION', 1); +angular.module('oppia').constant('CURRENT_ISSUE_SCHEMA_VERSION', 1); // Whether to enable the promo bar functionality. This does not actually turn on // the promo bar, as that is gated by a config value (see config_domain). This // merely avoids checking for whether the promo bar is enabled for every Oppia // page visited. -oppia.constant('ENABLE_PROMO_BAR', true); +angular.module('oppia').constant('ENABLE_PROMO_BAR', true); -oppia.constant('RTE_COMPONENT_SPECS', richTextComponents); +angular.module('oppia').constant('RTE_COMPONENT_SPECS', richTextComponents); -oppia.constant('SEARCH_DATA_URL', '/searchhandler/data'); +angular.module('oppia').constant('SEARCH_DATA_URL', '/searchhandler/data'); -oppia.constant( +angular.module('oppia').constant( 'STATE_ANSWER_STATS_URL', '/createhandler/state_answer_stats/'); diff --git a/core/templates/dev/head/services/stateful/BackgroundMaskService.ts b/core/templates/dev/head/services/stateful/BackgroundMaskService.ts index afe09bb61333..42c6777ad9db 100644 --- a/core/templates/dev/head/services/stateful/BackgroundMaskService.ts +++ b/core/templates/dev/head/services/stateful/BackgroundMaskService.ts @@ -17,9 +17,7 @@ * visible. */ -var oppia = require('AppInit.ts').module; - -oppia.factory('BackgroundMaskService', [ +angular.module('oppia').factory('BackgroundMaskService', [ function() { var maskIsActive = false; diff --git a/core/templates/dev/head/services/stateful/FocusManagerService.ts b/core/templates/dev/head/services/stateful/FocusManagerService.ts index 502a7fab9050..98f890a58182 100644 --- a/core/templates/dev/head/services/stateful/FocusManagerService.ts +++ b/core/templates/dev/head/services/stateful/FocusManagerService.ts @@ -20,9 +20,7 @@ * page. */ -var oppia = require('AppInit.ts').module; - -oppia.factory('FocusManagerService', [ +angular.module('oppia').factory('FocusManagerService', [ '$rootScope', '$timeout', 'DeviceInfoService', 'IdGenerationService', 'LABEL_FOR_CLEARING_FOCUS', function( diff --git a/core/templates/dev/head/tests/FormBuilderTestPage.ts b/core/templates/dev/head/tests/FormBuilderTestPage.ts index 7f643f39dcd2..875679e6687a 100644 --- a/core/templates/dev/head/tests/FormBuilderTestPage.ts +++ b/core/templates/dev/head/tests/FormBuilderTestPage.ts @@ -18,9 +18,7 @@ require('App.ts'); -var oppia = require('AppInit.ts').module; - -oppia.controller('FormBuilderTestPage', [ +angular.module('oppia').controller('FormBuilderTestPage', [ '$scope', function($scope) { $scope.testText = 'abc{{paramUnicode1}}'; diff --git a/core/templates/dev/head/tests/FormOverlayDirective.ts b/core/templates/dev/head/tests/FormOverlayDirective.ts index 43a4991eb920..59f989b69205 100644 --- a/core/templates/dev/head/tests/FormOverlayDirective.ts +++ b/core/templates/dev/head/tests/FormOverlayDirective.ts @@ -18,9 +18,7 @@ require('App.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('formOverlay', [ +angular.module('oppia').directive('formOverlay', [ 'NestedDirectivesRecursionTimeoutPreventionService', 'UrlInterpolationService', function( diff --git a/core/tests/build_sources/templates/pages/Base.ts b/core/tests/build_sources/templates/pages/Base.ts index 375d41ac7420..dc1ab74acad6 100644 --- a/core/tests/build_sources/templates/pages/Base.ts +++ b/core/tests/build_sources/templates/pages/Base.ts @@ -16,7 +16,7 @@ * @fileoverview Oppia's base controller. */ -oppia.controller('Base', [ +angular.module('oppia').controller('Base', [ '$scope', '$rootScope', '$document', 'AlertsService', 'BackgroundMaskService', 'SidebarStatusService', 'UrlService', 'SITE_FEEDBACK_FORM_URL', 'SITE_NAME', function($scope, $rootScope, $document, AlertsService, BackgroundMaskService, diff --git a/core/tests/karma.conf.ts b/core/tests/karma.conf.ts index 2556aff668b6..e7dda59b3019 100644 --- a/core/tests/karma.conf.ts +++ b/core/tests/karma.conf.ts @@ -34,6 +34,7 @@ module.exports = function(config) { 'core/templates/dev/head/**/*.directive.html', 'core/templates/dev/head/**/*.template.html', 'local_compiled_js/extensions/**/*.js', + 'core/templates/dev/head/AppInit.ts', // This is a file that is generated on running the run_frontend_tests.sh // script. This generated file is a combination of all the spec files // since Karma is unable to run tests on multiple files due to some diff --git a/extensions/classifiers/CountVectorizerService.ts b/extensions/classifiers/CountVectorizerService.ts index 40c576fbdea4..fdc28d7b0081 100644 --- a/extensions/classifiers/CountVectorizerService.ts +++ b/extensions/classifiers/CountVectorizerService.ts @@ -23,9 +23,7 @@ * propagated here. */ -var oppia = require('AppInit.ts').module; - -oppia.factory('CountVectorizerService', [function() { +angular.module('oppia').factory('CountVectorizerService', [function() { return { vectorize: function(tokens, vocabulary) { var vectorLength = Object.keys(vocabulary).length; diff --git a/extensions/classifiers/PythonProgramTokenizer.ts b/extensions/classifiers/PythonProgramTokenizer.ts index 36ee98eecf54..3fd21eff1227 100644 --- a/extensions/classifiers/PythonProgramTokenizer.ts +++ b/extensions/classifiers/PythonProgramTokenizer.ts @@ -28,9 +28,7 @@ require('classifiers/classifiers-extension.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('PythonProgramTokenizer', [ +angular.module('oppia').factory('PythonProgramTokenizer', [ '$log', 'PythonProgramTokenType', function($log, PythonProgramTokenType) { var groupOfRegEx = function(...params) { return '(' + Array.prototype.join.call(params, '|') + ')'; diff --git a/extensions/classifiers/SVMPredictionService.ts b/extensions/classifiers/SVMPredictionService.ts index abd4113121b5..a29ccc9e3b58 100644 --- a/extensions/classifiers/SVMPredictionService.ts +++ b/extensions/classifiers/SVMPredictionService.ts @@ -28,9 +28,7 @@ require('domain/classifier/PredictionResultObjectFactory.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('SVMPredictionService', [ +angular.module('oppia').factory('SVMPredictionService', [ '$log', 'PredictionResultObjectFactory', function($log, PredictionResultObjectFactory) { return { diff --git a/extensions/classifiers/TextInputTokenizer.ts b/extensions/classifiers/TextInputTokenizer.ts index d866f67bc054..80d5ff8026ff 100644 --- a/extensions/classifiers/TextInputTokenizer.ts +++ b/extensions/classifiers/TextInputTokenizer.ts @@ -26,9 +26,7 @@ */ // TODO(anmol): Add functionality to add n_grams, remove stop words. -var oppia = require('AppInit.ts').module; - -oppia.factory('TextInputTokenizer', [function() { +angular.module('oppia').factory('TextInputTokenizer', [function() { return { generateTokens: function(textInput) { var tokenizedTextInput; diff --git a/extensions/classifiers/WinnowingPreprocessingService.ts b/extensions/classifiers/WinnowingPreprocessingService.ts index 957fb9c0d51f..c68d2c45daa5 100644 --- a/extensions/classifiers/WinnowingPreprocessingService.ts +++ b/extensions/classifiers/WinnowingPreprocessingService.ts @@ -79,8 +79,6 @@ export class WinnowingPreprocessingService { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'WinnowingPreprocessingService', downgradeInjectable(WinnowingPreprocessingService)); diff --git a/extensions/classifiers/classifiers-extension.constants.ts b/extensions/classifiers/classifiers-extension.constants.ts index d67c006d5776..0b6668b83b8a 100644 --- a/extensions/classifiers/classifiers-extension.constants.ts +++ b/extensions/classifiers/classifiers-extension.constants.ts @@ -16,9 +16,7 @@ * @fileoverview Constants for classfiers extensions. */ -var oppia = require('AppInit.ts').module; - -oppia.constant('PythonProgramTokenType', { +angular.module('oppia').constant('PythonProgramTokenType', { COMMENT: 'COMMENT', NL: 'NL', STRING: 'STRING', diff --git a/extensions/interactions/CodeRepl/CodeReplPredictionService.ts b/extensions/interactions/CodeRepl/CodeReplPredictionService.ts index 216cea6c14ff..34844a58aa97 100644 --- a/extensions/interactions/CodeRepl/CodeReplPredictionService.ts +++ b/extensions/interactions/CodeRepl/CodeReplPredictionService.ts @@ -28,9 +28,7 @@ require('classifiers/WinnowingPreprocessingService.ts'); require('interactions/interactions-extension.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('CodeReplPredictionService', [ +angular.module('oppia').factory('CodeReplPredictionService', [ 'CountVectorizerService', 'PythonProgramTokenType', 'PythonProgramTokenizer', 'SVMPredictionService', 'WinnowingPreprocessingService', diff --git a/extensions/interactions/CodeRepl/directives/CodeReplRulesService.ts b/extensions/interactions/CodeRepl/directives/CodeReplRulesService.ts index 455ecc976b5e..a1505700bd62 100644 --- a/extensions/interactions/CodeRepl/directives/CodeReplRulesService.ts +++ b/extensions/interactions/CodeRepl/directives/CodeReplRulesService.ts @@ -19,9 +19,7 @@ require('filters/string-utility-filters/normalize-whitespace.filter.ts'); require('services/CodeNormalizerService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('CodeReplRulesService', [ +angular.module('oppia').factory('CodeReplRulesService', [ '$filter', 'CodeNormalizerService', function($filter, CodeNormalizerService) { return { diff --git a/extensions/interactions/CodeRepl/directives/CodeReplValidationService.ts b/extensions/interactions/CodeRepl/directives/CodeReplValidationService.ts index 9b98a81271de..f14559a0f3cd 100644 --- a/extensions/interactions/CodeRepl/directives/CodeReplValidationService.ts +++ b/extensions/interactions/CodeRepl/directives/CodeReplValidationService.ts @@ -18,9 +18,7 @@ require('interactions/baseInteractionValidationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('CodeReplValidationService', [ +angular.module('oppia').factory('CodeReplValidationService', [ 'baseInteractionValidationService', 'WARNING_TYPES', function(baseInteractionValidationService, WARNING_TYPES) { return { diff --git a/extensions/interactions/CodeRepl/directives/OppiaInteractiveCodeReplDirective.ts b/extensions/interactions/CodeRepl/directives/OppiaInteractiveCodeReplDirective.ts index de80fd3e0f24..3098303bb3cf 100644 --- a/extensions/interactions/CodeRepl/directives/OppiaInteractiveCodeReplDirective.ts +++ b/extensions/interactions/CodeRepl/directives/OppiaInteractiveCodeReplDirective.ts @@ -27,9 +27,7 @@ require( require('services/HtmlEscaperService.ts'); require('services/contextual/WindowDimensionsService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaInteractiveCodeRepl', [ +angular.module('oppia').directive('oppiaInteractiveCodeRepl', [ 'CodeReplRulesService', 'HtmlEscaperService', 'UrlInterpolationService', 'EVENT_NEW_CARD_AVAILABLE', function( diff --git a/extensions/interactions/CodeRepl/directives/OppiaResponseCodeReplDirective.ts b/extensions/interactions/CodeRepl/directives/OppiaResponseCodeReplDirective.ts index 3c5cb3e3dba7..a9be07dd09d7 100644 --- a/extensions/interactions/CodeRepl/directives/OppiaResponseCodeReplDirective.ts +++ b/extensions/interactions/CodeRepl/directives/OppiaResponseCodeReplDirective.ts @@ -24,9 +24,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/HtmlEscaperService.ts'); require('services/stateful/FocusManagerService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaResponseCodeRepl', [ +angular.module('oppia').directive('oppiaResponseCodeRepl', [ 'HtmlEscaperService', 'UrlInterpolationService', function(HtmlEscaperService, UrlInterpolationService) { return { diff --git a/extensions/interactions/CodeRepl/directives/OppiaShortResponseCodeReplDirective.ts b/extensions/interactions/CodeRepl/directives/OppiaShortResponseCodeReplDirective.ts index 6b227dea99a3..abff5b6e2147 100644 --- a/extensions/interactions/CodeRepl/directives/OppiaShortResponseCodeReplDirective.ts +++ b/extensions/interactions/CodeRepl/directives/OppiaShortResponseCodeReplDirective.ts @@ -25,9 +25,7 @@ require('filters/string-utility-filters/truncate-at-first-line.filter.ts'); require('domain/utilities/UrlInterpolationService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaShortResponseCodeRepl', [ +angular.module('oppia').directive('oppiaShortResponseCodeRepl', [ 'HtmlEscaperService', 'UrlInterpolationService', function(HtmlEscaperService, UrlInterpolationService) { return { diff --git a/extensions/interactions/Continue/directives/ContinueRulesService.ts b/extensions/interactions/Continue/directives/ContinueRulesService.ts index 6c1e9a9fb072..14ada8015c07 100644 --- a/extensions/interactions/Continue/directives/ContinueRulesService.ts +++ b/extensions/interactions/Continue/directives/ContinueRulesService.ts @@ -24,7 +24,5 @@ import { downgradeInjectable } from '@angular/upgrade/static'; }) export class ContinueRulesService {} -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'ContinueRulesService', downgradeInjectable(ContinueRulesService)); diff --git a/extensions/interactions/Continue/directives/ContinueValidationService.ts b/extensions/interactions/Continue/directives/ContinueValidationService.ts index 606246dd4bb5..39e74c5ba5b5 100644 --- a/extensions/interactions/Continue/directives/ContinueValidationService.ts +++ b/extensions/interactions/Continue/directives/ContinueValidationService.ts @@ -18,9 +18,7 @@ require('interactions/baseInteractionValidationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ContinueValidationService', [ +angular.module('oppia').factory('ContinueValidationService', [ 'baseInteractionValidationService', 'WARNING_TYPES', function(baseInteractionValidationService, WARNING_TYPES) { return { diff --git a/extensions/interactions/Continue/directives/OppiaInteractiveContinueDirective.ts b/extensions/interactions/Continue/directives/OppiaInteractiveContinueDirective.ts index 35b1cf443b70..3ea74385b668 100644 --- a/extensions/interactions/Continue/directives/OppiaInteractiveContinueDirective.ts +++ b/extensions/interactions/Continue/directives/OppiaInteractiveContinueDirective.ts @@ -28,9 +28,7 @@ require('services/ContextService.ts'); require('services/HtmlEscaperService.ts'); require('services/contextual/WindowDimensionsService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaInteractiveContinue', [ +angular.module('oppia').directive('oppiaInteractiveContinue', [ 'ContinueRulesService', 'HtmlEscaperService', 'UrlInterpolationService', function(ContinueRulesService, HtmlEscaperService, UrlInterpolationService) { return { diff --git a/extensions/interactions/Continue/directives/OppiaResponseContinueDirective.ts b/extensions/interactions/Continue/directives/OppiaResponseContinueDirective.ts index dd6f02eb306b..09031cc2aed7 100644 --- a/extensions/interactions/Continue/directives/OppiaResponseContinueDirective.ts +++ b/extensions/interactions/Continue/directives/OppiaResponseContinueDirective.ts @@ -23,9 +23,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaResponseContinue', [ +angular.module('oppia').directive('oppiaResponseContinue', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/extensions/interactions/Continue/directives/OppiaShortResponseContinueDirective.ts b/extensions/interactions/Continue/directives/OppiaShortResponseContinueDirective.ts index b563b01f5b5a..ed81fbf5b52c 100644 --- a/extensions/interactions/Continue/directives/OppiaShortResponseContinueDirective.ts +++ b/extensions/interactions/Continue/directives/OppiaShortResponseContinueDirective.ts @@ -23,9 +23,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaShortResponseContinue', [ +angular.module('oppia').directive('oppiaShortResponseContinue', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/extensions/interactions/DragAndDropSortInput/directives/DragAndDropSortInputRulesService.ts b/extensions/interactions/DragAndDropSortInput/directives/DragAndDropSortInputRulesService.ts index 66dc3cee2102..86e83587a21c 100644 --- a/extensions/interactions/DragAndDropSortInput/directives/DragAndDropSortInputRulesService.ts +++ b/extensions/interactions/DragAndDropSortInput/directives/DragAndDropSortInputRulesService.ts @@ -17,69 +17,71 @@ */ // Rules Service for DragAndDropSortInput interaction. -var oppia = require('AppInit.ts').module; - -oppia.factory('DragAndDropSortInputRulesService', [function() { - var checkEquality = function(answer, inputs) { - for (var i = 0; i < answer.length; i++) { - if (answer[i].length === inputs.x[i].length) { - for (var j = 0; j < answer[i].length; j++) { - if (inputs.x[i].indexOf(answer[i][j]) === -1) { - return false; - } - } - } else { - return false; - } - } - return true; - }; - var checkEqualityWithIncorrectPositions = function(answer, inputs) { - var noOfMismatches = 0; - for (var i = 0; i < math.min(inputs.x.length, answer.length); i++) { - for (var j = 0; j < math.max(answer[i].length, inputs.x[i].length); j++) { - if (inputs.x[i].length > answer[i].length) { - if (answer[i].indexOf(inputs.x[i][j]) === -1) { - noOfMismatches += 1; +angular.module('oppia').factory('DragAndDropSortInputRulesService', [ + function() { + var checkEquality = function(answer, inputs) { + for (var i = 0; i < answer.length; i++) { + if (answer[i].length === inputs.x[i].length) { + for (var j = 0; j < answer[i].length; j++) { + if (inputs.x[i].indexOf(answer[i][j]) === -1) { + return false; + } } } else { - if (inputs.x[i].indexOf(answer[i][j]) === -1) { - noOfMismatches += 1; - } + return false; } } - } - return noOfMismatches === 1; - }; - return { - IsEqualToOrdering: function(answer, inputs) { - return answer.length === inputs.x.length && checkEquality(answer, inputs); - }, - IsEqualToOrderingWithOneItemAtIncorrectPosition: function(answer, inputs) { - return checkEqualityWithIncorrectPositions(answer, inputs); - }, - HasElementXAtPositionY: function(answer, inputs) { - for (var i = 0; i < answer.length; i++) { - var index = answer[i].indexOf(inputs.x); - if (index !== -1) { - return ((i + 1) === inputs.y); + return true; + }; + var checkEqualityWithIncorrectPositions = function(answer, inputs) { + var noOfMismatches = 0; + for (var i = 0; i < math.min(inputs.x.length, answer.length); i++) { + for ( + var j = 0; j < math.max(answer[i].length, inputs.x[i].length); j++) { + if (inputs.x[i].length > answer[i].length) { + if (answer[i].indexOf(inputs.x[i][j]) === -1) { + noOfMismatches += 1; + } + } else { + if (inputs.x[i].indexOf(answer[i][j]) === -1) { + noOfMismatches += 1; + } + } } } - }, - HasElementXBeforeElementY: function(answer, inputs) { - var indX = -1; - var indY = -1; - for (var i = 0; i < answer.length; i++) { - var index = answer[i].indexOf(inputs.x); - if (index !== -1) { - indX = i; + return noOfMismatches === 1; + }; + return { + IsEqualToOrdering: function(answer, inputs) { + return answer.length === inputs.x.length && checkEquality( + answer, inputs); + }, + IsEqualToOrderingWithOneItemAtIncorrectPosition: function( + answer, inputs) { + return checkEqualityWithIncorrectPositions(answer, inputs); + }, + HasElementXAtPositionY: function(answer, inputs) { + for (var i = 0; i < answer.length; i++) { + var index = answer[i].indexOf(inputs.x); + if (index !== -1) { + return ((i + 1) === inputs.y); + } } - index = answer[i].indexOf(inputs.y); - if (index !== -1) { - indY = i; + }, + HasElementXBeforeElementY: function(answer, inputs) { + var indX = -1; + var indY = -1; + for (var i = 0; i < answer.length; i++) { + var index = answer[i].indexOf(inputs.x); + if (index !== -1) { + indX = i; + } + index = answer[i].indexOf(inputs.y); + if (index !== -1) { + indY = i; + } } + return indX < indY; } - return indX < indY; - } - }; -}]); + }; + }]); diff --git a/extensions/interactions/DragAndDropSortInput/directives/DragAndDropSortInputValidationService.ts b/extensions/interactions/DragAndDropSortInput/directives/DragAndDropSortInputValidationService.ts index 0460511ddd54..29788436b3d2 100644 --- a/extensions/interactions/DragAndDropSortInput/directives/DragAndDropSortInputValidationService.ts +++ b/extensions/interactions/DragAndDropSortInput/directives/DragAndDropSortInputValidationService.ts @@ -18,9 +18,7 @@ require('interactions/baseInteractionValidationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('DragAndDropSortInputValidationService', [ +angular.module('oppia').factory('DragAndDropSortInputValidationService', [ 'baseInteractionValidationService', 'WARNING_TYPES', function(baseInteractionValidationService, WARNING_TYPES) { return { diff --git a/extensions/interactions/DragAndDropSortInput/directives/OppiaInteractiveDragAndDropSortInputDirective.ts b/extensions/interactions/DragAndDropSortInput/directives/OppiaInteractiveDragAndDropSortInputDirective.ts index f3a9ddfe9707..75a9eb6f1cfa 100644 --- a/extensions/interactions/DragAndDropSortInput/directives/OppiaInteractiveDragAndDropSortInputDirective.ts +++ b/extensions/interactions/DragAndDropSortInput/directives/OppiaInteractiveDragAndDropSortInputDirective.ts @@ -26,9 +26,7 @@ require( require('services/HtmlEscaperService.ts'); require('services/contextual/UrlService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaInteractiveDragAndDropSortInput', [ +angular.module('oppia').directive('oppiaInteractiveDragAndDropSortInput', [ 'DragAndDropSortInputRulesService', 'HtmlEscaperService', 'UrlInterpolationService', function( DragAndDropSortInputRulesService, HtmlEscaperService, diff --git a/extensions/interactions/DragAndDropSortInput/directives/OppiaResponseDragAndDropSortInputDirective.ts b/extensions/interactions/DragAndDropSortInput/directives/OppiaResponseDragAndDropSortInputDirective.ts index 27d6e5733029..e1cee3be6343 100644 --- a/extensions/interactions/DragAndDropSortInput/directives/OppiaResponseDragAndDropSortInputDirective.ts +++ b/extensions/interactions/DragAndDropSortInput/directives/OppiaResponseDragAndDropSortInputDirective.ts @@ -19,9 +19,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaResponseDragAndDropSortInput', [ +angular.module('oppia').directive('oppiaResponseDragAndDropSortInput', [ 'HtmlEscaperService', 'UrlInterpolationService', function(HtmlEscaperService, UrlInterpolationService) { return { diff --git a/extensions/interactions/DragAndDropSortInput/directives/OppiaShortResponseDragAndDropSortInputDirective.ts b/extensions/interactions/DragAndDropSortInput/directives/OppiaShortResponseDragAndDropSortInputDirective.ts index 7d87e3d1b5b7..599cf60b7033 100644 --- a/extensions/interactions/DragAndDropSortInput/directives/OppiaShortResponseDragAndDropSortInputDirective.ts +++ b/extensions/interactions/DragAndDropSortInput/directives/OppiaShortResponseDragAndDropSortInputDirective.ts @@ -19,9 +19,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaShortResponseDragAndDropSortInput', [ +angular.module('oppia').directive('oppiaShortResponseDragAndDropSortInput', [ 'HtmlEscaperService', 'UrlInterpolationService', function(HtmlEscaperService, UrlInterpolationService) { return { diff --git a/extensions/interactions/EndExploration/directives/EndExplorationRulesService.ts b/extensions/interactions/EndExploration/directives/EndExplorationRulesService.ts index 59249d835f25..94d6826c94ac 100644 --- a/extensions/interactions/EndExploration/directives/EndExplorationRulesService.ts +++ b/extensions/interactions/EndExploration/directives/EndExplorationRulesService.ts @@ -24,8 +24,6 @@ import { downgradeInjectable } from '@angular/upgrade/static'; }) export class EndExplorationRulesService {} -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'EndExplorationRulesService', downgradeInjectable(EndExplorationRulesService)); diff --git a/extensions/interactions/EndExploration/directives/EndExplorationValidationService.ts b/extensions/interactions/EndExploration/directives/EndExplorationValidationService.ts index 1143ad9d2d4e..3f3ed5998f46 100644 --- a/extensions/interactions/EndExploration/directives/EndExplorationValidationService.ts +++ b/extensions/interactions/EndExploration/directives/EndExplorationValidationService.ts @@ -18,9 +18,7 @@ require('interactions/baseInteractionValidationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('EndExplorationValidationService', [ +angular.module('oppia').factory('EndExplorationValidationService', [ 'baseInteractionValidationService', 'WARNING_TYPES', function(baseInteractionValidationService, WARNING_TYPES) { return { diff --git a/extensions/interactions/EndExploration/directives/OppiaInteractiveEndExplorationDirective.ts b/extensions/interactions/EndExploration/directives/OppiaInteractiveEndExplorationDirective.ts index 2ad36d0e0bc6..d6b9451ddfcf 100644 --- a/extensions/interactions/EndExploration/directives/OppiaInteractiveEndExplorationDirective.ts +++ b/extensions/interactions/EndExploration/directives/OppiaInteractiveEndExplorationDirective.ts @@ -25,9 +25,7 @@ require('services/ContextService.ts'); require('services/HtmlEscaperService.ts'); require('services/contextual/UrlService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaInteractiveEndExploration', [ +angular.module('oppia').directive('oppiaInteractiveEndExploration', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/extensions/interactions/EndExploration/directives/OppiaResponseEndExplorationDirective.ts b/extensions/interactions/EndExploration/directives/OppiaResponseEndExplorationDirective.ts index 8ad6feafd6b7..938a70fb88a9 100644 --- a/extensions/interactions/EndExploration/directives/OppiaResponseEndExplorationDirective.ts +++ b/extensions/interactions/EndExploration/directives/OppiaResponseEndExplorationDirective.ts @@ -20,9 +20,7 @@ * followed by the name of the arg. */ -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaResponseEndExploration', [function() { +angular.module('oppia').directive('oppiaResponseEndExploration', [function() { return { restrict: 'E', scope: {}, diff --git a/extensions/interactions/EndExploration/directives/OppiaShortResponseEndExplorationDirective.ts b/extensions/interactions/EndExploration/directives/OppiaShortResponseEndExplorationDirective.ts index 0db80a02c665..b12c1e81fb3f 100644 --- a/extensions/interactions/EndExploration/directives/OppiaShortResponseEndExplorationDirective.ts +++ b/extensions/interactions/EndExploration/directives/OppiaShortResponseEndExplorationDirective.ts @@ -20,15 +20,14 @@ * followed by the name of the arg. */ -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaShortResponseEndExploration', [function() { - return { - restrict: 'E', - scope: {}, - bindToController: {}, - template: '', - controllerAs: '$ctrl', - controller: [function() {}] - }; -}]); +angular.module('oppia').directive('oppiaShortResponseEndExploration', [ + function() { + return { + restrict: 'E', + scope: {}, + bindToController: {}, + template: '', + controllerAs: '$ctrl', + controller: [function() {}] + }; + }]); diff --git a/extensions/interactions/FractionInput/directives/FractionInputRulesService.ts b/extensions/interactions/FractionInput/directives/FractionInputRulesService.ts index 08a6b372c038..38b00095ca00 100644 --- a/extensions/interactions/FractionInput/directives/FractionInputRulesService.ts +++ b/extensions/interactions/FractionInput/directives/FractionInputRulesService.ts @@ -18,9 +18,7 @@ require('domain/objects/FractionObjectFactory.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('FractionInputRulesService', [ +angular.module('oppia').factory('FractionInputRulesService', [ 'FractionObjectFactory', function(FractionObjectFactory) { var toFloat = function(fractionDict) { diff --git a/extensions/interactions/FractionInput/directives/FractionInputValidationService.ts b/extensions/interactions/FractionInput/directives/FractionInputValidationService.ts index 012de2b71cb7..87b7e86bd8e6 100644 --- a/extensions/interactions/FractionInput/directives/FractionInputValidationService.ts +++ b/extensions/interactions/FractionInput/directives/FractionInputValidationService.ts @@ -19,9 +19,7 @@ require('domain/objects/FractionObjectFactory.ts'); require('interactions/baseInteractionValidationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('FractionInputValidationService', [ +angular.module('oppia').factory('FractionInputValidationService', [ 'FractionObjectFactory', 'baseInteractionValidationService', 'WARNING_TYPES', function( diff --git a/extensions/interactions/FractionInput/directives/OppiaInteractiveFractionInputDirective.ts b/extensions/interactions/FractionInput/directives/OppiaInteractiveFractionInputDirective.ts index 29c642e79d8b..d40a10a79ca1 100644 --- a/extensions/interactions/FractionInput/directives/OppiaInteractiveFractionInputDirective.ts +++ b/extensions/interactions/FractionInput/directives/OppiaInteractiveFractionInputDirective.ts @@ -25,9 +25,7 @@ require('services/HtmlEscaperService.ts'); require('services/contextual/WindowDimensionsService.ts'); require('services/stateful/FocusManagerService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaInteractiveFractionInput', [ +angular.module('oppia').directive('oppiaInteractiveFractionInput', [ 'HtmlEscaperService', 'UrlInterpolationService', function(HtmlEscaperService, UrlInterpolationService) { return { diff --git a/extensions/interactions/FractionInput/directives/OppiaResponseFractionInputDirective.ts b/extensions/interactions/FractionInput/directives/OppiaResponseFractionInputDirective.ts index f934f3975ef8..0168e0295dc6 100644 --- a/extensions/interactions/FractionInput/directives/OppiaResponseFractionInputDirective.ts +++ b/extensions/interactions/FractionInput/directives/OppiaResponseFractionInputDirective.ts @@ -20,9 +20,7 @@ require('domain/objects/FractionObjectFactory.ts'); require('domain/utilities/UrlInterpolationService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaResponseFractionInput', [ +angular.module('oppia').directive('oppiaResponseFractionInput', [ 'FractionObjectFactory', 'HtmlEscaperService', 'UrlInterpolationService', function( FractionObjectFactory, HtmlEscaperService, UrlInterpolationService) { diff --git a/extensions/interactions/FractionInput/directives/OppiaShortResponseFractionInputDirective.ts b/extensions/interactions/FractionInput/directives/OppiaShortResponseFractionInputDirective.ts index a340dd9eb2a7..10c952cdeabe 100644 --- a/extensions/interactions/FractionInput/directives/OppiaShortResponseFractionInputDirective.ts +++ b/extensions/interactions/FractionInput/directives/OppiaShortResponseFractionInputDirective.ts @@ -20,9 +20,7 @@ require('domain/objects/FractionObjectFactory.ts'); require('domain/utilities/UrlInterpolationService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaShortResponseFractionInput', [ +angular.module('oppia').directive('oppiaShortResponseFractionInput', [ 'FractionObjectFactory', 'HtmlEscaperService', 'UrlInterpolationService', function( FractionObjectFactory, HtmlEscaperService, UrlInterpolationService) { diff --git a/extensions/interactions/GraphInput/directives/GraphDetailService.ts b/extensions/interactions/GraphInput/directives/GraphDetailService.ts index 21e450f13383..93e685ea3555 100644 --- a/extensions/interactions/GraphInput/directives/GraphDetailService.ts +++ b/extensions/interactions/GraphInput/directives/GraphDetailService.ts @@ -81,6 +81,5 @@ export class GraphDetailService { } } -var oppia = require('AppInit.ts').module; - -oppia.factory('GraphDetailService', downgradeInjectable(GraphDetailService)); +angular.module('oppia').factory( + 'GraphDetailService', downgradeInjectable(GraphDetailService)); diff --git a/extensions/interactions/GraphInput/directives/GraphInputRulesService.ts b/extensions/interactions/GraphInput/directives/GraphInputRulesService.ts index 48e446010e49..84467f77abef 100644 --- a/extensions/interactions/GraphInput/directives/GraphInputRulesService.ts +++ b/extensions/interactions/GraphInput/directives/GraphInputRulesService.ts @@ -18,9 +18,7 @@ require('interactions/GraphInput/directives/GraphUtilsService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('GraphInputRulesService', [ +angular.module('oppia').factory('GraphInputRulesService', [ 'GraphUtilsService', function(GraphUtilsService) { /** * @param {object} graph - A graph object. diff --git a/extensions/interactions/GraphInput/directives/GraphInputValidationService.ts b/extensions/interactions/GraphInput/directives/GraphInputValidationService.ts index 0c35d1672327..7ba97babfc34 100644 --- a/extensions/interactions/GraphInput/directives/GraphInputValidationService.ts +++ b/extensions/interactions/GraphInput/directives/GraphInputValidationService.ts @@ -18,9 +18,7 @@ require('interactions/baseInteractionValidationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('GraphInputValidationService', [ +angular.module('oppia').factory('GraphInputValidationService', [ 'baseInteractionValidationService', 'WARNING_TYPES', function(baseInteractionValidationService, WARNING_TYPES) { var VERTICES_LIMIT = 50; diff --git a/extensions/interactions/GraphInput/directives/GraphUtilsService.ts b/extensions/interactions/GraphInput/directives/GraphUtilsService.ts index c97e18cc385e..62378bf239ce 100644 --- a/extensions/interactions/GraphInput/directives/GraphUtilsService.ts +++ b/extensions/interactions/GraphInput/directives/GraphUtilsService.ts @@ -194,6 +194,5 @@ export class GraphUtilsService { } } -var oppia = require('AppInit.ts').module; - -oppia.factory('GraphUtilsService', downgradeInjectable(GraphUtilsService)); +angular.module('oppia').factory( + 'GraphUtilsService', downgradeInjectable(GraphUtilsService)); diff --git a/extensions/interactions/GraphInput/directives/GraphVizDirective.ts b/extensions/interactions/GraphInput/directives/GraphVizDirective.ts index d3ee988d6f80..e8b9b14935ff 100644 --- a/extensions/interactions/GraphInput/directives/GraphVizDirective.ts +++ b/extensions/interactions/GraphInput/directives/GraphVizDirective.ts @@ -27,9 +27,7 @@ require('services/stateful/FocusManagerService.ts'); require('interactions/interactions-extension.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('graphViz', [ +angular.module('oppia').directive('graphViz', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/extensions/interactions/GraphInput/directives/OppiaInteractiveGraphInputDirective.ts b/extensions/interactions/GraphInput/directives/OppiaInteractiveGraphInputDirective.ts index 4664cc68a94c..bb7289f5725e 100644 --- a/extensions/interactions/GraphInput/directives/OppiaInteractiveGraphInputDirective.ts +++ b/extensions/interactions/GraphInput/directives/OppiaInteractiveGraphInputDirective.ts @@ -30,14 +30,12 @@ require('services/HtmlEscaperService.ts'); require('services/contextual/UrlService.ts'); require('services/contextual/WindowDimensionsService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaInteractiveGraphInput', [ +angular.module('oppia').directive('oppiaInteractiveGraphInput', [ 'GraphInputRulesService', 'HtmlEscaperService', 'UrlInterpolationService', - 'UrlService', 'EVENT_NEW_CARD_AVAILABLE', + 'EVENT_NEW_CARD_AVAILABLE', function( GraphInputRulesService, HtmlEscaperService, UrlInterpolationService, - UrlService, EVENT_NEW_CARD_AVAILABLE) { + EVENT_NEW_CARD_AVAILABLE) { return { restrict: 'E', scope: {}, diff --git a/extensions/interactions/GraphInput/directives/OppiaResponseGraphInputDirective.ts b/extensions/interactions/GraphInput/directives/OppiaResponseGraphInputDirective.ts index 21a25cbab302..ee5dcd2107c1 100644 --- a/extensions/interactions/GraphInput/directives/OppiaResponseGraphInputDirective.ts +++ b/extensions/interactions/GraphInput/directives/OppiaResponseGraphInputDirective.ts @@ -26,9 +26,7 @@ require('services/HtmlEscaperService.ts'); require('interactions/interactions-extension.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaResponseGraphInput', [ +angular.module('oppia').directive('oppiaResponseGraphInput', [ 'GraphDetailService', 'HtmlEscaperService', 'UrlInterpolationService', 'GRAPH_INPUT_LEFT_MARGIN', function( diff --git a/extensions/interactions/GraphInput/directives/OppiaShortResponseGraphInputDirective.ts b/extensions/interactions/GraphInput/directives/OppiaShortResponseGraphInputDirective.ts index fd604de526cf..fd90e17246e9 100644 --- a/extensions/interactions/GraphInput/directives/OppiaShortResponseGraphInputDirective.ts +++ b/extensions/interactions/GraphInput/directives/OppiaShortResponseGraphInputDirective.ts @@ -23,9 +23,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaShortResponseGraphInput', [ +angular.module('oppia').directive('oppiaShortResponseGraphInput', [ 'HtmlEscaperService', 'UrlInterpolationService', function(HtmlEscaperService, UrlInterpolationService) { return { diff --git a/extensions/interactions/ImageClickInput/directives/ImageClickInputRulesService.ts b/extensions/interactions/ImageClickInput/directives/ImageClickInputRulesService.ts index 5d7119e41ac2..272164851dd2 100644 --- a/extensions/interactions/ImageClickInput/directives/ImageClickInputRulesService.ts +++ b/extensions/interactions/ImageClickInput/directives/ImageClickInputRulesService.ts @@ -31,8 +31,6 @@ export class ImageClickInputRulesService { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'ImageClickInputRulesService', downgradeInjectable(ImageClickInputRulesService)); diff --git a/extensions/interactions/ImageClickInput/directives/ImageClickInputValidationService.ts b/extensions/interactions/ImageClickInput/directives/ImageClickInputValidationService.ts index 938c1f7dd683..ceef38b94f41 100644 --- a/extensions/interactions/ImageClickInput/directives/ImageClickInputValidationService.ts +++ b/extensions/interactions/ImageClickInput/directives/ImageClickInputValidationService.ts @@ -18,11 +18,9 @@ require('interactions/baseInteractionValidationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ImageClickInputValidationService', [ - '$filter', 'baseInteractionValidationService', 'WARNING_TYPES', - function($filter, baseInteractionValidationService, WARNING_TYPES) { +angular.module('oppia').factory('ImageClickInputValidationService', [ + 'baseInteractionValidationService', 'WARNING_TYPES', + function(baseInteractionValidationService, WARNING_TYPES) { return { getCustomizationArgsWarnings: function(customizationArgs) { baseInteractionValidationService.requireCustomizationArguments( diff --git a/extensions/interactions/ImageClickInput/directives/OppiaInteractiveImageClickInputDirective.ts b/extensions/interactions/ImageClickInput/directives/OppiaInteractiveImageClickInputDirective.ts index cd06ebfbbf16..4dc5ce9363d6 100644 --- a/extensions/interactions/ImageClickInput/directives/OppiaInteractiveImageClickInputDirective.ts +++ b/extensions/interactions/ImageClickInput/directives/OppiaInteractiveImageClickInputDirective.ts @@ -27,15 +27,13 @@ require('services/AssetsBackendApiService.ts'); require('services/ContextService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaInteractiveImageClickInput', [ - '$sce', 'AssetsBackendApiService', 'ContextService', +angular.module('oppia').directive('oppiaInteractiveImageClickInput', [ + 'AssetsBackendApiService', 'ContextService', 'HtmlEscaperService', 'ImageClickInputRulesService', 'ImagePreloaderService', 'UrlInterpolationService', 'EVENT_NEW_CARD_AVAILABLE', 'EXPLORATION_EDITOR_TAB_CONTEXT', 'LOADING_INDICATOR_URL', function( - $sce, AssetsBackendApiService, ContextService, + AssetsBackendApiService, ContextService, HtmlEscaperService, ImageClickInputRulesService, ImagePreloaderService, UrlInterpolationService, EVENT_NEW_CARD_AVAILABLE, EXPLORATION_EDITOR_TAB_CONTEXT, LOADING_INDICATOR_URL) { diff --git a/extensions/interactions/ImageClickInput/directives/OppiaResponseImageClickInputDirective.ts b/extensions/interactions/ImageClickInput/directives/OppiaResponseImageClickInputDirective.ts index aadc204964bb..7c0b6917675f 100644 --- a/extensions/interactions/ImageClickInput/directives/OppiaResponseImageClickInputDirective.ts +++ b/extensions/interactions/ImageClickInput/directives/OppiaResponseImageClickInputDirective.ts @@ -23,9 +23,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaResponseImageClickInput', [ +angular.module('oppia').directive('oppiaResponseImageClickInput', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/extensions/interactions/ImageClickInput/directives/OppiaShortResponseImageClickInputDirective.ts b/extensions/interactions/ImageClickInput/directives/OppiaShortResponseImageClickInputDirective.ts index 22ee17dc1caf..696376311558 100644 --- a/extensions/interactions/ImageClickInput/directives/OppiaShortResponseImageClickInputDirective.ts +++ b/extensions/interactions/ImageClickInput/directives/OppiaShortResponseImageClickInputDirective.ts @@ -23,9 +23,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaShortResponseImageClickInput', [ +angular.module('oppia').directive('oppiaShortResponseImageClickInput', [ 'HtmlEscaperService', 'UrlInterpolationService', function(HtmlEscaperService, UrlInterpolationService) { return { diff --git a/extensions/interactions/InteractiveMap/directives/InteractiveMapRulesService.ts b/extensions/interactions/InteractiveMap/directives/InteractiveMapRulesService.ts index ae49bdedbefe..cda4c931a3d3 100644 --- a/extensions/interactions/InteractiveMap/directives/InteractiveMapRulesService.ts +++ b/extensions/interactions/InteractiveMap/directives/InteractiveMapRulesService.ts @@ -16,9 +16,7 @@ * @fileoverview Rules service for the interaction. */ -var oppia = require('AppInit.ts').module; - -oppia.factory('InteractiveMapRulesService', [ +angular.module('oppia').factory('InteractiveMapRulesService', [ function() { var RADIUS_OF_EARTH_KM = 6371.0; var degreesToRadians = function(angle) { diff --git a/extensions/interactions/InteractiveMap/directives/InteractiveMapValidationService.ts b/extensions/interactions/InteractiveMap/directives/InteractiveMapValidationService.ts index 36b47df623c8..d265706e627d 100644 --- a/extensions/interactions/InteractiveMap/directives/InteractiveMapValidationService.ts +++ b/extensions/interactions/InteractiveMap/directives/InteractiveMapValidationService.ts @@ -18,9 +18,7 @@ require('interactions/baseInteractionValidationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('InteractiveMapValidationService', [ +angular.module('oppia').factory('InteractiveMapValidationService', [ 'baseInteractionValidationService', 'WARNING_TYPES', function(baseInteractionValidationService, WARNING_TYPES) { return { diff --git a/extensions/interactions/InteractiveMap/directives/OppiaInteractiveInteractiveMapDirective.ts b/extensions/interactions/InteractiveMap/directives/OppiaInteractiveInteractiveMapDirective.ts index cf399d01db91..18e70dacec61 100644 --- a/extensions/interactions/InteractiveMap/directives/OppiaInteractiveInteractiveMapDirective.ts +++ b/extensions/interactions/InteractiveMap/directives/OppiaInteractiveInteractiveMapDirective.ts @@ -27,9 +27,7 @@ require( 'pages/exploration-player-page/services/current-interaction.service.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaInteractiveInteractiveMap', [ +angular.module('oppia').directive('oppiaInteractiveInteractiveMap', [ 'HtmlEscaperService', 'InteractiveMapRulesService', 'UrlInterpolationService', 'EVENT_NEW_CARD_AVAILABLE', function( diff --git a/extensions/interactions/InteractiveMap/directives/OppiaResponseInteractiveMapDirective.ts b/extensions/interactions/InteractiveMap/directives/OppiaResponseInteractiveMapDirective.ts index 908ac6105db6..cb9cb6b63bee 100644 --- a/extensions/interactions/InteractiveMap/directives/OppiaResponseInteractiveMapDirective.ts +++ b/extensions/interactions/InteractiveMap/directives/OppiaResponseInteractiveMapDirective.ts @@ -23,9 +23,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaResponseInteractiveMap', [ +angular.module('oppia').directive('oppiaResponseInteractiveMap', [ 'HtmlEscaperService', 'UrlInterpolationService', function(HtmlEscaperService, UrlInterpolationService) { return { diff --git a/extensions/interactions/InteractiveMap/directives/OppiaShortResponseInteractiveMapDirective.ts b/extensions/interactions/InteractiveMap/directives/OppiaShortResponseInteractiveMapDirective.ts index c2d3c19cfb41..c653f354ca2a 100644 --- a/extensions/interactions/InteractiveMap/directives/OppiaShortResponseInteractiveMapDirective.ts +++ b/extensions/interactions/InteractiveMap/directives/OppiaShortResponseInteractiveMapDirective.ts @@ -23,9 +23,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaShortResponseInteractiveMap', [ +angular.module('oppia').directive('oppiaShortResponseInteractiveMap', [ 'HtmlEscaperService', 'UrlInterpolationService', function(HtmlEscaperService, UrlInterpolationService) { return { diff --git a/extensions/interactions/ItemSelectionInput/directives/ItemSelectionInputRulesService.ts b/extensions/interactions/ItemSelectionInput/directives/ItemSelectionInputRulesService.ts index 1ad84ba9d4e9..62f33f60a4d7 100644 --- a/extensions/interactions/ItemSelectionInput/directives/ItemSelectionInputRulesService.ts +++ b/extensions/interactions/ItemSelectionInput/directives/ItemSelectionInputRulesService.ts @@ -18,43 +18,42 @@ require('filters/remove-duplicates-in-array.filter.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ItemSelectionInputRulesService', ['$filter', function($filter) { - return { - Equals: function(answer, inputs) { - var normalizedAnswer = $filter('removeDuplicatesInArray')(answer); - var normalizedInput = $filter('removeDuplicatesInArray')(inputs.x); - return normalizedAnswer.length === normalizedInput.length && - normalizedAnswer.every(function(val) { - return normalizedInput.indexOf(val) !== -1; - }); - }, - ContainsAtLeastOneOf: function(answer, inputs) { - var normalizedAnswer = $filter('removeDuplicatesInArray')(answer); - var normalizedInput = $filter('removeDuplicatesInArray')(inputs.x); - return normalizedAnswer.some(function(val) { - return normalizedInput.indexOf(val) !== -1; - }); - }, - // TODO(wxy): migrate the name of this rule to OmitsAtLeastOneOf, keeping - // in sync with the backend migration of the same rule. - DoesNotContainAtLeastOneOf: function(answer, inputs) { - var normalizedAnswer = $filter('removeDuplicatesInArray')(answer); - var normalizedInput = $filter('removeDuplicatesInArray')(inputs.x); - return normalizedInput.some(function(val) { - return normalizedAnswer.indexOf(val) === -1; - }); - }, - // This function checks if the answer - // given by the user is a subset of the correct answers. - IsProperSubsetOf: function(answer, inputs) { - var normalizedAnswer = $filter('removeDuplicatesInArray')(answer); - var normalizedInput = $filter('removeDuplicatesInArray')(inputs.x); - return normalizedAnswer.length < normalizedInput.length && - normalizedAnswer.every(function(val) { - return normalizedInput.indexOf(val) !== -1; - }); - } - }; -}]); +angular.module('oppia').factory('ItemSelectionInputRulesService', [ + '$filter', function($filter) { + return { + Equals: function(answer, inputs) { + var normalizedAnswer = $filter('removeDuplicatesInArray')(answer); + var normalizedInput = $filter('removeDuplicatesInArray')(inputs.x); + return normalizedAnswer.length === normalizedInput.length && + normalizedAnswer.every(function(val) { + return normalizedInput.indexOf(val) !== -1; + }); + }, + ContainsAtLeastOneOf: function(answer, inputs) { + var normalizedAnswer = $filter('removeDuplicatesInArray')(answer); + var normalizedInput = $filter('removeDuplicatesInArray')(inputs.x); + return normalizedAnswer.some(function(val) { + return normalizedInput.indexOf(val) !== -1; + }); + }, + // TODO(wxy): migrate the name of this rule to OmitsAtLeastOneOf, keeping + // in sync with the backend migration of the same rule. + DoesNotContainAtLeastOneOf: function(answer, inputs) { + var normalizedAnswer = $filter('removeDuplicatesInArray')(answer); + var normalizedInput = $filter('removeDuplicatesInArray')(inputs.x); + return normalizedInput.some(function(val) { + return normalizedAnswer.indexOf(val) === -1; + }); + }, + // This function checks if the answer + // given by the user is a subset of the correct answers. + IsProperSubsetOf: function(answer, inputs) { + var normalizedAnswer = $filter('removeDuplicatesInArray')(answer); + var normalizedInput = $filter('removeDuplicatesInArray')(inputs.x); + return normalizedAnswer.length < normalizedInput.length && + normalizedAnswer.every(function(val) { + return normalizedInput.indexOf(val) !== -1; + }); + } + }; + }]); diff --git a/extensions/interactions/ItemSelectionInput/directives/ItemSelectionInputValidationService.ts b/extensions/interactions/ItemSelectionInput/directives/ItemSelectionInputValidationService.ts index 06b7d65c1e38..c37f53a205a5 100644 --- a/extensions/interactions/ItemSelectionInput/directives/ItemSelectionInputValidationService.ts +++ b/extensions/interactions/ItemSelectionInput/directives/ItemSelectionInputValidationService.ts @@ -18,11 +18,9 @@ require('interactions/baseInteractionValidationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('ItemSelectionInputValidationService', [ - '$filter', 'baseInteractionValidationService', 'WARNING_TYPES', - function($filter, baseInteractionValidationService, WARNING_TYPES) { +angular.module('oppia').factory('ItemSelectionInputValidationService', [ + 'baseInteractionValidationService', 'WARNING_TYPES', + function(baseInteractionValidationService, WARNING_TYPES) { return { getCustomizationArgsWarnings: function(customizationArgs) { var warningsList = []; diff --git a/extensions/interactions/ItemSelectionInput/directives/OppiaInteractiveItemSelectionInputDirective.ts b/extensions/interactions/ItemSelectionInput/directives/OppiaInteractiveItemSelectionInputDirective.ts index 2e2a1bf24e1a..21811cfaecf6 100644 --- a/extensions/interactions/ItemSelectionInput/directives/OppiaInteractiveItemSelectionInputDirective.ts +++ b/extensions/interactions/ItemSelectionInput/directives/OppiaInteractiveItemSelectionInputDirective.ts @@ -30,9 +30,7 @@ require('services/contextual/UrlService.ts'); require('services/contextual/WindowDimensionsService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaInteractiveItemSelectionInput', [ +angular.module('oppia').directive('oppiaInteractiveItemSelectionInput', [ 'HtmlEscaperService', 'ItemSelectionInputRulesService', 'UrlInterpolationService', function( HtmlEscaperService, ItemSelectionInputRulesService, diff --git a/extensions/interactions/ItemSelectionInput/directives/OppiaResponseItemSelectionInputDirective.ts b/extensions/interactions/ItemSelectionInput/directives/OppiaResponseItemSelectionInputDirective.ts index 8b41107cb9fc..ae644a063391 100644 --- a/extensions/interactions/ItemSelectionInput/directives/OppiaResponseItemSelectionInputDirective.ts +++ b/extensions/interactions/ItemSelectionInput/directives/OppiaResponseItemSelectionInputDirective.ts @@ -23,9 +23,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaResponseItemSelectionInput', [ +angular.module('oppia').directive('oppiaResponseItemSelectionInput', [ 'HtmlEscaperService', 'UrlInterpolationService', function(HtmlEscaperService, UrlInterpolationService) { return { diff --git a/extensions/interactions/ItemSelectionInput/directives/OppiaShortResponseItemSelectionInputDirective.ts b/extensions/interactions/ItemSelectionInput/directives/OppiaShortResponseItemSelectionInputDirective.ts index fbec52ec4dac..5b798b0cac9d 100644 --- a/extensions/interactions/ItemSelectionInput/directives/OppiaShortResponseItemSelectionInputDirective.ts +++ b/extensions/interactions/ItemSelectionInput/directives/OppiaShortResponseItemSelectionInputDirective.ts @@ -23,9 +23,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaShortResponseItemSelectionInput', [ +angular.module('oppia').directive('oppiaShortResponseItemSelectionInput', [ 'HtmlEscaperService', 'UrlInterpolationService', function(HtmlEscaperService, UrlInterpolationService) { return { diff --git a/extensions/interactions/LogicProof/directives/LogicProofRulesService.ts b/extensions/interactions/LogicProof/directives/LogicProofRulesService.ts index 8d1c2d514f47..7b1f882c6469 100644 --- a/extensions/interactions/LogicProof/directives/LogicProofRulesService.ts +++ b/extensions/interactions/LogicProof/directives/LogicProofRulesService.ts @@ -16,9 +16,7 @@ * @fileoverview Rules service for the interaction. */ -var oppia = require('AppInit.ts').module; - -oppia.factory('LogicProofRulesService', [function() { +angular.module('oppia').factory('LogicProofRulesService', [function() { return { Correct: function(answer) { return answer.correct; diff --git a/extensions/interactions/LogicProof/directives/LogicProofValidationService.ts b/extensions/interactions/LogicProof/directives/LogicProofValidationService.ts index 799a4323d6da..12ec372be710 100644 --- a/extensions/interactions/LogicProof/directives/LogicProofValidationService.ts +++ b/extensions/interactions/LogicProof/directives/LogicProofValidationService.ts @@ -18,9 +18,7 @@ require('interactions/baseInteractionValidationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('LogicProofValidationService', [ +angular.module('oppia').factory('LogicProofValidationService', [ 'baseInteractionValidationService', function(baseInteractionValidationService) { return { diff --git a/extensions/interactions/LogicProof/directives/OppiaInteractiveLogicProofDirective.ts b/extensions/interactions/LogicProof/directives/OppiaInteractiveLogicProofDirective.ts index 1d6fbf1f82a7..786f98d69974 100644 --- a/extensions/interactions/LogicProof/directives/OppiaInteractiveLogicProofDirective.ts +++ b/extensions/interactions/LogicProof/directives/OppiaInteractiveLogicProofDirective.ts @@ -24,9 +24,7 @@ require('services/contextual/UrlService.ts'); require('services/contextual/WindowDimensionsService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaInteractiveLogicProof', [ +angular.module('oppia').directive('oppiaInteractiveLogicProof', [ 'HtmlEscaperService', 'UrlInterpolationService', 'EVENT_NEW_CARD_AVAILABLE', function( HtmlEscaperService, UrlInterpolationService, EVENT_NEW_CARD_AVAILABLE) { diff --git a/extensions/interactions/LogicProof/directives/OppiaResponseLogicProofDirective.ts b/extensions/interactions/LogicProof/directives/OppiaResponseLogicProofDirective.ts index 4d071f53b1be..352cd9c23421 100644 --- a/extensions/interactions/LogicProof/directives/OppiaResponseLogicProofDirective.ts +++ b/extensions/interactions/LogicProof/directives/OppiaResponseLogicProofDirective.ts @@ -19,9 +19,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaResponseLogicProof', [ +angular.module('oppia').directive('oppiaResponseLogicProof', [ 'HtmlEscaperService', 'UrlInterpolationService', function(HtmlEscaperService, UrlInterpolationService) { return { diff --git a/extensions/interactions/LogicProof/directives/OppiaShortResponseLogicProofDirective.ts b/extensions/interactions/LogicProof/directives/OppiaShortResponseLogicProofDirective.ts index 804317d5660b..df0ddb1b3a82 100644 --- a/extensions/interactions/LogicProof/directives/OppiaShortResponseLogicProofDirective.ts +++ b/extensions/interactions/LogicProof/directives/OppiaShortResponseLogicProofDirective.ts @@ -21,9 +21,7 @@ require('filters/string-utility-filters/truncate-at-first-line.filter.ts'); require('domain/utilities/UrlInterpolationService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaShortResponseLogicProof', [ +angular.module('oppia').directive('oppiaShortResponseLogicProof', [ 'HtmlEscaperService', 'UrlInterpolationService', function(HtmlEscaperService, UrlInterpolationService) { return { diff --git a/extensions/interactions/MathExpressionInput/directives/MathExpressionInputRulesService.ts b/extensions/interactions/MathExpressionInput/directives/MathExpressionInputRulesService.ts index dece30aad3a3..89be0f928f99 100644 --- a/extensions/interactions/MathExpressionInput/directives/MathExpressionInputRulesService.ts +++ b/extensions/interactions/MathExpressionInput/directives/MathExpressionInputRulesService.ts @@ -49,8 +49,6 @@ export class MathExpressionInputRulesService { } } -var oppia = require('AppInit.ts').module; - -oppia.factory( +angular.module('oppia').factory( 'MathExpressionInputRulesService', downgradeInjectable(MathExpressionInputRulesService)); diff --git a/extensions/interactions/MathExpressionInput/directives/MathExpressionInputValidationService.ts b/extensions/interactions/MathExpressionInput/directives/MathExpressionInputValidationService.ts index 026753a0a489..8737a5f4a2ab 100644 --- a/extensions/interactions/MathExpressionInput/directives/MathExpressionInputValidationService.ts +++ b/extensions/interactions/MathExpressionInput/directives/MathExpressionInputValidationService.ts @@ -18,9 +18,7 @@ require('interactions/baseInteractionValidationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('MathExpressionInputValidationService', [ +angular.module('oppia').factory('MathExpressionInputValidationService', [ 'baseInteractionValidationService', 'WARNING_TYPES', function(baseInteractionValidationService, WARNING_TYPES) { return { diff --git a/extensions/interactions/MathExpressionInput/directives/OppiaInteractiveMathExpressionInputDirective.ts b/extensions/interactions/MathExpressionInput/directives/OppiaInteractiveMathExpressionInputDirective.ts index c448d14bd09e..0fa21526ccb8 100644 --- a/extensions/interactions/MathExpressionInput/directives/OppiaInteractiveMathExpressionInputDirective.ts +++ b/extensions/interactions/MathExpressionInput/directives/OppiaInteractiveMathExpressionInputDirective.ts @@ -31,13 +31,11 @@ require('services/contextual/WindowDimensionsService.ts'); require('services/DebouncerService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaInteractiveMathExpressionInput', [ - 'HtmlEscaperService', 'MathExpressionInputRulesService', +angular.module('oppia').directive('oppiaInteractiveMathExpressionInput', [ + 'MathExpressionInputRulesService', 'UrlInterpolationService', function( - HtmlEscaperService, MathExpressionInputRulesService, + MathExpressionInputRulesService, UrlInterpolationService) { return { restrict: 'E', diff --git a/extensions/interactions/MathExpressionInput/directives/OppiaResponseMathExpressionInputDirective.ts b/extensions/interactions/MathExpressionInput/directives/OppiaResponseMathExpressionInputDirective.ts index 2431f8859bd7..415feb245618 100644 --- a/extensions/interactions/MathExpressionInput/directives/OppiaResponseMathExpressionInputDirective.ts +++ b/extensions/interactions/MathExpressionInput/directives/OppiaResponseMathExpressionInputDirective.ts @@ -23,9 +23,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaResponseMathExpressionInput', [ +angular.module('oppia').directive('oppiaResponseMathExpressionInput', [ 'HtmlEscaperService', 'UrlInterpolationService', function(HtmlEscaperService, UrlInterpolationService) { return { diff --git a/extensions/interactions/MathExpressionInput/directives/OppiaShortResponseMathExpressionInputDirective.ts b/extensions/interactions/MathExpressionInput/directives/OppiaShortResponseMathExpressionInputDirective.ts index 98c056c3348e..1416406f2a52 100644 --- a/extensions/interactions/MathExpressionInput/directives/OppiaShortResponseMathExpressionInputDirective.ts +++ b/extensions/interactions/MathExpressionInput/directives/OppiaShortResponseMathExpressionInputDirective.ts @@ -23,9 +23,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaShortResponseMathExpressionInput', [ +angular.module('oppia').directive('oppiaShortResponseMathExpressionInput', [ 'HtmlEscaperService', 'UrlInterpolationService', function(HtmlEscaperService, UrlInterpolationService) { return { diff --git a/extensions/interactions/MultipleChoiceInput/directives/MultipleChoiceInputRulesService.ts b/extensions/interactions/MultipleChoiceInput/directives/MultipleChoiceInputRulesService.ts index 23dc1ecf539e..093b204ae36f 100644 --- a/extensions/interactions/MultipleChoiceInput/directives/MultipleChoiceInputRulesService.ts +++ b/extensions/interactions/MultipleChoiceInput/directives/MultipleChoiceInputRulesService.ts @@ -16,9 +16,7 @@ * @fileoverview Rules service for the interaction. */ -var oppia = require('AppInit.ts').module; - -oppia.factory('MultipleChoiceInputRulesService', [function() { +angular.module('oppia').factory('MultipleChoiceInputRulesService', [function() { return { Equals: function(answer, inputs) { return answer === inputs.x; diff --git a/extensions/interactions/MultipleChoiceInput/directives/MultipleChoiceInputValidationService.ts b/extensions/interactions/MultipleChoiceInput/directives/MultipleChoiceInputValidationService.ts index 8b2f337e1524..61c3af2a68bf 100644 --- a/extensions/interactions/MultipleChoiceInput/directives/MultipleChoiceInputValidationService.ts +++ b/extensions/interactions/MultipleChoiceInput/directives/MultipleChoiceInputValidationService.ts @@ -18,9 +18,7 @@ require('interactions/baseInteractionValidationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('MultipleChoiceInputValidationService', [ +angular.module('oppia').factory('MultipleChoiceInputValidationService', [ 'baseInteractionValidationService', 'WARNING_TYPES', function(baseInteractionValidationService, WARNING_TYPES) { return { diff --git a/extensions/interactions/MultipleChoiceInput/directives/OppiaInteractiveMultipleChoiceInputDirective.ts b/extensions/interactions/MultipleChoiceInput/directives/OppiaInteractiveMultipleChoiceInputDirective.ts index 9279d3aead45..738a7ff076ee 100644 --- a/extensions/interactions/MultipleChoiceInput/directives/OppiaInteractiveMultipleChoiceInputDirective.ts +++ b/extensions/interactions/MultipleChoiceInput/directives/OppiaInteractiveMultipleChoiceInputDirective.ts @@ -28,9 +28,7 @@ require( 'MultipleChoiceInputRulesService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaInteractiveMultipleChoiceInput', [ +angular.module('oppia').directive('oppiaInteractiveMultipleChoiceInput', [ 'HtmlEscaperService', 'MultipleChoiceInputRulesService', 'UrlInterpolationService', function( diff --git a/extensions/interactions/MultipleChoiceInput/directives/OppiaResponseMultipleChoiceInputDirective.ts b/extensions/interactions/MultipleChoiceInput/directives/OppiaResponseMultipleChoiceInputDirective.ts index 439c33a84a3c..24c7e7b7e786 100644 --- a/extensions/interactions/MultipleChoiceInput/directives/OppiaResponseMultipleChoiceInputDirective.ts +++ b/extensions/interactions/MultipleChoiceInput/directives/OppiaResponseMultipleChoiceInputDirective.ts @@ -23,9 +23,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaResponseMultipleChoiceInput', [ +angular.module('oppia').directive('oppiaResponseMultipleChoiceInput', [ 'HtmlEscaperService', 'UrlInterpolationService', function(HtmlEscaperService, UrlInterpolationService) { return { diff --git a/extensions/interactions/MultipleChoiceInput/directives/OppiaShortResponseMultipleChoiceInputDirective.ts b/extensions/interactions/MultipleChoiceInput/directives/OppiaShortResponseMultipleChoiceInputDirective.ts index 56ce0aa01471..2be5197a3c60 100644 --- a/extensions/interactions/MultipleChoiceInput/directives/OppiaShortResponseMultipleChoiceInputDirective.ts +++ b/extensions/interactions/MultipleChoiceInput/directives/OppiaShortResponseMultipleChoiceInputDirective.ts @@ -25,9 +25,7 @@ require('filters/string-utility-filters/convert-to-plain-text.filter.ts'); require('filters/string-utility-filters/truncate-at-first-line.filter.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaShortResponseMultipleChoiceInput', [ +angular.module('oppia').directive('oppiaShortResponseMultipleChoiceInput', [ 'HtmlEscaperService', 'UrlInterpolationService', function(HtmlEscaperService, UrlInterpolationService) { return { diff --git a/extensions/interactions/MusicNotesInput/directives/MusicNotesInputRulesService.ts b/extensions/interactions/MusicNotesInput/directives/MusicNotesInputRulesService.ts index 74912e947dda..14fe379d3b74 100644 --- a/extensions/interactions/MusicNotesInput/directives/MusicNotesInputRulesService.ts +++ b/extensions/interactions/MusicNotesInput/directives/MusicNotesInputRulesService.ts @@ -23,9 +23,7 @@ require( require('interactions/interactions-extension.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('MusicNotesInputRulesService', [ +angular.module('oppia').factory('MusicNotesInputRulesService', [ 'NOTE_NAMES_TO_MIDI_VALUES', function(NOTE_NAMES_TO_MIDI_VALUES) { var _getMidiNoteValue = function(note) { if (NOTE_NAMES_TO_MIDI_VALUES.hasOwnProperty(note.readableNoteName)) { diff --git a/extensions/interactions/MusicNotesInput/directives/MusicNotesInputValidationService.ts b/extensions/interactions/MusicNotesInput/directives/MusicNotesInputValidationService.ts index 0fdda3dd2b81..219dd953f27b 100644 --- a/extensions/interactions/MusicNotesInput/directives/MusicNotesInputValidationService.ts +++ b/extensions/interactions/MusicNotesInput/directives/MusicNotesInputValidationService.ts @@ -18,9 +18,7 @@ require('interactions/baseInteractionValidationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('MusicNotesInputValidationService', [ +angular.module('oppia').factory('MusicNotesInputValidationService', [ 'baseInteractionValidationService', function(baseInteractionValidationService) { return { diff --git a/extensions/interactions/MusicNotesInput/directives/MusicPhrasePlayerService.ts b/extensions/interactions/MusicNotesInput/directives/MusicPhrasePlayerService.ts index 98c750f5eb7a..4cb429cd8e2e 100644 --- a/extensions/interactions/MusicNotesInput/directives/MusicPhrasePlayerService.ts +++ b/extensions/interactions/MusicNotesInput/directives/MusicPhrasePlayerService.ts @@ -16,42 +16,41 @@ * @fileoverview Player service for the interaction. */ -var oppia = require('AppInit.ts').module; +angular.module('oppia').factory('MusicPhrasePlayerService', [ + '$timeout', function($timeout) { + var _MIDI_CHANNEL = 0; + var _MIDI_VELOCITY = 127; + var _SECS_TO_MILLISECS = 1000.0; -oppia.factory('MusicPhrasePlayerService', ['$timeout', function($timeout) { - var _MIDI_CHANNEL = 0; - var _MIDI_VELOCITY = 127; - var _SECS_TO_MILLISECS = 1000.0; + var _playNote = function(midiValues, durationInSecs, delayInSecs) { + $timeout(function() { + MIDI.chordOn( + _MIDI_CHANNEL, midiValues, _MIDI_VELOCITY, 0); + MIDI.chordOff( + _MIDI_CHANNEL, midiValues, durationInSecs); + }, delayInSecs * _SECS_TO_MILLISECS); + }; - var _playNote = function(midiValues, durationInSecs, delayInSecs) { - $timeout(function() { - MIDI.chordOn( - _MIDI_CHANNEL, midiValues, _MIDI_VELOCITY, 0); - MIDI.chordOff( - _MIDI_CHANNEL, midiValues, durationInSecs); - }, delayInSecs * _SECS_TO_MILLISECS); - }; + /** + * Plays a music phrase. The input is given as an Array of notes. Each + * note is represented as an object with three key-value pairs: + * - midiValue: Integer. The midi value of the note. + * - duration: Float. A decimal number representing the length of the note, + * in seconds. + * - start: Float. A decimal number representing the time offset (after the + * beginning of the phrase) at which to start playing the note. + */ + var _playMusicPhrase = function(notes) { + MIDI.Player.stop(); - /** - * Plays a music phrase. The input is given as an Array of notes. Each - * note is represented as an object with three key-value pairs: - * - midiValue: Integer. The midi value of the note. - * - duration: Float. A decimal number representing the length of the note, in - * seconds. - * - start: Float. A decimal number representing the time offset (after the - * beginning of the phrase) at which to start playing the note. - */ - var _playMusicPhrase = function(notes) { - MIDI.Player.stop(); + for (var i = 0; i < notes.length; i++) { + _playNote([notes[i].midiValue], notes[i].duration, notes[i].start); + } + }; - for (var i = 0; i < notes.length; i++) { - _playNote([notes[i].midiValue], notes[i].duration, notes[i].start); - } - }; - - return { - playMusicPhrase: function(notes) { - _playMusicPhrase(notes); - } - }; -}]); + return { + playMusicPhrase: function(notes) { + _playMusicPhrase(notes); + } + }; + }]); diff --git a/extensions/interactions/MusicNotesInput/directives/OppiaInteractiveMusicNotesInputDirective.ts b/extensions/interactions/MusicNotesInput/directives/OppiaInteractiveMusicNotesInputDirective.ts index d04b42745789..4c79b4e854c3 100644 --- a/extensions/interactions/MusicNotesInput/directives/OppiaInteractiveMusicNotesInputDirective.ts +++ b/extensions/interactions/MusicNotesInput/directives/OppiaInteractiveMusicNotesInputDirective.ts @@ -33,17 +33,15 @@ require('services/HtmlEscaperService.ts'); require('interactions/interactions-extension.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaInteractiveMusicNotesInput', [ +angular.module('oppia').directive('oppiaInteractiveMusicNotesInput', [ 'CurrentInteractionService', 'HtmlEscaperService', 'MusicNotesInputRulesService', 'MusicPhrasePlayerService', - 'UrlInterpolationService', 'WindowDimensionsService', + 'UrlInterpolationService', 'EVENT_NEW_CARD_AVAILABLE', 'NOTE_NAMES_TO_MIDI_VALUES', function( CurrentInteractionService, HtmlEscaperService, MusicNotesInputRulesService, MusicPhrasePlayerService, - UrlInterpolationService, WindowDimensionsService, + UrlInterpolationService, EVENT_NEW_CARD_AVAILABLE, NOTE_NAMES_TO_MIDI_VALUES) { return { restrict: 'E', diff --git a/extensions/interactions/MusicNotesInput/directives/OppiaResponseMusicNotesInputDirective.ts b/extensions/interactions/MusicNotesInput/directives/OppiaResponseMusicNotesInputDirective.ts index 103b11291bc5..c8a492ce2f8a 100644 --- a/extensions/interactions/MusicNotesInput/directives/OppiaResponseMusicNotesInputDirective.ts +++ b/extensions/interactions/MusicNotesInput/directives/OppiaResponseMusicNotesInputDirective.ts @@ -23,9 +23,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaResponseMusicNotesInput', [ +angular.module('oppia').directive('oppiaResponseMusicNotesInput', [ 'HtmlEscaperService', 'UrlInterpolationService', function(HtmlEscaperService, UrlInterpolationService) { return { diff --git a/extensions/interactions/MusicNotesInput/directives/OppiaShortResponseMusicNotesInputDirective.ts b/extensions/interactions/MusicNotesInput/directives/OppiaShortResponseMusicNotesInputDirective.ts index 5e85d5c916d7..678585964624 100644 --- a/extensions/interactions/MusicNotesInput/directives/OppiaShortResponseMusicNotesInputDirective.ts +++ b/extensions/interactions/MusicNotesInput/directives/OppiaShortResponseMusicNotesInputDirective.ts @@ -23,9 +23,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaShortResponseMusicNotesInput', [ +angular.module('oppia').directive('oppiaShortResponseMusicNotesInput', [ 'HtmlEscaperService', 'UrlInterpolationService', function(HtmlEscaperService, UrlInterpolationService) { return { diff --git a/extensions/interactions/NumberWithUnits/directives/NumberWithUnitsRulesService.ts b/extensions/interactions/NumberWithUnits/directives/NumberWithUnitsRulesService.ts index 1878423c44ae..eba3ca4cd7e7 100644 --- a/extensions/interactions/NumberWithUnits/directives/NumberWithUnitsRulesService.ts +++ b/extensions/interactions/NumberWithUnits/directives/NumberWithUnitsRulesService.ts @@ -20,11 +20,9 @@ require('domain/objects/FractionObjectFactory.ts'); require('domain/objects/NumberWithUnitsObjectFactory.ts'); // Rules service for number with units interaction. -var oppia = require('AppInit.ts').module; - -oppia.factory('NumberWithUnitsRulesService', [ - 'FractionObjectFactory', 'NumberWithUnitsObjectFactory', - function(FractionObjectFactory, NumberWithUnitsObjectFactory) { +angular.module('oppia').factory('NumberWithUnitsRulesService', [ + 'NumberWithUnitsObjectFactory', + function(NumberWithUnitsObjectFactory) { try { NumberWithUnitsObjectFactory.createCurrencyUnits(); } catch (parsingError) {} diff --git a/extensions/interactions/NumberWithUnits/directives/NumberWithUnitsValidationService.ts b/extensions/interactions/NumberWithUnits/directives/NumberWithUnitsValidationService.ts index 64364f3dacd7..c30ba8269dd8 100644 --- a/extensions/interactions/NumberWithUnits/directives/NumberWithUnitsValidationService.ts +++ b/extensions/interactions/NumberWithUnits/directives/NumberWithUnitsValidationService.ts @@ -19,9 +19,7 @@ require('domain/objects/NumberWithUnitsObjectFactory.ts'); require('interactions/baseInteractionValidationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('NumberWithUnitsValidationService', [ +angular.module('oppia').factory('NumberWithUnitsValidationService', [ 'NumberWithUnitsObjectFactory', 'baseInteractionValidationService', 'WARNING_TYPES', function(NumberWithUnitsObjectFactory, baseInteractionValidationService, diff --git a/extensions/interactions/NumberWithUnits/directives/OppiaInteractiveNumberWithUnitsDirective.ts b/extensions/interactions/NumberWithUnits/directives/OppiaInteractiveNumberWithUnitsDirective.ts index f0818b542873..aaad3f3e2642 100644 --- a/extensions/interactions/NumberWithUnits/directives/OppiaInteractiveNumberWithUnitsDirective.ts +++ b/extensions/interactions/NumberWithUnits/directives/OppiaInteractiveNumberWithUnitsDirective.ts @@ -24,11 +24,9 @@ require( 'interactions/NumberWithUnits/directives/NumberWithUnitsRulesService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaInteractiveNumberWithUnits', [ - 'HtmlEscaperService', 'UrlInterpolationService', - function(HtmlEscaperService, UrlInterpolationService) { +angular.module('oppia').directive('oppiaInteractiveNumberWithUnits', [ + 'UrlInterpolationService', + function(UrlInterpolationService) { return { restrict: 'E', scope: {}, diff --git a/extensions/interactions/NumberWithUnits/directives/OppiaResponseNumberWithUnitsDirective.ts b/extensions/interactions/NumberWithUnits/directives/OppiaResponseNumberWithUnitsDirective.ts index 9a163e982e98..8fbe6cf451c9 100644 --- a/extensions/interactions/NumberWithUnits/directives/OppiaResponseNumberWithUnitsDirective.ts +++ b/extensions/interactions/NumberWithUnits/directives/OppiaResponseNumberWithUnitsDirective.ts @@ -20,9 +20,7 @@ require('domain/objects/NumberWithUnitsObjectFactory.ts'); require('domain/utilities/UrlInterpolationService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaResponseNumberWithUnits', [ +angular.module('oppia').directive('oppiaResponseNumberWithUnits', [ 'HtmlEscaperService', 'NumberWithUnitsObjectFactory', 'UrlInterpolationService', function(HtmlEscaperService, NumberWithUnitsObjectFactory, UrlInterpolationService) { diff --git a/extensions/interactions/NumberWithUnits/directives/OppiaShortResponseNumberWithUnitsDirective.ts b/extensions/interactions/NumberWithUnits/directives/OppiaShortResponseNumberWithUnitsDirective.ts index 6bb7f96b6553..17d5077e7541 100644 --- a/extensions/interactions/NumberWithUnits/directives/OppiaShortResponseNumberWithUnitsDirective.ts +++ b/extensions/interactions/NumberWithUnits/directives/OppiaShortResponseNumberWithUnitsDirective.ts @@ -20,9 +20,7 @@ require('domain/objects/NumberWithUnitsObjectFactory.ts'); require('domain/utilities/UrlInterpolationService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaShortResponseNumberWithUnits', [ +angular.module('oppia').directive('oppiaShortResponseNumberWithUnits', [ 'HtmlEscaperService', 'NumberWithUnitsObjectFactory', 'UrlInterpolationService', function(HtmlEscaperService, NumberWithUnitsObjectFactory, UrlInterpolationService) { diff --git a/extensions/interactions/NumericInput/directives/NumericInputRulesService.ts b/extensions/interactions/NumericInput/directives/NumericInputRulesService.ts index 0a2ce1e94233..b856eab12fd2 100644 --- a/extensions/interactions/NumericInput/directives/NumericInputRulesService.ts +++ b/extensions/interactions/NumericInput/directives/NumericInputRulesService.ts @@ -16,9 +16,7 @@ * @fileoverview Rules service for the interaction. */ -var oppia = require('AppInit.ts').module; - -oppia.factory('NumericInputRulesService', [function() { +angular.module('oppia').factory('NumericInputRulesService', [function() { return { Equals: function(answer, inputs) { return answer === inputs.x; diff --git a/extensions/interactions/NumericInput/directives/NumericInputValidationService.ts b/extensions/interactions/NumericInput/directives/NumericInputValidationService.ts index 7ada1d31b0d3..adeba05a007d 100644 --- a/extensions/interactions/NumericInput/directives/NumericInputValidationService.ts +++ b/extensions/interactions/NumericInput/directives/NumericInputValidationService.ts @@ -18,9 +18,7 @@ require('interactions/baseInteractionValidationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('NumericInputValidationService', [ +angular.module('oppia').factory('NumericInputValidationService', [ 'baseInteractionValidationService', 'WARNING_TYPES', function(baseInteractionValidationService, WARNING_TYPES) { return { diff --git a/extensions/interactions/NumericInput/directives/OppiaInteractiveNumericInputDirective.ts b/extensions/interactions/NumericInput/directives/OppiaInteractiveNumericInputDirective.ts index f24183355b5e..819d303d3ac8 100644 --- a/extensions/interactions/NumericInput/directives/OppiaInteractiveNumericInputDirective.ts +++ b/extensions/interactions/NumericInput/directives/OppiaInteractiveNumericInputDirective.ts @@ -27,9 +27,7 @@ require( require('services/contextual/WindowDimensionsService.ts'); require('services/stateful/FocusManagerService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaInteractiveNumericInput', [ +angular.module('oppia').directive('oppiaInteractiveNumericInput', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/extensions/interactions/NumericInput/directives/OppiaResponseNumericInputDirective.ts b/extensions/interactions/NumericInput/directives/OppiaResponseNumericInputDirective.ts index 062a2a0a9846..32ad48078c61 100644 --- a/extensions/interactions/NumericInput/directives/OppiaResponseNumericInputDirective.ts +++ b/extensions/interactions/NumericInput/directives/OppiaResponseNumericInputDirective.ts @@ -23,9 +23,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaResponseNumericInput', [ +angular.module('oppia').directive('oppiaResponseNumericInput', [ 'HtmlEscaperService', 'UrlInterpolationService', function(HtmlEscaperService, UrlInterpolationService) { return { diff --git a/extensions/interactions/NumericInput/directives/OppiaShortResponseNumericInputDirective.ts b/extensions/interactions/NumericInput/directives/OppiaShortResponseNumericInputDirective.ts index 3baf62ca82d1..6f84d318ee21 100644 --- a/extensions/interactions/NumericInput/directives/OppiaShortResponseNumericInputDirective.ts +++ b/extensions/interactions/NumericInput/directives/OppiaShortResponseNumericInputDirective.ts @@ -23,9 +23,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaShortResponseNumericInput', [ +angular.module('oppia').directive('oppiaShortResponseNumericInput', [ 'HtmlEscaperService', 'UrlInterpolationService', function(HtmlEscaperService, UrlInterpolationService) { return { diff --git a/extensions/interactions/PencilCodeEditor/directives/OppiaInteractivePencilCodeEditorDirective.ts b/extensions/interactions/PencilCodeEditor/directives/OppiaInteractivePencilCodeEditorDirective.ts index 57f615935f12..719205188d82 100644 --- a/extensions/interactions/PencilCodeEditor/directives/OppiaInteractivePencilCodeEditorDirective.ts +++ b/extensions/interactions/PencilCodeEditor/directives/OppiaInteractivePencilCodeEditorDirective.ts @@ -29,9 +29,7 @@ require('services/contextual/WindowDimensionsService.ts'); require('services/HtmlEscaperService.ts'); require('services/stateful/FocusManagerService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaInteractivePencilCodeEditor', [ +angular.module('oppia').directive('oppiaInteractivePencilCodeEditor', [ 'HtmlEscaperService', 'UrlInterpolationService', 'EVENT_NEW_CARD_AVAILABLE', function( HtmlEscaperService, UrlInterpolationService, EVENT_NEW_CARD_AVAILABLE) { diff --git a/extensions/interactions/PencilCodeEditor/directives/OppiaResponsePencilCodeEditorDirective.ts b/extensions/interactions/PencilCodeEditor/directives/OppiaResponsePencilCodeEditorDirective.ts index 13fa15d5e186..4375e79febaf 100644 --- a/extensions/interactions/PencilCodeEditor/directives/OppiaResponsePencilCodeEditorDirective.ts +++ b/extensions/interactions/PencilCodeEditor/directives/OppiaResponsePencilCodeEditorDirective.ts @@ -23,9 +23,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaResponsePencilCodeEditor', [ +angular.module('oppia').directive('oppiaResponsePencilCodeEditor', [ 'HtmlEscaperService', 'UrlInterpolationService', function(HtmlEscaperService, UrlInterpolationService) { return { diff --git a/extensions/interactions/PencilCodeEditor/directives/OppiaShortResponsePencilCodeEditorDirective.ts b/extensions/interactions/PencilCodeEditor/directives/OppiaShortResponsePencilCodeEditorDirective.ts index 14b5ca7fb7c3..b460765d887f 100644 --- a/extensions/interactions/PencilCodeEditor/directives/OppiaShortResponsePencilCodeEditorDirective.ts +++ b/extensions/interactions/PencilCodeEditor/directives/OppiaShortResponsePencilCodeEditorDirective.ts @@ -25,9 +25,7 @@ require('filters/string-utility-filters/truncate-at-first-line.filter.ts'); require('domain/utilities/UrlInterpolationService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaShortResponsePencilCodeEditor', [ +angular.module('oppia').directive('oppiaShortResponsePencilCodeEditor', [ 'HtmlEscaperService', 'UrlInterpolationService', function(HtmlEscaperService, UrlInterpolationService) { return { diff --git a/extensions/interactions/PencilCodeEditor/directives/PencilCodeEditorRulesService.ts b/extensions/interactions/PencilCodeEditor/directives/PencilCodeEditorRulesService.ts index d8bc4bd65933..6cd80e305173 100644 --- a/extensions/interactions/PencilCodeEditor/directives/PencilCodeEditorRulesService.ts +++ b/extensions/interactions/PencilCodeEditor/directives/PencilCodeEditorRulesService.ts @@ -22,9 +22,7 @@ require( 'normalize-whitespace-punctuation-and-case.filter.ts'); require('services/CodeNormalizerService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('PencilCodeEditorRulesService', [ +angular.module('oppia').factory('PencilCodeEditorRulesService', [ '$filter', 'CodeNormalizerService', function($filter, CodeNormalizerService) { return { diff --git a/extensions/interactions/PencilCodeEditor/directives/PencilCodeEditorValidationService.ts b/extensions/interactions/PencilCodeEditor/directives/PencilCodeEditorValidationService.ts index 9ce98290011c..e90452be26e1 100644 --- a/extensions/interactions/PencilCodeEditor/directives/PencilCodeEditorValidationService.ts +++ b/extensions/interactions/PencilCodeEditor/directives/PencilCodeEditorValidationService.ts @@ -18,9 +18,7 @@ require('interactions/baseInteractionValidationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('PencilCodeEditorValidationService', [ +angular.module('oppia').factory('PencilCodeEditorValidationService', [ 'baseInteractionValidationService', function(baseInteractionValidationService) { return { diff --git a/extensions/interactions/SetInput/directives/OppiaInteractiveSetInputDirective.ts b/extensions/interactions/SetInput/directives/OppiaInteractiveSetInputDirective.ts index ba106700ec2a..6718514e0b1d 100644 --- a/extensions/interactions/SetInput/directives/OppiaInteractiveSetInputDirective.ts +++ b/extensions/interactions/SetInput/directives/OppiaInteractiveSetInputDirective.ts @@ -26,9 +26,7 @@ require( 'pages/exploration-player-page/services/current-interaction.service.ts'); require('services/contextual/WindowDimensionsService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaInteractiveSetInput', [ +angular.module('oppia').directive('oppiaInteractiveSetInput', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/extensions/interactions/SetInput/directives/OppiaResponseSetInputDirective.ts b/extensions/interactions/SetInput/directives/OppiaResponseSetInputDirective.ts index 4b8805ec7660..a3c8a68095d6 100644 --- a/extensions/interactions/SetInput/directives/OppiaResponseSetInputDirective.ts +++ b/extensions/interactions/SetInput/directives/OppiaResponseSetInputDirective.ts @@ -23,9 +23,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaResponseSetInput', [ +angular.module('oppia').directive('oppiaResponseSetInput', [ 'HtmlEscaperService', 'UrlInterpolationService', function(HtmlEscaperService, UrlInterpolationService) { return { diff --git a/extensions/interactions/SetInput/directives/OppiaShortResponseSetInputDirective.ts b/extensions/interactions/SetInput/directives/OppiaShortResponseSetInputDirective.ts index 2930ccdb1f80..5da5ff5aec4c 100644 --- a/extensions/interactions/SetInput/directives/OppiaShortResponseSetInputDirective.ts +++ b/extensions/interactions/SetInput/directives/OppiaShortResponseSetInputDirective.ts @@ -23,9 +23,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaShortResponseSetInput', [ +angular.module('oppia').directive('oppiaShortResponseSetInput', [ 'HtmlEscaperService', 'UrlInterpolationService', function(HtmlEscaperService, UrlInterpolationService) { return { diff --git a/extensions/interactions/SetInput/directives/SetInputRulesService.ts b/extensions/interactions/SetInput/directives/SetInputRulesService.ts index 76e510b7529f..adf20adf6036 100644 --- a/extensions/interactions/SetInput/directives/SetInputRulesService.ts +++ b/extensions/interactions/SetInput/directives/SetInputRulesService.ts @@ -16,9 +16,7 @@ * @fileoverview Rules service for the interaction. */ -var oppia = require('AppInit.ts').module; - -oppia.factory('SetInputRulesService', [function() { +angular.module('oppia').factory('SetInputRulesService', [function() { return { Equals: function(answer, inputs) { return answer.length === inputs.x.length && inputs.x.every(function(val) { diff --git a/extensions/interactions/SetInput/directives/SetInputValidationService.ts b/extensions/interactions/SetInput/directives/SetInputValidationService.ts index 9b7fe59786f9..8b2f4e087764 100644 --- a/extensions/interactions/SetInput/directives/SetInputValidationService.ts +++ b/extensions/interactions/SetInput/directives/SetInputValidationService.ts @@ -18,9 +18,7 @@ require('interactions/baseInteractionValidationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('SetInputValidationService', [ +angular.module('oppia').factory('SetInputValidationService', [ 'baseInteractionValidationService', function(baseInteractionValidationService) { return { diff --git a/extensions/interactions/TextInput/TextInputPredictionService.ts b/extensions/interactions/TextInput/TextInputPredictionService.ts index 7a37efef9ae2..80c08a252da7 100644 --- a/extensions/interactions/TextInput/TextInputPredictionService.ts +++ b/extensions/interactions/TextInput/TextInputPredictionService.ts @@ -27,9 +27,7 @@ require('classifiers/CountVectorizerService.ts'); require('interactions/interactions-extension.constants.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('TextInputPredictionService', [ +angular.module('oppia').factory('TextInputPredictionService', [ 'CountVectorizerService', 'SVMPredictionService', 'TextInputTokenizer', 'TEXT_INPUT_PREDICTION_SERVICE_THRESHOLD', function( CountVectorizerService, SVMPredictionService, diff --git a/extensions/interactions/TextInput/directives/OppiaInteractiveTextInputDirective.ts b/extensions/interactions/TextInput/directives/OppiaInteractiveTextInputDirective.ts index e86ac38178ab..09250eb42f7f 100644 --- a/extensions/interactions/TextInput/directives/OppiaInteractiveTextInputDirective.ts +++ b/extensions/interactions/TextInput/directives/OppiaInteractiveTextInputDirective.ts @@ -28,9 +28,7 @@ require('services/contextual/WindowDimensionsService.ts'); require('services/HtmlEscaperService.ts'); require('services/stateful/FocusManagerService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaInteractiveTextInput', [ +angular.module('oppia').directive('oppiaInteractiveTextInput', [ 'HtmlEscaperService', 'UrlInterpolationService', function(HtmlEscaperService, UrlInterpolationService) { return { diff --git a/extensions/interactions/TextInput/directives/OppiaResponseTextInputDirective.ts b/extensions/interactions/TextInput/directives/OppiaResponseTextInputDirective.ts index 2974495d376a..1d1d663212ea 100644 --- a/extensions/interactions/TextInput/directives/OppiaResponseTextInputDirective.ts +++ b/extensions/interactions/TextInput/directives/OppiaResponseTextInputDirective.ts @@ -23,9 +23,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaResponseTextInput', [ +angular.module('oppia').directive('oppiaResponseTextInput', [ 'HtmlEscaperService', 'UrlInterpolationService', function(HtmlEscaperService, UrlInterpolationService) { return { diff --git a/extensions/interactions/TextInput/directives/OppiaShortResponseTextInputDirective.ts b/extensions/interactions/TextInput/directives/OppiaShortResponseTextInputDirective.ts index 54b69603ac15..af63d317e48a 100644 --- a/extensions/interactions/TextInput/directives/OppiaShortResponseTextInputDirective.ts +++ b/extensions/interactions/TextInput/directives/OppiaShortResponseTextInputDirective.ts @@ -25,9 +25,7 @@ require('filters/string-utility-filters/truncate-at-first-line.filter.ts'); require('domain/utilities/UrlInterpolationService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaShortResponseTextInput', [ +angular.module('oppia').directive('oppiaShortResponseTextInput', [ 'HtmlEscaperService', 'UrlInterpolationService', function(HtmlEscaperService, UrlInterpolationService) { return { diff --git a/extensions/interactions/TextInput/directives/TextInputRulesService.ts b/extensions/interactions/TextInput/directives/TextInputRulesService.ts index 6f49e867b653..47a18a17302a 100644 --- a/extensions/interactions/TextInput/directives/TextInputRulesService.ts +++ b/extensions/interactions/TextInput/directives/TextInputRulesService.ts @@ -18,61 +18,60 @@ require('filters/string-utility-filters/normalize-whitespace.filter.ts'); -var oppia = require('AppInit.ts').module; +angular.module('oppia').factory('TextInputRulesService', [ + '$filter', function($filter) { + return { + Equals: function(answer, inputs) { + var normalizedAnswer = $filter('normalizeWhitespace')(answer); + var normalizedInput = $filter('normalizeWhitespace')(inputs.x); + return normalizedAnswer.toLowerCase() === normalizedInput.toLowerCase(); + }, + FuzzyEquals: function(answer, inputs) { + var normalizedAnswer = $filter('normalizeWhitespace')(answer); + var answerString = normalizedAnswer.toLowerCase(); -oppia.factory('TextInputRulesService', ['$filter', function($filter) { - return { - Equals: function(answer, inputs) { - var normalizedAnswer = $filter('normalizeWhitespace')(answer); - var normalizedInput = $filter('normalizeWhitespace')(inputs.x); - return normalizedAnswer.toLowerCase() === normalizedInput.toLowerCase(); - }, - FuzzyEquals: function(answer, inputs) { - var normalizedAnswer = $filter('normalizeWhitespace')(answer); - var answerString = normalizedAnswer.toLowerCase(); + var normalizedInput = $filter('normalizeWhitespace')(inputs.x); + var inputString = normalizedInput.toLowerCase(); - var normalizedInput = $filter('normalizeWhitespace')(inputs.x); - var inputString = normalizedInput.toLowerCase(); - - if (inputString === answerString) { - return true; - } - var editDistance = []; - for (var i = 0; i <= inputString.length; i++) { - editDistance.push([i]); - } - for (var j = 1; j <= answerString.length; j++) { - editDistance[0].push(j); - } - for (var i = 1; i <= inputString.length; i++) { + if (inputString === answerString) { + return true; + } + var editDistance = []; + for (var i = 0; i <= inputString.length; i++) { + editDistance.push([i]); + } for (var j = 1; j <= answerString.length; j++) { - if (inputString.charAt(i - 1) === answerString.charAt(j - 1)) { - editDistance[i][j] = editDistance[i - 1][j - 1]; - } else { - editDistance[i][j] = Math.min(editDistance[i - 1][j - 1], - editDistance[i][j - 1], - editDistance[i - 1][j]) + 1; + editDistance[0].push(j); + } + for (var i = 1; i <= inputString.length; i++) { + for (var j = 1; j <= answerString.length; j++) { + if (inputString.charAt(i - 1) === answerString.charAt(j - 1)) { + editDistance[i][j] = editDistance[i - 1][j - 1]; + } else { + editDistance[i][j] = Math.min(editDistance[i - 1][j - 1], + editDistance[i][j - 1], + editDistance[i - 1][j]) + 1; + } } } + return editDistance[inputString.length][answerString.length] === 1; + }, + CaseSensitiveEquals: function(answer, inputs) { + var normalizedAnswer = $filter('normalizeWhitespace')(answer); + var normalizedInput = $filter('normalizeWhitespace')(inputs.x); + return normalizedAnswer === normalizedInput; + }, + StartsWith: function(answer, inputs) { + var normalizedAnswer = $filter('normalizeWhitespace')(answer); + var normalizedInput = $filter('normalizeWhitespace')(inputs.x); + return normalizedAnswer.toLowerCase().indexOf( + normalizedInput.toLowerCase()) === 0; + }, + Contains: function(answer, inputs) { + var normalizedAnswer = $filter('normalizeWhitespace')(answer); + var normalizedInput = $filter('normalizeWhitespace')(inputs.x); + return normalizedAnswer.toLowerCase().indexOf( + normalizedInput.toLowerCase()) !== -1; } - return editDistance[inputString.length][answerString.length] === 1; - }, - CaseSensitiveEquals: function(answer, inputs) { - var normalizedAnswer = $filter('normalizeWhitespace')(answer); - var normalizedInput = $filter('normalizeWhitespace')(inputs.x); - return normalizedAnswer === normalizedInput; - }, - StartsWith: function(answer, inputs) { - var normalizedAnswer = $filter('normalizeWhitespace')(answer); - var normalizedInput = $filter('normalizeWhitespace')(inputs.x); - return normalizedAnswer.toLowerCase().indexOf( - normalizedInput.toLowerCase()) === 0; - }, - Contains: function(answer, inputs) { - var normalizedAnswer = $filter('normalizeWhitespace')(answer); - var normalizedInput = $filter('normalizeWhitespace')(inputs.x); - return normalizedAnswer.toLowerCase().indexOf( - normalizedInput.toLowerCase()) !== -1; - } - }; -}]); + }; + }]); diff --git a/extensions/interactions/TextInput/directives/TextInputValidationService.ts b/extensions/interactions/TextInput/directives/TextInputValidationService.ts index 0a06e18167d9..56a9894dc571 100644 --- a/extensions/interactions/TextInput/directives/TextInputValidationService.ts +++ b/extensions/interactions/TextInput/directives/TextInputValidationService.ts @@ -18,9 +18,7 @@ require('interactions/baseInteractionValidationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('TextInputValidationService', [ +angular.module('oppia').factory('TextInputValidationService', [ 'baseInteractionValidationService', 'INTERACTION_SPECS', 'WARNING_TYPES', function(baseInteractionValidationService, INTERACTION_SPECS, WARNING_TYPES) { return { diff --git a/extensions/interactions/baseInteractionValidationService.ts b/extensions/interactions/baseInteractionValidationService.ts index 4ec2cbfe5421..f732bb11c6ae 100644 --- a/extensions/interactions/baseInteractionValidationService.ts +++ b/extensions/interactions/baseInteractionValidationService.ts @@ -18,10 +18,8 @@ require('interactions/baseInteractionValidationService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.factory('baseInteractionValidationService', [ - '$filter', 'WARNING_TYPES', function($filter, WARNING_TYPES) { +angular.module('oppia').factory('baseInteractionValidationService', [ + 'WARNING_TYPES', function(WARNING_TYPES) { return { // 'argNames' is an array of top-level customization argument names (such // as 'chocies') used to verify the basic structure of the input diff --git a/extensions/interactions/interactions-extension.constants.ts b/extensions/interactions/interactions-extension.constants.ts index 33114d908f62..91dea3bcd1c7 100644 --- a/extensions/interactions/interactions-extension.constants.ts +++ b/extensions/interactions/interactions-extension.constants.ts @@ -16,17 +16,15 @@ * @fileoverview Constants for interactions extensions. */ -var oppia = require('AppInit.ts').module; - // Minimum confidence required for a predicted answer group to be shown to user. // Generally a threshold of 0.7-0.8 is assumed to be a good one in practice, // however value need not be in those bounds. -oppia.constant('CODE_REPL_PREDICTION_SERVICE_THRESHOLD', 0.7); +angular.module('oppia').constant('CODE_REPL_PREDICTION_SERVICE_THRESHOLD', 0.7); -oppia.constant('GRAPH_INPUT_LEFT_MARGIN', 120); +angular.module('oppia').constant('GRAPH_INPUT_LEFT_MARGIN', 120); // Gives the staff-lines human readable values. -oppia.constant('NOTE_NAMES_TO_MIDI_VALUES', { +angular.module('oppia').constant('NOTE_NAMES_TO_MIDI_VALUES', { A5: 81, G5: 79, F5: 77, @@ -45,4 +43,5 @@ oppia.constant('NOTE_NAMES_TO_MIDI_VALUES', { // Minimum confidence required for a predicted answer group to be shown to user. // Generally a threshold of 0.7-0.8 is assumed to be a good one in practice, // however value need not be in those bounds. -oppia.constant('TEXT_INPUT_PREDICTION_SERVICE_THRESHOLD', 0.7); +angular.module('oppia').constant( + 'TEXT_INPUT_PREDICTION_SERVICE_THRESHOLD', 0.7); diff --git a/extensions/objects/templates/BooleanEditorDirective.ts b/extensions/objects/templates/BooleanEditorDirective.ts index b92993d04b4f..5a222f4215ee 100644 --- a/extensions/objects/templates/BooleanEditorDirective.ts +++ b/extensions/objects/templates/BooleanEditorDirective.ts @@ -18,11 +18,9 @@ // The value for this editor is always editable. -var oppia = require('AppInit.ts').module; - -oppia.directive('booleanEditor', [ - 'UrlInterpolationService', 'OBJECT_EDITOR_URL_PREFIX', - function(UrlInterpolationService, OBJECT_EDITOR_URL_PREFIX) { +angular.module('oppia').directive('booleanEditor', [ + 'UrlInterpolationService', + function(UrlInterpolationService) { return { controllerAs: '$ctrl', controller: ['$scope', function($scope) { diff --git a/extensions/objects/templates/CodeStringEditorDirective.ts b/extensions/objects/templates/CodeStringEditorDirective.ts index 673ebca58a56..3de97c0a8d11 100644 --- a/extensions/objects/templates/CodeStringEditorDirective.ts +++ b/extensions/objects/templates/CodeStringEditorDirective.ts @@ -20,11 +20,9 @@ // may be additional customization options for the editor that should be passed // in via initArgs. -var oppia = require('AppInit.ts').module; - -oppia.directive('codeStringEditor', [ - 'UrlInterpolationService', 'OBJECT_EDITOR_URL_PREFIX', - function(UrlInterpolationService, OBJECT_EDITOR_URL_PREFIX) { +angular.module('oppia').directive('codeStringEditor', [ + 'UrlInterpolationService', + function(UrlInterpolationService) { return { restrict: 'E', scope: {}, diff --git a/extensions/objects/templates/CoordTwoDimEditorDirective.ts b/extensions/objects/templates/CoordTwoDimEditorDirective.ts index e448d0bca97e..ca71bf0e2e6f 100644 --- a/extensions/objects/templates/CoordTwoDimEditorDirective.ts +++ b/extensions/objects/templates/CoordTwoDimEditorDirective.ts @@ -16,11 +16,9 @@ * @fileoverview Directive for coord two dim editor. */ -var oppia = require('AppInit.ts').module; - -oppia.directive('coordTwoDimEditor', [ - 'UrlInterpolationService', 'OBJECT_EDITOR_URL_PREFIX', - function(UrlInterpolationService, OBJECT_EDITOR_URL_PREFIX) { +angular.module('oppia').directive('coordTwoDimEditor', [ + 'UrlInterpolationService', + function(UrlInterpolationService) { return { controllerAs: '$ctrl', controller: ['$scope', function($scope) { diff --git a/extensions/objects/templates/DragAndDropHtmlStringEditorDirective.ts b/extensions/objects/templates/DragAndDropHtmlStringEditorDirective.ts index 1fe9e8bb4187..e175a5a0b9ce 100644 --- a/extensions/objects/templates/DragAndDropHtmlStringEditorDirective.ts +++ b/extensions/objects/templates/DragAndDropHtmlStringEditorDirective.ts @@ -16,11 +16,9 @@ * @fileoverview Directive for drag and drop HTML string editor. */ -var oppia = require('AppInit.ts').module; - -oppia.directive('dragAndDropHtmlStringEditor', [ - 'UrlInterpolationService', 'OBJECT_EDITOR_URL_PREFIX', - function(UrlInterpolationService, OBJECT_EDITOR_URL_PREFIX) { +angular.module('oppia').directive('dragAndDropHtmlStringEditor', [ + 'UrlInterpolationService', + function(UrlInterpolationService) { return { restrict: 'E', scope: {}, diff --git a/extensions/objects/templates/DragAndDropPositiveIntEditorDirective.ts b/extensions/objects/templates/DragAndDropPositiveIntEditorDirective.ts index afa120388a70..87fd5ff51bb9 100644 --- a/extensions/objects/templates/DragAndDropPositiveIntEditorDirective.ts +++ b/extensions/objects/templates/DragAndDropPositiveIntEditorDirective.ts @@ -16,11 +16,9 @@ * @fileoverview Directive for drag and drop positive int editor. */ -var oppia = require('AppInit.ts').module; - -oppia.directive('dragAndDropPositiveIntEditor', [ - 'UrlInterpolationService', 'OBJECT_EDITOR_URL_PREFIX', - function(UrlInterpolationService, OBJECT_EDITOR_URL_PREFIX) { +angular.module('oppia').directive('dragAndDropPositiveIntEditor', [ + 'UrlInterpolationService', + function(UrlInterpolationService) { return { restrict: 'E', scope: {}, diff --git a/extensions/objects/templates/FilepathEditorDirective.ts b/extensions/objects/templates/FilepathEditorDirective.ts index 4a1d3aa12ad4..341260dae041 100644 --- a/extensions/objects/templates/FilepathEditorDirective.ts +++ b/extensions/objects/templates/FilepathEditorDirective.ts @@ -19,16 +19,12 @@ // This directive can only be used in the context of an exploration. require('services/CsrfTokenService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('filepathEditor', [ - '$http', '$sce', 'AlertsService', 'AssetsBackendApiService', +angular.module('oppia').directive('filepathEditor', [ + '$sce', 'AlertsService', 'AssetsBackendApiService', 'ContextService', 'CsrfTokenService', 'UrlInterpolationService', - 'OBJECT_EDITOR_URL_PREFIX', function( - $http, $sce, AlertsService, AssetsBackendApiService, - ContextService, CsrfTokenService, UrlInterpolationService, - OBJECT_EDITOR_URL_PREFIX) { + $sce, AlertsService, AssetsBackendApiService, + ContextService, CsrfTokenService, UrlInterpolationService) { return { restrict: 'E', scope: {}, diff --git a/extensions/objects/templates/FractionEditorDirective.ts b/extensions/objects/templates/FractionEditorDirective.ts index 3aa31352c3b3..4c08bd735552 100644 --- a/extensions/objects/templates/FractionEditorDirective.ts +++ b/extensions/objects/templates/FractionEditorDirective.ts @@ -16,14 +16,10 @@ * @fileoverview Directive for fraction editor. */ -var oppia = require('AppInit.ts').module; - -oppia.directive('fractionEditor', [ +angular.module('oppia').directive('fractionEditor', [ 'FractionObjectFactory', 'UrlInterpolationService', - 'OBJECT_EDITOR_URL_PREFIX', function( - FractionObjectFactory, UrlInterpolationService, - OBJECT_EDITOR_URL_PREFIX) { + FractionObjectFactory, UrlInterpolationService) { return { restrict: 'E', scope: {}, diff --git a/extensions/objects/templates/GraphEditorDirective.ts b/extensions/objects/templates/GraphEditorDirective.ts index c90c6d4e426b..dbcbcea85697 100644 --- a/extensions/objects/templates/GraphEditorDirective.ts +++ b/extensions/objects/templates/GraphEditorDirective.ts @@ -20,11 +20,9 @@ // may be additional customization options for the editor that should be passed // in via initArgs. -var oppia = require('AppInit.ts').module; - -oppia.directive('graphEditor', [ - 'UrlInterpolationService', 'OBJECT_EDITOR_URL_PREFIX', - function(UrlInterpolationService, OBJECT_EDITOR_URL_PREFIX) { +angular.module('oppia').directive('graphEditor', [ + 'UrlInterpolationService', + function(UrlInterpolationService) { return { restrict: 'E', scope: {}, diff --git a/extensions/objects/templates/GraphPropertyEditorDirective.ts b/extensions/objects/templates/GraphPropertyEditorDirective.ts index f11e98c4cca0..0d17319523ba 100644 --- a/extensions/objects/templates/GraphPropertyEditorDirective.ts +++ b/extensions/objects/templates/GraphPropertyEditorDirective.ts @@ -21,11 +21,9 @@ // may be additional customization options for the editor that should be passed // in via initArgs. -var oppia = require('AppInit.ts').module; - -oppia.directive('graphPropertyEditor', [ - 'UrlInterpolationService', 'OBJECT_EDITOR_URL_PREFIX', - function(UrlInterpolationService, OBJECT_EDITOR_URL_PREFIX) { +angular.module('oppia').directive('graphPropertyEditor', [ + 'UrlInterpolationService', + function(UrlInterpolationService) { return { restrict: 'E', scope: {}, diff --git a/extensions/objects/templates/HtmlEditorDirective.ts b/extensions/objects/templates/HtmlEditorDirective.ts index 2bfc0f5f8ce2..05f222722f60 100644 --- a/extensions/objects/templates/HtmlEditorDirective.ts +++ b/extensions/objects/templates/HtmlEditorDirective.ts @@ -22,11 +22,9 @@ // // This directive is based on the UnicodeString directive. -var oppia = require('AppInit.ts').module; - -oppia.directive('htmlEditor', [ - 'UrlInterpolationService', 'OBJECT_EDITOR_URL_PREFIX', - function(UrlInterpolationService, OBJECT_EDITOR_URL_PREFIX) { +angular.module('oppia').directive('htmlEditor', [ + 'UrlInterpolationService', + function(UrlInterpolationService) { return { restrict: 'E', scope: {}, diff --git a/extensions/objects/templates/ImageWithRegionsEditorDirective.ts b/extensions/objects/templates/ImageWithRegionsEditorDirective.ts index 834e2a478708..4a79fe51f5ff 100644 --- a/extensions/objects/templates/ImageWithRegionsEditorDirective.ts +++ b/extensions/objects/templates/ImageWithRegionsEditorDirective.ts @@ -21,15 +21,11 @@ // in via initArgs. // TODO(czx): Uniquify the labels of image regions -var oppia = require('AppInit.ts').module; - -oppia.directive('imageWithRegionsEditor', [ - '$document', '$sce', 'AlertsService', 'AssetsBackendApiService', +angular.module('oppia').directive('imageWithRegionsEditor', [ + 'AssetsBackendApiService', 'ContextService', 'UrlInterpolationService', - 'OBJECT_EDITOR_URL_PREFIX', - function($document, $sce, AlertsService, AssetsBackendApiService, - ContextService, UrlInterpolationService, - OBJECT_EDITOR_URL_PREFIX) { + function(AssetsBackendApiService, + ContextService, UrlInterpolationService) { return { restrict: 'E', scope: {}, diff --git a/extensions/objects/templates/IntEditorDirective.ts b/extensions/objects/templates/IntEditorDirective.ts index d5c388344a09..f478ee7fc2ce 100644 --- a/extensions/objects/templates/IntEditorDirective.ts +++ b/extensions/objects/templates/IntEditorDirective.ts @@ -20,11 +20,9 @@ // may be additional customization options for the editor that should be passed // in via initArgs. -var oppia = require('AppInit.ts').module; - -oppia.directive('intEditor', [ - 'UrlInterpolationService', 'OBJECT_EDITOR_URL_PREFIX', - function(UrlInterpolationService, OBJECT_EDITOR_URL_PREFIX) { +angular.module('oppia').directive('intEditor', [ + 'UrlInterpolationService', + function(UrlInterpolationService) { return { restrict: 'E', scope: {}, diff --git a/extensions/objects/templates/ListOfSetsOfHtmlStringsEditorDirective.ts b/extensions/objects/templates/ListOfSetsOfHtmlStringsEditorDirective.ts index 7112f4c6e24f..3745d523cc0b 100644 --- a/extensions/objects/templates/ListOfSetsOfHtmlStringsEditorDirective.ts +++ b/extensions/objects/templates/ListOfSetsOfHtmlStringsEditorDirective.ts @@ -16,11 +16,9 @@ * @fileoverview Directive for list of sets of html strings editor. */ -var oppia = require('AppInit.ts').module; - -oppia.directive('listOfSetsOfHtmlStringsEditor', [ - 'UrlInterpolationService', 'OBJECT_EDITOR_URL_PREFIX', - function(UrlInterpolationService, OBJECT_EDITOR_URL_PREFIX) { +angular.module('oppia').directive('listOfSetsOfHtmlStringsEditor', [ + 'UrlInterpolationService', + function(UrlInterpolationService) { return { restrict: 'E', scope: {}, diff --git a/extensions/objects/templates/ListOfTabsEditorDirective.ts b/extensions/objects/templates/ListOfTabsEditorDirective.ts index be15bde7cdbe..b5a08d45df7c 100644 --- a/extensions/objects/templates/ListOfTabsEditorDirective.ts +++ b/extensions/objects/templates/ListOfTabsEditorDirective.ts @@ -20,11 +20,9 @@ // may be additional customization options for the editor that should be passed // in via initArgs. -var oppia = require('AppInit.ts').module; - -oppia.directive('listOfTabsEditor', [ - 'UrlInterpolationService', 'OBJECT_EDITOR_URL_PREFIX', - function(UrlInterpolationService, OBJECT_EDITOR_URL_PREFIX) { +angular.module('oppia').directive('listOfTabsEditor', [ + 'UrlInterpolationService', + function(UrlInterpolationService) { return { restrict: 'E', scope: {}, diff --git a/extensions/objects/templates/ListOfUnicodeStringEditorDirective.ts b/extensions/objects/templates/ListOfUnicodeStringEditorDirective.ts index f00779281fba..42202abc94c7 100644 --- a/extensions/objects/templates/ListOfUnicodeStringEditorDirective.ts +++ b/extensions/objects/templates/ListOfUnicodeStringEditorDirective.ts @@ -20,11 +20,9 @@ // may be additional customization options for the editor that should be passed // in via initArgs. -var oppia = require('AppInit.ts').module; - -oppia.directive('listOfUnicodeStringEditor', [ - 'UrlInterpolationService', 'OBJECT_EDITOR_URL_PREFIX', - function(UrlInterpolationService, OBJECT_EDITOR_URL_PREFIX) { +angular.module('oppia').directive('listOfUnicodeStringEditor', [ + 'UrlInterpolationService', + function(UrlInterpolationService) { return { restrict: 'E', scope: {}, diff --git a/extensions/objects/templates/LogicErrorCategoryEditorDirective.ts b/extensions/objects/templates/LogicErrorCategoryEditorDirective.ts index e011596d60ba..76c550ad278e 100644 --- a/extensions/objects/templates/LogicErrorCategoryEditorDirective.ts +++ b/extensions/objects/templates/LogicErrorCategoryEditorDirective.ts @@ -20,11 +20,9 @@ // may be additional customization options for the editor that should be passed // in via initArgs. -var oppia = require('AppInit.ts').module; - -oppia.directive('logicErrorCategoryEditor', [ - 'UrlInterpolationService', 'OBJECT_EDITOR_URL_PREFIX', - function(UrlInterpolationService, OBJECT_EDITOR_URL_PREFIX) { +angular.module('oppia').directive('logicErrorCategoryEditor', [ + 'UrlInterpolationService', + function(UrlInterpolationService) { return { restrict: 'E', scope: {}, diff --git a/extensions/objects/templates/LogicQuestionEditorDirective.ts b/extensions/objects/templates/LogicQuestionEditorDirective.ts index 17436e7def03..653aff8041fb 100644 --- a/extensions/objects/templates/LogicQuestionEditorDirective.ts +++ b/extensions/objects/templates/LogicQuestionEditorDirective.ts @@ -20,11 +20,9 @@ // may be additional customization options for the editor that should be passed // in via initArgs. -var oppia = require('AppInit.ts').module; - -oppia.directive('logicQuestionEditor', [ - 'UrlInterpolationService', 'OBJECT_EDITOR_URL_PREFIX', - function(UrlInterpolationService, OBJECT_EDITOR_URL_PREFIX) { +angular.module('oppia').directive('logicQuestionEditor', [ + 'UrlInterpolationService', + function(UrlInterpolationService) { return { restrict: 'E', scope: {}, diff --git a/extensions/objects/templates/MathLatexStringEditorDirective.ts b/extensions/objects/templates/MathLatexStringEditorDirective.ts index 3bb27220dc99..939d10c0d46c 100644 --- a/extensions/objects/templates/MathLatexStringEditorDirective.ts +++ b/extensions/objects/templates/MathLatexStringEditorDirective.ts @@ -20,11 +20,9 @@ // may be additional customization options for the editor that should be passed // in via initArgs. -var oppia = require('AppInit.ts').module; - -oppia.directive('mathLatexStringEditor', [ - 'UrlInterpolationService', 'OBJECT_EDITOR_URL_PREFIX', - function(UrlInterpolationService, OBJECT_EDITOR_URL_PREFIX) { +angular.module('oppia').directive('mathLatexStringEditor', [ + 'UrlInterpolationService', + function(UrlInterpolationService) { return { restrict: 'E', scope: {}, diff --git a/extensions/objects/templates/MusicPhraseEditorDirective.ts b/extensions/objects/templates/MusicPhraseEditorDirective.ts index 230b748c01dd..e4e3e8c952c3 100644 --- a/extensions/objects/templates/MusicPhraseEditorDirective.ts +++ b/extensions/objects/templates/MusicPhraseEditorDirective.ts @@ -18,11 +18,9 @@ // This directive is always editable. -var oppia = require('AppInit.ts').module; - -oppia.directive('musicPhraseEditor', [ - 'AlertsService', 'UrlInterpolationService', 'OBJECT_EDITOR_URL_PREFIX', - function(AlertsService, UrlInterpolationService, OBJECT_EDITOR_URL_PREFIX) { +angular.module('oppia').directive('musicPhraseEditor', [ + 'AlertsService', 'UrlInterpolationService', + function(AlertsService, UrlInterpolationService) { return { restrict: 'E', scope: {}, diff --git a/extensions/objects/templates/NonnegativeIntEditorDirective.ts b/extensions/objects/templates/NonnegativeIntEditorDirective.ts index bcb8e99ad83c..9e48f4dcd4b1 100644 --- a/extensions/objects/templates/NonnegativeIntEditorDirective.ts +++ b/extensions/objects/templates/NonnegativeIntEditorDirective.ts @@ -20,11 +20,9 @@ // may be additional customization options for the editor that should be passed // in via initArgs. -var oppia = require('AppInit.ts').module; - -oppia.directive('nonnegativeIntEditor', [ - 'UrlInterpolationService', 'OBJECT_EDITOR_URL_PREFIX', - function(UrlInterpolationService, OBJECT_EDITOR_URL_PREFIX) { +angular.module('oppia').directive('nonnegativeIntEditor', [ + 'UrlInterpolationService', + function(UrlInterpolationService) { return { restrict: 'E', scope: {}, diff --git a/extensions/objects/templates/NormalizedStringEditorDirective.ts b/extensions/objects/templates/NormalizedStringEditorDirective.ts index 1cd5738c28f2..08b078839c4b 100644 --- a/extensions/objects/templates/NormalizedStringEditorDirective.ts +++ b/extensions/objects/templates/NormalizedStringEditorDirective.ts @@ -18,11 +18,9 @@ // This is a copy of the UnicodeStringEditor. -var oppia = require('AppInit.ts').module; - -oppia.directive('normalizedStringEditor', [ - 'UrlInterpolationService', 'OBJECT_EDITOR_URL_PREFIX', - function(UrlInterpolationService, OBJECT_EDITOR_URL_PREFIX) { +angular.module('oppia').directive('normalizedStringEditor', [ + 'UrlInterpolationService', + function(UrlInterpolationService) { return { restrict: 'E', scope: {}, diff --git a/extensions/objects/templates/NumberWithUnitsEditorDirective.ts b/extensions/objects/templates/NumberWithUnitsEditorDirective.ts index 7fb7a30dbf2f..10abbd25ec79 100644 --- a/extensions/objects/templates/NumberWithUnitsEditorDirective.ts +++ b/extensions/objects/templates/NumberWithUnitsEditorDirective.ts @@ -16,13 +16,9 @@ * @fileoverview Directive for number with units editor. */ -var oppia = require('AppInit.ts').module; - -oppia.directive('numberWithUnitsEditor', [ +angular.module('oppia').directive('numberWithUnitsEditor', [ 'NumberWithUnitsObjectFactory', 'UrlInterpolationService', - 'OBJECT_EDITOR_URL_PREFIX', - function(NumberWithUnitsObjectFactory, UrlInterpolationService, - OBJECT_EDITOR_URL_PREFIX) { + function(NumberWithUnitsObjectFactory, UrlInterpolationService) { return { restrict: 'E', scope: {}, diff --git a/extensions/objects/templates/ParameterNameEditorDirective.ts b/extensions/objects/templates/ParameterNameEditorDirective.ts index 26776c84a560..b344651cecd5 100644 --- a/extensions/objects/templates/ParameterNameEditorDirective.ts +++ b/extensions/objects/templates/ParameterNameEditorDirective.ts @@ -19,11 +19,9 @@ // NOTE TO DEVELOPERS: This editor requires ExplorationParamSpecsService to be // available in the context in which it is used. -var oppia = require('AppInit.ts').module; - -oppia.directive('parameterNameEditor', [ - 'UrlInterpolationService', 'OBJECT_EDITOR_URL_PREFIX', - function(UrlInterpolationService, OBJECT_EDITOR_URL_PREFIX) { +angular.module('oppia').directive('parameterNameEditor', [ + 'UrlInterpolationService', + function(UrlInterpolationService) { return { restrict: 'E', scope: {}, diff --git a/extensions/objects/templates/RealEditorDirective.ts b/extensions/objects/templates/RealEditorDirective.ts index 0fe5eab9140e..7123dab139ce 100644 --- a/extensions/objects/templates/RealEditorDirective.ts +++ b/extensions/objects/templates/RealEditorDirective.ts @@ -16,11 +16,9 @@ * @fileoverview Directive for real editor. */ -var oppia = require('AppInit.ts').module; - -oppia.directive('realEditor', [ - 'UrlInterpolationService', 'OBJECT_EDITOR_URL_PREFIX', - function(UrlInterpolationService, OBJECT_EDITOR_URL_PREFIX) { +angular.module('oppia').directive('realEditor', [ + 'UrlInterpolationService', + function(UrlInterpolationService) { return { restrict: 'E', scope: {}, diff --git a/extensions/objects/templates/SanitizedUrlEditorDirective.ts b/extensions/objects/templates/SanitizedUrlEditorDirective.ts index e4bdec6c8248..d6e7d9f2cd52 100644 --- a/extensions/objects/templates/SanitizedUrlEditorDirective.ts +++ b/extensions/objects/templates/SanitizedUrlEditorDirective.ts @@ -16,11 +16,9 @@ * @fileoverview Directive for sanitized URL editor. */ -var oppia = require('AppInit.ts').module; - -oppia.directive('sanitizedUrlEditor', [ - 'UrlInterpolationService', 'OBJECT_EDITOR_URL_PREFIX', - function(UrlInterpolationService, OBJECT_EDITOR_URL_PREFIX) { +angular.module('oppia').directive('sanitizedUrlEditor', [ + 'UrlInterpolationService', + function(UrlInterpolationService) { // Editable URL directive. return { restrict: 'E', diff --git a/extensions/objects/templates/SetOfHtmlStringEditorDirective.ts b/extensions/objects/templates/SetOfHtmlStringEditorDirective.ts index be178d6cde70..2366f000e8ea 100644 --- a/extensions/objects/templates/SetOfHtmlStringEditorDirective.ts +++ b/extensions/objects/templates/SetOfHtmlStringEditorDirective.ts @@ -20,11 +20,9 @@ // may be additional customization options for the editor that should be passed // in via initArgs. -var oppia = require('AppInit.ts').module; - -oppia.directive('setOfHtmlStringEditor', [ - 'UrlInterpolationService', 'OBJECT_EDITOR_URL_PREFIX', - function(UrlInterpolationService, OBJECT_EDITOR_URL_PREFIX) { +angular.module('oppia').directive('setOfHtmlStringEditor', [ + 'UrlInterpolationService', + function(UrlInterpolationService) { return { restrict: 'E', scope: {}, diff --git a/extensions/objects/templates/SetOfUnicodeStringEditorDirective.ts b/extensions/objects/templates/SetOfUnicodeStringEditorDirective.ts index 8d9b480da3ca..41a3e4f8cc77 100644 --- a/extensions/objects/templates/SetOfUnicodeStringEditorDirective.ts +++ b/extensions/objects/templates/SetOfUnicodeStringEditorDirective.ts @@ -20,11 +20,9 @@ // may be additional customization options for the editor that should be passed // in via initArgs. -var oppia = require('AppInit.ts').module; - -oppia.directive('setOfUnicodeStringEditor', [ - 'UrlInterpolationService', 'OBJECT_EDITOR_URL_PREFIX', - function(UrlInterpolationService, OBJECT_EDITOR_URL_PREFIX) { +angular.module('oppia').directive('setOfUnicodeStringEditor', [ + 'UrlInterpolationService', + function(UrlInterpolationService) { return { restrict: 'E', scope: {}, diff --git a/extensions/objects/templates/UnicodeStringEditorDirective.ts b/extensions/objects/templates/UnicodeStringEditorDirective.ts index 0f27b068a9f4..edf4c9f364df 100644 --- a/extensions/objects/templates/UnicodeStringEditorDirective.ts +++ b/extensions/objects/templates/UnicodeStringEditorDirective.ts @@ -20,11 +20,9 @@ // may be additional customization options for the editor that should be passed // in via initArgs. -var oppia = require('AppInit.ts').module; - -oppia.directive('unicodeStringEditor', [ - 'UrlInterpolationService', 'OBJECT_EDITOR_URL_PREFIX', - function(UrlInterpolationService, OBJECT_EDITOR_URL_PREFIX) { +angular.module('oppia').directive('unicodeStringEditor', [ + 'UrlInterpolationService', + function(UrlInterpolationService) { return { restrict: 'E', scope: {}, diff --git a/extensions/rich_text_components/Collapsible/directives/OppiaNoninteractiveCollapsibleDirective.ts b/extensions/rich_text_components/Collapsible/directives/OppiaNoninteractiveCollapsibleDirective.ts index c9d20806568f..4219e327cac8 100644 --- a/extensions/rich_text_components/Collapsible/directives/OppiaNoninteractiveCollapsibleDirective.ts +++ b/extensions/rich_text_components/Collapsible/directives/OppiaNoninteractiveCollapsibleDirective.ts @@ -23,11 +23,9 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaNoninteractiveCollapsible', [ - '$rootScope', '$sce', 'HtmlEscaperService', 'UrlInterpolationService', - function($rootScope, $sce, HtmlEscaperService, UrlInterpolationService) { +angular.module('oppia').directive('oppiaNoninteractiveCollapsible', [ + 'HtmlEscaperService', 'UrlInterpolationService', + function(HtmlEscaperService, UrlInterpolationService) { return { restrict: 'E', scope: {}, diff --git a/extensions/rich_text_components/Image/directives/OppiaNoninteractiveImageDirective.ts b/extensions/rich_text_components/Image/directives/OppiaNoninteractiveImageDirective.ts index 8c8eebb09fa9..7e1224e692b5 100644 --- a/extensions/rich_text_components/Image/directives/OppiaNoninteractiveImageDirective.ts +++ b/extensions/rich_text_components/Image/directives/OppiaNoninteractiveImageDirective.ts @@ -26,14 +26,12 @@ require('services/AssetsBackendApiService.ts'); require('services/ContextService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaNoninteractiveImage', [ - '$rootScope', '$sce', 'AssetsBackendApiService', 'ContextService', +angular.module('oppia').directive('oppiaNoninteractiveImage', [ + 'AssetsBackendApiService', 'ContextService', 'HtmlEscaperService', 'ImagePreloaderService', 'UrlInterpolationService', 'LOADING_INDICATOR_URL', function( - $rootScope, $sce, AssetsBackendApiService, ContextService, + AssetsBackendApiService, ContextService, HtmlEscaperService, ImagePreloaderService, UrlInterpolationService, LOADING_INDICATOR_URL) { return { diff --git a/extensions/rich_text_components/Link/directives/OppiaNoninteractiveLinkDirective.ts b/extensions/rich_text_components/Link/directives/OppiaNoninteractiveLinkDirective.ts index 8a291db3420c..7bce38c678c1 100644 --- a/extensions/rich_text_components/Link/directives/OppiaNoninteractiveLinkDirective.ts +++ b/extensions/rich_text_components/Link/directives/OppiaNoninteractiveLinkDirective.ts @@ -24,9 +24,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/ContextService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaNoninteractiveLink', [ +angular.module('oppia').directive('oppiaNoninteractiveLink', [ 'HtmlEscaperService', 'UrlInterpolationService', function(HtmlEscaperService, UrlInterpolationService) { return { diff --git a/extensions/rich_text_components/Math/directives/OppiaNoninteractiveMathDirective.ts b/extensions/rich_text_components/Math/directives/OppiaNoninteractiveMathDirective.ts index b6d0eef5e865..c54b7165f264 100644 --- a/extensions/rich_text_components/Math/directives/OppiaNoninteractiveMathDirective.ts +++ b/extensions/rich_text_components/Math/directives/OppiaNoninteractiveMathDirective.ts @@ -23,9 +23,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaNoninteractiveMath', [ +angular.module('oppia').directive('oppiaNoninteractiveMath', [ 'HtmlEscaperService', 'UrlInterpolationService', function(HtmlEscaperService, UrlInterpolationService) { return { diff --git a/extensions/rich_text_components/Tabs/directives/OppiaNoninteractiveTabsDirective.ts b/extensions/rich_text_components/Tabs/directives/OppiaNoninteractiveTabsDirective.ts index 2498a89e641e..b55957db94ce 100644 --- a/extensions/rich_text_components/Tabs/directives/OppiaNoninteractiveTabsDirective.ts +++ b/extensions/rich_text_components/Tabs/directives/OppiaNoninteractiveTabsDirective.ts @@ -23,9 +23,7 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaNoninteractiveTabs', [ +angular.module('oppia').directive('oppiaNoninteractiveTabs', [ 'HtmlEscaperService', 'UrlInterpolationService', function(HtmlEscaperService, UrlInterpolationService) { return { diff --git a/extensions/rich_text_components/Video/directives/OppiaNoninteractiveVideoDirective.ts b/extensions/rich_text_components/Video/directives/OppiaNoninteractiveVideoDirective.ts index 041bdb9667e1..8df09a5f3e0f 100644 --- a/extensions/rich_text_components/Video/directives/OppiaNoninteractiveVideoDirective.ts +++ b/extensions/rich_text_components/Video/directives/OppiaNoninteractiveVideoDirective.ts @@ -25,9 +25,7 @@ require('services/AutoplayedVideosService.ts'); require('services/ContextService.ts'); require('services/HtmlEscaperService.ts'); -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaNoninteractiveVideo', [ +angular.module('oppia').directive('oppiaNoninteractiveVideo', [ '$sce', 'HtmlEscaperService', 'UrlInterpolationService', function($sce, HtmlEscaperService, UrlInterpolationService) { return { diff --git a/extensions/value_generators/templates/CopierDirective.ts b/extensions/value_generators/templates/CopierDirective.ts index 87c3dc8ff31d..d9e8769a2458 100644 --- a/extensions/value_generators/templates/CopierDirective.ts +++ b/extensions/value_generators/templates/CopierDirective.ts @@ -19,9 +19,7 @@ // TODO(sll): Remove this directive (as well as the whole of the value // generators framework). -var oppia = require('AppInit.ts').module; - -oppia.directive('copier', ['$compile', function($compile) { +angular.module('oppia').directive('copier', ['$compile', function($compile) { return { link: function(scope: ICustomScope, element) { scope.getTemplateUrl = function() { diff --git a/extensions/value_generators/templates/RandomSelectorDirective.ts b/extensions/value_generators/templates/RandomSelectorDirective.ts index 01047d6c626b..2d6d41259198 100644 --- a/extensions/value_generators/templates/RandomSelectorDirective.ts +++ b/extensions/value_generators/templates/RandomSelectorDirective.ts @@ -16,39 +16,38 @@ * @fileoverview Directive for random selector value generator. */ -var oppia = require('AppInit.ts').module; - -oppia.directive('randomSelector', ['$compile', function($compile) { - return { - link: function(scope: ICustomScope, element) { - scope.getTemplateUrl = function() { - return '/value_generator_handler/' + scope.generatorId; - }; - $compile(element.contents())(scope); - }, - restrict: 'E', - scope: {}, - bindToController: { - customizationArgs: '=', - getGeneratorId: '&' - }, - template: '
', - controllerAs: '$ctrl', - controller: function() { - var ctrl = this; - ctrl.SCHEMA = { - type: 'list', - items: { - type: 'unicode' - }, - ui_config: { - add_element_text: 'Add New Choice' +angular.module('oppia').directive('randomSelector', [ + '$compile', function($compile) { + return { + link: function(scope: ICustomScope, element) { + scope.getTemplateUrl = function() { + return '/value_generator_handler/' + scope.generatorId; + }; + $compile(element.contents())(scope); + }, + restrict: 'E', + scope: {}, + bindToController: { + customizationArgs: '=', + getGeneratorId: '&' + }, + template: '
', + controllerAs: '$ctrl', + controller: function() { + var ctrl = this; + ctrl.SCHEMA = { + type: 'list', + items: { + type: 'unicode' + }, + ui_config: { + add_element_text: 'Add New Choice' + } + }; + ctrl.generatorId = ctrl.getGeneratorId(); + if (!ctrl.customizationArgs.list_of_values) { + ctrl.customizationArgs.list_of_values = []; } - }; - ctrl.generatorId = ctrl.getGeneratorId(); - if (!ctrl.customizationArgs.list_of_values) { - ctrl.customizationArgs.list_of_values = []; } - } - }; -}]); + }; + }]); diff --git a/extensions/visualizations/OppiaVisualizationBarChartDirective.ts b/extensions/visualizations/OppiaVisualizationBarChartDirective.ts index 1a6fa0f84460..c1de68bc8ca0 100644 --- a/extensions/visualizations/OppiaVisualizationBarChartDirective.ts +++ b/extensions/visualizations/OppiaVisualizationBarChartDirective.ts @@ -21,9 +21,7 @@ require('services/HtmlEscaperService.ts'); // Each visualization receives three variables: 'data', 'options', and // 'isAddressed'. The exact format for each of these is specific to the // particular visualization. -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaVisualizationBarChart', [function() { +angular.module('oppia').directive('oppiaVisualizationBarChart', [function() { return { restrict: 'E', scope: {}, diff --git a/extensions/visualizations/OppiaVisualizationEnumeratedFrequencyTableDirective.ts b/extensions/visualizations/OppiaVisualizationEnumeratedFrequencyTableDirective.ts index ffc6c2f8c0a2..7fdf4fb7c8b6 100644 --- a/extensions/visualizations/OppiaVisualizationEnumeratedFrequencyTableDirective.ts +++ b/extensions/visualizations/OppiaVisualizationEnumeratedFrequencyTableDirective.ts @@ -22,35 +22,34 @@ require('services/HtmlEscaperService.ts'); // Each visualization receives three variables: 'data', 'options', and // 'isAddressed'. The exact format for each of these is specific to the // particular visualization. -var oppia = require('AppInit.ts').module; +angular.module('oppia').directive( + 'oppiaVisualizationEnumeratedFrequencyTable', [ + 'UrlInterpolationService', function(UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: {}, + templateUrl: UrlInterpolationService.getExtensionResourceUrl( + '/visualizations/enumerated_frequency_table_directive.html'), + controllerAs: '$ctrl', + controller: [ + '$attrs', 'HtmlEscaperService', + function($attrs, HtmlEscaperService) { + var ctrl = this; + ctrl.data = HtmlEscaperService.escapedJsonToObj($attrs.escapedData); + ctrl.options = + HtmlEscaperService.escapedJsonToObj($attrs.escapedOptions); + ctrl.addressedInfoIsSupported = $attrs.addressedInfoIsSupported; -oppia.directive('oppiaVisualizationEnumeratedFrequencyTable', [ - 'UrlInterpolationService', function(UrlInterpolationService) { - return { - restrict: 'E', - scope: {}, - bindToController: {}, - templateUrl: UrlInterpolationService.getExtensionResourceUrl( - '/visualizations/enumerated_frequency_table_directive.html'), - controllerAs: '$ctrl', - controller: [ - '$attrs', 'HtmlEscaperService', - function($attrs, HtmlEscaperService) { - var ctrl = this; - ctrl.data = HtmlEscaperService.escapedJsonToObj($attrs.escapedData); - ctrl.options = - HtmlEscaperService.escapedJsonToObj($attrs.escapedOptions); - ctrl.addressedInfoIsSupported = $attrs.addressedInfoIsSupported; - - ctrl.answerVisible = ctrl.data.map(function(_, i) { - // First element is shown while all others are hidden by default. - return i === 0; - }); - ctrl.toggleAnswerVisibility = function(i) { - ctrl.answerVisible[i] = !ctrl.answerVisible[i]; - }; - } - ] - }; - } -]); + ctrl.answerVisible = ctrl.data.map(function(_, i) { + // First element is shown while all others are hidden by default. + return i === 0; + }); + ctrl.toggleAnswerVisibility = function(i) { + ctrl.answerVisible[i] = !ctrl.answerVisible[i]; + }; + } + ] + }; + } + ]); diff --git a/extensions/visualizations/OppiaVisualizationFrequencyTableDirective.ts b/extensions/visualizations/OppiaVisualizationFrequencyTableDirective.ts index 0c40e33a6245..13bddaa61a10 100644 --- a/extensions/visualizations/OppiaVisualizationFrequencyTableDirective.ts +++ b/extensions/visualizations/OppiaVisualizationFrequencyTableDirective.ts @@ -22,9 +22,7 @@ require('services/HtmlEscaperService.ts'); // Each visualization receives three variables: 'data', 'options', and // 'isAddressed'. The exact format for each of these is specific to the // particular visualization. -var oppia = require('AppInit.ts').module; - -oppia.directive('oppiaVisualizationFrequencyTable', [ +angular.module('oppia').directive('oppiaVisualizationFrequencyTable', [ 'UrlInterpolationService', function(UrlInterpolationService) { return { restrict: 'E', diff --git a/scripts/create_expression_parser.sh b/scripts/create_expression_parser.sh index 930cb038e1e7..6e306ea94ef4 100755 --- a/scripts/create_expression_parser.sh +++ b/scripts/create_expression_parser.sh @@ -50,7 +50,7 @@ if [ ! -d "$NODE_MODULE_DIR/pegjs" ]; then fi $NODE_MODULE_DIR/pegjs/bin/pegjs $EXPRESSION_PARSER_DEFINITION $EXPRESSION_PARSER_JS -sed -i "s/module\.exports.*$/oppia.factory('ExpressionParserService', ['\$log', function(\$log) {/" $EXPRESSION_PARSER_JS +sed -i "s/module\.exports.*$/angular.module('oppia').factory('ExpressionParserService', ['\$log', function(\$log) {/" $EXPRESSION_PARSER_JS sed -i 's/^})();\s*$/}]);/' $EXPRESSION_PARSER_JS diff --git a/webpack.config.ts b/webpack.config.ts index bf2cc6ca0f84..7c7b402026bf 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -64,10 +64,10 @@ module.exports = { 'topic-landing-page.scripts.ts', learner_dashboard: commonPrefix + '/pages/learner-dashboard-page/' + - 'learner-dashboard-page.controller.ts', + 'learner-dashboard-page.scripts.ts', library: commonPrefix + '/pages/library-page/library-page.scripts.ts', maintenance: - commonPrefix + '/pages/maintenance-page/maintenance-page.controller.ts', + commonPrefix + '/pages/maintenance-page/maintenance-page.scripts.ts', moderator: commonPrefix + '/pages/moderator-page/moderator-page.scripts.ts', notifications_dashboard: @@ -76,7 +76,7 @@ module.exports = { practice_session: commonPrefix + '/pages/practice-session-page/' + 'practice-session-page.scripts.ts', - privacy: commonPrefix + '/pages/privacy-page/privacy-page.controller.ts', + privacy: commonPrefix + '/pages/privacy-page/privacy-page.scripts.ts', preferences: commonPrefix + '/pages/preferences-page/preferences-page.scripts.ts', profile: commonPrefix + '/pages/profile-page/profile-page.scripts.ts', @@ -94,8 +94,8 @@ module.exports = { story_viewer: commonPrefix + '/pages/story-viewer-page/story-viewer-page.scripts.ts', teach: commonPrefix + '/pages/teach-page/teach-page.scripts.ts', - terms: commonPrefix + '/pages/terms-page/terms-page.controller.ts', - thanks: commonPrefix + '/pages/thanks-page/thanks-page.controller.ts', + terms: commonPrefix + '/pages/terms-page/terms-page.scripts.ts', + thanks: commonPrefix + '/pages/thanks-page/thanks-page.scripts.ts', topic_editor: commonPrefix + '/pages/topic-editor-page/topic-editor-page.scripts.ts', topics_and_skills_dashboard: (