2016-07-28 07:33:04 -04:00
|
|
|
//= require vue
|
|
|
|
//= require vue-resource
|
|
|
|
//= require Sortable
|
2016-08-01 09:18:30 -04:00
|
|
|
//= require_tree ./models
|
2016-07-28 07:33:04 -04:00
|
|
|
//= require_tree ./stores
|
|
|
|
//= require_tree ./services
|
2016-08-05 11:30:14 -04:00
|
|
|
//= require_tree ./mixins
|
2016-08-15 05:07:53 -04:00
|
|
|
//= require ./components/board
|
|
|
|
//= require ./components/new_list_dropdown
|
2016-08-16 06:34:32 -04:00
|
|
|
//= require ./vue_resource_interceptor
|
2016-07-28 07:33:04 -04:00
|
|
|
|
2016-08-11 04:51:52 -04:00
|
|
|
$(() => {
|
2016-08-16 04:02:45 -04:00
|
|
|
const $boardApp = document.getElementById('board-app'),
|
|
|
|
Store = gl.issueBoards.BoardsStore;
|
2016-08-11 04:51:52 -04:00
|
|
|
|
2016-08-15 04:57:01 -04:00
|
|
|
window.gl = window.gl || {};
|
2016-07-28 07:33:04 -04:00
|
|
|
|
2016-08-05 09:00:06 -04:00
|
|
|
if (gl.IssueBoardsApp) {
|
|
|
|
gl.IssueBoardsApp.$destroy(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
gl.IssueBoardsApp = new Vue({
|
2016-08-16 04:02:45 -04:00
|
|
|
el: $boardApp,
|
2016-08-15 05:07:53 -04:00
|
|
|
components: {
|
|
|
|
'board': gl.issueBoards.Board
|
|
|
|
},
|
2016-07-28 07:33:04 -04:00
|
|
|
data: {
|
2016-08-16 04:02:45 -04:00
|
|
|
state: Store.state,
|
2016-08-11 04:51:52 -04:00
|
|
|
loading: true,
|
2016-08-16 04:02:45 -04:00
|
|
|
endpoint: $boardApp.dataset.endpoint,
|
|
|
|
disabled: $boardApp.dataset.disabled === 'true',
|
|
|
|
issueLinkBase: $boardApp.dataset.issueLinkBase
|
2016-07-28 07:33:04 -04:00
|
|
|
},
|
2016-08-11 04:51:52 -04:00
|
|
|
init () {
|
2016-08-15 04:57:01 -04:00
|
|
|
gl.issueBoards.BoardsStore.create();
|
2016-08-05 13:39:49 -04:00
|
|
|
},
|
2016-08-11 04:51:52 -04:00
|
|
|
created () {
|
2016-08-08 11:15:05 -04:00
|
|
|
this.loading = true;
|
|
|
|
gl.boardService = new BoardService(this.endpoint);
|
|
|
|
},
|
2016-08-11 04:51:52 -04:00
|
|
|
ready () {
|
2016-08-16 04:02:45 -04:00
|
|
|
Store.disabled = this.disabled;
|
2016-08-05 09:00:06 -04:00
|
|
|
gl.boardService.all()
|
2016-07-28 07:33:04 -04:00
|
|
|
.then((resp) => {
|
2016-08-02 04:58:09 -04:00
|
|
|
const boards = resp.json();
|
|
|
|
|
2016-08-11 04:51:52 -04:00
|
|
|
for (let i = 0, boardsLength = boards.length; i < boardsLength; i++) {
|
|
|
|
const board = boards[i],
|
2016-08-16 04:02:45 -04:00
|
|
|
list = Store.addList(board);
|
2016-08-04 11:16:50 -04:00
|
|
|
|
|
|
|
if (list.type === 'done') {
|
2016-08-11 04:51:52 -04:00
|
|
|
list.position = Infinity;
|
2016-08-05 12:01:34 -04:00
|
|
|
} else if (list.type === 'backlog') {
|
|
|
|
list.position = -1;
|
2016-08-04 11:16:50 -04:00
|
|
|
}
|
2016-08-11 04:51:52 -04:00
|
|
|
}
|
2016-08-04 11:16:50 -04:00
|
|
|
|
2016-08-16 04:02:45 -04:00
|
|
|
Store.addBlankState();
|
2016-08-08 11:15:05 -04:00
|
|
|
this.loading = false;
|
2016-07-28 07:33:04 -04:00
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|