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

27 lines
899 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] do
2015-09-12 15:31:31 +02:00
= 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]
2015-09-12 15:31:31 +02:00
= 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]
2015-09-12 15:31:31 +02:00
%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, [])