summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/labels_select.js.coffee
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/labels_select.js.coffee')
-rw-r--r--app/assets/javascripts/labels_select.js.coffee12
1 files changed, 11 insertions, 1 deletions
diff --git a/app/assets/javascripts/labels_select.js.coffee b/app/assets/javascripts/labels_select.js.coffee
index 4a0c18a99a6..f3cb1e3bc09 100644
--- a/app/assets/javascripts/labels_select.js.coffee
+++ b/app/assets/javascripts/labels_select.js.coffee
@@ -14,6 +14,9 @@ class @LabelsSelect
defaultLabel = $dropdown.data('default-label')
if newLabelField.length
+ $newLabelError = $dropdown.parent().find('.js-label-error')
+ $newLabelError.hide()
+
$('.suggest-colors-dropdown a').on 'click', (e) ->
e.preventDefault()
e.stopPropagation()
@@ -27,6 +30,7 @@ class @LabelsSelect
e.stopPropagation()
if newLabelField.val() isnt '' and newColorField.val() isnt ''
+ $newLabelError.hide()
$('.js-new-label-btn').disable()
# Create new label with API
@@ -35,7 +39,13 @@ class @LabelsSelect
color: newColorField.val()
}, (label) ->
$('.js-new-label-btn').enable()
- $('.dropdown-menu-back', $dropdown.parent()).trigger 'click'
+
+ if label.message?
+ $newLabelError
+ .text label.message
+ .show()
+ else
+ $('.dropdown-menu-back', $dropdown.parent()).trigger 'click'
$dropdown.glDropdown(
data: (term, callback) ->