Merge changelog.html into home.html

This commit is contained in:
jeremystretch 2021-05-17 13:28:59 -04:00
parent cb6dbc801f
commit 8545974e47
2 changed files with 82 additions and 85 deletions

View File

@ -1,47 +0,0 @@
{% load helpers %} {% load get_status %}
{% if changelog and perms.extras.view_objectchange %}
<table class="table align-middle table-hover">
<thead>
<tr>
<th scope="col">User</th>
<th scope="col">Action</th>
<th scope="col">Type</th>
<th scope="col">Object</th>
<th scope="col">Time</th>
<th scope="col" align="right"></th>
</tr>
</thead>
<tbody>
{% for change in changelog %}
<tr class="{% get_status change.get_action_display %}">
<th scope="row">{{ change.user|default:change.user_name }}</th>
<td>{{ change.get_action_display|bettertitle }}</td>
<td>{{ change.changed_object_type.name|bettertitle }}</td>
<td>
{% if change.changed_object.get_absolute_url %}
<a class="text-body" href="{{ change.changed_object.get_absolute_url }}">{{ change.changed_object }}</a>
{% else %} {{ change.changed_object|default:change.object_repr }} {% endif %}
</td>
<td>{{ change.time|date:'SHORT_DATETIME_FORMAT' }}</td>
<td>
<a role="button" class="text-body" href="{{ change.get_absolute_url }}">
<i class="mdi mdi-dots-horizontal" data-bs-toggle="tooltip" data-bs-placement="left" title="View Change Details"></i>
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% elif perms.extras.view_objectchange %}
<div class="alert alert-secondary mt-4" role="alert">
No change history found.
</div>
{% else %}
<div class="alert alert-danger mt-4" role="alert">
<strong>{{ request.user|truncatechars:"30" }}</strong> does not have
permission to view changes.
</div>
{% endif %}

View File

@ -1,56 +1,100 @@
{% extends 'layout.html' %} {% extends 'layout.html' %}
{% load get_status %}
{% load helpers %} {% load helpers %}
{% block title_container %}{% endblock %} {% block title_container %}{% endblock %}
{% block title %}Home{% endblock %} {% block title %}Home{% endblock %}
{% block content %} {% block content %}
<div class="stats-container">
<div class="row masonry"> {# General stats #}
{% for section in stats %} <div class="stats-container">
<div class="col col-sm-12 col-md-4 my-2 masonry-item"> <div class="row masonry">
<div class="card"> {% for section in stats %}
<h5 class="card-header text-primary">{{ section.label }}</h5> <div class="col col-sm-12 col-md-4 my-2 masonry-item">
<div class="card-body"> <div class="card">
<div class="list-group list-group-flush"> <h5 class="card-header text-primary">{{ section.label }}</h5>
{% for item in section.items %} <div class="card-body">
<a href="{% url item.url %}" class="list-group-item list-group-item-action{% if item.disabled %} disabled{% endif %}"> <div class="list-group list-group-flush">
<div class="d-flex w-100 justify-content-between align-items-center"> {% for item in section.items %}
<div class="d-flex flex-column align-items-start"> <a href="{% url item.url %}" class="list-group-item list-group-item-action{% if item.disabled %} disabled{% endif %}">
<h6 class="mb-1">{{ item.label }}</h6> <div class="d-flex w-100 justify-content-between align-items-center">
{% if item.description %} <div class="d-flex flex-column align-items-start">
<small class="mb-1 text-muted">{{ item.description }}</small> <h6 class="mb-1">{{ item.label }}</h6>
{% endif %} {% if item.description %}
<small class="mb-1 text-muted">{{ item.description }}</small>
{% endif %}
</div>
<span class="badge stat-badge rounded-pill">
{% if item.count == None %}
<i class="mdi mdi-lock"></i>
{% else %}
{{ item.count }}
{% endif %}
</span>
</div> </div>
<span class="badge stat-badge rounded-pill"> </a>
{% if item.count == None %} {% endfor %}
<i class="mdi mdi-lock"></i> </div>
{% else %} <div class="display-4 font-weight-normal text-primary">
{{ item.count }} {{ item.count }}
{% endif %} </div>
</span>
</div>
</a>
{% endfor %}
</div>
<div class="display-4 font-weight-normal text-primary">
{{ item.count }}
</div> </div>
</div> </div>
</div> </div>
{% endfor %}
</div> </div>
{% endfor %}
</div> </div>
</div>
<div class="row my-4 flex-grow-1 changelog-container"> {# Changelog #}
<div class="col"> <div class="row my-4 flex-grow-1 changelog-container">
<div class="card"> <div class="col">
<h4 class="card-header">Changelog</h4> <div class="card">
<div class="card-body"> <h4 class="card-header">Changelog</h4>
{% include 'changelog.html' %} <div class="card-body">
{% if changelog and perms.extras.view_objectchange %}
{# TODO: Replace this with a django-tables2 Table #}
<table class="table align-middle table-hover">
<thead>
<tr>
<th scope="col">User</th>
<th scope="col">Action</th>
<th scope="col">Type</th>
<th scope="col">Object</th>
<th scope="col">Time</th>
<th scope="col" align="right"></th>
</tr>
</thead>
<tbody>
{% for change in changelog %}
<tr class="{% get_status change.get_action_display %}">
<th scope="row">{{ change.user|default:change.user_name }}</th>
<td>{{ change.get_action_display|bettertitle }}</td>
<td>{{ change.changed_object_type.name|bettertitle }}</td>
<td>
{% if change.changed_object.get_absolute_url %}
<a class="text-body" href="{{ change.changed_object.get_absolute_url }}">{{ change.changed_object }}</a>
{% else %} {{ change.changed_object|default:change.object_repr }} {% endif %}
</td>
<td>{{ change.time|date:'SHORT_DATETIME_FORMAT' }}</td>
<td>
<a role="button" class="text-body" href="{{ change.get_absolute_url }}">
<i class="mdi mdi-dots-horizontal" data-bs-toggle="tooltip" data-bs-placement="left" title="View Change Details"></i>
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% elif perms.extras.view_objectchange %}
<div class="alert alert-secondary mt-4" role="alert">
No change history found.
</div>
{% endif %}
</div>
</div> </div>
</div> </div>
</div> </div>
</div>
{% endblock %} {% endblock %}