<% var reprValue = function(value) { if (typeof(value) === 'string' || value instanceof String) { return value; } return JSON.stringify(value); }; var showDifference = function(className, difference) { _.each(difference, function(value, key) { if (!Array.isArray(value)) { value = [value]; } _.each(value, function(v) { %>
  • <%= key + ':' + reprValue(v) %>
  • <% }); }); }; %> <% _.each(history, function( historyEntry) { %> <% }) %>
    <%= util.formatRelativeTime(historyEntry.time) %> <% var userName = historyEntry.user && historyEntry.user.name || '' %> <% if (userName) { %> <% } %> <%= userName || 'Anonymous user' %> <%= userName || 'Anonymous user' %> <% if (userName) { %> <% } %> <% if (historyEntry.type === 0) { %> @<%= historyEntry.primaryKey %> <% } else if (historyEntry.type === 1) { %> #<%= historyEntry.data.name %> <% } else { %> ? <% } %> <% if (historyEntry.operation == 2) { %> deleted <% } else { %> <% if (historyEntry.operation == 0) { %> added <% } else { %> changed <% } %> <% if (historyEntry.dataDifference) { %>
      <% showDifference('addition', historyEntry.dataDifference['+']) %><% showDifference('removal', historyEntry.dataDifference['-']) %>
    <% } %> <% } %>