]> source.dussan.org Git - nextcloud-server.git/commitdiff
Improve comment date format
authorVincent Petry <pvince81@owncloud.com>
Thu, 28 Jan 2016 10:47:23 +0000 (11:47 +0100)
committerVincent Petry <pvince81@owncloud.com>
Tue, 2 Feb 2016 17:01:15 +0000 (18:01 +0100)
apps/comments/js/commentstabview.js

index cccb400dd68372d07a831f405459e829f925f391..b1a3f854fe13338bfbb009d43919e731a947f7d9 100644 (file)
@@ -30,7 +30,7 @@
                '   <hr />' +
                '   <div class="authorRow">' +
                '      <span class="author"><em>{{actorDisplayName}}</em></span>' +
-               '      <span class="date">{{creationDateTime}}</span>' +
+               '      <span class="date has-tooltip" title="{{altDate}}">{{date}}</span>' +
                '   </div>' +
                '   <div class="message">{{message}}</div>' +
                '</li>';
                },
 
                _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
-                       return commentModel.attributes;
+                       return data;
                },
 
                _toggleLoading: function(state) {
                        } else {
                                this.$container.append($el);
                        }
+                       $el.find('.has-tooltip').tooltip();
                },
 
                nextPage: function() {
                                actorDisplayName: OC.currentUser,
                                actorType: 'users',
                                verb: 'comment',
-                               message: $textArea.val()
+                               message: $textArea.val(),
+                               creationDateTime: (new Date()).getTime()
                        }, {at: 0});
 
                        // TODO: spinner/disable field?