112 lines
3.4 KiB
HTML
112 lines
3.4 KiB
HTML
{% load static %}
|
|
{% load i18n %}
|
|
{% load mastodon %}
|
|
{% get_current_language as LANGUAGE_CODE %}
|
|
<!DOCTYPE html>
|
|
<html lang="{{ LANGUAGE_CODE }}" class="content-page">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>{{ site_name }} - {{ item.display_title }} - {% trans "revision history" %}</title>
|
|
{% include "common_libs.html" %}
|
|
<style>
|
|
aside details {
|
|
margin-bottom: 1rem;
|
|
padding: 1rem;
|
|
border: var(--pico-muted-color) solid 1px;
|
|
}
|
|
aside summary {
|
|
cursor: pointer;
|
|
font-weight: bold;
|
|
}
|
|
main>div {
|
|
margin-bottom: 4rem;
|
|
}
|
|
|
|
/* diff viewer */
|
|
.diffview pre {
|
|
white-space: pre-wrap;
|
|
word-wrap: break-word;
|
|
word-break: break-all;
|
|
background: unset;
|
|
}
|
|
.diffview td {
|
|
vertical-align: top;
|
|
}
|
|
.diffview td div{
|
|
display: none;
|
|
}
|
|
</style>
|
|
<script src="{{ cdn_url }}/npm/json5@2.2.3/dist/index.min.js"></script>
|
|
<script type="text/javascript">
|
|
function parse_json(j){
|
|
try {
|
|
j = JSON5.parse(j);
|
|
} catch (e) {
|
|
if (j == 'None' || j == '-' || j == '') j = undefined;
|
|
if (j == 'True') j = true;
|
|
if (j == 'False') j = false;
|
|
}
|
|
return JSON.stringify(j, null, 2);
|
|
}
|
|
</script>
|
|
</head>
|
|
<body>
|
|
{% include "_header.html" %}
|
|
<main>
|
|
<div class="grid__main">
|
|
<h4>{{ item.display_title }} - {% trans "revision history" %}</h4>
|
|
<table class="diffview">
|
|
<thead>
|
|
<tr>
|
|
<th>Field</th>
|
|
<th style="width:40%;">From</th>
|
|
<th style="width:40%;">To</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for log in item.history.all %}
|
|
<tr>
|
|
<td colspan="3">
|
|
<b title="#{{ log.id }}">
|
|
{% if request.user.is_staff or log.actor.preference.show_last_edit %}
|
|
{{ log.actor.username|default:'-' }}
|
|
{% else %}
|
|
<i class="fa-solid fa-user-secret"></i>
|
|
{% endif %}
|
|
</b>
|
|
{{ log.get_action_display }} on {{ log.timestamp }}
|
|
</td>
|
|
</tr>
|
|
{% for key, value in log.changes_dict.items %}
|
|
<tr>
|
|
<td>{{ key }}</td>
|
|
<td _='init set x to innerText of first in me then set innerHTML of last in me to parse_json(x)'>
|
|
<div class="hidden">{{ value.0|default:"-" }}</div>
|
|
<pre></pre>
|
|
</td>
|
|
<td _='init set x to innerText of first in me then set innerHTML of last in me to parse_json(x)'>
|
|
<div class="hidden">{{ value.1|default:"-" }}</div>
|
|
<pre></pre>
|
|
</td>
|
|
</tr>
|
|
{% empty %}
|
|
<tr>
|
|
<td>-</td>
|
|
<td></td>
|
|
<td></td>
|
|
</tr>
|
|
{% endfor %}
|
|
{% empty %}
|
|
<p>No history for this item has been logged yet.</p>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<aside class="grid__aside">
|
|
{% include "_sidebar_edit.html" %}
|
|
</aside>
|
|
</main>
|
|
{% include "_footer.html" %}
|
|
</body>
|
|
</html>
|