diff options
author | Alfredo Sumaran <alfredo@gitlab.com> | 2016-08-24 19:29:25 -0500 |
---|---|---|
committer | Alfredo Sumaran <alfredo@gitlab.com> | 2016-08-24 19:29:25 -0500 |
commit | 1bc53bc8702ea0cda02a368ba9ca0516ad1e3947 (patch) | |
tree | 8412e1b93a1304fd027c656747e561719c9c1980 | |
parent | 6fb46b604e4feebcbaa92d3d44d7616be709c0e5 (diff) | |
download | gitlab-ce-1bc53bc8702ea0cda02a368ba9ca0516ad1e3947.tar.gz |
Ensure we update the label after input is added919-protected-branch-dropdown-all-users
-rw-r--r-- | app/assets/javascripts/gl_dropdown.js | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/app/assets/javascripts/gl_dropdown.js b/app/assets/javascripts/gl_dropdown.js index 0179b320a3b..521ffb405be 100644 --- a/app/assets/javascripts/gl_dropdown.js +++ b/app/assets/javascripts/gl_dropdown.js @@ -565,10 +565,6 @@ } else { field.remove(); } - if (this.options.toggleLabel) { - this.updateLabel(selectedObject, el, this); - } - return selectedObject; } else if (el.hasClass(INDETERMINATE_CLASS)) { el.addClass(ACTIVE_CLASS); el.removeClass(INDETERMINATE_CLASS); @@ -578,7 +574,6 @@ if (!field.length && fieldName) { this.addInput(fieldName, value, selectedObject); } - return selectedObject; } else { if (!this.options.multiSelect || el.hasClass('dropdown-clear-active')) { this.dropdown.find("." + ACTIVE_CLASS).removeClass(ACTIVE_CLASS); @@ -590,9 +585,6 @@ field.remove(); } el.addClass(ACTIVE_CLASS); - if (this.options.toggleLabel) { - this.updateLabel(selectedObject, el, this); - } if (value != null) { if (!field.length && fieldName) { this.addInput(fieldName, value, selectedObject); @@ -600,8 +592,14 @@ field.val(value).trigger('change'); } } - return selectedObject; } + + // Update label right after input has been added + if (this.options.toggleLabel) { + this.updateLabel(selectedObject, el, this); + } + + return selectedObject; }; GitLabDropdown.prototype.addInput = function(fieldName, value, selectedObject) { |