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
ff5fd4eb
Commit
ff5fd4eb
authored
Aug 08, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved some code over to underscorejs
parent
1de64675
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
30 deletions
+26
-30
app/assets/javascripts/boards/components/board_list.js.es6
app/assets/javascripts/boards/components/board_list.js.es6
+2
-1
app/assets/javascripts/boards/models/issue.js.es6
app/assets/javascripts/boards/models/issue.js.es6
+1
-3
app/assets/javascripts/boards/models/list.js.es6
app/assets/javascripts/boards/models/list.js.es6
+3
-3
app/assets/javascripts/boards/stores/boards_store.js.es6
app/assets/javascripts/boards/stores/boards_store.js.es6
+18
-21
app/assets/stylesheets/pages/boards.scss
app/assets/stylesheets/pages/boards.scss
+2
-2
No files found.
app/assets/javascripts/boards/components/board_list.js.es6
View file @
ff5fd4eb
...
@@ -35,10 +35,11 @@
...
@@ -35,10 +35,11 @@
},
},
},
},
ready: function () {
ready: function () {
const list = this.list;
const options = _.extend({
const options = _.extend({
group: 'issues',
group: 'issues',
disabled: this.disabled,
disabled: this.disabled,
onAdd:
function (e)
{
onAdd:
(e) =>
{
const fromListId = parseInt(e.from.getAttribute('data-board')),
const fromListId = parseInt(e.from.getAttribute('data-board')),
toListId = parseInt(e.to.getAttribute('data-board')),
toListId = parseInt(e.to.getAttribute('data-board')),
issueId = parseInt(e.item.getAttribute('data-issue'));
issueId = parseInt(e.item.getAttribute('data-issue'));
...
...
app/assets/javascripts/boards/models/issue.js.es6
View file @
ff5fd4eb
...
@@ -39,9 +39,7 @@ class Issue {
...
@@ -39,9 +39,7 @@ class Issue {
}
}
removeLabels (labels) {
removeLabels (labels) {
labels.forEach((label) => {
_.each(labels, this.removeLabel.bind(this));
this.removeLabel(label);
});
}
}
getLists () {
getLists () {
...
...
app/assets/javascripts/boards/models/list.js.es6
View file @
ff5fd4eb
...
@@ -19,7 +19,7 @@ class List {
...
@@ -19,7 +19,7 @@ class List {
}
}
save () {
save () {
gl.boardService.createList(this.label.id)
return
gl.boardService.createList(this.label.id)
.then((resp) => {
.then((resp) => {
const data = resp.json();
const data = resp.json();
...
@@ -27,7 +27,7 @@ class List {
...
@@ -27,7 +27,7 @@ class List {
this.type = data.list_type;
this.type = data.list_type;
this.position = data.position;
this.position = data.position;
this.getIssues();
return
this.getIssues();
});
});
}
}
...
@@ -80,7 +80,7 @@ class List {
...
@@ -80,7 +80,7 @@ class List {
}
}
createIssues (data) {
createIssues (data) {
data.forEach(
(issue) => {
_.each(data,
(issue) => {
this.issues.push(new Issue(issue));
this.issues.push(new Issue(issue));
});
});
}
}
...
...
app/assets/javascripts/boards/stores/boards_store.js.es6
View file @
ff5fd4eb
...
@@ -12,12 +12,19 @@
...
@@ -12,12 +12,19 @@
};
};
},
},
new: function (board, persist = true) {
new: function (board, persist = true) {
const doneList = this.getDoneList(),
const doneList = this.findList('type', 'done'),
backlogList = this.findList('type', 'backlog'),
list = new List(board);
list = new List(board);
this.state.lists.push(list);
this.state.lists.push(list);
if (persist) {
if (persist) {
list.save();
list
.save()
.then(function () {
// Remove any new issues from the backlog
// as they will be visible in the new list
_.each(list.issues, backlogList.removeIssue.bind(backlogList));
});
this.removeBlankState();
this.removeBlankState();
}
}
...
@@ -29,15 +36,10 @@
...
@@ -29,15 +36,10 @@
},
},
shouldAddBlankState: function () {
shouldAddBlankState: function () {
// Decide whether to add the blank state
// Decide whether to add the blank state
let addBlankState = true;
let addBlankState = _.find(this.state.lists, function (list) {
return list.type === 'backlog' || list.type === 'done';
this.state.lists.forEach(function (list) {
if (list.type !== 'backlog' && list.type !== 'done') {
addBlankState = false;
return;
}
});
});
return addBlankState;
return
!
addBlankState;
},
},
addBlankState: function () {
addBlankState: function () {
const addBlankState = this.shouldAddBlankState();
const addBlankState = this.shouldAddBlankState();
...
@@ -65,9 +67,6 @@
...
@@ -65,9 +67,6 @@
welcomeIsHidden: function () {
welcomeIsHidden: function () {
return $.cookie('issue_board_welcome_hidden') === 'true';
return $.cookie('issue_board_welcome_hidden') === 'true';
},
},
getDoneList: function () {
return this.findList('type', 'done');
},
removeList: function (id) {
removeList: function (id) {
const list = this.findList('id', id);
const list = this.findList('id', id);
...
@@ -75,7 +74,7 @@
...
@@ -75,7 +74,7 @@
list.destroy();
list.destroy();
this.state.lists = _.reject(this.state.lists,
(list) =>
{
this.state.lists = _.reject(this.state.lists,
function (list)
{
return list.id === id;
return list.id === id;
});
});
...
@@ -83,7 +82,7 @@
...
@@ -83,7 +82,7 @@
},
},
moveList: function (oldIndex, newIndex) {
moveList: function (oldIndex, newIndex) {
if (oldIndex === newIndex) return;
if (oldIndex === newIndex) return;
const listFrom = this.findList('position', oldIndex),
const listFrom = this.findList('position', oldIndex),
listTo = this.findList('position', newIndex);
listTo = this.findList('position', newIndex);
...
@@ -101,9 +100,9 @@
...
@@ -101,9 +100,9 @@
moveCardToList: function (listFromId, listToId, issueId) {
moveCardToList: function (listFromId, listToId, issueId) {
const listFrom = this.findList('id', listFromId),
const listFrom = this.findList('id', listFromId),
listTo = this.findList('id', listToId),
listTo = this.findList('id', listToId),
issueTo = listTo.findIssue(issueId)
;
issueTo = listTo.findIssue(issueId)
,
let issue = listFrom.findIssue(issueId);
issue = listFrom.findIssue(issueId),
const
issueLists = issue.getLists(),
issueLists = issue.getLists(),
listLabels = issueLists.map(function (issue) {
listLabels = issueLists.map(function (issue) {
return issue.label;
return issue.label;
});
});
...
@@ -114,9 +113,7 @@
...
@@ -114,9 +113,7 @@
}
}
if (listTo.type === 'done' && listFrom.type !== 'backlog') {
if (listTo.type === 'done' && listFrom.type !== 'backlog') {
issueLists.forEach((list) => {
_.each(issueLists, list.removeIssue.bind(list));
list.removeIssue(issue);
});
issue.removeLabels(listLabels);
issue.removeLabels(listLabels);
} else {
} else {
listFrom.removeIssue(issue);
listFrom.removeIssue(issue);
...
...
app/assets/stylesheets/pages/boards.scss
View file @
ff5fd4eb
...
@@ -84,8 +84,8 @@
...
@@ -84,8 +84,8 @@
overflow-x
:
scroll
;
overflow-x
:
scroll
;
@media
(
min-width
:
$screen-sm-min
)
{
@media
(
min-width
:
$screen-sm-min
)
{
min-height
:
47
0
px
;
min-height
:
47
5
px
;
max-height
:
47
0
px
;
max-height
:
47
5
px
;
}
}
}
}
...
...
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