diff --git a/app/models/communication/block/template/post.rb b/app/models/communication/block/template/post.rb index 7f5c803c0d045307e500187b3d2da88811bcfe10..08e3918a71d958089af022637ae26d89a7e60be4 100644 --- a/app/models/communication/block/template/post.rb +++ b/app/models/communication/block/template/post.rb @@ -35,7 +35,7 @@ class Communication::Block::Template::Post < Communication::Block::Template category.posts.ordered.limit(quantity) end - def selected_posts_free + def selected_posts_selection elements.map { |element| post(element['id']) } .compact end diff --git a/app/models/communication/block/template/timeline.rb b/app/models/communication/block/template/timeline.rb index 13359cdfe3333169dbdbb089cae76bcf67cc7213..94c030a8459d1eca581c158224567fc8e3d827eb 100644 --- a/app/models/communication/block/template/timeline.rb +++ b/app/models/communication/block/template/timeline.rb @@ -1,4 +1,9 @@ class Communication::Block::Template::Timeline < Communication::Block::Template + + def description + "#{data['description']}" + end + def events @events ||= elements.map { |element| event(element) } .compact diff --git a/app/views/admin/communication/blocks/templates/pages/_edit.html.erb b/app/views/admin/communication/blocks/templates/pages/_edit.html.erb index 628602fcc2367e252d7dc920ec0f810dc06c09d9..8ac8909e21b1df8673b76a3a33f7539b34186f32 100644 --- a/app/views/admin/communication/blocks/templates/pages/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/pages/_edit.html.erb @@ -59,7 +59,6 @@ <option value="<%= page[:id] %>"><%= page[:label].html_safe %></option> <% end %> </select> - </div> <div class="col-6"> <div class="col-md-6"> diff --git a/app/views/admin/communication/blocks/templates/timeline/_edit.html.erb b/app/views/admin/communication/blocks/templates/timeline/_edit.html.erb index a646b4816c4b05cc79ca75aa64a352d0c8cb928a..6a9f54f1c4fddc6b0d979dfe9dc53ca6af078af4 100644 --- a/app/views/admin/communication/blocks/templates/timeline/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/timeline/_edit.html.erb @@ -1,3 +1,10 @@ +<label for="description"><%= t '.description_placeholder' %></label> +<textarea class="form-control mb-2" + rows="3" + v-model="data.description" + placeholder="<%= t '.description_placeholder' %>" + id="description"></textarea> + <a class="<%= button_classes('mb-4') %>" v-on:click="data.elements.push({title: '', text: ''})"> <%= t '.add_event' %> diff --git a/app/views/admin/communication/blocks/templates/timeline/_show.html.erb b/app/views/admin/communication/blocks/templates/timeline/_show.html.erb index e7bb0b4b59b9d304a16018a95c11cc132c41cf74..461a8243f8eaabd4a1e9dc28fdc4d4718fe1c337 100644 --- a/app/views/admin/communication/blocks/templates/timeline/_show.html.erb +++ b/app/views/admin/communication/blocks/templates/timeline/_show.html.erb @@ -1,3 +1,4 @@ +<p><%= @block.template.description %></p> <div class="row"> <% @block.template.events.each do |event| %> <div class="col-xxl-4 col-xl-6"> diff --git a/app/views/admin/communication/blocks/templates/timeline/_static.html.erb b/app/views/admin/communication/blocks/templates/timeline/_static.html.erb index dbfed4bda9cb5d0792b85d456f5cb02b0659e50a..fd0c941736bfef710e2287ad6bcacd6a09ec8bb1 100644 --- a/app/views/admin/communication/blocks/templates/timeline/_static.html.erb +++ b/app/views/admin/communication/blocks/templates/timeline/_static.html.erb @@ -1,6 +1,9 @@ + description: >- + <%= prepare_text_for_static block.template.description %> + events: <% block.template.events.each do |event| %> - - title: >- - <%= prepare_text_for_static event.title %> - text: >- - <%= prepare_text_for_static event.text %> + - title: >- + <%= prepare_text_for_static event.title %> + text: >- + <%= prepare_text_for_static event.text %> <% end %> diff --git a/config/locales/communication/fr.yml b/config/locales/communication/fr.yml index 0a2cd407863f92aee942dfbd2881960a633099ee..63e92f048e8d5e253aea8e63fb181f5238eff432 100644 --- a/config/locales/communication/fr.yml +++ b/config/locales/communication/fr.yml @@ -165,6 +165,8 @@ fr: remove_testimonial: Enlever le témoignage timeline: edit: + description_label: Description + description_placeholder: Entrer la description add_event: Ajouter un événement remove_event: Supprimer l'événement title_label: Titre