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

Version Path
radiant-event_calendar-extension-1.5.6 app/views/events/_minicalendar.html.haml
radiant-event_calendar-extension-1.5.5 app/views/events/_minicalendar.html.haml
radiant-event_calendar-extension-1.5.4 app/views/events/_minicalendar.html.haml
radiant-event_calendar-extension-1.5.3 app/views/events/_minicalendar.html.haml
radiant-event_calendar-extension-1.5.1 app/views/events/_minicalendar.html.haml
radiant-event_calendar-extension-1.5.0 app/views/events/_minicalendar.html.haml
radiant-event_calendar-extension-1.4.14 app/views/events/_minicalendar.html.haml
radiant-event_calendar-extension-1.4.12 app/views/events/_minicalendar.html.haml
radiant-event_calendar-extension-1.4.10 app/views/events/_minicalendar.html.haml
radiant-event_calendar-extension-1.4.9 app/views/events/_minicalendar.html.haml
radiant-event_calendar-extension-1.4.8 app/views/events/_minicalendar.html.haml
radiant-event_calendar-extension-1.4.7 app/views/events/_minicalendar.html.haml
radiant-event_calendar-extension-1.4.6 app/views/events/_minicalendar.html.haml
radiant-event_calendar-extension-1.4.5 app/views/events/_minicalendar.html.haml
radiant-event_calendar-extension-1.4.2 app/views/events/_minicalendar.html.haml
radiant-event_calendar-extension-1.4.1 app/views/events/_minicalendar.html.haml
radiant-event_calendar-extension-1.4.0 app/views/events/_minicalendar.html.haml