summaryrefslogtreecommitdiffstats
path: root/client/components/boards
diff options
context:
space:
mode:
authorMaxime Quandalle <maxime@quandalle.com>2015-08-23 11:09:48 +0200
committerMaxime Quandalle <maxime@quandalle.com>2015-08-26 19:59:44 +0200
commit48ac8b026ffdf8b3823c573e5693dcf1765383e2 (patch)
tree832576fddbcdef9810b206f1ee86469702497806 /client/components/boards
parent9faaf07e0257f622abcaa365408fa836a1cbdea8 (diff)
downloadwekan-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.jade12
-rw-r--r--client/components/boards/boardArchive.js35
-rw-r--r--client/components/boards/boardBody.jade1
-rw-r--r--client/components/boards/boardHeader.jade4
-rw-r--r--client/components/boards/boardHeader.js9
-rw-r--r--client/components/boards/boardList.jade29
-rw-r--r--client/components/boards/boardList.js2
-rw-r--r--client/components/boards/boardList.styl7
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