Class: EventGroupsController

Inherits:
WhoopsController show all
Defined in:
app/controllers/event_groups_controller.rb

Instance Method Summary collapse

Instance Method Details

#event_group_filterObject



26
27
28
# File 'app/controllers/event_groups_controller.rb', line 26

def event_group_filter
  session[:event_group_filter] ||= new_whoops_filter
end

#event_group_filter=(filter) ⇒ Object



30
31
32
33
34
# File 'app/controllers/event_groups_controller.rb', line 30

def event_group_filter=(filter)
  filter = Whoops::Filter.new_from_params(filter)
  filter.authorized_service_lookup = authorized_service_lookup
  session[:event_group_filter] = filter
end

#indexObject



5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/controllers/event_groups_controller.rb', line 5

def index
  query_document = event_group_filter.to_query_document
  query_document.merge!(:archived => false) unless params[:show_archived]
  query_document.merge!(:_id.in => Whoops::Event.where(:keywords => /#{params[:query]}/i).distinct(:event_group_id)) unless params[:query].blank?
  
  @event_groups = Whoops::EventGroup.where(query_document).desc(:last_recorded_at).page(params[:page]).per(30)
  
  respond_to do |format|
    format.html
    format.js { render :partial => 'list' }
  end
end

#showObject



18
19
20
# File 'app/controllers/event_groups_controller.rb', line 18

def show
  @event_group = Whoops::EventGroup.find(params[:id])
end

#updateObject



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

def update
  @event_group = Whoops::EventGroup.find(params[:id])
  @event_group.update_attributes(:archived => params[:event_group][:archived] == "true")
  redirect_to whoops_event_group_events_path(@event_group)
end

#update_event_group_filterObject



22
23
24
# File 'app/controllers/event_groups_controller.rb', line 22

def update_event_group_filter
  self.event_group_filter = params[:whoops_filter] if params[:updating_filters]
end