app/controllers/jobs_controller.rb
# a means for admins to see all jobs on the system
a means for admins to see all jobs on the system
a means for admins to see all jobs on the system
def show_all
    if !current_user.admin?
      redirect_to :jobs and return
    end
    @types = Hash['All' => 'all'].merge(Job.types)
    @currtype = params[:type]
    if params[:type] == 'all' or params[:type].blank?
      @jobs = Job.paginate :page => params[:page], :order => 'created_at DESC'
    else
      @jobs = Job.paginate :page => params[:page], :order => 'created_at DESC', :conditions => {:type => params[:type]}
    end
    respond_to do |format|
      format.html 
      format.xml  { render :xml => @jobs }
      format.json  { render :json => @jobs }
    end
  end
def show_all if ! current_user . admin? redirect_to :jobs and return end @types = Hash [ 'All' => 'all' ] . merge ( Job . types ) @currtype = params [ :type ] if params [ :type ] == 'all' or params [ :type ] . blank? @jobs = Job . paginate :page => params [ :page ] , :order => 'created_at DESC' else @jobs = Job . paginate :page => params [ :page ] , :order => 'created_at DESC' , :conditions => { :type => params [ :type ] } end respond_to do | format | format . html format . xml { render :xml => @jobs } format . json { render :json => @jobs } end end
a means for admins to see all jobs on the system
a means for admins to see all jobs on the system
# allow admins to filter jobs by type # this fails on the production server for unknown reasons # and is temporarily disabled until the problem is fixed #@jobs.sort! {|a,b| a.email <=> b.email } # index.html.erb