Tweak diffs.css
and refactor 'view_version' template to use it
This commit is contained in:
parent
568a625500
commit
c3c77ed586
|
@ -4,6 +4,10 @@ table.diff {
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
border-left: 1px solid Black;
|
border-left: 1px solid Black;
|
||||||
border-top: 1px solid Black;
|
border-top: 1px solid Black;
|
||||||
|
font-size: 11pt;
|
||||||
|
margin-top: 2em;
|
||||||
|
margin-left: 50px;
|
||||||
|
min-width: 80%;
|
||||||
}
|
}
|
||||||
|
|
||||||
table.diff th,
|
table.diff th,
|
||||||
|
@ -13,16 +17,22 @@ table.diff td {
|
||||||
padding: 2px 5px;
|
padding: 2px 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
table.diff td {
|
||||||
|
padding: 5px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
table.diff.monospace td.old-value,
|
table.diff.monospace td.old-value,
|
||||||
table.diff.monospace td.new-value{
|
table.diff.monospace td.new-value{
|
||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
white-space: pre;
|
white-space: pre;
|
||||||
}
|
}
|
||||||
|
|
||||||
table.diff tr.diff td.new-value {
|
table.diff.new td.new-value,
|
||||||
|
table.diff.dirty tr.diff td.new-value {
|
||||||
background-color: #cfc;
|
background-color: #cfc;
|
||||||
}
|
}
|
||||||
|
|
||||||
table.diff tr.diff td.old-value {
|
table.diff.deleted td.old-value,
|
||||||
|
table.diff.dirty tr.diff td.old-value {
|
||||||
background-color: #fcc;
|
background-color: #fcc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,50 +5,6 @@
|
||||||
|
|
||||||
## TODO: this was basically copied from Revel diff template..need to abstract
|
## TODO: this was basically copied from Revel diff template..need to abstract
|
||||||
|
|
||||||
<%def name="extra_styles()">
|
|
||||||
${parent.extra_styles()}
|
|
||||||
<style type="text/css">
|
|
||||||
|
|
||||||
table {
|
|
||||||
background-color: White;
|
|
||||||
border-collapse: collapse;
|
|
||||||
border-left: 1px solid black;
|
|
||||||
border-top: 1px solid black;
|
|
||||||
font-size: 11pt;
|
|
||||||
margin-top: 2em;
|
|
||||||
margin-left: 50px;
|
|
||||||
min-width: 80%;
|
|
||||||
}
|
|
||||||
|
|
||||||
table th,
|
|
||||||
table td {
|
|
||||||
border-bottom: 1px solid black;
|
|
||||||
border-right: 1px solid black;
|
|
||||||
}
|
|
||||||
|
|
||||||
table td {
|
|
||||||
padding: 5px 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
table td.value {
|
|
||||||
font-family: monospace;
|
|
||||||
white-space: pre;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
table.new td.host-value,
|
|
||||||
table.diff tr.diff td.host-value {
|
|
||||||
background-color: #cfc;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.deleted td.local-value,
|
|
||||||
table.diff tr.diff td.local-value {
|
|
||||||
background-color: #fcc;
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
||||||
</%def>
|
|
||||||
|
|
||||||
<%def name="content_title()">
|
<%def name="content_title()">
|
||||||
<div style="float: right;">
|
<div style="float: right;">
|
||||||
% if previous_transaction:
|
% if previous_transaction:
|
||||||
|
@ -98,7 +54,7 @@
|
||||||
<h2>${title_for_version(version)}</h2>
|
<h2>${title_for_version(version)}</h2>
|
||||||
|
|
||||||
% if version.previous and version.operation_type == continuum.Operation.DELETE:
|
% if version.previous and version.operation_type == continuum.Operation.DELETE:
|
||||||
<table class="deleted">
|
<table class="diff monospace deleted">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>field name</th>
|
<th>field name</th>
|
||||||
|
@ -110,14 +66,14 @@
|
||||||
% for field in fields_for_version(version):
|
% for field in fields_for_version(version):
|
||||||
<tr>
|
<tr>
|
||||||
<td class="field">${field}</td>
|
<td class="field">${field}</td>
|
||||||
<td class="value local-value">${repr(getattr(version.previous, field))}</td>
|
<td class="value old-value">${repr(getattr(version.previous, field))}</td>
|
||||||
<td class="value host-value"> </td>
|
<td class="value new-value"> </td>
|
||||||
</tr>
|
</tr>
|
||||||
% endfor
|
% endfor
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
% elif version.previous:
|
% elif version.previous:
|
||||||
<table class="diff">
|
<table class="diff monospace dirty">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>field name</th>
|
<th>field name</th>
|
||||||
|
@ -129,14 +85,14 @@
|
||||||
% for field in fields_for_version(version):
|
% for field in fields_for_version(version):
|
||||||
<tr${' class="diff"' if getattr(version, field) != getattr(version.previous, field) else ''|n}>
|
<tr${' class="diff"' if getattr(version, field) != getattr(version.previous, field) else ''|n}>
|
||||||
<td class="field">${field}</td>
|
<td class="field">${field}</td>
|
||||||
<td class="value local-value">${repr(getattr(version.previous, field))}</td>
|
<td class="value old-value">${repr(getattr(version.previous, field))}</td>
|
||||||
<td class="value host-value">${repr(getattr(version, field))}</td>
|
<td class="value new-value">${repr(getattr(version, field))}</td>
|
||||||
</tr>
|
</tr>
|
||||||
% endfor
|
% endfor
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
% else:
|
% else:
|
||||||
<table class="new">
|
<table class="diff monospace new">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>field name</th>
|
<th>field name</th>
|
||||||
|
@ -148,8 +104,8 @@
|
||||||
% for field in fields_for_version(version):
|
% for field in fields_for_version(version):
|
||||||
<tr>
|
<tr>
|
||||||
<td class="field">${field}</td>
|
<td class="field">${field}</td>
|
||||||
<td class="value local-value"> </td>
|
<td class="value old-value"> </td>
|
||||||
<td class="value host-value">${repr(getattr(version, field))}</td>
|
<td class="value new-value">${repr(getattr(version, field))}</td>
|
||||||
</tr>
|
</tr>
|
||||||
% endfor
|
% endfor
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
Loading…
Reference in a new issue