Skip to content
Snippets Groups Projects
Unverified Commit aa24d3f9 authored by Sébastien Gaya's avatar Sébastien Gaya Committed by GitHub
Browse files

block links: alt_title (#2278)

* block links: alt_title

* locales alt_title

* english is in english
parent a73402b3
No related branches found
No related tags found
No related merge requests found
class Communication::Block::Template::Link::Element < Communication::Block::Template::Base
has_component :title, :string
has_component :alt_title, :string
has_component :description, :text
has_component :url, :string
has_component :image, :image
def check_accessibility
super
accessibility_warning 'accessibility.blocks.templates.links.alt_title_missing' if alt_title.blank?
end
end
......@@ -24,6 +24,7 @@
</div>
<div class="card-body">
<%= block_component_edit block, :title, template: @element %>
<%= block_component_edit block, :alt_title, template: @element %>
<%= block_component_edit block, :description, template: @element %>
<%= block_component_edit block, :url, template: @element %>
<%= block_component_edit block, :image, template: @element %>
......
......@@ -11,7 +11,9 @@
<% isExternal = false %>
<% end %>
<link itemprop="url" href="<%= element.url %>">
<a href="<%= element.url %>"<% if isExternal %> rel="noopener" target="_blank"<% end %> title="<%= element.title %>">
<a href="<%= element.url %>"
<% if isExternal %> rel="noopener" target="_blank"<% end %>
title="<%= element.alt_title.presence || element.title %>">
<%= element.title %>
</a>
<p><%= element.description %></p>
......
......@@ -2,6 +2,7 @@
links:
<% block.template.elements.each do |element| %>
<%= block_component_static block, :title, template: element, depth: 4, list: true %>
<%= block_component_static block, :alt_title, template: element, depth: 5 %>
<%= block_component_static block, :description, template: element, depth: 5 %>
<%= block_component_static block, :url, template: element, depth: 5 %>
external: <%= !(element.url.start_with?('/') || element.url.start_with?(@website.url)) %>
......
......@@ -361,15 +361,18 @@ en:
description:
label: Description
element:
alt_title:
label: Alternative title
placeholder: Enter link alternative title
description:
label: Description
placeholder: Enter link description
url:
label: URL
placeholder: 'https://'
title:
label: Title
placeholder: Enter link title
url:
label: URL
placeholder: 'https://'
remove: Remove the link
locations:
description: A selection of locations on a campus.
......
......@@ -361,15 +361,18 @@ fr:
description:
label: Description
element:
alt_title:
label: Titre alternatif
placeholder: Entrer le titre alternatif du lien
description:
label: Description
placeholder: Entrer la description du lien
url:
label: URL
placeholder: 'https://'
title:
label: Titre
placeholder: Entrer le titre du lien
url:
label: URL
placeholder: 'https://'
remove: Enlever le lien
locations:
description: Une sélection de sites dans des campus.
......
......@@ -27,6 +27,10 @@ en:
transcription_missing:
title: No transcription
text_html: The HTML iframe has no text transcription for blind people, for people with low bandwidth or no javascript enabled. Please add a text transcription.
links:
alt_title_missing:
title: No alternative title
text_html: The link has no alternative title. It might be completely fine if the link title alone allows to understand the function and the destination, as mentioned in <a href="https://accessibilite.numerique.gouv.fr/methode/criteres-et-tests/#6" target="_blank">criterion 6.1 of RGAA</a>. On the contrary, please add an alternative title to the link.
sound:
title_missing:
title: No title
......
......@@ -27,6 +27,10 @@ fr:
transcription_missing:
title: Pas de transcription
text_html: Le cadre HTML n'est pas accompagné d'une transcription textuelle pour les personnes malvoyantes, ou pour les situations de faible débit qui empêcheraient la lecture.
links:
alt_title_missing:
title: Pas de titre alternatif du lien
text_html: Le titre alternatif du lien est vide. C'est tout à fait pertinent si le titre du lien seul permet de comprendre la fonction et la destination, comme expliqué dans le <a href="https://accessibilite.numerique.gouv.fr/methode/criteres-et-tests/#6" target="_blank">critère 6.1 du RGAA</a>. Dans le cas contraire, merci d'ajouter un titre alternatif à votre lien.
sound:
title_missing:
title: Pas de titre
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment