Fixed lint issues with model in task services (#8523)

This commit is contained in:
Keith Holliday
2017-03-02 08:16:28 -07:00
committed by GitHub
parent 0cb254d5fc
commit be64274be4
3 changed files with 8 additions and 7 deletions

View File

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

View File

@@ -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

View File

@@ -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