Merge pull request #1345 from internetee/clickable-version-string

Clickable version string
This commit is contained in:
Timo Võhmar 2020-04-17 18:36:12 +03:00 committed by GitHub
commit f26031d539
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 18 additions and 5 deletions

View file

@ -15,6 +15,9 @@ body > .container
padding-top: 15px
font-size: 10px
a.footer-version-link
color: black
.nowrap
white-space: nowrap

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

View file

@ -32,5 +32,5 @@
.footer.text-right
Version
= CURRENT_COMMIT_HASH
= current_commit_link
= javascript_include_tag 'admin-manifest', async: true

View file

@ -76,7 +76,7 @@
</div>
<div class="col-md-6 text-right">
Version
<%= CURRENT_COMMIT_HASH %>
<%= current_commit_link %>
</div>
</div>
</div>

View file

@ -54,7 +54,7 @@
</div>
<div class="col-md-6 text-right">
Version
<%= CURRENT_COMMIT_HASH %>
<%= current_commit_link %>
</div>
</div>
</div>

View file

@ -44,7 +44,7 @@
</div>
<div class="col-md-6 text-right">
Version
<%= CURRENT_COMMIT_HASH %>
<%= current_commit_link %>
</div>
</div>
</div>

View file

@ -1 +1,2 @@
CURRENT_COMMIT_HASH = `git rev-parse --short HEAD`
CURRENT_COMMIT_REPO = `git remote get-url origin`