Sha256: c4e9072bc9b4b796abe4a52193f95b95386263b210d24137f76c5e62e4a9abcd

Contents?: true

Size: 1.34 KB

Versions: 6

Compression:

Stored size: 1.34 KB

Contents

class EventGroupsController < WhoopsController
  before_filter :update_event_group_filter
  helper_method :event_group_filter
  
  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
  
  def show
    @event_group = Whoops::EventGroup.find(params[:id])
  end
  
  def update_event_group_filter
    self.event_group_filter = params[:whoops_filter] if params[:updating_filters]
  end
  
  def event_group_filter
    session[:event_group_filter] ||= new_whoops_filter
  end
  
  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

  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
  
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
whoops-0.5.5 app/controllers/event_groups_controller.rb
whoops-0.5.4 app/controllers/event_groups_controller.rb
whoops-0.5.3 app/controllers/event_groups_controller.rb
whoops-0.5.2 app/controllers/event_groups_controller.rb
whoops-0.5.1 app/controllers/event_groups_controller.rb
whoops-0.5.0 app/controllers/event_groups_controller.rb