gitlab-org--gitlab-foss/app/helpers/version_check_helper.rb
Bob Van Landuyt b09e40624b Show the commit-sha for pre-release versions
The pre-release tags are set at the beginning of a release, so it
would be impossible to figure out which version was running if we're
running nightlies.

In that case it's better to still link to the SHA. These versions
don't get deployed to .com.
2018-10-02 16:11:32 +02:00

25 lines
837 B
Ruby

# frozen_string_literal: true
module VersionCheckHelper
def version_status_badge
return unless Rails.env.production?
return unless Gitlab::CurrentSettings.version_check_enabled
return if User.single_user&.requires_usage_stats_consent?
image_url = VersionCheck.new.url
image_tag image_url, class: 'js-version-status-badge'
end
def link_to_version
if Gitlab.pre_release?
commit_link = link_to(Gitlab.revision, Gitlab::COM_URL + namespace_project_commits_path('gitlab-org', source_code_project, Gitlab.revision))
[Gitlab::VERSION, content_tag(:small, commit_link)].join(' ').html_safe
else
link_to Gitlab::VERSION, Gitlab::COM_URL + namespace_project_tag_path('gitlab-org', source_code_project, "v#{Gitlab::VERSION}")
end
end
def source_code_project
'gitlab-ce'
end
end