From a68f1fdd2975a9e7cab39ab7d40e3eae2cc676db Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Wed, 5 Oct 2016 14:27:29 +0100 Subject: Fix form not re-enabling thanks to jQuery Stop issue being dragged if it doesn't have an ID --- app/assets/javascripts/boards/components/board_list.js.es6 | 2 +- app/assets/javascripts/boards/components/board_new_issue.js.es6 | 6 +++++- app/assets/javascripts/boards/models/list.js.es6 | 2 +- app/views/projects/boards/components/_board.html.haml | 3 ++- app/views/projects/boards/components/_card.html.haml | 2 +- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/boards/components/board_list.js.es6 b/app/assets/javascripts/boards/components/board_list.js.es6 index 208aac504fd..7022a29e818 100644 --- a/app/assets/javascripts/boards/components/board_list.js.es6 +++ b/app/assets/javascripts/boards/components/board_list.js.es6 @@ -76,7 +76,7 @@ group: 'issues', sort: false, disabled: this.disabled, - filter: '.board-list-count, .board-new-issue-form', + filter: '.board-list-count, .is-disabled', onStart: (e) => { const card = this.$refs.issue[e.oldIndex]; diff --git a/app/assets/javascripts/boards/components/board_new_issue.js.es6 b/app/assets/javascripts/boards/components/board_new_issue.js.es6 index eb26ed9721d..315c16ee242 100644 --- a/app/assets/javascripts/boards/components/board_new_issue.js.es6 +++ b/app/assets/javascripts/boards/components/board_new_issue.js.es6 @@ -25,7 +25,11 @@ labels }); - this.list.newIssue(issue); + this.list.newIssue(issue) + .then(() => { + // Need this because our jQuery very kindly disables buttons on ALL form submissions + $(this.$els.submitButton).enable(); + }); this.cancel(); }, diff --git a/app/assets/javascripts/boards/models/list.js.es6 b/app/assets/javascripts/boards/models/list.js.es6 index 14e42db4cd2..5d0a561cdba 100644 --- a/app/assets/javascripts/boards/models/list.js.es6 +++ b/app/assets/javascripts/boards/models/list.js.es6 @@ -91,7 +91,7 @@ class List { this.addIssue(issue); this.issuesSize++; - gl.boardService.newIssue(this.id, issue) + return gl.boardService.newIssue(this.id, issue) .then((resp) => { const data = resp.json(); issue.id = data.iid; diff --git a/app/views/projects/boards/components/_board.html.haml b/app/views/projects/boards/components/_board.html.haml index 4d7d8319204..26b2236b581 100644 --- a/app/views/projects/boards/components/_board.html.haml +++ b/app/views/projects/boards/components/_board.html.haml @@ -54,7 +54,8 @@ ":id" => "list.id + '-title'" } .clearfix.prepend-top-10 %button.btn.btn-success.pull-left{ type: "submit", - ":disabled" => "title === ''" } + ":disabled" => "title === ''", + "v-el:submit-button" => true } Submit issue %button.btn.btn-default.pull-right{ type: "button", "@click" => "cancel" } diff --git a/app/views/projects/boards/components/_card.html.haml b/app/views/projects/boards/components/_card.html.haml index 25701b0a99e..f15c87c8185 100644 --- a/app/views/projects/boards/components/_card.html.haml +++ b/app/views/projects/boards/components/_card.html.haml @@ -7,7 +7,7 @@ ":issue-link-base" => "issueLinkBase", ":disabled" => "disabled", "track-by" => "id" } - %li.card{ ":class" => "{ 'user-can-drag': !disabled }", + %li.card{ ":class" => "{ 'user-can-drag': !disabled && issue.id, 'is-disabled': disabled || !issue.id }", ":index" => "index" } %h4.card-title = icon("eye-slash", class: "confidential-icon", "v-if" => "issue.confidential") -- cgit v1.2.1