diff --git a/website/client-old/js/services/taskServices.js b/website/client-old/js/services/taskServices.js index dfd9c3ebd7..52d763c8a7 100644 --- a/website/client-old/js/services/taskServices.js +++ b/website/client-old/js/services/taskServices.js @@ -3,8 +3,8 @@ var TASK_KEYS_TO_REMOVE = ['_id', 'completed', 'date', 'dateCompleted', 'history', 'id', 'streak', 'createdAt', 'challenge']; angular.module('habitrpg') -.factory('Tasks', ['$rootScope', 'Shared', '$http', - function tasksFactory($rootScope, Shared, $http) { +.factory('Tasks', ['$rootScope', 'Shared', '$http', '$modal', + function tasksFactory($rootScope, Shared, $http, $modal) { function addTasks(listDef, addTaskFn) { var tasks = listDef.newTask; @@ -256,6 +256,7 @@ angular.module('habitrpg') }; function editTask(task, user, taskStatus, scopeInc) { + // @TODO: This should be it's own controller. And methods should be abstracted form the three task ctrls to a directive/ctrl var modalScope = $rootScope.$new(); modalScope.task = task; modalScope.task._editing = true; @@ -286,9 +287,10 @@ angular.module('habitrpg') modalScope.task._edit.repeatsOn = 'dayOfWeek'; } - $rootScope.openModal('task-edit', { + $modal.open({ scope: modalScope, - controller: function ($scope) { + templateUrl: 'modals/task-edit.html', + controller: ['$scope', function ($scope) { $scope.$watch('task._edit', function (newValue, oldValue) { if ($scope.task.type !== 'daily') return; $scope.summary = generateSummary($scope.task); @@ -311,7 +313,7 @@ angular.module('habitrpg') $scope.task._edit.repeat[shortDay] = true; } }, true); - }, + }], }) .result.catch(function() { cancelTaskEdit(task); diff --git a/website/views/shared/modals/task-notes.jade b/website/views/shared/modals/task-notes.jade index 2914795287..fcad3da5c5 100644 --- a/website/views/shared/modals/task-notes.jade +++ b/website/views/shared/modals/task-notes.jade @@ -1,4 +1,4 @@ -script(id='modals/task-notes.html', type='text/ng-template') +script(type='text/ng-template', id='modals/task-notes.html') .modal-header h4 Task Notes diff --git a/website/views/shared/modals/tasks-edit.jade b/website/views/shared/modals/tasks-edit.jade index 2dbe112d23..0ed820bb76 100644 --- a/website/views/shared/modals/tasks-edit.jade +++ b/website/views/shared/modals/tasks-edit.jade @@ -1,7 +1,6 @@ script(type='text/ng-template', id='modals/task-edit.html') .modal-content.task-modal(style='min-width:22em', class='{{taskStatus}}', id="task-{{task._id}}") .modal-body.text-center(style='padding-bottom:0') - | {{scope}} include ../tasks/edit/index .modal-footer(style='margin-top:0') .container-fluid