summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-08-11 12:40:48 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-08-11 12:40:48 +0300
commit91d6f916c75a36b04f171d974801115ef0a43a2e (patch)
tree91a903b613f6853b8c68043abc8298ecc4131d56
parentd4b17700082357536aff47827d5bbf903ef02ac6 (diff)
parent15c682fcb01807b8c7c857aba213f2f14904083d (diff)
downloadgitlab-ce-91d6f916c75a36b04f171d974801115ef0a43a2e.tar.gz
Merge pull request #7432 from Razer6/disable_comment_btn_if_empty
Disable 'Save changes' button if input is empty, fixes #6351
-rw-r--r--app/assets/javascripts/notes.js.coffee4
-rw-r--r--app/views/projects/notes/_note.html.haml4
2 files changed, 5 insertions, 3 deletions
diff --git a/app/assets/javascripts/notes.js.coffee b/app/assets/javascripts/notes.js.coffee
index 607b109dc0b..83b1bae0ea1 100644
--- a/app/assets/javascripts/notes.js.coffee
+++ b/app/assets/javascripts/notes.js.coffee
@@ -321,7 +321,9 @@ class Notes
GitLab.GfmAutoComplete.setup()
form = note.find(".note-edit-form")
form.show()
- form.find("textarea").focus()
+ textarea = form.find("textarea")
+ textarea.focus()
+ disableButtonIfEmptyField textarea, form.find(".js-comment-button")
###
Called in response to clicking the edit note link
diff --git a/app/views/projects/notes/_note.html.haml b/app/views/projects/notes/_note.html.haml
index 2fd8cb6d489..5e84aed0cc4 100644
--- a/app/views/projects/notes/_note.html.haml
+++ b/app/views/projects/notes/_note.html.haml
@@ -38,10 +38,10 @@
= f.text_area :note, class: 'note_text js-note-text js-gfm-input turn-on'
.form-actions.clearfix
- = f.submit 'Save changes', class: "btn btn-primary btn-save"
+ = f.submit 'Save changes', class: "btn btn-primary btn-save js-comment-button"
.note-form-option
- %a.choose-btn.btn.btn-small.js-choose-note-attachment-button
+ %a.choose-btn.btn.js-choose-note-attachment-button
%i.icon-paper-clip
%span Choose File ...
&nbsp;