BigW Consortium Gitlab

Commit 0fa57599 by Phil Hughes

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

parent 0b351d55
...@@ -7,15 +7,23 @@ ...@@ -7,15 +7,23 @@
//= require_tree ./components //= require_tree ./components
$(function () { $(function () {
window.service = new BoardService($('#board-app').data('endpoint')); if (!window.gl) {
window.gl = {};
}
gl.boardService = new BoardService($('#board-app').data('endpoint'));
if (gl.IssueBoardsApp) {
gl.IssueBoardsApp.$destroy(true);
BoardsStore.reset();
}
new Vue({ gl.IssueBoardsApp = new Vue({
el: '#board-app', el: '#board-app',
data: { data: {
state: BoardsStore.state state: BoardsStore.state
}, },
ready: function () { ready: function () {
service.all() gl.boardService.all()
.then((resp) => { .then((resp) => {
const boards = resp.json(); const boards = resp.json();
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
}, },
clearBlankState: function () { clearBlankState: function () {
BoardsStore.removeList('blank'); BoardsStore.removeBlankState();
} }
} }
}); });
......
...@@ -12,7 +12,7 @@ class List { ...@@ -12,7 +12,7 @@ class List {
if (this.type !== 'blank') { if (this.type !== 'blank') {
this.loading = true; this.loading = true;
service.getIssuesForList(this.id) gl.boardService.getIssuesForList(this.id)
.then((resp) => { .then((resp) => {
const data = resp.json(); const data = resp.json();
this.loading = false; this.loading = false;
...@@ -25,7 +25,7 @@ class List { ...@@ -25,7 +25,7 @@ class List {
} }
save () { save () {
service.createList(this.label.id) gl.boardService.createList(this.label.id)
.then((resp) => { .then((resp) => {
const data = resp.json(); const data = resp.json();
...@@ -36,11 +36,13 @@ class List { ...@@ -36,11 +36,13 @@ class List {
} }
destroy () { destroy () {
service.destroyList(this.id); if (this.type !== 'blank') {
gl.boardService.destroyList(this.id);
}
} }
update () { update () {
service.updateList(this); gl.boardService.updateList(this);
} }
canSearch () { canSearch () {
...@@ -52,7 +54,7 @@ class List { ...@@ -52,7 +54,7 @@ class List {
issue.addLabel(this.label); issue.addLabel(this.label);
service.moveIssue(issue.id, listFrom.id, this.id); gl.boardService.moveIssue(issue.id, listFrom.id, this.id);
} }
findIssue (id) { findIssue (id) {
......
...@@ -9,6 +9,15 @@ ...@@ -9,6 +9,15 @@
label: [] label: []
} }
}, },
reset: function () {
this.state.lists = [];
this.state.filters = {
author: {},
assignee: {},
milestone: {},
label: []
};
},
new: function (board, persist = true) { new: function (board, persist = true) {
const doneList = this.getDoneList(), const doneList = this.getDoneList(),
list = new List(board); list = new List(board);
...@@ -35,6 +44,8 @@ ...@@ -35,6 +44,8 @@
return addBlankState; return addBlankState;
}, },
addBlankState: function () { addBlankState: function () {
if ($.cookie('issue_board_welcome_hidden') === 'true') return;
const doneList = this.getDoneList(), const doneList = this.getDoneList(),
addBlankState = this.shouldAddBlankState(); addBlankState = this.shouldAddBlankState();
...@@ -49,24 +60,22 @@ ...@@ -49,24 +60,22 @@
}, },
removeBlankState: function () { removeBlankState: function () {
this.removeList('blank'); this.removeList('blank');
$.cookie('issue_board_welcome_hidden', 'true', {
path: '/',
expires: 365 * 10
});
}, },
getDoneList: function () { getDoneList: function () {
return this.findList('type', 'done'); return this.findList('type', 'done');
}, },
removeList: function (id) { removeList: function (id) {
const list = this.findList('id', id); const list = this.findList('id', id);
if (id !== 'blank') {
list.destroy(); list.destroy();
}
this.state.lists = _.reject(this.state.lists, (list) => { this.state.lists = _.reject(this.state.lists, (list) => {
return list.id === id; return list.id === id;
}); });
if (id !== 'blank') {
this.addBlankState();
}
}, },
moveList: function (oldIndex, newIndex) { moveList: function (oldIndex, newIndex) {
const listFrom = this.findList('position', oldIndex), const listFrom = this.findList('position', oldIndex),
......
...@@ -11,4 +11,4 @@ ...@@ -11,4 +11,4 @@
%button.btn.btn-create.btn-inverted.btn-block{ type: "button", "@click" => "addDefaultLists" } %button.btn.btn-create.btn-inverted.btn-block{ type: "button", "@click" => "addDefaultLists" }
Add default lists Add default lists
%button.btn.btn-default.btn-block{ type: "button", "@click" => "clearBlankState" } %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 @@ ...@@ -4,13 +4,13 @@
%header.board-inner-container.board-header{ ":class" => "{ 'has-border': board.label }", ":style" => "{ borderTopColor: board.label.color }" } %header.board-inner-container.board-header{ ":class" => "{ 'has-border': board.label }", ":style" => "{ borderTopColor: board.label.color }" }
%h3.board-title %h3.board-title
{{ board.title }} {{ board.title }}
%span.pull-right %span.pull-right{ "v-if" => "board.type !== 'blank'" }
{{ board.issues.length }} {{ board.issues.length }}
%board-delete{ "inline-template" => true, "v-if" => "!isPreset", ":board-id" => "board.id" } %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" } %button.board-delete.has-tooltip.pull-right{ type: "button", title: "Delete board", "aria-label" => "Delete board", data: { placement: "bottom" }, "@click" => "deleteBoard" }
= icon("trash") = icon("trash")
.board-inner-container.board-search-container{ "v-if" => "board.canSearch()" } .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") = 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" } %button.board-search-clear-btn{ type: "button", role: "button", "aria-label" => "Clear search", "@click" => "clearSearch", "v-show" => "query" }
= icon("times", class: "board-search-clear") = icon("times", class: "board-search-clear")
...@@ -29,4 +29,5 @@ ...@@ -29,4 +29,5 @@
"v-show" => "!loading", "v-show" => "!loading",
":data-board" => "boardId" } ":data-board" => "boardId" }
= render "projects/boards/components/card" = render "projects/boards/components/card"
- if current_user
= render "projects/boards/components/blank_state" = 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