BigW Consortium Gitlab

Commit 63a1ec14 by Phil Hughes

Correctly removes from boards when moved to done

Only shows options to remove from all boards if issue is in more than 1
parent ff7bab37
IssueDone = Vue.extend IssueDone = Vue.extend
props: props:
done: Object done: Object
methods:
removeFromAll: ->
BoardsStore.removeIssueFromBoards(this.done.issue, this.done.boards)
BoardsStore.clearDone()
removeFromSingle: ->
BoardsStore.removeIssueFromBoard(this.done.issue, this.done.board)
BoardsStore.clearDone()
Vue.component('issue-done', IssueDone) Vue.component('issue-done', IssueDone)
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
# Add to new boards issues # Add to new boards issues
boardTo.issues.splice(toIndex, 0, issue) boardTo.issues.splice(toIndex, 0, issue)
if boardTo.id is 'done' if boardTo.id is 'done' and issueBoards.length > 1
Vue.set(BoardsStore.state.done, 'board', boardFrom) Vue.set(BoardsStore.state.done, 'board', boardFrom)
Vue.set(BoardsStore.state.done, 'issue', issue) Vue.set(BoardsStore.state.done, 'issue', issue)
Vue.set(BoardsStore.state.done, 'boards', issueBoards) Vue.set(BoardsStore.state.done, 'boards', issueBoards)
...@@ -45,13 +45,23 @@ ...@@ -45,13 +45,23 @@
label.title is boardFrom.title label.title is boardFrom.title
else else
if boardTo.label? if boardTo.label?
foundLabel = _.find issue.labels, (label) -> BoardsStore.removeIssueFromBoard(issue, boardTo)
label.title is boardTo.label.title
unless foundLabel? unless foundLabel?
issue.labels.push(boardTo.label) issue.labels.push(boardTo.label)
removeIssueFromBoards: (issue, boards) ->
boardLabels = _.map boards, (board) ->
board.label.title
issue.labels = _.reject issue.labels, (label) ->
boardLabels.indexOf(label.title) != -1
removeIssueFromBoard: (issue, board) ->
issue.labels = _.reject issue.labels, (label) ->
label.title is board.title
getBoardsForIssue: (issue) -> getBoardsForIssue: (issue) ->
_.filter BoardsStore.state.boards, (board) -> _.filter BoardsStore.state.boards, (board) ->
foundIssue = _.find board.issues, (boardIssue) -> foundIssue = _.find board.issues, (boardIssue) ->
issue?.id == boardIssue?.id issue?.id == boardIssue?.id
foundIssue? foundIssue?
clearDone: ->
Vue.set(BoardsStore.state, 'done', {})
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
{{ board.title }} {{ board.title }}
%p %p
Moving it to Done will remove it from all lists and close the issue. Moving it to Done will remove it from all lists and close the issue.
%button.btn.btn-gray.btn-block.prepend-top-10{ type: "button" } %button.btn.btn-gray.btn-block.prepend-top-10{ type: "button", "@click" => "removeFromAll" }
Remove from all lists and close Remove from all lists and close
%button.btn.btn-gray.btn-block{ type: "button" } %button.btn.btn-gray.btn-block{ type: "button", "@click" => "removeFromSingle" }
Remove from {{ done.board.title }} list Remove from {{ done.board.title }} list
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment