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

Removes labels instead of closing issue when clicking remove button

parent 32a97ef1
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -45,6 +45,7 @@ $(() => {
disabled: $boardApp.dataset.disabled === 'true',
issueLinkBase: $boardApp.dataset.issueLinkBase,
rootPath: $boardApp.dataset.rootPath,
bulkUpdatePath: $boardApp.dataset.bulkUpdatePath,
detailIssue: Store.detail
},
computed: {
Loading
Loading
@@ -53,7 +54,7 @@ $(() => {
},
},
created () {
gl.boardService = new BoardService(this.endpoint, this.boardId);
gl.boardService = new BoardService(this.endpoint, this.bulkUpdatePath, this.boardId);
},
mounted () {
Store.disabled = this.disabled;
Loading
Loading
Loading
Loading
@@ -44,7 +44,7 @@
:href="newIssuePath"
class="btn btn-success btn-inverted"
v-if="activeTab === 'all'">
Create issue
New issue
</a>
<button
type="button"
Loading
Loading
Loading
Loading
@@ -4,9 +4,6 @@
const ModalStore = gl.issueBoards.ModalStore;
 
gl.issueBoards.ModalFooter = Vue.extend({
props: [
'bulkUpdatePath',
],
data() {
return ModalStore.store;
},
Loading
Loading
@@ -30,11 +27,8 @@
const issueIds = selectedIssues.map(issue => issue.globalId);
 
// Post the data to the backend
this.$http.post(this.bulkUpdatePath, {
update: {
issuable_ids: issueIds.join(','),
add_label_ids: [list.label.id],
},
gl.boardService.bulkUpdate(issueIds, {
add_label_ids: [list.label.id],
});
 
// Add the issues on the frontend
Loading
Loading
Loading
Loading
@@ -13,7 +13,7 @@
return 'Select all';
}
 
return 'Un-select all';
return 'Deselect all';
},
},
methods: {
Loading
Loading
Loading
Loading
@@ -9,7 +9,7 @@
 
gl.issueBoards.IssuesModal = Vue.extend({
props: [
'blankStateImage', 'newIssuePath', 'bulkUpdatePath', 'issueLinkBase',
'blankStateImage', 'newIssuePath', 'issueLinkBase',
'rootPath',
],
data() {
Loading
Loading
@@ -33,6 +33,7 @@
} else if (!this.showAddIssuesModal) {
this.issues = [];
this.selectedIssues = [];
this.issuesCount = false;
}
},
},
Loading
Loading
@@ -101,7 +102,7 @@
<i class="fa fa-spinner fa-spin"></i>
</div>
</section>
<modal-footer :bulk-update-path="bulkUpdatePath"></modal-footer>
<modal-footer></modal-footer>
</div>
</div>
`,
Loading
Loading
Loading
Loading
@@ -11,9 +11,18 @@
],
methods: {
removeIssue() {
const doneList = Store.findList('type', 'done', false);
const lists = this.issue.getLists();
const labelIds = lists.map(list => list.label.id);
 
Store.moveIssueToList(this.list, doneList, this.issue, 0);
// Post the remove data
gl.boardService.bulkUpdate([this.issue.globalId], {
remove_label_ids: labelIds,
});
// Remove from the frontend store
lists.forEach((list) => {
list.removeIssue(this.issue);
});
 
Store.detail.issue = {};
},
Loading
Loading
Loading
Loading
@@ -2,7 +2,7 @@
/* global Vue */
 
class BoardService {
constructor (root, boardId) {
constructor (root, bulkUpdatePath, boardId) {
this.boards = Vue.resource(`${root}{/id}.json`, {}, {
issues: {
method: 'GET',
Loading
Loading
@@ -16,7 +16,12 @@ class BoardService {
}
});
this.issue = Vue.resource(`${root}/${boardId}/issues{/id}`, {});
this.issues = Vue.resource(`${root}/${boardId}/lists{/id}/issues`, {});
this.issues = Vue.resource(`${root}/${boardId}/lists{/id}/issues`, {}, {
bulkUpdate: {
method: 'POST',
url: bulkUpdatePath,
},
});
 
Vue.http.interceptors.push((request, next) => {
request.headers['X-CSRF-Token'] = $.rails.csrfToken();
Loading
Loading
@@ -75,6 +80,16 @@ class BoardService {
getBacklog(data) {
return this.boards.issues(data);
}
bulkUpdate(issueIds, extraData = {}) {
const data = {
update: Object.assign(extraData, {
issuable_ids: issueIds.join(','),
}),
};
return this.issues.bulkUpdate(data);
}
}
 
window.BoardService = BoardService;
Loading
Loading
@@ -8,6 +8,7 @@ module BoardsHelper
disabled: "#{!can?(current_user, :admin_list, @project)}",
issue_link_base: namespace_project_issues_path(@project.namespace, @project),
root_path: root_path,
bulk_update_path: bulk_update_namespace_project_issues_path(@project.namespace, @project),
}
end
end
Loading
Loading
@@ -29,6 +29,5 @@
= render "projects/boards/components/sidebar"
%board-add-issues-modal{ "blank-state-image" => render('shared/empty_states/icons/issues.svg'),
"new-issue-path" => new_namespace_project_issue_path(@project.namespace, @project),
"bulk-update-path" => bulk_update_namespace_project_issues_path(@project.namespace, @project),
":issue-link-base" => "issueLinkBase",
":root-path" => "rootPath" }
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