mirror of
https://github.com/moparisthebest/mail
synced 2024-11-22 08:52:15 -05:00
read and reply work
This commit is contained in:
parent
3e7af24697
commit
e2e5f11c8e
@ -52,12 +52,18 @@
|
||||
},
|
||||
|
||||
read: function(userId, folder, messageId) {
|
||||
var readView = new app.view.ReadView({
|
||||
var self = this,
|
||||
readView;
|
||||
|
||||
readView = new app.view.ReadView({
|
||||
account: userId,
|
||||
folder: folder,
|
||||
messageId: decodeURIComponent(messageId)
|
||||
messageId: decodeURIComponent(messageId),
|
||||
callback: function(view) {
|
||||
self.changePage(view);
|
||||
view.renderBody(true);
|
||||
}
|
||||
});
|
||||
this.changePage(readView);
|
||||
readView.renderBody(true);
|
||||
},
|
||||
|
||||
changePage: function(page) {
|
||||
|
@ -23,7 +23,7 @@
|
||||
return;
|
||||
}
|
||||
// set mail to reply to
|
||||
self.replyTo = resArgs.email;
|
||||
self.replyTo = new app.model.Email(resArgs.email);
|
||||
args.callback(self);
|
||||
});
|
||||
|
||||
|
@ -4,14 +4,31 @@
|
||||
app.view.ReadView = Backbone.View.extend({
|
||||
|
||||
initialize: function(args) {
|
||||
var self = this;
|
||||
|
||||
this.template = _.template(app.util.tpl.get('read'));
|
||||
this.model = args.dao.getItem(args.folder, args.messageId);
|
||||
this.account = args.account;
|
||||
this.folder = args.folder;
|
||||
|
||||
app.util.postMessage('getEmail', {
|
||||
folder: args.folder,
|
||||
messageId: args.messageId
|
||||
}, function(resArgs) {
|
||||
var err = resArgs.err;
|
||||
if (err) {
|
||||
window.alert(JSON.stringify(err));
|
||||
return;
|
||||
}
|
||||
// set mail to reply to
|
||||
self.model = new app.model.Email(resArgs.email);
|
||||
args.callback(self);
|
||||
});
|
||||
},
|
||||
|
||||
render: function(eventName) {
|
||||
render: function() {
|
||||
var params = this.model.toJSON();
|
||||
params.account = this.options.dao.account.get('emailAddress');
|
||||
params.folder = this.options.folder;
|
||||
params.account = this.account;
|
||||
params.folder = this.folder;
|
||||
params.id = encodeURIComponent(params.id);
|
||||
|
||||
$(this.el).html(this.template(params));
|
||||
|
@ -1,5 +1,5 @@
|
||||
<div data-role="header" data-position="fixed">
|
||||
<input type="button" id="backBtn" data-icon="arrow-l" value="Back" class="ui-btn-left">
|
||||
<a href="#accounts/<%- account %>/folders/<%- folder %>" data-role="button" data-icon="arrow-l" data-iconpos="left" class="ui-btn-left">Back</a>
|
||||
<h1><%- subject %></h1>
|
||||
<a href="#accounts/<%- account %>/folders/<%- folder %>/reply/<%- id %>" data-role="button" data-icon="back" data-iconpos="right" class="ui-btn-right">Reply</a>
|
||||
</div><!-- /header -->
|
||||
|
Loading…
Reference in New Issue
Block a user