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
Léo-Paul Géneau
gitlab-ce
Commits
dc73405d
Commit
dc73405d
authored
Aug 16, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Uses dataset rather than jQuery to get attribute values
parent
1de23708
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
45 additions
and
40 deletions
+45
-40
app/assets/javascripts/boards/boards_bundle.js.es6
app/assets/javascripts/boards/boards_bundle.js.es6
+10
-14
app/assets/javascripts/boards/components/board.js.es6
app/assets/javascripts/boards/components/board.js.es6
+6
-4
app/assets/javascripts/boards/components/board_blank_state.js.es6
...ts/javascripts/boards/components/board_blank_state.js.es6
+6
-4
app/assets/javascripts/boards/components/board_card.js.es6
app/assets/javascripts/boards/components/board_card.js.es6
+8
-6
app/assets/javascripts/boards/components/board_list.js.es6
app/assets/javascripts/boards/components/board_list.js.es6
+9
-8
app/assets/javascripts/boards/components/new_list_dropdown.js.es6
...ts/javascripts/boards/components/new_list_dropdown.js.es6
+6
-4
No files found.
app/assets/javascripts/boards/boards_bundle.js.es6
View file @
dc73405d
...
@@ -9,7 +9,8 @@
...
@@ -9,7 +9,8 @@
//= require ./components/new_list_dropdown
//= require ./components/new_list_dropdown
$(() => {
$(() => {
const $boardApp = $('#board-app');
const $boardApp = document.getElementById('board-app'),
Store = gl.issueBoards.BoardsStore;
window.gl = window.gl || {};
window.gl = window.gl || {};
...
@@ -18,16 +19,16 @@ $(() => {
...
@@ -18,16 +19,16 @@ $(() => {
}
}
gl.IssueBoardsApp = new Vue({
gl.IssueBoardsApp = new Vue({
el: $boardApp
.get(0)
,
el: $boardApp,
components: {
components: {
'board': gl.issueBoards.Board
'board': gl.issueBoards.Board
},
},
data: {
data: {
state:
gl.issueBoards.Boards
Store.state,
state: Store.state,
loading: true,
loading: true,
endpoint: $boardApp.data
('endpoint')
,
endpoint: $boardApp.data
set.endpoint
,
disabled: $boardApp.data
('disabled')
,
disabled: $boardApp.data
set.disabled === 'true'
,
issueLinkBase: $boardApp.data
('issue-link-base')
issueLinkBase: $boardApp.data
set.issueLinkBase
},
},
init () {
init () {
gl.issueBoards.BoardsStore.create();
gl.issueBoards.BoardsStore.create();
...
@@ -35,21 +36,16 @@ $(() => {
...
@@ -35,21 +36,16 @@ $(() => {
created () {
created () {
this.loading = true;
this.loading = true;
gl.boardService = new BoardService(this.endpoint);
gl.boardService = new BoardService(this.endpoint);
$boardApp
.removeAttr('data-endpoint')
.removeAttr('data-disabled')
.removeAttr('data-issue-link-base');
},
},
ready () {
ready () {
gl.issueBoards.Boards
Store.disabled = this.disabled;
Store.disabled = this.disabled;
gl.boardService.all()
gl.boardService.all()
.then((resp) => {
.then((resp) => {
const boards = resp.json();
const boards = resp.json();
for (let i = 0, boardsLength = boards.length; i < boardsLength; i++) {
for (let i = 0, boardsLength = boards.length; i < boardsLength; i++) {
const board = boards[i],
const board = boards[i],
list =
gl.issueBoards.Boards
Store.addList(board);
list = Store.addList(board);
if (list.type === 'done') {
if (list.type === 'done') {
list.position = Infinity;
list.position = Infinity;
...
@@ -58,7 +54,7 @@ $(() => {
...
@@ -58,7 +54,7 @@ $(() => {
}
}
}
}
gl.issueBoards.Boards
Store.addBlankState();
Store.addBlankState();
this.loading = false;
this.loading = false;
});
});
}
}
...
...
app/assets/javascripts/boards/components/board.js.es6
View file @
dc73405d
...
@@ -3,6 +3,8 @@
...
@@ -3,6 +3,8 @@
//= require ./board_list
//= require ./board_list
(() => {
(() => {
const Store = gl.issueBoards.BoardsStore;
window.gl = window.gl || {};
window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {};
window.gl.issueBoards = window.gl.issueBoards || {};
...
@@ -20,7 +22,7 @@
...
@@ -20,7 +22,7 @@
data () {
data () {
return {
return {
query: '',
query: '',
filters:
gl.issueBoards.Boards
Store.state.filters
filters: Store.state.filters
};
};
},
},
watch: {
watch: {
...
@@ -75,8 +77,8 @@
...
@@ -75,8 +77,8 @@
$board.$destroy(true);
$board.$destroy(true);
this.$nextTick(() => {
this.$nextTick(() => {
gl.issueBoards.Boards
Store.state.lists.splice(e.newIndex, 0, list);
Store.state.lists.splice(e.newIndex, 0, list);
gl.issueBoards.Boards
Store.moveList(list, order);
Store.moveList(list, order);
});
});
}
}
}
}
...
@@ -89,7 +91,7 @@
...
@@ -89,7 +91,7 @@
this.sortable = Sortable.create(this.$el.parentNode, options);
this.sortable = Sortable.create(this.$el.parentNode, options);
},
},
beforeDestroy () {
beforeDestroy () {
gl.issueBoards.Boards
Store.state.lists.$remove(this.list);
Store.state.lists.$remove(this.list);
}
}
});
});
})();
})();
app/assets/javascripts/boards/components/board_blank_state.js.es6
View file @
dc73405d
(() => {
(() => {
const Store = gl.issueBoards.BoardsStore;
window.gl = window.gl || {};
window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {};
window.gl.issueBoards = window.gl.issueBoards || {};
...
@@ -15,12 +17,12 @@
...
@@ -15,12 +17,12 @@
},
},
methods: {
methods: {
addDefaultLists () {
addDefaultLists () {
gl.issueBoards.Boards
Store.removeBlankState();
Store.removeBlankState();
for (let i = 0, labelsLength = this.predefinedLabels.length; i < labelsLength; i++) {
for (let i = 0, labelsLength = this.predefinedLabels.length; i < labelsLength; i++) {
const label = this.predefinedLabels[i];
const label = this.predefinedLabels[i];
gl.issueBoards.Boards
Store.addList({
Store.addList({
title: label.title,
title: label.title,
position: i,
position: i,
list_type: 'label',
list_type: 'label',
...
@@ -39,7 +41,7 @@
...
@@ -39,7 +41,7 @@
for (let i = 0, dataLength = data.length; i < dataLength; i++) {
for (let i = 0, dataLength = data.length; i < dataLength; i++) {
const listObj = data[i],
const listObj = data[i],
list =
gl.issueBoards.Boards
Store.findList('title', listObj.title);
list = Store.findList('title', listObj.title);
list.id = listObj.id;
list.id = listObj.id;
list.label.id = listObj.label.id;
list.label.id = listObj.label.id;
...
@@ -48,7 +50,7 @@
...
@@ -48,7 +50,7 @@
});
});
},
},
clearBlankState () {
clearBlankState () {
gl.issueBoards.Boards
Store.removeBlankState();
Store.removeBlankState();
}
}
}
}
});
});
...
...
app/assets/javascripts/boards/components/board_card.js.es6
View file @
dc73405d
(() => {
(() => {
const Store = gl.issueBoards.BoardsStore;
window.gl = window.gl || {};
window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {};
window.gl.issueBoards = window.gl.issueBoards || {};
...
@@ -13,19 +15,19 @@
...
@@ -13,19 +15,19 @@
methods: {
methods: {
filterByLabel (label, e) {
filterByLabel (label, e) {
let labelToggleText = label.title;
let labelToggleText = label.title;
const labelIndex =
gl.issueBoards.Boards
Store.state.filters['label_name'].indexOf(label.title);
const labelIndex = Store.state.filters['label_name'].indexOf(label.title);
$(e.target).tooltip('hide');
$(e.target).tooltip('hide');
if (labelIndex === -1) {
if (labelIndex === -1) {
gl.issueBoards.Boards
Store.state.filters['label_name'].push(label.title);
Store.state.filters['label_name'].push(label.title);
$('.labels-filter').prepend(`<input type="hidden" name="label_name[]" value="${label.title}" />`);
$('.labels-filter').prepend(`<input type="hidden" name="label_name[]" value="${label.title}" />`);
} else {
} else {
gl.issueBoards.Boards
Store.state.filters['label_name'].splice(labelIndex, 1);
Store.state.filters['label_name'].splice(labelIndex, 1);
labelToggleText =
gl.issueBoards.Boards
Store.state.filters['label_name'][0];
labelToggleText = Store.state.filters['label_name'][0];
$(`.labels-filter input[name="label_name[]"][value="${label.title}"]`).remove();
$(`.labels-filter input[name="label_name[]"][value="${label.title}"]`).remove();
}
}
const selectedLabels =
gl.issueBoards.Boards
Store.state.filters['label_name'];
const selectedLabels = Store.state.filters['label_name'];
if (selectedLabels.length === 0) {
if (selectedLabels.length === 0) {
labelToggleText = 'Label';
labelToggleText = 'Label';
} else if (selectedLabels.length > 1) {
} else if (selectedLabels.length > 1) {
...
@@ -34,7 +36,7 @@
...
@@ -34,7 +36,7 @@
$('.labels-filter .dropdown-toggle-text').text(labelToggleText);
$('.labels-filter .dropdown-toggle-text').text(labelToggleText);
gl.issueBoards.Boards
Store.updateFiltersUrl();
Store.updateFiltersUrl();
}
}
}
}
});
});
...
...
app/assets/javascripts/boards/components/board_list.js.es6
View file @
dc73405d
//= require ./board_card
//= require ./board_card
(() => {
(() => {
const Store = gl.issueBoards.BoardsStore;
window.gl = window.gl || {};
window.gl = window.gl || {};
window.gl.issueBoards = window.gl.issueBoards || {};
window.gl.issueBoards = window.gl.issueBoards || {};
...
@@ -18,7 +20,7 @@
...
@@ -18,7 +20,7 @@
data () {
data () {
return {
return {
scrollOffset: 250,
scrollOffset: 250,
filters:
gl.issueBoards.Boards
Store.state.filters
filters: Store.state.filters
};
};
},
},
watch: {
watch: {
...
@@ -59,20 +61,19 @@
...
@@ -59,20 +61,19 @@
onStart: (e) => {
onStart: (e) => {
const card = this.$refs.issue[e.oldIndex];
const card = this.$refs.issue[e.oldIndex];
gl.issueBoards.Boards
Store.moving.issue = card.issue;
Store.moving.issue = card.issue;
gl.issueBoards.Boards
Store.moving.list = card.list;
Store.moving.list = card.list;
},
},
onAdd: (e) => {
onAdd: (e) => {
const card = e.item,
const fromList = Store.moving.list,
fromList = gl.issueBoards.BoardsStore.moving.list,
issue = Store.moving.issue;
issue = gl.issueBoards.BoardsStore.moving.issue;
gl.issueBoards.BoardsStore.moveIssueToList(fromList, this.list, issue);
gl.issueBoards.BoardsStore.moveIssueToList(fromList, this.list, issue);
},
},
onRemove (e) {
onRemove (e) {
const card = e.item,
const card = e.item,
list =
gl.issueBoards.Boards
Store.moving.list,
list = Store.moving.list,
issue =
gl.issueBoards.Boards
Store.moving.issue;
issue = Store.moving.issue;
// Remove the new dom element & let vue add the element
// Remove the new dom element & let vue add the element
card.parentNode.removeChild(card);
card.parentNode.removeChild(card);
...
...
app/assets/javascripts/boards/components/new_list_dropdown.js.es6
View file @
dc73405d
$(() => {
$(() => {
const Store = gl.issueBoards.BoardsStore;
$('.js-new-board-list').each(function () {
$('.js-new-board-list').each(function () {
const $this = $(this);
const $this = $(this);
...
@@ -13,7 +15,7 @@ $(() => {
...
@@ -13,7 +15,7 @@ $(() => {
});
});
},
},
renderRow (label) {
renderRow (label) {
const active =
gl.issueBoards.Boards
Store.findList('title', label.title),
const active = Store.findList('title', label.title),
$li = $('<li />',),
$li = $('<li />',),
$a = $('<a />', {
$a = $('<a />', {
class: (active ? `is-active js-board-list-${active.id}` : ''),
class: (active ? `is-active js-board-list-${active.id}` : ''),
...
@@ -35,10 +37,10 @@ $(() => {
...
@@ -35,10 +37,10 @@ $(() => {
clicked (label, $el, e) {
clicked (label, $el, e) {
e.preventDefault();
e.preventDefault();
if (!
gl.issueBoards.Boards
Store.findList('title', label.title)) {
if (!Store.findList('title', label.title)) {
gl.issueBoards.Boards
Store.new({
Store.new({
title: label.title,
title: label.title,
position:
gl.issueBoards.Boards
Store.state.lists.length - 2,
position: Store.state.lists.length - 2,
list_type: 'label',
list_type: 'label',
label: {
label: {
id: label.id,
id: label.id,
...
...
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