Commit c1890c1a4a6775c848d267a7586e92ac46b4b19c

Authored by Jared Pace
1 parent 6aec6f2e
Exists in master and in 1 other branch production

Add errs#all to display resolved + unresolved errs

app/controllers/errs_controller.rb
... ... @@ -4,6 +4,10 @@ class ErrsController < ApplicationController
4 4 @errs = Err.unresolved.ordered.paginate(:page => params[:page])
5 5 end
6 6  
  7 + def all
  8 + @errs = Err.ordered.paginate(:page => params[:page])
  9 + end
  10 +
7 11 def show
8 12 @project = Project.find(params[:project_id])
9 13 @err = @project.errs.find(params[:id])
... ...
app/views/errs/all.html.haml 0 → 100644
... ... @@ -0,0 +1,5 @@
  1 +- content_for :title, 'All Errors'
  2 +- content_for :action_bar do
  3 + = will_paginate(@errs)
  4 + = link_to 'hide resolved', errs_path
  5 += render 'table', :errs => @errs
0 6 \ No newline at end of file
... ...
app/views/errs/index.html.haml
1 1 - content_for :title, 'Unresolved Errors'
2   -
  2 +- content_for :action_bar do
  3 + = will_paginate(@errs)
  4 + = link_to 'show resolved', all_errs_path
3 5 = render 'table', :errs => @errs
4 6 \ No newline at end of file
... ...
config/routes.rb
... ... @@ -4,7 +4,11 @@ Hypnotoad::Application.routes.draw do
4 4 match '/notifier_api/v2/notices' => 'notices#create'
5 5 match '/deploys.txt' => 'deploys#create'
6 6  
7   - resources :errs, :only => [:index]
  7 + resources :errs, :only => [:index] do
  8 + collection do
  9 + get :all
  10 + end
  11 + end
8 12 resources :notices, :only => [:show]
9 13 resources :deploys, :only => [:show]
10 14  
... ...
spec/controllers/errs_controller_spec.rb
... ... @@ -17,6 +17,19 @@ describe ErrsController do
17 17 end
18 18 end
19 19  
  20 + describe "GET /errs/all" do
  21 + it "gets a paginated list of all errors" do
  22 + errors = WillPaginate::Collection.new(1,30)
  23 + 3.times { errors << Factory(:err) }
  24 + 3.times { errors << Factory(:err, :resolved => true)}
  25 + Err.should_receive(:ordered).and_return(
  26 + mock('proxy', :paginate => errors)
  27 + )
  28 + get :index
  29 + assigns(:errs).should == errors
  30 + end
  31 + end
  32 +
20 33 describe "GET /projects/:project_id/errs/:id" do
21 34 before do
22 35 3.times { Factory(:notice, :err => err)}
... ...