Commit 0fa57599 authored by Phil Hughes's avatar Phil Hughes

Hides the welcome board forever after it being hidden by the user

parent 0b351d55
......@@ -7,15 +7,23 @@
//= require_tree ./components
$(function () {
window.service = new BoardService($('#board-app').data('endpoint'));
if (!window.gl) {
window.gl = {};
}
gl.boardService = new BoardService($('#board-app').data('endpoint'));
new Vue({
if (gl.IssueBoardsApp) {
gl.IssueBoardsApp.$destroy(true);
BoardsStore.reset();
}
gl.IssueBoardsApp = new Vue({
el: '#board-app',
data: {
state: BoardsStore.state
},
ready: function () {
service.all()
gl.boardService.all()
.then((resp) => {
const boards = resp.json();
......
......@@ -2,10 +2,10 @@
const BoardBlankState = Vue.extend({
methods: {
addDefaultLists: function () {
},
clearBlankState: function () {
BoardsStore.removeList('blank');
BoardsStore.removeBlankState();
}
}
});
......
......@@ -12,7 +12,7 @@ class List {
if (this.type !== 'blank') {
this.loading = true;
service.getIssuesForList(this.id)
gl.boardService.getIssuesForList(this.id)
.then((resp) => {
const data = resp.json();
this.loading = false;
......@@ -25,7 +25,7 @@ class List {
}
save () {
service.createList(this.label.id)
gl.boardService.createList(this.label.id)
.then((resp) => {
const data = resp.json();
......@@ -36,11 +36,13 @@ class List {
}
destroy () {
service.destroyList(this.id);
if (this.type !== 'blank') {
gl.boardService.destroyList(this.id);
}
}
update () {
service.updateList(this);
gl.boardService.updateList(this);
}
canSearch () {
......@@ -52,7 +54,7 @@ class List {
issue.addLabel(this.label);
service.moveIssue(issue.id, listFrom.id, this.id);
gl.boardService.moveIssue(issue.id, listFrom.id, this.id);
}
findIssue (id) {
......
......@@ -9,6 +9,15 @@
label: []
}
},
reset: function () {
this.state.lists = [];
this.state.filters = {
author: {},
assignee: {},
milestone: {},
label: []
};
},
new: function (board, persist = true) {
const doneList = this.getDoneList(),
list = new List(board);
......@@ -35,6 +44,8 @@
return addBlankState;
},
addBlankState: function () {
if ($.cookie('issue_board_welcome_hidden') === 'true') return;
const doneList = this.getDoneList(),
addBlankState = this.shouldAddBlankState();
......@@ -49,24 +60,22 @@
},
removeBlankState: function () {
this.removeList('blank');
$.cookie('issue_board_welcome_hidden', 'true', {
path: '/',
expires: 365 * 10
});
},
getDoneList: function () {
return this.findList('type', 'done');
},
removeList: function (id) {
const list = this.findList('id', id);
if (id !== 'blank') {
list.destroy();
}
list.destroy();
this.state.lists = _.reject(this.state.lists, (list) => {
return list.id === id;
});
if (id !== 'blank') {
this.addBlankState();
}
},
moveList: function (oldIndex, newIndex) {
const listFrom = this.findList('position', oldIndex),
......
......@@ -11,4 +11,4 @@
%button.btn.btn-create.btn-inverted.btn-block{ type: "button", "@click" => "addDefaultLists" }
Add default lists
%button.btn.btn-default.btn-block{ type: "button", "@click" => "clearBlankState" }
Nevermind, i'll use my own
Nevermind, I'll use my own
......@@ -4,13 +4,13 @@
%header.board-inner-container.board-header{ ":class" => "{ 'has-border': board.label }", ":style" => "{ borderTopColor: board.label.color }" }
%h3.board-title
{{ board.title }}
%span.pull-right
%span.pull-right{ "v-if" => "board.type !== 'blank'" }
{{ board.issues.length }}
%board-delete{ "inline-template" => true, "v-if" => "!isPreset", ":board-id" => "board.id" }
%button.board-delete.has-tooltip.pull-right{ type: "button", title: "Delete board", "aria-label" => "Delete board", data: { placement: "bottom" }, "@click" => "deleteBoard" }
= icon("trash")
.board-inner-container.board-search-container{ "v-if" => "board.canSearch()" }
%input.form-control{ type: "text", placeholder: "Search issues", "v-model" => "query" }
%input.form-control{ type: "text", placeholder: "Search issues", "v-model" => "query", "debounce" => "250" }
= icon("search", class: "board-search-icon", "v-show" => "!query")
%button.board-search-clear-btn{ type: "button", role: "button", "aria-label" => "Clear search", "@click" => "clearSearch", "v-show" => "query" }
= icon("times", class: "board-search-clear")
......@@ -29,4 +29,5 @@
"v-show" => "!loading",
":data-board" => "boardId" }
= render "projects/boards/components/card"
= render "projects/boards/components/blank_state"
- if current_user
= render "projects/boards/components/blank_state"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment