Add GUI for setting percent completed
This commit is contained in:
parent
f4f732061a
commit
4266ea1fc8
15 changed files with 111 additions and 9 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -230,4 +230,5 @@ Sublime Text
|
|||
Various
|
||||
#######
|
||||
*.ai
|
||||
*.bat
|
||||
*.bat
|
||||
*.rej
|
|
@ -223,6 +223,16 @@ $this->create('task_start', '/tasks/{taskID}/start')
|
|||
}
|
||||
);
|
||||
|
||||
$this->create('task_percentcomplete', '/tasks/{taskID}/percentcomplete')
|
||||
->post()
|
||||
->action(
|
||||
function($params){
|
||||
session_write_close();
|
||||
$dispatcher = new Dispatcher($params);
|
||||
$dispatcher->dispatch('TasksController', 'percentComplete');
|
||||
}
|
||||
);
|
||||
|
||||
$this->create('task_reminder', '/tasks/{taskID}/reminder')
|
||||
->post()
|
||||
->action(
|
||||
|
|
|
@ -1233,3 +1233,9 @@ li.ui-draggable-dragging .duedate {
|
|||
opacity: 0;
|
||||
height: 0px !important;
|
||||
}
|
||||
div.percentdone {
|
||||
height: 3px;
|
||||
margin-bottom: -3px;
|
||||
background-color: green;
|
||||
border-radius: 2px 2px 2px 2px;
|
||||
}
|
||||
|
|
|
@ -1279,4 +1279,10 @@ li.ui-draggable-dragging{
|
|||
.task-item.ng-enter {
|
||||
opacity: 0;
|
||||
height: 0px !important;
|
||||
}
|
||||
div.percentdone{
|
||||
height:3px;
|
||||
margin-bottom:-3px;
|
||||
background-color: green;
|
||||
border-radius: 2px 2px 2px 2px;
|
||||
}
|
|
@ -209,6 +209,10 @@ $timeout, $routeParams) ->
|
|||
,5000)
|
||||
,true)
|
||||
|
||||
@_$scope.setPercentComplete = (percentComplete) ->
|
||||
_tasksbusinesslayer.setPercentComplete(_$scope.route.taskID,
|
||||
percentComplete)
|
||||
|
||||
@_$scope.setstartday = (date) ->
|
||||
_tasksbusinesslayer.setStart(_$scope.route.taskID,
|
||||
moment(date,'MM/DD/YYYY'),'day')
|
||||
|
|
|
@ -54,6 +54,10 @@ angular.module('Tasks').factory 'TasksBusinessLayer',
|
|||
@_$tasksmodel.complete(taskID)
|
||||
@_persistence.completeTask(taskID)
|
||||
|
||||
setPercentComplete: (taskID, percentComplete) ->
|
||||
@_$tasksmodel.setPercentComplete(taskID, percentComplete)
|
||||
@_persistence.setPercentComplete(taskID, percentComplete)
|
||||
|
||||
uncompleteTask: (taskID) ->
|
||||
@_$tasksmodel.uncomplete(taskID)
|
||||
@_persistence.uncompleteTask(taskID)
|
||||
|
|
|
@ -124,6 +124,9 @@ angular.module('Tasks').factory 'TasksModel',
|
|||
@update({id:taskID,completed:false,
|
||||
completed_date:null})
|
||||
|
||||
setPercentComplete: (taskID, complete) ->
|
||||
@update({id:taskID,complete:complete})
|
||||
|
||||
setDueDate: (taskID,date) ->
|
||||
@update({id:taskID,due:date})
|
||||
|
||||
|
|
|
@ -197,6 +197,15 @@ angular.module('Tasks').factory 'Persistence',
|
|||
|
||||
@_request.post '/apps/tasks_enhanced/tasks/{taskID}/complete', params
|
||||
|
||||
setPercentComplete: (taskID, complete) ->
|
||||
params =
|
||||
routeParams:
|
||||
taskID: taskID
|
||||
data:
|
||||
complete: complete
|
||||
|
||||
@_request.post '/apps/tasks_enhanced/tasks/{taskID}/percentcomplete', params
|
||||
|
||||
uncompleteTask: (taskID) ->
|
||||
params =
|
||||
routeParams:
|
||||
|
|
|
@ -582,6 +582,9 @@
|
|||
}
|
||||
}
|
||||
}, true);
|
||||
this._$scope.setPercentComplete = function(percentComplete) {
|
||||
return _tasksbusinesslayer.setPercentComplete(_$scope.route.taskID, percentComplete);
|
||||
};
|
||||
this._$scope.setstartday = function(date) {
|
||||
return _tasksbusinesslayer.setStart(_$scope.route.taskID, moment(date, 'MM/DD/YYYY'), 'day');
|
||||
};
|
||||
|
@ -1212,6 +1215,11 @@
|
|||
return this._persistence.completeTask(taskID);
|
||||
};
|
||||
|
||||
TasksBusinessLayer.prototype.setPercentComplete = function(taskID, percentComplete) {
|
||||
this._$tasksmodel.setPercentComplete(taskID, percentComplete);
|
||||
return this._persistence.setPercentComplete(taskID, percentComplete);
|
||||
};
|
||||
|
||||
TasksBusinessLayer.prototype.uncompleteTask = function(taskID) {
|
||||
this._$tasksmodel.uncomplete(taskID);
|
||||
return this._persistence.uncompleteTask(taskID);
|
||||
|
@ -2016,6 +2024,13 @@
|
|||
});
|
||||
};
|
||||
|
||||
TasksModel.prototype.setPercentComplete = function(taskID, complete) {
|
||||
return this.update({
|
||||
id: taskID,
|
||||
complete: complete
|
||||
});
|
||||
};
|
||||
|
||||
TasksModel.prototype.setDueDate = function(taskID, date) {
|
||||
return this.update({
|
||||
id: taskID,
|
||||
|
@ -2326,6 +2341,19 @@
|
|||
return this._request.post('/apps/tasks_enhanced/tasks/{taskID}/complete', params);
|
||||
};
|
||||
|
||||
Persistence.prototype.setPercentComplete = function(taskID, complete) {
|
||||
var params;
|
||||
params = {
|
||||
routeParams: {
|
||||
taskID: taskID
|
||||
},
|
||||
data: {
|
||||
complete: complete
|
||||
}
|
||||
};
|
||||
return this._request.post('/apps/tasks_enhanced/tasks/{taskID}/percentcomplete', params);
|
||||
};
|
||||
|
||||
Persistence.prototype.uncompleteTask = function(taskID) {
|
||||
var params;
|
||||
params = {
|
||||
|
|
|
@ -51,6 +51,7 @@ class TasksController extends Controller {
|
|||
try {
|
||||
$task_data = Helper::arrayForJSON($task['id'], $vtodo, $user_timezone);
|
||||
$task_data['calendarid'] = $calendar['id'];
|
||||
$task_data['calendarcolor'] = $calendar['calendarcolor'];
|
||||
$tasks[] = $task_data;
|
||||
} catch(\Exception $e) {
|
||||
\OCP\Util::writeLog('tasks_enhanced', $e->getMessage(), \OCP\Util::ERROR);
|
||||
|
@ -112,9 +113,8 @@ class TasksController extends Controller {
|
|||
}
|
||||
}
|
||||
|
||||
private function setCompleted($isCompleted){
|
||||
private function setPercentComplete($percent_complete){
|
||||
$taskId = (int) $this->params('taskID');
|
||||
$percent_complete = $isCompleted ? '100' : '0';
|
||||
$isCompleted = null;
|
||||
try {
|
||||
$vcalendar = \OC_Calendar_App::getVCalendar($taskId);
|
||||
|
@ -146,13 +146,29 @@ class TasksController extends Controller {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
*/
|
||||
public function percentComplete( $percentCompete ){
|
||||
$response = new JSONResponse();
|
||||
try{
|
||||
$percent_complete = $this->params('complete');
|
||||
$this->setPercentComplete( $percent_complete );
|
||||
return $response;
|
||||
}catch(\Exception $e) {
|
||||
return $response;
|
||||
// return $this->renderJSON(array(), $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
*/
|
||||
public function completeTask(){
|
||||
$response = new JSONResponse();
|
||||
try {
|
||||
$this->setCompleted(true);
|
||||
$this->setPercentComplete(100);
|
||||
return $response;
|
||||
} catch(\Exception $e) {
|
||||
return $response;
|
||||
|
@ -166,7 +182,7 @@ class TasksController extends Controller {
|
|||
public function uncompleteTask(){
|
||||
$response = new JSONResponse();
|
||||
try {
|
||||
$this->setCompleted(false);
|
||||
$this->setPercentComplete(0);
|
||||
return $response;
|
||||
} catch(\Exception $e) {
|
||||
return $response;
|
||||
|
@ -465,4 +481,4 @@ class TasksController extends Controller {
|
|||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -168,7 +168,7 @@ Class helper {
|
|||
} else {
|
||||
$task['completed'] = false;
|
||||
}
|
||||
$task['complete'] = $vtodo->getAsString('PERCENT-COMPLETE');
|
||||
$task['complete'] = $vtodo->getAsString('PERCENT-COMPLETE')==''?'0':$vtodo->getAsString('PERCENT-COMPLETE');
|
||||
return $task;
|
||||
}
|
||||
|
||||
|
@ -198,6 +198,7 @@ Class helper {
|
|||
$vtodo->setString('DESCRIPTION', $request['description']);
|
||||
$vtodo->setString('CATEGORIES', $request["categories"]);
|
||||
$vtodo->setString('PRIORITY', $request['priority']);
|
||||
$vtodo->setString('PERCENT-COMPLETE', $request['complete']);
|
||||
|
||||
$due = $request['due'];
|
||||
if ($due) {
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<li ng-animate="'animate'" ng-repeat="task in tasks | filter:{'calendarid':list.id} | filter:filterTasks(task) | 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:{{list.calendarcolor}};"></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>
|
||||
|
@ -23,4 +24,4 @@
|
|||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -7,6 +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:{{list.calendarcolor}};"></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>
|
||||
|
|
|
@ -70,6 +70,16 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section detail-complete">
|
||||
<div class="section-title" ng-class="{'overdue':isOverDue(task.reminder.date)}">
|
||||
<text rel="">Percent completed</text>
|
||||
<select ng-init='percents = ["0","5","10","15","20","25","30","25","30","35","40","45","50","55","60","65","70","75","80","85","90","95","100"]'
|
||||
ng-change="setPercentComplete(task.complete)"
|
||||
ng-model="task.complete"
|
||||
ng-options="percent for percent in percents">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <ul class="subtasks buffer"></ul> -->
|
||||
<div class="note">
|
||||
<div class="note-body selectable" ng-click="editNote()" stop-event="click" oc-click-focus="{selector: '.expandingArea textarea', timeout: 0}">
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
<li ng-repeat="(id, task) in tasks | filter:{'calendarid':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>
|
||||
<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,6 +30,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>
|
||||
<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>
|
||||
|
@ -48,4 +50,4 @@
|
|||
<!-- <span ng-click="loadMore()" stop-event="click"> <?php p($l->t('Load more completed tasks')); ?> </span> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue