From e29731f3fecb560c4962cd02c2833d418750444e Mon Sep 17 00:00:00 2001 From: Paul Schilling Date: Thu, 8 Feb 2024 11:53:47 +0100 Subject: [PATCH] [#2093] Upgrade django-admin-index to 3.1.0 --- requirements/base.txt | 17 +++- requirements/ci.txt | 9 +- requirements/dev.txt | 9 +- ...059_alter_siteconfigurationpage_options.py | 21 +++++ .../migrations/0062_merge_20240215_1501.py | 13 +++ .../components/anchor-menu/scroll_to_top.js | 4 +- src/open_inwoner/scss/admin/_admin_theme.scss | 9 +- .../scss/admin/_app_overrides.scss | 87 ++++++++----------- src/open_inwoner/urls.py | 1 + 9 files changed, 109 insertions(+), 61 deletions(-) create mode 100644 src/open_inwoner/configurations/migrations/0059_alter_siteconfigurationpage_options.py create mode 100644 src/open_inwoner/configurations/migrations/0062_merge_20240215_1501.py diff --git a/requirements/base.txt b/requirements/base.txt index d3a89bf69a..f04de7a6c1 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -62,7 +62,9 @@ cryptography==41.0.7 # mozilla-django-oidc # pyopenssl css-inline==0.13.0 - # via -r requirements/base.in + # via + # -r requirements/base.in + # mail-editor cssselect2==0.4.1 # via # svglib @@ -77,6 +79,7 @@ diff-match-patch==20200713 django==3.2.23 # via # -r requirements/base.in + # django-admin-index # django-appconf # django-appdata # django-axes @@ -120,7 +123,7 @@ django==3.2.23 # mozilla-django-oidc-db # notifications-api-common # zgw-consumers -django-admin-index==1.5.0 +django-admin-index==3.1.0 # via -r requirements/base.in django-appconf==1.0.5 # via @@ -298,7 +301,9 @@ face==20.1.1 fontawesomefree==6.4.2 # via -r requirements/base.in fonttools[woff]==4.29.1 - # via weasyprint + # via + # fonttools + # weasyprint furl==2.1.3 # via # -r requirements/base.in @@ -341,6 +346,7 @@ lockfile==0.12.2 lxml==4.9.1 # via # django-digid-eherkenning + # mail-editor # maykin-python3-saml # svglib # xmlsec @@ -453,6 +459,7 @@ requests==2.31.0 # django-open-forms-client # django-rosetta # gemma-zds-client + # mail-editor # maykin-python3-saml # messagebird # mozilla-django-oidc @@ -481,7 +488,9 @@ sqlparse==0.4.4 svglib==1.5.1 # via easy-thumbnails tablib[html,ods,xls,xlsx,yaml]==3.1.0 - # via django-import-export + # via + # django-import-export + # tablib tinycss2==1.1.1 # via # -r requirements/base.in diff --git a/requirements/ci.txt b/requirements/ci.txt index 3209ca1bba..8d06d49c41 100644 --- a/requirements/ci.txt +++ b/requirements/ci.txt @@ -122,6 +122,7 @@ css-inline==0.13.0 # via # -c requirements/base.txt # -r requirements/base.txt + # mail-editor cssselect==1.1.0 # via pyquery cssselect2==0.4.1 @@ -148,6 +149,7 @@ django==3.2.23 # via # -c requirements/base.txt # -r requirements/base.txt + # django-admin-index # django-appconf # django-appdata # django-axes @@ -191,7 +193,7 @@ django==3.2.23 # mozilla-django-oidc-db # notifications-api-common # zgw-consumers -django-admin-index==1.5.0 +django-admin-index==3.1.0 # via # -c requirements/base.txt # -r requirements/base.txt @@ -472,6 +474,7 @@ easy-thumbnails[svg]==2.8.5 # -r requirements/base.txt # django-filer # djangocms-picture + # easy-thumbnails ecs-logging==2.1.0 # via # -c requirements/base.txt @@ -515,6 +518,7 @@ fonttools[woff]==4.29.1 # via # -c requirements/base.txt # -r requirements/base.txt + # fonttools # weasyprint freezegun==1.1.0 # via -r requirements/test-tools.in @@ -605,6 +609,7 @@ lxml==4.9.1 # -c requirements/base.txt # -r requirements/base.txt # django-digid-eherkenning + # mail-editor # maykin-python3-saml # pyquery # svglib @@ -834,6 +839,7 @@ requests==2.31.0 # django-open-forms-client # django-rosetta # gemma-zds-client + # mail-editor # maykin-python3-saml # messagebird # mozilla-django-oidc @@ -886,6 +892,7 @@ tablib[html,ods,xls,xlsx,yaml]==3.1.0 # -c requirements/base.txt # -r requirements/base.txt # django-import-export + # tablib tblib==1.7.0 # via -r requirements/test-tools.in text-unidecode==1.3 diff --git a/requirements/dev.txt b/requirements/dev.txt index 892b41dcda..01a58c3155 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -147,6 +147,7 @@ css-inline==0.13.0 # via # -c requirements/ci.txt # -r requirements/ci.txt + # mail-editor cssselect==1.1.0 # via # -c requirements/ci.txt @@ -182,6 +183,7 @@ django==3.2.23 # -c requirements/ci.txt # -r requirements/ci.txt # ddt-api-calls + # django-admin-index # django-appconf # django-appdata # django-axes @@ -228,7 +230,7 @@ django==3.2.23 # mozilla-django-oidc-db # notifications-api-common # zgw-consumers -django-admin-index==1.5.0 +django-admin-index==3.1.0 # via # -c requirements/ci.txt # -r requirements/ci.txt @@ -521,6 +523,7 @@ easy-thumbnails[svg]==2.8.5 # -r requirements/ci.txt # django-filer # djangocms-picture + # easy-thumbnails ecs-logging==2.1.0 # via # -c requirements/ci.txt @@ -580,6 +583,7 @@ fonttools[woff]==4.29.1 # via # -c requirements/ci.txt # -r requirements/ci.txt + # fonttools # weasyprint freezegun==1.1.0 # via @@ -699,6 +703,7 @@ lxml==4.9.1 # -c requirements/ci.txt # -r requirements/ci.txt # django-digid-eherkenning + # mail-editor # maykin-python3-saml # pyquery # svglib @@ -974,6 +979,7 @@ requests==2.31.0 # django-rosetta # gemma-zds-client # locust + # mail-editor # maykin-python3-saml # messagebird # mozilla-django-oidc @@ -1059,6 +1065,7 @@ tablib[html,ods,xls,xlsx,yaml]==3.1.0 # -c requirements/ci.txt # -r requirements/ci.txt # django-import-export + # tablib tblib==1.7.0 # via # -c requirements/ci.txt diff --git a/src/open_inwoner/configurations/migrations/0059_alter_siteconfigurationpage_options.py b/src/open_inwoner/configurations/migrations/0059_alter_siteconfigurationpage_options.py new file mode 100644 index 0000000000..bcb27f5632 --- /dev/null +++ b/src/open_inwoner/configurations/migrations/0059_alter_siteconfigurationpage_options.py @@ -0,0 +1,21 @@ +# Generated by Django 3.2.23 on 2024-02-08 15:13 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("configurations", "0058_siteconfiguration_recipients_email_digest"), + ] + + operations = [ + migrations.AlterModelOptions( + name="siteconfigurationpage", + options={ + "ordering": ("order",), + "verbose_name": "Flatpage in the footer", + "verbose_name_plural": "Flatpages in the footer", + }, + ), + ] diff --git a/src/open_inwoner/configurations/migrations/0062_merge_20240215_1501.py b/src/open_inwoner/configurations/migrations/0062_merge_20240215_1501.py new file mode 100644 index 0000000000..9843b5f8ca --- /dev/null +++ b/src/open_inwoner/configurations/migrations/0062_merge_20240215_1501.py @@ -0,0 +1,13 @@ +# Generated by Django 3.2.23 on 2024-02-15 14:01 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("configurations", "0059_alter_siteconfigurationpage_options"), + ("configurations", "0061_merge_20240214_1308"), + ] + + operations = [] diff --git a/src/open_inwoner/js/components/anchor-menu/scroll_to_top.js b/src/open_inwoner/js/components/anchor-menu/scroll_to_top.js index 1e32c03f82..66ac4a98ac 100644 --- a/src/open_inwoner/js/components/anchor-menu/scroll_to_top.js +++ b/src/open_inwoner/js/components/anchor-menu/scroll_to_top.js @@ -5,7 +5,9 @@ const mybutton = document.getElementById('scroll-anchor') document.addEventListener( 'scroll', (e) => { - if ( + if (!mybutton) { + return + } else if ( document.body.scrollTop > 80 || document.documentElement.scrollTop > 80 ) { diff --git a/src/open_inwoner/scss/admin/_admin_theme.scss b/src/open_inwoner/scss/admin/_admin_theme.scss index aea72e0b28..bc0b63e455 100644 --- a/src/open_inwoner/scss/admin/_admin_theme.scss +++ b/src/open_inwoner/scss/admin/_admin_theme.scss @@ -69,7 +69,6 @@ div.breadcrumbs { color: $color_primary; position: sticky; top: 60px; - z-index: 100000; a { color: $color_dark; @@ -101,9 +100,13 @@ div.breadcrumbs { #content { /* adjusting for django-cms page */ #changelist:not([class~='cms-pagetree-root']) { - display: grid; - grid-template-columns: 1fr 360px; + display: block; + grid-template-columns: 1fr 260px; gap: 16px; + + @media (min-width: 768px) { + display: grid; + } } #toolbar, diff --git a/src/open_inwoner/scss/admin/_app_overrides.scss b/src/open_inwoner/scss/admin/_app_overrides.scss index 1dda5a080f..8ef3f732d9 100644 --- a/src/open_inwoner/scss/admin/_app_overrides.scss +++ b/src/open_inwoner/scss/admin/_app_overrides.scss @@ -8,72 +8,57 @@ /** * DJANGO ADMIN INDEX */ - -.dropdown-menu, -div#container .dropdown-menu { - /* Override for Environment banner */ - top: 48px; - /* Added to attach body */ - border-bottom: 8px solid $color_secondary; +body { + --djai-tab-bg: #{$color-primary}; // no fallback to default admin vars + --djai-tab-bg--active: #{$color-secondary}; + --djai-tab-bg--hover: #{$color-primary-dark}; + --djai-tab-fg--active: #{$color-primary}; + --djai-dropdown-bg--active: var(--color-primary); + --djai-dropdown-bg--hover: #{$color-primary}; } -.breadcrumbs { - top: 48px !important; -} +$djai-padding: 40px; +$djai-padding--mobile: 15px; +$djai-padding--tablet: 30px; +$djai-border-width: 8px; -/* Integration into color scheme */ -.dropdown-menu { - background-color: $color_primary; +.djai-dropdown-menu { + // use full width on mobile & tablet + width: 100%; - .dropdown-menu__item, - .dropdown-menu__item:link, - .dropdown-menu__item:visited { - color: $color_lightest; + & &__drop { + min-width: 250px !important; + } - &.dropdown-menu__item--active { - background-color: $color_secondary; - text-decoration: none; - color: $color_primary; + // remove the header padding on mobile and tablet + @at-root #header { + padding-bottom: 0 !important; - &:hover { - color: $color_lightest; - } + // remove the border height from the breadcrumbs padding + & + .breadcrumbs { + padding-top: 10px - $djai-border-width; // 10px is original django value } - &:hover { - background-color: $color_primary_dark; + // overwrite admin '#header a:link' rule which is otherwise more specific + .djai-dropdown-menu .djai-dropdown-menu__item--active:link, + .djai-dropdown-menu .djai-dropdown-menu__item--active:visited { + color: var(--djai-tab-fg--active); + + &:hover { + color: var(--djai-tab-fg--hover); + } } } - .dropdown-menu__drop { - background-color: $color_primary; - box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.2); + /* Override for wider filer dropzone Taiga #359 */ + .js-filer-dropzone { + min-width: 600px !important; } - .dropdown-menu__link, - .dropdown-menu__link:link, - .dropdown-menu__link:visited { - color: $color_lightest; - - &:hover { - background-color: $color_primary_dark; - } - - &.dropdown-menu__link--active { - background-color: $color_primary_dark; - text-decoration: none; - } + @at-root body.login #header { + padding-bottom: 15px !important; } } -/* Override for wider dropdown */ -.dropdown-menu .dropdown-menu__drop { - min-width: 250px; -} - -/* Override for wider filer dropzone Taiga #359 */ -.js-filer-dropzone { - min-width: 600px !important; -} /** * DJANGO-BETTER-ADMIN-ARRAYFIELD diff --git a/src/open_inwoner/urls.py b/src/open_inwoner/urls.py index e5dfb17285..51ed5f211e 100644 --- a/src/open_inwoner/urls.py +++ b/src/open_inwoner/urls.py @@ -30,6 +30,7 @@ from open_inwoner.pdc.views import FAQView handler500 = "open_inwoner.utils.views.server_error" +admin.site.enable_nav_sidebar = False admin.site.site_header = "Open Inwoner beheeromgeving" admin.site.site_title = "Open Inwoner beheeromgeving" admin.site.index_title = "Welkom op de OpenInwoner beheeromgeving"