diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-01-29 22:38:00 +0300 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2017-02-07 01:12:23 +0300 |
commit | 27f2ca94181880861269a7ddc07ae0d50a656d35 (patch) | |
tree | f93a26a7bf263e448f24230950db618bcd73b8f5 /app/helpers/commits_helper.rb | |
parent | d147688af4adb6bcd6cb0f18797c70a8a451f4fa (diff) |
Add 'View on [env]' link to blobs and individual files in diffs
Diffstat (limited to 'app/helpers/commits_helper.rb')
-rw-r--r-- | app/helpers/commits_helper.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/app/helpers/commits_helper.rb b/app/helpers/commits_helper.rb index 6dcb624c4da..a5cf4ddb6a3 100644 --- a/app/helpers/commits_helper.rb +++ b/app/helpers/commits_helper.rb @@ -205,6 +205,17 @@ module CommitsHelper end end + def view_on_environment_btn(commit_sha, diff_new_path, environment) + return unless environment && commit_sha + + external_url = environment.external_url_for(diff_new_path, commit_sha) + return unless external_url + + link_to(external_url, class: 'btn btn-file-option has-tooltip', target: '_blank', title: "View on #{environment.formatted_external_url}", data: { container: 'body' }) do + icon('external-link') + end + end + def truncate_sha(sha) Commit.truncate_sha(sha) end |