Add sticky action button option. (#110)
* Add sticky action button option. * Add sticky_pagination field. Handle top submit row. Update Admin section * Add sticky-pagination styles. Fix trailing whitespace issue in models. * Update sticky pagination max-widthpull/120/head
parent
fdbacba4bb
commit
d1cda34a52
|
|
@ -110,6 +110,13 @@ class ThemeAdmin(admin.ModelAdmin):
|
|||
'related_modal_close_button_visible',
|
||||
)
|
||||
}),
|
||||
(_('Form Controls'), {
|
||||
'classes': ('wide', ),
|
||||
'fields': (
|
||||
'form_submit_sticky',
|
||||
'form_pagination_sticky',
|
||||
)
|
||||
}),
|
||||
(_('List Filter'), {
|
||||
'classes': ('wide', ),
|
||||
'fields': (
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
# Generated by Django 3.1.5 on 2021-01-29 20:29
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('admin_interface', '0018_theme_list_filter_sticky'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='theme',
|
||||
name='form_pagination_sticky',
|
||||
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'),
|
||||
),
|
||||
]
|
||||
|
|
@ -299,6 +299,13 @@ class Theme(models.Model):
|
|||
default=True,
|
||||
verbose_name=_('visible'))
|
||||
|
||||
form_submit_sticky = models.BooleanField(
|
||||
default=False,
|
||||
verbose_name=_('sticky submit'))
|
||||
form_pagination_sticky = models.BooleanField(
|
||||
default=False,
|
||||
verbose_name=_('sticky pagination'))
|
||||
|
||||
def set_active(self):
|
||||
self.active = True
|
||||
self.save()
|
||||
|
|
|
|||
|
|
@ -52,7 +52,8 @@ https://github.com/fabiocaccamo/django-admin-interface
|
|||
{% include "admin_interface/related-modal.html" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block bodyclass %}admin-interface flat-theme {% get_admin_interface_theme as theme %}{% if theme.name %}{{ theme.name|slugify }}-theme{% 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 %}{% if theme.form_pagination_sticky %} sticky-pagination {% endif %}{% endblock %}
|
||||
|
||||
{% block branding %}
|
||||
{% get_admin_interface_theme as theme %}
|
||||
|
|
|
|||
|
|
@ -412,6 +412,25 @@ body.admin-interface .paginator a.showall:visited {
|
|||
max-width: 100%;
|
||||
}
|
||||
|
||||
.admin-interface.sticky-submit.change-form:not(.popup) #main > #nav-sidebar + .content,
|
||||
.admin-interface.sticky-pagination.change-list:not(.popup) #main > #nav-sidebar + .content {
|
||||
padding-bottom: 4rem;
|
||||
}
|
||||
|
||||
.admin-interface.sticky-submit.change-form:not(.popup) #main > #nav-sidebar + .content form fieldset + .submit-row,
|
||||
.admin-interface.sticky-pagination.change-list:not(.popup) #main > #nav-sidebar + .content form .results + .paginator {
|
||||
width: 100%;
|
||||
max-width: calc(100% - 28px);
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
margin-bottom: 0;
|
||||
position: fixed;
|
||||
}
|
||||
|
||||
.admin-interface.sticky-pagination.change-list:not(.popup) #main > #nav-sidebar + .content form .results + .paginator {
|
||||
max-width: calc(100% - 20px);
|
||||
}
|
||||
|
||||
/* hide nav-sidebar below 1280px to prevent horizontal overflow issues */
|
||||
@media (max-width:1279px) {
|
||||
.admin-interface #nav-sidebar,
|
||||
|
|
@ -449,6 +468,17 @@ body.admin-interface .paginator a.showall:visited {
|
|||
.admin-interface.change-form:not(.popup) #main.shifted > #nav-sidebar + .content {
|
||||
max-width: calc(100% - 360px);
|
||||
}
|
||||
|
||||
.admin-interface.sticky-submit.change-form:not(.popup) #main.shifted > #nav-sidebar + .content form fieldset + .submit-row,
|
||||
.admin-interface.sticky-pagination.change-list:not(.popup) #main.shifted > #nav-sidebar + .content form .results + .paginator {
|
||||
max-width: calc(100% - 388px);
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
.admin-interface.sticky-pagination.change-list:not(.popup) #main.shifted > #nav-sidebar + .content form .results + .paginator {
|
||||
max-width: calc(100% - 380px);
|
||||
}
|
||||
}
|
||||
|
||||
/* fixed related widget and select2 */
|
||||
|
|
@ -537,4 +567,14 @@ body.admin-interface .paginator a.showall:visited {
|
|||
.admin-interface .aligned .form-row .file-upload input[type="file"] {
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.admin-interface.sticky-submit.change-form:not(.popup) #main > #nav-sidebar + .content,
|
||||
.admin-interface.sticky-pagination.change-form:not(.popup) #main > #nav-sidebar + .content {
|
||||
padding-bottom: 12rem;
|
||||
}
|
||||
|
||||
.admin-interface.sticky-submit.change-form:not(.popup) #main > #nav-sidebar + .content .submit-row,
|
||||
.admin-interface.sticky-pagination.change-list:not(.popup) #main > #nav-sidebar + .content form .results + .paginator {
|
||||
max-width: calc(100% - 20px);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue