Sha256: 0a963a3f710314e9ed3c927f5a1c2bf9f62f3db06817f4f24d515aead53b245a

Contents?: true

Size: 756 Bytes

Versions: 13

Compression:

Stored size: 756 Bytes

Contents

class Admin::EventsController < Admin::ResourceController
  paginate_models :per_page => 20
  prepend_before_filter :get_venue
  
  def load_models
    pp = pagination_parameters
    finder = @event_venue ? Event.at_venue(@event_venue) : Event.scoped({})
    unless params[:p]
      first_event = finder.future_and_current.first
      i = finder.index(first_event) || 0    # if there are no future events we revert to the first page
      p = (i / pp[:per_page].to_i) + 1
      pp[:page] = p if p && p > 1
    end
    self.models = finder.paginate(pp)
  end

protected
  
  def get_venue
    @event_venue = EventVenue.find_by_id(params[:event_venue_id]) if params[:event_venue_id]
    Rails.logger.warn "@event_venue is #{@event_venue.inspect}"
  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
radiant-event_calendar-extension-1.5.6 app/controllers/admin/events_controller.rb
radiant-event_calendar-extension-1.5.5 app/controllers/admin/events_controller.rb
radiant-event_calendar-extension-1.5.4 app/controllers/admin/events_controller.rb
radiant-event_calendar-extension-1.5.3 app/controllers/admin/events_controller.rb
radiant-event_calendar-extension-1.5.1 app/controllers/admin/events_controller.rb
radiant-event_calendar-extension-1.5.0 app/controllers/admin/events_controller.rb
radiant-event_calendar-extension-1.4.14 app/controllers/admin/events_controller.rb
radiant-event_calendar-extension-1.4.12 app/controllers/admin/events_controller.rb
radiant-event_calendar-extension-1.4.10 app/controllers/admin/events_controller.rb
radiant-event_calendar-extension-1.4.9 app/controllers/admin/events_controller.rb
radiant-event_calendar-extension-1.4.8 app/controllers/admin/events_controller.rb
radiant-event_calendar-extension-1.4.7 app/controllers/admin/events_controller.rb
radiant-event_calendar-extension-1.4.6 app/controllers/admin/events_controller.rb