Skip to content
Snippets Groups Projects
Commit 954deefa authored by Phil Hughes's avatar Phil Hughes Committed by Fatih Acet
Browse files

Added remove button

parent ffeb3200
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -50,6 +50,7 @@
Store.detail.issue = {};
} else {
Store.detail.issue = this.issue;
Store.detail.list = this.list;
}
}
}
Loading
Loading
Loading
Loading
@@ -4,6 +4,7 @@
/* global MilestoneSelect */
/* global LabelsSelect */
/* global Sidebar */
//= require ./sidebar/remove_issue
 
(() => {
const Store = gl.issueBoards.BoardsStore;
Loading
Loading
@@ -18,7 +19,8 @@
data() {
return {
detail: Store.detail,
issue: {}
issue: {},
list: {},
};
},
computed: {
Loading
Loading
@@ -36,6 +38,7 @@
}
 
this.issue = this.detail.issue;
this.list = this.detail.list;
},
deep: true
},
Loading
Loading
@@ -60,6 +63,9 @@
new LabelsSelect();
new Sidebar();
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>
`,
});
})();
Loading
Loading
@@ -22,3 +22,5 @@
= render "projects/boards/components/sidebar/due_date"
= render "projects/boards/components/sidebar/labels"
= render "projects/boards/components/sidebar/notifications"
%remove-btn{ ":issue" => "issue",
":list" => "list" }
Loading
Loading
@@ -70,6 +70,38 @@ describe 'Issue Boards', feature: true, js: true do
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
it 'updates the issues assignee' do
page.within(first('.board')) do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment