summaryrefslogtreecommitdiffstats
path: root/client
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
parent9faaf07e0257f622abcaa365408fa836a1cbdea8 (diff)
downloadwekan-48ac8b026ffdf8b3823c573e5693dcf1765383e2.tar.gz
wekan-48ac8b026ffdf8b3823c573e5693dcf1765383e2.tar.bz2
wekan-48ac8b026ffdf8b3823c573e5693dcf1765383e2.zip
Implement board archive and restoration
Diffstat (limited to 'client')
-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
-rw-r--r--client/components/main/header.jade6
-rw-r--r--client/components/main/header.js6
-rw-r--r--client/components/main/header.styl2
-rw-r--r--client/components/main/layouts.styl6
-rw-r--r--client/lib/modal.js2
13 files changed, 97 insertions, 24 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
diff --git a/client/components/main/header.jade b/client/components/main/header.jade
index 1185da85..da7999cf 100644
--- a/client/components/main/header.jade
+++ b/client/components/main/header.jade
@@ -31,7 +31,7 @@ template(name="header")
The main bar is a colorful bar that provide all the meta-data for the
current page. This bar is contextual based.
If the user is not connected we display "sign in" and "log in" buttons.
- #header-main-bar
+ #header-main-bar(class="{{#if wrappedHeader}}wrapper{{/if}}")
if $.Session.get 'currentBoard'
+headerBoard
else
@@ -39,3 +39,7 @@ template(name="header")
template(name="headerTitle")
h1 LibreBoard
+ .board-header-btns.right
+ a.board-header-btn.js-open-archived-board
+ i.fa.fa-archive
+ span Archives
diff --git a/client/components/main/header.js b/client/components/main/header.js
index 2a545309..864f889d 100644
--- a/client/components/main/header.js
+++ b/client/components/main/header.js
@@ -2,6 +2,12 @@ Template.header.helpers({
// Reactively set the color of the page from the color of the current board.
headerTemplate: function() {
return 'headerBoard';
+ },
+
+ wrappedHeader: function() {
+ var unwrapedRoutes = ['board', 'card'];
+ var currentRouteName = FlowRouter.getRouteName();
+ return unwrapedRoutes.indexOf(currentRouteName) === -1;
}
});
diff --git a/client/components/main/header.styl b/client/components/main/header.styl
index 1840becb..e31f0992 100644
--- a/client/components/main/header.styl
+++ b/client/components/main/header.styl
@@ -106,6 +106,8 @@
margin: 0 10px
+ span
+ display: inline-block
+ margin-top: 1px
margin-right: 10px
.board-header-btn-close
diff --git a/client/components/main/layouts.styl b/client/components/main/layouts.styl
index 42a70310..f3d9bfe9 100644
--- a/client/components/main/layouts.styl
+++ b/client/components/main/layouts.styl
@@ -42,6 +42,7 @@ body
width: 660px
min-height: 160px
margin: 42px auto
+ padding: 12px
border-radius: 4px
background: darken(white, 13%)
z-index: 110
@@ -49,7 +50,6 @@ body
.modal-close-btn
display: block
float: right
- margin: 12px
font-size: 24px
h1
@@ -206,6 +206,10 @@ dd
margin-bottom: 0
padding-bottom: 0
+.wrapper
+ max-width: 1200px
+ margin: 0 auto
+
.relative
position: relative
diff --git a/client/lib/modal.js b/client/lib/modal.js
index 04a9b8b2..492f6595 100644
--- a/client/lib/modal.js
+++ b/client/lib/modal.js
@@ -1,6 +1,6 @@
const closedValue = null
-Modal = new class {
+window.Modal = new class {
constructor() {
this._currentModal = new ReactiveVar(closedValue)
}