Improve comment date format

This commit is contained in:
Vincent Petry 2016-01-28 11:47:23 +01:00
parent cca33942aa
commit d1518045ec
1 changed files with 10 additions and 3 deletions

View File

@ -30,7 +30,7 @@
' <hr />' + ' <hr />' +
' <div class="authorRow">' + ' <div class="authorRow">' +
' <span class="author"><em>{{actorDisplayName}}</em></span>' + ' <span class="author"><em>{{actorDisplayName}}</em></span>' +
' <span class="date">{{creationDateTime}}</span>' + ' <span class="date has-tooltip" title="{{altDate}}">{{date}}</span>' +
' </div>' + ' </div>' +
' <div class="message">{{message}}</div>' + ' <div class="message">{{message}}</div>' +
'</li>'; '</li>';
@ -101,8 +101,13 @@
}, },
_formatItem: function(commentModel) { _formatItem: function(commentModel) {
var timestamp = new Date(commentModel.get('creationDateTime')).getTime();
var data = _.extend({
date: OC.Util.relativeModifiedDate(timestamp),
altDate: OC.Util.formatDate(timestamp)
}, commentModel.attributes);
// TODO: format // TODO: format
return commentModel.attributes; return data;
}, },
_toggleLoading: function(state) { _toggleLoading: function(state) {
@ -128,6 +133,7 @@
} else { } else {
this.$container.append($el); this.$container.append($el);
} }
$el.find('.has-tooltip').tooltip();
}, },
nextPage: function() { nextPage: function() {
@ -152,7 +158,8 @@
actorDisplayName: OC.currentUser, actorDisplayName: OC.currentUser,
actorType: 'users', actorType: 'users',
verb: 'comment', verb: 'comment',
message: $textArea.val() message: $textArea.val(),
creationDateTime: (new Date()).getTime()
}, {at: 0}); }, {at: 0});
// TODO: spinner/disable field? // TODO: spinner/disable field?