Implement list restoration

This commit is contained in:
Maxime Quandalle 2015-08-22 02:06:49 +02:00
parent 4fc72d64b4
commit 04bfbd5bd1
7 changed files with 68 additions and 15 deletions

View file

@ -55,3 +55,4 @@ peerlibrary:blaze-components
perak:markdown perak:markdown
reactive-var reactive-var
seriousm:emoji-continued seriousm:emoji-continued
templates:tabs

View file

@ -107,6 +107,7 @@ spacebars@1.0.6
spacebars-compiler@1.0.6 spacebars-compiler@1.0.6
srp@1.0.3 srp@1.0.3
tap:i18n@1.5.1 tap:i18n@1.5.1
templates:tabs@2.2.0
templating@1.1.1 templating@1.1.1
tmeasday:presence@1.0.6 tmeasday:presence@1.0.6
tracker@1.0.7 tracker@1.0.7

View file

@ -288,6 +288,10 @@ a
list-style-type: initial list-style-type: initial
padding-left: 20px padding-left: 20px
.basicTabs-container .tabs-content-container
padding: 0
padding-top: 15px
@keyframes fadeIn @keyframes fadeIn
from from
opacity: 0 opacity: 0

View file

@ -116,3 +116,17 @@
.board-sidebar.is-open &.is-hidden .board-sidebar.is-open &.is-hidden
z-index: 0 z-index: 0
left: 5px left: 5px
.archived-lists .archived-lists-item
border-top: 1px solid darken(white, 20%)
clear: both
padding: 5px 0
&:first-child
border-top: none
button
float: right
margin: 0
margin-bottom: 5px
padding: 0 2px 0 10px

View file

@ -1,12 +1,25 @@
template(name="archivesSidebar") template(name="archivesSidebar")
each archivedCards +basicTabs(tabs=tabs)
.minicard-wrapper.js-minicard
+minicard(this) +tabContent(slug="cards")
p.quiet each archivedCards
a.js-restore Restore .minicard-wrapper.js-minicard
| - +minicard(this)
a.js-delete Delete p.quiet
if cardIsInArchivedList a.js-restore-card Restore
p.quiet.small (warning: this card is in an archived list) <br> | -
else a.js-delete-card Delete
p.no-items-message No archived cards. if cardIsInArchivedList
p.quiet.small (warning: this card is in an archived list) <br>
else
p.no-items-message No archived cards.
+tabContent(slug="lists")
ul.archived-lists
each archivedLists
li.archived-lists-item
button.js-restore-list
i.fa.fa-undo
= title
else
li.no-items-message No archived lists.

View file

@ -3,8 +3,19 @@ BlazeComponent.extendComponent({
return 'archivesSidebar'; return 'archivesSidebar';
}, },
tabs: function() {
return [
{ name: 'Cards', slug: 'cards' },
{ name: 'Lists', slug: 'lists' }
]
},
archivedCards: function() { archivedCards: function() {
return Cards.find({archived: true}); return Cards.find({ archived: true });
},
archivedLists: function() {
return Lists.find({ archived: true });
}, },
cardIsInArchivedList: function() { cardIsInArchivedList: function() {
@ -17,15 +28,19 @@ BlazeComponent.extendComponent({
events: function() { events: function() {
return [{ return [{
'click .js-restore': function() { 'click .js-restore-card': function() {
var cardId = this.currentData()._id; var cardId = this.currentData()._id;
Cards.update(cardId, {$set: {archived: false}}); Cards.update(cardId, {$set: {archived: false}});
}, },
'click .js-delete': Popup.afterConfirm('cardDelete', function() { 'click .js-delete-card': Popup.afterConfirm('cardDelete', function() {
var cardId = this._id; var cardId = this._id;
Cards.remove(cardId); Cards.remove(cardId);
Popup.close(); Popup.close();
}) }),
'click .js-restore-list': function() {
var listId = this.currentData()._id;
Lists.update(listId, {$set: {archived: false}});
}
}]; }];
} }
}).register('archivesSidebar'); }).register('archivesSidebar');

View file

@ -0,0 +1,5 @@
// XXX Since Blaze doesn't have a clean high component API, component API are
// also tweaky to use. I guess React would be a solution.
ReactiveTabs.createInterface({
template: 'basicTabs'
});