summaryrefslogtreecommitdiffstats
path: root/client/components/cards/attachments.js
diff options
context:
space:
mode:
authorMaxime Quandalle <maxime@quandalle.com>2015-06-13 15:04:55 +0200
committerMaxime Quandalle <maxime@quandalle.com>2015-06-13 15:04:55 +0200
commite001c3409a3911089adddad7bbd0e350aa152cb8 (patch)
tree499484bf1e5a64129440190ebeca72ff33a8dcbd /client/components/cards/attachments.js
parentc8945679872a0708eb67a477a99a65d508c84cb0 (diff)
downloadwekan-e001c3409a3911089adddad7bbd0e350aa152cb8.tar.gz
wekan-e001c3409a3911089adddad7bbd0e350aa152cb8.tar.bz2
wekan-e001c3409a3911089adddad7bbd0e350aa152cb8.zip
Fix card attachments
Closes #192.
Diffstat (limited to 'client/components/cards/attachments.js')
-rw-r--r--client/components/cards/attachments.js38
1 files changed, 38 insertions, 0 deletions
diff --git a/client/components/cards/attachments.js b/client/components/cards/attachments.js
new file mode 100644
index 00000000..db0ecb8e
--- /dev/null
+++ b/client/components/cards/attachments.js
@@ -0,0 +1,38 @@
+Template.attachmentsGalery.events({
+ 'click .js-add-attachment': Popup.open('cardAttachments'),
+ 'click .js-confirm-delete': Popup.afterConfirm('attachmentDelete',
+ function() {
+ Attachments.remove(this._id);
+ Popup.close();
+ }
+ ),
+ // If we let this event bubble, Iron-Router will handle it and empty the
+ // page content, see #101.
+ 'click .js-open-viewer, click .js-download': function(event) {
+ event.stopPropagation();
+ },
+ 'click .js-add-cover': function() {
+ Cards.update(this.cardId, { $set: { coverId: this._id } });
+ },
+ 'click .js-remove-cover': function() {
+ Cards.update(this.cardId, { $unset: { coverId: '' } });
+ }
+});
+
+Template.cardAttachmentsPopup.events({
+ 'change .js-attach-file': function(evt) {
+ var card = this;
+ FS.Utility.eachFile(evt, function(f) {
+ var file = new FS.File(f);
+ file.boardId = card.boardId;
+ file.cardId = card._id;
+
+ Attachments.insert(file);
+ Popup.close();
+ });
+ },
+ 'click .js-computer-upload': function(evt, tpl) {
+ tpl.find('.js-attach-file').click();
+ evt.preventDefault();
+ }
+});