From 6e7f5ec4ce45775ebc99482c5d38fb5acfc95f8b Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Fri, 27 Apr 2012 20:26:12 +0200 Subject: [PATCH] Tasks: Add input to edit the task location --- apps/tasks/ajax/update_property.php | 4 ++++ apps/tasks/css/style.css | 5 +++-- apps/tasks/js/tasks.js | 15 +++++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/apps/tasks/ajax/update_property.php b/apps/tasks/ajax/update_property.php index a14816be12..b075489bd1 100644 --- a/apps/tasks/ajax/update_property.php +++ b/apps/tasks/ajax/update_property.php @@ -25,6 +25,10 @@ switch($property) { $description = $_POST['description']; $vtodo->setString('DESCRIPTION', $description); break; + case 'location': + $location = $_POST['location']; + $vtodo->setString('LOCATION', $location); + break; case 'categories': $categories = $_POST['categories']; $vtodo->setString('CATEGORIES', $categories); diff --git a/apps/tasks/css/style.css b/apps/tasks/css/style.css index 6bc1213649..95dec3f8d0 100644 --- a/apps/tasks/css/style.css +++ b/apps/tasks/css/style.css @@ -40,12 +40,13 @@ .task .tag.active{border-color:black;opacity:0.6;} .task .tag.active:hover{opacity:0.8;} -.task .categories{position:absolute;right:6em;text-align:right;top:0.4em} +.task .categories{position:absolute;right:12em;text-align:right;top:0.4em} .task .categories a{background-color:#1d2d44;color:white;} .task .categories .tag.active{display:none;} .task input.categories{display:none;top:0;text-align:left;} -.task .location{background-color:#442d44;color:white;position:absolute;right:0.6em;width:4.2em;text-align:left;top:0.4em} +.task .location{background-color:#442d44;color:white;position:absolute;right:0.6em;width:9.2em;text-align:left;top:0.4em} +.task input.location{display:none;top:0;text-align:left;right:0.3em;background-color:white;color:#333333;} .task .more{display:none;margin-top:0.5em;} diff --git a/apps/tasks/js/tasks.js b/apps/tasks/js/tasks.js index 43d7284f79..197988f79a 100644 --- a/apps/tasks/js/tasks.js +++ b/apps/tasks/js/tasks.js @@ -117,6 +117,19 @@ OC.Tasks = { }); }) .appendTo(task_container); + $('') + .addClass('location') + .val(task.location) + .blur(function(){ + var task = $(this).closest('.task').data('task'); + var location = $(this).val(); + $.post('ajax/update_property.php', {id:task.id, type:'location', location:location}, function(jsondata){ + if(jsondata.status == 'success') { + task.location = location; + } + }); + }) + .appendTo(task_container); return task_container; }, filter:function(tag, find_filter) { @@ -237,6 +250,8 @@ OC.Tasks = { $task.find('.more').show(); $task.find('div.categories').hide(); $task.find('input.categories').show(); + $task.find('div.location').hide(); + $task.find('input.location').show(); }, complete_task:function() { var $task = $(this).closest('.task'),