53 lines
2.4 KiB
HTML
53 lines
2.4 KiB
HTML
{% extends "base.html" %}
|
|
{% block title %}Historia wersji hosts{% endblock %}
|
|
{% block content %}
|
|
<div class="card">
|
|
<div class="card-header">
|
|
<h2>Historia wersji dla: {{ hostfile.title }}</h2>
|
|
</div>
|
|
<div class="card-body">
|
|
<form method="post" id="bulkDeleteForm">
|
|
<table class="table table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th><input type="checkbox" id="select-all"></th>
|
|
<th>Data</th>
|
|
<th>Fragment treści</th>
|
|
<th>Akcje</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% set latest_id = versions[0].id if versions|length > 0 else None %}
|
|
{% for version in versions %}
|
|
<tr>
|
|
<td><input type="checkbox" name="selected_versions" value="{{ version.id }}"></td>
|
|
<td>{{ version.timestamp.strftime("%Y-%m-%d %H:%M:%S") }}</td>
|
|
<td>{{ version.content[:50] }}{% if version.content|length > 50 %}...{% endif %}</td>
|
|
<td>
|
|
<a href="{{ url_for('view_hostfile_version', version_id=version.id) }}" class="btn btn-sm btn-info">Podgląd</a>
|
|
<a href="{{ url_for('restore_hostfile_version', version_id=version.id) }}" class="btn btn-sm btn-success" onclick="return confirm('Przywrócić tę wersję?');">Przywróć</a>
|
|
{% if latest_id and version.id != latest_id %}
|
|
<a href="{{ url_for('diff_hostfile_versions', version1_id=version.id, version2_id=latest_id) }}" class="btn btn-sm btn-warning">Diff z najnowszą</a>
|
|
{% else %}
|
|
<span class="text-muted">Brak diff</span>
|
|
{% endif %}
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
<button type="submit" class="btn btn-danger" onclick="return confirm('Czy na pewno usunąć zaznaczone wersje?');">Usuń zaznaczone</button>
|
|
<a href="{{ url_for('delete_old_versions', hostfile_id=hostfile.id, days=30) }}" class="btn btn-secondary" onclick="return confirm('Usuń wersje starsze niż 30 dni?');">Usuń wersje starsze niż 30 dni</a>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
document.getElementById('select-all').addEventListener('change', function(){
|
|
var checkboxes = document.querySelectorAll('input[name="selected_versions"]');
|
|
checkboxes.forEach(function(checkbox) {
|
|
checkbox.checked = document.getElementById('select-all').checked;
|
|
});
|
|
});
|
|
</script>
|
|
{% endblock %}
|