agenda-libre-ruby/app/views/simple_calendar/_month_calendar.html.haml

27 lines
974 B
Plaintext
Raw Normal View History

2015-09-12 15:31:31 +02:00
%header.calendar-header
- if params[:year]
= link_to start_date: start_date.beginning_of_month,
tag: params[:tag], region: params[:region] do
= I18n.t('date.month_names')[start_date.month]
= start_date.year
- else
= link_to '<<', start_date: (date_range.first - 1.day).beginning_of_month,
tag: params[:tag], region: params[:region]
= I18n.t('date.month_names')[start_date.month]
= link_to root_path(year: start_date.year) do
= start_date.year
= link_to '>>', start_date: (date_range.last + 1.day).beginning_of_month,
tag: params[:tag], region: params[:region]
%table.table.table-striped
%thead
%tr
- date_range.slice(0, 7).each do |day|
%th= I18n.t('date.day_names')[day.wday]
%tbody
- date_range.each_slice(7) do |week|
%tr
- week.each do |day|
= content_tag :td, class: calendar.td_classes_for(day) do
= block.call day, sorted_events.fetch(day, [])