Class: Store::EventsController

Inherits:
StoreController
  • Object
show all
Defined in:
app/controllers/store/events_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



20
21
22
# File 'app/controllers/store/events_controller.rb', line 20

def index
  @events = Event.for_event_storefront(store_organization, current_member)
end

#showObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/store/events_controller.rb', line 2

def show
  session[:last_event_id] = params[:id]
  
  @event = Event.storefront_find(params[:id], current_member)
  @shows = @event.upcoming_shows_rel.published

  if @shows.count < 5
    @shows = @shows.includes(:event, :chart => [:sections => :ticket_types])
  elsif 
    dates = @shows.collect(&:datetime_local_to_event).map {|d| d.to_date}
    @dates_by_month = dates.group_by {|d| d.strftime("%B %Y")}
  end

  render :single_show and return if @event.single_show?
  render :calendar    and return if @event.upcoming_public_shows.length > 4
  render :show
end