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:
authorSarah German <sgerman@gitlab.com>2023-03-07 22:58:57 +0300
committerSarah German <sgerman@gitlab.com>2023-03-07 22:58:57 +0300
commit384964f7d2366f24f77eacd30f1fd814a5ab3a26 (patch)
tree44abde8ca97058332b15e96fc0d2f4895c036982
parent7846dd526e31550f845e8e66452d11be822c8689 (diff)
parentfeb110fc5634df3c6ac7858770df142734c72c3f (diff)
Merge branch 'axil-rm-omnibus-code' into 'main'
Remove any Omnibus-related code See merge request https://gitlab.com/gitlab-org/gitlab-docs/-/merge_requests/3629 Merged-by: Sarah German <sgerman@gitlab.com> Approved-by: Sarah German <sgerman@gitlab.com> Co-authored-by: Achilleas Pipinellis <axil@gitlab.com>
-rw-r--r--Rules2
-rw-r--r--layouts/global_nav.html2
-rw-r--r--lib/gitlab/navigation.rb31
-rw-r--r--lib/gitlab/navigation/section.rb7
-rw-r--r--lib/gitlab/symlinks_converter.rb39
-rw-r--r--lib/helpers/generic.rb7
6 files changed, 1 insertions, 87 deletions
diff --git a/Rules b/Rules
index 08ff670a..bf74263e 100644
--- a/Rules
+++ b/Rules
@@ -187,6 +187,4 @@ passthrough '/favicon.ico'
postprocess do
raise "Failed to copy GitLab fonts. Run 'yarn install' and try again." unless system('make add-gitlab-fonts')
raise "postprocessing error" unless system('nanoc frontend')
-
- Gitlab::SymlinksConverter.run(config, items)
end
diff --git a/layouts/global_nav.html b/layouts/global_nav.html
index ebe49eaa..aacce628 100644
--- a/layouts/global_nav.html
+++ b/layouts/global_nav.html
@@ -12,7 +12,7 @@
</span>
<!-- nav categories -->
- <% if sec.has_children? && sec.enabled %>
+ <% if sec.has_children? %>
<div class="collapse <%= navigation.show_element?(sec) ? 'show' : '' %>" id="sec_<%= sec_uuid %>">
<% sec.children.each do |cat| %>
<% cat_uuid = SecureRandom.uuid %>
diff --git a/lib/gitlab/navigation.rb b/lib/gitlab/navigation.rb
index fd490588..a00dc600 100644
--- a/lib/gitlab/navigation.rb
+++ b/lib/gitlab/navigation.rb
@@ -1,19 +1,14 @@
# frozen_string_literal: true
-require_relative '../helpers/generic'
require_relative '../helpers/icons_helper'
module Gitlab
class Navigation
- include Nanoc::Helpers::Generic
include Nanoc::Helpers::IconsHelper
def initialize(items, item)
@items = items
@item = item
-
- disable_inactive_sections!
- omnibus_only_items!
end
def nav_items
@@ -40,36 +35,10 @@ module Gitlab
attr_reader :items, :item
- def disable_inactive_sections!
- return unless omnibus?
-
- children.each do |section|
- section.disable! unless has_active_element?([section])
- end
- end
-
- # Remove sections and categories menu items missing in Omnibus
- def omnibus_only_items!
- return unless omnibus?
-
- children.filter! do |section|
- if allowed_link?(section.url)
- section.children.filter! { |category| allowed_link?(category.url) }
- true
- end
- end
- end
-
def allowed_link?(link)
link.start_with?('ee/', 'http')
end
- def has_active_element?(collection)
- return false unless collection
-
- collection.any? { |element| show_element?(element) || has_active_element?(element.children) }
- end
-
def dir
@dir ||= item.identifier.to_s[%r{(?<=/)[^/]+}]
end
diff --git a/lib/gitlab/navigation/section.rb b/lib/gitlab/navigation/section.rb
index 40ae04a7..dc470cb9 100644
--- a/lib/gitlab/navigation/section.rb
+++ b/lib/gitlab/navigation/section.rb
@@ -5,13 +5,6 @@ module Gitlab
class Section
def initialize(section)
@section = section
- @enabled = true
- end
-
- attr_reader :enabled
-
- def disable!
- @enabled = false
end
def title
diff --git a/lib/gitlab/symlinks_converter.rb b/lib/gitlab/symlinks_converter.rb
deleted file mode 100644
index 043a5042..00000000
--- a/lib/gitlab/symlinks_converter.rb
+++ /dev/null
@@ -1,39 +0,0 @@
-# frozen_string_literal: true
-
-module Gitlab
- class SymlinksConverter
- include Nanoc::Helpers::Generic
- EXTENSIONS = %w[png jpg gif svg].freeze
-
- def initialize(config, items)
- @config = config
- @items = items
- end
-
- def self.run(config, items)
- new(config, items).run
- end
-
- def run
- return unless omnibus?
-
- items.each do |item|
- id = item.identifier
-
- next unless id.to_s.start_with?('/ee/')
- next unless EXTENSIONS.include?(id.ext)
-
- file_path = File.join(config.fetch(:content_dir), id.to_s)
- real_path = Pathname.new(file_path).realpath.to_s
- symlink = File.join(config.output_dir, id.to_s)
-
- # Replace a file with a symlink
- File.delete(symlink) && File.symlink(real_path, symlink) if File.exist?(symlink)
- end
- end
-
- private
-
- attr_reader :config, :items
- end
-end
diff --git a/lib/helpers/generic.rb b/lib/helpers/generic.rb
index cfcb8112..f0ef3f44 100644
--- a/lib/helpers/generic.rb
+++ b/lib/helpers/generic.rb
@@ -20,13 +20,6 @@ module Nanoc::Helpers
end
#
- # Used when bundling gitlab-docs with Omnibus
- #
- def omnibus?
- ENV['NANOC_ENV'] == 'omnibus'
- end
-
- #
# Find the current branch. If CI_COMMIT_BRANCH is not defined, that means
# we're working locally, and Git is used to find the branch.
#