diff options
author | NavaL <ayoyo@thoughtworks.com> | 2016-02-09 13:41:21 +0100 |
---|---|---|
committer | NavaL <ayoyo@thoughtworks.com> | 2016-02-09 13:41:57 +0100 |
commit | b7943d436702c2bf6551ccceded94eff8638eae1 (patch) | |
tree | 2e58367cda46bf90b34a9cda4e2526c641227384 /haha.diff | |
parent | 1716d0f65d42451d7fe5fe761703e7c733533733 (diff) |
adding OSX setup
Issue #593
Diffstat (limited to 'haha.diff')
-rw-r--r-- | haha.diff | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/haha.diff b/haha.diff deleted file mode 100644 index b4a59fc2..00000000 --- a/haha.diff +++ /dev/null @@ -1,93 +0,0 @@ -diff --git a/web-ui/app/js/mail_view/data/attachment_list.js b/web-ui/app/js/mail_view/data/attachment_list.js -index af48b05..0815cdf 100644 ---- a/web-ui/app/js/mail_view/data/attachment_list.js -+++ b/web-ui/app/js/mail_view/data/attachment_list.js -@@ -30,6 +30,7 @@ define( - - this.addAttachment = function (event, data) { - this.attr.attachments.push(data); -+ console.log(this.attr.attachments); - }; - - this.after('initialize', function () { -diff --git a/web-ui/app/js/mail_view/ui/attachment.js b/web-ui/app/js/mail_view/ui/attachment.js -index f57fea5..529bc97 100644 ---- a/web-ui/app/js/mail_view/ui/attachment.js -+++ b/web-ui/app/js/mail_view/ui/attachment.js -@@ -19,14 +19,15 @@ define( - [ - 'flight/lib/component', - 'page/events', -- 'features' -+ 'features', -+ 'helpers/monitored_ajax' - ], - -- function (defineComponent, events, features) { -+ function (defineComponent, events, features, monitoredAjax) { - 'use strict'; - - return defineComponent(function () { -- this.render = function () { -+ this.renderButton = function () { - this.$node.html('<i class="fa fa-paperclip fa-2x"></i>'); - }; - -@@ -52,14 +53,34 @@ define( - }); - } - -+ this.updateAttachmentList = function(data){ -+ $('#files').html('<span>' + data.filename + ' (' + humanReadable(data.filesize) + ')' + '</span>'); -+ console.log(data); -+ this.trigger(document, events.mail.uploadedAttachment, data); -+ }.bind(this); -+ - this.upload = function () { -- addJqueryFileUploadConfig(this); -- $('#fileupload').click(); -+ var $fileUploadInput = $('#fileupload'); -+ $fileUploadInput.click(); -+ $fileUploadInput.on('change', this.uploadAttachment); - }; - -+ this.uploadAttachment = function () { -+ var data = new FormData(), -+ attachment = $('#fileupload')[0].files[0]; -+ -+ data.append('attachment', attachment); -+ monitoredAjax(this, '/attachment', { -+ type: 'POST', -+ contentType: false, -+ processData: false, -+ data: data -+ }).done(this.updateAttachmentList); -+ }.bind(this); -+ - this.after('initialize', function () { - if (features.isEnabled('attachment')) { -- this.render(); -+ this.renderButton(); - } - this.on(this.$node, 'click', this.upload); - }); -diff --git a/web-ui/test/spec/mail_view/ui/attachment.spec.js b/web-ui/test/spec/mail_view/ui/attachment.spec.js -index bbea2f5..bfd9626 100644 ---- a/web-ui/test/spec/mail_view/ui/attachment.spec.js -+++ b/web-ui/test/spec/mail_view/ui/attachment.spec.js -@@ -11,11 +11,12 @@ describeComponent('mail_view/ui/attachment', function () { - expect(this.$node.html()).toMatch('<i class="fa fa-paperclip fa-2x"></i>'); - }); - -- xit('uploads attachment on click', function () { -- var fileUploads = spyOn($, 'fileupload'); -+ iit('uploads attachment on click', function () { -+ var ajax = spyOn(this.component, 'monitoredAjax'); - this.$node.click(); -- expect(fileUploads).toHaveBeenCalled(); -+ expect(ajax).toHaveBeenCalled(); - }); - -+ - }); - }); |