Commit dbde149fbab93e9580266ac64574edcb710b6391
1 parent
b329dcd0
Exists in
master
and in
1 other branch
Resolve button in the errs list.
Showing
4 changed files
with
13 additions
and
2 deletions
Show diff stats
app/controllers/errs_controller.rb
| @@ -29,7 +29,10 @@ class ErrsController < ApplicationController | @@ -29,7 +29,10 @@ class ErrsController < ApplicationController | ||
| 29 | @err.resolve! | 29 | @err.resolve! |
| 30 | 30 | ||
| 31 | flash[:success] = 'Great news everyone! The err has been resolved.' | 31 | flash[:success] = 'Great news everyone! The err has been resolved.' |
| 32 | - redirect_to errs_path | 32 | + |
| 33 | + redirect_to :back | ||
| 34 | + rescue ActionController::RedirectBackError | ||
| 35 | + redirect_to app_path(@app) | ||
| 33 | end | 36 | end |
| 34 | 37 | ||
| 35 | protected | 38 | protected |
app/views/errs/_table.html.haml
| @@ -6,6 +6,7 @@ | @@ -6,6 +6,7 @@ | ||
| 6 | %th Latest | 6 | %th Latest |
| 7 | %th Deploy | 7 | %th Deploy |
| 8 | %th Count | 8 | %th Count |
| 9 | + %th Resolve | ||
| 9 | %tbody | 10 | %tbody |
| 10 | - errs.each do |err| | 11 | - errs.each do |err| |
| 11 | %tr{:class => err.resolved? ? 'resolved' : 'unresolved'} | 12 | %tr{:class => err.resolved? ? 'resolved' : 'unresolved'} |
| @@ -18,6 +19,7 @@ | @@ -18,6 +19,7 @@ | ||
| 18 | %td.latest #{time_ago_in_words(last_notice_at err)} ago | 19 | %td.latest #{time_ago_in_words(last_notice_at err)} ago |
| 19 | %td.deploy= err.app.last_deploy_at ? err.app.last_deploy_at.to_s(:micro) : 'n/a' | 20 | %td.deploy= err.app.last_deploy_at ? err.app.last_deploy_at.to_s(:micro) : 'n/a' |
| 20 | %td.count= link_to err.notices.count, app_err_path(err.app, err) | 21 | %td.count= link_to err.notices.count, app_err_path(err.app, err) |
| 22 | + %td.resolve= link_to image_tag("thumbs-up.png"), resolve_app_err_path(err.app, err), :title => "Resolve", :method => :put, :confirm => 'Seriously?', :class => 'resolve' if err.unresolved? | ||
| 21 | - if errs.none? | 23 | - if errs.none? |
| 22 | %tr | 24 | %tr |
| 23 | %td{:colspan => (@app ? 5 : 6)} | 25 | %td{:colspan => (@app ? 5 : 6)} |
1.42 KB
spec/controllers/errs_controller_spec.rb
| @@ -151,7 +151,13 @@ describe ErrsController do | @@ -151,7 +151,13 @@ describe ErrsController do | ||
| 151 | request.flash[:success].should match(/Great news/) | 151 | request.flash[:success].should match(/Great news/) |
| 152 | end | 152 | end |
| 153 | 153 | ||
| 154 | - it "should redirect do the errs page" do | 154 | + it "should redirect to the app page" do |
| 155 | + put :resolve, :app_id => @err.app.id, :id => @err.id | ||
| 156 | + response.should redirect_to(app_path(@err.app)) | ||
| 157 | + end | ||
| 158 | + | ||
| 159 | + it "should redirect back to errs page" do | ||
| 160 | + request.env["Referer"] = errs_path | ||
| 155 | put :resolve, :app_id => @err.app.id, :id => @err.id | 161 | put :resolve, :app_id => @err.app.id, :id => @err.id |
| 156 | response.should redirect_to(errs_path) | 162 | response.should redirect_to(errs_path) |
| 157 | end | 163 | end |