{{_ "card-delete-pop"}}
- - -{{_ "attachment-delete-pop"}}
diff --git a/client/components/lists/body.jade b/client/components/lists/body.jade index f1159ce56..60e7a57e0 100644 --- a/client/components/lists/body.jade +++ b/client/components/lists/body.jade @@ -5,7 +5,13 @@ template(name="listBody") +inlinedForm(autoclose=false position="top") +addCardForm(listId=_id position="top") each cards - +minicard(this) + a.minicard-wrapper.js-minicard(href=absoluteUrl + class="{{#if cardIsSelected}}is-selected{{/if}}" + class="{{#if MultiSelection.isSelected _id}}is-checked{{/if}}") + if MultiSelection.isActive + .materialCheckBox.multi-selection-checkbox.js-toggle-multi-selection( + class="{{#if MultiSelection.isSelected _id}}is-checked{{/if}}") + +minicard(this) if currentUser.isBoardMember +inlinedForm(autoclose=false position="bottom") +addCardForm(listId=_id position="bottom") diff --git a/client/components/lists/body.js b/client/components/lists/body.js index f2d780af3..a91f0ca96 100644 --- a/client/components/lists/body.js +++ b/client/components/lists/body.js @@ -61,10 +61,39 @@ BlazeComponent.extendComponent({ }); }, + clickOnMiniCard: function(evt) { + if (MultiSelection.isActive() || evt.shiftKey) { + evt.stopImmediatePropagation(); + evt.preventDefault(); + var methodName = evt.shiftKey ? 'toogleRange' : 'toogle'; + MultiSelection[methodName](this.currentData()._id); + + // If the card is already selected, we want to de-select it. + // XXX We should probably modify the minicard href attribute instead of + // overwriting the event in case the card is already selected. + } else if (Session.equals('currentCard', this.currentData()._id)) { + evt.stopImmediatePropagation(); + evt.preventDefault(); + Utils.goBoardId(Session.get('currentBoard')); + } + }, + + cardIsSelected: function() { + return Session.equals('currentCard', this.currentData()._id); + }, + + toggleMultiSelection: function(evt) { + evt.stopPropagation(); + evt.preventDefault(); + MultiSelection.toogle(this.currentData()._id); + }, + events: function() { return [{ - submit: this.addCard, - 'click .open-minicard-composer': this.scrollToBottom + 'click .js-minicard': this.clickOnMiniCard, + 'click .js-toggle-multi-selection': this.toggleMultiSelection, + 'click .open-minicard-composer': this.scrollToBottom, + submit: this.addCard }]; } }).register('listBody'); diff --git a/client/components/sidebar/sidebar.js b/client/components/sidebar/sidebar.js index cfd38c895..7da674764 100644 --- a/client/components/sidebar/sidebar.js +++ b/client/components/sidebar/sidebar.js @@ -4,7 +4,8 @@ var defaultView = 'home'; var viewTitles = { filter: 'filter-cards', - multiselection: 'multi-selection' + multiselection: 'multi-selection', + archives: 'archives' }; BlazeComponent.extendComponent({ diff --git a/client/components/sidebar/sidebar.styl b/client/components/sidebar/sidebar.styl index 57cc85fd9..813e263ad 100644 --- a/client/components/sidebar/sidebar.styl +++ b/client/components/sidebar/sidebar.styl @@ -8,7 +8,7 @@ .sidebar-content padding: 12px - background: white + background: darken(white, 3%) box-shadow: -10px 0px 5px -10px darken(white, 30%) z-index: 10 position: absolute @@ -73,7 +73,7 @@ position: absolute top: 12px z-index: 15 - background: white + background: darken(white, 3%) border-radius: left 3px box-shadow: -4px 0px 7px -4px darken(white, 30%) color: darken(white, 50%) diff --git a/client/components/sidebar/sidebarArchives.jade b/client/components/sidebar/sidebarArchives.jade new file mode 100644 index 000000000..efd70fd41 --- /dev/null +++ b/client/components/sidebar/sidebarArchives.jade @@ -0,0 +1,10 @@ +template(name="archivesSidebar") + each archivedCards + .minicard-wrapper.js-minicard + +minicard(this) + p.quiet + a.js-restore Restore + | - + a.js-delete Delete + else + p.no-items-message No archived cards. diff --git a/client/components/sidebar/sidebarArchives.js b/client/components/sidebar/sidebarArchives.js new file mode 100644 index 000000000..b106f705f --- /dev/null +++ b/client/components/sidebar/sidebarArchives.js @@ -0,0 +1,26 @@ +BlazeComponent.extendComponent({ + template: function() { + return 'archivesSidebar'; + }, + archivedCards: function() { + return Cards.find({archived: true}); + }, + + onRendered: function() { + //XXX We should support dragging a card from the sidebar to the board + }, + + events: function() { + return [{ + 'click .js-restore': function() { + var cardId = this.currentData()._id; + Cards.update(cardId, {$set: {archived: false}}); + }, + 'click .js-delete': Popup.afterConfirm('cardDelete', function() { + var cardId = this._id; + Cards.remove(cardId); + Popup.close(); + }) + }]; + } +}).register('archivesSidebar'); diff --git a/client/lib/popup.js b/client/lib/popup.js index a1f4def28..6193cb13a 100644 --- a/client/lib/popup.js +++ b/client/lib/popup.js @@ -91,7 +91,7 @@ Popup = { var self = this; return function(evt, tpl) { - var context = this; + var context = this.currentData && this.currentData() || this; context.__afterConfirmAction = action; self.open(name).call(context, evt, tpl); }; diff --git a/client/styles/main.styl b/client/styles/main.styl index e6c0eb138..e68498520 100644 --- a/client/styles/main.styl +++ b/client/styles/main.styl @@ -53,6 +53,11 @@ h3, h4, h5, h6 .error, .error a color: #eb3800 +.no-items-message + color: darken(white, 60%) + margin: 30px 0 + text-align: center + .warning background: #f0ecdb border-radius: 3px @@ -72,6 +77,10 @@ a cursor: default text-decoration: none +p + a + text-decoration: underline + table, p margin-bottom: 8px @@ -83,7 +92,7 @@ pre pre, code, tt - font-family: bitstream vera sans mono, andale mono, lucida console, monospace + font-family: lucida console, monospace line-height: 1.25em blockquote diff --git a/i18n/en.i18n.json b/i18n/en.i18n.json index bdefaa0f1..741f67ca2 100644 --- a/i18n/en.i18n.json +++ b/i18n/en.i18n.json @@ -13,6 +13,7 @@ "activity-removed": "removed %s from %s", "activity-attached": "attached %s to %s", "activity-on": "on %s", + "archives": "Archives", "this-board": "this board", "this-card": "this card", "add": "Add", @@ -45,7 +46,8 @@ "card-archived": "This card is archived.", "card-comments-title": "This card has %s comment.", "card-delete-notice": "Deleting is permanent. You will lose all actions associated with this card.", - "card-delete-pop": "All actions will be removed from the activity feed and you won't be able to re-open the card. There is no undo. You can archive a card to remove it from the board and preserve the activity.", + "card-delete-pop": "All actions will be removed from the activity feed and you won't be able to re-open the card. There is no undo.", + "card-delete-suggest-archive": "You can archive a card to remove it from the board and preserve the activity.", "attachment-delete-pop": "Deleting an attachment is permanent. There is no undo.", "change-avatar": "Change Avatar", "change-background": "Change background",