Sha256: cb16b4eab3e4e0f6ab0cea4bd884d6f46962f24b2db981d1597d3fc5a9b4288e
Contents?: true
Size: 1.88 KB
Versions: 17
Compression:
Stored size: 1.88 KB
Contents
- date ||= Date.today - month = date.month - month_events = Event.coincident_with(date.beginning_of_month, date.end_of_month) - first_shown = date.beginning_of_month.beginning_of_week - last_shown = date.end_of_month.end_of_week - before = date.beginning_of_month - 1.day - after = date.end_of_month + 1.day %table.minimonth %thead %tr %td.m = link_to '<', url_for_month(before), :title => (I18n.l before, :format => :calendar_period_minicalendar_title), :class => 'previous' %td{:colspan => 5} %h3 = link_to_unless_current I18n.l(date, :format => :calendar_period_minicalendar_month), url_for_month(date) %td.m = link_to '>', url_for_month(after), :title => (I18n.l after, :format => :calendar_period_minicalendar_title), :class => 'next' %tr - day_names.each do |d| %th.day_name{:scope => 'col'} = d.first %tbody - weeks = {} - first_shown.upto(last_shown) do |day| - new_events_today = month_events.select{ |e| e.start_date <= day + 1.day && e.start_date > day } - continuing_events = month_events.select{ |e| e.start_date <= day && e.end_date && e.end_date >= day } - cell_class = "d" - cell_class += " o" if day.month != date.month - cell_class += " t" if day == ::Date.current - if new_events_today.any? - cell_class += " e" - date_label = %{<a href="#{url_for_date(day)}">#{day.mday}</a>} - elsif continuing_events.any? - cell_class += " c" - date_label = %{<a href="#{url_for_date(day)}">#{day.mday}</a>} - else - cell_class += " u" - date_label = day.mday - weeks[day.cweek] ||= [] - weeks[day.cweek].push({:class => cell_class, :label => date_label}) - weeks.sort.each do |week, weekdays| %tr - weekdays.each do |d| %td{:class => d[:class]} = d[:label]
Version data entries
17 entries across 17 versions & 1 rubygems