Skip to content

Commit

Permalink
templates/upper_footer: add if to only show leichte sprache link when…
Browse files Browse the repository at this point in the history
… page is in german fixes #806
  • Loading branch information
philli-m authored and goapunk committed Jun 22, 2023
1 parent 295b092 commit caf5c31
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 25 deletions.
16 changes: 12 additions & 4 deletions digitalstrategie/templates/includes/header.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{% load snippet_tags i18n static %}
{% load snippet_tags i18n static contrib_tags %}
{% get_current_language as LANGUAGE_CODE %}
{% get_available_languages as languages %}

{% if 'de-ls' in request.path %}
{% load_site_menu "header_ls" as header_menu_items %}
{% else %}
Expand Down Expand Up @@ -60,15 +63,20 @@ <h2 class="heading"><span>{% trans 'Accessibility' %}</span></h2>
</button>
</div>
<div class="overlay__body">

{% if request.LANGUAGE_CODE == 'de' %}
{% get_language_info for 'de-ls' as language %}
{% get_has_translation page 'de_ls' as has_translation_de_ls %}
<h3>{% trans 'Settings' %}</h3>
<ul class="wcag-linklist">
<li>
<a href="#">
<img aria-hidden="true" src="https://www.berlin.de/i9f/v4/css/images/misc/leichtesprache.svg" alt="Symbol leichte Sprache">
Leichte Sprache <span class="aural">für diese Seite anzeigen</span>
<a href="{% if has_translation_de_ls %}{% translate_url language.code %}{% else %}/{% endif %}" aria-label="{% trans 'select' %}">
{{ language.name_local }}
<span class="aural">für diese Seite anzeigen</span>
</a>
</li>
</ul>
{% endif %}

{% if settings.apps_settings.Accessibility.accessibility_declaration and settings.apps_settings.Accessibility.accessibility_declaration_title %}
<h3>{% trans 'How accessible is this website?' %}</h3>
Expand Down
44 changes: 23 additions & 21 deletions digitalstrategie/templates/includes/upper_footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,29 @@
<h3 class="heading js-trigger">{{ menuitem.title }}</h3>
<ul>
{% if forloop.first %}
{% get_language_info for 'de-ls' as language %}
{% get_has_translation page 'de_ls' as has_translation_de_ls %}
<li>
<form class="footer-menu__btn" action="{% url 'set_language' %}" method="post">
{% csrf_token %}
<input name="next" type="hidden" value="{% if has_translation_de_ls %}{{ redirect_to }}{% else %}/{% endif %}" />
<input name="language" type="hidden" value="{{ language.code }}">
<span>
<button role="button" type="submit" aria-label="{% trans 'select' %}{{ language.name }}">
<img
class="misc-icon"
src="https://www.berlin.de/i9f/v4/css/images/misc/leichtesprache.svg"
title="{% trans 'Leichte Sprache' %}"
aria-hidden="true"
alt="{% trans 'Leichte Sprache' %}"
>
{{ language.name_local }}
</button>
</span>
</form>
</li>
{% if request.LANGUAGE_CODE == 'de' %}
{% get_language_info for 'de-ls' as language %}
{% get_has_translation page 'de_ls' as has_translation_de_ls %}
<li>
<form class="footer-menu__btn" action="{% url 'set_language' %}" method="post">
{% csrf_token %}
<input name="next" type="hidden" value="{% if has_translation_de_ls %}{{ redirect_to }}{% else %}/{% endif %}" />
<input name="language" type="hidden" value="{{ language.code }}">
<span>
<button role="button" type="submit" aria-label="{% trans 'select' %}{{ language.name }}">
<img
class="misc-icon"
src="https://www.berlin.de/i9f/v4/css/images/misc/leichtesprache.svg"
title="{% trans 'Leichte Sprache' %}"
aria-hidden="true"
alt="{% trans 'Leichte Sprache' %}"
>
{{ language.name_local }}
</button>
</span>
</form>
</li>
{% endif %}
{% endif %}
{% if menuitem.subpages %}
{% for subpage in menuitem.subpages %}
Expand Down

0 comments on commit caf5c31

Please sign in to comment.