Commit d384598e4397b9848c9a9df481e05516b5394610

Authored by Nathan B
2 parents 78435433 117a4025
Exists in master and in 1 other branch production

Merge pull request #161 from mrplum/issue-75

Added 'Up' button in the err view.
.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
... ...
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
... ...
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;
... ...
public/stylesheets/images/icons/up.png 0 → 100644

2.16 KB

spec/views/errs/show.html.haml_spec.rb
... ... @@ -38,6 +38,24 @@ describe "errs/show.html.haml" do
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
... ...