diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2016-09-01 14:13:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-01 14:13:23 +0200 |
commit | ca7b60ba816e198202d1fb61e576013888636737 (patch) | |
tree | df93d0ebd24ff1b51721784a2892b589de430778 /apps | |
parent | 8325c4443b64d10abc79f9b12ace093f69e8d4ce (diff) | |
parent | 80e8d3db35e22f4e0c3adff79b426e472c203df0 (diff) | |
download | nextcloud-server-ca7b60ba816e198202d1fb61e576013888636737.tar.gz nextcloud-server-ca7b60ba816e198202d1fb61e576013888636737.zip |
Merge pull request #1215 from nextcloud/issue-1083-update-live-relative-timestamps
Update relative timestamps for a better "live" feeling
Diffstat (limited to 'apps')
-rw-r--r-- | apps/comments/js/commentstabview.js | 3 | ||||
-rw-r--r-- | apps/files/js/filelist.js | 3 | ||||
-rw-r--r-- | apps/files/js/mainfileinfodetailview.js | 3 | ||||
-rw-r--r-- | apps/files_versions/js/versionstabview.js | 3 |
4 files changed, 8 insertions, 4 deletions
diff --git a/apps/comments/js/commentstabview.js b/apps/comments/js/commentstabview.js index eae18c1d485..82244d61e9a 100644 --- a/apps/comments/js/commentstabview.js +++ b/apps/comments/js/commentstabview.js @@ -51,7 +51,7 @@ '{{#if isUserAuthor}}' + ' <a href="#" class="action edit icon icon-rename has-tooltip" title="{{editTooltip}}"></a>' + '{{/if}}' + - ' <div class="date has-tooltip" title="{{altDate}}">{{date}}</div>' + + ' <div class="date has-tooltip live-relative-timestamp" data-timestamp="{{timestamp}}" title="{{altDate}}">{{date}}</div>' + ' </div>' + ' <div class="message">{{{formattedMessage}}}</div>' + '{{#if isLong}}' + @@ -179,6 +179,7 @@ _formatItem: function(commentModel) { var timestamp = new Date(commentModel.get('creationDateTime')).getTime(); var data = _.extend({ + timestamp: timestamp, date: OC.Util.relativeModifiedDate(timestamp), altDate: OC.Util.formatDate(timestamp), formattedMessage: this._formatMessage(commentModel.get('message')) diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index cfaeca1a06b..26c6b34d098 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -1202,8 +1202,9 @@ } td = $('<td></td>').attr({ "class": "date" }); td.append($('<span></span>').attr({ - "class": "modified", + "class": "modified live-relative-timestamp", "title": formatted, + "data-timestamp": mtime, "style": 'color:rgb('+modifiedColor+','+modifiedColor+','+modifiedColor+')' }).text(text) .tooltip({placement: 'top'}) diff --git a/apps/files/js/mainfileinfodetailview.js b/apps/files/js/mainfileinfodetailview.js index 30b2b531df7..20cedcf4e82 100644 --- a/apps/files/js/mainfileinfodetailview.js +++ b/apps/files/js/mainfileinfodetailview.js @@ -24,7 +24,7 @@ ' class="action action-favorite favorite">' + ' <img class="svg" alt="{{starAltText}}" src="{{starIcon}}" />' + ' </a>' + - ' {{#if hasSize}}<span class="size" title="{{altSize}}">{{size}}</span>, {{/if}}<span class="date" title="{{altDate}}">{{date}}</span>' + + ' {{#if hasSize}}<span class="size" title="{{altSize}}">{{size}}</span>, {{/if}}<span class="date live-relative-timestamp" data-timestamp="{{timestamp}}" title="{{altDate}}">{{date}}</span>' + ' </div>' + '</div>' + '<div class="hidden permalink-field">' + @@ -152,6 +152,7 @@ altSize: n('files', '%n byte', '%n bytes', this.model.get('size')), dateLabel: t('files', 'Modified'), altDate: OC.Util.formatDate(this.model.get('mtime')), + timestamp: this.model.get('mtime'), date: OC.Util.relativeModifiedDate(this.model.get('mtime')), starAltText: isFavorite ? t('files', 'Favorited') : t('files', 'Favorite'), starIcon: OC.imagePath('core', isFavorite ? 'actions/starred' : 'actions/star'), diff --git a/apps/files_versions/js/versionstabview.js b/apps/files_versions/js/versionstabview.js index 2424778b4ee..2e334edacb5 100644 --- a/apps/files_versions/js/versionstabview.js +++ b/apps/files_versions/js/versionstabview.js @@ -15,7 +15,7 @@ '<li data-revision="{{timestamp}}">' + '<img class="preview" src="{{previewUrl}}"/>' + '<a href="{{downloadUrl}}" class="downloadVersion"><img src="{{downloadIconUrl}}" />' + - '<span class="versiondate has-tooltip" title="{{formattedTimestamp}}">{{relativeTimestamp}}</span>' + + '<span class="versiondate has-tooltip live-relative-timestamp" data-timestamp="{{millisecondsTimestamp}}" title="{{formattedTimestamp}}">{{relativeTimestamp}}</span>' + '</a>' + '{{#canRevert}}' + '<a href="#" class="revertVersion" title="{{revertLabel}}"><img src="{{revertIconUrl}}" /></a>' + @@ -183,6 +183,7 @@ _formatItem: function(version) { var timestamp = version.get('timestamp') * 1000; return _.extend({ + millisecondsTimestamp: timestamp, formattedTimestamp: OC.Util.formatDate(timestamp), relativeTimestamp: OC.Util.relativeModifiedDate(timestamp), downloadUrl: version.getDownloadUrl(), |