Sha256: c7b9744558a0861a2881cce182a3a08f0f40df989b82634a44a9f45a8a8bb16d

Contents?: true

Size: 1.8 KB

Versions: 16

Compression:

Stored size: 1.8 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 => "#{month_name(before.month)} #{before.year}", :class => 'previous'
      %td{:colspan => 5}
        %h3
          = link_to_unless_current month_name(month), url_for_month(date)
      %td.m
        = link_to '>', url_for_month(after), :title => "#{month_name(after.month)} #{after.year}", :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

16 entries across 16 versions & 1 rubygems

Version Path
radiant-event_calendar-extension-1.3.9 app/views/events/_minicalendar.html.haml
radiant-event_calendar-extension-1.3.8 app/views/events/_minicalendar.html.haml
radiant-event_calendar-extension-1.3.7 app/views/events/_minicalendar.html.haml
radiant-event_calendar-extension-1.3.6 app/views/events/_minicalendar.html.haml
radiant-event_calendar-extension-1.3.5 app/views/events/_minicalendar.html.haml
radiant-event_calendar-extension-1.3.4 app/views/events/_minicalendar.html.haml
radiant-event_calendar-extension-1.3.3 app/views/events/_minicalendar.html.haml
radiant-event_calendar-extension-1.3.2 app/views/events/_minicalendar.html.haml
radiant-event_calendar-extension-1.3.1 app/views/events/_minicalendar.html.haml
radiant-event_calendar-extension-1.3.0 app/views/events/_minicalendar.html.haml
radiant-event_calendar-extension-1.1.2 app/views/events/_minicalendar.html.haml
radiant-event_calendar-extension-1.1.1 app/views/events/_minicalendar.html.haml
radiant-event_calendar-extension-1.1.0 app/views/events/_minicalendar.html.haml
radiant-event_calendar-extension-1.0.2 app/views/events/_minicalendar.html.haml
radiant-event_calendar-extension-1.0.1 app/views/events/_minicalendar.html.haml
radiant-event_calendar-extension-1.0.0 app/views/events/_minicalendar.html.haml