Commit 954deefa authored by Phil Hughes's avatar Phil Hughes Committed by Fatih Acet

Added remove button

parent ffeb3200
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
Store.detail.issue = {}; Store.detail.issue = {};
} else { } else {
Store.detail.issue = this.issue; Store.detail.issue = this.issue;
Store.detail.list = this.list;
} }
} }
} }
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
/* global MilestoneSelect */ /* global MilestoneSelect */
/* global LabelsSelect */ /* global LabelsSelect */
/* global Sidebar */ /* global Sidebar */
//= require ./sidebar/remove_issue
(() => { (() => {
const Store = gl.issueBoards.BoardsStore; const Store = gl.issueBoards.BoardsStore;
...@@ -18,7 +19,8 @@ ...@@ -18,7 +19,8 @@
data() { data() {
return { return {
detail: Store.detail, detail: Store.detail,
issue: {} issue: {},
list: {},
}; };
}, },
computed: { computed: {
...@@ -36,6 +38,7 @@ ...@@ -36,6 +38,7 @@
} }
this.issue = this.detail.issue; this.issue = this.detail.issue;
this.list = this.detail.list;
}, },
deep: true deep: true
}, },
...@@ -60,6 +63,9 @@ ...@@ -60,6 +63,9 @@
new LabelsSelect(); new LabelsSelect();
new Sidebar(); new Sidebar();
gl.Subscription.bindAll('.subscription'); gl.Subscription.bindAll('.subscription');
} },
components: {
'remove-btn': gl.issueBoards.RemoveIssueBtn,
},
}); });
})(); })();
/* global Vue */
(() => {
const Store = gl.issueBoards.BoardsStore;
window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {};
gl.issueBoards.RemoveIssueBtn = Vue.extend({
props: [
'issue', 'list',
],
methods: {
removeIssue() {
const doneList = Store.findList('type', 'done', false);
Store.moveIssueToList(this.list, doneList, this.issue, 0);
Store.detail.issue = {};
},
},
template: `
<div
class="block list"
v-if="list.type !== 'done'">
<button
class="btn btn-default btn-block"
type="button"
@click="removeIssue">
Remove from board
</button>
</div>
`,
});
})();
...@@ -22,3 +22,5 @@ ...@@ -22,3 +22,5 @@
= render "projects/boards/components/sidebar/due_date" = render "projects/boards/components/sidebar/due_date"
= render "projects/boards/components/sidebar/labels" = render "projects/boards/components/sidebar/labels"
= render "projects/boards/components/sidebar/notifications" = render "projects/boards/components/sidebar/notifications"
%remove-btn{ ":issue" => "issue",
":list" => "list" }
...@@ -70,6 +70,38 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -70,6 +70,38 @@ describe 'Issue Boards', feature: true, js: true do
end end
end end
it 'removes card from board when clicking remove button' do
page.within(first('.board')) do
first('.card').click
end
page.within('.issue-boards-sidebar') do
click_button 'Remove from board'
end
page.within(first('.board')) do
expect(page).to have_selector('.card', count: 1)
end
end
it 'does not show remove issue button when issue is closed' do
page.within(first('.board')) do
first('.card').click
end
page.within('.issue-boards-sidebar') do
click_button 'Remove from board'
end
page.within(find('.board:nth-child(2)')) do
first('.card').click
end
page.within('.issue-boards-sidebar') do
expect(page).not_to have_button 'Remove from board'
end
end
context 'assignee' do context 'assignee' do
it 'updates the issues assignee' do it 'updates the issues assignee' do
page.within(first('.board')) do page.within(first('.board')) do
......
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