Implement board archive and restoration

This commit is contained in:
Maxime Quandalle 2015-08-23 11:09:48 +02:00
parent 9faaf07e02
commit 48ac8b026f
32 changed files with 138 additions and 42 deletions

View file

@ -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.

View file

@ -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')

View file

@ -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

View file

@ -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'}}

View file

@ -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({

View file

@ -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'}}

View file

@ -4,7 +4,7 @@ BlazeComponent.extendComponent({
},
boards: function() {
return Boards.find({}, {
return Boards.find({ archived: false }, {
sort: ['title']
});
},

View file

@ -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