Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2016-11-24 13:32:55 +0300
committerPhil Hughes <me@iamphill.com>2016-11-24 13:32:55 +0300
commit058c652904b13cea73e92615776f29fd1a8a1ded (patch)
treef839fc4ca3c7773d8541ba02dff77f3467f85455
parent00162d24d909a127656eae9393b01b36c23d4254 (diff)
Fixed issue boards issue sorting when dragging issue into list
Currently it just appends the new issue to the end of list & then sorts by priority which can cause some strange effects. For example if you drag the issue to the top of the list & then vue re-renders, the issue actually goes to the bottom.
-rw-r--r--app/assets/javascripts/boards/components/board_list.js.es62
-rw-r--r--app/assets/javascripts/boards/models/list.js.es68
-rw-r--r--app/assets/javascripts/boards/stores/boards_store.js.es64
-rw-r--r--changelogs/unreleased/boards-issue-sorting.yml4
4 files changed, 13 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 8e91cbfac75..8996ca438a6 100644
--- a/app/assets/javascripts/boards/components/board_list.js.es6
+++ b/app/assets/javascripts/boards/components/board_list.js.es6
@@ -94,7 +94,7 @@
gl.issueBoards.onStart();
},
onAdd: (e) => {
- gl.issueBoards.BoardsStore.moveIssueToList(Store.moving.list, this.list, Store.moving.issue);
+ gl.issueBoards.BoardsStore.moveIssueToList(Store.moving.list, this.list, Store.moving.issue, e.newIndex);
this.$nextTick(() => {
e.item.remove();
diff --git a/app/assets/javascripts/boards/models/list.js.es6 b/app/assets/javascripts/boards/models/list.js.es6
index 8a7dc67409e..429bd27c3fb 100644
--- a/app/assets/javascripts/boards/models/list.js.es6
+++ b/app/assets/javascripts/boards/models/list.js.es6
@@ -106,9 +106,13 @@ class List {
});
}
- addIssue (issue, listFrom) {
+ addIssue (issue, listFrom, newIndex) {
if (!this.findIssue(issue.id)) {
- this.issues.push(issue);
+ if (newIndex !== undefined) {
+ this.issues.splice(newIndex, 0, issue);
+ } else {
+ this.issues.push(issue);
+ }
if (this.label) {
issue.addLabel(this.label);
diff --git a/app/assets/javascripts/boards/stores/boards_store.js.es6 b/app/assets/javascripts/boards/stores/boards_store.js.es6
index 6bc95aa60f2..bb2a4de8b18 100644
--- a/app/assets/javascripts/boards/stores/boards_store.js.es6
+++ b/app/assets/javascripts/boards/stores/boards_store.js.es6
@@ -89,14 +89,14 @@
});
listFrom.update();
},
- moveIssueToList (listFrom, listTo, issue) {
+ moveIssueToList (listFrom, listTo, issue, newIndex) {
const issueTo = listTo.findIssue(issue.id),
issueLists = issue.getLists(),
listLabels = issueLists.map( listIssue => listIssue.label );
// Add to new lists issues if it doesn't already exist
if (!issueTo) {
- listTo.addIssue(issue, listFrom);
+ listTo.addIssue(issue, listFrom, newIndex);
}
if (listTo.type === 'done' && listFrom.type !== 'backlog') {
diff --git a/changelogs/unreleased/boards-issue-sorting.yml b/changelogs/unreleased/boards-issue-sorting.yml
new file mode 100644
index 00000000000..fb7dc2f9190
--- /dev/null
+++ b/changelogs/unreleased/boards-issue-sorting.yml
@@ -0,0 +1,4 @@
+---
+title: Fixed issue boards issue sorting when dragging issue into list
+merge_request:
+author: