|
|
|
@ -76,6 +76,12 @@
|
|
|
|
|
this.render();
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
renderContact: function(contact) {
|
|
|
|
|
var v = new ContactView({
|
|
|
|
|
model: contact,
|
|
|
|
|
conflict: this.model.getKeyConflict(contact.id)
|
|
|
|
|
}).render().$el.appendTo(this.$('.contacts'));
|
|
|
|
|
},
|
|
|
|
|
render: function() {
|
|
|
|
|
this.$el.html(Mustache.render(this.template, {
|
|
|
|
|
sent_at : moment(this.model.get('sent_at')).toString(),
|
|
|
|
@ -85,19 +91,11 @@
|
|
|
|
|
this.view.render().$el.prependTo(this.$('.message-container'));
|
|
|
|
|
|
|
|
|
|
if (this.model.isOutgoing()) {
|
|
|
|
|
this.conversation.contactCollection.each(function(contact) {
|
|
|
|
|
var v = new ContactView({
|
|
|
|
|
model: contact,
|
|
|
|
|
conflict: this.model.getKeyConflict(contact.id)
|
|
|
|
|
}).render().$el.appendTo(this.$('.contacts'));
|
|
|
|
|
}.bind(this));
|
|
|
|
|
this.conversation.contactCollection.each(this.renderContact.bind(this));
|
|
|
|
|
} else {
|
|
|
|
|
var number = this.model.get('source');
|
|
|
|
|
var contact = this.conversation.contactCollection.get(number);
|
|
|
|
|
var v = new ContactView({
|
|
|
|
|
model: contact,
|
|
|
|
|
conflict: this.model.getKeyConflict(number)
|
|
|
|
|
}).render().$el.appendTo(this.$('.contacts'));
|
|
|
|
|
this.renderContact(
|
|
|
|
|
this.conversation.contactCollection.get(this.model.get('source'))
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|