Fixed a few issues with editable item lists in JS
authorAlexander Ebert <ebert@woltlab.com>
Sun, 20 May 2012 23:36:26 +0000 (01:36 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sun, 20 May 2012 23:36:26 +0000 (01:36 +0200)
wcfsetup/install/files/js/WCF.js

index a24b7a8d0a96f2962691b42ab187dbff553b3843..93a9e3b3efac22a7e11a398d177723425f414584 100644 (file)
@@ -5564,6 +5564,9 @@ WCF.EditableItemList = Class.extend({
                                                label: self._searchInput.val()
                                        });
                                        
+                                       // reset input
+                                       $(this).val('');
+                                       
                                        event.stopPropagation();
                                        return false;
                                }
@@ -5627,7 +5630,9 @@ WCF.EditableItemList = Class.extend({
         */
        addItem: function(data) {
                if (this._data[data.objectID]) {
-                       return true;
+                       if (!(data.objectID === 0 && this._allowCustomInput)) {
+                               return true;
+                       }
                }
                
                var $listItem = $('<li class="badge">' + data.label + '</li>').data('objectID', data.objectID).data('label', data.label).appendTo(this._itemList);