Prevent dropping in not writable lists

This commit is contained in:
Raimund Schlüßler 2016-03-15 21:18:34 +01:00
parent f21d86129b
commit b2a87ca8bc
3 changed files with 21 additions and 6 deletions

View file

@ -328,15 +328,22 @@
this._$scope.dragover = function($event, item, index) {
$('.subtasks-container').removeClass('dropzone-visible');
$($event.target).closest('.task-item').children('.subtasks-container').addClass('dropzone-visible');
return true;
var calendarID = $('li.dndPlaceholder').closest('ol[dnd-list]').attr('calendarID');
var calendar = _$listsmodel.getByUri(calendarID);
if (calendar.writable) {
$($event.target).closest('.task-item').children('.subtasks-container').addClass('dropzone-visible');
return true;
} else {
return false;
}
};
}
return TasksController;
})();
return new TasksController($scope, $window, $routeParams, TasksModel, ListsModel, CollectionsModel, TasksBusinessLayer, $location, SettingsBusinessLayer, SearchBusinessLayer, VTodo);
return new TasksController($scope, $window, $routeParams, TasksModel, ListsModel, CollectionsModel, TasksBusinessLayer, $location, SettingsBusinessLayer,
SearchBusinessLayer, VTodo);
}
]);

View file

@ -1119,15 +1119,22 @@ angular.module('Tasks').controller('SettingsController', [
this._$scope.dragover = function($event, item, index) {
$('.subtasks-container').removeClass('dropzone-visible');
$($event.target).closest('.task-item').children('.subtasks-container').addClass('dropzone-visible');
return true;
var calendarID = $('li.dndPlaceholder').closest('ol[dnd-list]').attr('calendarID');
var calendar = _$listsmodel.getByUri(calendarID);
if (calendar.writable) {
$($event.target).closest('.task-item').children('.subtasks-container').addClass('dropzone-visible');
return true;
} else {
return false;
}
};
}
return TasksController;
})();
return new TasksController($scope, $window, $routeParams, TasksModel, ListsModel, CollectionsModel, TasksBusinessLayer, $location, SettingsBusinessLayer, SearchBusinessLayer, VTodo);
return new TasksController($scope, $window, $routeParams, TasksModel, ListsModel, CollectionsModel, TasksBusinessLayer, $location, SettingsBusinessLayer,
SearchBusinessLayer, VTodo);
}
]);

View file

@ -33,6 +33,7 @@
<div class="subtasks-container"
ng-class="{subtaskshidden: hideSubtasks(task)}">
<ol dnd-list="draggedTasks"
calendarID="{{task.calendar.uri}}"
dnd-drop="dropAsSubtask(event, item, index)"
dnd-dragover="dragover(event, item, index)">
<li class="task-item ui-draggable handler add-subtask"