diff --git a/app/models/communication/block/template/chapter.rb b/app/models/communication/block/template/chapter.rb index b1738a00afe0723d83f1b18947fde5fc6d55047b..7bd5c20051e77bb8441d45c582be44e9d136f4bb 100644 --- a/app/models/communication/block/template/chapter.rb +++ b/app/models/communication/block/template/chapter.rb @@ -6,4 +6,10 @@ class Communication::Block::Template::Chapter < Communication::Block::Template:: has_string :alt has_rich_text :credit + protected + + def check_accessibility + super + accessibility_warning 'accessibility.commons.alt.empty' if image_component.blob && alt.blank? + end end diff --git a/app/views/admin/application/_accessibility.html.erb b/app/views/admin/application/_accessibility.html.erb index 38becadbe51efc9aba1012d1911187a213343cd9..0f170d955046b476134031b1d82b33ea8be77fe7 100644 --- a/app/views/admin/application/_accessibility.html.erb +++ b/app/views/admin/application/_accessibility.html.erb @@ -8,7 +8,7 @@ color = about.accessible? ? 'text-success' : 'text-danger' <%= t('accessibility.label') %> </h2> </div> - <% if about.accessibility_errors.any? %> + <% if about.accessibility_errors.any? || about.accessibility_warnings.any? %> <div class="card-body"> <% if about.accessibility_errors.any? %> <h2 class="h5 text-danger"> @@ -27,10 +27,18 @@ color = about.accessible? ? 'text-success' : 'text-danger' </ol> <% end %> <% if about.accessibility_warnings.any? %> - <h2 class="h5"><%= t 'accessibility.warnings' %></h2> + <h2 class="h5"> + <%= t 'accessibility.warnings', count: about.accessibility_warnings.count %> + </h2> <ul class="list-unstyled"> <% about.accessibility_warnings.each do |key| %> - <li><%= message %></li> + <li> + <hr> + <h3 class="h5"><%= t "#{key}.title" %></h3> + <p> + <%= t "#{key}.text_html" %> + </p> + </li> <% end %> </ul> <% end %> diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 129f0f38fad1aa4cd817a36619a560adeb25d0e7..942f33326284f2facacbd97b277a53e303128c01 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -7,6 +7,11 @@ fr: warnings: one: '1 information utile' other: '%{count} informations utiles' + commons: + alt: + empty: + title: Texte alternatif vide + text_html: Vous avez une image, mais le texte alternatif est vide. C'est tout à fait pertinent s'il n'y a aucune information significative dans l'image. En revanche, si l'image contient des informations utiles, il est nécessaire de les indiquer en texte. blocks: components: templates: