diff --git a/app/assets/images/communication/blocks/templates/sound.jpg b/app/assets/images/communication/blocks/templates/sound.jpg new file mode 100644 index 0000000000000000000000000000000000000000..f42a626b49a634551c61735aa4e1bf7a04a05273 Binary files /dev/null and b/app/assets/images/communication/blocks/templates/sound.jpg differ diff --git a/app/models/communication/block.rb b/app/models/communication/block.rb index 858d40aa191bc92083e00ef4a24cdb07690953b7..d9e386f5a6a09973276b7c040537bcb504988695 100644 --- a/app/models/communication/block.rb +++ b/app/models/communication/block.rb @@ -64,6 +64,7 @@ class Communication::Block < ApplicationRecord image: 51, gallery: 300, video: 52, + sound: 1005, key_figures: 56, features: 2010, datatable: 54, @@ -82,7 +83,7 @@ class Communication::Block < ApplicationRecord } CATEGORIES = { - basic: [:chapter, :image, :video, :datatable], + basic: [:chapter, :image, :video, :sound, :datatable], storytelling: [:key_figures, :features, :gallery, :call_to_action, :testimonials, :timeline], references: [:pages, :posts, :organization_chart, :partners, :programs], utilities: [:files, :definitions, :embed, :contact] diff --git a/app/models/communication/block/template/sound.rb b/app/models/communication/block/template/sound.rb new file mode 100644 index 0000000000000000000000000000000000000000..459a4d19da820156b27b4659e18a75141a71374d --- /dev/null +++ b/app/models/communication/block/template/sound.rb @@ -0,0 +1,14 @@ +class Communication::Block::Template::Sound < Communication::Block::Template::Base + + has_component :file, :file + has_component :title, :string + has_component :transcription, :text + + protected + + def check_accessibility + super + accessibility_error 'accessibility.blocks.templates.sound.title_missing' if block.title.blank? && title.blank? + accessibility_error 'accessibility.blocks.templates.sound.transcription_missing' if transcription.blank? + end +end diff --git a/app/views/admin/communication/blocks/components/file/_edit.html.erb b/app/views/admin/communication/blocks/components/file/_edit.html.erb index 1161795efd45f16a8dc6f776c79fcb8ddf87c665..592c1f391cb482a5afc58c7cb6ea4276f3a2885e 100644 --- a/app/views/admin/communication/blocks/components/file/_edit.html.erb +++ b/app/views/admin/communication/blocks/components/file/_edit.html.erb @@ -16,7 +16,7 @@ remove = t 'admin.communication.blocks.components.file.input.remove' :id="<%= dom_id.html_safe %>"> </div> <div v-if="<%= model %>.<%= property %>.id"> - <p><b>{{ element.file.filename }}</b></p> + <p><b>{{ <%= model %>.<%= property %>.filename }}</b></p> <a class="btn btn-sm text-danger" v-on:click="<%= model %>.<%= property %>={}"> <i class="<%= Icon::DELETE %>"></i> diff --git a/app/views/admin/communication/blocks/components/image/_edit.html.erb b/app/views/admin/communication/blocks/components/image/_edit.html.erb index 7691d20af29607b2f71806faa14b137f63fea9ef..2f4702ec6b3efc19033885dfa1989272649be42a 100644 --- a/app/views/admin/communication/blocks/components/image/_edit.html.erb +++ b/app/views/admin/communication/blocks/components/image/_edit.html.erb @@ -12,6 +12,7 @@ remove = t 'admin.communication.blocks.components.image.input.remove' type="file" accept="image/*" @change="onFileImageChange( $event, <%= model %>, '<%= property %>' )" + data-size-limit="<%= Communication::Block::IMAGE_MAX_SIZE %>" :id="<%= dom_id.html_safe %>"> </div> <div v-if="<%= model %>.<%= property %>.id"> diff --git a/app/views/admin/communication/blocks/templates/sound/_edit.html.erb b/app/views/admin/communication/blocks/templates/sound/_edit.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..ec65c4326fc1cd5652407fec86470084c9ef06ab --- /dev/null +++ b/app/views/admin/communication/blocks/templates/sound/_edit.html.erb @@ -0,0 +1,11 @@ +<div class="row pure__row--small"> + <div class="col-md-6"> + <%= block_component_edit :file %> + <%= block_component_edit :title %> + </div> + <div class="col-md-6"> + <%= block_component_edit :transcription, + label: t('admin.communication.blocks.components.text.transcription.label'), + placeholder: t('admin.communication.blocks.components.text.transcription.placeholder'), rows: 10 %> + </div> +</div> diff --git a/app/views/admin/communication/blocks/templates/sound/_preview.html.erb b/app/views/admin/communication/blocks/templates/sound/_preview.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..d287566753441b75e0d33eff7b3e7974c0444213 --- /dev/null +++ b/app/views/admin/communication/blocks/templates/sound/_preview.html.erb @@ -0,0 +1,34 @@ +<% +class_name = "block block-sound" +unless @block.title.blank? + class_name += " block-with-title" +end +%> +<section class="<%= class_name %>"> + <div class="container"> + <div class="block-content"> + <% unless @block.title.blank? %> + <div class="top"> + <h2><%= @block.title %></h2> + </div> + <% end %> + <% if @block.template.file.present? %> + <% blob = @block.template.file_component.blob %> + <% if blob %> + <audio controls src="<%= blob.url %>"></audio> + <% end %> + <% end %> + <% if @block.template.title %> + <p><%= block_component_preview :title %></p> + <% end %> + <% unless @block.template.transcription.blank? %> + <div class="transcription"> + <details> + <summary><%= t 'accessibility.transcription' %></summary> + <p><%= block_component_preview :transcription %></p> + </details> + </div> + <% end %> + </div> + </div> +</section> \ No newline at end of file diff --git a/app/views/admin/communication/blocks/templates/sound/_static.html.erb b/app/views/admin/communication/blocks/templates/sound/_static.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..08326619b00c3bb27491f7690ae9baefab7e2cb4 --- /dev/null +++ b/app/views/admin/communication/blocks/templates/sound/_static.html.erb @@ -0,0 +1,3 @@ +<%= block_component_static :file %> +<%= block_component_static :title %> +<%= block_component_static :transcription %> diff --git a/config/locales/communication/en.yml b/config/locales/communication/en.yml index e25a3e57ec7bec58418febce75441927e26a9da6..ae26a0ac925dda7cff3a6a6811003816628d46a9 100644 --- a/config/locales/communication/en.yml +++ b/config/locales/communication/en.yml @@ -582,6 +582,14 @@ en: description: A selection of programs. edit: add: Add a program + sound: + description: An audio recording with a text transcription for a proper accessibility. + edit: + file: + label: Audio file encoded for the Web (.mp3, .m4a...) + title: + label: Recording title + placeholder: Enter the title testimonials: description: One or more testimonies edit: @@ -756,6 +764,7 @@ en: partners: Organizations posts: Posts programs: Programs + sound: Sound testimonials: Testimonials timeline: Timeline video: Video diff --git a/config/locales/communication/fr.yml b/config/locales/communication/fr.yml index ff64b5856adcfb5c40b1abfd617f79d9e352fdb9..b41a76a3a1e2f1016c8f2c68c7f1e8f63cd1764c 100644 --- a/config/locales/communication/fr.yml +++ b/config/locales/communication/fr.yml @@ -582,6 +582,14 @@ fr: description: Une sélection de formations. edit: add: Ajouter une formation + sound: + description: Un enregistrement audio, avec sa transcription pour l'accessibilité. + edit: + file: + label: Fichier audio pour diffusion Web (.mp3, .m4a...) + title: + label: Titre de l'enregistrement + placeholder: Entrer le titre testimonials: description: Un ou plusieurs témoignages, avec le texte, l'auteur, sa fonction et sa photo. edit: @@ -756,6 +764,7 @@ fr: partners: Organisations posts: Actualités programs: Formations + sound: Son testimonials: Témoignages timeline: Frise chronologique video: Vidéo diff --git a/config/locales/en.yml b/config/locales/en.yml index 551e5fb3b8104a64070910aec3a0232cf3e89bd9..dc883cd4684e38de51169e7ca3d9e5b96312b53b 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -19,13 +19,6 @@ en: blocks: components: templates: - video: - title_missing: - title: No title - text_html: Neither the block, neither the video have a title. It will prevent blind people from knowing what the video is about, as mentioned in <a href="https://www.numerique.gouv.fr/publications/rgaa-accessibilite/methode-rgaa/criteres/#topic4" target="_blank">criterion 4.7 of RGAA</a>. Please add a title to the video. - transcription_missing: - title: No transcription - text_html: The video has no text transcription for blind people, or for users with a low bitrate connection who could not read the video properly. Please add a text transcription. embed: title_missing: title: No frame title @@ -33,6 +26,20 @@ 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. + sound: + title_missing: + title: No title + text_html: Neither the block, neither the recording have a title. It will prevent blind people from knowing what the recording is about, as mentioned in <a href="https://www.numerique.gouv.fr/publications/rgaa-accessibilite/methode-rgaa/criteres/#topic4" target="_blank">criterion 4.7 of RGAA</a>. Please add a title to the recording. + transcription_missing: + title: No transcription + text_html: The recording has no text transcription for blind people, or for users with a low bitrate connection who could not read the recording properly. Please add a text transcription. + video: + title_missing: + title: No title + text_html: Neither the block, neither the video have a title. It will prevent blind people from knowing what the video is about, as mentioned in <a href="https://www.numerique.gouv.fr/publications/rgaa-accessibilite/methode-rgaa/criteres/#topic4" target="_blank">criterion 4.7 of RGAA</a>. Please add a title to the video. + transcription_missing: + title: No transcription + text_html: The video has no text transcription for blind people, or for users with a low bitrate connection who could not read the video properly. Please add a text transcription. activerecord: attributes: import: diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 1fc37088e5c8ff952d9534c617e994326808d2da..71d597e29f33d503c81c6f1da24184e23de6d567 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -19,13 +19,6 @@ fr: blocks: components: templates: - video: - title_missing: - title: Pas de titre - text_html: Ni le bloc ni la vidéo n'ont de titre, cela va empêcher les personnes malvoyantes de savoir de quoi parle la vidéo, comme expliqué dans le <a href="https://www.numerique.gouv.fr/publications/rgaa-accessibilite/methode-rgaa/criteres/#topic4" target="_blank">critère 4.7 du RGAA</a>. Merci d'ajouter un titre à la vidéo. - transcription_missing: - title: Pas de transcription - text_html: La vidéo n'est pas accompagnée d'une transcription textuelle pour les personnes malvoyantes, ou pour les situations de faible débit qui empêcheraient la lecture. embed: title_missing: title: Pas de titre de cadre @@ -33,6 +26,20 @@ 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. + sound: + title_missing: + title: Pas de titre + text_html: Ni le bloc ni le fichier audio n'ont de titre, cela va empêcher les personnes malvoyantes de savoir de quoi parle l'enregistrement, comme expliqué dans le <a href="https://www.numerique.gouv.fr/publications/rgaa-accessibilite/methode-rgaa/criteres/#topic4" target="_blank">critère 4.7 du RGAA</a>. Merci d'ajouter un titre à l'enregistrement. + transcription_missing: + title: Pas de transcription + text_html: L'enregistrement 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. + video: + title_missing: + title: Pas de titre + text_html: Ni le bloc ni la vidéo n'ont de titre, cela va empêcher les personnes malvoyantes de savoir de quoi parle la vidéo, comme expliqué dans le <a href="https://www.numerique.gouv.fr/publications/rgaa-accessibilite/methode-rgaa/criteres/#topic4" target="_blank">critère 4.7 du RGAA</a>. Merci d'ajouter un titre à la vidéo. + transcription_missing: + title: Pas de transcription + text_html: La vidéo n'est pas accompagnée d'une transcription textuelle pour les personnes malvoyantes, ou pour les situations de faible débit qui empêcheraient la lecture. activerecord: attributes: import: