12591 restore page styling

This commit is contained in:
Arthur 2023-06-16 13:09:47 -07:00
parent 68341c55b3
commit b9ad61d7a8
4 changed files with 48 additions and 35 deletions

View File

@ -117,7 +117,7 @@ urlpatterns = [
path('render/markdown/', views.RenderMarkdownView.as_view(), name="render_markdown"), path('render/markdown/', views.RenderMarkdownView.as_view(), name="render_markdown"),
# Config Revision # Config Revision
path('config-revision/', views.ConfigRevisionListView.as_view(), name='configrevision'), path('config-revision/', views.ConfigRevisionListView.as_view(), name='configrevision_list'),
path('config-revision/add/', views.ConfigRevisionEditView.as_view(), name='configrevision_add'), path('config-revision/add/', views.ConfigRevisionEditView.as_view(), name='configrevision_add'),
path('config-revision/delete/', views.ConfigRevisionBulkDeleteView.as_view(), name='configrevision_bulk_delete'), path('config-revision/delete/', views.ConfigRevisionBulkDeleteView.as_view(), name='configrevision_bulk_delete'),
path('config-revision/<int:pk>/restore', views.ConfigRevisionRestoreView.as_view(), name='configrevision_restore'), path('config-revision/<int:pk>/restore', views.ConfigRevisionRestoreView.as_view(), name='configrevision_restore'),

View File

@ -1257,6 +1257,6 @@ class ConfigRevisionRestoreView(ContentTypePermissionRequiredMixin, View):
candidate_config = get_object_or_404(ConfigRevision, pk=pk) candidate_config = get_object_or_404(ConfigRevision, pk=pk)
candidate_config.activate() candidate_config.activate()
self.message_user(request, f"Restored configuration revision #{pk}") messages.success(request, f"Restored configuration revision #{pk}")
return redirect(reverse('admin:extras_configrevision_changelist')) return redirect(reverse('extras:configrevision'))

View File

@ -352,7 +352,7 @@ ADMIN_MENU = Menu(
label=_('Configuration'), label=_('Configuration'),
items=( items=(
MenuItem( MenuItem(
link='extras:configrevision', link='extras:configrevision_list',
link_text=_('Config Revisions'), link_text=_('Config Revisions'),
permissions=['extras.config_revision'] permissions=['extras.config_revision']
), ),

View File

@ -4,10 +4,12 @@
{% load perms %} {% load perms %}
{% load static %} {% load static %}
{% block title %}{{ script }}{% endblock %} {% block title %}Restore: {{ object }}{% endblock %}
{% block subtitle %} {% block subtitle %}
{{ script.Meta.description|markdown }} <div class="object-subtitle">
<span>Created {{ object.created|annotated_date }}</span>
</div>
{% endblock %} {% endblock %}
{% block header %} {% block header %}
@ -15,7 +17,8 @@
<div class="col col-md-12"> <div class="col col-md-12">
<nav class="breadcrumb-container px-3" aria-label="breadcrumb"> <nav class="breadcrumb-container px-3" aria-label="breadcrumb">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="{% url 'extras:script_list' %}">Scripts</a></li> <li class="breadcrumb-item"><a href="{% url 'extras:configrevision_list' %}">Config revisions</a></li>
<li class="breadcrumb-item"><a href="{% url 'extras:configrevision' pk=object.pk %}">{{ object }}</a></li>
</ol> </ol>
</nav> </nav>
</div> </div>
@ -33,42 +36,52 @@
</div> </div>
{% endblock controls %} {% endblock controls %}
{% block content %} {% block tabs %}
<ul class="nav nav-tabs px-3" role="tablist"> <ul class="nav nav-tabs px-3" role="tablist">
<li class="nav-item" role="presentation"> <li class="nav-item" role="presentation">
<a href="#log" role="tab" data-bs-toggle="tab" class="nav-link active">Log</a> <a href="#log" role="tab" data-bs-toggle="tab" class="nav-link active">Restore</a>
</li> </li>
</ul> </ul>
<div class="tab-content mb-3"> {% endblock %}
<div role="tabpanel" class="tab-pane active" id="log">
<div class="row">
<p>Restore configuration #{{ object.pk }} from <strong>{{ object.created }}</strong>?</p> {% block content %}
<div class="row">
<table class="table table-striped table-hover"> <div class="col-12">
<thead> <table class="table table-striped table-hover">
<tr> <thead>
<th scope="col">Parameter</th> <tr>
<th scope="col">Current Value</th> <th scope="col">Parameter</th>
<th scope="col">New Value</th> <th scope="col">Current Value</th>
<th scope="col"></th> <th scope="col">New Value</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
{% for param, current, new in params %}
<tr{% if current != new %} class="table-warning"{% endif %}>
<td>{{ param }}</td>
<td>{{ current }}</td>
<td>{{ new }}</td>
<td>{% if current != new %}<img src="{% static 'admin/img/icon-changelink.svg' %}" alt="*" title="Changed">{% endif %}</td>
</tr> </tr>
</thead> {% endfor %}
<tbody> </tbody>
{% for param, current, new in params %} </table>
<tr{% if current != new %} class="table-warning"{% endif %}>
<td>{{ param }}</td>
<td>{{ current }}</td>
<td>{{ new }}</td>
<td>{% if current != new %}<img src="{% static 'admin/img/icon-changelink.svg' %}" alt="*" title="Changed">{% endif %}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div> </div>
</div> </div>
<form method="post">
{% csrf_token %}
<div class="submit-row" style="margin-top: 20px">
<div class="controls">
<div class="control-group">
<button type="submit" name="restore" class="btn btn-primary">Restore</button>
<a href="{% url 'extras:configrevision_list' %}" id="cancel" name="cancel" class="btn btn-outline-danger">Cancel</a>
</div>
</div>
</div>
</form>
{% endblock content %} {% endblock content %}
{% block modals %} {% block modals %}