Add versioning display support for contact-related models

This commit is contained in:
Lance Edgar 2017-07-05 17:16:28 -05:00
parent 20ddf2687b
commit 85bdefc25b
8 changed files with 125 additions and 27 deletions

View file

@ -1,7 +1,7 @@
## -*- coding: utf-8; -*-
<%inherit file="/base.mako" />
<%def name="title()">${instance_title} @ ver ${transaction.id}</%def>
<%def name="title()">${instance_title_normal} @ ver ${transaction.id}</%def>
## TODO: this was basically copied from Revel diff template..need to abstract
@ -40,7 +40,7 @@
background-color: #cfc;
}
table.deleted td.local-value,
table.deleted td.host-value,
table.diff tr.diff td.local-value {
background-color: #fcc;
}
@ -75,7 +75,7 @@
<div class="field-wrapper">
<label>Changed by</label>
<div class="field">${transaction.user}</div>
<div class="field">${transaction.user or ''}</div>
</div>
<div class="field-wrapper">
@ -94,9 +94,28 @@
% for version in versions:
<h2>${version.version_parent.get_model_title()}</h2>
<h2>${title_for_version(version)}</h2>
% if version.previous:
% if version.previous and version.operation_type == continuum.Operation.DELETE:
<table class="deleted">
<thead>
<tr>
<th>field name</th>
<th>old value</th>
<th>new value</th>
</tr>
</thead>
<tbody>
% for field in fields_for_version(version):
<tr>
<td class="field">${field}</td>
<td class="value local-value">${repr(getattr(version.previous, field))}</td>
<td class="value host-value">&nbsp;</td>
</tr>
% endfor
</tbody>
</table>
% elif version.previous:
<table class="diff">
<thead>
<tr>

View file

@ -1,4 +1,4 @@
## -*- coding: utf-8 -*-
## -*- coding: utf-8; -*-
<%namespace name="base" file="tailbone:templates/base.mako" />
<%namespace file="/menu.mako" import="main_menu_items" />
<%namespace file="/newgrids/nav.mako" import="grid_index_nav" />
@ -40,6 +40,10 @@
<span class="global">${model_title_plural}</span>
% else:
${h.link_to(index_title, index_url, class_='global')}
% if instance_url is not Undefined:
<span class="global">&raquo;</span>
${h.link_to(instance_title, instance_url, class_='global')}
% endif
% if master.viewing and grid_index:
${grid_index_nav()}
% endif