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
diff options
context:
space:
mode:
authorDavid O'Regan <doregan@gitlab.com>2022-10-01 08:28:02 +0300
committerDavid O'Regan <doregan@gitlab.com>2022-10-01 08:28:02 +0300
commit43cee4668fffa9ebc2cafe2bfc0e084d0b8b1b32 (patch)
tree8f451422cc5c5e88705238247e74dfba023f4234
parent8b00f752f0bee98f566d80ec163fd55508d9065f (diff)
parent1284380196bca81375fecb71400e09798a5c0578 (diff)
Merge branch 'sarahg/remove-unused-version-methods' into 'main'
Remove unused Version-related functions See merge request https://gitlab.com/gitlab-org/gitlab-docs/-/merge_requests/3143 Merged-by: David O'Regan <doregan@gitlab.com> Approved-by: David O'Regan <doregan@gitlab.com> Co-authored-by: Sarah German <sgerman@gitlab.com>
-rw-r--r--layouts/partials/versions_list.html21
-rw-r--r--lib/helpers/versions.rb66
2 files changed, 0 insertions, 87 deletions
diff --git a/layouts/partials/versions_list.html b/layouts/partials/versions_list.html
deleted file mode 100644
index dd563e01..00000000
--- a/layouts/partials/versions_list.html
+++ /dev/null
@@ -1,21 +0,0 @@
-<!--
- If we are on the archives page, the link here is hardcoded to always
- point to `/archives/`. If you visit https://docs.gitlab.com/archives/
- and select a version from the dropdown, that version's archives page
- will be shown. We want to always show the latest archives page as it
- contains all current versions and offline archives.
--->
-<% if archives? %>
- <a class="dropdown-item" href='/archives/'>
- <%= version %>
- </a>
-<% else %>
- <!-- Use canonical URLs. If the URL contains 'index', remove it. -->
- <% if @item.identifier.without_ext.split('/').last == 'index' %>
- <a class="dropdown-item" <%= active_dropdown(version) %> href='/<%= version %><%= @item.identifier.without_ext.gsub('index', '') %>'>
- <% else %>
- <a class="dropdown-item" <%= active_dropdown(version) %> href='/<%= version %><%= @item.identifier.without_ext + '.html' %>'>
- <% end %>
- <%= version %>
- </a>
-<% end %>
diff --git a/lib/helpers/versions.rb b/lib/helpers/versions.rb
index 7ec7fe11..ea98b966 100644
--- a/lib/helpers/versions.rb
+++ b/lib/helpers/versions.rb
@@ -5,18 +5,6 @@ module Nanoc::Helpers
STABLE_VERSIONS_REGEX = %r{^\d{1,2}\.\d{1,2}$}.freeze
#
- # Set the active class based on CI_COMMIT_REF_NAME and exclude if on
- # the archives page, otherwise we would end up with two active links.
- #
- def active_dropdown(selection)
- if archives?
- active_class if selection == 'archives'
- elsif selection == ENV['CI_COMMIT_REF_NAME']
- active_class
- end
- end
-
- #
# Determines whether or not to display the version banner on the frontend.
#
# Note: We only want the banner to display on production.
@@ -35,20 +23,6 @@ module Nanoc::Helpers
end
#
- # Check if we are on the /archives page
- #
- def archives?
- @item.identifier.to_s.split('/')[1] == 'archives'
- end
-
- #
- # Define the active CSS class
- #
- def active_class
- %( class="active")
- end
-
- #
# Stable versions regexp
#
# At most two digits for major and minor numbers.
@@ -57,45 +31,5 @@ module Nanoc::Helpers
version.match?(STABLE_VERSIONS_REGEX)
end
- def data_versions
- @items['/_data/versions.yaml']
- end
-
- def next_version
- latest_stable = data_versions[:online].first
- latest_major, latest_minor = latest_stable.split('.')
- _, last_minor = data_versions[:last_before_new_major].first.split('.')
-
- #
- # If the minor version of the latest online version
- # is equal to last_minor, bump the major version
- # and set patch to 0. This is for the case where a new
- # major version is the next version to be released.
- #
- if latest_minor == last_minor
- "#{latest_major.to_i + 1}.0"
- else
- "#{latest_major}.#{latest_minor.to_i + 1}"
- end
- 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