From 32a5eb605b20f6ee7241f4d7168491c89d5666bd Mon Sep 17 00:00:00 2001 From: echarp Date: Sat, 14 Jul 2018 00:49:52 +0200 Subject: [PATCH] Now using the icalendar gem, to generate ical files --- Gemfile | 3 +++ Gemfile.lock | 10 ++++++---- app/views/events/index.ics.erb | 17 ----------------- app/views/events/show.ics.erb | 16 ---------------- 4 files changed, 9 insertions(+), 37 deletions(-) delete mode 100644 app/views/events/index.ics.erb delete mode 100644 app/views/events/show.ics.erb diff --git a/Gemfile b/Gemfile index 6957d389..88a7adf0 100644 --- a/Gemfile +++ b/Gemfile @@ -10,6 +10,9 @@ gem 'mini_portile2' # The central piece of this application: the month calendar view gem 'simple_calendar' + +gem 'icalendar' + # The recurrence management library gem 'ice_cube' diff --git a/Gemfile.lock b/Gemfile.lock index 38367564..3aa58d03 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -99,7 +99,7 @@ GEM railties (>= 4.1.0, < 6.0) responders warden (~> 1.2.3) - devise-i18n (1.6.2) + devise-i18n (1.6.4) devise (>= 4.4) differ (0.1.2) domain_name (0.5.20180417) @@ -199,6 +199,7 @@ GEM concurrent-ruby (~> 1.0) i18n-active_record (0.2.2) i18n (>= 0.5.0) + icalendar (2.4.1) ice_cube (0.16.2) inherited_resources (1.8.0) actionpack (>= 4.2, <= 5.2) @@ -269,7 +270,7 @@ GEM request_store (~> 1.1) paper_trail-association_tracking (1.0.0) parallel (1.12.1) - parser (2.5.1.0) + parser (2.5.1.2) ast (~> 2.4.0) piwik_analytics (1.0.2) actionpack @@ -341,10 +342,10 @@ GEM responders (2.4.0) actionpack (>= 4.2.0, < 5.3) railties (>= 4.2.0, < 5.3) - rubocop (0.58.0) + rubocop (0.58.1) jaro_winkler (~> 1.5.1) parallel (~> 1.10) - parser (>= 2.5) + parser (>= 2.5, != 2.5.1.1) powerpack (~> 0.1) rainbow (>= 2.2.2, < 4.0) ruby-progressbar (~> 1.7) @@ -474,6 +475,7 @@ DEPENDENCIES high_voltage http_accept_language i18n-active_record + icalendar ice_cube jbuilder (~> 2.5) jquery-ui-rails diff --git a/app/views/events/index.ics.erb b/app/views/events/index.ics.erb deleted file mode 100644 index 2c54cc67..00000000 --- a/app/views/events/index.ics.erb +++ /dev/null @@ -1,17 +0,0 @@ -BEGIN:VCALENDAR -VERSION:2.0 -PRODID:-//AgendaDuLibre.org -X-WR-CALNAME:<%= t('title', scope: [:layouts, :application]).gsub(/'/, '’') %> -X-WR-CALDESC:<%= t 'subtitle', scope: [:layouts, :application] %> -<% @events.find_each do |event| %> -BEGIN:VEVENT -DTSTART:<%= event.start_time.strftime '%Y%m%dT%H%M%S' %> -DTEND:<%= event.end_time.strftime '%Y%m%dT%H%M%S' %> -UID:<%= event.id %>@agendadulibre.org -SUMMARY:<%= event.title.gsub(',', '\,').gsub(';', '\;') %> -URL:<%= event_url event %> -DESCRIPTION:<%= strip_tags(event.description).gsub(/'/, '’').gsub(',', '\,').gsub(';', '\;').gsub(/^/, ' ') %> -LOCATION:<%= event.full_address.gsub(/,/, '\,') %> -END:VEVENT -<% end %> -END:VCALENDAR diff --git a/app/views/events/show.ics.erb b/app/views/events/show.ics.erb deleted file mode 100644 index c700bd88..00000000 --- a/app/views/events/show.ics.erb +++ /dev/null @@ -1,16 +0,0 @@ -BEGIN:VCALENDAR -VERSION:2.0 -PRODID:-//AgendaDuLibre.org -X-WR-CALNAME:<%= t('title', scope: [:layouts, :application]).gsub(/'/, '’') %> -X-WR-CALDESC:<%= t 'subtitle', scope: [:layouts, :application] %> -<% event = @event %> -BEGIN:VEVENT -DTSTART:<%= event.start_time.strftime '%Y%m%dT%H%M%S' %> -DTEND:<%= event.end_time.strftime '%Y%m%dT%H%M%S' %> -UID:<%= event.id %>@agendadulibre.org -SUMMARY:<%= event.title %> -URL:<%= event_url event %> -DESCRIPTION:<%= strip_tags(event.description).gsub(/'/, '’').gsub(/,/, '\,').gsub(/;/, '\;').gsub /^/, ' ' %> -LOCATION:<%= event.full_address %> -END:VEVENT -END:VCALENDAR