summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/tasklist/tasklist.js21
1 files changed, 19 insertions, 2 deletions
diff --git a/plugins/tasklist/tasklist.js b/plugins/tasklist/tasklist.js
index 198ba82..d318011 100644
--- a/plugins/tasklist/tasklist.js
+++ b/plugins/tasklist/tasklist.js
@@ -998,7 +998,8 @@ function rcube_tasklist_ui(settings)
// append inherited tags
if (itags.length) {
$.each(itags, function(i,val){
- $('<span>').addClass('tag-element inherit').html(Q(val)).appendTo(taglist);
+ if (!rec.tags || rec.tags.indexOf(val) < 0)
+ $('<span>').addClass('tag-element inherit').html(Q(val)).appendTo(taglist);
});
// re-sort tags list
$(taglist).children().sortElements(function(a,b){
@@ -1498,7 +1499,7 @@ function rcube_tasklist_ui(settings)
}
}
- return itags;
+ return $.unqiqueStrings(itags);
}
/**
@@ -1816,6 +1817,22 @@ jQuery.fn.sortElements = (function(){
};
})();
+// equivalent to $.unique() but working on arrays of strings
+jQuery.unqiqueStrings = (function() {
+ return function(arr) {
+ var hash = {}, out = [];
+
+ for (var i = 0; i < arr.length; i++) {
+ hash[arr[i]] = 0;
+ }
+ for (var val in hash) {
+ out.push(val);
+ }
+
+ return out;
+ };
+})();
+
/* tasklist plugin UI initialization */
var rctasks;