diff options
author | Andrés Manelli <andresmanelli@gmail.com> | 2018-01-22 16:54:19 -0300 |
---|---|---|
committer | Andrés Manelli <andresmanelli@gmail.com> | 2018-01-22 16:54:19 -0300 |
commit | a14f4ffee297872c72edc99d7b147d18802f7d44 (patch) | |
tree | 02376dced6aa57a3b7e0bf5a78a34582c38d04b8 | |
parent | 2d7d9b5d9ffed0349b2cf65acc61561c21d05aaf (diff) | |
download | wekan-a14f4ffee297872c72edc99d7b147d18802f7d44.tar.gz wekan-a14f4ffee297872c72edc99d7b147d18802f7d44.tar.bz2 wekan-a14f4ffee297872c72edc99d7b147d18802f7d44.zip |
Add view boards field to change between views
-rw-r--r-- | client/components/boards/boardHeader.jade | 5 | ||||
-rw-r--r-- | client/components/boards/boardHeader.js | 16 | ||||
-rw-r--r-- | i18n/en.i18n.json | 3 | ||||
-rw-r--r-- | models/boards.js | 8 | ||||
-rw-r--r-- | server/migrations.js | 12 |
5 files changed, 44 insertions, 0 deletions
diff --git a/client/components/boards/boardHeader.jade b/client/components/boards/boardHeader.jade index ffb8eb27..1a65ce27 100644 --- a/client/components/boards/boardHeader.jade +++ b/client/components/boards/boardHeader.jade @@ -87,6 +87,11 @@ template(name="boardHeaderBar") a.board-header-btn-close.js-filter-reset(title="{{_ 'filter-clear'}}") i.fa.fa-times-thin + a.board-header-btn.js-toggle-board-view( + title="{{_ 'board-view'}}") + i.fa.fa-th-large + span {{_ currentBoard.view}} + if canModifyBoard a.board-header-btn.js-multiselection-activate( title="{{#if MultiSelection.isActive}}{{_ 'multi-selection-on'}}{{else}}{{_ 'multi-selection'}}{{/if}}" diff --git a/client/components/boards/boardHeader.js b/client/components/boards/boardHeader.js index e6943b40..4cc582b1 100644 --- a/client/components/boards/boardHeader.js +++ b/client/components/boards/boardHeader.js @@ -76,6 +76,22 @@ BlazeComponent.extendComponent({ 'click .js-open-archived-board'() { Modal.open('archivedBoards'); }, + 'click .js-toggle-board-view'() { + const currentBoard = Boards.findOne(Session.get('currentBoard')); + if (currentBoard.view === 'board-view-swimlanes') { + Boards.update(currentBoard._id, { + $set: { + view: 'board-view-lists', + } + }); + } else if (currentBoard.view === 'board-view-lists') { + Boards.update(currentBoard._id, { + $set: { + view: 'board-view-swimlanes', + } + }); + } + }, 'click .js-open-filter-view'() { Sidebar.setView('filter'); }, diff --git a/i18n/en.i18n.json b/i18n/en.i18n.json index be04fac0..acb7992f 100644 --- a/i18n/en.i18n.json +++ b/i18n/en.i18n.json @@ -95,6 +95,9 @@ "boardChangeWatchPopup-title": "Change Watch", "boardMenuPopup-title": "Board Menu", "boards": "Boards", + "board-view": "Board View", + "board-view-swimlanes": "Swimlanes", + "board-view-lists": "Lists", "bucket-example": "Like “Bucket List” for example", "cancel": "Cancel", "card-archived": "This card is archived.", diff --git a/models/boards.js b/models/boards.js index 5f39d8a4..84a715fb 100644 --- a/models/boards.js +++ b/models/boards.js @@ -31,6 +31,14 @@ Boards.attachSchema(new SimpleSchema({ } }, }, + view: { + type: String, + autoValue() { // eslint-disable-line consistent-return + if (this.isInsert) { + return 'board-view-swimlanes'; + } + }, + }, createdAt: { type: Date, autoValue() { // eslint-disable-line consistent-return diff --git a/server/migrations.js b/server/migrations.js index fbb33636..f2cb124b 100644 --- a/server/migrations.js +++ b/server/migrations.js @@ -175,3 +175,15 @@ Migrations.add('add-swimlanes', () => { }); }); }); + +Migrations.add('add-views', () => { + Boards.find().forEach((board) => { + if (!board.hasOwnProperty('view')) { + Boards.direct.update( + { _id: board._id }, + { $set: { view: 'board-view-swimlanes' } }, + noValidate + ); + } + }); +}); |