diff --git a/app/controllers/errs_controller.rb b/app/controllers/errs_controller.rb index b4093c0..e2644ee 100644 --- a/app/controllers/errs_controller.rb +++ b/app/controllers/errs_controller.rb @@ -29,7 +29,10 @@ class ErrsController < ApplicationController @err.resolve! flash[:success] = 'Great news everyone! The err has been resolved.' - redirect_to errs_path + + redirect_to :back + rescue ActionController::RedirectBackError + redirect_to app_path(@app) end protected diff --git a/app/views/errs/_table.html.haml b/app/views/errs/_table.html.haml index 06b7017..3bd09f3 100644 --- a/app/views/errs/_table.html.haml +++ b/app/views/errs/_table.html.haml @@ -6,6 +6,7 @@ %th Latest %th Deploy %th Count + %th Resolve %tbody - errs.each do |err| %tr{:class => err.resolved? ? 'resolved' : 'unresolved'} @@ -18,6 +19,7 @@ %td.latest #{time_ago_in_words(last_notice_at err)} ago %td.deploy= err.app.last_deploy_at ? err.app.last_deploy_at.to_s(:micro) : 'n/a' %td.count= link_to err.notices.count, app_err_path(err.app, err) + %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? - if errs.none? %tr %td{:colspan => (@app ? 5 : 6)} diff --git a/public/images/thumbs-up.png b/public/images/thumbs-up.png new file mode 100644 index 0000000..03dad84 Binary files /dev/null and b/public/images/thumbs-up.png differ diff --git a/spec/controllers/errs_controller_spec.rb b/spec/controllers/errs_controller_spec.rb index 8f2a77c..5dbc42b 100644 --- a/spec/controllers/errs_controller_spec.rb +++ b/spec/controllers/errs_controller_spec.rb @@ -151,7 +151,13 @@ describe ErrsController do request.flash[:success].should match(/Great news/) end - it "should redirect do the errs page" do + it "should redirect to the app page" do + put :resolve, :app_id => @err.app.id, :id => @err.id + response.should redirect_to(app_path(@err.app)) + end + + it "should redirect back to errs page" do + request.env["Referer"] = errs_path put :resolve, :app_id => @err.app.id, :id => @err.id response.should redirect_to(errs_path) end -- libgit2 0.21.2