Skip to content

Commit

Permalink
feat: hide history section if empty
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasvinclav committed Apr 21, 2023
1 parent 149a870 commit e1da167
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
8 changes: 3 additions & 5 deletions src/unfold/templates/admin/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@ <h1 id="site-name">
{% endblock %}

{% block content %}
<div class="flex -mx-4">
<div class="px-4 w-8/12">
<div class="flex flex-row -mx-4">
<div class="flex-grow px-4">
{% include "unfold/helpers/app_list_default.html" %}
</div>

<div class="px-4 w-4/12">
{% include "unfold/helpers/history.html" %}
</div>
{% include "unfold/helpers/history.html" %}
</div>
{% endblock %}
20 changes: 8 additions & 12 deletions src/unfold/templates/unfold/helpers/history.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,13 @@

{% get_admin_log 10 as admin_log for_user user %}

<div id="content-related">
<div class="module" id="recent-actions-module">
<h2 class="mb-4 font-semibold text-gray-700 text-sm dark:text-gray-200">
{% translate 'Recent actions' %}
</h2>
{% if admin_log %}
<div id="content-related" class="px-4 w-4/12">
<div class="module" id="recent-actions-module">
<h2 class="mb-4 font-semibold text-gray-700 text-sm dark:text-gray-200">
{% translate 'Recent actions' %}
</h2>

{% if not admin_log %}
<p class="dark:text-gray-400">
{% translate 'None available' %}
</p>
{% else %}
<ul class="actionlist bg-gray-50 rounded-md p-3 dark:bg-gray-800">
{% for entry in admin_log %}
<li class="{% if entry.is_addition %}addlink{% endif %}{% if entry.is_change %}changelink{% endif %}{% if entry.is_deletion %}deletelink{% endif %} bg-white mb-4 p-3 rounded-md shadow-sm last:mb-0 dark:bg-gray-900">
Expand Down Expand Up @@ -40,6 +36,6 @@ <h2 class="mb-4 font-semibold text-gray-700 text-sm dark:text-gray-200">
</li>
{% endfor %}
</ul>
{% endif %}
</div>
</div>
</div>
{% endif %}

0 comments on commit e1da167

Please sign in to comment.