Added absolute timestamp hints where necessary
This commit is contained in:
parent
f1647a5f7b
commit
2fd371b10a
12 changed files with 31 additions and 10 deletions
|
@ -103,6 +103,7 @@ App.Presenters.CommentListPresenter = function(
|
|||
var $item = jQuery('<li>' + templates.commentListItem({
|
||||
comment: comment,
|
||||
formatRelativeTime: util.formatRelativeTime,
|
||||
formatAbsoluteTime: util.formatAbsoluteTime,
|
||||
formatMarkdown: util.formatMarkdown,
|
||||
canVote: auth.isLoggedIn(),
|
||||
canEditComment: auth.isLoggedIn(comment.user.name) ? privileges.canEditOwnComments : privileges.canEditAllComments,
|
||||
|
|
|
@ -164,6 +164,7 @@ App.Presenters.PostPresenter = function(
|
|||
postHistory: post.history,
|
||||
|
||||
formatRelativeTime: util.formatRelativeTime,
|
||||
formatAbsoluteTime: util.formatAbsoluteTime,
|
||||
formatFileSize: util.formatFileSize,
|
||||
|
||||
historyTemplate: templates.history,
|
||||
|
|
|
@ -88,6 +88,7 @@ App.Presenters.TagPresenter = function(
|
|||
siblings: siblings,
|
||||
tagCategories: JSON.parse(jQuery('head').attr('data-tag-categories')),
|
||||
formatRelativeTime: util.formatRelativeTime,
|
||||
formatAbsoluteTime: util.formatAbsoluteTime,
|
||||
historyTemplate: templates.history,
|
||||
}));
|
||||
$el.find('.post-list').hide();
|
||||
|
|
|
@ -77,6 +77,7 @@ App.Presenters.UserListPresenter = function(
|
|||
var $item = jQuery('<li>' + templates.listItem(_.extend({
|
||||
user: user,
|
||||
formatRelativeTime: util.formatRelativeTime,
|
||||
formatAbsoluteTime: util.formatAbsoluteTime,
|
||||
}, privileges)) + '</li>');
|
||||
$target.append($item);
|
||||
});
|
||||
|
|
|
@ -75,6 +75,7 @@ App.Presenters.UserPresenter = function(
|
|||
user: user,
|
||||
isLoggedIn: auth.isLoggedIn(user.name),
|
||||
formatRelativeTime: util.formatRelativeTime,
|
||||
formatAbsoluteTime: util.formatAbsoluteTime,
|
||||
canChangeBrowsingSettings: userBrowsingSettingsPresenter.getPrivileges().canChangeBrowsingSettings,
|
||||
canChangeAccountSettings: _.any(userAccountSettingsPresenter.getPrivileges()),
|
||||
canDeleteAccount: userAccountRemovalPresenter.getPrivileges().canDeleteAccount}));
|
||||
|
|
|
@ -146,6 +146,11 @@ App.Util.Misc = function(_, jQuery, marked, promise) {
|
|||
return future ? 'in ' + text : text + ' ago';
|
||||
}
|
||||
|
||||
function formatAbsoluteTime(timeString) {
|
||||
var time = new Date(Date.parse(timeString));
|
||||
return time.toString();
|
||||
}
|
||||
|
||||
function formatUnits(number, base, suffixes, callback) {
|
||||
if (!number && number !== 0) {
|
||||
return NaN;
|
||||
|
@ -233,6 +238,7 @@ App.Util.Misc = function(_, jQuery, marked, promise) {
|
|||
return {
|
||||
promiseTemplate: promiseTemplate,
|
||||
formatRelativeTime: formatRelativeTime,
|
||||
formatAbsoluteTime: formatAbsoluteTime,
|
||||
formatFileSize: formatFileSize,
|
||||
formatMarkdown: formatMarkdown,
|
||||
enableExitConfirmation: enableExitConfirmation,
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<% } %>
|
||||
</span>
|
||||
|
||||
<span class="date" title="<%= comment.creationTime %>">
|
||||
<span class="date" title="<%= formatAbsoluteTime(comment.creationTime) %>">
|
||||
<%= formatRelativeTime(comment.creationTime) %>
|
||||
</span>
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ var showDifference = function(className, difference) {
|
|||
<tbody>
|
||||
<% _.each(history, function( historyEntry) { %>
|
||||
<tr>
|
||||
<td class="time">
|
||||
<td class="time" title="<%= formatAbsoluteTime(historyEntry.time) %>">
|
||||
<%= formatRelativeTime(historyEntry.time) %>
|
||||
</td>
|
||||
|
||||
|
|
|
@ -109,7 +109,9 @@
|
|||
|
||||
<br/>
|
||||
|
||||
<span class="date"><%= formatRelativeTime(post.uploadTime) %></span>
|
||||
<span class="date" title="<%= formatAbsoluteTime(post.uploadTime) %>">
|
||||
<%= formatRelativeTime(post.uploadTime) %>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<ul class="other-info">
|
||||
|
@ -138,7 +140,9 @@
|
|||
<% if (post.lastEditTime !== post.uploadTime) { %>
|
||||
<li>
|
||||
Edited:
|
||||
<%= formatRelativeTime(post.lastEditTime) %>
|
||||
<span title="<%= formatAbsoluteTime(post.lastEditTime) %>">
|
||||
<%= formatRelativeTime(post.lastEditTime) %>
|
||||
</span>
|
||||
</li>
|
||||
<% } %>
|
||||
|
||||
|
@ -273,7 +277,8 @@
|
|||
<h1>History</h1>
|
||||
<%= historyTemplate({
|
||||
history: postHistory,
|
||||
formatRelativeTime: formatRelativeTime
|
||||
formatRelativeTime: formatRelativeTime,
|
||||
formatAbsoluteTime: formatAbsoluteTime,
|
||||
}) %>
|
||||
</div>
|
||||
<% } %>
|
||||
|
|
|
@ -103,7 +103,8 @@
|
|||
<h3>History</h3>
|
||||
<%= historyTemplate({
|
||||
history: tag.history,
|
||||
formatRelativeTime: formatRelativeTime
|
||||
formatRelativeTime: formatRelativeTime,
|
||||
formatAbsoluteTime: formatAbsoluteTime,
|
||||
}) %>
|
||||
</div>
|
||||
<% } %>
|
||||
|
|
|
@ -19,10 +19,10 @@
|
|||
<%= user.name %>
|
||||
<% } %>
|
||||
</h1>
|
||||
<div class="date-joined" title="<%= user.registrationTime %>">
|
||||
<div class="date-joined" title="<%= formatAbsoluteTime(user.registrationTime) %>">
|
||||
Joined: <%= formatRelativeTime(user.registrationTime) %>
|
||||
</div>
|
||||
<div class="date-seen">
|
||||
<div class="date-seen" title="<%= formatAbsoluteTime(user.lastLoginTime) %>">
|
||||
Last seen: <%= formatRelativeTime(user.lastLoginTime) %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -51,12 +51,16 @@
|
|||
<table>
|
||||
<tr>
|
||||
<td>Registered:</td>
|
||||
<td><%= formatRelativeTime(user.registrationTime) %></td>
|
||||
<td title="<%= formatAbsoluteTime(user.registrationTime) %>">
|
||||
<%= formatRelativeTime(user.registrationTime) %>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Seen:</td>
|
||||
<td><%= formatRelativeTime(user.lastLoginTime) %></td>
|
||||
<td title="<%= formatAbsoluteTime(user.lastLoginTime) %>">
|
||||
<%= formatRelativeTime(user.lastLoginTime) %>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<% if (user.accessRank) { %>
|
||||
|
|
Loading…
Reference in a new issue