Skip to content
This repository
Browse code

Added 'Up' button in the err view.

  • Loading branch information...
commit 117a4025070080dcbdc730d6f058ef7c6c430349 1 parent 7843543
Łukasz Śliwa lukaszsliwa authored
1  .gitignore
@@ -9,6 +9,7 @@ config/deploy
9 9 config/mongoid.yml
10 10 config/newrelic.yml
11 11 .rvmrc
  12 +.idea
12 13 *~
13 14 *.rbc
14 15 .DS_Store
1  app/views/errs/show.html.haml
@@ -21,6 +21,7 @@
21 21 = link_to 'unlink issue', unlink_issue_app_err_path(@app, @problem), :method => :delete, :confirm => "Unlink err issues?", :class => "unlink-issue"
22 22 - if @problem.unresolved?
23 23 %span= link_to 'resolve', resolve_app_err_path(@app, @problem), :method => :put, :confirm => err_confirm, :class => 'resolve'
  24 + %span= link_to 'up', (request.env['HTTP_REFERER'] ? :back : app_errs_path(@app)), :class => 'up'
24 25
25 26 - if Errbit::Config.allow_comments_with_issue_tracker || !@app.issue_tracker_configured? || @problem.comments.any?
26 27 - content_for :comments do
5 public/stylesheets/application.css
@@ -672,6 +672,11 @@ table.deploys td.when {
672 672 background: transparent url(images/icons/thumbs-up.png) 6px 5px no-repeat;
673 673 }
674 674
  675 +/* Go Up */
  676 +#action-bar a.up {
  677 + background: transparent url(images/icons/up.png) 6px 5px no-repeat;
  678 +}
  679 +
675 680 /* Notices Pagination */
676 681 .notice-pagination {
677 682 float: left;
BIN  public/stylesheets/images/icons/up.png
18 spec/views/errs/show.html.haml_spec.rb
@@ -38,6 +38,24 @@
38 38 resolve_link.should_not =~ /data-confirm=/
39 39 end
40 40
  41 + it "should link 'up' to HTTP_REFERER if is set" do
  42 + url = 'http://localhost:3000/errs'
  43 + controller.request.env['HTTP_REFERER'] = url
  44 + render
  45 + action_bar = String.new(view.instance_variable_get(:@_content_for)[:action_bar])
  46 + action_bar.should =~ /<span><a href=\"#{url}\" class=\"up\">up<\/a><\/span>/
  47 + end
  48 +
  49 + it "should link 'up' to app_errs_path if HTTP_REFERER isn't set'" do
  50 + controller.request.env['HTTP_REFERER'] = nil
  51 + problem = Fabricate(:problem_with_comments)
  52 + assign :problem, problem
  53 + assign :app, problem.app
  54 + render
  55 + action_bar = String.new(view.instance_variable_get(:@_content_for)[:action_bar])
  56 + action_bar.should =~ /<span><a href=\"#{app_errs_path(problem.app)}\" class=\"up\">up<\/a><\/span>/
  57 + end
  58 +
41 59 end
42 60
43 61 describe "content_for :comments with comments disabled for configured issue tracker" do

0 comments on commit 117a402

Please sign in to comment.
Something went wrong with that request. Please try again.