Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/unfold/static/unfold/css/styles.css

Large diffs are not rendered by default.

16 changes: 15 additions & 1 deletion src/unfold/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,21 @@ table tr.selected th {
}

.timezonewarning {
@apply mt-2 text-gray-500 text-xs w-full;
@apply absolute block items-center right-20 top-2.5 text-gray-500 truncate;
font-size: 0;
}

.timezonewarning:hover {
@apply bg-white bottom-px leading-9 left-px right-px px-3 rounded-md text-xs top-px dark:bg-gray-900;
}

.timezonewarning:hover:before {
@apply hidden mr-2;
}

.timezonewarning:before {
@apply block cursor-pointer items-center justify-center material-symbols-outlined text-base text-center text-red-600 dark:border-gray-700;
content: "warning";
}

/*******************************************************
Expand Down
4 changes: 2 additions & 2 deletions src/unfold/templates/admin/edit_inline/tabular.html
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ <h2 class="bg-gray-100 border border-transparent font-semibold mb-6 px-4 py-3 ro
{% with is_last_col=forloop.last %}
{% for field in line %}
{% if field.is_readonly or not field.field.is_hidden %}
<td{% if field.field.name %} class="field-{{ field.field.name }}{% if field.field.errors|length > 0 %} errors{% endif %}{% if inline_admin_form.original %} p-3 lg:py-3{% else %} py-3{% endif %}{% if field.is_checkbox %} align-middle{% else %} align-top{% endif %} {% if is_last_row and not inline_admin_formset.has_add_permission %}{% if is_last_col %}border-0 {% else %}border-b lg:border-0{% endif %}{% else %}border-b{% endif %} border-gray-200 flex items-center before:capitalize before:content-[attr(data-label)] before:mr-auto before:text-gray-500 before:w-72 lg:before:hidden font-normal px-3 text-left text-sm lg:table-cell dark:border-gray-800 {% if field.field.is_hidden %} !hidden{% endif %}"{% endif %} data-label="{{ field.field.label }}">
<td{% if field.field.name %} class="field-{{ field.field.name }} group field-tabular {% if field.field.errors|length > 0 %} errors{% endif %}{% if inline_admin_form.original %} p-3 lg:py-3{% else %} py-3{% endif %}{% if field.is_checkbox %} align-middle{% else %} align-top{% endif %} {% if is_last_row and not inline_admin_formset.has_add_permission %}{% if is_last_col %}border-0 {% else %}border-b lg:border-0{% endif %}{% else %}border-b{% endif %} border-gray-200 flex items-center before:capitalize before:content-[attr(data-label)] before:mr-auto before:text-gray-500 before:pr-4 lg:before:hidden font-normal px-3 text-left text-sm lg:table-cell dark:border-gray-800 {% if field.field.is_hidden %} !hidden{% endif %}"{% endif %} data-label="{{ field.field.label }}">
{% if field.is_readonly %}
{% include "unfold/helpers/field_readonly_value.html" with tabular=1 %}
{% else %}
Expand All @@ -132,7 +132,7 @@ <h2 class="bg-gray-100 border border-transparent font-semibold mb-6 px-4 py-3 ro
{% endfor %}

{% if inline_admin_formset.formset.can_delete and inline_admin_formset.has_delete_permission %}
<td class="delete {% if inline_admin_form.original %}p-3 lg:py-3{% else %}py-3{% endif %} text-left font-normal px-3 text-sm text-red-600 border-b border-gray-200 flex items-center before:capitalize before:content-[attr(data-label)] before:mr-auto before:text-gray-500 before:w-72 lg:before:hidden font-normal px-3 text-sm lg:align-top lg:table-cell lg:underline lg:w-px dark:border-gray-800" data-label="{% trans "Remove" %}">
<td class="delete {% if inline_admin_form.original %}p-3 lg:py-3{% else %}py-3{% endif %} text-left text-red-600 border-b border-gray-200 flex items-center before:capitalize before:content-[attr(data-label)] before:mr-auto before:text-gray-500 before:pr-4 lg:before:hidden font-normal px-3 text-sm lg:align-top lg:table-cell lg:underline lg:w-px dark:border-gray-800" data-label="{% trans "Remove" %}">
{% if inline_admin_form.original %}
<div class="flex flex-row lg:mt-3">
<div class="ml-auto">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="flex flex-row">
<div class="flex flex-row flex-grow">
{% include 'django/forms/widgets/input.html' %}

{% if related_url %}
Expand Down
14 changes: 7 additions & 7 deletions src/unfold/templates/unfold/widgets/split_datetime.html
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
<div class="datetime flex flex-col gap-2 max-w-2xl lg:flex-row group-[.field-row]:flex-row group-[.field-row]:items-center">
<div class="basis-1/2 flex flex-col flex-wrap mb-4 lg:mb-0 group-[.field-row]:flex-row group-[.field-row]:gap-2">
<div class="font-medium mb-2 text-gray-500 text-sm dark:text-gray-400 group-[.field-row]:mb-0 group-[.field-row]:flex group-[.field-row]:items-center">
<div class="datetime flex flex-col gap-2 max-w-2xl lg:flex-row lg:group-[.field-row]:flex-row lg:group-[.field-row]:items-center lg:group-[.field-tabular]:flex-row lg:group-[.field-tabular]:items-center">
<div class="basis-1/2 flex flex-col lg:group-[.field-row]:flex-row group-[.field-row]:gap-2 lg:group-[.field-tabular]:flex-row group-[.field-tabular]:gap-2">
<div class="font-medium mb-2 text-gray-500 text-sm dark:text-gray-400 group-[.field-row]:mb-0 group-[.field-row]:flex group-[.field-row]:items-center group-[.field-tabular]:mb-0 group-[.field-tabular]:flex group-[.field-tabular]:items-center">
{{ date_label }}
</div>

{% with widget=widget.subwidgets.0 %}
<div class="flex flex-col relative group-[.field-row]:flex-grow">
<div class="flex flex-col min-w-52 relative group-[.field-row]:flex-grow group-[.field-tabular]:flex-grow">
{% include widget.template_name %}
</div>
{% endwith %}
</div>

<div class="basis-1/2 flex flex-col flex-wrap lg:ml-auto mt-3 md:mt-0 group-[.field-row]:flex-row group-[.field-row]:gap-2">
<div class="font-medium mb-2 text-gray-500 text-sm dark:text-gray-400 group-[.field-row]:mb-0 group-[.field-row]:flex group-[.field-row]:items-center">
<div class="basis-1/2 flex flex-col lg:ml-auto md:mt-0 lg:group-[.field-row]:flex-row group-[.field-row]:gap-2 lg:group-[.field-tabular]:flex-row group-[.field-tabular]:gap-2">
<div class="font-medium mb-2 text-gray-500 text-sm dark:text-gray-400 group-[.field-row]:mb-0 group-[.field-row]:flex group-[.field-row]:items-center group-[.field-tabular]:mb-0 group-[.field-tabular]:flex group-[.field-tabular]:items-center">
{{ time_label }}
</div>

{% with widget=widget.subwidgets.1 %}
<div class="flex flex-col relative group-[.field-row]:flex-grow">
<div class="flex flex-col min-w-52 relative group-[.field-row]:flex-grow group-[.field-tabular]:flex-grow">
{% include widget.template_name %}
</div>
{% endwith %}
Expand Down
11 changes: 7 additions & 4 deletions src/unfold/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"border",
"bg-white",
"font-medium",
"min-w-20",
"rounded-md",
"shadow-sm",
"text-gray-500",
Expand Down Expand Up @@ -78,6 +79,8 @@

INPUT_CLASSES = [*BASE_INPUT_CLASSES, "max-w-2xl"]

DATETIME_CLASSES = [*BASE_INPUT_CLASSES, "min-w-52"]

COLOR_CLASSES = [*BASE_CLASSES, "h-9.5", "px-2", "py-2", "w-32"]

INPUT_CLASSES_READONLY = [*BASE_INPUT_CLASSES, "bg-gray-50"]
Expand Down Expand Up @@ -322,7 +325,7 @@ def __init__(
self, attrs: Optional[Dict[str, Any]] = None, format: Optional[str] = None
) -> None:
attrs = {
"class": "vDateField " + " ".join(INPUT_CLASSES),
"class": "vDateField " + " ".join(DATETIME_CLASSES),
"size": "10",
**(attrs or {}),
}
Expand All @@ -336,7 +339,7 @@ def __init__(
self, attrs: Optional[Dict[str, Any]] = None, format: Optional[str] = None
) -> None:
attrs = {
"class": "vDateField " + " ".join(INPUT_CLASSES),
"class": "vDateField " + " ".join(DATETIME_CLASSES),
"size": "10",
**(attrs or {}),
}
Expand All @@ -348,7 +351,7 @@ def __init__(
self, attrs: Optional[Dict[str, Any]] = None, format: Optional[str] = None
) -> None:
attrs = {
"class": "vTimeField " + " ".join(INPUT_CLASSES),
"class": "vTimeField " + " ".join(DATETIME_CLASSES),
"size": "8",
**(attrs or {}),
}
Expand All @@ -362,7 +365,7 @@ def __init__(
self, attrs: Optional[Dict[str, Any]] = None, format: Optional[str] = None
) -> None:
attrs = {
"class": "vTimeField " + " ".join(INPUT_CLASSES),
"class": "vTimeField " + " ".join(DATETIME_CLASSES),
"size": "8",
**(attrs or {}),
}
Expand Down