Group plans reorder tasks (#8358)

* Added move route for group tasks

* Added group task reorder to front end

* Added syncing with group task order

* Fixed linting issues

* Added missing exec and abstracted move code

* Added unit test for moveTask
This commit is contained in:
Keith Holliday
2017-01-11 11:16:20 -07:00
committed by Matteo Pagliazzi
parent 2690caed35
commit 1590d955cd
9 changed files with 191 additions and 21 deletions

View File

@@ -6,10 +6,11 @@
.directive('hrpgSortTasks', hrpgSortTasks);
hrpgSortTasks.$inject = [
'User'
'User',
'Tasks',
];
function hrpgSortTasks(User) {
function hrpgSortTasks(User, Tasks) {
return function($scope, element, attrs, ngModel) {
$(element).sortable({
axis: "y",
@@ -20,6 +21,13 @@
stop: function (event, ui) {
var task = angular.element(ui.item[0]).scope().task;
var startIndex = ui.item.data('startIndex');
// Check if task is a group original task
if (task.group.id && !task.userId) {
Tasks.moveGroupTask(task._id, ui.item.index());
return;
}
User.sortTask({
params: { id: task._id, taskType: task.type },
query: {