diff options
Diffstat (limited to 'apps/tasks/js/tasks.js')
-rw-r--r-- | apps/tasks/js/tasks.js | 30 |
1 files changed, 15 insertions, 15 deletions
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){ |