diff --git a/app/models/communication/block/template/agenda.rb b/app/models/communication/block/template/agenda.rb index 86fbe46b1313579da22877825873da38aa5333fb..14bb0d4c573f78109b60e12933fdb3db69d26dd8 100644 --- a/app/models/communication/block/template/agenda.rb +++ b/app/models/communication/block/template/agenda.rb @@ -26,6 +26,7 @@ class Communication::Block::Template::Agenda < Communication::Block::Template::B has_component :show_category, :boolean has_component :show_summary, :boolean has_component :show_status, :boolean + has_component :no_event_message, :string def selected_events @selected_events ||= send "selected_events_#{mode}" diff --git a/app/views/admin/communication/blocks/templates/agenda/_edit.html.erb b/app/views/admin/communication/blocks/templates/agenda/_edit.html.erb index 12bb26f4df9ff619843ce6bb2ad96c6c92185587..23829c8be06185dbd9f84d4dd3950906411c6731 100644 --- a/app/views/admin/communication/blocks/templates/agenda/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/agenda/_edit.html.erb @@ -58,6 +58,7 @@ <%= block_component_edit block, :show_summary %> <%= block_component_edit block, :show_category %> <%= block_component_edit block, :show_status %> + <%= block_component_edit block, :no_event_message %> </div> </div> </div> diff --git a/app/views/admin/communication/blocks/templates/agenda/_show.html.erb b/app/views/admin/communication/blocks/templates/agenda/_show.html.erb index e18bd15781c110349148e95e93f6e5ad7221497a..4d7194e4d4862ea558cb18b1733b5175174d431d 100644 --- a/app/views/admin/communication/blocks/templates/agenda/_show.html.erb +++ b/app/views/admin/communication/blocks/templates/agenda/_show.html.erb @@ -38,6 +38,9 @@ end </div> </article> <% end %> + <% if block.template.selected_events.empty? %> + <p><%= block.template.no_event_message %></p> + <% end %> <% end %> </div> </div> diff --git a/app/views/admin/communication/blocks/templates/agenda/_static.html.erb b/app/views/admin/communication/blocks/templates/agenda/_static.html.erb index 966c8cab0b216233cbc51b3f06a5463ff0dc2732..0b1332ee470b6bd5a393447cbcf78dfe2c1e25cc 100644 --- a/app/views/admin/communication/blocks/templates/agenda/_static.html.erb +++ b/app/views/admin/communication/blocks/templates/agenda/_static.html.erb @@ -1,13 +1,13 @@ <%= block_component_static block, :mode %> <%= block_component_static block, :layout %> <%= block_component_static block, :description %> +<%= block_component_static block, :no_event_message %> +<%= block_component_static block, :show_summary %> +<%= block_component_static block, :show_category %> +<%= block_component_static block, :show_status %> <% if block.template.mode == 'category' && block.template.category %> category: "<%= block.template.category.path %>" <% end %> - show_summary: <%= block.template.show_summary %> - show_category: <%= block.template.show_category %> - show_status: <%= block.template.show_status %> - events: <% block.template.selected_events.each do |element| %> - path: "<%= element.current_permalink_in_website(@website)&.path %>" diff --git a/config/locales/communication/contents/en.yml b/config/locales/communication/contents/en.yml index e5279f58b42a55fbc7321a417efe04799b5eabbf..21d0677375a2d7e74656400022c9651abf6e40d9 100644 --- a/config/locales/communication/contents/en.yml +++ b/config/locales/communication/contents/en.yml @@ -86,6 +86,9 @@ en: category: A specific category of events selection: A selection of events categories: A list of all events' categories + no_event_message: + label: Sentence to be displayed if there is no event + placeholder: Enter the desired sentence quantity: label: Quantity of events to show placeholder: Enter quantity diff --git a/config/locales/communication/contents/fr.yml b/config/locales/communication/contents/fr.yml index 460bd127828f24e55738462cb661befee84d3033..4320c63e6a9d93bbdf110ba10a908824c0bc4b67 100644 --- a/config/locales/communication/contents/fr.yml +++ b/config/locales/communication/contents/fr.yml @@ -86,6 +86,9 @@ fr: category: Une catégorie spécifique d'événements selection: Une sélection d'événements categories: La liste des catégories d'événements + no_event_message: + label: Phrase à afficher s'il n'y a aucun événement + placeholder: Entrer la phrase souhaitée quantity: label: Quantité d'événements à afficher placeholder: Entrer la quantité