2018-12-05 23:21:45 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2015-09-11 14:41:01 +05:30
|
|
|
module VersionCheckHelper
|
|
|
|
def version_status_badge
|
2018-11-20 20:47:30 +05:30
|
|
|
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'
|
2015-09-11 14:41:01 +05:30
|
|
|
end
|
2018-12-05 23:21:45 +05:30
|
|
|
|
|
|
|
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
|
2015-09-11 14:41:01 +05:30
|
|
|
end
|