mirror of
https://github.com/moparisthebest/mail
synced 2025-02-07 02:20:14 -05:00
implemented get Email post message
This commit is contained in:
parent
da3dc17cb4
commit
3e7af24697
@ -21,12 +21,17 @@
|
||||
},
|
||||
|
||||
compose: function(userId, folder, messageId) {
|
||||
var composeView = new app.view.ComposeView({
|
||||
var self = this,
|
||||
composeView;
|
||||
|
||||
composeView = new app.view.ComposeView({
|
||||
account: userId,
|
||||
folder: folder,
|
||||
messageId: (messageId) ? decodeURIComponent(messageId) : null
|
||||
messageId: (messageId) ? decodeURIComponent(messageId) : null,
|
||||
callback: function(view) {
|
||||
self.changePage(view);
|
||||
}
|
||||
});
|
||||
this.changePage(composeView);
|
||||
},
|
||||
|
||||
folders: function(userId) {
|
||||
|
@ -4,13 +4,31 @@
|
||||
app.view.ComposeView = Backbone.View.extend({
|
||||
|
||||
initialize: function(args) {
|
||||
var self = this;
|
||||
|
||||
this.template = _.template(app.util.tpl.get('compose'));
|
||||
this.account = args.account;
|
||||
this.folder = args.folder;
|
||||
|
||||
if (args.folder && args.messageId) {
|
||||
// fetch reply-to email model
|
||||
this.replyTo = args.dao.getItem(args.folder, args.messageId);
|
||||
// post message to main window
|
||||
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.replyTo = resArgs.email;
|
||||
args.callback(self);
|
||||
});
|
||||
|
||||
} else {
|
||||
args.callback(self);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -117,6 +117,14 @@
|
||||
});
|
||||
});
|
||||
|
||||
} else if (cmd === 'getEmail') {
|
||||
// list emails from folder
|
||||
var mail = emailDao.getItem(args.folder, args.messageId);
|
||||
callback({
|
||||
err: null,
|
||||
email: mail.toJSON()
|
||||
});
|
||||
|
||||
} else if (cmd === 'sendEmail') {
|
||||
// list emails from folder
|
||||
sendEmail(args.email, function(err) {
|
||||
|
Loading…
Reference in New Issue
Block a user