Implement priority support

This commit is contained in:
Raimund Schlüßler 2015-06-19 21:14:22 +02:00
parent dbc740037c
commit 4715e7da50
17 changed files with 524 additions and 173 deletions

View file

@ -44,10 +44,6 @@ $application->registerRoutes($this, array('routes' => array(
// tasks
array('name' => 'tasks#getTasks', 'url' => '/tasks/{type}/{listID}', 'verb' => 'GET'),
array('name' => 'tasks#getTask', 'url' => '/task/{taskID}', 'verb' => 'GET'),
array('name' => 'tasks#starTask', 'url' => '/tasks/{taskID}/star', 'verb' => 'POST'),
array('name' => 'tasks#unstarTask', 'url' => '/tasks/{taskID}/unstar', 'verb' => 'POST'),
array('name' => 'tasks#completeTask', 'url' => '/tasks/{taskID}/complete', 'verb' => 'POST'),
array('name' => 'tasks#uncompleteTask', 'url' => '/tasks/{taskID}/uncomplete', 'verb' => 'POST'),
array('name' => 'tasks#addTask', 'url' => '/tasks/add', 'verb' => 'POST'),
array('name' => 'tasks#deleteTask', 'url' => '/tasks/{taskID}/delete', 'verb' => 'POST'),
array('name' => 'tasks#setTaskName', 'url' => '/tasks/{taskID}/name', 'verb' => 'POST'),
@ -57,6 +53,7 @@ $application->registerRoutes($this, array('routes' => array(
array('name' => 'tasks#setStartDate', 'url' => '/tasks/{taskID}/start', 'verb' => 'POST'),
array('name' => 'tasks#percentComplete','url' => '/tasks/{taskID}/percentcomplete', 'verb' => 'POST'),
array('name' => 'tasks#setPriority', 'url' => '/tasks/{taskID}/priority', 'verb' => 'POST'),
array('name' => 'tasks#setReminderDate','url' => '/tasks/{taskID}/reminder', 'verb' => 'POST'),
array('name' => 'tasks#addComment', 'url' => '/tasks/{taskID}/comment', 'verb' => 'POST'),
array('name' => 'tasks#deleteComment', 'url' => '/tasks/{taskID}/comment/{commentID}/delete', 'verb' => 'POST'),

View file

@ -156,9 +156,14 @@ Class Helper {
$task['reminder'] = null;
}
$priority = $vtodo->PRIORITY;
if(isset($priority) && $priority->getValue() > 0){
$task['starred'] = true;
if(isset($priority)){
$priority = (10 - $priority->getValue()) % 10;
$task['priority'] = (string) $priority;
if($priority > 5){
$task['starred'] = true;
}
} else {
$task['priority'] = '0';
$task['starred'] = false;
}
$completed = $vtodo->COMPLETED;

View file

@ -65,19 +65,8 @@ class TasksController extends Controller {
/**
* @NoAdminRequired
*/
public function starTask($taskID){
$result = $this->tasksService->setStarred($taskID, true);
$response = array(
'data' => $result
);
return (new JSONResponse())->setData($response);
}
/**
* @NoAdminRequired
*/
public function unstarTask($taskID){
$result = $this->tasksService->setStarred($taskID, false);
public function setPriority($taskID,$priority){
$result = $this->tasksService->setPriority($taskID, $priority);
$response = array(
'data' => $result
);
@ -95,29 +84,6 @@ class TasksController extends Controller {
return (new JSONResponse())->setData($response);
}
/**
* @NoAdminRequired
*/
public function completeTask(){
$result = $this->tasksService->setPercentComplete($taskID, 100);
$response = array(
'data' => $result
);
return (new JSONResponse())->setData($response);
}
/**
* @NoAdminRequired
*/
public function uncompleteTask(){
$result = $this->tasksService->setPercentComplete($taskID, 0);
$response = array(
'data' => $result
);
return (new JSONResponse())->setData($response);
}
/**
* @NoAdminRequired
*/

View file

@ -145,8 +145,11 @@
#content .icon.detail-percent {
background-position: -260px -60px;
}
#content .icon.detail-priority {
background-position: -160px -80px;
}
#content .icon.detail-categories {
background-position: -180px -40px;
background-position: -200px -60px;
}
#content .icon.task-checked,
#content .icon.detail-checked {
@ -162,18 +165,18 @@
height: 60px;
width: 30px;
}
#content .icon.detail-star.low {
background-position: -90px -100px !important;
}
#content .icon.detail-star.medium {
background-position: -60px -100px !important;
}
#content .icon.detail-star.high {
background-position: -120px -40px !important;
}
#content .icon.detail-star:hover {
background-position: -90px -40px;
}
#content .icon.detail-starred {
top: -2px !important;
position: absolute;
right: 15px;
top: -2px;
background-position: -120px -40px !important;
height: 60px;
width: 30px;
}
#content .icon.detail-save {
background-position: -20px -40px;
}
@ -256,14 +259,17 @@
#content div.task-item .task-body .icon.task-star:hover {
background-position: -160px 0;
}
#content li.task-item .task-body .icon.task-starred,
#content div.task-item .task-body .icon.task-starred,
#content li.task-item .task-body .icon.task-starred:hover,
#content div.task-item .task-body .icon.task-starred:hover {
background-position: -180px 0;
margin-left: 5px;
margin-right: 8px;
margin-top: 0;
#content li.task-item .task-body .icon.task-star.high,
#content div.task-item .task-body .icon.task-star.high {
background-position: -180px 0 !important;
}
#content li.task-item .task-body .icon.task-star.medium,
#content div.task-item .task-body .icon.task-star.medium {
background-position: -160px -40px !important;
}
#content li.task-item .task-body .icon.task-star.low,
#content div.task-item .task-body .icon.task-star.low {
background-position: -180px -40px !important;
}
#content li.task-item .task-body .title-wrapper,
#content div.task-item .task-body .title-wrapper {
@ -846,8 +852,26 @@
#task-details div.content-wrapper .body .section.date .section-title.repeat {
margin-top: -2px;
}
#task-details div.content-wrapper .body .section.high .icon.detail-priority {
background-position: -180px -80px;
}
#task-details div.content-wrapper .body .section.high .section-title {
color: #B3312D;
}
#task-details div.content-wrapper .body .section.medium .icon.detail-priority {
background-position: -160px -100px;
}
#task-details div.content-wrapper .body .section.medium .section-title {
color: #FFDD00;
}
#task-details div.content-wrapper .body .section.low .icon.detail-priority {
background-position: -180px -100px;
}
#task-details div.content-wrapper .body .section.low .section-title {
color: #4271A6;
}
#task-details div.content-wrapper .body .section.active .detail-categories {
background-position: -180px -60px;
background-position: -200px -80px;
}
#task-details div.content-wrapper .body .section.active .select2-search-field input {
color: #4271a6;
@ -1000,7 +1024,8 @@ input.duration-input {
margin: 2px 0 0 0.3em;
width: 35px;
}
input.percent-input {
input.percent-input,
input.priority-input {
width: 35px;
margin-top: 0px;
}

View file

@ -180,8 +180,11 @@
&.detail-percent{
background-position: -260px -60px;
}
&.detail-priority{
background-position: -160px -80px;
}
&.detail-categories{
background-position: -180px -40px;
background-position: -200px -60px;
}
&.task-checked, &.detail-checked {
background-position: -60px -20px;
@ -195,19 +198,19 @@
background-position: -60px -40px;
height: 60px;
width: 30px;
&.low{
background-position: -90px -100px !important;
}
&.medium{
background-position: -60px -100px !important;
}
&.high{
background-position: -120px -40px !important;
}
&:hover {
background-position: -90px -40px;
}
}
&.detail-starred{
top: -2px !important;
position: absolute;
right: 15px;
top: -2px;
background-position: -120px -40px !important;
height: 60px;
width: 30px;
}
&.detail-save{
background-position: -20px -40px;
}
@ -283,12 +286,15 @@
&:hover{
background-position: -160px 0;
}
}
&.task-starred, &.task-starred:hover{
background-position: -180px 0;
margin-left: 5px;
margin-right: 8px;
margin-top: 0;
&.high{
background-position: -180px 0 !important;
}
&.medium{
background-position: -160px -40px !important;
}
&.low{
background-position: -180px -40px !important;
}
}
}
.title-wrapper {
@ -861,9 +867,33 @@
}
}
}
&.high{
.icon.detail-priority{
background-position: -180px -80px;
}
.section-title{
color: #B3312D;
}
}
&.medium{
.icon.detail-priority{
background-position: -160px -100px;
}
.section-title{
color: #FFDD00;
}
}
&.low{
.icon.detail-priority{
background-position: -180px -100px;
}
.section-title{
color: #4271A6;
}
}
&.active{
.detail-categories{
background-position: -180px -60px;
background-position: -200px -80px;
}
.select2-search-field input{
color: #4271a6;
@ -1035,7 +1065,7 @@ input.duration-input{
margin: 2px 0 0 0.3em;
width: 35px;
}
input.percent-input{
input.percent-input, input.priority-input{
width: 35px;
margin-top: 0px;
}

View file

@ -1647,29 +1647,261 @@
<g>
<g>
<defs>
<rect id="SVGID_227_" x="180" y="40" width="20" height="20"/>
<rect id="SVGID_227_" x="200" y="60" width="20" height="20"/>
</defs>
<clipPath id="SVGID_228_">
<use xlink:href="#SVGID_227_" overflow="visible"/>
</clipPath>
<rect x="186.5" y="49.5" clip-path="url(#SVGID_228_)" fill="#B0B0B0" width="12" height="9"/>
<polygon clip-path="url(#SVGID_228_)" fill="#B0B0B0" points="186,49 186,54.5 184,54.5 184,45.5 196,45.5 196,49 "/>
<polygon clip-path="url(#SVGID_228_)" fill="#B0B0B0" points="183.5,45 183.5,50.5 181.5,50.5 181.5,41.5 193.5,41.5 193.5,45
<rect x="206.5" y="69.5" clip-path="url(#SVGID_228_)" fill="#B0B0B0" width="12" height="9"/>
<polygon clip-path="url(#SVGID_228_)" fill="#B0B0B0" points="206,69 206,74.5 204,74.5 204,65.5 216,65.5 216,69 "/>
<polygon clip-path="url(#SVGID_228_)" fill="#B0B0B0" points="203.5,65 203.5,70.5 201.5,70.5 201.5,61.5 213.5,61.5 213.5,65
"/>
</g>
</g>
<g>
<g>
<defs>
<rect id="SVGID_229_" x="180" y="60" width="20" height="20"/>
<rect id="SVGID_229_" x="60" y="100" width="30" height="60"/>
</defs>
<clipPath id="SVGID_230_">
<use xlink:href="#SVGID_229_" overflow="visible"/>
</clipPath>
<rect x="186.5" y="69.5" clip-path="url(#SVGID_230_)" fill="#4372A7" width="12" height="9"/>
<polygon clip-path="url(#SVGID_230_)" fill="#4372A7" points="186,69 186,74.5 184,74.5 184,65.5 196,65.5 196,69 "/>
<polygon clip-path="url(#SVGID_230_)" fill="#4372A7" points="183.5,65 183.5,70.5 181.5,70.5 181.5,61.5 193.5,61.5 193.5,65
<g clip-path="url(#SVGID_230_)">
<defs>
<rect id="SVGID_231_" x="60" y="100" width="30" height="60"/>
</defs>
<clipPath id="SVGID_232_">
<use xlink:href="#SVGID_231_" overflow="visible"/>
</clipPath>
<g clip-path="url(#SVGID_232_)">
<defs>
<rect id="SVGID_233_" x="60" y="100" width="30" height="60"/>
</defs>
<clipPath id="SVGID_234_">
<use xlink:href="#SVGID_233_" overflow="visible"/>
</clipPath>
<g opacity="0.5" clip-path="url(#SVGID_234_)">
<g>
<defs>
<rect id="SVGID_235_" x="62.842" y="116.827" width="24.313" height="23.125"/>
</defs>
<clipPath id="SVGID_236_">
<use xlink:href="#SVGID_235_" overflow="visible"/>
</clipPath>
<polygon clip-path="url(#SVGID_236_)" fill="#FFFFFF" points="74.998,118.445 68.44,138.642 85.618,126.157 64.38,126.157
81.562,138.636 "/>
<polygon clip-path="url(#SVGID_236_)" fill="none" stroke="#FFFFFF" stroke-miterlimit="10" points="74.998,118.445
68.44,138.642 85.618,126.157 64.38,126.157 81.562,138.636 "/>
</g>
</g>
</g>
<polygon clip-path="url(#SVGID_232_)" fill="#FFCC04" points="74.999,116.933 68.441,137.127 85.617,124.645 64.381,124.645
81.562,137.126 "/>
<polygon clip-path="url(#SVGID_232_)" fill="none" stroke="#FFCC04" stroke-miterlimit="10" points="74.999,116.933
68.441,137.127 85.617,124.645 64.381,124.645 81.562,137.126 "/>
</g>
</g>
</g>
<g>
<g>
<defs>
<rect id="SVGID_237_" x="90" y="100" width="30" height="60"/>
</defs>
<clipPath id="SVGID_238_">
<use xlink:href="#SVGID_237_" overflow="visible"/>
</clipPath>
<g clip-path="url(#SVGID_238_)">
<defs>
<rect id="SVGID_239_" x="90" y="100" width="30" height="60"/>
</defs>
<clipPath id="SVGID_240_">
<use xlink:href="#SVGID_239_" overflow="visible"/>
</clipPath>
<g clip-path="url(#SVGID_240_)">
<defs>
<rect id="SVGID_241_" x="90" y="100" width="30" height="60"/>
</defs>
<clipPath id="SVGID_242_">
<use xlink:href="#SVGID_241_" overflow="visible"/>
</clipPath>
<g opacity="0.5" clip-path="url(#SVGID_242_)">
<g>
<defs>
<rect id="SVGID_243_" x="92.842" y="116.827" width="24.313" height="23.125"/>
</defs>
<clipPath id="SVGID_244_">
<use xlink:href="#SVGID_243_" overflow="visible"/>
</clipPath>
<polygon clip-path="url(#SVGID_244_)" fill="#FFFFFF" points="104.998,118.445 98.44,138.642 115.618,126.157 94.38,126.157
111.562,138.636 "/>
<polygon clip-path="url(#SVGID_244_)" fill="none" stroke="#FFFFFF" stroke-miterlimit="10" points="104.998,118.445
98.44,138.642 115.618,126.157 94.38,126.157 111.562,138.636 "/>
</g>
</g>
</g>
<polygon clip-path="url(#SVGID_240_)" fill="#4372A7" points="104.999,116.933 98.441,137.127 115.617,124.645 94.381,124.645
111.562,137.126 "/>
<polygon clip-path="url(#SVGID_240_)" fill="none" stroke="#4372A7" stroke-miterlimit="10" points="104.999,116.933
98.441,137.127 115.617,124.645 94.381,124.645 111.562,137.126 "/>
</g>
</g>
</g>
<g>
<g>
<defs>
<rect id="SVGID_245_" x="200" y="80" width="20" height="20"/>
</defs>
<clipPath id="SVGID_246_">
<use xlink:href="#SVGID_245_" overflow="visible"/>
</clipPath>
<rect x="206.5" y="89.5" clip-path="url(#SVGID_246_)" fill="#4372A7" width="12" height="9"/>
<polygon clip-path="url(#SVGID_246_)" fill="#4372A7" points="206,89 206,94.5 204,94.5 204,85.5 216,85.5 216,89 "/>
<polygon clip-path="url(#SVGID_246_)" fill="#4372A7" points="203.5,85 203.5,90.5 201.5,90.5 201.5,81.5 213.5,81.5 213.5,85
"/>
</g>
</g>
<g>
<g>
<defs>
<rect id="SVGID_247_" x="180" y="40" width="20" height="40"/>
</defs>
<clipPath id="SVGID_248_">
<use xlink:href="#SVGID_247_" overflow="visible"/>
</clipPath>
<g clip-path="url(#SVGID_248_)">
<defs>
<rect id="SVGID_249_" x="180" y="40" width="20" height="40"/>
</defs>
<clipPath id="SVGID_250_">
<use xlink:href="#SVGID_249_" overflow="visible"/>
</clipPath>
<g clip-path="url(#SVGID_250_)">
<defs>
<rect id="SVGID_251_" x="180" y="40" width="20" height="40"/>
</defs>
<clipPath id="SVGID_252_">
<use xlink:href="#SVGID_251_" overflow="visible"/>
</clipPath>
<g opacity="0.5" clip-path="url(#SVGID_252_)">
<g>
<defs>
<rect id="SVGID_253_" x="181.381" y="49.941" width="17.235" height="16.393"/>
</defs>
<clipPath id="SVGID_254_">
<use xlink:href="#SVGID_253_" overflow="visible"/>
</clipPath>
<polygon clip-path="url(#SVGID_254_)" fill="#FFFFFF" points="189.998,51.56 185.626,65.024 197.078,56.702 182.92,56.702
194.374,65.021 "/>
<polygon clip-path="url(#SVGID_254_)" fill="none" stroke="#FFFFFF" stroke-miterlimit="10" points="189.998,51.56
185.626,65.024 197.078,56.702 182.92,56.702 194.374,65.021 "/>
</g>
</g>
</g>
<polygon clip-path="url(#SVGID_250_)" fill="#33669A" points="189.999,50.551 185.627,64.014 197.078,55.692 182.92,55.692
194.374,64.013 "/>
<polygon clip-path="url(#SVGID_250_)" fill="none" stroke="#33669A" stroke-miterlimit="10" points="189.999,50.551
185.627,64.014 197.078,55.692 182.92,55.692 194.374,64.013 "/>
</g>
</g>
</g>
<g>
<g>
<defs>
<rect id="SVGID_255_" x="160" y="40" width="20" height="40"/>
</defs>
<clipPath id="SVGID_256_">
<use xlink:href="#SVGID_255_" overflow="visible"/>
</clipPath>
<g clip-path="url(#SVGID_256_)">
<defs>
<rect id="SVGID_257_" x="160" y="40" width="20" height="40"/>
</defs>
<clipPath id="SVGID_258_">
<use xlink:href="#SVGID_257_" overflow="visible"/>
</clipPath>
<g clip-path="url(#SVGID_258_)">
<defs>
<rect id="SVGID_259_" x="160" y="40" width="20" height="40"/>
</defs>
<clipPath id="SVGID_260_">
<use xlink:href="#SVGID_259_" overflow="visible"/>
</clipPath>
<g opacity="0.5" clip-path="url(#SVGID_260_)">
<g>
<defs>
<rect id="SVGID_261_" x="161.381" y="49.941" width="17.235" height="16.393"/>
</defs>
<clipPath id="SVGID_262_">
<use xlink:href="#SVGID_261_" overflow="visible"/>
</clipPath>
<polygon clip-path="url(#SVGID_262_)" fill="#FFFFFF" points="169.998,51.56 165.626,65.024 177.078,56.702 162.92,56.702
174.374,65.021 "/>
<polygon clip-path="url(#SVGID_262_)" fill="none" stroke="#FFFFFF" stroke-miterlimit="10" points="169.998,51.56
165.626,65.024 177.078,56.702 162.92,56.702 174.374,65.021 "/>
</g>
</g>
</g>
<polygon clip-path="url(#SVGID_258_)" fill="#FFCC04" points="169.999,50.551 165.627,64.014 177.078,55.692 162.92,55.692
174.374,64.013 "/>
<polygon clip-path="url(#SVGID_258_)" fill="none" stroke="#FFCC04" stroke-miterlimit="10" points="169.999,50.551
165.627,64.014 177.078,55.692 162.92,55.692 174.374,64.013 "/>
</g>
</g>
</g>
<g>
<g>
<defs>
<rect id="SVGID_263_" x="180" y="80" width="20" height="20"/>
</defs>
<clipPath id="SVGID_264_">
<use xlink:href="#SVGID_263_" overflow="visible"/>
</clipPath>
<polygon clip-path="url(#SVGID_264_)" fill="#CD3333" points="190,83.268 185.628,96.732 197.079,88.409 182.921,88.409
194.375,96.73 "/>
<polygon clip-path="url(#SVGID_264_)" fill="none" stroke="#CD3333" stroke-miterlimit="10" points="190,83.268 185.628,96.732
197.079,88.409 182.921,88.409 194.375,96.73 "/>
</g>
</g>
<g>
<g>
<defs>
<rect id="SVGID_265_" x="180" y="100" width="20" height="20"/>
</defs>
<clipPath id="SVGID_266_">
<use xlink:href="#SVGID_265_" overflow="visible"/>
</clipPath>
<polygon clip-path="url(#SVGID_266_)" fill="#33669A" points="190,103.268 185.628,116.732 197.079,108.409 182.921,108.409
194.375,116.73 "/>
<polygon clip-path="url(#SVGID_266_)" fill="none" stroke="#33669A" stroke-miterlimit="10" points="190,103.268 185.628,116.732
197.079,108.409 182.921,108.409 194.375,116.73 "/>
</g>
</g>
<g>
<g>
<defs>
<rect id="SVGID_267_" x="160" y="100" width="20" height="20"/>
</defs>
<clipPath id="SVGID_268_">
<use xlink:href="#SVGID_267_" overflow="visible"/>
</clipPath>
<polygon clip-path="url(#SVGID_268_)" fill="#FFCC04" points="170,103.268 165.627,116.732 177.078,108.409 162.92,108.409
174.375,116.73 "/>
<polygon clip-path="url(#SVGID_268_)" fill="none" stroke="#FFCC04" stroke-miterlimit="10" points="170,103.268 165.627,116.732
177.078,108.409 162.92,108.409 174.375,116.73 "/>
</g>
</g>
<g>
<g>
<defs>
<rect id="SVGID_269_" x="160" y="80" width="20" height="20"/>
</defs>
<clipPath id="SVGID_270_">
<use xlink:href="#SVGID_269_" overflow="visible"/>
</clipPath>
<polygon clip-path="url(#SVGID_270_)" fill="#999999" points="170,83.268 165.628,96.732 177.079,88.409 162.921,88.409
174.375,96.73 "/>
<polygon clip-path="url(#SVGID_270_)" fill="none" stroke="#999999" stroke-miterlimit="10" points="170,83.268 165.628,96.732
177.079,88.409 162.921,88.409 174.375,96.73 "/>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 83 KiB

After

Width:  |  Height:  |  Size: 91 KiB

View file

@ -172,6 +172,13 @@ $timeout, $routeParams, SettingsModel, Loading) ->
else
return
@_$scope.editPriority = ($event) ->
if $($event.currentTarget).is($($event.target).closest('.handler'))
_$location.path('/lists/'+_$scope.route.listID +
'/tasks/' + _$scope.route.taskID + '/edit/priority')
else
return
@_$scope.editPercent = ($event) ->
if $($event.currentTarget).is($($event.target).closest('.handler'))
_$location.path('/lists/'+_$scope.route.listID +
@ -221,6 +228,9 @@ $timeout, $routeParams, SettingsModel, Loading) ->
else
_tasksbusinesslayer.starTask(taskID)
@_$scope.deletePriority = () ->
_tasksbusinesslayer.unstarTask(_$scope.route.taskID)
@_$scope.isDue = (date) ->
return _$tasksmodel.due(date)
@ -251,6 +261,13 @@ $timeout, $routeParams, SettingsModel, Loading) ->
_tasksbusinesslayer.setPercentComplete(newVal.id,
newVal.complete)
,1000)
if newVal.priority != oldVal.priority
if _$scope.timers['task'+newVal.id+'priority']
$timeout.cancel(_$scope.timers['task'+newVal.id+'priority'])
_$scope.timers['task'+newVal.id+'priority'] = $timeout( () ->
_tasksbusinesslayer.setPriority(newVal.id,
newVal.priority)
,1000)
,true)
@_$scope.setstartday = (date) ->

View file

@ -0,0 +1,32 @@
###
ownCloud - Tasks
@author Raimund Schlüßler
@copyright 2013
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
License as published by the Free Software Foundation; either
version 3 of the License, or any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU AFFERO GENERAL PUBLIC LICENSE for more details.
You should have received a copy of the GNU Affero General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
###
angular.module('Tasks').filter 'priorityDetails', () ->
(priority) ->
string = t('tasks', 'priority %s: ').replace('%s', priority)
if +priority in [6,7,8,9]
return string+' '+t('tasks', 'high')
else if +priority == 5
return string+' '+t('tasks', 'medium')
else if +priority in [1,2,3,4]
return string+' '+t('tasks', 'low')
else
return t('tasks', 'no priority assigned')

View file

@ -47,16 +47,19 @@ angular.module('Tasks').factory 'TasksBusinessLayer',
@_persistence.getTask(taskID, onSuccess, true)
setPriority: (taskID, priority) ->
@_$tasksmodel.setPriority(taskID, priority)
if +priority in [6,7,8,9]
@_$tasksmodel.star(taskID)
else
@_$tasksmodel.unstar(taskID)
@_persistence.setPriority(taskID, priority)
starTask: (taskID) ->
@_$tasksmodel.star(taskID)
@_persistence.starTask(taskID)
@setPriority(taskID, '9')
unstarTask: (taskID) ->
@_$tasksmodel.unstar(taskID)
@_persistence.unstarTask(taskID)
completeTask: (taskID) ->
@setPercentComplete(taskID,100)
@setPriority(taskID, '0')
setPercentComplete: (taskID, percentComplete) ->
@_$tasksmodel.setPercentComplete(taskID, percentComplete)
@ -66,6 +69,9 @@ angular.module('Tasks').factory 'TasksBusinessLayer',
@_$tasksmodel.complete(taskID)
@_persistence.setPercentComplete(taskID, percentComplete)
completeTask: (taskID) ->
@setPercentComplete(taskID,100)
uncompleteTask: (taskID) ->
@setPercentComplete(taskID,0)

View file

@ -162,6 +162,9 @@ angular.module('Tasks').factory 'TasksModel',
unstar: (taskID) ->
@update({id:taskID,starred:false})
setPriority: (taskID, priority) ->
@update({id:taskID,priority:priority})
completed: (taskID) ->
return @getById(taskID).completed

View file

@ -201,20 +201,6 @@ angular.module('Tasks').factory 'Persistence',
@_request.get '/apps/tasks/task/{taskID}', params
starTask: (taskID) ->
params =
routeParams:
taskID: taskID
@_request.post '/apps/tasks/tasks/{taskID}/star', params
unstarTask: (taskID) ->
params =
routeParams:
taskID: taskID
@_request.post '/apps/tasks/tasks/{taskID}/unstar', params
setPercentComplete: (taskID, complete) ->
params =
routeParams:
@ -224,6 +210,15 @@ angular.module('Tasks').factory 'Persistence',
@_request.post '/apps/tasks/tasks/{taskID}/percentcomplete', params
setPriority: (taskID, priority) ->
params =
routeParams:
taskID: taskID
data:
priority: priority
@_request.post '/apps/tasks/tasks/{taskID}/priority', params
addTask: (task, onSuccess=null, onFailure=null) ->
onSuccess or= ->
onFailure or= ->

View file

@ -588,6 +588,13 @@
}
};
this._$scope.editPriority = function($event) {
if ($($event.currentTarget).is($($event.target).closest('.handler'))) {
return _$location.path('/lists/' + _$scope.route.listID + '/tasks/' + _$scope.route.taskID + '/edit/priority');
} else {
}
};
this._$scope.editPercent = function($event) {
if ($($event.currentTarget).is($($event.target).closest('.handler'))) {
return _$location.path('/lists/' + _$scope.route.listID + '/tasks/' + _$scope.route.taskID + '/edit/percent');
@ -640,6 +647,9 @@
return _tasksbusinesslayer.starTask(taskID);
}
};
this._$scope.deletePriority = function() {
return _tasksbusinesslayer.unstarTask(_$scope.route.taskID);
};
this._$scope.isDue = function(date) {
return _$tasksmodel.due(date);
};
@ -670,10 +680,18 @@
if (_$scope.timers['task' + newVal.id + 'complete']) {
$timeout.cancel(_$scope.timers['task' + newVal.id + 'complete']);
}
return _$scope.timers['task' + newVal.id + 'complete'] = $timeout(function() {
_$scope.timers['task' + newVal.id + 'complete'] = $timeout(function() {
return _tasksbusinesslayer.setPercentComplete(newVal.id, newVal.complete);
}, 1000);
}
if (newVal.priority !== oldVal.priority) {
if (_$scope.timers['task' + newVal.id + 'priority']) {
$timeout.cancel(_$scope.timers['task' + newVal.id + 'priority']);
}
return _$scope.timers['task' + newVal.id + 'priority'] = $timeout(function() {
return _tasksbusinesslayer.setPriority(newVal.id, newVal.priority);
}, 1000);
}
}
}, true);
this._$scope.setstartday = function(date) {
@ -1461,18 +1479,22 @@
return this._persistence.getTask(taskID, onSuccess, true);
};
TasksBusinessLayer.prototype.setPriority = function(taskID, priority) {
this._$tasksmodel.setPriority(taskID, priority);
if (+priority === 6 || +priority === 7 || +priority === 8 || +priority === 9) {
this._$tasksmodel.star(taskID);
} else {
this._$tasksmodel.unstar(taskID);
}
return this._persistence.setPriority(taskID, priority);
};
TasksBusinessLayer.prototype.starTask = function(taskID) {
this._$tasksmodel.star(taskID);
return this._persistence.starTask(taskID);
return this.setPriority(taskID, '9');
};
TasksBusinessLayer.prototype.unstarTask = function(taskID) {
this._$tasksmodel.unstar(taskID);
return this._persistence.unstarTask(taskID);
};
TasksBusinessLayer.prototype.completeTask = function(taskID) {
return this.setPercentComplete(taskID, 100);
return this.setPriority(taskID, '0');
};
TasksBusinessLayer.prototype.setPercentComplete = function(taskID, percentComplete) {
@ -1485,6 +1507,10 @@
return this._persistence.setPercentComplete(taskID, percentComplete);
};
TasksBusinessLayer.prototype.completeTask = function(taskID) {
return this.setPercentComplete(taskID, 100);
};
TasksBusinessLayer.prototype.uncompleteTask = function(taskID) {
return this.setPercentComplete(taskID, 0);
};
@ -2345,6 +2371,13 @@
});
};
TasksModel.prototype.setPriority = function(taskID, priority) {
return this.update({
id: taskID,
priority: priority
});
};
TasksModel.prototype.completed = function(taskID) {
return this.getById(taskID).completed;
};
@ -2738,26 +2771,6 @@
return this._request.get('/apps/tasks/task/{taskID}', params);
};
Persistence.prototype.starTask = function(taskID) {
var params;
params = {
routeParams: {
taskID: taskID
}
};
return this._request.post('/apps/tasks/tasks/{taskID}/star', params);
};
Persistence.prototype.unstarTask = function(taskID) {
var params;
params = {
routeParams: {
taskID: taskID
}
};
return this._request.post('/apps/tasks/tasks/{taskID}/unstar', params);
};
Persistence.prototype.setPercentComplete = function(taskID, complete) {
var params;
params = {
@ -2771,6 +2784,19 @@
return this._request.post('/apps/tasks/tasks/{taskID}/percentcomplete', params);
};
Persistence.prototype.setPriority = function(taskID, priority) {
var params;
params = {
routeParams: {
taskID: taskID
},
data: {
priority: priority
}
};
return this._request.post('/apps/tasks/tasks/{taskID}/priority', params);
};
Persistence.prototype.addTask = function(task, onSuccess, onFailure) {
var params;
if (onSuccess == null) {
@ -3146,12 +3172,14 @@
(function() {
angular.module('Tasks').filter('priorityDetails', function() {
return function(priority) {
if (+priority === 1 || +priority === 2 || +priority === 3 || +priority === 4) {
return t('tasks', 'high priority');
var string;
string = t('tasks', 'priority %s: ').replace('%s', priority);
if (+priority === 6 || +priority === 7 || +priority === 8 || +priority === 9) {
return string + ' ' + t('tasks', 'high');
} else if (+priority === 5) {
return t('tasks', 'medium priority');
} else if (+priority === 6 || +priority === 7 || +priority === 8 || +priority === 9) {
return t('tasks', 'low priority');
return string + ' ' + t('tasks', 'medium');
} else if (+priority === 1 || +priority === 2 || +priority === 3 || +priority === 4) {
return string + ' ' + t('tasks', 'low');
} else {
return t('tasks', 'no priority assigned');
}

View file

@ -197,27 +197,6 @@ class TasksService {
}
}
/**
* star or unstar task by id
*
* @param int $taskID
* @param bool $isStarred
*/
public function setStarred($taskID, $isStarred) {
try {
$vcalendar = \OC_Calendar_App::getVCalendar($taskID);
$vtodo = $vcalendar->VTODO;
if($isStarred) {
$vtodo->PRIORITY = 5; // prio: medium
} else {
$vtodo->PRIORITY = 0;
}
return \OC_Calendar_Object::edit($taskID, $vcalendar->serialize());
} catch(\Exception $e) {
return false;
}
}
/**
* set completeness of task in percent by id
*
@ -250,6 +229,28 @@ class TasksService {
}
}
/**
* set priority of task by id
*
* @param int $taskID
* @param int $priority
* @return bool
*/
public function setPriority($taskID, $priority){
try {
$vcalendar = \OC_Calendar_App::getVCalendar($taskID);
$vtodo = $vcalendar->VTODO;
if($priority){
$vtodo->PRIORITY = (10 - $priority) % 10;
}else{
$vtodo->__unset('PRIORITY');
}
return \OC_Calendar_Object::edit($taskID, $vcalendar->serialize());
} catch(\Exception $e) {
return false;// throw new BusinessLayerException($e->getMessage());
}
}
/**
* set due date of task by id
*

View file

@ -5,7 +5,7 @@
<text>{{ list.displayname }}</text>
</h2>
<ol class="tasks">
<li ng-animate="'animate'" ng-repeat="task in tasks | filter:filterTasks(task,list.id) | filter:filterTasks(task,route.listID) | filter:filterTasksByString(task) | orderBy:sortDue | orderBy:'starred':true | orderBy:'completed_date':true"
<li ng-animate="'animate'" ng-repeat="task in tasks | filter:filterTasks(task,list.id) | filter:filterTasks(task,route.listID) | filter:filterTasksByString(task) | orderBy:sortDue | orderBy:'priority':true | orderBy:'completed_date':true"
class="task-item ui-draggable handler" rel="{{ task.id }}" ng-click="openDetails(task.id,$event)" ng-class="{done: task.completed}" oc-drag-task>
<div class="task-body">
<div class="percentdone" style="width:{{ task.complete }}%; background-color:{{list.calendarcolor}};"></div>
@ -14,7 +14,7 @@
</a>
<a class="icon task-separator"></a>
<a class="task-star handler" ng-click="toggleStarred(task.id)">
<span class="icon task-star faded" ng-class="{'task-starred': task.starred}"></span>
<span class="icon task-star faded" ng-class="{'high':task.priority>5,'medium':task.priority==5,'low':task.priority > 0 && task.priority < 5}"></span>
</a>
<a class="duedate" ng-class="{overdue: TasksModel.overdue(task.due)}">{{ task.due | dateTaskList }}</a>
<div class="title-wrapper" ng-class="{attachment: task.note!=''}">

View file

@ -4,7 +4,7 @@
<text>{{ day | day }}</text>
</h2>
<ol class="tasks">
<li ng-animate="'animate'" ng-repeat="task in getTasksAtDay(tasks, day) | filter:filterTasksByString(task) | filter:{'completed':'false'} | orderBy:sortDue | orderBy:'starred':true"
<li ng-animate="'animate'" ng-repeat="task in getTasksAtDay(tasks, day) | filter:filterTasksByString(task) | filter:{'completed':'false'} | orderBy:sortDue | orderBy:'priority':true"
class="task-item ui-draggable handler" rel="{{ task.id }}" ng-click="openDetails(task.id,$event)" ng-class="{done: task.completed}" oc-drag-task>
<div class="task-body">
<div class="percentdone" style="width:{{ task.complete }}%; background-color:{{ getTaskColor(task.calendarid) }};"></div>
@ -13,7 +13,7 @@
</a>
<a class="icon task-separator"></a>
<a class="task-star handler" ng-click="toggleStarred(task.id)">
<span class="icon task-star faded" ng-class="{'task-starred': task.starred}"></span>
<span class="icon task-star faded" ng-class="{'high':task.priority>5,'medium':task.priority==5,'low':task.priority > 0 && task.priority < 5}"></span>
</a>
<a class="duedate" ng-class="{overdue: TasksModel.overdue(task.due)}">{{ task.due | dateTaskList }}</a>
<a class="listname" >{{ getTaskList(task.calendarid) }}</a>

View file

@ -4,7 +4,7 @@
<span class="icon detail-checkbox" ng-class="{'detail-checked':task.completed}"></span>
</a>
<a class="detail-star" ng-click="toggleStarred(task.id)">
<span class="icon detail-star" ng-class="{'detail-starred':task.starred}"></span>
<span class="icon detail-star" ng-class="{'high':task.priority>5,'medium':task.priority==5,'low':task.priority > 0 && task.priority < 5}"></span>
</a>
<div class="title" ng-class="{'editing':route.parameter=='name'}">
<span class="title-text handler" ng-class="{'strike-through':task.completed}" ng-click="editName()"
@ -71,10 +71,24 @@
</div>
</div>
</div>
<div class="section detail-priority handler" ng-class="{'editing':route.parameter=='priority','high':task.priority>5,'medium':task.priority==5,'low':task.priority > 0 && task.priority < 5}" ng-click="editPriority($event)">
<span class="icon detail-priority"></span>
<div class="section-title">
<text>{{ task.priority | priorityDetails}}</text>
</div>
<a class="detail-delete handler end-edit" ng-click="deletePriority()">
<span class="icon detail-delete"></span>
</a>
<span class="icon detail-save handler end-edit"></span>
<div class="section-edit">
<input class="priority-input" type="text" ng-model="task.priority">
<input type="range" ng-model="task.priority" min="0" max="9" step ="1">
</div>
</div>
<div class="section detail-complete handler" ng-class="{'editing':route.parameter=='percent', 'date':task.complete>0}" ng-click="editPercent($event)">
<span class="icon detail-percent"></span>
<div class="section-title">
<text rel="">{{ task.complete | percentDetails}}</text>
<text>{{ task.complete | percentDetails}}</text>
</div>
<a class="detail-delete handler end-edit" ng-click="deletePercent()">
<span class="icon detail-delete"></span>

View file

@ -2,7 +2,7 @@
<div ng-if="route.listID != 'week' && route.listID != 'starred' && route.listID != 'completed' && route.listID != 'all' && route.listID != 'today' && route.listID != 'current'">
<div class="grouped-tasks" ng-class="{'completed-hidden':!settingsmodel.getById('various').showHidden}">
<ol class="tasks" rel="uncompleted" oc-drop-task>
<li ng-repeat="(id, task) in tasks | filter:filterTasks(task,route.listID) | filter:{'completed':'false'} | filter:filterTasksByString(task) | orderBy:sortDue | orderBy:'starred':true"
<li ng-repeat="(id, task) in tasks | filter:filterTasks(task,route.listID) | filter:{'completed':'false'} | filter:filterTasksByString(task) | orderBy:sortDue | orderBy:'priority':true"
class="task-item ui-draggable handler" rel="{{ task.id }}" ng-click="openDetails(task.id,$event)" ng-class="{done: task.completed}" oc-drag-task>
<div class="task-body">
<div class="percentdone" style="width:{{ task.complete }}%; background-color:{{ getTaskColor(task.calendarid) }};"></div>
@ -11,7 +11,7 @@
</a>
<a class="icon task-separator"></a>
<a class="task-star handler" ng-click="toggleStarred(task.id)">
<span class="icon task-star faded" ng-class="{'task-starred': task.starred}"></span>
<span class="icon task-star faded" ng-class="{'high':task.priority>5,'medium':task.priority==5,'low':task.priority > 0 && task.priority < 5}"></span>
</a>
<a class="duedate" ng-class="{overdue: TasksModel.overdue(task.due)}">{{ task.due | dateTaskList }}</a>
<div class="title-wrapper" ng-class="{attachment: task.note!=''}">
@ -41,7 +41,7 @@
</a>
<a class="icon task-separator"></a>
<a class="task-star handler" ng-click="toggleStarred(task.id)">
<span class="icon task-star faded" ng-class="{'task-starred': task.starred}"></span>
<span class="icon task-star faded" ng-class="{'high':task.priority>5,'medium':task.priority==5,'low':task.priority > 0 && task.priority < 5}"></span>
</a>
<a class="duedate" ng-class="{overdue: TasksModel.overdue(task.due)}">{{ task.due | dateTaskList }}</a>
<div class="title-wrapper" ng-class="{attachment: task.note!=''}">