mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
Fixed adding and removing tags on tasks
This commit is contained in:
@@ -33,9 +33,7 @@ habitrpg.controller("TasksCtrl", ['$scope', '$rootScope', '$location', 'User','N
|
||||
var newTask = {
|
||||
text: task,
|
||||
type: listDef.type,
|
||||
// tags: _.transform(User.user.filters, function(m, v, k) {
|
||||
// if (v) m.push(v);
|
||||
// }),
|
||||
tags: _.keys(User.user.filters),
|
||||
};
|
||||
|
||||
User.addTask({body: newTask});
|
||||
@@ -272,4 +270,21 @@ habitrpg.controller("TasksCtrl", ['$scope', '$rootScope', '$location', 'User','N
|
||||
$rootScope.playSound('Reward');
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
------------------------
|
||||
Tags
|
||||
------------------------
|
||||
*/
|
||||
|
||||
$scope.updateTaskTags = function (tagId, task) {
|
||||
var tagIndex = task.tags.indexOf(tagId);
|
||||
if (tagIndex === -1) {
|
||||
Tasks.addTagToTask(task._id, tagId);
|
||||
task.tags.push(tagId);
|
||||
} else {
|
||||
Tasks.removeTagFromTask(task._id, tagId);
|
||||
task.tags.splice(tagIndex, 0);
|
||||
}
|
||||
}
|
||||
}]);
|
||||
|
||||
Reference in New Issue
Block a user