diff options
author | Maxime Quandalle <maxime@quandalle.com> | 2015-08-23 11:09:48 +0200 |
---|---|---|
committer | Maxime Quandalle <maxime@quandalle.com> | 2015-08-26 19:59:44 +0200 |
commit | 48ac8b026ffdf8b3823c573e5693dcf1765383e2 (patch) | |
tree | 832576fddbcdef9810b206f1ee86469702497806 /client/components/boards | |
parent | 9faaf07e0257f622abcaa365408fa836a1cbdea8 (diff) | |
download | wekan-48ac8b026ffdf8b3823c573e5693dcf1765383e2.tar.gz wekan-48ac8b026ffdf8b3823c573e5693dcf1765383e2.tar.bz2 wekan-48ac8b026ffdf8b3823c573e5693dcf1765383e2.zip |
Implement board archive and restoration
Diffstat (limited to 'client/components/boards')
-rw-r--r-- | client/components/boards/boardArchive.jade | 12 | ||||
-rw-r--r-- | client/components/boards/boardArchive.js | 35 | ||||
-rw-r--r-- | client/components/boards/boardBody.jade | 1 | ||||
-rw-r--r-- | client/components/boards/boardHeader.jade | 4 | ||||
-rw-r--r-- | client/components/boards/boardHeader.js | 9 | ||||
-rw-r--r-- | client/components/boards/boardList.jade | 29 | ||||
-rw-r--r-- | client/components/boards/boardList.js | 2 | ||||
-rw-r--r-- | client/components/boards/boardList.styl | 7 |
8 files changed, 78 insertions, 21 deletions
diff --git a/client/components/boards/boardArchive.jade b/client/components/boards/boardArchive.jade new file mode 100644 index 00000000..d659d0cc --- /dev/null +++ b/client/components/boards/boardArchive.jade @@ -0,0 +1,12 @@ +template(name="archivedBoards") + h2 Archived boards + + ul.archived-lists + each archivedBoards + li.archived-lists-item + button.js-restore-board + i.fa.fa-undo + | Restore board + = title + else + li.no-items-message No archived board. diff --git a/client/components/boards/boardArchive.js b/client/components/boards/boardArchive.js new file mode 100644 index 00000000..1ce1a593 --- /dev/null +++ b/client/components/boards/boardArchive.js @@ -0,0 +1,35 @@ +Template.headerTitle.events({ + 'click .js-open-archived-board': function() { + Modal.open('archivedBoards') + } +}) + +BlazeComponent.extendComponent({ + template() { + return 'archivedBoards'; + }, + + onCreated() { + this.subscribe('archivedBoards') + }, + + archivedBoards() { + return Boards.find({ archived: true }, { + sort: ['title'] + }) + }, + + events() { + return [{ + 'click .js-restore-board': function() { + let boardId = this.currentData()._id + Boards.update(boardId, { + $set: { + archived: false + } + }) + Utils.goBoardId(boardId) + } + }] + }, +}).register('archivedBoards') diff --git a/client/components/boards/boardBody.jade b/client/components/boards/boardBody.jade index 6598dea9..25c8f6d8 100644 --- a/client/components/boards/boardBody.jade +++ b/client/components/boards/boardBody.jade @@ -3,6 +3,7 @@ template(name="board") if currentBoard +boardBody else + //- XXX We need a better error message in case the board has been archived +message(label="board-no-found") else +spinner diff --git a/client/components/boards/boardHeader.jade b/client/components/boards/boardHeader.jade index f6ef59c3..4773e3bb 100644 --- a/client/components/boards/boardHeader.jade +++ b/client/components/boards/boardHeader.jade @@ -60,7 +60,7 @@ template(name="boardMenuPopup") if currentUser.isBoardAdmin hr ul.pop-over-list - li: a Close Board… + li: a.js-archive-board Archive Board… template(name="boardVisibilityList") ul.pop-over-list @@ -120,6 +120,6 @@ template(name="boardChangeTitlePopup") input.js-board-name(type="text" value="{{title}}" autofocus) input.primary.wide(type="submit" value="{{_ 'rename'}}") -template(name="closeBoardPopup") +template(name="archiveBoardPopup") p {{_ 'close-board-pop'}} button.js-confirm.negate.full(type="submit") {{_ 'close'}} diff --git a/client/components/boards/boardHeader.js b/client/components/boards/boardHeader.js index efe6b5ef..19103f98 100644 --- a/client/components/boards/boardHeader.js +++ b/client/components/boards/boardHeader.js @@ -5,7 +5,14 @@ Template.boardMenuPopup.events({ Popup.close(); }, 'click .js-change-board-color': Popup.open('boardChangeColor'), - 'click .js-change-language': Popup.open('setLanguage') + 'click .js-change-language': Popup.open('setLanguage'), + 'click .js-archive-board ': Popup.afterConfirm('archiveBoard', function() { + var boardId = Session.get('currentBoard'); + Boards.update(boardId, { $set: { archived: true }}); + // XXX We should have some kind of notification on top of the page to + // confirm that the board was successfully archived. + FlowRouter.go('home'); + }) }); Template.boardChangeTitlePopup.events({ diff --git a/client/components/boards/boardList.jade b/client/components/boards/boardList.jade index a6895cc8..4a73ed48 100644 --- a/client/components/boards/boardList.jade +++ b/client/components/boards/boardList.jade @@ -1,15 +1,16 @@ template(name="boardList") - if boards.count - ul.board-list.clearfix - each boards - li(class="{{#if isStarred}}starred{{/if}}" class=colorClass) - a.js-open-board(href="{{pathFor 'board' id=_id slug=slug}}") - span.details - span.board-list-item-name= title - i.fa.js-star-board( - class="fa-star{{#if isStarred}} is-star-active{{else}}-o{{/if}}" - title="{{_ 'star-board-title'}}") - else - ul.board-list.clearfix - li.js-add-board - a.label {{_ 'add-board'}} + .wrapper + if boards.count + ul.board-list.clearfix + each boards + li(class="{{#if isStarred}}starred{{/if}}" class=colorClass) + a.js-open-board(href="{{pathFor 'board' id=_id slug=slug}}") + span.details + span.board-list-item-name= title + i.fa.js-star-board( + class="fa-star{{#if isStarred}} is-star-active{{else}}-o{{/if}}" + title="{{_ 'star-board-title'}}") + else + ul.board-list.clearfix + li.js-add-board + a.label {{_ 'add-board'}} diff --git a/client/components/boards/boardList.js b/client/components/boards/boardList.js index e86d16ab..cf6b727c 100644 --- a/client/components/boards/boardList.js +++ b/client/components/boards/boardList.js @@ -4,7 +4,7 @@ BlazeComponent.extendComponent({ }, boards: function() { - return Boards.find({}, { + return Boards.find({ archived: false }, { sort: ['title'] }); }, diff --git a/client/components/boards/boardList.styl b/client/components/boards/boardList.styl index af66a1a2..8e296028 100644 --- a/client/components/boards/boardList.styl +++ b/client/components/boards/boardList.styl @@ -1,6 +1,7 @@ +$spaceBetweenTiles = 16px + .board-list - margin: 25px auto - width: 1200px + margin: $spaceBetweenTiles ($spaceBetweenTiles/-2) 0 li float: left @@ -24,7 +25,7 @@ font-weight: 700 min-height: 18px padding: 8px 12px 8px 12px - margin: 0 16px 16px 0 + margin: 0 ($spaceBetweenTiles/2) $spaceBetweenTiles position: relative text-decoration: none |