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

Fix part of #3825: Rename angular services in Group 5 #4111

Merged
merged 11 commits into from
Nov 25, 2017
Merged
24 changes: 12 additions & 12 deletions core/templates/dev/head/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ oppia.constant('RTE_COMPONENT_SPECS', richTextComponents);
oppia.config(['$provide', function($provide) {
$provide.decorator('taOptions', [
'$delegate', '$document', '$modal', '$timeout', 'FocusManagerService',
'taRegisterTool', 'rteHelperService', 'alertsService',
'explorationContextService', 'PAGE_CONTEXT',
'taRegisterTool', 'rteHelperService', 'AlertsService',
'ExplorationContextService', 'PAGE_CONTEXT',
'UrlInterpolationService',
function(
taOptions, $document, $modal, $timeout, FocusManagerService,
taRegisterTool, rteHelperService, alertsService,
explorationContextService, PAGE_CONTEXT,
taRegisterTool, rteHelperService, AlertsService,
ExplorationContextService, PAGE_CONTEXT,
UrlInterpolationService) {
taOptions.disableSanitizer = true;
taOptions.forceTextAngularSanitize = false;
Expand Down Expand Up @@ -163,7 +163,7 @@ oppia.config(['$provide', function($provide) {

rteHelperService.getRichTextComponents().forEach(function(componentDefn) {
var buttonDisplay = rteHelperService.createToolbarIcon(componentDefn);
var canUseFs = explorationContextService.getPageContext() ===
var canUseFs = ExplorationContextService.getPageContext() ===
PAGE_CONTEXT.EDITOR;

taRegisterTool(componentDefn.id, {
Expand All @@ -185,7 +185,7 @@ oppia.config(['$provide', function($provide) {
if (!canUseFs && componentDefn.requiresFs) {
var FS_UNAUTHORIZED_WARNING = 'Unfortunately, only ' +
'exploration authors can make changes involving files.';
alertsService.addWarning(FS_UNAUTHORIZED_WARNING);
AlertsService.addWarning(FS_UNAUTHORIZED_WARNING);
// Without this, the view will not update to show the warning.
textAngular.$editor().$parent.$apply();
return;
Expand Down Expand Up @@ -302,7 +302,7 @@ oppia.config([
// Add an interceptor to convert requests to strings and to log and show
// warnings for error responses.
$httpProvider.interceptors.push([
'$q', '$log', 'alertsService', function($q, $log, alertsService) {
'$q', '$log', 'AlertsService', function($q, $log, AlertsService) {
return {
request: function(config) {
if (config.data) {
Expand All @@ -327,7 +327,7 @@ oppia.config([
if (rejection.data && rejection.data.error) {
warningMessage = rejection.data.error;
}
alertsService.addWarning(warningMessage);
AlertsService.addWarning(warningMessage);
}
return $q.reject(rejection);
}
Expand Down Expand Up @@ -451,10 +451,10 @@ oppia.factory('oppiaDatetimeFormatter', ['$filter', function($filter) {
}]);

oppia.factory('rteHelperService', [
'$filter', '$log', '$interpolate', 'explorationContextService',
'$filter', '$log', '$interpolate', 'ExplorationContextService',
'RTE_COMPONENT_SPECS', 'HtmlEscaperService', 'UrlInterpolationService',
function(
$filter, $log, $interpolate, explorationContextService,
$filter, $log, $interpolate, ExplorationContextService,
RTE_COMPONENT_SPECS, HtmlEscaperService, UrlInterpolationService) {
var _RICH_TEXT_COMPONENTS = [];

Expand Down Expand Up @@ -509,7 +509,7 @@ oppia.factory('rteHelperService', [
// Returns a DOM node.
createRteElement: function(componentDefn, customizationArgsDict) {
var el = $('<img/>');
if (explorationContextService.isInExplorationContext()) {
if (ExplorationContextService.isInExplorationContext()) {
// TODO(sll): This extra key was introduced in commit
// 19a934ce20d592a3fc46bd97a2f05f41d33e3d66 in order to retrieve an
// image for RTE previews. However, it has had the unfortunate side-
Expand All @@ -518,7 +518,7 @@ oppia.factory('rteHelperService', [
// convertRteToHtml(), but we need to find a less invasive way to
// handle previews.
customizationArgsDict = angular.extend(customizationArgsDict, {
explorationId: explorationContextService.getExplorationId()
explorationId: ExplorationContextService.getExplorationId()
});
}
var componentPreviewUrlTemplate = componentDefn.previewUrlTemplate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ oppia.directive('answerGroupEditor', [
'answer_group_editor_directive.html'),
controller: [
'$scope', 'stateInteractionIdService', 'ResponsesService',
'EditorStateService', 'alertsService', 'INTERACTION_SPECS',
'EditorStateService', 'AlertsService', 'INTERACTION_SPECS',
'RULE_TYPE_CLASSIFIER', 'RuleObjectFactory',
function(
$scope, stateInteractionIdService, ResponsesService,
EditorStateService, alertsService, INTERACTION_SPECS,
EditorStateService, AlertsService, INTERACTION_SPECS,
RULE_TYPE_CLASSIFIER, RuleObjectFactory) {
$scope.rulesMemento = null;
$scope.activeRuleIndex = ResponsesService.getActiveRuleIndex();
Expand Down Expand Up @@ -203,7 +203,7 @@ oppia.directive('answerGroupEditor', [
$scope.saveRules();

if ($scope.rules.length === 0) {
alertsService.addWarning(
AlertsService.addWarning(
'All answer groups must have at least one rule.');
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ oppia.directive('classifierRulePanel', [
'/components/' +
'classifier_panel_directive.html'),
controller: [
'$scope', '$modal', 'oppiaExplorationHtmlFormatterService',
'$scope', '$modal', 'ExplorationHtmlFormatterService',
'stateInteractionIdService', 'stateCustomizationArgsService',
'TrainingModalService',
function($scope, $modal, oppiaExplorationHtmlFormatterService,
function($scope, $modal, ExplorationHtmlFormatterService,
stateInteractionIdService, stateCustomizationArgsService,
TrainingModalService) {
$scope.trainingDataHtmlList = [];
var trainingData = $scope.ruleInputs.training_data;
for (var i = 0; i < trainingData.length; i++) {
$scope.trainingDataHtmlList.push(
oppiaExplorationHtmlFormatterService.getShortAnswerHtml(
ExplorationHtmlFormatterService.getShortAnswerHtml(
trainingData[i], stateInteractionIdService.savedMemento,
stateCustomizationArgsService.savedMemento));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
// ExplorationCreationService.

oppia.factory('CollectionCreationService', [
'$http', '$window', '$rootScope', '$timeout', 'alertsService',
'$http', '$window', '$rootScope', '$timeout', 'AlertsService',
'UrlInterpolationService', 'siteAnalyticsService',
function(
$http, $window, $rootScope, $timeout, alertsService,
$http, $window, $rootScope, $timeout, AlertsService,
UrlInterpolationService, siteAnalyticsService) {
var CREATE_NEW_COLLECTION_URL_TEMPLATE = (
'/collection_editor/create/<collection_id>');
Expand All @@ -37,7 +37,7 @@ oppia.factory('CollectionCreationService', [
}

collectionCreationInProgress = true;
alertsService.clearWarnings();
AlertsService.clearWarnings();

$rootScope.loadingMessage = 'Creating collection';
$http.post('/collection_editor_handler/create_new', {})
Expand Down
14 changes: 7 additions & 7 deletions core/templates/dev/head/components/ExplorationCreationService.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@

oppia.factory('ExplorationCreationService', [
'$http', '$modal', '$timeout', '$rootScope', '$window',
'alertsService', 'siteAnalyticsService', 'UrlInterpolationService',
'AlertsService', 'siteAnalyticsService', 'UrlInterpolationService',
function(
$http, $modal, $timeout, $rootScope, $window,
alertsService, siteAnalyticsService, UrlInterpolationService) {
AlertsService, siteAnalyticsService, UrlInterpolationService) {
var CREATE_NEW_EXPLORATION_URL_TEMPLATE = '/create/<exploration_id>';

var explorationCreationInProgress = false;
Expand All @@ -34,7 +34,7 @@ oppia.factory('ExplorationCreationService', [
}

explorationCreationInProgress = true;
alertsService.clearWarnings();
AlertsService.clearWarnings();
$rootScope.loadingMessage = 'Creating exploration';

$http.post('/contributehandler/create_new', {
Expand All @@ -55,7 +55,7 @@ oppia.factory('ExplorationCreationService', [
});
},
showUploadExplorationModal: function() {
alertsService.clearWarnings();
AlertsService.clearWarnings();

$modal.open({
backdrop: true,
Expand All @@ -68,7 +68,7 @@ oppia.factory('ExplorationCreationService', [
var returnObj = {};
var file = document.getElementById('newFileInput').files[0];
if (!file || !file.size) {
alertsService.addWarning('Empty file detected.');
AlertsService.addWarning('Empty file detected.');
return;
}
returnObj.yamlFile = file;
Expand All @@ -78,7 +78,7 @@ oppia.factory('ExplorationCreationService', [

$scope.cancel = function() {
$modalInstance.dismiss('cancel');
alertsService.clearWarnings();
AlertsService.clearWarnings();
};
}
]
Expand Down Expand Up @@ -112,7 +112,7 @@ oppia.factory('ExplorationCreationService', [
}).fail(function(data) {
var transformedData = data.responseText.substring(5);
var parsedResponse = JSON.parse(transformedData);
alertsService.addWarning(
AlertsService.addWarning(
parsedResponse.error || 'Error communicating with server.');
$rootScope.loadingMessage = '';
$scope.$apply();
Expand Down
22 changes: 11 additions & 11 deletions core/templates/dev/head/components/SolutionEditorDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@
oppia.directive('solutionEditor', [
'$modal', 'UrlInterpolationService', 'stateSolutionService',
'EditorStateService', 'explorationStatesService',
'explorationWarningsService', 'alertsService',
'explorationWarningsService', 'AlertsService',
'SolutionObjectFactory', 'SolutionVerificationService',
'explorationContextService', 'oppiaExplorationHtmlFormatterService',
'ExplorationContextService', 'ExplorationHtmlFormatterService',
'stateInteractionIdService', 'stateCustomizationArgsService',
'INFO_MESSAGE_SOLUTION_IS_INVALID',
function($modal, UrlInterpolationService, stateSolutionService,
EditorStateService, explorationStatesService,
explorationWarningsService, alertsService,
explorationWarningsService, AlertsService,
SolutionObjectFactory, SolutionVerificationService,
explorationContextService, oppiaExplorationHtmlFormatterService,
ExplorationContextService, ExplorationHtmlFormatterService,
stateInteractionIdService, stateCustomizationArgsService,
INFO_MESSAGE_SOLUTION_IS_INVALID) {
return {
Expand All @@ -50,7 +50,7 @@ oppia.directive('solutionEditor', [
};

$scope.getAnswerHtml = function () {
return oppiaExplorationHtmlFormatterService.getAnswerHtml(
return ExplorationHtmlFormatterService.getAnswerHtml(
stateSolutionService.savedMemento.correctAnswer,
stateInteractionIdService.savedMemento,
stateCustomizationArgsService.savedMemento);
Expand All @@ -65,17 +65,17 @@ oppia.directive('solutionEditor', [
controller: [
'$scope', '$modalInstance', 'stateInteractionIdService',
'stateSolutionService', 'EditorStateService',
'oppiaExplorationHtmlFormatterService',
'ExplorationHtmlFormatterService',
'explorationStatesService',
function($scope, $modalInstance, stateInteractionIdService,
stateSolutionService, EditorStateService,
oppiaExplorationHtmlFormatterService,
ExplorationHtmlFormatterService,
explorationStatesService) {
$scope.SOLUTION_EDITOR_FOCUS_LABEL = (
'currentCorrectAnswerEditorHtmlForSolutionEditor');
$scope.correctAnswer = null;
$scope.correctAnswerEditorHtml = (
oppiaExplorationHtmlFormatterService.getInteractionHtml(
ExplorationHtmlFormatterService.getInteractionHtml(
stateInteractionIdService.savedMemento,
/* eslint-disable max-len */
explorationStatesService.getInteractionCustomizationArgsMemento(
Expand Down Expand Up @@ -113,7 +113,7 @@ oppia.directive('solutionEditor', [

$scope.cancel = function() {
$modalInstance.dismiss('cancel');
alertsService.clearWarnings();
AlertsService.clearWarnings();
};
}
]
Expand All @@ -122,7 +122,7 @@ oppia.directive('solutionEditor', [
var currentStateName = EditorStateService.getActiveStateName();
var state = explorationStatesService.getState(currentStateName);
SolutionVerificationService.verifySolution(
explorationContextService.getExplorationId(),
ExplorationContextService.getExplorationId(),
state,
correctAnswer,
function () {
Expand All @@ -134,7 +134,7 @@ oppia.directive('solutionEditor', [
explorationStatesService.updateSolutionValidity(
currentStateName, false);
explorationWarningsService.updateWarnings();
alertsService.addInfoMessage(
AlertsService.addInfoMessage(
INFO_MESSAGE_SOLUTION_IS_INVALID);
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,15 +250,15 @@ oppia.directive('versionDiffVisualization', [
controller: [
'$scope', '$http', '$modalInstance', '$timeout', 'newStateName',
'oldStateName', 'newState', 'oldState', 'headers',
'explorationContextService', 'UrlInterpolationService',
'ExplorationContextService', 'UrlInterpolationService',
function(
$scope, $http, $modalInstance, $timeout, newStateName,
oldStateName, newState, oldState, headers,
explorationContextService, UrlInterpolationService) {
ExplorationContextService, UrlInterpolationService) {
var STATE_YAML_URL = UrlInterpolationService.interpolateUrl(
'/createhandler/state_yaml/<exploration_id>', {
exploration_id: (
explorationContextService.getExplorationId())
ExplorationContextService.getExplorationId())
});

$scope.headers = headers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ oppia.directive('alertMessage', [function() {
},
template: '<div class="oppia-alert-message"></div>',
controller: [
'$scope', 'alertsService', 'toastr',
function($scope, alertsService, toastr) {
$scope.alertsService = alertsService;
'$scope', 'AlertsService', 'toastr',
function($scope, AlertsService, toastr) {
$scope.AlertsService = AlertsService;
$scope.toastr = toastr;
}
],
Expand All @@ -36,13 +36,13 @@ oppia.directive('alertMessage', [function() {
if (message.type === 'info') {
scope.toastr.info(message.content, {
onHidden: function() {
scope.alertsService.deleteMessage(message);
scope.AlertsService.deleteMessage(message);
}
});
} else if (message.type === 'success') {
scope.toastr.success(message.content, {
onHidden: function() {
scope.alertsService.deleteMessage(message);
scope.AlertsService.deleteMessage(message);
}
});
}
Expand Down
Loading