Update message bubble timestamps as needed
Display format consistent with Android: * relative time for everything from today * Day of week + time for within the past 7 days * Static Month Day time for everything older Each timestamp will only update as often as needed to stay accurate, which is once a minute, once an hour, once a week, or never. // FREEBIE
This commit is contained in:
parent
ddd2e67eb5
commit
2ce890b845
3 changed files with 59 additions and 2 deletions
|
@ -17,6 +17,7 @@
|
|||
this.listenTo(this.model, 'destroy', this.remove);
|
||||
this.listenTo(this.model, 'pending', this.renderPending);
|
||||
this.listenTo(this.model, 'done', this.renderDone);
|
||||
this.timeStampView = new Whisper.MessageTimestampView();
|
||||
},
|
||||
events: {
|
||||
'click .timestamp': 'select',
|
||||
|
@ -67,11 +68,13 @@
|
|||
this.$el.html(
|
||||
Mustache.render(this.template, {
|
||||
message: this.model.get('body'),
|
||||
timestamp: moment(this.model.get('sent_at')).fromNow(),
|
||||
timestamp: this.model.get('sent_at'),
|
||||
sender: (contact && contact.getTitle()) || '',
|
||||
avatar: (contact && contact.getAvatar())
|
||||
}, this.render_partials())
|
||||
);
|
||||
this.timeStampView.setElement(this.$('.timestamp'));
|
||||
this.timeStampView.update();
|
||||
|
||||
this.renderControl();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue