52 lines
2.3 KiB
Plaintext
52 lines
2.3 KiB
Plaintext
%form.region_selector
|
|
- if params[:start_date]
|
|
= hidden_field_tag :start_date, params[:start_date]
|
|
- if params[:year]
|
|
= hidden_field_tag :year, params[:year]
|
|
= label_tag :region, Region.model_name.human
|
|
= select_tag :region,
|
|
options_from_collection_for_select(Region.all, 'id', 'name', params[:region]),
|
|
prompt: t('.all_regions')
|
|
|
|
- if params[:year]
|
|
-# Whole year calendar
|
|
%header.calendar-header.year
|
|
= link_to '<<', "?year=#{params[:year].to_i-1}"
|
|
= params[:year]
|
|
= link_to '>>', "?year=#{params[:year].to_i+1}"
|
|
|
|
- (1..12).each do |i|
|
|
- params[:start_date] = "#{params[:year]}-#{i}-01"
|
|
|
|
= month_calendar events: @events,
|
|
title: ->(start_date) { raw link_to I18n.t('date.month_names')[start_date.month]+' '+params[:year], root_url( start_date: start_date), class: 'month_selector' },
|
|
previous_link: ->(param, date_range) { },
|
|
next_link: ->(param, date_range) { } do |date, events|
|
|
.day_number= date.day
|
|
%ul.events
|
|
- events.select { |e| e.start_time.to_date <= date and date <= e.end_time.to_date }.sort_by { |e| e.city }.each do |event|
|
|
%li.event
|
|
= link_to event do
|
|
%strong= event.city.gsub('-', ' ')
|
|
= event.title
|
|
|
|
- else
|
|
= month_calendar events: @events,
|
|
title: ->(start_date) { raw "#{I18n.t('date.month_names')[start_date.month]} #{link_to start_date.year, root_url(year: start_date.year), class: 'year_selector'}" },
|
|
previous_link: ->(param, date_range) { link_to '<<', { param => date_range.first - 1.day } },
|
|
next_link: ->(param, date_range) { link_to '>>', { param => date_range.last + 1.day } } do |date, events|
|
|
.day_number= date.day
|
|
%ul.events
|
|
- events.select { |e| e.start_time.to_date <= date and date <= e.end_time.to_date }.sort_by { |e| e.city }.each do |event|
|
|
%li.event
|
|
= link_to event do
|
|
%strong= event.city.gsub('-', ' ')
|
|
= event.title
|
|
|
|
.formats
|
|
=t '.calendar_in'
|
|
= link_to('rss', events_url(:rss, tag: params[:tag], region: params[:region]))+','
|
|
= link_to 'iCal', events_url(:rss, tag: params[:tag], format: :ics, tag: params[:tag], region: params[:region])
|
|
ou
|
|
= link_to 'calendrier Google', "http://www.google.com/calendar/render?cid=#{events_url(format: :ics, tag: params[:tag], region: params[:region])}"
|