Merge pull request #282 from owncloud/ShowSubTasks
Temporally show subtasks when task open
This commit is contained in:
commit
00cae41865
4 changed files with 43 additions and 1 deletions
|
@ -79,6 +79,15 @@ SettingsBusinessLayer, SearchBusinessLayer) ->
|
|||
@_$scope.showSubtaskInput = (uid) ->
|
||||
_$scope.status.addSubtaskTo = uid
|
||||
|
||||
@_$scope.hideSubtasks = (task) ->
|
||||
descendants = _$tasksmodel.getDescendantID(task.id)
|
||||
if task.id == _$scope.route.taskID
|
||||
return false
|
||||
else if _$scope.route.taskID in descendants
|
||||
return false
|
||||
else
|
||||
return task.hidesubtasks
|
||||
|
||||
@_$scope.showInput = () ->
|
||||
if _$scope.route.listID in ['completed', 'week']
|
||||
return false
|
||||
|
|
|
@ -149,6 +149,14 @@ angular.module('Tasks').factory 'TasksModel',
|
|||
childrenID.push t.id
|
||||
return childrenID
|
||||
|
||||
getDescendantID: (taskID) ->
|
||||
childrenID = @getChildrenID(taskID)
|
||||
descendantID = []
|
||||
descendantID = descendantID.concat childrenID
|
||||
for childID in childrenID
|
||||
descendantID = descendantID.concat @getDescendantID(childID)
|
||||
return descendantID
|
||||
|
||||
filterTasks: (task, filter) ->
|
||||
switch filter
|
||||
when 'completed'
|
||||
|
|
|
@ -987,6 +987,8 @@
|
|||
}).call(this);
|
||||
|
||||
(function() {
|
||||
var __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
|
||||
|
||||
angular.module('Tasks').controller('TasksController', [
|
||||
'$scope', '$window', '$routeParams', 'TasksModel', 'ListsModel', 'CollectionsModel', 'TasksBusinessLayer', '$location', 'SettingsBusinessLayer', 'SearchBusinessLayer', function($scope, $window, $routeParams, TasksModel, ListsModel, CollectionsModel, TasksBusinessLayer, $location, SettingsBusinessLayer, SearchBusinessLayer) {
|
||||
var TasksController;
|
||||
|
@ -1039,6 +1041,17 @@
|
|||
this._$scope.showSubtaskInput = function(uid) {
|
||||
return _$scope.status.addSubtaskTo = uid;
|
||||
};
|
||||
this._$scope.hideSubtasks = function(task) {
|
||||
var descendants, _ref;
|
||||
descendants = _$tasksmodel.getDescendantID(task.id);
|
||||
if (task.id === _$scope.route.taskID) {
|
||||
return false;
|
||||
} else if (_ref = _$scope.route.taskID, __indexOf.call(descendants, _ref) >= 0) {
|
||||
return false;
|
||||
} else {
|
||||
return task.hidesubtasks;
|
||||
}
|
||||
};
|
||||
this._$scope.showInput = function() {
|
||||
var _ref;
|
||||
if ((_ref = _$scope.route.listID) === 'completed' || _ref === 'week') {
|
||||
|
@ -2626,6 +2639,18 @@
|
|||
return childrenID;
|
||||
};
|
||||
|
||||
TasksModel.prototype.getDescendantID = function(taskID) {
|
||||
var childID, childrenID, descendantID, _i, _len;
|
||||
childrenID = this.getChildrenID(taskID);
|
||||
descendantID = [];
|
||||
descendantID = descendantID.concat(childrenID);
|
||||
for (_i = 0, _len = childrenID.length; _i < _len; _i++) {
|
||||
childID = childrenID[_i];
|
||||
descendantID = descendantID.concat(this.getDescendantID(childID));
|
||||
}
|
||||
return descendantID;
|
||||
};
|
||||
|
||||
TasksModel.prototype.filterTasks = function(task, filter) {
|
||||
switch (filter) {
|
||||
case 'completed':
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="subtasks-container"
|
||||
ng-class="{subtaskshidden: task.hidesubtasks}">
|
||||
ng-class="{subtaskshidden: hideSubtasks(task)}">
|
||||
<ol dnd-list="draggedTasks"
|
||||
dnd-drop="dropCallback(event, item, index)"
|
||||
dnd-dragover="dragover(event, item, index)">
|
||||
|
|
Loading…
Reference in a new issue