diff options
author | Alfredo Sumaran <alfredo@gitlab.com> | 2017-04-06 01:31:44 -0500 |
---|---|---|
committer | Alfredo Sumaran <alfredo@gitlab.com> | 2017-04-06 01:31:44 -0500 |
commit | 5200686bd980751d73738fdecd8232b682a7fcdc (patch) | |
tree | d7c5035df1cbfe7312f34618a829201723d97865 | |
parent | d9dedac8589c8ec7f41354d3920ae5f9feb44345 (diff) | |
download | gitlab-ce-5200686bd980751d73738fdecd8232b682a7fcdc.tar.gz |
Disable submit button and dropdown when submitt comment form
-rw-r--r-- | app/assets/javascripts/notes.js | 7 | ||||
-rw-r--r-- | app/views/projects/notes/_comment_type_button.html.haml | 3 |
2 files changed, 8 insertions, 2 deletions
diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js index 83c33cbe885..ee62ca2fbfb 100644 --- a/app/assets/javascripts/notes.js +++ b/app/assets/javascripts/notes.js @@ -112,10 +112,17 @@ require('./task_list'); // when issue status changes, we need to refresh data $(document).on("issuable:change", this.refresh); + $(document).on('submit', '.js-main-target-form', this.disableDropdown) + // when a key is clicked on the notes return $(document).on("keydown", ".js-note-text", this.keydownNoteText); }; + Notes.prototype.disableDropdown = function(e) { + const $form = $(e.target); + $form.find('.js-note-new-discussion').disable(); + }; + Notes.prototype.cleanBinding = function() { $(document).off("ajax:success", ".js-main-target-form"); $(document).off("ajax:success", ".js-discussion-note-form"); diff --git a/app/views/projects/notes/_comment_type_button.html.haml b/app/views/projects/notes/_comment_type_button.html.haml index 078b606eda8..2a851d57fd6 100644 --- a/app/views/projects/notes/_comment_type_button.html.haml +++ b/app/views/projects/notes/_comment_type_button.html.haml @@ -1,8 +1,7 @@ - noteable_type = @note.noteable_type .pull-left.btn-group.append-right-10.comment-type-dropdown.js-comment-type-dropdown - %button.btn.btn-nr.btn-create.comment-btn.js-comment-button.js-comment-submit-button - Comment + %input.btn.btn-nr.btn-create.comment-btn.js-comment-button.js-comment-submit-button{ type: 'submit', value: 'Comment' } - if @note.can_be_discussion_note? = button_tag type: 'button', class: 'btn btn-nr dropdown-toggle comment-btn js-note-new-discussion', data: { 'dropdown-trigger' => '#resolvable-comment-menu' } do = icon('caret-down') |