Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
7e7673d5
Commit
7e7673d5
authored
Aug 15, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug when moving lists around & then deleting
parent
d4387bd3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
13 deletions
+26
-13
app/assets/javascripts/boards/components/board.js.es6
app/assets/javascripts/boards/components/board.js.es6
+15
-8
app/assets/javascripts/boards/components/board_delete.js.es6
app/assets/javascripts/boards/components/board_delete.js.es6
+4
-1
app/assets/javascripts/boards/models/list.js.es6
app/assets/javascripts/boards/models/list.js.es6
+1
-0
app/assets/javascripts/boards/stores/boards_store.js.es6
app/assets/javascripts/boards/stores/boards_store.js.es6
+2
-3
app/views/projects/boards/components/_board.html.haml
app/views/projects/boards/components/_board.html.haml
+4
-1
No files found.
app/assets/javascripts/boards/components/board.js.es6
View file @
7e7673d5
...
@@ -64,9 +64,20 @@
...
@@ -64,9 +64,20 @@
group: 'boards',
group: 'boards',
draggable: '.is-draggable',
draggable: '.is-draggable',
handle: '.js-board-handle',
handle: '.js-board-handle',
onUpdate: (e) => {
onEnd: (e) => {
if (e.oldIndex !== e.newIndex) {
document.body.classList.remove('is-dragging');
gl.issueBoards.BoardsStore.moveList(e.oldIndex, this.sortable.toArray());
if (e.newIndex !== undefined && e.oldIndex !== e.newIndex) {
const order = this.sortable.toArray(),
$board = this.$parent.$refs.board[e.oldIndex + 1],
list = $board.list;
$board.$destroy(true);
this.$nextTick(() => {
gl.issueBoards.BoardsStore.state.lists.splice(e.newIndex, 0, list);
gl.issueBoards.BoardsStore.moveList(list, order);
});
}
}
}
}
});
});
...
@@ -78,11 +89,7 @@
...
@@ -78,11 +89,7 @@
this.sortable = Sortable.create(this.$el.parentNode, options);
this.sortable = Sortable.create(this.$el.parentNode, options);
},
},
beforeDestroy () {
beforeDestroy () {
this.list.destroy();
gl.issueBoards.BoardsStore.state.lists.$remove(this.list);
if (gl.issueBoards.BoardsStore.state.lists.length === 0) {
this.sortable.destroy();
}
}
}
});
});
})();
})();
app/assets/javascripts/boards/components/board_delete.js.es6
View file @
7e7673d5
...
@@ -3,13 +3,16 @@
...
@@ -3,13 +3,16 @@
window.gl.issueBoards = window.gl.issueBoards || {};
window.gl.issueBoards = window.gl.issueBoards || {};
gl.issueBoards.BoardDelete = Vue.extend({
gl.issueBoards.BoardDelete = Vue.extend({
props: {
list: Object
},
methods: {
methods: {
deleteBoard (e) {
deleteBoard (e) {
e.stopImmediatePropagation();
e.stopImmediatePropagation();
$(this.$el).tooltip('hide');
$(this.$el).tooltip('hide');
if (confirm('Are you sure you want to delete this list?')) {
if (confirm('Are you sure you want to delete this list?')) {
this.
$parent.$destroy(true
);
this.
list.destroy(
);
}
}
}
}
}
}
...
...
app/assets/javascripts/boards/models/list.js.es6
View file @
7e7673d5
class List {
class List {
constructor (obj) {
constructor (obj) {
this.id = obj.id;
this.id = obj.id;
this._uid = Math.ceil(Math.random() * 1000);
this.position = obj.position;
this.position = obj.position;
this.title = obj.title;
this.title = obj.title;
this.type = obj.list_type;
this.type = obj.list_type;
...
...
app/assets/javascripts/boards/stores/boards_store.js.es6
View file @
7e7673d5
...
@@ -80,15 +80,14 @@
...
@@ -80,15 +80,14 @@
return list.id !== id;
return list.id !== id;
});
});
},
},
moveList (oldIndex, orderLists) {
moveList (listFrom, orderLists) {
const listFrom = this.findList('position', oldIndex);
for (let i = 0, orderLength = orderLists.length; i < orderLength; i++) {
for (let i = 0, orderLength = orderLists.length; i < orderLength; i++) {
const id = parseInt(orderLists[i]),
const id = parseInt(orderLists[i]),
list = this.findList('id', id);
list = this.findList('id', id);
list.position = i;
list.position = i;
}
}
listFrom.update();
},
},
moveIssueToList (listFrom, listTo, issue) {
moveIssueToList (listFrom, listTo, issue) {
const issueTo = listTo.findIssue(issue.id),
const issueTo = listTo.findIssue(issue.id),
...
...
app/views/projects/boards/components/_board.html.haml
View file @
7e7673d5
%board
{
"inline-template"
=>
true
,
%board
{
"inline-template"
=>
true
,
"v-cloak"
=>
true
,
"v-cloak"
=>
true
,
"v-for"
=>
"list in state.lists | orderBy 'position'"
,
"v-for"
=>
"list in state.lists | orderBy 'position'"
,
"v-ref:board"
=>
true
,
":list"
=>
"list"
,
":list"
=>
"list"
,
":disabled"
=>
"disabled"
,
":disabled"
=>
"disabled"
,
":issue-link-base"
=>
"issueLinkBase"
}
":issue-link-base"
=>
"issueLinkBase"
,
"track-by"
=>
"_uid"
}
.board
{
":class"
=>
"{ 'is-draggable': !isPreset }"
,
.board
{
":class"
=>
"{ 'is-draggable': !isPreset }"
,
":data-id"
=>
"list.id"
}
":data-id"
=>
"list.id"
}
.board-inner
.board-inner
...
@@ -15,6 +17,7 @@
...
@@ -15,6 +17,7 @@
{{ list.issues.length }}
{{ list.issues.length }}
-
if
can?
(
current_user
,
:admin_list
,
@project
)
-
if
can?
(
current_user
,
:admin_list
,
@project
)
%board-delete
{
"inline-template"
=>
true
,
%board-delete
{
"inline-template"
=>
true
,
":list"
=>
"list"
,
"v-if"
=>
"!isPreset && list.id"
}
"v-if"
=>
"!isPreset && list.id"
}
%button
.board-delete.has-tooltip.pull-right
{
type:
"button"
,
title:
"Delete list"
,
"aria-label"
=>
"Delete list"
,
data:
{
placement:
"bottom"
},
"@click.stop"
=>
"deleteBoard"
}
%button
.board-delete.has-tooltip.pull-right
{
type:
"button"
,
title:
"Delete list"
,
"aria-label"
=>
"Delete list"
,
data:
{
placement:
"bottom"
},
"@click.stop"
=>
"deleteBoard"
}
=
icon
(
"trash"
)
=
icon
(
"trash"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment