Commit f85a8a16eeee19b27b130eda24b3595a3a50898a

Authored by Barry Hess
1 parent ced5a311
Exists in master and in 1 other branch production

Updated GitHub linkage on a notice to be directly on the backtrace line numbers,…

… not in the summary area.

Conflicts:

	app/models/notice.rb
	app/views/notices/_summary.html.haml
app/helpers/errs_helper.rb
... ... @@ -8,11 +8,11 @@ module ErrsHelper
8 8 Errbit::Config.confirm_resolve_err === false ? nil : 'Seriously?'
9 9 end
10 10  
11   - def link_to_github app, notice
  11 + def link_to_github app, notice, text=nil
12 12 file_name = notice.top_in_app_backtrace_line['file'].split('/').last
13 13 file_path = notice.top_in_app_backtrace_line['file'].gsub('[PROJECT_ROOT]', '')
14 14 line_number = notice.top_in_app_backtrace_line['number']
15   - link_to(file_name, "#{app.github_url_to_file(file_path)}#L#{line_number}", :target => '_blank')
  15 + link_to(text || file_name, "#{app.github_url_to_file(file_path)}#L#{line_number}", :target => '_blank')
16 16 end
17 17  
18 18 end
19 19 \ No newline at end of file
... ...
app/models/notice.rb
... ... @@ -56,6 +56,10 @@ class Notice
56 56 agent_string.blank? ? nil : UserAgent.parse(agent_string)
57 57 end
58 58  
  59 + def self.in_app_backtrace_line? line
  60 + line['file'] =~ %r{^\[PROJECT_ROOT\]/(?!(vendor))}
  61 + end
  62 +
59 63 def request
60 64 read_attribute(:request) || {}
61 65 end
... ... @@ -81,7 +85,7 @@ class Notice
81 85 end
82 86  
83 87 def top_in_app_backtrace_line
84   - @top_in_app_backtrace_line ||= self.backtrace.find {|line| line['file'] =~ %r{^\[PROJECT_ROOT\]/(?!(vendor))} }
  88 + @top_in_app_backtrace_line ||= self.backtrace.find {|line| Notice.in_app_backtrace_line?(line) }
85 89 end
86 90  
87 91 protected
... ... @@ -122,4 +126,3 @@ class Notice
122 126 end
123 127 end
124 128 end
125   -
... ...
app/views/notices/_backtrace.html.haml
... ... @@ -4,7 +4,8 @@
4 4 %th
5 5 %ul.line-numbers
6 6 - lines.each do |line|
7   - %li= line['number']
  7 + %li= (@app.github_url? && Notice.in_app_backtrace_line?(line)) ? link_to_github(@app, @notice, line['number']) : line['number']
  8 +
8 9 %td
9 10 %ul.lines
10 11 - lines.each do |line|
... ...
app/views/notices/_summary.html.haml
... ... @@ -19,7 +19,3 @@
19 19 %tr
20 20 %th Browser
21 21 %td= user_agent_graph(notice.err)
22   - - if @app.github_url?
23   - %tr
24   - %th GitHub
25   - %td= link_to_github(@app, notice)
... ...