Class: Admin::EventsController

Inherits:
AdminController
  • Object
show all
Defined in:
app/controllers/admin/events_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject

get /admin/events



5
6
7
# File 'app/controllers/admin/events_controller.rb', line 5

def index
  @collection = Event.page_for_administration(current_page)
end

#lockObject

put /api/events/:id/lock



29
30
31
32
33
# File 'app/controllers/admin/events_controller.rb', line 29

def lock
  @entity.update! locked: true

  render json: { data: { locked: @entity.locked? } }
end

#participantsObject

get /admin/events/:id/users



14
15
16
17
# File 'app/controllers/admin/events_controller.rb', line 14

def participants
  @filter     = params[:filter] || Hash.new
  @collection = @entity.event_participants.page_for_administration(current_page, @filter)
end

#showObject

get /admin/events/:id



10
11
# File 'app/controllers/admin/events_controller.rb', line 10

def show
end

#toggleObject

post /api/events/:id/toggle



20
21
22
23
24
25
26
# File 'app/controllers/admin/events_controller.rb', line 20

def toggle
  if @entity.locked?
    render json: { errors: { locked: @entity.locked } }, status: :forbidden
  else
    render json: { data: @entity.toggle_parameter(params[:parameter].to_s) }
  end
end

#unlockObject

delete /api/events/:id/lock



36
37
38
39
40
# File 'app/controllers/admin/events_controller.rb', line 36

def unlock
  @entity.update! locked: false

  render json: { data: { locked: @entity.locked? } }
end