Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorVasilii Iakliushin <viakliushin@gitlab.com>2021-01-12 18:52:03 +0300
committerVasilii Iakliushin <viakliushin@gitlab.com>2021-01-12 18:52:03 +0300
commitfd7ff36b13975408591f24c3e85ceab2969582e3 (patch)
tree30382d14c621589b3b9ef08bed351f4cd2bdb8f6 /lib
parenta75621454ed1df6425afa7ff7a08d44b350e92a6 (diff)
Remove previous versions from dropdown for omnibus packages
We discovered that dropdown displays previous versions when deployed in Omnibus. Changes: * Extract common functionality into a partial or a helper * Add `display_previous_versions?` method to hide previous versions
Diffstat (limited to 'lib')
-rw-r--r--lib/helpers/versions.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/helpers/versions.rb b/lib/helpers/versions.rb
index fbc77940..014a1c0a 100644
--- a/lib/helpers/versions.rb
+++ b/lib/helpers/versions.rb
@@ -56,5 +56,35 @@ module Nanoc::Helpers
def stable_version?(version)
version.match?(STABLE_VERSIONS_REGEX)
end
+
+ def data_versions
+ @items['/_data/versions.yaml']
+ end
+
+ def next_version
+ latest_stable = data_versions[:online].first
+ next_major, next_minor = latest_stable.split('.')
+
+ "#{next_major}.#{next_minor.to_i + 1}"
+ end
+
+ def dotcom
+ "GitLab.com (#{next_version}-pre)"
+ end
+
+ def version_dropdown_title
+ return 'Archives' if archives?
+ return 'Versions' unless production?
+
+ if ENV['CI_COMMIT_REF_NAME'] == ENV['CI_DEFAULT_BRANCH']
+ dotcom
+ else
+ ENV['CI_COMMIT_REF_NAME']
+ end
+ end
+
+ def display_previous_versions?
+ !omnibus?
+ end
end
end