diff options
author | Bart Visscher <bartv@thisnet.nl> | 2012-06-21 18:21:38 +0200 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2012-06-21 19:49:28 +0200 |
commit | b17e6826099f2ba58d1abd246cf3c103520efea4 (patch) | |
tree | ab96aa5e6839454ebb89ea01a542ad1bac387111 | |
parent | 10351550cd822c08b605ce9a249ff880c64b0211 (diff) | |
download | nextcloud-server-b17e6826099f2ba58d1abd246cf3c103520efea4.tar.gz nextcloud-server-b17e6826099f2ba58d1abd246cf3c103520efea4.zip |
Tasks: Add delete action
-rw-r--r-- | apps/tasks/css/style.css | 2 | ||||
-rw-r--r-- | apps/tasks/js/tasks.js | 30 | ||||
-rw-r--r-- | apps/tasks/templates/tasks.php | 3 |
3 files changed, 20 insertions, 15 deletions
diff --git a/apps/tasks/css/style.css b/apps/tasks/css/style.css index ccebe60df0f..80b6e777b5d 100644 --- a/apps/tasks/css/style.css +++ b/apps/tasks/css/style.css @@ -58,3 +58,5 @@ .task .due{position:absolute;right:0.3em;} .task .due .date{width:6em;} .task .due .time{width:6em;} + +.task_delete{position:absolute;bottom:2px;right:5px} diff --git a/apps/tasks/js/tasks.js b/apps/tasks/js/tasks.js index 6547b80981c..bc92965bb0b 100644 --- a/apps/tasks/js/tasks.js +++ b/apps/tasks/js/tasks.js @@ -97,8 +97,10 @@ OC.Tasks = { due.find('.time').timepicker('setTime', date.getHours()+':'+date.getMinutes()); } } + var delete_action = task_container.find('.task_delete').click(OC.Tasks.deleteClickHandler); $('<div>') .addClass('more') + .append(delete_action) .append(description) .append(due) .appendTo(task_container); @@ -273,6 +275,19 @@ OC.Tasks = { $task.find('div.location').show(); $task.find('input.location').hide(); }, + deleteClickHandler:function(event){ + var $task = $(this).closest('.task'), + task = $task.data('task'); + $.post(OC.filePath('tasks', 'ajax', 'delete.php'),{'id':task.id},function(jsondata){ + if(jsondata.status == 'success'){ + $task.remove(); + } + else{ + alert(jsondata.data.message); + } + }); + return false; + }, complete_task:function() { var $task = $(this).closest('.task'), task = $task.data('task'), @@ -441,21 +456,6 @@ $(document).ready(function(){ }); }); - $('#tasks_delete').live('click',function(){ - var id = $('#task_details').data('id'); - $.post('ajax/delete.php',{'id':id},function(jsondata){ - if(jsondata.status == 'success'){ - $('#tasks [data-id="'+jsondata.data.id+'"]').remove(); - $('#task_details').data('id',''); - $('#task_details').html(''); - } - else{ - alert(jsondata.data.message); - } - }); - return false; - }); - $('#tasks_addtask').click(function(){ var input = $('#tasks_newtask').val(); $.post(OC.filePath('tasks', 'ajax', 'addtask.php'),{text:input},function(jsondata){ diff --git a/apps/tasks/templates/tasks.php b/apps/tasks/templates/tasks.php index c0e2f8d4e23..8c0c89e4970 100644 --- a/apps/tasks/templates/tasks.php +++ b/apps/tasks/templates/tasks.php @@ -25,6 +25,9 @@ <span class="task_less"> <img title="<?php echo $l->t('Less') ?>" src="<?php echo OCP\image_path('core', 'actions/triangle-n.svg') ?>" class="svg"><?php echo $l->t('Less') ?> </span> + <span class="task_delete"> + <img title="<?php echo $l->t('Delete') ?>" src="<?php echo OCP\image_path('core', 'actions/delete.svg') ?>" class="svg"><?php echo $l->t('Delete') ?> + </span> </p> <script type='text/javascript'> var categories = <?php echo json_encode($_['categories']); ?>; |