Class: Calagator::AdminController

Inherits:
ApplicationController show all
Defined in:
app/controllers/calagator/admin_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#recaptcha_enabled?

Instance Method Details

#eventsObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/calagator/admin_controller.rb', line 7

def events
  if params[:query].blank?
    @events = Event.future
  else
    @search = Event::Search.new(params)
    @admin_query = params[:query]

    @events = @search.events

    flash[:failure] = @search.failure_message
    return redirect_to admin_events_path if @search.hard_failure?
  end

  render 'calagator/admin/events'
end

#indexObject



5
# File 'app/controllers/calagator/admin_controller.rb', line 5

def index; end

#lock_eventObject



23
24
25
26
27
28
29
30
31
32
33
34
# File 'app/controllers/calagator/admin_controller.rb', line 23

def lock_event
  @event = Event.find(params[:event_id])

  if @event.locked?
    @event.unlock_editing!
    flash[:success] = "Unlocked event #{@event.title} (#{@event.id})"
  else
    @event.lock_editing!
    flash[:success] = "Locked event #{@event.title} (#{@event.id})"
  end
  redirect_to action: :events, query: params[:query]
end