Skip to content
Browse files

Fixed a few issues with editable item lists in JS

  • Loading branch information...
1 parent 5a59650 commit 8717050fefe848029e9c25f187e956536283da78 @dtdesign dtdesign committed May 21, 2012
Showing with 6 additions and 1 deletion.
  1. +6 −1 wcfsetup/install/files/js/WCF.js
View
7 wcfsetup/install/files/js/WCF.js
@@ -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)) {
@TimWolla
WoltLab GmbH member
TimWolla added a note May 21, 2012

I'd rewrite this according to De Morgans's laws

@dtdesign
WoltLab GmbH member
dtdesign added a note May 21, 2012

It was intentionally written this way to make the condition way more understandable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ return true;
+ }
}
var $listItem = $('<li class="badge">' + data.label + '</li>').data('objectID', data.objectID).data('label', data.label).appendTo(this._itemList);

0 comments on commit 8717050

Please sign in to comment.
Something went wrong with that request. Please try again.