Commit 32e9bbfc47a9b5101794683a2dc7e387e15057df
1 parent
1ec24d91
Exists in
master
and in
1 other branch
Added asset_host to generate JavaScript links in backtraces
Showing
3 changed files
with
17 additions
and
1 deletions
Show diff stats
app/helpers/backtrace_line_helper.rb
... | ... | @@ -7,13 +7,24 @@ module BacktraceLineHelper |
7 | 7 | private |
8 | 8 | def link_to_in_app_source_file(line, text) |
9 | 9 | return unless line.in_app? |
10 | - link_to_repo_source_file(line, text) || link_to_issue_tracker_file(line, text) | |
10 | + if line.file_name =~ /\.js$/ | |
11 | + link_to_hosted_javascript(line, text) | |
12 | + else | |
13 | + link_to_repo_source_file(line, text) || | |
14 | + link_to_issue_tracker_file(line, text) | |
15 | + end | |
11 | 16 | end |
12 | 17 | |
13 | 18 | def link_to_repo_source_file(line, text) |
14 | 19 | link_to_github(line, text) || link_to_bitbucket(line, text) |
15 | 20 | end |
16 | 21 | |
22 | + def link_to_hosted_javascript(line, text) | |
23 | + if line.app.asset_host? | |
24 | + link_to(text, "#{line.app.asset_host}/#{line.file_relative}", :target => '_blank') | |
25 | + end | |
26 | + end | |
27 | + | |
17 | 28 | def link_to_external_source_file(text) |
18 | 29 | text |
19 | 30 | end | ... | ... |
app/models/app.rb
... | ... | @@ -7,6 +7,7 @@ class App |
7 | 7 | field :api_key |
8 | 8 | field :github_repo |
9 | 9 | field :bitbucket_repo |
10 | + field :asset_host | |
10 | 11 | field :repository_branch |
11 | 12 | field :resolve_errs_on_deploy, :type => Boolean, :default => false |
12 | 13 | field :notify_all_users, :type => Boolean, :default => false | ... | ... |
app/views/apps/_fields.html.haml
... | ... | @@ -13,6 +13,10 @@ |
13 | 13 | %div |
14 | 14 | = f.label :bitbucket_repo |
15 | 15 | = f.text_field :bitbucket_repo, :placeholder => "errbit/errbit from https://bitbucket.org/errbit/errbit" |
16 | +%div | |
17 | + = f.label :asset_host | |
18 | + %em Used to generate links for JavaScript errors | |
19 | + = f.text_field :asset_host, :placeholder => "e.g. https://assets.example.com" | |
16 | 20 | |
17 | 21 | %fieldset |
18 | 22 | %legend Notifications | ... | ... |