Skip to content

Commit 7e5a575

Browse files
authored
feat: redesigned default dashboard (#310)
1 parent f1e4dd0 commit 7e5a575

File tree

4 files changed

+61
-61
lines changed

4 files changed

+61
-61
lines changed

src/unfold/static/unfold/css/styles.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/unfold/templates/admin/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ <h1 id="site-name">
1515
{% endblock %}
1616

1717
{% block content %}
18-
<div class="flex flex-col gap-8 lg:flex-row">
18+
<div class="flex flex-col lg:flex-row lg:gap-8">
1919
<div class="flex-grow">
2020
{% include "unfold/helpers/app_list_default.html" %}
2121
</div>
Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,61 @@
11
{% load i18n %}
22

33
{% if app_list %}
4-
{% for app in app_list %}
5-
<div class="app-{{ app.app_label }} module{% if app.app_url in request.path %} current-app{% endif %}">
6-
<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 %}">
7-
<caption class="font-semibold mb-4 text-gray-700 text-left dark:text-gray-200">
8-
<a href="{{ app.app_url }}" class="section" title="{% blocktranslate with name=app.name %}Models in the {{ name }} application{% endblocktranslate %}">
9-
{{ app.name }}
10-
</a>
11-
</caption>
4+
{% for app in app_list %}
5+
<div class="app-{{ app.app_label }} module{% if app.app_url in request.path %} current-app{% endif %}">
6+
<div class="bg-gray-50 mb-6 rounded-md p-3 dark:bg-gray-800">
7+
<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">
8+
<caption class="font-semibold mb-3 text-gray-700 text-left dark:text-gray-200">
9+
<a href="{{ app.app_url }}" class="section" title="{% blocktranslate with name=app.name %}Models in the {{ name }} application{% endblocktranslate %}">
10+
{{ app.name }}
11+
</a>
12+
</caption>
1213

13-
{% for model in app.models %}
14-
<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]' %}">
15-
{% if model.admin_url %}
16-
<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 %}">
17-
<a href="{{ model.admin_url }}"{% if model.admin_url in request.path %} aria-current="page"{% endif %}>
18-
{{ model.name }}
19-
</a>
20-
</th>
21-
{% else %}
22-
<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 %}">
23-
{{ model.name }}
24-
</th>
25-
{% endif %}
14+
{% for model in app.models %}
15+
<tr class="bg-white dark:bg-gray-900 model-{{ model.object_name|lower }}{% if model.admin_url in request.path %} current-model{% endif %}">
16+
{% if model.admin_url %}
17+
<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 %}">
18+
<a href="{{ model.admin_url }}"{% if model.admin_url in request.path %} aria-current="page"{% endif %}>
19+
{{ model.name }}
20+
</a>
21+
</th>
22+
{% else %}
23+
<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 %}">
24+
{{ model.name }}
25+
</th>
26+
{% endif %}
2627

27-
{% if model.add_url %}
28-
<td class="{% if not forloop.last %}border-b dark:border-gray-800{% endif %} p-3 text-right">
29-
<a href="{{ model.add_url }}" class="addlink text-gray-500 transition-all underline dark:text-gray-400 dark:hover:text-gray-200">
30-
{% translate 'Add' %}
31-
</a>
32-
</td>
33-
{% else %}
34-
<td class="{% if not forloop.last %}border-b dark:border-gray-800{% endif %} p-3 text-right"></td>
35-
{% endif %}
28+
<td class="{% if not forloop.last %}border-b border-gray-100 dark:border-gray-800{% endif %} p-3 text-right">
29+
<div class="flex flex-row items-center ml-auto gap-4 justify-end">
30+
{% if model.add_url %}
31+
<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' %}">
32+
<span class="material-symbols-outlined">add</span>
33+
</a>
34+
{% endif %}
3635

37-
{% if model.admin_url and show_changelinks %}
38-
{% if model.view_only %}
39-
<td class="{% if not forloop.last %}border-b dark:border-gray-800{% endif %} p-3 text-right">
40-
<a href="{{ model.admin_url }}" class="viewlink text-gray-500 transition-all underline dark:text-gray-400 dark:hover:text-gray-200">
41-
{% translate 'View' %}
42-
</a>
43-
</td>
44-
{% else %}
45-
<td class="{% if not forloop.last %}border-b dark:border-gray-800{% endif %} p-3 text-right">
46-
<a href="{{ model.admin_url }}" class="changelink text-gray-500 transition-all underline dark:text-gray-400 dark:hover:text-gray-200">
47-
{% translate 'Change' %}
48-
</a>
49-
</td>
50-
{% endif %}
51-
{% elif show_changelinks %}
52-
<td class="{% if not forloop.last %}border-b dark:border-gray-800{% endif %} p-3 text-right"></td>
53-
{% endif %}
54-
</tr>
55-
{% endfor %}
56-
</table>
57-
</div>
58-
{% endfor %}
36+
{% if model.admin_url and show_changelinks %}
37+
{% if model.view_only %}
38+
<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' %} ">
39+
<span class="material-symbols-outlined">visibility</span>
40+
</a>
41+
{% else %}
42+
<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' %}">
43+
<span class="material-symbols-outlined">edit_square</span>
44+
</a>
45+
{% endif %}
46+
{% elif show_changelinks %}
47+
{% endif %}
48+
</div>
49+
</td>
50+
51+
</tr>
52+
{% endfor %}
53+
</table>
54+
</div>
55+
</div>
56+
{% endfor %}
5957
{% else %}
60-
<p>{% translate 'You don’t have permission to view or edit anything.' %}</p>
58+
<p>
59+
{% translate 'You don’t have permission to view or edit anything.' %}
60+
</p>
6161
{% endif %}

src/unfold/templates/unfold/helpers/history.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
{% get_admin_log 10 as admin_log for_user user %}
44

55
{% if admin_log %}
6-
<div id="content-related" class="lg:w-4/12">
7-
<div class="module" id="recent-actions-module">
8-
<h2 class="mb-4 font-semibold text-gray-700 text-sm dark:text-gray-200">
6+
<div id="content-related" class="lg:w-96">
7+
<div id="recent-actions-module" class="module bg-gray-50 rounded-md p-3 dark:bg-gray-800">
8+
<h2 class="mb-3 font-semibold text-gray-700 text-sm dark:text-gray-200">
99
{% translate 'Recent actions' %}
1010
</h2>
1111

12-
<ul class="actionlist bg-gray-50 rounded-md p-3 dark:bg-gray-800">
12+
<ul class="actionlist">
1313
{% for entry in admin_log %}
14-
<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">
15-
<div class="mb-3 text-gray-500 overflow-hidden text-ellipsis text-sm whitespace-nowrap dark:text-gray-200">
14+
<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">
15+
<div class="mb-3 text-gray-700 overflow-hidden text-ellipsis text-sm whitespace-nowrap dark:text-gray-200">
1616
{% if entry.is_deletion or not entry.get_admin_url %}
1717
{{ entry.object_repr }}
1818
{% else %}

0 commit comments

Comments
 (0)