From 26bfd2b37efba10899e669585068bc4639a8891e Mon Sep 17 00:00:00 2001 From: Albina Starykova Date: Tue, 20 Aug 2024 18:45:35 +0200 Subject: [PATCH] Fix small accessibility and design issues --- .../base/templatetags/navigation_tags.py | 36 ------------------- bakerydemo/static/css/main.css | 9 +++-- bakerydemo/templates/base/form_page.html | 2 +- .../templates/includes/card/listing-card.html | 4 +-- bakerydemo/templates/includes/footer.html | 4 +-- .../templates/locations/location_page.html | 6 ++-- .../templates/recipes/recipe_index_page.html | 2 ++ bakerydemo/templates/tags/top_menu.html | 10 ++---- .../templates/tags/top_menu_children.html | 7 ---- 9 files changed, 19 insertions(+), 61 deletions(-) delete mode 100644 bakerydemo/templates/tags/top_menu_children.html diff --git a/bakerydemo/base/templatetags/navigation_tags.py b/bakerydemo/base/templatetags/navigation_tags.py index 75699dd..972c2c3 100644 --- a/bakerydemo/base/templatetags/navigation_tags.py +++ b/bakerydemo/base/templatetags/navigation_tags.py @@ -14,14 +14,6 @@ def get_site_root(context): # attribute 'get_children') return Site.find_for_request(context["request"]).root_page - -def has_menu_children(page): - # This is used by the top_menu property - # get_children is a Treebeard API thing - # https://tabo.pe/projects/django-treebeard/docs/4.0.1/api.html - return page.get_children().live().in_menu().exists() - - def has_children(page): # Generically allow index pages to list their children return page.get_children().live().exists() @@ -33,13 +25,10 @@ def is_active(page, current_page): # Retrieves the top menu items - the immediate children of the parent page -# The has_menu_children method is necessary because the Foundation menu requires -# a dropdown class to be applied to a parent @register.inclusion_tag("tags/top_menu.html", takes_context=True) def top_menu(context, parent, calling_page=None): menuitems = parent.get_children().live().in_menu() for menuitem in menuitems: - menuitem.show_dropdown = has_menu_children(menuitem) # We don't directly check if calling_page is None since the template # engine can pass an empty string to calling_page # if the variable passed as calling_page does not exist. @@ -55,31 +44,6 @@ def top_menu(context, parent, calling_page=None): "request": context["request"], } - -# Retrieves the children of the top menu items for the drop downs -@register.inclusion_tag("tags/top_menu_children.html", takes_context=True) -def top_menu_children(context, parent, calling_page=None): - menuitems_children = parent.get_children() - menuitems_children = menuitems_children.live().in_menu() - for menuitem in menuitems_children: - menuitem.has_dropdown = has_menu_children(menuitem) - # We don't directly check if calling_page is None since the template - # engine can pass an empty string to calling_page - # if the variable passed as calling_page does not exist. - menuitem.active = ( - calling_page.url_path.startswith(menuitem.url_path) - if calling_page - else False - ) - menuitem.children = menuitem.get_children().live().in_menu() - return { - "parent": parent, - "menuitems_children": menuitems_children, - # required by the pageurl tag that we want to use within this template - "request": context["request"], - } - - @register.inclusion_tag("tags/breadcrumbs.html", takes_context=True) def breadcrumbs(context): self = context.get("self") diff --git a/bakerydemo/static/css/main.css b/bakerydemo/static/css/main.css index cf9b3bb..85eef89 100644 --- a/bakerydemo/static/css/main.css +++ b/bakerydemo/static/css/main.css @@ -252,6 +252,11 @@ figure img { height: auto; } +/* Overriding Bootstrap's default caption styles */ +caption { + color: var(--dark); +} + /* Generic detail page styles */ .intro { font-family: var(--font--secondary); @@ -403,7 +408,7 @@ blockquote .attribute-name { } /* stylelint-disable-next-line selector-class-pattern */ -.block-paragraph_block a { +.block-paragraph_block a, .block-ingredients_list a { text-decoration: underline; } @@ -1756,7 +1761,7 @@ input[type='radio'] { } .picture-card__link:hover .picture-card__image img { - transform: scale(1.05); + transform: scale(1.00); } .picture-card__link:hover .picture-card__title { diff --git a/bakerydemo/templates/base/form_page.html b/bakerydemo/templates/base/form_page.html index 0226235..4206f74 100644 --- a/bakerydemo/templates/base/form_page.html +++ b/bakerydemo/templates/base/form_page.html @@ -37,7 +37,7 @@ {% endif %} {% for field in form %} -
+
{{ field.label_tag }}{% if field.field.required %}*{% endif %} diff --git a/bakerydemo/templates/includes/card/listing-card.html b/bakerydemo/templates/includes/card/listing-card.html index 4b6d645..0f52045 100644 --- a/bakerydemo/templates/includes/card/listing-card.html +++ b/bakerydemo/templates/includes/card/listing-card.html @@ -13,13 +13,13 @@ {% if page.origin %} - + {% endif %} {% if page.bread_type %} - + {% endif %} diff --git a/bakerydemo/templates/includes/footer.html b/bakerydemo/templates/includes/footer.html index f44254f..5c7f04e 100644 --- a/bakerydemo/templates/includes/footer.html +++ b/bakerydemo/templates/includes/footer.html @@ -15,8 +15,8 @@ {% endif %} {% if twitter_url %} {% endif %} diff --git a/bakerydemo/templates/locations/location_page.html b/bakerydemo/templates/locations/location_page.html index 40832f9..ffbe69e 100644 --- a/bakerydemo/templates/locations/location_page.html +++ b/bakerydemo/templates/locations/location_page.html @@ -24,18 +24,18 @@
-

Operating Status

+

Operating Status

{% if page.is_open %} This location is currently open. {% else %} Sorry, this location is currently closed. {% endif %} -

Address

+

Address

{{ page.address|linebreaks }}
{% if page.operating_hours %} -

Opening hours

+

Opening hours

{% for hours in page.operating_hours %}
OriginOrigin {{ page.origin }}
TypeType {{ page.bread_type }}