diff --git a/app/models/communication/website/agenda/event/with_time.rb b/app/models/communication/website/agenda/event/with_time.rb index 9da9f67fc0c547fe7a5f253ab9d76ae608a01b1f..ea401cbbb8120e29a215884a2a5750d5031d0245 100644 --- a/app/models/communication/website/agenda/event/with_time.rb +++ b/app/models/communication/website/agenda/event/with_time.rb @@ -47,6 +47,14 @@ module Communication::Website::Agenda::Event::WithTime from_day == to_day end + def has_hours? + from_hour.present? || to_hour.present? + end + + def has_specific_time_zone? + time_zone != website.default_time_zone + end + # Un événement demain aura une distance de 1, comme un événement hier # On utilise cette info pour classer les événements à venir dans un sens et les archives dans l'autre def distance_in_days diff --git a/app/views/admin/communication/websites/agenda/events/_dates.html.erb b/app/views/admin/communication/websites/agenda/events/_dates.html.erb index 68a6fb78ec37f336035a15fb9c6e716dbea88af8..5fbfedcf52976acc328986e2088d95c1b938b9b2 100644 --- a/app/views/admin/communication/websites/agenda/events/_dates.html.erb +++ b/app/views/admin/communication/websites/agenda/events/_dates.html.erb @@ -21,7 +21,7 @@ day_format = detailed ? :full <%= l(event.to_hour, format: :time_only) if event.to_hour %> <% end %> <% end %> -<% unless event.from_hour.nil? && event.to_hour.nil? || event.time_zone == @website.default_time_zone %> +<% if event.has_hours? && event.has_specific_time_zone? %> <br> <%= t('admin.communication.website.agenda.events.formatted_time_zone', time_zone: event.time_zone) %> <% end %> \ No newline at end of file