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
Boxiang Sun
gitlab-ce
Commits
77a074a7
Commit
77a074a7
authored
Aug 17, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code improvements
parent
94f5d8a9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
41 deletions
+24
-41
app/assets/javascripts/boards/boards_bundle.js.es6
app/assets/javascripts/boards/boards_bundle.js.es6
+5
-11
app/assets/javascripts/boards/models/issue.js.es6
app/assets/javascripts/boards/models/issue.js.es6
+3
-1
app/assets/javascripts/boards/stores/boards_store.js.es6
app/assets/javascripts/boards/stores/boards_store.js.es6
+16
-29
No files found.
app/assets/javascripts/boards/boards_bundle.js.es6
View file @
77a074a7
...
@@ -31,29 +31,23 @@ $(() => {
...
@@ -31,29 +31,23 @@ $(() => {
disabled: $boardApp.dataset.disabled === 'true',
disabled: $boardApp.dataset.disabled === 'true',
issueLinkBase: $boardApp.dataset.issueLinkBase
issueLinkBase: $boardApp.dataset.issueLinkBase
},
},
init () {
init: Store.create.bind(Store),
gl.issueBoards.BoardsStore.create();
},
created () {
created () {
this.loading = true;
gl.boardService = new BoardService(this.endpoint);
gl.boardService = new BoardService(this.endpoint);
},
},
ready () {
ready () {
Store.disabled = this.disabled;
Store.disabled = this.disabled;
gl.boardService.all()
gl.boardService.all()
.then((resp) => {
.then((resp) => {
const boards = resp.json();
resp.json().forEach((board) => {
const list = Store.addList(board);
for (let i = 0, boardsLength = boards.length; i < boardsLength; i++) {
const board = boards[i],
list = Store.addList(board);
if (list.type === 'done') {
if (list.type === 'done') {
list.position = Infinity;
list.position = Infinity;
} else if (list.type === 'backlog') {
} else if (list.type === 'backlog') {
list.position = -1;
list.position = -1;
}
}
}
}
);
Store.addBlankState();
Store.addBlankState();
this.loading = false;
this.loading = false;
...
...
app/assets/javascripts/boards/models/issue.js.es6
View file @
77a074a7
...
@@ -29,7 +29,9 @@ class ListIssue {
...
@@ -29,7 +29,9 @@ class ListIssue {
}
}
removeLabel (removeLabel) {
removeLabel (removeLabel) {
this.labels = this.labels.filter( label => removeLabel.title !== label.title );
if (removeLabel) {
this.labels = this.labels.filter( label => removeLabel.title !== label.title );
}
}
}
removeLabels (labels) {
removeLabels (labels) {
...
...
app/assets/javascripts/boards/stores/boards_store.js.es6
View file @
77a074a7
...
@@ -33,10 +33,7 @@
...
@@ -33,10 +33,7 @@
.then(() => {
.then(() => {
// Remove any new issues from the backlog
// Remove any new issues from the backlog
// as they will be visible in the new list
// as they will be visible in the new list
for (let i = 0, issuesLength = list.issues.length; i < issuesLength; i++) {
list.issues.forEach(backlogList.removeIssue.bind(backlogList));
const issue = list.issues[i];
backlogList.removeIssue(issue);
}
});
});
this.removeBlankState();
this.removeBlankState();
},
},
...
@@ -45,21 +42,17 @@
...
@@ -45,21 +42,17 @@
},
},
shouldAddBlankState () {
shouldAddBlankState () {
// Decide whether to add the blank state
// Decide whether to add the blank state
return !(this.state.lists.filter((list) => {
return !(this.state.lists.filter( list => list.type !== 'backlog' && list.type !== 'done' )[0]);
return list.type !== 'backlog' && list.type !== 'done';
})[0]);
},
},
addBlankState () {
addBlankState () {
if (this.welcomeIsHidden() || this.disabled) return;
if (
!this.shouldAddBlankState() ||
this.welcomeIsHidden() || this.disabled) return;
if (this.shouldAddBlankState()) {
this.addList({
this.addList({
id: 'blank',
id: 'blank',
list_type: 'blank',
list_type: 'blank',
title: 'Welcome to your Issue Board!',
title: 'Welcome to your Issue Board!',
position: 0
position: 0
});
});
}
},
},
removeBlankState () {
removeBlankState () {
this.removeList('blank');
this.removeList('blank');
...
@@ -76,25 +69,20 @@
...
@@ -76,25 +69,20 @@
if (!list) return;
if (!list) return;
this.state.lists = this.state.lists.filter((list) => {
this.state.lists = this.state.lists.filter( list => list.id !== id );
return list.id !== id;
});
},
},
moveList (listFrom, orderLists) {
moveList (listFrom, orderLists) {
for (let i = 0, orderLength = orderLists.length; i < orderLength; i++) {
orderLists.forEach((id, i) => {
const id = parseInt(orderLists[i]),
const list = this.findList('id', id);
list = this.findList('id', id);
list.position = i;
list.position = i;
}
}
);
listFrom.update();
listFrom.update();
},
},
moveIssueToList (listFrom, listTo, issue) {
moveIssueToList (listFrom, listTo, issue) {
const issueTo = listTo.findIssue(issue.id),
const issueTo = listTo.findIssue(issue.id),
issueLists = issue.getLists(),
issueLists = issue.getLists(),
listLabels = issueLists.map((listIssue) => {
listLabels = issueLists.map( listIssue => listIssue.label );
return listIssue.label;
});
// Add to new lists issues if it doesn't already exist
// Add to new lists issues if it doesn't already exist
if (!issueTo) {
if (!issueTo) {
...
@@ -102,10 +90,9 @@
...
@@ -102,10 +90,9 @@
}
}
if (listTo.type === 'done' && listFrom.type !== 'backlog') {
if (listTo.type === 'done' && listFrom.type !== 'backlog') {
for (let i = 0, listsLength = issueLists.length; i < listsLength; i++) {
issueLists.forEach((list) => {
const list = issueLists[i];
list.removeIssue(issue);
list.removeIssue(issue);
}
}
)
issue.removeLabels(listLabels);
issue.removeLabels(listLabels);
} else {
} else {
listFrom.removeIssue(issue);
listFrom.removeIssue(issue);
...
...
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