Skip to content

Commit 5ee1041

Browse files
authored
feat: actions icons (#1070)
1 parent 72f0b3c commit 5ee1041

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

src/unfold/templates/admin/submit_line.html

+7-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@
1212
{% endif %}
1313

1414
{% for action in actions_submit_line %}
15-
<button type="submit" {% if not action.attrs.name %}name="{{ action.action_name }}"{% endif %} class="border border-base-200 font-medium px-3 py-2 rounded transition-all w-full hover:bg-base-50 lg:w-auto dark:border-base-700 dark:hover:text-base-200 dark:hover:bg-base-900" {% include "unfold/helpers/attrs.html" with attrs=action.attrs %}>
15+
<button type="submit" {% if not action.attrs.name %}name="{{ action.action_name }}"{% endif %} class="border border-base-200 flex font-medium gap-2 items-center px-3 py-2 rounded transition-all w-full hover:bg-base-50 lg:w-auto dark:border-base-700 dark:hover:text-base-200 dark:hover:bg-base-900" {% include "unfold/helpers/attrs.html" with attrs=action.attrs %}>
16+
{% if action.icon %}
17+
<span class="material-symbols-outlined">
18+
{{ action.icon }}
19+
</span>
20+
{% endif %}
21+
1622
{{ action.description }}
1723
</button>
1824
{% endfor %}

src/unfold/templates/unfold/helpers/actions_row.html

+11-3
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,18 @@
1111
</span>
1212

1313
<template x-teleport="body">
14-
<nav x-anchor.bottom-end.offset.4="$refs.rowDropdown{{ action_id }}" class="bg-white border flex flex-col leading-none py-1 rounded shadow-lg text-sm top-7 z-50 w-48 dark:bg-base-800 dark:border-base-700" x-cloak x-show="openActionsId{{ action_id }}" x-transition x-on:click.outside="openActionsId{{ action_id }} = false">
14+
<nav x-anchor.bottom-end.offset.4="$refs.rowDropdown{{ action_id }}" class="bg-white border flex flex-col py-1 rounded shadow-lg text-sm top-7 z-50 w-48 dark:bg-base-800 dark:border-base-700" x-cloak x-show="openActionsId{{ action_id }}" x-transition x-on:click.outside="openActionsId{{ action_id }} = false">
1515
{% for action in actions %}
16-
<a href="{% url action.raw_path instance_pk %}" class="mx-1 px-3 py-2 rounded truncate hover:bg-base-100 dark:hover:bg-base-700 dark:hover:text-base-200"{% for attr_name, attr_value in action.attrs.items %} {{ attr_name }}="{{ attr_value }}"{% endfor %}>
17-
{{ action.title }}
16+
<a href="{% url action.raw_path instance_pk %}" class="flex items-center gap-2 mx-1 px-3 py-2 max-h-[30px] rounded hover:bg-base-100 dark:hover:bg-base-700 dark:hover:text-base-200"{% for attr_name, attr_value in action.attrs.items %} {{ attr_name }}="{{ attr_value }}"{% endfor %}>
17+
{% if action.icon %}
18+
<span class="material-symbols-outlined">
19+
{{ action.icon }}
20+
</span>
21+
{% endif %}
22+
23+
<span class="grow truncate">
24+
{{ action.title }}
25+
</span>
1826
</a>
1927
{% endfor %}
2028
</nav>

0 commit comments

Comments
 (0)