diff options
author | Bart Visscher <bartv@thisnet.nl> | 2012-05-02 17:28:19 +0200 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2012-05-02 17:28:19 +0200 |
commit | 71f9b1968e3d4decc4395db2a1555a872cbb2820 (patch) | |
tree | 2d67a76cf852cce9e9468242fa5363e6d69103a9 /apps/tasks | |
parent | 6e7f5ec4ce45775ebc99482c5d38fb5acfc95f8b (diff) | |
download | nextcloud-server-71f9b1968e3d4decc4395db2a1555a872cbb2820.tar.gz nextcloud-server-71f9b1968e3d4decc4395db2a1555a872cbb2820.zip |
Tasks: Make it possible to close the details area
Diffstat (limited to 'apps/tasks')
-rw-r--r-- | apps/tasks/css/style.css | 1 | ||||
-rw-r--r-- | apps/tasks/js/tasks.js | 42 | ||||
-rw-r--r-- | apps/tasks/templates/tasks.php | 3 |
3 files changed, 35 insertions, 11 deletions
diff --git a/apps/tasks/css/style.css b/apps/tasks/css/style.css index 95dec3f8d08..0ec8f5702a6 100644 --- a/apps/tasks/css/style.css +++ b/apps/tasks/css/style.css @@ -49,6 +49,7 @@ .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;} +.task_less{display:none;} .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 197988f79a8..7bd210a8a61 100644 --- a/apps/tasks/js/tasks.js +++ b/apps/tasks/js/tasks.js @@ -50,18 +50,17 @@ OC.Tasks = { .text(task.location) .appendTo(task_container); } - if (task.categories.length > 0) { - var categories = $('<div>') - .addClass('categories') - .appendTo(task_container); - $(task.categories).each(function(i, category){ - categories.append($('<a>') - .addClass('tag') - .text(category) - ); - }); - } + var $categories = $('<div>') + .addClass('categories') + .appendTo(task_container); + $(task.categories).each(function(i, category){ + $categories.append($('<a>') + .addClass('tag') + .text(category) + ); + }); task_container.find('.task_more').click(OC.Tasks.moreClickHandler); + task_container.find('.task_less').click(OC.Tasks.lessClickHandler); var description = $('<textarea>') .addClass('description') .blur(function(){ @@ -113,6 +112,13 @@ OC.Tasks = { $.post('ajax/update_property.php', {id:task.id, type:'categories', categories:categories}, function(jsondata){ if(jsondata.status == 'success') { task.categories = categories.split(','); + $categories.empty(); + $(task.categories).each(function(i, category){ + $categories.append($('<a>') + .addClass('tag') + .text(category) + ); + }); } }); }) @@ -126,6 +132,7 @@ OC.Tasks = { $.post('ajax/update_property.php', {id:task.id, type:'location', location:location}, function(jsondata){ if(jsondata.status == 'success') { task.location = location; + task_container.find('.location').text(location); } }); }) @@ -248,11 +255,24 @@ OC.Tasks = { var $task = $(this).closest('.task'), task = $task.data('task'); $task.find('.more').show(); + $task.find('.task_more').hide(); + $task.find('.task_less').show(); $task.find('div.categories').hide(); $task.find('input.categories').show(); $task.find('div.location').hide(); $task.find('input.location').show(); }, + lessClickHandler:function(event){ + var $task = $(this).closest('.task'), + task = $task.data('task'); + $task.find('.more').hide(); + $task.find('.task_more').show(); + $task.find('.task_less').hide(); + $task.find('div.categories').show(); + $task.find('input.categories').hide(); + $task.find('div.location').show(); + $task.find('input.location').hide(); + }, complete_task:function() { var $task = $(this).closest('.task'), task = $task.data('task'), diff --git a/apps/tasks/templates/tasks.php b/apps/tasks/templates/tasks.php index 90196dfc5b6..98698400797 100644 --- a/apps/tasks/templates/tasks.php +++ b/apps/tasks/templates/tasks.php @@ -22,6 +22,9 @@ <span class="task_more"> <img title="<?php echo $l->t('More') ?>" src="<?php echo image_path('core', 'actions/triangle-s.svg') ?>" class="svg"><?php echo $l->t('More') ?> </span> + <span class="task_less"> + <img title="<?php echo $l->t('Less') ?>" src="<?php echo image_path('core', 'actions/triangle-n.svg') ?>" class="svg"><?php echo $l->t('Less') ?> + </span> </p> <script type='text/javascript'> var categories = <?php echo json_encode($_['categories']); ?>; |