1
0
mirror of https://github.com/moparisthebest/mail synced 2024-11-14 05:05:10 -05:00
mail/src/js/view/read-view.js

35 lines
825 B
JavaScript

(function() {
'use strict';
app.view.ReadView = Backbone.View.extend({
initialize: function(args) {
this.template = _.template(app.util.tpl.get('read'));
this.model = args.dao.getItem(args.folder, args.messageId);
},
render: function(eventName) {
$(this.el).html(this.template(this.model.toJSON()));
return this;
},
renderBody: function() {
var emailBody = this.model.get('body'),
iframe = $('#idMailContent'),
iframeDoc = iframe[0].contentDocument || iframe[0].contentWindow.document;
iframe.load(function() {
// resize
var newheight = iframeDoc.body.scrollHeight;
var newwidth = iframeDoc.body.scrollWidth;
iframe[0].height = (newheight) + 'px';
iframe[0].width = (newwidth) + 'px';
});
iframeDoc.write(emailBody);
iframeDoc.close();
}
});
}());