Sha256: 3de402f3858016293fa6557d620a0ccd86b23ac8344c5dfa93baea19b19da6ab

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

class EventGroupsController < ApplicationController
  layout 'whoops'
  before_filter :update_event_group_filter
  helper_method :event_group_filter
  
  def index
    finder = if params[:query].blank?
      Whoops::EventGroup.where(event_group_filter.to_query_document)
    else
      Whoops::EventGroup.where(:_id.in => Whoops::Event.where(:keywords => /#{params[:query]}/i).collect{|e| e.event_group_id}.uniq)
    end
    
    @event_groups = finder.desc(:last_recorded_at).page(params[:page]).per(10)
    
    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] ||= Whoops::Filter.new
  end
  
  def event_group_filter=(filter)
    session[:event_group_filter] = Whoops::Filter.new_from_params(filter)
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
whoops-0.2 app/controllers/event_groups_controller.rb