Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added 'Up' button in the err view.

  • Loading branch information...
commit 117a4025070080dcbdc730d6f058ef7c6c430349 1 parent 7843543
@lukaszsliwa lukaszsliwa authored
View
1  .gitignore
@@ -9,6 +9,7 @@ config/deploy
config/mongoid.yml
config/newrelic.yml
.rvmrc
+.idea
*~
*.rbc
.DS_Store
View
1  app/views/errs/show.html.haml
@@ -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
View
5 public/stylesheets/application.css
@@ -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;
View
BIN  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.
View
18 spec/views/errs/show.html.haml_spec.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.