BigW Consortium Gitlab

Commit c30a9013 by Phil Hughes

Changes names to lists

Fixed some bugs introduced when moving to es6
parent 8e041957
...@@ -17,7 +17,7 @@ $(function () { ...@@ -17,7 +17,7 @@ $(function () {
service.all() service.all()
.then((resp) => { .then((resp) => {
resp.data.forEach((board) => { resp.data.forEach((board) => {
BoardsStore.state.boards.push(board); BoardsStore.state.lists.push(board);
}); });
}); });
} }
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
}, },
computed: { computed: {
isPreset: function () { isPreset: function () {
typeof this.board.id !== 'number'; return typeof this.board.id !== 'number';
} }
}, },
ready: function () { ready: function () {
......
((w) => { ((w) => {
w.BoardsStore = { w.BoardsStore = {
state: { state: {
boards: [], lists: [],
done: {}, done: {},
filters: { filters: {
author: {}, author: {},
...@@ -10,18 +10,18 @@ ...@@ -10,18 +10,18 @@
} }
}, },
removeBoard: (id) => { removeBoard: (id) => {
BoardsStore.state.boards = _.reject(BoardsStore.state.boards, (board) => { BoardsStore.state.lists = _.reject(BoardsStore.state.lists, (board) => {
return board.id === id; return board.id === id;
}); });
}, },
moveBoard: (oldIndex, newIndex) => { moveBoard: (oldIndex, newIndex) => {
const boardFrom = _.find(BoardsStore.state.boards, (board) => { const boardFrom = _.find(BoardsStore.state.lists, (board) => {
return board.index === oldIndex; return board.index === oldIndex;
}); });
service.updateBoard(boardFrom.id, newIndex); service.updateBoard(boardFrom.id, newIndex);
const boardTo = _.find(BoardsStore.state.boards, (board) => { const boardTo = _.find(BoardsStore.state.lists, (board) => {
return board.index === newIndex; return board.index === newIndex;
}); });
...@@ -33,10 +33,10 @@ ...@@ -33,10 +33,10 @@
} }
}, },
moveCardToBoard: (boardFromId, boardToId, issueId, toIndex) => { moveCardToBoard: (boardFromId, boardToId, issueId, toIndex) => {
const boardFrom = _.find(BoardsStore.state.boards, (board) => { const boardFrom = _.find(BoardsStore.state.lists, (board) => {
return board.id === boardFromId; return board.id === boardFromId;
}); });
const boardTo = _.find(BoardsStore.state.boards, (board) => { const boardTo = _.find(BoardsStore.state.lists, (board) => {
return board.id === boardToId; return board.id === boardToId;
}); });
let issue = _.find(boardFrom.issues, (issue) => { let issue = _.find(boardFrom.issues, (issue) => {
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
}); });
// Add to new boards issues if it doesn't already exist // Add to new boards issues if it doesn't already exist
if (issueTo !== null) { if (issueTo) {
issue = issueTo; issue = issueTo;
} else { } else {
boardTo.issues.splice(toIndex, 0, issue); boardTo.issues.splice(toIndex, 0, issue);
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
return label.title === boardTo.title; return label.title === boardTo.title;
}); });
if (foundLabel === null) { if (!foundLabel) {
issue.labels.push(boardTo.label); issue.labels.push(boardTo.label);
} }
} }
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
}, },
removeIssueFromBoards: (issue, boards) => { removeIssueFromBoards: (issue, boards) => {
const boardLabels = _.map(boards, (board) => { const boardLabels = _.map(boards, (board) => {
return board.label.title; return board.title;
}); });
boards.issues = _.each(boards, (board) => { boards.issues = _.each(boards, (board) => {
...@@ -98,11 +98,11 @@ ...@@ -98,11 +98,11 @@
}); });
}, },
getBoardsForIssue: (issue) => { getBoardsForIssue: (issue) => {
_.filter(BoardsStore.state.boards, (board) => { return _.filter(BoardsStore.state.lists, (board) => {
const foundIssue = _.find(board.issues, (boardIssue) => { const foundIssue = _.find(board.issues, (boardIssue) => {
return issue.id === boardIssue.id; return issue.id === boardIssue.id;
}); });
return foundIssue !== null; return foundIssue;
}); });
}, },
clearDone: () => { clearDone: () => {
......
%board{ "inline-template" => true, "v-cloak" => true, "v-for" => "board in state.boards | orderBy 'index'", ":board" => "board" } %board{ "inline-template" => true, "v-cloak" => true, "v-for" => "board in state.lists | orderBy 'index'", ":board" => "board" }
.board{ ":class" => "{ 'is-draggable': !isPreset }" } .board{ ":class" => "{ 'is-draggable': !isPreset }" }
.board-inner .board-inner
%header.board-inner-container.board-header{ ":class" => "{ 'has-border': board.label }", ":style" => "{ borderTopColor: board.label.backgroundColor }" } %header.board-inner-container.board-header{ ":class" => "{ 'has-border': board.label }", ":style" => "{ borderTopColor: board.label.backgroundColor }" }
...@@ -7,16 +7,12 @@ ...@@ -7,16 +7,12 @@
%span.pull-right %span.pull-right
{{ 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", 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" }
%span.sr-only
Delete board
= icon("trash") = icon("trash")
.board-inner-container.board-search-container{ "v-if" => "board.search" } .board-inner-container.board-search-container{ "v-if" => "board.search" }
%input.form-control{ type: "text", placeholder: "Search issues", "v-model" => "query" } %input.form-control{ type: "text", placeholder: "Search issues", "v-model" => "query" }
= 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", "@click" => "clearSearch", "v-show" => "query" } %button.board-search-clear-btn{ type: "button", role: "button", "aria-label" => "Clear search", "@click" => "clearSearch", "v-show" => "query" }
%span.sr-only
Clear search
= icon("times", class: "board-search-clear") = icon("times", class: "board-search-clear")
%board-list{ "inline-template" => true, ":board-id" => "board.id", ":issues" => "board.issues", ":disabled" => "#{current_user.nil?}", ":query" => "query", ":filters" => "filters" } %board-list{ "inline-template" => true, ":board-id" => "board.id", ":issues" => "board.issues", ":disabled" => "#{current_user.nil?}", ":query" => "query", ":filters" => "filters" }
%ul.board-list{ "v-el:list" => true, ":data-board" => "boardId" } %ul.board-list{ "v-el:list" => true, ":data-board" => "boardId" }
......
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