Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate remaining constants into individual files. #6996

Merged
merged 13 commits into from
Jun 25, 2019
Next Next commit
Services
  • Loading branch information
YashJipkate committed Jun 18, 2019
commit 389110972ee117b585a83364d7049a0052377309
13 changes: 1 addition & 12 deletions core/templates/dev/head/services/ContextService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,7 @@
* context.
*/

oppia.constant('PAGE_CONTEXT', {
EXPLORATION_EDITOR: 'editor',
EXPLORATION_PLAYER: 'learner',
QUESTION_EDITOR: 'question_editor',
QUESTION_PLAYER: 'question_player',
OTHER: 'other'
});

oppia.constant('EXPLORATION_EDITOR_TAB_CONTEXT', {
EDITOR: 'editor',
PREVIEW: 'preview'
});
require('services/services.constants.ts');

oppia.factory('ContextService', [
'UrlService', 'EXPLORATION_EDITOR_TAB_CONTEXT', 'PAGE_CONTEXT',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
* configured to support.
*/

oppia.constant(
'EXPLORATION_FEATURES_URL', '/explorehandler/features/<exploration_id>');
require('services/services.constants.ts');

oppia.factory('ExplorationFeaturesBackendApiService', [
'$http', 'UrlInterpolationService', 'EXPLORATION_FEATURES_URL',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,7 @@ require('domain/statistics/PlaythroughObjectFactory.ts');
require('domain/statistics/PlaythroughIssueObjectFactory.ts');
require('domain/utilities/UrlInterpolationService.ts');

oppia.constant(
'FETCH_ISSUES_URL', '/issuesdatahandler/<exploration_id>');

oppia.constant(
'FETCH_PLAYTHROUGH_URL',
'/playthroughdatahandler/<exploration_id>/<playthrough_id>');

oppia.constant(
'RESOLVE_ISSUE_URL', '/resolveissuehandler/<exploration_id>');
require('services/services.constants.ts');

oppia.factory('PlaythroughIssuesBackendApiService', [
'$http', 'PlaythroughIssueObjectFactory', 'PlaythroughObjectFactory',
Expand Down
11 changes: 1 addition & 10 deletions core/templates/dev/head/services/PlaythroughService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,7 @@ require('domain/utilities/StopwatchObjectFactory.ts');
require('domain/utilities/UrlInterpolationService.ts');
require('services/ExplorationFeaturesService.ts');

oppia.constant(
'STORE_PLAYTHROUGH_URL',
'/explorehandler/store_playthrough/<exploration_id>');

// 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);
require('services/services.constants.ts');

oppia.factory('PlaythroughService', [
'$http', 'ExplorationFeaturesService', 'LearnerActionObjectFactory',
Expand Down
6 changes: 1 addition & 5 deletions core/templates/dev/head/services/PromoBarService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@
* @fileoverview Service Promo bar.
*/

// 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);
require('services/services.constants.ts');

oppia.factory('PromoBarService', [
'$http', '$q', 'ENABLE_PROMO_BAR',
Expand Down
2 changes: 1 addition & 1 deletion core/templates/dev/head/services/RteHelperService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* @fileoverview A helper service for the Rich text editor(RTE).
*/

oppia.constant('RTE_COMPONENT_SPECS', richTextComponents);
require('services/services.constants.ts');

oppia.factory('RteHelperService', [
'$document', '$filter', '$interpolate', '$log', '$uibModal',
Expand Down
2 changes: 1 addition & 1 deletion core/templates/dev/head/services/SearchService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* @fileoverview search service for activityTilesInfinityGrid
*/

oppia.constant('SEARCH_DATA_URL', '/searchhandler/data');
require('services/services.constants.ts');

oppia.factory('SearchService', [
'$http', '$log', '$rootScope', '$translate', 'SEARCH_DATA_URL',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
* @fileoverview Service to fetch statistics about an exploration's states.
*/

oppia.constant(
'STATE_ANSWER_STATS_URL',
'/createhandler/state_answer_stats/<exploration_id>');
require('services/services.constants.ts');

oppia.factory('StateTopAnswersStatsBackendApiService', [
'$http', 'UrlInterpolationService', 'STATE_ANSWER_STATS_URL',
Expand Down
68 changes: 68 additions & 0 deletions core/templates/dev/head/services/services.constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// Copyright 2018 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 Constants for shared services across Oppia.
*/

oppia.constant('PAGE_CONTEXT', {
EXPLORATION_EDITOR: 'editor',
EXPLORATION_PLAYER: 'learner',
QUESTION_EDITOR: 'question_editor',
QUESTION_PLAYER: 'question_player',
OTHER: 'other'
});

oppia.constant('EXPLORATION_EDITOR_TAB_CONTEXT', {
EDITOR: 'editor',
PREVIEW: 'preview'
});

oppia.constant(
'EXPLORATION_FEATURES_URL', '/explorehandler/features/<exploration_id>');

oppia.constant(
'FETCH_ISSUES_URL', '/issuesdatahandler/<exploration_id>');

oppia.constant(
'FETCH_PLAYTHROUGH_URL',
'/playthroughdatahandler/<exploration_id>/<playthrough_id>');

oppia.constant(
'RESOLVE_ISSUE_URL', '/resolveissuehandler/<exploration_id>');

oppia.constant(
'STORE_PLAYTHROUGH_URL',
'/explorehandler/store_playthrough/<exploration_id>');

// 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);

// 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);

oppia.constant('RTE_COMPONENT_SPECS', richTextComponents);

oppia.constant('SEARCH_DATA_URL', '/searchhandler/data');

oppia.constant(
'STATE_ANSWER_STATS_URL',
'/createhandler/state_answer_stats/<exploration_id>');