Commit f85a8a16eeee19b27b130eda24b3595a3a50898a
1 parent
ced5a311
Exists in
master
and in
1 other branch
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
Showing
4 changed files
with
9 additions
and
9 deletions
Show diff stats
app/helpers/errs_helper.rb
| @@ -8,11 +8,11 @@ module ErrsHelper | @@ -8,11 +8,11 @@ module ErrsHelper | ||
| 8 | Errbit::Config.confirm_resolve_err === false ? nil : 'Seriously?' | 8 | Errbit::Config.confirm_resolve_err === false ? nil : 'Seriously?' |
| 9 | end | 9 | end |
| 10 | 10 | ||
| 11 | - def link_to_github app, notice | 11 | + def link_to_github app, notice, text=nil |
| 12 | file_name = notice.top_in_app_backtrace_line['file'].split('/').last | 12 | file_name = notice.top_in_app_backtrace_line['file'].split('/').last |
| 13 | file_path = notice.top_in_app_backtrace_line['file'].gsub('[PROJECT_ROOT]', '') | 13 | file_path = notice.top_in_app_backtrace_line['file'].gsub('[PROJECT_ROOT]', '') |
| 14 | line_number = notice.top_in_app_backtrace_line['number'] | 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 | end | 16 | end |
| 17 | 17 | ||
| 18 | end | 18 | end |
| 19 | \ No newline at end of file | 19 | \ No newline at end of file |
app/models/notice.rb
| @@ -56,6 +56,10 @@ class Notice | @@ -56,6 +56,10 @@ class Notice | ||
| 56 | agent_string.blank? ? nil : UserAgent.parse(agent_string) | 56 | agent_string.blank? ? nil : UserAgent.parse(agent_string) |
| 57 | end | 57 | end |
| 58 | 58 | ||
| 59 | + def self.in_app_backtrace_line? line | ||
| 60 | + line['file'] =~ %r{^\[PROJECT_ROOT\]/(?!(vendor))} | ||
| 61 | + end | ||
| 62 | + | ||
| 59 | def request | 63 | def request |
| 60 | read_attribute(:request) || {} | 64 | read_attribute(:request) || {} |
| 61 | end | 65 | end |
| @@ -81,7 +85,7 @@ class Notice | @@ -81,7 +85,7 @@ class Notice | ||
| 81 | end | 85 | end |
| 82 | 86 | ||
| 83 | def top_in_app_backtrace_line | 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 | end | 89 | end |
| 86 | 90 | ||
| 87 | protected | 91 | protected |
| @@ -122,4 +126,3 @@ class Notice | @@ -122,4 +126,3 @@ class Notice | ||
| 122 | end | 126 | end |
| 123 | end | 127 | end |
| 124 | end | 128 | end |
| 125 | - |
app/views/notices/_backtrace.html.haml
| @@ -4,7 +4,8 @@ | @@ -4,7 +4,8 @@ | ||
| 4 | %th | 4 | %th |
| 5 | %ul.line-numbers | 5 | %ul.line-numbers |
| 6 | - lines.each do |line| | 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 | %td | 9 | %td |
| 9 | %ul.lines | 10 | %ul.lines |
| 10 | - lines.each do |line| | 11 | - lines.each do |line| |
app/views/notices/_summary.html.haml