Move url generation to helper, made it reliable with ssh git checkout

This commit is contained in:
Alex Sherman 2020-04-16 16:01:34 +05:00
parent 1fabdb6a72
commit 197d199215
6 changed files with 15 additions and 6 deletions

View file

@ -33,6 +33,15 @@ module ApplicationHelper
end
end
def current_commit_link
hash = CURRENT_COMMIT_HASH
current_repo = CURRENT_COMMIT_REPO.gsub('com:', 'com/')
.gsub('git@', 'https://')
.gsub('.git', '')
link_to hash.to_s, "#{current_repo}/commit/#{hash}", class: 'footer-version-link'
end
def creator_link(model)
return 'not present' if model.blank?
return 'unknown' if model.creator.blank?
@ -96,4 +105,4 @@ module ApplicationHelper
def body_css_class
[controller_path.split('/').map!(&:dasherize), action_name.dasherize, 'page'].join('-')
end
end
end