Skip to content

Commit

Permalink
feat: redesigned default dashboard (#310)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasvinclav committed Mar 11, 2024
1 parent f1e4dd0 commit 7e5a575
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 61 deletions.
2 changes: 1 addition & 1 deletion src/unfold/static/unfold/css/styles.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/unfold/templates/admin/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ <h1 id="site-name">
{% endblock %}

{% block content %}
<div class="flex flex-col gap-8 lg:flex-row">
<div class="flex flex-col lg:flex-row lg:gap-8">
<div class="flex-grow">
{% include "unfold/helpers/app_list_default.html" %}
</div>
Expand Down
106 changes: 53 additions & 53 deletions src/unfold/templates/unfold/helpers/app_list_default.html
Original file line number Diff line number Diff line change
@@ -1,61 +1,61 @@
{% load i18n %}

{% if app_list %}
{% for app in app_list %}
<div class="app-{{ app.app_label }} module{% if app.app_url in request.path %} current-app{% endif %}">
<table class="border border-spacing-none border-separate rounded-md shadow-sm text-gray-700 text-sm w-full dark:border-gray-800 {% if not forloop.last %}mb-8{% endif %}">
<caption class="font-semibold mb-4 text-gray-700 text-left dark:text-gray-200">
<a href="{{ app.app_url }}" class="section" title="{% blocktranslate with name=app.name %}Models in the {{ name }} application{% endblocktranslate %}">
{{ app.name }}
</a>
</caption>
{% for app in app_list %}
<div class="app-{{ app.app_label }} module{% if app.app_url in request.path %} current-app{% endif %}">
<div class="bg-gray-50 mb-6 rounded-md p-3 dark:bg-gray-800">
<table class="border border-gray-400/10 border-spacing-none border-separate rounded-md overflow-hidden shadow-sm text-gray-700 text-sm w-full dark:border-gray-800">
<caption class="font-semibold mb-3 text-gray-700 text-left dark:text-gray-200">
<a href="{{ app.app_url }}" class="section" title="{% blocktranslate with name=app.name %}Models in the {{ name }} application{% endblocktranslate %}">
{{ app.name }}
</a>
</caption>

{% for model in app.models %}
<tr class="model-{{ model.object_name|lower }}{% if model.admin_url in request.path %} current-model{% endif %} {% cycle '' 'bg-gray-50 dark:bg-white/[.02]' %}">
{% if model.admin_url %}
<th scope="row" class="font-normal p-3 text-left dark:text-gray-400 {% if not forloop.last %}border-b dark:border-gray-800{% endif %}">
<a href="{{ model.admin_url }}"{% if model.admin_url in request.path %} aria-current="page"{% endif %}>
{{ model.name }}
</a>
</th>
{% else %}
<th scope="row" class="font-normal p-3 text-left dark:text-gray-400 {% if not forloop.last %}border-b dark:border-gray-800{% endif %}">
{{ model.name }}
</th>
{% endif %}
{% for model in app.models %}
<tr class="bg-white dark:bg-gray-900 model-{{ model.object_name|lower }}{% if model.admin_url in request.path %} current-model{% endif %}">
{% if model.admin_url %}
<th scope="row" class="font-normal p-3 text-left dark:text-gray-200 {% if not forloop.last %}border-b border-gray-100 dark:border-gray-800{% endif %}">
<a href="{{ model.admin_url }}"{% if model.admin_url in request.path %} aria-current="page"{% endif %}>
{{ model.name }}
</a>
</th>
{% else %}
<th scope="row" class="font-normal p-3 text-left dark:text-gray-400 {% if not forloop.last %}border-b border-gray-100 dark:border-gray-800{% endif %}">
{{ model.name }}
</th>
{% endif %}

{% if model.add_url %}
<td class="{% if not forloop.last %}border-b dark:border-gray-800{% endif %} p-3 text-right">
<a href="{{ model.add_url }}" class="addlink text-gray-500 transition-all underline dark:text-gray-400 dark:hover:text-gray-200">
{% translate 'Add' %}
</a>
</td>
{% else %}
<td class="{% if not forloop.last %}border-b dark:border-gray-800{% endif %} p-3 text-right"></td>
{% endif %}
<td class="{% if not forloop.last %}border-b border-gray-100 dark:border-gray-800{% endif %} p-3 text-right">
<div class="flex flex-row items-center ml-auto gap-4 justify-end">
{% if model.add_url %}
<a href="{{ model.add_url }}" class="addlink block leading-none text-gray-400 transition-colors hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200" title="{% translate 'Add' %}">
<span class="material-symbols-outlined">add</span>
</a>
{% endif %}

{% if model.admin_url and show_changelinks %}
{% if model.view_only %}
<td class="{% if not forloop.last %}border-b dark:border-gray-800{% endif %} p-3 text-right">
<a href="{{ model.admin_url }}" class="viewlink text-gray-500 transition-all underline dark:text-gray-400 dark:hover:text-gray-200">
{% translate 'View' %}
</a>
</td>
{% else %}
<td class="{% if not forloop.last %}border-b dark:border-gray-800{% endif %} p-3 text-right">
<a href="{{ model.admin_url }}" class="changelink text-gray-500 transition-all underline dark:text-gray-400 dark:hover:text-gray-200">
{% translate 'Change' %}
</a>
</td>
{% endif %}
{% elif show_changelinks %}
<td class="{% if not forloop.last %}border-b dark:border-gray-800{% endif %} p-3 text-right"></td>
{% endif %}
</tr>
{% endfor %}
</table>
</div>
{% endfor %}
{% if model.admin_url and show_changelinks %}
{% if model.view_only %}
<a href="{{ model.admin_url }}" class="viewlink block leading-none text-gray-400 transition-colors hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200" title="{% translate 'View' %} ">
<span class="material-symbols-outlined">visibility</span>
</a>
{% else %}
<a href="{{ model.admin_url }}" class="changelink block leading-none text-gray-400 transition-colors hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200" title="{% translate 'Change' %}">
<span class="material-symbols-outlined">edit_square</span>
</a>
{% endif %}
{% elif show_changelinks %}
{% endif %}
</div>
</td>

</tr>
{% endfor %}
</table>
</div>
</div>
{% endfor %}
{% else %}
<p>{% translate 'You don’t have permission to view or edit anything.' %}</p>
<p>
{% translate 'You don’t have permission to view or edit anything.' %}
</p>
{% endif %}
12 changes: 6 additions & 6 deletions src/unfold/templates/unfold/helpers/history.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
{% get_admin_log 10 as admin_log for_user user %}

{% if admin_log %}
<div id="content-related" class="lg: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">
<div id="content-related" class="lg:w-96">
<div id="recent-actions-module" class="module bg-gray-50 rounded-md p-3 dark:bg-gray-800">
<h2 class="mb-3 font-semibold text-gray-700 text-sm dark:text-gray-200">
{% translate 'Recent actions' %}
</h2>

<ul class="actionlist bg-gray-50 rounded-md p-3 dark:bg-gray-800">
<ul class="actionlist">
{% 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">
<div class="mb-3 text-gray-500 overflow-hidden text-ellipsis text-sm whitespace-nowrap dark:text-gray-200">
<li class="{% if entry.is_addition %}addlink{% endif %}{% if entry.is_change %}changelink{% endif %}{% if entry.is_deletion %}deletelink{% endif %} border border-gray-400/10 bg-white mb-3 p-3 rounded-md shadow-sm last:mb-0 dark:bg-gray-900">
<div class="mb-3 text-gray-700 overflow-hidden text-ellipsis text-sm whitespace-nowrap dark:text-gray-200">
{% if entry.is_deletion or not entry.get_admin_url %}
{{ entry.object_repr }}
{% else %}
Expand Down

0 comments on commit 7e5a575

Please sign in to comment.