From 246d53ed46240afccfed0b8ad36cfae3c1b163bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Gaya?= <sebastien.gaya@gmail.com> Date: Fri, 9 Feb 2024 10:23:58 +0100 Subject: [PATCH] cal_provider_url --- .../website/agenda/event/with_cal.rb | 31 ++++++++++++++++--- .../agenda/events/_dates_static.html.erb | 10 +++--- 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/app/models/communication/website/agenda/event/with_cal.rb b/app/models/communication/website/agenda/event/with_cal.rb index dfbdc0c08..e964f63a6 100644 --- a/app/models/communication/website/agenda/event/with_cal.rb +++ b/app/models/communication/website/agenda/event/with_cal.rb @@ -17,15 +17,36 @@ module Communication::Website::Agenda::Event::WithCal ) end + def cal_google_url + add_to_calendar_urls['google'] + end + + def cal_yahoo_url + add_to_calendar_urls['yahoo'] + end + + def cal_office_url + add_to_calendar_urls['office'] + end + + def cal_outlook_url + add_to_calendar_urls['outlook'] + end + + def cal_ical_url + add_to_calendar_urls['ical'] + end + + protected def set_add_to_calendar_urls self.add_to_calendar_urls = { - google: cal.google_url, - yahoo: cal.yahoo_url, - office: cal.office365_url, - outlook: cal.outlook_com_url, - ical: cal.ical_url + 'google' => cal.google_url, + 'yahoo' => cal.yahoo_url, + 'office' => cal.office365_url, + 'outlook' => cal.outlook_com_url, + 'ical' => cal.ical_url } end diff --git a/app/views/admin/communication/websites/agenda/events/_dates_static.html.erb b/app/views/admin/communication/websites/agenda/events/_dates_static.html.erb index 69547b84a..e6d436b85 100644 --- a/app/views/admin/communication/websites/agenda/events/_dates_static.html.erb +++ b/app/views/admin/communication/websites/agenda/events/_dates_static.html.erb @@ -26,8 +26,8 @@ indentation = ' ' * depth <%= indentation %> hour: <%= event.to_hour.strftime "%H:%M" %> <% end %> <%= indentation %> add_to_calendar: -<%= indentation %> google: "<%= event.add_to_calendar_urls['google'].html_safe %>" -<%= indentation %> yahoo: "<%= event.add_to_calendar_urls['yahoo'].html_safe %>" -<%= indentation %> office: "<%= event.add_to_calendar_urls['office'].html_safe %>" -<%= indentation %> outlook: "<%= event.add_to_calendar_urls['outlook'].html_safe %>" -<%= indentation %> ical: "<%= event.add_to_calendar_urls['ical'].html_safe %>" +<%= indentation %> google: "<%= event.cal_google_url.html_safe %>" +<%= indentation %> yahoo: "<%= event.cal_yahoo_url.html_safe %>" +<%= indentation %> office: "<%= event.cal_office_url.html_safe %>" +<%= indentation %> outlook: "<%= event.cal_outlook_url.html_safe %>" +<%= indentation %> ical: "<%= event.cal_ical_url.html_safe %>" -- GitLab