diff options
-rw-r--r-- | client/components/cards/cardDetails.jade | 4 | ||||
-rw-r--r-- | client/components/cards/cardDetails.js | 3 | ||||
-rw-r--r-- | client/components/cards/minicard.jade | 10 | ||||
-rw-r--r-- | client/components/cards/minicard.js | 9 | ||||
-rw-r--r-- | client/components/lists/listBody.js | 6 | ||||
-rw-r--r-- | models/cards.js | 33 | ||||
-rw-r--r-- | server/publications/boards.js | 4 |
7 files changed, 50 insertions, 19 deletions
diff --git a/client/components/cards/cardDetails.jade b/client/components/cards/cardDetails.jade index 34dbc117..3d0bfb98 100644 --- a/client/components/cards/cardDetails.jade +++ b/client/components/cards/cardDetails.jade @@ -109,10 +109,10 @@ template(name="cardDetails") a.js-open-inlined-form {{_ 'view-it'}} = ' - ' a.js-close-inlined-form {{_ 'discard'}} - else if description + else if getDescription h3.card-details-item-title {{_ 'description'}} +viewer - = description + = getDescription .card-details-items .card-details-item.card-details-item-name diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index b41bfc17..181fea1b 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -43,7 +43,8 @@ BlazeComponent.extendComponent({ }, canModifyCard() { - return Meteor.user() && Meteor.user().isBoardMember() && !Meteor.user().isCommentOnly(); + return Meteor.user() && Meteor.user().isBoardMember() && + !Meteor.user().isCommentOnly() && !this.currentData().isImported(); }, scrollParentContainer() { diff --git a/client/components/cards/minicard.jade b/client/components/cards/minicard.jade index 95fa6e31..7e2999d3 100644 --- a/client/components/cards/minicard.jade +++ b/client/components/cards/minicard.jade @@ -1,7 +1,7 @@ template(name="minicard") .minicard( - class="{{#if importedCard}}imported-card{{/if}}" - class="{{#if importedBoard}}imported-board{{/if}}") + class="{{#if isImportedCard}}imported-card{{/if}}" + class="{{#if isImportedBoard}}imported-board{{/if}}") if cover .minicard-cover(style="background-image: url('{{cover.url}}');") if labels @@ -15,7 +15,7 @@ template(name="minicard") if $eq 'prefix-with-parent' currentBoard.presentParentTask .parent-prefix | {{ parentCardName }} - if imported + if isImported span.imported-icon.fa.fa-share-alt +viewer | {{ title }} @@ -67,8 +67,8 @@ template(name="minicard") .badge(title="{{_ 'card-comments-title' comments.count }}") span.badge-icon.fa.fa-comment-o.badge-comment span.badge-text= comments.count - if description - .badge.badge-state-image-only(title=description) + if getDescription + .badge.badge-state-image-only(title=getDescription) span.badge-icon.fa.fa-align-left if attachments.count .badge diff --git a/client/components/cards/minicard.js b/client/components/cards/minicard.js index 5202232b..a98b5730 100644 --- a/client/components/cards/minicard.js +++ b/client/components/cards/minicard.js @@ -6,13 +6,4 @@ BlazeComponent.extendComponent({ template() { return 'minicard'; }, - importedCard() { - return this.currentData().type === 'cardType-importedCard'; - }, - importedBoard() { - return this.currentData().type === 'cardType-importedBoard'; - }, - imported() { - return this.importedCard() || this.importedBoard(); - }, }).register('minicard'); diff --git a/client/components/lists/listBody.js b/client/components/lists/listBody.js index 39614108..2c8b1af7 100644 --- a/client/components/lists/listBody.js +++ b/client/components/lists/listBody.js @@ -281,6 +281,8 @@ BlazeComponent.extendComponent({ archived: false, 'members.userId': Meteor.userId(), _id: {$ne: Session.get('currentBoard')}, + }, { + sort: ['title'], })._id; // Subscribe to this board subManager.subscribe('board', boardId); @@ -370,6 +372,7 @@ BlazeComponent.extendComponent({ //IMPORT BOARD evt.stopPropagation(); evt.preventDefault(); + const impBoardId = $('.js-select-boards option:selected').val(); const _id = Cards.insert({ title: $('.js-select-boards option:selected').text(), //dummy listId: this.listId, @@ -377,7 +380,8 @@ BlazeComponent.extendComponent({ boardId: this.boardId, sort: Lists.findOne(this.listId).cards().count(), type: 'cardType-importedBoard', - importedId: $('.js-select-boards option:selected').val(), + importedId: impBoardId, + description: Boards.findOne({_id: impBoardId}).description, }); Filter.addException(_id); Popup.close(); diff --git a/models/cards.js b/models/cards.js index af8bea48..4b18b8f3 100644 --- a/models/cards.js +++ b/models/cards.js @@ -393,6 +393,39 @@ Cards.helpers({ isTopLevel() { return this.parentId === ''; }, + + isImportedCard() { + return this.type === 'cardType-importedCard'; + }, + + isImportedBoard() { + return this.type === 'cardType-importedBoard'; + }, + + isImported() { + return this.isImportedCard() || this.isImportedBoard(); + }, + + getDescription() { + if (this.isImportedCard()) { + const card = Cards.findOne({_id: this.importedId}); + if (card && card.description) + return card.description; + else + return null; + } else if (this.isImportedBoard()) { + const board = Boards.findOne({_id: this.importedId}); + if (board && board.description) + return board.description; + else + return null; + } else { + if (this.description) + return this.description; + else + return null; + } + }, }); Cards.mutations({ diff --git a/server/publications/boards.js b/server/publications/boards.js index 5d095c17..bf75196a 100644 --- a/server/publications/boards.js +++ b/server/publications/boards.js @@ -98,7 +98,9 @@ Meteor.publishRelations('board', function(boardId) { // // And in the meantime our code below works pretty well -- it's not even a // hack! - this.cursor(Cards.find({ boardId }), function(cardId) { + this.cursor(Cards.find({ boardId }), function(cardId, card) { + this.cursor(Cards.find({_id: card.importedId})); + this.cursor(Boards.find({_id: card.importedId})); this.cursor(CardComments.find({ cardId })); this.cursor(Attachments.find({ cardId })); this.cursor(Checklists.find({ cardId })); |