Get task color from lists

This commit is contained in:
raimund-schluessler 2014-11-08 17:06:00 +01:00
parent 9453e07835
commit 0dbc5ea4fd
8 changed files with 25 additions and 6 deletions

View file

@ -65,7 +65,6 @@ class TasksController extends Controller {
try {
$task_data = Helper::arrayForJSON($task['id'], $vtodo, $user_timezone);
$task_data['calendarid'] = $calendar['id'];
$task_data['calendarcolor'] = $calendar['calendarcolor'];
switch($type){
case 'all':

View file

@ -1375,6 +1375,6 @@ li.ui-draggable-dragging .duedate {
div.percentdone {
height: 3px;
margin-bottom: -3px;
background-color: green;
background-color: #CCC;
border-radius: 2px 2px 2px 2px;
}

View file

@ -1414,6 +1414,6 @@ li.ui-draggable-dragging{
div.percentdone{
height:3px;
margin-bottom:-3px;
background-color: green;
background-color: #CCC;
border-radius: 2px 2px 2px 2px;
}

View file

@ -193,6 +193,9 @@ SettingsBusinessLayer) ->
else
return task.due
@_$scope.getTaskColor = (listID) ->
return _$listsmodel.getColor(listID)
return new TasksController($scope, $window, $routeParams,
TasksModel, ListsModel, CollectionsModel, TasksBusinessLayer, $location,
SettingsBusinessLayer)

View file

@ -129,5 +129,11 @@ angular.module('Tasks').factory 'ListsModel',
loadedAll: (listID) ->
return !@notLoaded(listID)
getColor: (listID) ->
if angular.isUndefined(@getById(listID))
return '#CCCCCC'
else
return @getById(listID).calendarcolor
return new ListsModel(TasksModel, Utils)
]

View file

@ -1262,6 +1262,9 @@
return task.due;
}
};
this._$scope.getTaskColor = function(listID) {
return _$listsmodel.getColor(listID);
};
}
return TasksController;
@ -2063,6 +2066,14 @@
return !this.notLoaded(listID);
};
ListsModel.prototype.getColor = function(listID) {
if (angular.isUndefined(this.getById(listID))) {
return '#CCCCCC';
} else {
return this.getById(listID).calendarcolor;
}
};
return ListsModel;
})(_Model);

View file

@ -7,7 +7,7 @@
<li ng-animate="'animate'" ng-repeat="task in tasks | taskAtDay:day | filter:{'completed':'false'} | orderBy:sortDue | orderBy:'starred':true"
class="task-item ui-draggable" rel="{{ task.id }}" ng-click="openDetails(task.id)" ng-class="{done: task.completed}" oc-drag-task stop-event="click">
<div class="task-body">
<div class="percentdone" style="width:{{ task.complete }}%; background-color:{{task.calendarcolor}};"></div>
<div class="percentdone" style="width:{{ task.complete }}%; background-color:{{ getTaskColor(task.calendarid) }};"></div>
<a class="task-checkbox" name="toggleCompleted" ng-click="toggleCompleted(task.id)" stop-event="click">
<span class="icon task-checkbox" ng-class="{'task-checked': task.completed}"></span>
</a>

View file

@ -4,7 +4,7 @@
<li ng-repeat="(id, task) in tasks | filter:filterTasksByCalendar(task,route.listID) | filter:{'completed':'false'} | filter:route.searchString | orderBy:sortDue | orderBy:'starred':true"
class="task-item ui-draggable" rel="{{ task.id }}" ng-click="openDetails(task.id)" ng-class="{done: task.completed}" oc-drag-task stop-event="click">
<div class="task-body">
<div class="percentdone" style="width:{{ task.complete }}%; background-color:{{task.calendarcolor}};"></div>
<div class="percentdone" style="width:{{ task.complete }}%; background-color:{{ getTaskColor(task.calendarid) }};"></div>
<a class="task-checkbox" name="toggleCompleted" ng-click="toggleCompleted(task.id)" stop-event="click">
<span class="icon task-checkbox" ng-class="{'task-checked': task.completed}"></span>
</a>
@ -29,7 +29,7 @@
class="task-item" rel="{{ task.id }}" ng-click="openDetails(task.id)"
ng-class="{done: task.completed}" oc-drag-task stop-event="click">
<div class="task-body">
<div class="percentdone" style="width:{{ task.complete }}%; background-color:{{task.calendarcolor}};"></div>
<div class="percentdone" style="width:{{ task.complete }}%; background-color:{{ getTaskColor(task.calendarid) }};"></div>
<a class="task-checkbox" name="toggleCompleted" ng-click="toggleCompleted(task.id)" stop-event="click">
<span class="icon task-checkbox" ng-class="{'task-checked': task.completed}"></span>
</a>