feat: allowing modification of challenge tasks after challenge creation. fixes #7320

closes #7877
This commit is contained in:
Husman
2016-08-06 15:32:03 -07:00
committed by Blade Barringer
parent 89822222fe
commit 725c3b36f3
10 changed files with 104 additions and 17 deletions

View File

@@ -1,5 +1,5 @@
habitrpg.controller("ChallengesCtrl", ['$rootScope','$scope', 'Shared', 'User', 'Challenges', 'Notification', '$compile', 'Groups', '$state', '$stateParams', 'Members', 'Tasks', 'TAVERN_ID',
function($rootScope, $scope, Shared, User, Challenges, Notification, $compile, Groups, $state, $stateParams, Members, Tasks, TAVERN_ID) {
habitrpg.controller("ChallengesCtrl", ['$rootScope','$scope', 'Shared', 'User', 'Tasks', 'Challenges', 'Notification', '$compile', 'Groups', '$state', '$stateParams', 'Members', 'Tasks', 'TAVERN_ID',
function($rootScope, $scope, Shared, User, Tasks, Challenges, Notification, $compile, Groups, $state, $stateParams, Members, Tasks, TAVERN_ID) {
// Use presence of cid to determine whether to show a list or a single
// challenge
@@ -36,6 +36,22 @@ habitrpg.controller("ChallengesCtrl", ['$rootScope','$scope', 'Shared', 'User',
$scope.editTask = Tasks.editTask;
$scope.canEdit = function(task) {
return true;
}
$scope.doubleClickTask = function (obj, task) {
if (obj._locked) {
return false;
}
if (task._editing) {
$scope.saveTask(task);
} else {
$scope.editTask(task);
}
}
/**
* Create
*/
@@ -274,8 +290,8 @@ habitrpg.controller("ChallengesCtrl", ['$rootScope','$scope', 'Shared', 'User',
};
$scope.saveTask = function(task){
Tasks.updateTask(task._id, task);
task._editing = false;
// TODO persist
}
$scope.toggleBulk = function(list) {