summaryrefslogtreecommitdiffstats
path: root/apps/tasks/js
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2012-02-22 20:21:27 +0100
committerBart Visscher <bartv@thisnet.nl>2012-02-22 20:21:27 +0100
commit18bac944b4b0a63e99f6b6971de6ae788d3e39f1 (patch)
treead3b7d39992346f27eb5af9b0c6eef95d01ab0fb /apps/tasks/js
parent92db4f8be099c32b477bba33412b1d2fc7a04dbc (diff)
downloadnextcloud-server-18bac944b4b0a63e99f6b6971de6ae788d3e39f1.tar.gz
nextcloud-server-18bac944b4b0a63e99f6b6971de6ae788d3e39f1.zip
Change loading of tasks to ajax call
Diffstat (limited to 'apps/tasks/js')
-rw-r--r--apps/tasks/js/tasks.js38
1 files changed, 34 insertions, 4 deletions
diff --git a/apps/tasks/js/tasks.js b/apps/tasks/js/tasks.js
index e695925aad4..aba3eca7ce1 100644
--- a/apps/tasks/js/tasks.js
+++ b/apps/tasks/js/tasks.js
@@ -2,14 +2,44 @@ $(document).ready(function(){
/*-------------------------------------------------------------------------
* Actions for startup
*-----------------------------------------------------------------------*/
- if( $('#tasks li').length > 0 ){
- $('#tasks li').first().addClass('active');
- }
+ $.getJSON(OC.filePath('tasks', 'ajax', 'gettasks.php'), function(jsondata) {
+ var tasks = $('#tasks').empty();
+ var actions = $('#task_actions_template');
+ $(jsondata).each(function(i, task) {
+ var task_container = $('<div>').appendTo(tasks)
+ .addClass('task')
+ .data('task', task)
+ .attr('data-id', task.id)
+ .append($('<p>')
+ .html('<a href="index.php?id='+task.id+'">'+task.summary+'</a>')
+ .addClass('summary')
+ )
+ .append(actions.clone().removeAttr('id'))
+ ;
+ if (task.categories.length > 0) {
+ var categories = $('<div>')
+ .addClass('categories')
+ .appendTo(task_container);
+ $(task.categories).each(function(i, category){
+ categories.append($('<a>')
+ .text(category)
+ );
+ });
+ }
+ });
+ if( $('#tasks div').length > 0 ){
+ $('#tasks div').first().addClass('active');
+ }
+
+ });
+
+ fillHeight($('#tasks'));
+ fillWindow($('#task_details'));
/*-------------------------------------------------------------------------
* Event handlers
*-----------------------------------------------------------------------*/
- $('#tasks li').live('click',function(){
+ $('#tasks div').live('click',function(){
var id = $(this).data('id');
var oldid = $('#task_details').data('id');
if(oldid != 0){