Skip to content

Commit

Permalink
Added 'Up' button in the err view.
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszsliwa committed Mar 1, 2012
1 parent 7843543 commit 117a402
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -9,6 +9,7 @@ config/deploy
config/mongoid.yml
config/newrelic.yml
.rvmrc
.idea
*~
*.rbc
.DS_Store
1 change: 1 addition & 0 deletions app/views/errs/show.html.haml
Expand Up @@ -21,6 +21,7 @@
= link_to 'unlink issue', unlink_issue_app_err_path(@app, @problem), :method => :delete, :confirm => "Unlink err issues?", :class => "unlink-issue"
- if @problem.unresolved?
%span= link_to 'resolve', resolve_app_err_path(@app, @problem), :method => :put, :confirm => err_confirm, :class => 'resolve'
%span= link_to 'up', (request.env['HTTP_REFERER'] ? :back : app_errs_path(@app)), :class => 'up'

- if Errbit::Config.allow_comments_with_issue_tracker || !@app.issue_tracker_configured? || @problem.comments.any?
- content_for :comments do
Expand Down
5 changes: 5 additions & 0 deletions public/stylesheets/application.css
Expand Up @@ -672,6 +672,11 @@ table.deploys td.when {
background: transparent url(images/icons/thumbs-up.png) 6px 5px no-repeat;
}

/* Go Up */
#action-bar a.up {
background: transparent url(images/icons/up.png) 6px 5px no-repeat;
}

/* Notices Pagination */
.notice-pagination {
float: left;
Expand Down
Binary file added public/stylesheets/images/icons/up.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions spec/views/errs/show.html.haml_spec.rb
Expand Up @@ -38,6 +38,24 @@
resolve_link.should_not =~ /data-confirm=/
end

it "should link 'up' to HTTP_REFERER if is set" do
url = 'http://localhost:3000/errs'
controller.request.env['HTTP_REFERER'] = url
render
action_bar = String.new(view.instance_variable_get(:@_content_for)[:action_bar])
action_bar.should =~ /<span><a href=\"#{url}\" class=\"up\">up<\/a><\/span>/
end

it "should link 'up' to app_errs_path if HTTP_REFERER isn't set'" do
controller.request.env['HTTP_REFERER'] = nil
problem = Fabricate(:problem_with_comments)
assign :problem, problem
assign :app, problem.app
render
action_bar = String.new(view.instance_variable_get(:@_content_for)[:action_bar])
action_bar.should =~ /<span><a href=\"#{app_errs_path(problem.app)}\" class=\"up\">up<\/a><\/span>/
end

end

describe "content_for :comments with comments disabled for configured issue tracker" do
Expand Down

0 comments on commit 117a402

Please sign in to comment.