diff --git a/app/models/communication/block/template/agenda.rb b/app/models/communication/block/template/agenda.rb index 12dddd549f2e42ba1645dc798855681f6d5faeff..a3eafdfc7bb328ebd40f655616c58db743fd9254 100644 --- a/app/models/communication/block/template/agenda.rb +++ b/app/models/communication/block/template/agenda.rb @@ -1,19 +1,19 @@ class Communication::Block::Template::Agenda < Communication::Block::Template::Base AUTHORIZED_SCOPES = [ - 'future_or_present', + 'future_or_current', 'future', - 'present', + 'current', 'archive' ] - + has_elements has_layouts [:grid, :list, :large] has_component :mode, :option, options: [:all, :category, :selection] has_component :category_id, :category has_component :description, :rich_text has_component :quantity, :number, options: 3 - has_component :time, :option, options: [:future_or_present, :future, :present, :archive] + has_component :time, :option, options: AUTHORIZED_SCOPES has_component :show_category, :boolean has_component :show_summary, :boolean has_component :show_status, :boolean @@ -33,7 +33,7 @@ class Communication::Block::Template::Agenda < Communication::Block::Template::B def allowed_for_about? website.present? end - + def children selected_events end diff --git a/app/models/communication/website/agenda/event.rb b/app/models/communication/website/agenda/event.rb index 742c2a0e688ffac9b98d19aca7fdfae0376d6a60..bd670f2ccd8ef81f97dddbbf4602a7b1e5f9327d 100644 --- a/app/models/communication/website/agenda/event.rb +++ b/app/models/communication/website/agenda/event.rb @@ -71,12 +71,12 @@ class Communication::Website::Agenda::Event < ApplicationRecord scope :recent, -> { order(:updated_at).limit(5) } scope :published, -> { where(published: true) } scope :draft, -> { where(published: false) } - + scope :for_category, -> (category_id) { joins(:categories).where(communication_website_categories: { id: category_id }).distinct } scope :future, -> { where('from_day > :today', today: Date.today).ordered_asc } - scope :future_or_present, -> { where('from_day <= :today', today: Date.today).ordered_asc } - scope :present, -> { where('(from_day <= :today AND to_day IS NULL) OR (from_day <= :today AND to_day >= :today)', today: Date.today).ordered_asc } + scope :future_or_current, -> { where('from_day <= :today', today: Date.today).ordered_asc } + scope :current, -> { where('(from_day <= :today AND to_day IS NULL) OR (from_day <= :today AND to_day >= :today)', today: Date.today).ordered_asc } scope :archive, -> { where('to_day < :today', today: Date.today).ordered_desc } scope :past, -> { archive } @@ -84,14 +84,14 @@ class Communication::Website::Agenda::Event < ApplicationRecord validate :to_day_after_from_day, :to_hour_after_from_hour_on_same_day STATUS_FUTURE = 'future' - STATUS_PRESENT = 'present' + STATUS_CURRENT = 'current' STATUS_ARCHIVE = 'archive' def status if future? STATUS_FUTURE - elsif present? - STATUS_PRESENT + elsif current? + STATUS_CURRENT else STATUS_ARCHIVE end @@ -101,7 +101,7 @@ class Communication::Website::Agenda::Event < ApplicationRecord from_day > Date.today end - def present? + def current? to_day.present? ? (Date.today >= from_day && Date.today <= to_day) : from_day <= Date.today # Les événements sans date de fin restent actifs end diff --git a/config/locales/communication/contents/en.yml b/config/locales/communication/contents/en.yml index 3fe57f049b1955ba0f62bf56d5f65ae26aa011e4..4dbb688f84ce4c538ca29aaef80b23fd26138805 100644 --- a/config/locales/communication/contents/en.yml +++ b/config/locales/communication/contents/en.yml @@ -92,13 +92,13 @@ en: show_summary: label: Show events' summaries show_status: - label: Show events' status (present, future...) + label: Show events' status (current, future...) time: label: What event dates should be displayed? options: - future_or_present: Now and in the future + future_or_current: Now and in the future future: In the future, not started yet - present: Running now + current: Running now archive: Past, archives call_to_action: description: A title, a text, an optional image and up to 3 call to action buttons. diff --git a/config/locales/communication/contents/fr.yml b/config/locales/communication/contents/fr.yml index 6cb04ac3d59a8aad3e01625505e7eff81e4b8c31..9df3eb5e64c24503e96ee7f9fbf03ca216b54f3c 100644 --- a/config/locales/communication/contents/fr.yml +++ b/config/locales/communication/contents/fr.yml @@ -64,7 +64,7 @@ fr: description: Une liste d'événements avec de petites images à la même largeur. large: label: Grand - description: Chaque événement est présenté en majesté, sur toute la largeur disponible avec une grande image. + description: Chaque événement est présenté en majesté, sur toute la largeur disponible avec une grande image. edit: add_event: Ajouter un événement category_id: @@ -96,9 +96,9 @@ fr: time: label: Quelles dates d'événements afficher ? options: - future_or_present: En cours et à venir + future_or_current: En cours et à venir future: À venir, pas encore en cours - present: En cours en ce moment + current: En cours en ce moment archive: Terminés, archivés call_to_action: description: Un titre, un texte, un visuel et 3 boutons pour inviter les personnes à agir. @@ -380,7 +380,7 @@ fr: description: Une alternance très légère graphiquement de pages, rythmée entre la gauche et la droite. large: label: Grand - description: Chaque page est présentée en majesté, sur toute la largeur disponible avec une grande image. + description: Chaque page est présentée en majesté, sur toute la largeur disponible avec une grande image. edit: mode: label: Type de liste @@ -444,7 +444,7 @@ fr: description: Une alternance très légère graphiquement d'articles entre la gauche et la droite de la page. large: label: Grand - description: Chaque actualité est présentée en majesté, sur toute la largeur disponible avec une grande image. + description: Chaque actualité est présentée en majesté, sur toute la largeur disponible avec une grande image. edit: add_post: Ajouter un article mode: