Sha256: dc89357f556071723b415be4bf5459005eafd6e144390eff789a3d7cd131bbfe

Contents?: true

Size: 1.16 KB

Versions: 9

Compression:

Stored size: 1.16 KB

Contents

class EventsController < ApplicationController
  if Forge.config.events.display == :calendar
    helper LaterDude::CalendarHelper
  end

  def index
    @page_title = 'Listing Events'

    if Forge.config.events.display == :calendar
      now = Time.now

      @year = (params[:year] || now.year).to_i
      @month = (params[:month] || now.month).to_i

      template = 'events/index_calendar'
    else
      # this roundabout sorting is necessary because ruby 1.8
      # doesn't preserve insertion order - sorting and then using
      # group_by doesn't guarantee the items will remain in that order
      @events = Event\
        .published\
        .order('starts_at DESC')\
        .group_by { |e| e.starts_at.strftime('%Y/%m') }\
        .sort_by(&:first)\
        .reverse

      template = 'events/index_list'
    end

    respond_to do |format|
      format.html { render :template => template }
      format.mobile { render :template => 'mobile/events' }
    end
  end

  def show
    @event = Event.find_by_id!(params[:id])
    @page_title = @event.title

    respond_to do |format|
      format.html
      format.mobile { render :template => 'mobile/event' }
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
forge-cli-0.1.5 lib/forge/app/controllers/events_controller.rb
forge-cli-0.1.4 lib/forge/app/controllers/events_controller.rb
forge-cli-0.1.3 lib/forge/app/controllers/events_controller.rb
forge-cli-0.1.2 lib/forge/app/controllers/events_controller.rb
forge-cli-0.1.1 lib/forge/app/controllers/events_controller.rb
forge-cli-0.1.0 lib/forge/app/controllers/events_controller.rb
forge-cli-0.0.18 lib/forge/app/controllers/events_controller.rb
forge-cli-0.0.17 lib/forge/app/controllers/events_controller.rb
forge-cli-0.0.16 lib/forge/app/controllers/events_controller.rb