Compare commits

...

7 Commits

Author SHA1 Message Date
Fabio Caccamo 2baed25204 Updated version and CHANGELOG. 2021-02-03 14:35:45 +01:00
Fabio Caccamo 3f5a3f9ded Updated README. 2021-02-03 14:35:25 +01:00
Fabio Caccamo 6189a7bbdb Renamed migration. 2021-02-03 14:35:10 +01:00
Amir Ajorloo d1cda34a52 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-width
2021-02-03 10:26:07 +01:00
Fabio Caccamo fdbacba4bb Added support to 4-digit language code in language chooser. #111 2021-01-29 15:57:39 +01:00
Fabio Caccamo 5c56f3a2db Added theme css variables. 2021-01-11 15:34:58 +01:00
Fabio Caccamo 17bb35c559 Fixed app module section link hover color. 2021-01-11 15:34:42 +01:00
10 changed files with 143 additions and 4 deletions
+6
View File
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.15.0](https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.15.0) - 2021-02-03
- Added sticky form controls and pagination options. #110
- Added support to 4-digit language code in language chooser. #111
- Added theme css variables for third-party libraries.
- Fixed app module section link hover color.
## [0.14.2](https://github.com/fabiocaccamo/django-admin-interface/releases/tag/0.14.2) - 2021-01-04
- Fixed tabular inline scroll bar. #101
- Fixed module header selected link color. #102
+27 -1
View File
@@ -77,7 +77,7 @@ Run ``python manage.py loaddata admin_interface_theme_foundation.json``
Run ``python manage.py loaddata admin_interface_theme_uswds.json``
### Add more themes
You can add a theme you've created through the admin to this repository by [sending us a PR](http://makeapullrequest.com/). Here are the steps to follow to add :
You can add a theme you've created through the admin to this repository by [sending us a PR](http://makeapullrequest.com/). Here are the steps to follow to add:
1. Export your exact theme as fixture using the `dumpdata` admin command:
``python manage.py dumpdata admin_interface.Theme --indent 4 -o admin_interface_theme_{{name}}.json --pks=N``
@@ -88,6 +88,32 @@ You can add a theme you've created through the admin to this repository by [send
4. Edit the section above to document your theme.
### Add theme support to third-party libraries
You can add **theme support to existing third-party libraries** using the following **css variables**:
- `--admin-interface-title-color`
- `--admin-interface-logo-color`
- `--admin-interface-env-color`
- `--admin-interface-header-background-color:`
- `--admin-interface-header-text-color`
- `--admin-interface-header-link-color`
- `--admin-interface-header-link_hover-color`
- `--admin-interface-module-background-color`
- `--admin-interface-module-text-color`
- `--admin-interface-module-link-color`
- `--admin-interface-module-link-hover-color`
- `--admin-interface-generic-link-color`
- `--admin-interface-generic-link-hover-color`
- `--admin-interface-save-button-background-color`
- `--admin-interface-save-button-background-hover-color`
- `--admin-interface-save-button-text-color`
- `--admin-interface-delete-button-background-color`
- `--admin-interface-delete-button-background-hover-color`
- `--admin-interface-delete-button-text-color`
- `--admin-interface-related-modal-background-color`
- `--admin-interface-related-modal-background-opacity`
## Screenshots
###### Admin login
![django-admin-interface_login](https://cloud.githubusercontent.com/assets/1035294/11240233/55c8d4ba-8df1-11e5-9568-00fdc987ede8.gif)
+7
View File
@@ -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'),
),
]
+7
View File
@@ -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);
}
}
@@ -1,3 +1,27 @@
:root {
--admin-interface-title-color: {{ theme.title_color }};
--admin-interface-logo-color: {{ theme.logo_color }};
--admin-interface-env-color: {{ theme.env_color }};
--admin-interface-header-background-color: {{ theme.css_header_background_color }};
--admin-interface-header-text-color: {{ theme.css_header_text_color }};
--admin-interface-header-link-color: {{ theme.css_header_link_color }};
--admin-interface-header-link_hover-color: {{ theme.css_header_link_hover_color }};
--admin-interface-module-background-color: {{ theme.css_module_background_color }};
--admin-interface-module-text-color: {{ theme.css_module_text_color }};
--admin-interface-module-link-color: {{ theme.css_module_link_color }};
--admin-interface-module-link-hover-color: {{ theme.css_module_link_hover_color }};
--admin-interface-generic-link-color: {{ theme.css_generic_link_color }};
--admin-interface-generic-link-hover-color: {{ theme.css_generic_link_hover_color }};
--admin-interface-save-button-background-color: {{ theme.css_save_button_background_color }};
--admin-interface-save-button-background-hover-color: {{ theme.css_save_button_background_hover_color }};
--admin-interface-save-button-text-color: {{ theme.css_save_button_text_color }};
--admin-interface-delete-button-background-color: {{ theme.css_delete_button_background_color }};
--admin-interface-delete-button-background-hover-color: {{ theme.css_delete_button_background_hover_color }};
--admin-interface-delete-button-text-color: {{ theme.css_delete_button_text_color }};
--admin-interface-related-modal-background-color: {{ theme.related_modal_background_color }};
--admin-interface-related-modal-background-opacity: {{ theme.related_modal_background_opacity }};
}
.admin-interface #header {
background: {{ theme.css_header_background_color }};
color: {{ theme.css_header_text_color }};
@@ -106,6 +130,11 @@
font-weight: normal;
}
.admin-interface #nav-sidebar .current-app .section:focus,
.admin-interface #nav-sidebar .current-app .section:hover {
color: {{ theme.css_module_link_hover_color }};
}
.admin-interface #nav-sidebar .current-model {
background: #FFFFCC;
}
@@ -42,7 +42,7 @@ def get_admin_interface_languages(context):
if not request:
return None
full_path = request.get_full_path()
admin_nolang_url = re.sub(r'^\/([\w]{2})([\-\_]{1}[\w]{2})?\/', '/', full_path)
admin_nolang_url = re.sub(r'^\/([\w]{2})([\-\_]{1}[\w]{2,4})?\/', '/', full_path)
if admin_nolang_url == full_path:
# ImproperlyConfigured - must include admin urls using i18n_patterns:
# from django.conf.urls.i18n import i18n_patterns
+1 -1
View File
@@ -1,3 +1,3 @@
# -*- coding: utf-8 -*-
__version__ = '0.14.2'
__version__ = '0.15.0'