Fixed tag handling
authorAlexander Ebert <ebert@woltlab.com>
Sat, 17 May 2014 13:19:05 +0000 (15:19 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sat, 17 May 2014 13:19:05 +0000 (15:19 +0200)
wcfsetup/install/files/js/WCF.Tagging.js

index 0bdc34ac1712b554fae6f39e8dc4a9baf74e55f0..05315ee92c92002f5fb9909af37048dc753de047 100644 (file)
@@ -96,10 +96,20 @@ WCF.Tagging.TagList = WCF.EditableItemList.extend({
                        data.label = data.label.substr(0, this._maxLength);
                }
                
-               var result = this._super(data);
-               $(this._itemList).find('.badge:not(tag)').addClass('tag');
+               if (WCF.inArray(data.label, this._data)) {
+                       return true;
+               }
+               
+               var $listItem = $('<li class="badge tag">' + WCF.String.escapeHTML(data.label) + '</li>').data('objectID', data.objectID).data('label', data.label).appendTo(this._itemList);
+               $listItem.click($.proxy(this._click, this));
+               
+               if (this._search) {
+                       this._search.addExcludedSearchValue(data.label);
+               }
+               
+               this._addItem(data.objectID, data.label);
                
-               return result;
+               return true;
        },
        
        /**