diff --git a/app/views/events/index.html.haml b/app/views/events/index.html.haml
index 067e65ac..50c3fca0 100644
--- a/app/views/events/index.html.haml
+++ b/app/views/events/index.html.haml
@@ -1,3 +1,5 @@
+- config.time_zone = 'Paris'
+
%form.region_selector
- if params[:start_date]
= hidden_field_tag :start_date, params[:start_date]
diff --git a/app/views/events/index.ics.erb b/app/views/events/index.ics.erb
index 3f8716bd..28cbe7a7 100644
--- a/app/views/events/index.ics.erb
+++ b/app/views/events/index.ics.erb
@@ -4,7 +4,7 @@ PRODID:-//AgendaDuLibre.org
X-WR-CALNAME:Agenda du Libre
X-WR-TIMEZONE:Europe/Paris
CALSCALE:GREGORIAN
-X-WR-CALDESC:L'Agenda des évènements autour du Libre
+X-WR-CALDESC:<%= t 'title', scope: [:layouts, :application] %>
<% @events.each do |event| %>
BEGIN:VEVENT
DTSTART;TZID=Europe/Paris:<%= event.start_time.strftime '%Y%m%dT%H%M%S' %>
diff --git a/app/views/events/show.html.haml b/app/views/events/show.html.haml
index 644296dd..b48f9e9f 100644
--- a/app/views/events/show.html.haml
+++ b/app/views/events/show.html.haml
@@ -13,7 +13,7 @@
(#{lug.department})
%h1=t '.actions'
- = link_to root_url do
+ = link_to event_path(@event, protocol: :webcal, format: :ics) do
%em.fa.fa-calendar
=t '.add_to_calendar'
- if user_signed_in?
diff --git a/app/views/events/show.ics.erb b/app/views/events/show.ics.erb
new file mode 100644
index 00000000..2058d929
--- /dev/null
+++ b/app/views/events/show.ics.erb
@@ -0,0 +1,18 @@
+BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//AgendaDuLibre.org
+X-WR-CALNAME:Agenda du Libre
+X-WR-TIMEZONE:Europe/Paris
+CALSCALE:GREGORIAN
+X-WR-CALDESC:<%= t 'title', scope: [:layouts, :application] %>
+<% event = @event %>
+BEGIN:VEVENT
+DTSTART;TZID=Europe/Paris:<%= event.start_time.strftime '%Y%m%dT%H%M%S' %>
+DTEND;TZID=Europe/Paris:<%= event.end_time.strftime '%Y%m%dT%H%M%S' %>
+UID:<%= event.id %>@agendadulibre.org
+SUMMARY:<%= event.title %>
+URL:<%= event_url event %>
+DESCRIPTION:Un évènement de l'Agenda du Libre
+LOCATION:<%= event.city.gsub('-', ' ') %>
+END:VEVENT
+END:VCALENDAR
diff --git a/config/application.rb b/config/application.rb
index 04656fc1..04256983 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -15,7 +15,6 @@ module AgendaDuLibreRails
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
- config.time_zone = 'Paris'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
@@ -24,7 +23,10 @@ module AgendaDuLibreRails
I18n.config.enforce_available_locales = true
- config.action_mailer.default_options = {from: 'moderateurs@agendadulibre.org', to: 'moderateurs@agendadulibre.org'}
+ config.action_mailer.default_options = {
+ from: 'moderateurs@agendadulibre.org',
+ to: 'moderateurs@agendadulibre.org'
+ }
#config.quiet_assets = false
end