gitlab-org--gitlab-foss/app/assets/javascripts/boards/boards_bundle.js.es6

52 lines
1.1 KiB
JavaScript
Raw Normal View History

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
//= require_tree ./mixins
2016-07-28 07:33:04 -04:00
//= require_tree ./components
$(function () {
if (!window.gl) {
window.gl = {};
}
gl.boardService = new BoardService($('#board-app').data('endpoint'));
2016-07-28 07:33:04 -04:00
if (gl.IssueBoardsApp) {
gl.IssueBoardsApp.$destroy(true);
}
gl.IssueBoardsApp = new Vue({
2016-07-28 07:33:04 -04:00
el: '#board-app',
props: {
disabled: Boolean
},
2016-07-28 07:33:04 -04:00
data: {
state: BoardsStore.state
},
init: function () {
BoardsStore.create();
},
2016-07-28 07:33:04 -04:00
ready: function () {
BoardsStore.disabled = this.disabled;
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();
boards.forEach((board) => {
const list = BoardsStore.new(board, false);
if (list.type === 'done') {
list.position = 9999999;
2016-08-05 12:01:34 -04:00
} else if (list.type === 'backlog') {
list.position = -1;
}
2016-07-28 07:33:04 -04:00
});
BoardsStore.addBlankState();
2016-07-28 07:33:04 -04:00
});
}
});
});