diff --git a/app/models/communication/block.rb b/app/models/communication/block.rb index 95ccf3744fffd4a75ae99b5be9a0f5656cd7e961..c6d7e48d00575217288293dcb6b3a0e7b76a7d5f 100644 --- a/app/models/communication/block.rb +++ b/app/models/communication/block.rb @@ -36,6 +36,7 @@ class Communication::Block < ApplicationRecord image: 51, gallery: 300, video: 52, + key_figures: 56, datatable: 54, files: 55, embed: 53, @@ -47,7 +48,13 @@ class Communication::Block < ApplicationRecord partners: 200, posts: 500, pages: 600, - key_figures: 56, + } + + CATEGORIES = { + basic: [:chapter, :image, :video, :datatable], + storytelling: [:key_figures, :gallery, :call_to_action, :testimonials, :timeline], + references: [:pages, :posts, :organization_chart, :partners], + utilities: [:files, :definitions, :embed] } before_validation :sanitize_data diff --git a/app/views/admin/communication/blocks/new.html.erb b/app/views/admin/communication/blocks/new.html.erb index 7afbfc0c41d9c8af25af6bf15bf1cadfa8139b93..404668594e887d463f96670f14f4804f8c314e27 100644 --- a/app/views/admin/communication/blocks/new.html.erb +++ b/app/views/admin/communication/blocks/new.html.erb @@ -1,25 +1,35 @@ <% content_for :title, t('communication.block.choose_template') %> -<div class="row"> - <% Communication::Block.template_kinds.keys.each do |template_kind| %> - <% @block.template_kind = template_kind %> - <div class="col-lg-3 col-md-4"> - <div class="card"> - <%= image_tag "communication/blocks/templates/#{template_kind}.jpg", alt: '', class:"card-img-top" %> - <div class="card-body"> - <h5 class="card-title"><%= t "enums.communication.block.template_kind.#{template_kind}" %></h5> - <%= simple_form_for [:admin, @block] do |f| %> - <%= f.error_notification %> - <%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %> - - <%= f.input :about_type, as: :hidden %> - <%= f.input :about_id, as: :hidden %> - <%= f.input :template_kind, as: :hidden %> - <%= f.submit t('communication.block.choose'), - class: button_classes('stretched-link') %> - <% end %> +<% Communication::Block::CATEGORIES.each do |category, kinds| %> + <div class="row mt-5"> + <div class="col-lg-7"> + <h2><%= t "admin.communication.blocks.categories.#{category}.label" %></h2> + </div> + <div class="col-lg-5"> + <p class="lead mb-0 text-end"> + <%= t "admin.communication.blocks.categories.#{category}.description" %> + </p> + </div> + </div> + <hr> + <div class="row"> + <% kinds.each do |kind| %> + <% @block.template_kind = kind %> + <div class="col-xxl-2 col-lg-3 col-md-4 d-flex"> + <div class="card flex-fill"> + <%= image_tag "communication/blocks/templates/#{kind}.jpg", alt: '', class:"card-img-top" %> + <div class="card-body d-flex flex-column"> + <h5 class="card-title"><%= t "enums.communication.block.template.#{kind}" %></h5> + <p class="mb-0"><%= t "admin.communication.blocks.templates.#{kind}.description" %></p> + <%= simple_form_for [:admin, @block], html: { class: 'mt-auto'} do |f| %> + <%= f.input :about_type, as: :hidden %> + <%= f.input :about_id, as: :hidden %> + <%= f.input :template_kind, as: :hidden %> + <%= f.submit t('communication.block.choose'), class: button_classes %> + <% end %> + </div> </div> </div> - </div> - <% end %> -</div> + <% end %> + </div> +<% end %> diff --git a/config/locales/communication/en.yml b/config/locales/communication/en.yml index 45fb35a7900e2a3d9a26290ea0c8e33daf1d46c7..a832ba1ef6b01e3ced38b7151fa101f5486a7dc7 100644 --- a/config/locales/communication/en.yml +++ b/config/locales/communication/en.yml @@ -123,6 +123,19 @@ en: admin: communication: blocks: + categories: + basic: + label: Basic blocks + description: Essential bricks to build your page + storytelling: + label: Storytelling blocks + description: Advanced tools to organize and showcase your content + references: + label: List blocks + description: Lists of other objects, to present and connect + utilities: + label: Utility blocks + description: Purely practical and technical features components: text: label: Text @@ -141,8 +154,9 @@ en: not_linked: No linked file link: target_blank: Open in new window - template_kinds: + templates: call_to_action: + description: A title, a text, an optional image and up to 3 call to action buttons. edit: button_1: Primary button button_2: Secondary button @@ -162,12 +176,16 @@ en: url_label: Link url_placeholder: Enter the URL with "https://..." chapter: + description: A section of a document, with a title, a text, footnotes and an image. edit: notes_label: Notes notes_placeholder: Enter notes text_label: Text text_placeholder: Enter text + datatable: + description: A table of data, as responsive and accessible as possible. definitions: + description: A list of terms and definitions. We could call it a dictionary. edit: add_definition: Add definition remove_definition: Delete definition @@ -176,12 +194,14 @@ en: text_label: Text text_placeholder: Enter text here embed: + description: HTML raw code, so you can integrate maps or iframe components. edit: code_label: Code code_placeholder: Enter code transcription_label: Text transcript transcription_placeholder: Enter text transcript files: + description: A list of downloadable files, mentioning their file size. edit: add_file: Add a file file_label: File @@ -189,6 +209,7 @@ en: title_placeholder: Enter title here remove_file: Remove a file gallery: + description: A gallery of images, with an accessible description, a text and a credit for each image. layouts: grid: label: Grid @@ -206,7 +227,10 @@ en: text_label: Text text_placeholder: Enter text remove_image: Remove image + image: + description: An image with its alternative description, a credit and a text. key_figures: + description: Animated figures, with a unit and a text. edit: add_key: Add key figure unit_label: Unit @@ -217,6 +241,7 @@ en: description_placeholder: Enter description here remove_key: Remove key figure organization_chart: + description: People and their jobs. edit: add_person: Add person person_label: Person @@ -226,6 +251,7 @@ en: drag_title: Drag and drop to organize persons delete_title: Remove person pages: + description: A highlight of some pages, with multiple layout options. layouts: cards: label: Cards @@ -257,6 +283,7 @@ en: pages_descriptions: Show pages short descriptions pages_images: Show pages images partners: + description: A list of organizations with logo, name and website. edit: add_partner: Add partner partner_name_label: Partner @@ -266,7 +293,10 @@ en: partner_logo_label: Logo remove_logo: Remove logo remove_partner: Remove partner + posts: + description: A list of highlighted news. testimonials: + description: One or more testimonies edit: add_testimonial: Add testimonial text_label: Text @@ -279,6 +309,7 @@ en: remove_photo: Remove photo remove_testimonial: Remove testimonial timeline: + description: A list of events with their description, on a timeline. edit: add_event: Add event remove_event: Delete event @@ -287,6 +318,7 @@ en: text_label: Text text_placeholder: Enter text here video: + description: An embedded video from most platforms, with the text transcription for accessibility, and no autoplay. edit: url_label: Video url url_placeholder: Enter video's url @@ -418,6 +450,7 @@ en: files: Files gallery: Gallery image: Image + key_figures: Key figures organization_chart: Organization chart pages: Pages partners: Partners diff --git a/config/locales/communication/fr.yml b/config/locales/communication/fr.yml index e464d5ca1a8e64b411fedc1b407909c9ae7f79a5..986f7921d02541a17c2908825e4efc246ed20cf8 100644 --- a/config/locales/communication/fr.yml +++ b/config/locales/communication/fr.yml @@ -123,6 +123,19 @@ fr: admin: communication: blocks: + categories: + basic: + label: Blocs de base + description: Les éléments essentiels pour constituer une page + storytelling: + label: Blocs narratifs + description: Des outils plus sophistiqués pour articuler et mettre en scène des contenus + references: + label: Blocs de liste + description: Des listes d'autres objets, qui mettent en valeur et créent des liens + utilities: + label: Blocs techniques + description: Des fonctionnalités pratiques, purement utilitaires components: text: label: Texte @@ -144,6 +157,7 @@ fr: templates: call_to_action: + description: Un titre, un texte, un visuel et 3 boutons pour inviter les personnes à agir. edit: button_1: Bouton principal button_2: Bouton secondaire @@ -163,12 +177,16 @@ fr: url_label: Lien url_placeholder: Entrer le lien ici avec "https://..." chapter: + description: Une section de document avec un titre, un texte, des notes de bas de page et une image. edit: notes_label: Notes notes_placeholder: Entrer les notes text_label: Texte text_placeholder: Entrer le texte + datatable: + description: Un tableau de données, aussi responsive et accessible que possible. definitions: + description: Une liste de termes et leur définition. Un genre de dictionnaires, finalement. edit: add_definition: Ajouter une définition remove_definition: Supprimer la définition @@ -177,12 +195,14 @@ fr: text_label: Texte text_placeholder: Entrer la description de la définition embed: + description: Du code HTML brut, permettant d'intégrer des cartes ou divers composants en iframe. edit: code_label: Code du bloc d'intégration HTML code_placeholder: Entrez ici le code transcription_label: Transcription textuelle du contenu transcription_placeholder: Entrez ici la transcription files: + description: Une liste de fichiers téléchargeables, présentés avec leur poids. edit: add_file: Ajouter un fichier file_label: Fichier @@ -190,6 +210,7 @@ fr: title_placeholder: Entrer le titre du fichier remove_file: Supprimer le fichier gallery: + description: Une galerie d'images, avec pour chaque image une description accessible, un texte et un crédit. layouts: grid: label: Grille @@ -207,7 +228,10 @@ fr: text_label: Texte text_placeholder: Entrer le texte remove_image: Enlever l'image + image: + description: Une image avec sa description alternative accessible, son texte et son crédit. key_figures: + description: Des chiffres clés avec une jolie animation. Chaque chiffre peut être doté d'une unité et d'un texte. edit: add_key: Add key figure unit_label: Unit @@ -218,6 +242,7 @@ fr: description_placeholder: Enter description here remove_key: Remove key figure organization_chart: + description: Un organigramme présentant des personnes et leur fonction. edit: add_person: Ajouter une personne person_label: Personne @@ -227,6 +252,7 @@ fr: drag_title: Glisser-déposer pour organiser les personnes delete_title: Enlever la personne pages: + description: Une mise en avant d'une sélection de pages, avec plusieurs options d'affichage. layouts: cards: label: Cartes @@ -258,6 +284,7 @@ fr: pages_descriptions: Afficher les descriptions courtes des pages pages_images: Afficher les images des pages partners: + description: Une liste de partenaires, avec leur logo, leur site et leur nom. edit: add_partner: Ajouter un partenaire partner_name_label: Partenaire @@ -267,7 +294,10 @@ fr: partner_logo_label: Logo remove_logo: Enlever le logo remove_partner: Enlever le partenaire + posts: + description: Une liste d'actualités mises en avant. testimonials: + description: Un ou plusieurs témoignages, avec le texte, l'auteur, sa fonction et sa photo. edit: add_testimonial: Ajouter un témoignage text_label: Texte @@ -280,6 +310,7 @@ fr: remove_photo: Enlever la photo remove_testimonial: Enlever le témoignage timeline: + description: Une liste d'événements avec leur description, présentés en frise. edit: description_label: Description description_placeholder: Entrer la description @@ -290,6 +321,7 @@ fr: text_label: Texte text_placeholder: Entrer le texte de l'événement video: + description: Une vidéo intégrée dans la page depuis diverses plateformes, avec la transcription et sans lecture automatique. edit: url_label: Url de la vidéo url_placeholder: Entrer l'url de la vidéo @@ -423,9 +455,9 @@ fr: image: Image key_figures: Chiffres-clés organization_chart: Organigramme - pages: Liste de pages + pages: Pages partners: Partenaires - posts: Liste d'actualités + posts: Actualités testimonials: Témoignages timeline: Frise chronologique video: Vidéo