From 6702148278b9f38d3004487f3348f4254b581d66 Mon Sep 17 00:00:00 2001 From: Arnaud Levy <contact@arnaudlevy.com> Date: Fri, 17 Jun 2022 19:09:24 +0200 Subject: [PATCH] descriptions --- .../communication/block/template/file.rb | 1 + .../communication/block/template/gallery.rb | 1 + .../block/template/organization_chart.rb | 1 + .../communication/block/template/partner.rb | 1 + .../blocks/components/file/_edit.html.erb | 14 ++++++----- .../blocks/templates/files/_edit.html.erb | 25 ++++++------------- .../blocks/templates/files/_preview.html.erb | 3 ++- .../blocks/templates/files/_static.html.erb | 1 + .../blocks/templates/gallery/_edit.html.erb | 9 ++++++- .../templates/gallery/_preview.html.erb | 1 + .../blocks/templates/gallery/_static.html.erb | 1 + .../blocks/templates/partners/_edit.html.erb | 5 ++++ .../templates/partners/_preview.html.erb | 1 + .../templates/partners/_static.html.erb | 13 +++++----- config/locales/communication/fr.yml | 14 ++++++++--- 15 files changed, 55 insertions(+), 36 deletions(-) diff --git a/app/models/communication/block/template/file.rb b/app/models/communication/block/template/file.rb index 44322dc71..1d07223ed 100644 --- a/app/models/communication/block/template/file.rb +++ b/app/models/communication/block/template/file.rb @@ -1,5 +1,6 @@ class Communication::Block::Template::File < Communication::Block::Template::Base has_elements + has_component :description, :rich_text end diff --git a/app/models/communication/block/template/gallery.rb b/app/models/communication/block/template/gallery.rb index 572169bcc..17d6cfdca 100644 --- a/app/models/communication/block/template/gallery.rb +++ b/app/models/communication/block/template/gallery.rb @@ -2,5 +2,6 @@ class Communication::Block::Template::Gallery < Communication::Block::Template:: has_elements has_layouts [:grid, :carousel] + has_component :description, :rich_text end diff --git a/app/models/communication/block/template/organization_chart.rb b/app/models/communication/block/template/organization_chart.rb index 42901e89c..a2de8cb9a 100644 --- a/app/models/communication/block/template/organization_chart.rb +++ b/app/models/communication/block/template/organization_chart.rb @@ -1,5 +1,6 @@ class Communication::Block::Template::OrganizationChart < Communication::Block::Template::Base has_elements + has_component :description, :rich_text end diff --git a/app/models/communication/block/template/partner.rb b/app/models/communication/block/template/partner.rb index 1644b17ae..25a1e1900 100644 --- a/app/models/communication/block/template/partner.rb +++ b/app/models/communication/block/template/partner.rb @@ -1,5 +1,6 @@ class Communication::Block::Template::Partner < Communication::Block::Template::Base has_elements + has_component :description, :rich_text 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 8e2b5d631..52971a54e 100644 --- a/app/views/admin/communication/blocks/components/file/_edit.html.erb +++ b/app/views/admin/communication/blocks/components/file/_edit.html.erb @@ -14,10 +14,12 @@ remove = t 'admin.communication.blocks.components.file.input.remove' @change="onFileImageChange( $event, <%= model %>, '<%= property %>' )" :id="<%= dom_id.html_safe %>"> </div> - <a class="btn btn-sm btn-danger" - v-on:click="<%= model %>.<%= property %>={}" - v-if="<%= model %>.<%= property %>.id"> - <i class="fas fa-times"></i> - <%= remove %> - </a> + <div v-if="<%= model %>.<%= property %>.id"> + <p><b>{{ element.file.filename }}</b></p> + <a class="btn btn-sm btn-danger" + v-on:click="<%= model %>.<%= property %>={}"> + <i class="fas fa-times"></i> + <%= remove %> + </a> + </div> </div> diff --git a/app/views/admin/communication/blocks/templates/files/_edit.html.erb b/app/views/admin/communication/blocks/templates/files/_edit.html.erb index 4153e497d..f79297521 100644 --- a/app/views/admin/communication/blocks/templates/files/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/files/_edit.html.erb @@ -1,4 +1,8 @@ -<% element = @block.template.default_element %> +<div class="row"> + <div class="col-xl-6"> + <%= block_component_edit :description %> + </div> +</div> <%= block_component_add_element t('.add_file') %> @@ -18,23 +22,8 @@ </div> </div> <div class="card-body"> - <div class="d-flex"> - <div class="flex-fill"> - <%= block_component_edit :title, template: element %> - - <div v-if="element.file.id"> - <p><b>{{ element.file.filename }}</b></p> - <a class="btn btn-sm btn-danger mt-2" - v-on:click="element.file={}"> - <i class="fas fa-times"></i> - <%= t '.remove_file' %> - </a> - </div> - <div v-if="!element.file.id"> - <%= block_component_edit :file, template: element %> - </div> - </div> - </div> + <%= block_component_edit :title, template: @element %> + <%= block_component_edit :file, template: @element %> </div> </div> </div> diff --git a/app/views/admin/communication/blocks/templates/files/_preview.html.erb b/app/views/admin/communication/blocks/templates/files/_preview.html.erb index 887d247e2..f7e976917 100644 --- a/app/views/admin/communication/blocks/templates/files/_preview.html.erb +++ b/app/views/admin/communication/blocks/templates/files/_preview.html.erb @@ -1,3 +1,4 @@ +<%= block_component_preview :description %> <ul> <% @block.template.elements.each do |element| %> <% next unless element.blob %> @@ -7,5 +8,5 @@ <small>(<%= element.blob.filename %>)</small> </a> </li> -<% end %> + <% end %> </ul> diff --git a/app/views/admin/communication/blocks/templates/files/_static.html.erb b/app/views/admin/communication/blocks/templates/files/_static.html.erb index 2807e72e1..11793b83f 100644 --- a/app/views/admin/communication/blocks/templates/files/_static.html.erb +++ b/app/views/admin/communication/blocks/templates/files/_static.html.erb @@ -1,3 +1,4 @@ +<%= block_component_static :description %> files: <% block.template.elements.each do |element| %> <% next unless element.blob %> 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 09e483a80..c2155870a 100644 --- a/app/views/admin/communication/blocks/templates/gallery/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/gallery/_edit.html.erb @@ -1,4 +1,11 @@ -<%= block_component_edit :layout, horizontal: true %> +<div class="row"> + <div class="col-xl-6"> + <%= block_component_edit :description %> + </div> + <div class="col-xl-6"> + <%= block_component_edit :layout %> + </div> +</div> <%= block_component_add_element t('.add_image') %> <draggable :list="data.elements" handle=".imageHandle" class="row"> diff --git a/app/views/admin/communication/blocks/templates/gallery/_preview.html.erb b/app/views/admin/communication/blocks/templates/gallery/_preview.html.erb index f272c8046..f7aab6b5f 100644 --- a/app/views/admin/communication/blocks/templates/gallery/_preview.html.erb +++ b/app/views/admin/communication/blocks/templates/gallery/_preview.html.erb @@ -1,3 +1,4 @@ +<%= block_component_preview :description %> <%= block_component_preview :layout %> <div class="row"> <% @block.template.elements.each do |element| %> 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 860632e82..2d82becb5 100644 --- a/app/views/admin/communication/blocks/templates/gallery/_static.html.erb +++ b/app/views/admin/communication/blocks/templates/gallery/_static.html.erb @@ -1,3 +1,4 @@ +<%= block_component_static :description %> <%= block_component_static :layout %> images: <% block.template.elements.each do |element| %> diff --git a/app/views/admin/communication/blocks/templates/partners/_edit.html.erb b/app/views/admin/communication/blocks/templates/partners/_edit.html.erb index 1492348dc..61498d485 100644 --- a/app/views/admin/communication/blocks/templates/partners/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/partners/_edit.html.erb @@ -1,3 +1,8 @@ +<div class="row"> + <div class="col-xl-6"> + <%= block_component_edit :description %> + </div> +</div> <%= block_component_add_element t('.add_partner') %> <draggable :list="data.elements" class="list-group" handle=".partnerHandle"> <div v-for="(element, index) in data.elements" class="list-group-item"> diff --git a/app/views/admin/communication/blocks/templates/partners/_preview.html.erb b/app/views/admin/communication/blocks/templates/partners/_preview.html.erb index 0498531d1..a747c3c94 100644 --- a/app/views/admin/communication/blocks/templates/partners/_preview.html.erb +++ b/app/views/admin/communication/blocks/templates/partners/_preview.html.erb @@ -1,3 +1,4 @@ +<%= block_component_preview :description %> <div class="row"> <% @block.template.elements.each do |element| %> <div class="col-6 mb-3"> diff --git a/app/views/admin/communication/blocks/templates/partners/_static.html.erb b/app/views/admin/communication/blocks/templates/partners/_static.html.erb index 8785dd573..86b6271bc 100644 --- a/app/views/admin/communication/blocks/templates/partners/_static.html.erb +++ b/app/views/admin/communication/blocks/templates/partners/_static.html.erb @@ -1,10 +1,11 @@ -<% -block.template.elements.each do |element| %> +<%= block_component_static :description %> + partners: +<% block.template.elements.each do |element| %> <% if element.organization %> - - slug: "<%= element.organization.slug %>" + - slug: "<%= element.organization.slug %>" <% else %> -<%= block_component_static :name, template: element, list: true %> -<%= block_component_static :url, template: element, depth: 4 %> - logo: "<%= element.logo_component.blob&.id %>" +<%= block_component_static :name, template: element, depth: 4, list: true %> +<%= block_component_static :url, template: element, depth: 5 %> + logo: "<%= element.logo_component.blob&.id %>" <% end %> <% end %> diff --git a/config/locales/communication/fr.yml b/config/locales/communication/fr.yml index db4f03a29..8b75e7d02 100644 --- a/config/locales/communication/fr.yml +++ b/config/locales/communication/fr.yml @@ -157,8 +157,6 @@ fr: credit: label: Crédit placeholder: Entrer le crédit - file: - not_linked: Pas de fichier lié link: target_blank: Ouvrir dans une nouvelle fenêtre templates: @@ -225,6 +223,8 @@ fr: description: Une liste de fichiers téléchargeables, présentés avec leur poids. edit: add_file: Ajouter un fichier + description: + label: Description element: file: label: Fichier @@ -237,11 +237,13 @@ fr: layouts: grid: label: Grille - description: Les images sont présentées en grille, de gauche à droite puis de haut en bas. + description: Les images sont présentées en grille, toutes de la même taille. carousel: label: Carrousel - description: Les images sont présentées en grand, avec une navigation suivant / précédent. + description: Les images sont présentées en grand, toutes de la même hauteur. edit: + description: + label: Description element: text: label: Texte @@ -279,6 +281,8 @@ fr: description: Un organigramme présentant des personnes et leur fonction. edit: add_person: Ajouter une personne + description: + label: Description element: id: label: Personne @@ -330,6 +334,8 @@ fr: description: Une liste de partenaires, avec leur logo, leur site et leur nom. edit: add_partner: Ajouter un partenaire + description: + label: Description element: id: label: Organisation -- GitLab