Sha256: 8ce14604de9d8b148b6316daf0bd026a3c328574535dc6d56cbc1cefdd8f85f5

Contents?: true

Size: 895 Bytes

Versions: 1

Compression:

Stored size: 895 Bytes

Contents

module ::EventCalendar::CalendarHelper
  def wday_class_for(date)
    case date.wday
    when 0
      'sunday'
    when 6
      'saturday'
    end
  end

  def hightlight_classes(date, calendar)
    classes = []
    events = calendar.events_on(date)
    classes << 'has_events' if events.present?
    events.map(&:class).uniq.each {|event_class| classes << event_class.to_s.underscore }
    classes
  end

  def previous_month_path(calendar)
  end

  def next_month_path(calendar)
  end

  def today_path(calendar)
  end

  def render_monthly(calendar)
    render(
      { :partial => 'event_calendar/calendar',
        :format => :html,
        :locals => { :calendar => calendar },
      }
    )
  end

  def render_event_details(events)
    render(
      { :partial => 'event_calendar/event_details',
        :format => :html,
        :locals => { :events => events }
      }
    )
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
event_cal-1.0 lib/event_calendar/calendar_helper.rb