2014-10-26 01:15:43 +02:00
|
|
|
<%
|
|
|
|
var reprValue = function(value) {
|
|
|
|
if (typeof(value) === 'string' || value instanceof String) {
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
return JSON.stringify(value);
|
|
|
|
};
|
2014-11-19 10:22:59 +01:00
|
|
|
|
|
|
|
var showDifference = function(className, difference) {
|
|
|
|
_.each(difference, function(value, key) {
|
|
|
|
if (!Array.isArray(value)) {
|
|
|
|
value = [value];
|
|
|
|
}
|
|
|
|
_.each(value, function(v) {
|
|
|
|
%><li class="<%= className %> difference-<%= key %>"><%= key + ':' + reprValue(v) %></li><%
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
2014-10-26 01:15:43 +02:00
|
|
|
%>
|
|
|
|
|
2014-09-26 20:41:28 +02:00
|
|
|
<table class="history">
|
|
|
|
<tbody>
|
|
|
|
<% _.each(history, function( historyEntry) { %>
|
|
|
|
<tr>
|
|
|
|
<td class="time">
|
|
|
|
<%= formatRelativeTime(historyEntry.time) %>
|
|
|
|
</td>
|
|
|
|
|
|
|
|
<td class="user">
|
|
|
|
<% var userName = historyEntry.user && historyEntry.user.name || '' %>
|
|
|
|
|
|
|
|
<% if (userName) { %>
|
|
|
|
<a href="#/user/<%= userName %>">
|
|
|
|
<% } %>
|
|
|
|
|
2014-10-05 11:05:34 +02:00
|
|
|
<img width="20" height="20" class="author-avatar"
|
2014-09-26 20:41:28 +02:00
|
|
|
src="/data/thumbnails/20x20/avatars/<%= userName || '!' %>"
|
|
|
|
alt="<%= userName || 'Anonymous user' %>"/>
|
|
|
|
|
|
|
|
<%= userName || 'Anonymous user' %>
|
|
|
|
|
|
|
|
<% if (userName) { %>
|
|
|
|
</a>
|
|
|
|
<% } %>
|
|
|
|
</td>
|
|
|
|
|
|
|
|
<td class="subject">
|
2014-11-07 13:52:37 +01:00
|
|
|
<% if (historyEntry.type === 0) { %>
|
2014-09-26 20:41:28 +02:00
|
|
|
<a href="#/post/<%= historyEntry.primaryKey %>">
|
|
|
|
@<%= historyEntry.primaryKey %>
|
|
|
|
</a>
|
2014-11-07 13:52:37 +01:00
|
|
|
<% } else if (historyEntry.type === 1) { %>
|
|
|
|
<a href="#/tag/<%= historyEntry.data.name %>">
|
|
|
|
#<%= historyEntry.data.name %>
|
|
|
|
</a>
|
2014-09-26 20:41:28 +02:00
|
|
|
<% } else { %>
|
|
|
|
?
|
|
|
|
<% } %>
|
|
|
|
</td>
|
|
|
|
|
|
|
|
<td class="difference">
|
2014-11-09 17:04:04 +01:00
|
|
|
<% if (historyEntry.operation == 2) { %>
|
2014-09-26 20:41:28 +02:00
|
|
|
deleted
|
|
|
|
<% } else { %>
|
2014-11-09 17:04:04 +01:00
|
|
|
<% if (historyEntry.operation == 0) { %>
|
|
|
|
added
|
|
|
|
<% } else { %>
|
|
|
|
changed
|
|
|
|
<% } %>
|
2014-09-26 20:41:28 +02:00
|
|
|
|
|
|
|
<% if (historyEntry.dataDifference) { %>
|
|
|
|
<ul><!--
|
2014-11-19 10:22:59 +01:00
|
|
|
--><% showDifference('addition', historyEntry.dataDifference['+']) %><!--
|
|
|
|
--><% showDifference('removal', historyEntry.dataDifference['-']) %><!--
|
2014-09-26 20:41:28 +02:00
|
|
|
--></ul>
|
|
|
|
<% } %>
|
|
|
|
<% } %>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<% }) %>
|
|
|
|
</tbody>
|
|
|
|
</table>
|