aboutsummaryrefslogtreecommitdiffstats
path: root/apps/tasks
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2012-04-23 18:03:19 +0200
committerBart Visscher <bartv@thisnet.nl>2012-04-23 18:28:44 +0200
commit728e6a6bf9540b845073c4c8fb96dd7eb1dffa3a (patch)
treecfb847ea76699169297ea9677fb181918275d785 /apps/tasks
parentacea156a3d4ba94844b23946b2f24e8205f42462 (diff)
downloadnextcloud-server-728e6a6bf9540b845073c4c8fb96dd7eb1dffa3a.tar.gz
nextcloud-server-728e6a6bf9540b845073c4c8fb96dd7eb1dffa3a.zip
Tasks: Simple categories input
Diffstat (limited to 'apps/tasks')
-rw-r--r--apps/tasks/ajax/update_property.php4
-rw-r--r--apps/tasks/css/style.css5
-rw-r--r--apps/tasks/js/tasks.js23
3 files changed, 30 insertions, 2 deletions
diff --git a/apps/tasks/ajax/update_property.php b/apps/tasks/ajax/update_property.php
index 7128aee8d39..a14816be127 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 'categories':
+ $categories = $_POST['categories'];
+ $vtodo->setString('CATEGORIES', $categories);
+ break;
case 'due':
$due = $_POST['due'];
$due_date_only = $_POST['date'];
diff --git a/apps/tasks/css/style.css b/apps/tasks/css/style.css
index 084085d6b76..e619be67852 100644
--- a/apps/tasks/css/style.css
+++ b/apps/tasks/css/style.css
@@ -46,11 +46,12 @@
.task .categories{position:absolute;right:6em;text-align:right;top:0.4em}
.task .categories a{background-color:#1d2d44;color:white;}
-.task .categories .tag.active{display:none}
+.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 .more{display:none;}
+.task .more{display:none;margin-top:0.5em;}
.task .description{position:relative;left:4em;}
.task .due{position:absolute;right:0.3em;}
diff --git a/apps/tasks/js/tasks.js b/apps/tasks/js/tasks.js
index 3647107eab8..bf28626d09b 100644
--- a/apps/tasks/js/tasks.js
+++ b/apps/tasks/js/tasks.js
@@ -103,6 +103,20 @@ OC.Tasks = {
.append(description)
.append(due)
.appendTo(task_container);
+ $('<input placeholder="'+t('tasks', 'List')+'">')
+ .addClass('categories')
+ .multiple_autocomplete({source: categories})
+ .val(task.categories)
+ .blur(function(){
+ var task = $(this).closest('.task').data('task');
+ var categories = $(this).val();
+ $.post('ajax/update_property.php', {id:task.id, type:'categories', categories:categories}, function(jsondata){
+ if(jsondata.status == 'success') {
+ task.categories = categories.split(',');
+ }
+ });
+ })
+ .appendTo(task_container);
return task_container;
},
filter:function(tag, find_filter) {
@@ -221,6 +235,8 @@ OC.Tasks = {
var $task = $(this).closest('.task'),
task = $task.data('task');
$task.find('.more').show();
+ $task.find('div.categories').hide();
+ $task.find('input.categories').show();
},
complete_task:function() {
var $task = $(this).closest('.task'),
@@ -242,6 +258,11 @@ OC.Tasks = {
}
}, 'json');
},
+ categoriesChanged:function(newcategories){
+ categories = $.map(newcategories, function(v) {return v;});
+ console.log('Task categories changed to: ' + categories);
+ $('input.categories').multiple_autocomplete('option', 'source', categories);
+ },
List: {
create_list_div:function(category){
return $('<div>').text(category)
@@ -283,6 +304,8 @@ $(document).ready(function(){
});
$(this).toggleClass('active');
});
+ OCCategories.changed = OC.Tasks.categoriesChanged;
+ OCCategories.app = 'calendar';
});
/*-------------------------------------------------------------------------