Sha256: 569eaa37a4e8672e83fb89d85e3d0b3044d48fcad33dbe15d957896b530b1469
Contents?: true
Size: 863 Bytes
Versions: 2
Compression:
Stored size: 863 Bytes
Contents
class CalendarsController < ApplicationController respond_to :html, :json layout SpudEvents.config.calendar_layout before_action :calendar_date def show if params[:calendar] && calendar = SpudCalendar.find_by_title(params[:calendar].titleize) @events = calendar.spud_calendar_events.in_month_of(@calendar_date).order(:start_at).to_a else @events = SpudCalendarEvent.in_month_of(@calendar_date).order(:start_at).to_a end @current_calendar = params[:calendar] ? params[:calendar] : 0 respond_with @events end private def calendar_date if params[:month] year = params[:year] ? params[:year].to_i : Date.today.year begin @calendar_date = Date.new(year, params[:month].to_i) rescue @calendar_date = Date.today end else @calendar_date = Date.today end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tb_events-1.3.1 | app/controllers/calendars_controller.rb |
tb_events-1.3.0 | app/controllers/calendars_controller.rb |