Skip to content

Commit 26bfd2b

Browse files
albinazsthibaudcolas
authored andcommitted
Fix small accessibility and design issues
1 parent 63c95ca commit 26bfd2b

File tree

9 files changed

+19
-61
lines changed

9 files changed

+19
-61
lines changed

bakerydemo/base/templatetags/navigation_tags.py

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,6 @@ def get_site_root(context):
1414
# attribute 'get_children')
1515
return Site.find_for_request(context["request"]).root_page
1616

17-
18-
def has_menu_children(page):
19-
# This is used by the top_menu property
20-
# get_children is a Treebeard API thing
21-
# https://tabo.pe/projects/django-treebeard/docs/4.0.1/api.html
22-
return page.get_children().live().in_menu().exists()
23-
24-
2517
def has_children(page):
2618
# Generically allow index pages to list their children
2719
return page.get_children().live().exists()
@@ -33,13 +25,10 @@ def is_active(page, current_page):
3325

3426

3527
# Retrieves the top menu items - the immediate children of the parent page
36-
# The has_menu_children method is necessary because the Foundation menu requires
37-
# a dropdown class to be applied to a parent
3828
@register.inclusion_tag("tags/top_menu.html", takes_context=True)
3929
def top_menu(context, parent, calling_page=None):
4030
menuitems = parent.get_children().live().in_menu()
4131
for menuitem in menuitems:
42-
menuitem.show_dropdown = has_menu_children(menuitem)
4332
# We don't directly check if calling_page is None since the template
4433
# engine can pass an empty string to calling_page
4534
# if the variable passed as calling_page does not exist.
@@ -55,31 +44,6 @@ def top_menu(context, parent, calling_page=None):
5544
"request": context["request"],
5645
}
5746

58-
59-
# Retrieves the children of the top menu items for the drop downs
60-
@register.inclusion_tag("tags/top_menu_children.html", takes_context=True)
61-
def top_menu_children(context, parent, calling_page=None):
62-
menuitems_children = parent.get_children()
63-
menuitems_children = menuitems_children.live().in_menu()
64-
for menuitem in menuitems_children:
65-
menuitem.has_dropdown = has_menu_children(menuitem)
66-
# We don't directly check if calling_page is None since the template
67-
# engine can pass an empty string to calling_page
68-
# if the variable passed as calling_page does not exist.
69-
menuitem.active = (
70-
calling_page.url_path.startswith(menuitem.url_path)
71-
if calling_page
72-
else False
73-
)
74-
menuitem.children = menuitem.get_children().live().in_menu()
75-
return {
76-
"parent": parent,
77-
"menuitems_children": menuitems_children,
78-
# required by the pageurl tag that we want to use within this template
79-
"request": context["request"],
80-
}
81-
82-
8347
@register.inclusion_tag("tags/breadcrumbs.html", takes_context=True)
8448
def breadcrumbs(context):
8549
self = context.get("self")

bakerydemo/static/css/main.css

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,11 @@ figure img {
252252
height: auto;
253253
}
254254

255+
/* Overriding Bootstrap's default caption styles */
256+
caption {
257+
color: var(--dark);
258+
}
259+
255260
/* Generic detail page styles */
256261
.intro {
257262
font-family: var(--font--secondary);
@@ -403,7 +408,7 @@ blockquote .attribute-name {
403408
}
404409

405410
/* stylelint-disable-next-line selector-class-pattern */
406-
.block-paragraph_block a {
411+
.block-paragraph_block a, .block-ingredients_list a {
407412
text-decoration: underline;
408413
}
409414

@@ -1756,7 +1761,7 @@ input[type='radio'] {
17561761
}
17571762

17581763
.picture-card__link:hover .picture-card__image img {
1759-
transform: scale(1.05);
1764+
transform: scale(1.00);
17601765
}
17611766

17621767
.picture-card__link:hover .picture-card__title {

bakerydemo/templates/base/form_page.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ <h1 class="index-header__title">{{ page.title }}</h1>
3737
{% endif %}
3838

3939
{% for field in form %}
40-
<div class="form-page__field" aria-required={% if field.field.required %}"true"{% else %}"false"{% endif %}>
40+
<div class="form-page__field">
4141

4242
{{ field.label_tag }}{% if field.field.required %}<span class="required">*</span>{% endif %}
4343

bakerydemo/templates/includes/card/listing-card.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ <h3 class="listing-card__title">{{ page.title }}</h3>
1313
<table class="listing-card__meta">
1414
{% if page.origin %}
1515
<tr>
16-
<td class="listing-card__meta-category">Origin</td>
16+
<th scope="row" class="listing-card__meta-category">Origin</th>
1717
<td class="listing-card__meta-content">{{ page.origin }}</td>
1818
</tr>
1919
{% endif %}
2020
{% if page.bread_type %}
2121
<tr>
22-
<td class="listing-card__meta-category">Type</td>
22+
<th scope="row" class="listing-card__meta-category">Type</td>
2323
<td class="listing-card__meta-content">{{ page.bread_type }}</td>
2424
</tr>
2525
{% endif %}

bakerydemo/templates/includes/footer.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
{% endif %}
1616
{% if twitter_url %}
1717
<li class="footer__icon">
18-
<a href="{{ twitter_url }}" target="_blank" rel="noreferrer" aria-label="Wagtail's official Twitter account">
19-
<svg aria-hidden="true" fill="currentColor" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 512 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M459.37 151.716c.325 4.548.325 9.097.325 13.645 0 138.72-105.583 298.558-298.558 298.558-59.452 0-114.68-17.219-161.137-47.106 8.447.974 16.568 1.299 25.34 1.299 49.055 0 94.213-16.568 130.274-44.832-46.132-.975-84.792-31.188-98.112-72.772 6.498.974 12.995 1.624 19.818 1.624 9.421 0 18.843-1.3 27.614-3.573-48.081-9.747-84.143-51.98-84.143-102.985v-1.299c13.969 7.797 30.214 12.67 47.431 13.319-28.264-18.843-46.781-51.005-46.781-87.391 0-19.492 5.197-37.36 14.294-52.954 51.655 63.675 129.3 105.258 216.365 109.807-1.624-7.797-2.599-15.918-2.599-24.04 0-57.828 46.782-104.934 104.934-104.934 30.213 0 57.502 12.67 76.67 33.137 23.715-4.548 46.456-13.32 66.599-25.34-7.798 24.366-24.366 44.833-46.132 57.827 21.117-2.273 41.584-8.122 60.426-16.243-14.292 20.791-32.161 39.308-52.628 54.253z"/></svg>
18+
<a href="{{ twitter_url }}" target="_blank" rel="noreferrer" aria-label="Wagtail's official X account">
19+
<svg aria-hidden="true" fill="currentColor" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 512 512"><!--!Font Awesome Free 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M389.2 48h70.6L305.6 224.2 487 464H345L233.7 318.6 106.5 464H35.8L200.7 275.5 26.8 48H172.4L272.9 180.9 389.2 48zM364.4 421.8h39.1L151.1 88h-42L364.4 421.8z"/></svg>
2020
</a>
2121
</li>
2222
{% endif %}

bakerydemo/templates/locations/location_page.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,18 @@
2424
<div class="col-md-4 col-md-offset-1">
2525
<div class="row">
2626
<div class="bread-detail__meta">
27-
<p class="location__meta-title">Operating Status</p>
27+
<h2 class="location__meta-title">Operating Status</h2>
2828
{% if page.is_open %}
2929
This location is currently open.
3030
{% else %}
3131
Sorry, this location is currently closed.
3232
{% endif %}
3333

34-
<p class="location__meta-title">Address</p>
34+
<h2 class="location__meta-title">Address</h2>
3535
<address>{{ page.address|linebreaks }}</address>
3636

3737
{% if page.operating_hours %}
38-
<p class="location__meta-title">Opening hours</p>
38+
<h2 class="location__meta-title">Opening hours</h2>
3939
{% for hours in page.operating_hours %}
4040
<time itemprop="openingHours" datetime="{{ hours }}" class="location__time">
4141
<span class="location__day">{{ hours.day }}</span>:

bakerydemo/templates/recipes/recipe_index_page.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
{% load wagtailcore_tags navigation_tags wagtailimages_tags %}
33

44
{% block content %}
5+
{% include "base/include/header-index.html" %}
6+
57
<div class="container">
68
<div class="blog-list">
79
{% if recipes %}

bakerydemo/templates/tags/top_menu.html

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,7 @@
22
{% get_site_root as site_root %}
33

44
{% for menuitem in menuitems %}
5-
<li class="presentation {{ menuitem.title|lower|cut:" " }}{% if menuitem.active %} active{% endif %}{% if menuitem.show_dropdown %} has-submenu{% endif %}">
6-
{% if menuitem.show_dropdown %}
7-
<a href="{% pageurl menuitem %}" class="allow-toggle">{{ menuitem.title }} <span><a class="caret-custom dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"></a></span></a>
8-
{% top_menu_children parent=menuitem %}
9-
{# Used to display child menu items #}
10-
{% else %}
11-
<a href="{% pageurl menuitem %}">{{ menuitem.title }}</a>
12-
{% endif %}
5+
<li class="presentation {{ menuitem.title|lower|cut:" " }}{% if menuitem.active %} active{% endif %}">
6+
<a href="{% pageurl menuitem %}">{{ menuitem.title }}</a>
137
</li>
148
{% endfor %}

bakerydemo/templates/tags/top_menu_children.html

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)