diff --git a/app/models/communication/block/template/file.rb b/app/models/communication/block/template/file.rb index 44322dc71270c5d9a15f1707280afe93fe048982..1d07223ed8065a6e77dbf38127eca85460f4430d 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 572169bcc60eae93b6f91c95ac7beeb463bdadac..17d6cfdcad19a63d94b8ee7dc44de3dcd3b3898b 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 42901e89c5cfccd6cab37dae0bcbf0df7fb3d158..a2de8cb9a7ab9b5bef28068463c88d3de8921584 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 1644b17aef327481772ba6d1b31c509ce68594b0..25a1e19005a20bb52091de8f7804caf020a6c85f 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 8e2b5d63173207ff2b20f836b19312fed42082ef..52971a54e0e37ff8c0b443462c306c2aafd60907 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 4153e497d29f169388a87071811d16e9e933be4c..f79297521387fb45ea41935b35f8239ddcbf6031 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 887d247e2c6f89d8cf5ad9acd424e5946414effd..f7e976917bebcd69d2ed4080e7948d589be3bdb7 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 2807e72e1dd9b010768402369eab1ba8686aef14..11793b83fdea5ff680e1e4a073046bacba0cf66c 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 09e483a80d6328f75a1e1ba04747123beff8ffa9..c2155870a15c4215711f7b567b7bd4d6f8520375 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 f272c8046952c73cd184482af3aac037ef9c0a88..f7aab6b5f265606e02e76603557bd77b18c4715f 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 860632e82d067f50f0af21b01a7cd3651394b072..2d82becb5955a9b507dceb93e40e443dbab6aadb 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 1492348dcdfdb3736f9723185437ba741815e7df..61498d485e0b8cfb49220f42fa76344a8bf86fbe 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 0498531d17f301ee65cba33c290db68e97690447..a747c3c94b48045004a7889d3e7fecf38cc02abc 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 8785dd5739964b86a75d18c00b828bfcfe35a207..86b6271bc18373ecd2231b63789dec50a88998f5 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 db4f03a2927df38020f44f6ea3487df28b532e6f..8b75e7d02dae37be13514a2452577da523caabb2 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