Disable 'Save changes' button if input is empty, fixes #6351

This commit is contained in:
Robert Schilling 2014-08-04 20:29:17 +02:00
parent d4f5af820f
commit 15c682fcb0
2 changed files with 5 additions and 3 deletions

View file

@ -321,7 +321,9 @@ class Notes
GitLab.GfmAutoComplete.setup() GitLab.GfmAutoComplete.setup()
form = note.find(".note-edit-form") form = note.find(".note-edit-form")
form.show() 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 Called in response to clicking the edit note link

View file

@ -38,10 +38,10 @@
= f.text_area :note, class: 'note_text js-note-text js-gfm-input turn-on' = f.text_area :note, class: 'note_text js-note-text js-gfm-input turn-on'
.form-actions.clearfix .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 .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 %i.icon-paper-clip
%span Choose File ... %span Choose File ...