diff --git a/client/components/activities/activities.js b/client/components/activities/activities.js index 5d95006ac..6d796199b 100644 --- a/client/components/activities/activities.js +++ b/client/components/activities/activities.js @@ -49,6 +49,10 @@ BlazeComponent.extendComponent({ return TAPi18n.__('this-board'); }, + cardLabel: function() { + return TAPi18n.__('this-card'); + }, + cardLink: function() { var card = this.currentData().card(); return Blaze.toHTML(HTML.A({ @@ -69,16 +73,6 @@ BlazeComponent.extendComponent({ href: attachment.url(), 'class': 'js-open-attachment-viewer' }, attachment.name())); - } -}).register('activities'); - -BlazeComponent.extendComponent({ - template: function() { - return 'cardActivities'; - }, - - cardLabel: function() { - return TAPi18n.__('this-card'); }, events: function() { @@ -102,4 +96,4 @@ BlazeComponent.extendComponent({ } }]; } -}).register('cardActivities'); +}).register('activities'); diff --git a/client/components/cards/attachments.jade b/client/components/cards/attachments.jade new file mode 100644 index 000000000..4170d195b --- /dev/null +++ b/client/components/cards/attachments.jade @@ -0,0 +1,40 @@ +template(name="cardAttachmentsPopup") + ul.pop-over-list + li + input.js-attach-file.hide(type="file" name="file" multiple) + a.js-computer-upload {{_ 'computer'}} + +template(name="attachmentDeletePopup") + p {{_ "attachment-delete-pop"}} + button.js-confirm.negate.full(type="submit") {{_ 'delete'}} + +template(name="attachmentsGalery") + .attachments-galery + each attachments + a.attachment-item.js-open-viewer(title="{{_ 'added'}} {{ moment uploadedAt }}") + .attachment-thumbnail + if isUploaded + if isImage + img.attachment-thumbnail-img(src=url) + else + span.attachment-thumbnail-ext= extension + else + +spinner + p.attachment-details + = name + span.attachment-details-actions + a.js-download + i.fa.fa-download + | {{_ 'download'}} + if isImage + a(class="{{#if $eq ../coverId _id}}js-remove-cover{{else}}js-add-cover{{/if}}") + i.fa.fa-thumb-tack + if($eq ../coverId _id) + | {{_ 'remove-cover'}} + else + | {{_ 'add-cover'}} + a.js-confirm-delete + i.fa.fa-close + | {{_ 'delete'}} + + a.attachment-item.add-attachment.js-add-attachment {{_ 'add-attachment' }} diff --git a/client/components/cards/events.js b/client/components/cards/attachments.js similarity index 78% rename from client/components/cards/events.js rename to client/components/cards/attachments.js index ca2ddb505..db0ecb8ed 100644 --- a/client/components/cards/events.js +++ b/client/components/cards/attachments.js @@ -1,5 +1,5 @@ -Template.WindowAttachmentsModule.events({ - 'click .js-attach': Popup.open('cardAttachments'), +Template.attachmentsGalery.events({ + 'click .js-add-attachment': Popup.open('cardAttachments'), 'click .js-confirm-delete': Popup.afterConfirm('attachmentDelete', function() { Attachments.remove(this._id); @@ -21,22 +21,18 @@ Template.WindowAttachmentsModule.events({ Template.cardAttachmentsPopup.events({ 'change .js-attach-file': function(evt) { - var card = this.card; + var card = this; FS.Utility.eachFile(evt, function(f) { var file = new FS.File(f); - - // set Ids file.boardId = card.boardId; file.cardId = card._id; - // upload file Attachments.insert(file); - Popup.close(); }); }, - 'click .js-computer-upload': function(evt, t) { - t.find('.js-attach-file').click(); + 'click .js-computer-upload': function(evt, tpl) { + tpl.find('.js-attach-file').click(); evt.preventDefault(); } }); diff --git a/client/components/cards/attachments.styl b/client/components/cards/attachments.styl new file mode 100644 index 000000000..5cdf7386f --- /dev/null +++ b/client/components/cards/attachments.styl @@ -0,0 +1,47 @@ +.attachments-galery + display: flex + flex-wrap: wrap + + .attachment-item + width: 33.33% - 2% + margin: 10px 1% 0 + text-align: center + border-radius: 3px + overflow: hidden + background: darken(white, 7%) + min-height: 120px + + &:hover + background: darken(white, 12%) + + &.add-attachment + display: flex + align-items: center + + .attachment-thumbnail + height: 80px + display: flex + align-items: center + justify-content: center + position: relative + + .attachment-thumbnail-img + height: 100% + width: 100% + + .attachment-thumbnail-ext + text-transform: uppercase + font-size: 1.6em + + .attachment-details + font-size: 0.75em + margin: 3px + + .attachment-details-actions + display: block + +.attachment-image-preview + max-width: 100px + display: block + box-shadow: 0 1px 2px rgba(0,0,0,.2) + diff --git a/client/components/cards/details.jade b/client/components/cards/details.jade index 1eeda71d0..f8e99d77a 100644 --- a/client/components/cards/details.jade +++ b/client/components/cards/details.jade @@ -61,7 +61,11 @@ template(name="cardDetails") = description if attachments.count hr - +WindowAttachmentsModule(card=this) + h2 + i.fa.fa-paperclip + | {{_ 'attachments'}} + + +attachmentsGalery hr h2 {{ _ 'activity'}} diff --git a/client/components/cards/templates.html b/client/components/cards/templates.html deleted file mode 100644 index f61c3df58..000000000 --- a/client/components/cards/templates.html +++ /dev/null @@ -1,197 +0,0 @@ - - - - - - - - -