From 66c790599ea8449d6bef52db235a540ef9ba400e Mon Sep 17 00:00:00 2001 From: Wesley B <62723358+wesleyboar@users.noreply.github.com> Date: Tue, 16 Jun 2026 17:26:31 -0500 Subject: [PATCH 1/4] fix(gh-999): align header logo markup (navbar-brand on plugin render) Apply navbar-brand at HeaderLogoPlugin render; align settings fallback template. Pairs with Core-Styles header logo styling. --- .../contrib/taccsite_header_logo/cms_plugins.py | 13 +++++++------ taccsite_cms/contrib/taccsite_header_logo/forms.py | 7 ------- .../templates/header_logo_via_settings.html | 6 ++---- 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/taccsite_cms/contrib/taccsite_header_logo/cms_plugins.py b/taccsite_cms/contrib/taccsite_header_logo/cms_plugins.py index 25dc0470b..4d91e8ad8 100644 --- a/taccsite_cms/contrib/taccsite_header_logo/cms_plugins.py +++ b/taccsite_cms/contrib/taccsite_header_logo/cms_plugins.py @@ -6,15 +6,13 @@ from .forms import HeaderLogoForm -HEADER_LOGO_ELEMENT_ID = 'header-logo' +HEADER_LOGO_LINK_CLASS = 'navbar-brand' @plugin_pool.register_plugin class HeaderLogoPlugin(PicturePlugin): """ - Header > "Header logo" plugin - - Full Picture plugin; default id="header-logo" when not set in Attributes. + Header > "Header logo" (Picture) plugin """ model = Picture form = HeaderLogoForm @@ -24,6 +22,9 @@ class HeaderLogoPlugin(PicturePlugin): def render(self, context, instance, placeholder): if not instance.attributes: instance.attributes = {} - if 'id' not in instance.attributes: - instance.attributes['id'] = HEADER_LOGO_ELEMENT_ID + + # To add required attributes + existing_class = instance.attributes.get('class', '') + instance.attributes['class'] = f'{HEADER_LOGO_LINK_CLASS} {existing_class}'.strip() + return super().render(context, instance, placeholder) diff --git a/taccsite_cms/contrib/taccsite_header_logo/forms.py b/taccsite_cms/contrib/taccsite_header_logo/forms.py index 787b9a680..c814cb0b0 100644 --- a/taccsite_cms/contrib/taccsite_header_logo/forms.py +++ b/taccsite_cms/contrib/taccsite_header_logo/forms.py @@ -11,9 +11,6 @@ def default_home_page(): class HeaderLogoForm(PictureForm): """ Defaults for new Header logo plugins only (admin add form). - - With a link, TACC default picture.html puts Attributes (e.g. class mr-5) on - the , not the . """ def __init__(self, *args, **kwargs): @@ -25,10 +22,6 @@ def __init__(self, *args, **kwargs): if home is not None: self.initial.setdefault('link_page', home.pk) - self.initial.setdefault('height', 50) self.initial.setdefault('use_no_cropping', True) self.initial.setdefault('use_automatic_scaling', False) - attributes = dict(self.initial.get('attributes') or {}) - attributes.setdefault('class', 'mr-5') - self.initial['attributes'] = attributes diff --git a/taccsite_cms/templates/header_logo_via_settings.html b/taccsite_cms/templates/header_logo_via_settings.html index 12e3233fb..55b432de9 100644 --- a/taccsite_cms/templates/header_logo_via_settings.html +++ b/taccsite_cms/templates/header_logo_via_settings.html @@ -1,4 +1,3 @@ -{# @var className #} {% load static custom_portal_settings %} {% if settings.LOGO %} @@ -7,7 +6,7 @@ {% with settings.LOGO as logo %} {% with filename=logo|index:1 selectors=logo|index:2 targeturl=logo|index:3 targettype=logo|index:4 accessibility=logo|index:5 corstype=logo|index:6 visibility=logo|index:7 %} {% if visibility == "True" %} - {% endif %} @@ -19,8 +18,7 @@ {# via CMS setting (e.g. CMS developer sets logo image) #} {% with settings.PORTAL_LOGO as logo %}