merge email list and message body objects in email dao

This commit is contained in:
Tankred Hase 2013-09-30 17:29:29 +02:00
parent ab5e5a573d
commit 8a40de92ea
3 changed files with 10 additions and 4 deletions

View File

@ -143,7 +143,7 @@ define(function(require) {
};
function createDummyMails(callback) {
var Email = function(unread, attachments, replied) {
var Email = function(unread, attachments, answered) {
this.uid = '1';
this.from = [{
name: 'Whiteout Support',
@ -154,7 +154,7 @@ define(function(require) {
}]; // list of receivers
this.attachments = (attachments) ? [true] : undefined;
this.unread = unread;
this.replied = replied;
this.answered = answered;
this.sentDate = new Date('Thu Sep 19 2013 20:41:23 GMT+0200 (CEST)');
this.subject = "Welcome Max"; // Subject line
this.body = "Hi Max,\n\n" +

View File

@ -484,7 +484,13 @@ define(function(require) {
return;
}
emails.push(message);
// set gotten attributes like body to message object containing list meta data like 'unread' or 'replied'
messageItem.id = message.id;
messageItem.body = message.body;
messageItem.html = message.html;
messageItem.attachments = message.attachments;
emails.push(messageItem);
after();
});
});

View File

@ -4,7 +4,7 @@
</header>
<ul class="mail-list">
<li ng-class="{'mail-list-active': email === selected, 'mail-list-attachment': email.attachments !== undefined && email.attachments.length > 0, 'mail-list-unread': email.unread, 'mail-list-replied': email.replied}" ng-click="select(email)" ng-repeat="email in emails">
<li ng-class="{'mail-list-active': email === selected, 'mail-list-attachment': email.attachments !== undefined && email.attachments.length > 0, 'mail-list-unread': email.unread, 'mail-list-replied': email.answered}" ng-click="select(email)" ng-repeat="email in emails">
<h3>{{email.from[0].name || email.from[0].address}}</h3>
<div class="head">
<p class="subject">{{email.subject}}</p>