summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2013-10-24 17:26:22 (GMT)
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2013-10-31 11:52:56 (GMT)
commitdd26bb533301f99d327b561179a6a64853b7e644 (patch)
treeae323aafe82c2415cd7288bd7453835f0f610db2
parentfb0e0417f142847b5c376969d6a807cb3e429c8c (diff)
downloadroundcubemail-plugins-kolab-dd26bb533301f99d327b561179a6a64853b7e644.tar.gz
Re-calculate tag counts after updating a task item
-rw-r--r--plugins/tasklist/tasklist.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/plugins/tasklist/tasklist.js b/plugins/tasklist/tasklist.js
index c9146f2..8fd1889 100644
--- a/plugins/tasklist/tasklist.js
+++ b/plugins/tasklist/tasklist.js
@@ -601,6 +601,21 @@ function rcube_tasklist_ui(settings)
*/
function update_tagcloud(counts)
{
+ // compute counts first by iterating over all visible task items
+ if (typeof counts == 'undefined') {
+ counts = {};
+ $('li.taskitem', rcmail.gui_objects.resultlist).each(function(i,li){
+ var t, id = $(li).attr('rel'),
+ rec = listdata[id];
+ for (var j=0; rec && rec.tags && j < rec.tags.length; j++) {
+ t = rec.tags[j];
+ if (typeof counts[t] == 'undefined')
+ counts[t] = 0;
+ counts[t]++;
+ }
+ });
+ }
+
$(rcmail.gui_objects.tagslist).children('li').each(function(i,li){
var elem = $(li), tag = elem.attr('rel'),
count = counts[tag] || 0;
@@ -741,6 +756,7 @@ function rcube_tasklist_ui(settings)
}
append_tags(rec.tags || []);
+ update_tagcloud();
fix_tree_toggles();
}