Add sticky_pagination field. Handle top submit row. Update Admin section

pull/110/head
theSinner 2021-02-02 06:30:39 +03:30
parent 41e50e358a
commit 6edd4bb7af
5 changed files with 28 additions and 15 deletions

View File

@ -110,6 +110,13 @@ class ThemeAdmin(admin.ModelAdmin):
'related_modal_close_button_visible', 'related_modal_close_button_visible',
) )
}), }),
(_('Form Controls'), {
'classes': ('wide', ),
'fields': (
'form_submit_sticky',
'form_pagination_sticky',
)
}),
(_('List Filter'), { (_('List Filter'), {
'classes': ('wide', ), 'classes': ('wide', ),
'fields': ( 'fields': (
@ -121,10 +128,6 @@ class ThemeAdmin(admin.ModelAdmin):
'classes': ('wide', ), 'classes': ('wide', ),
'fields': ('recent_actions_visible', ) 'fields': ('recent_actions_visible', )
}), }),
(_('Action Buttons'), {
'classes': ('wide', ),
'fields': ('action_buttons_sticky', )
}),
) )
save_on_top = True save_on_top = True

View File

@ -1,4 +1,4 @@
# Generated by Django 3.1.5 on 2021-01-22 11:04 # Generated by Django 3.1.5 on 2021-01-29 20:29
from django.db import migrations, models from django.db import migrations, models
@ -12,7 +12,12 @@ class Migration(migrations.Migration):
operations = [ operations = [
migrations.AddField( migrations.AddField(
model_name='theme', model_name='theme',
name='action_buttons_sticky', name='form_pagination_sticky',
field=models.BooleanField(default=False, verbose_name='sticky position'), field=models.BooleanField(default=False, verbose_name='sticky pagination'),
),
migrations.AddField(
model_name='theme',
name='form_submit_sticky',
field=models.BooleanField(default=False, verbose_name='sticky submit'),
), ),
] ]

View File

@ -299,9 +299,13 @@ class Theme(models.Model):
default=True, default=True,
verbose_name=_('visible')) verbose_name=_('visible'))
action_buttons_sticky = models.BooleanField( form_submit_sticky = models.BooleanField(
default=False, default=False,
verbose_name=_('sticky position')) verbose_name=_('sticky submit'))
form_pagination_sticky = models.BooleanField(
default=False,
verbose_name=_('sticky pagination'))
def set_active(self): def set_active(self):
self.active = True self.active = True

View File

@ -52,7 +52,8 @@ https://github.com/fabiocaccamo/django-admin-interface
{% include "admin_interface/related-modal.html" %} {% include "admin_interface/related-modal.html" %}
{% endblock %} {% endblock %}
{% block bodyclass %}admin-interface flat-theme {% get_admin_interface_theme as theme %}{% if theme.name %}{{ theme.name|slugify }}-theme{% endif %}{% if theme.action_buttons_sticky %} sticky-action-buttons {% endif %}{% endblock %} {% block bodyclass %}admin-interface flat-theme {% get_admin_interface_theme as theme %}{% if theme.name %}{{
theme.name|slugify }}-theme{% endif %}{% if theme.form_submit_sticky %} sticky-submit {% endif %}{% endblock %}
{% block branding %} {% block branding %}
{% get_admin_interface_theme as theme %} {% get_admin_interface_theme as theme %}

View File

@ -412,11 +412,11 @@ body.admin-interface .paginator a.showall:visited {
max-width: 100%; max-width: 100%;
} }
.admin-interface.sticky-action-buttons.change-form:not(.popup) #main > #nav-sidebar + .content { .admin-interface.sticky-submit.change-form:not(.popup) #main > #nav-sidebar + .content {
padding-bottom: 4rem; padding-bottom: 4rem;
} }
.admin-interface.sticky-action-buttons.change-form:not(.popup) #main > #nav-sidebar + .content .submit-row { .admin-interface.sticky-submit.change-form:not(.popup) #main > #nav-sidebar + .content form fieldset + .submit-row {
width: 100%; width: 100%;
max-width: calc(100% - 28px); max-width: calc(100% - 28px);
bottom: 0; bottom: 0;
@ -463,7 +463,7 @@ body.admin-interface .paginator a.showall:visited {
max-width: calc(100% - 360px); max-width: calc(100% - 360px);
} }
.admin-interface.sticky-action-buttons.change-form:not(.popup) #main.shifted > #nav-sidebar + .content .submit-row { .admin-interface.sticky-submit.change-form:not(.popup) #main.shifted > #nav-sidebar + .content .submit-row {
max-width: calc(100% - 388px); max-width: calc(100% - 388px);
right: 0; right: 0;
bottom: 0; bottom: 0;
@ -557,11 +557,11 @@ body.admin-interface .paginator a.showall:visited {
margin-top: 5px; margin-top: 5px;
} }
.admin-interface.sticky-action-buttons.change-form:not(.popup) #main > #nav-sidebar + .content { .admin-interface.sticky-submit.change-form:not(.popup) #main > #nav-sidebar + .content {
padding-bottom: 12rem; padding-bottom: 12rem;
} }
.admin-interface.sticky-action-buttons.change-form:not(.popup) #main > #nav-sidebar + .content .submit-row { .admin-interface.sticky-submit.change-form:not(.popup) #main > #nav-sidebar + .content .submit-row {
max-width: calc(100% - 20px); max-width: calc(100% - 20px);
} }
} }