From 9d29084446bb339dfaff136701c8e02b79258aa5 Mon Sep 17 00:00:00 2001 From: Arnaud Levy <contact@arnaudlevy.com> Date: Tue, 19 Apr 2022 16:29:16 +0200 Subject: [PATCH] gallery text --- app/models/communication/block/template/gallery.rb | 3 ++- .../communication/blocks/templates/gallery/_edit.html.erb | 8 ++++++++ .../communication/blocks/templates/gallery/_show.html.erb | 1 + .../blocks/templates/gallery/_static.html.erb | 2 ++ config/locales/communication/en.yml | 2 ++ config/locales/communication/fr.yml | 2 ++ 6 files changed, 17 insertions(+), 1 deletion(-) diff --git a/app/models/communication/block/template/gallery.rb b/app/models/communication/block/template/gallery.rb index 731ea647c..da9c83d52 100644 --- a/app/models/communication/block/template/gallery.rb +++ b/app/models/communication/block/template/gallery.rb @@ -20,7 +20,8 @@ class Communication::Block::Template::Gallery < Communication::Block::Template return if blob.nil? { blob: blob, - alt: element['alt'] + alt: element['alt'], + text: element['text'] }.to_dot end end diff --git a/app/views/admin/communication/blocks/templates/gallery/_edit.html.erb b/app/views/admin/communication/blocks/templates/gallery/_edit.html.erb index 36dce3af3..bb2d880de 100644 --- a/app/views/admin/communication/blocks/templates/gallery/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/gallery/_edit.html.erb @@ -39,6 +39,14 @@ v-model="image.alt" placeholder="<%= t '.alt_placeholder' %>" :id="'image-alt-' + imageIndex"> + <label aria-label="<%= t '.text_label' %>" + :for="'image-text-' + imageIndex"> + <%= t '.text_label' %> + </label> + <textarea class="form-control" + v-model="image.text" + placeholder="<%= t '.text_placeholder' %>" + :id="'image-text-' + imageIndex"></textarea> </div> </div> </div> diff --git a/app/views/admin/communication/blocks/templates/gallery/_show.html.erb b/app/views/admin/communication/blocks/templates/gallery/_show.html.erb index c7217cadd..0317b5ab8 100644 --- a/app/views/admin/communication/blocks/templates/gallery/_show.html.erb +++ b/app/views/admin/communication/blocks/templates/gallery/_show.html.erb @@ -7,6 +7,7 @@ <% end %> <div class="card-body"> <p class="mb-0"><%= image.alt %></p> + <p class="mb-0 small"><%= image.text %></p> </div> </article> </div> diff --git a/app/views/admin/communication/blocks/templates/gallery/_static.html.erb b/app/views/admin/communication/blocks/templates/gallery/_static.html.erb index 46b616f91..465dae402 100644 --- a/app/views/admin/communication/blocks/templates/gallery/_static.html.erb +++ b/app/views/admin/communication/blocks/templates/gallery/_static.html.erb @@ -2,5 +2,7 @@ <% block.template.images_with_alt.each do |image| %> - alt: > <%= prepare_text_for_static image.alt %> + text: > + <%= prepare_text_for_static image.text %> file: "<%= image.blob.id %>" <% end %> diff --git a/config/locales/communication/en.yml b/config/locales/communication/en.yml index dcf5ed340..07d3b9746 100644 --- a/config/locales/communication/en.yml +++ b/config/locales/communication/en.yml @@ -126,6 +126,8 @@ en: image_label: Image (.png, .jpg) alt_label: Alternative text alt_placeholder: Enter text description + text_label: Text + text_placeholder: Enter text remove_image: Remove image organization_chart: edit: diff --git a/config/locales/communication/fr.yml b/config/locales/communication/fr.yml index 892c33e79..b47c3b0c8 100644 --- a/config/locales/communication/fr.yml +++ b/config/locales/communication/fr.yml @@ -126,6 +126,8 @@ fr: image_label: Image (.png, .jpg) alt_label: Texte alternatif alt_placeholder: Entrer la description textuelle + text_label: Texte + text_placeholder: Entrer le texte remove_image: Enlever l'image organization_chart: edit: -- GitLab