summaryrefslogtreecommitdiff
path: root/web-ui/app/js/mail_view/ui/mail_view.js
diff options
context:
space:
mode:
authorCaio Carrara <ccarrara@thoughtworks.com>2016-03-29 18:09:03 -0300
committerCaio Carrara <ccarrara@thoughtworks.com>2016-03-29 18:09:03 -0300
commitb512200aef602afba340321a2ae89fa9293dde73 (patch)
tree62cf0e354188b657021739f4f28f00f771d86a58 /web-ui/app/js/mail_view/ui/mail_view.js
parent646f3647f131570b15c70e59ee70633545ef4f73 (diff)
Issue #622 - hide reply buttons
It changes the trigger of event which show the reply container to after the iframe received the message with email body.
Diffstat (limited to 'web-ui/app/js/mail_view/ui/mail_view.js')
-rw-r--r--web-ui/app/js/mail_view/ui/mail_view.js54
1 files changed, 4 insertions, 50 deletions
diff --git a/web-ui/app/js/mail_view/ui/mail_view.js b/web-ui/app/js/mail_view/ui/mail_view.js
index 6f21b96c..6f57236e 100644
--- a/web-ui/app/js/mail_view/ui/mail_view.js
+++ b/web-ui/app/js/mail_view/ui/mail_view.js
@@ -23,14 +23,15 @@ define(
'helpers/view_helper',
'mixins/with_hide_and_show',
'mixins/with_mail_tagging',
+ 'mixins/with_mail_sandbox',
'page/events',
'views/i18n'
],
- function (defineComponent, templates, mailActions, viewHelpers, withHideAndShow, withMailTagging, events, i18n) {
+ function (defineComponent, templates, mailActions, viewHelpers, withHideAndShow, withMailTagging, withMailSandbox, events, i18n) {
'use strict';
- return defineComponent(mailView, mailActions, withHideAndShow, withMailTagging);
+ return defineComponent(mailView, mailActions, withHideAndShow, withMailTagging, withMailSandbox);
function mailView() {
this.defaultAttrs({
@@ -71,54 +72,7 @@ define(
attachments: attachments
}));
- var $iframe = $("#read-sandbox");
- var iframe = $iframe[0];
-
- var content = viewHelpers.formatMailBody(data.mail);
-
- iframe.onload = function() {
- // use iframe-resizer to dynamically adapt iframe size to its content
- var config = {
- resizedCallback: scaleToFit,
- checkOrigin: false
- };
- $iframe.iFrameResize(config);
-
- // transform scale iframe to fit container width
- // necessary if iframe is wider than container
- function scaleToFit() {
- var parentWidth = $iframe.parent().width();
- var w = $iframe.width();
- var scale = 'none';
-
- // only scale html mails
- var mail = data.mail;
- if (mail && mail.htmlBody && (w > parentWidth)) {
- scale = parentWidth / w;
- scale = 'scale(' + scale + ',' + scale + ')';
- }
-
- $iframe.css({
- '-webkit-transform-origin': '0 0',
- '-moz-transform-origin': '0 0',
- '-ms-transform-origin': '0 0',
- 'transform-origin': '0 0',
- '-webkit-transform': scale,
- '-moz-transform': scale,
- '-ms-transform': scale,
- 'transform': scale
- });
- }
-
- iframe.contentWindow.postMessage({
- html: content
- }, '*');
- };
-
-
-
- this.trigger(document, events.search.highlightResults, {where: '.mail-read-view__header'});
- this.trigger(document, events.ui.replyBox.showReplyContainer);
+ this.showMailOnSandbox(this.attr.mail);
this.attachTagCompletion(this.attr.mail);