summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorRobert Schilling <rschilling@student.tugraz.at>2014-08-13 14:22:34 +0200
committerRobert Schilling <rschilling@student.tugraz.at>2014-08-13 15:48:26 +0200
commit04ad197bcc41a26da2c2a80c5b4ffbfad2c296ee (patch)
tree3c98f24dcc3e6271d9f1c05e8324944dda6302a8 /app
parentb9519c83142d566ee562da57563db42849e91771 (diff)
downloadgitlab-ce-04ad197bcc41a26da2c2a80c5b4ffbfad2c296ee.tar.gz
Trigger an update of save button if user pressed a preview color
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/application.js.coffee6
-rw-r--r--app/assets/javascripts/labels.js.coffee4
2 files changed, 6 insertions, 4 deletions
diff --git a/app/assets/javascripts/application.js.coffee b/app/assets/javascripts/application.js.coffee
index 9c53d3b4cc0..1960479321c 100644
--- a/app/assets/javascripts/application.js.coffee
+++ b/app/assets/javascripts/application.js.coffee
@@ -59,18 +59,18 @@ window.rstrip = (val) ->
# Disable button if text field is empty
window.disableButtonIfEmptyField = (field_selector, button_selector) ->
field = $(field_selector)
- closest_submit = field.closest("form").find(button_selector)
+ closest_submit = field.closest('form').find(button_selector)
closest_submit.disable() if rstrip(field.val()) is ""
- field.on "input", ->
+ field.on 'input', ->
if rstrip($(@).val()) is ""
closest_submit.disable()
else
closest_submit.enable()
# Disable button if any input field with given selector is empty
-window.disableButtonIfEmptyField = (form, form_selector, button_selector) ->
+window.disableButtonIfAnyEmptyField = (form, form_selector, button_selector) ->
closest_submit = form.find(button_selector)
empty = false
form.find('input').filter(form_selector).each ->
diff --git a/app/assets/javascripts/labels.js.coffee b/app/assets/javascripts/labels.js.coffee
index ce566b5afa3..8e53d6929df 100644
--- a/app/assets/javascripts/labels.js.coffee
+++ b/app/assets/javascripts/labels.js.coffee
@@ -16,7 +16,7 @@ class Labels
# Initializes the form to disable the save button if no color or title is entered
setupLabelForm: (form) ->
- disableButtonIfEmptyField form, '.form-control', form.find('.js-save-button')
+ disableButtonIfAnyEmptyField form, '.form-control', form.find('.js-save-button')
# Updates the the preview color with the hex-color input
updateColorPreview: =>
@@ -28,6 +28,8 @@ class Labels
color = $(e.currentTarget).data('color')
$('input#label_color').val(color)
@updateColorPreview()
+ # Notify the form, that color has changed
+ $('.label-form').trigger('keyup')
e.preventDefault()
@Labels = Labels