mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 23:27:26 +01:00
feat: allowing modification of challenge tasks after challenge creation. fixes #7320
closes #7877
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user