Skip to content

Commit

Permalink
feat: changelist fullwidth option (#573)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasvinclav committed Jul 12, 2024
1 parent 3e9b3b1 commit debf8b5
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,9 @@ class CustomAdminClass(ModelAdmin):
# Display submit button in filters
list_filter_submit = False

# Display changelist in fullwidth
list_fullwidth = False

# Position horizontal scrollbar in changelist at the top
list_horizontal_scrollbar_top = False

Expand Down
1 change: 1 addition & 0 deletions src/unfold/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ class ModelAdmin(ModelAdminMixin, BaseModelAdmin):
add_fieldsets = ()
list_horizontal_scrollbar_top = False
list_filter_submit = False
list_fullwidth = False
compressed_fields = False
readonly_preprocess_fields = {}
checks_class = UnfoldModelAdminChecks
Expand Down
2 changes: 1 addition & 1 deletion src/unfold/templates/admin/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
{% endblock messages %}

<div class="px-4 pb-12 lg:px-12">
<div id="content" class="container mx-auto {% block coltype %}colM{% endblock %}">
<div id="content" class="{% if not cl.model_admin.list_filter_submit %}container{% endif %} mx-auto {% block coltype %}colM{% endblock %}">
{% if cl %}
{% tab_list "changelist" cl.opts %}
{% elif opts %}
Expand Down
2 changes: 1 addition & 1 deletion src/unfold/templates/admin/change_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
{% if not is_popup %}
{% block breadcrumbs %}
<div class="px-4 lg:px-12">
<div class="container mb-6 mx-auto -my-3 lg:mb-12">
<div class="{% if not cl.model_admin.list_filter_submit %}container{% endif %} mb-6 mx-auto -my-3 lg:mb-12">
<ul class="flex">
{% url 'admin:index' as link %}
{% trans 'Home' as name %}
Expand Down
2 changes: 1 addition & 1 deletion src/unfold/templates/unfold/helpers/header.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% if not is_popup %}
{% block header %}
<div class="border-b border-gray-200 mb-6 px-4 lg:px-12 dark:border-gray-800">
<div class="container flex items-center h-16 mx-auto py-4">
<div class="{% if not cl.model_admin.list_filter_submit %}container{% endif %} flex items-center h-16 mx-auto py-4">
<div id="header-inner" class="flex items-center w-full">
<div class="flex items-center w-full">
{% block usertools %}
Expand Down

0 comments on commit debf8b5

Please sign in to comment.