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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/nav/top_nav_menu_builder.rb')
-rw-r--r--lib/gitlab/nav/top_nav_menu_builder.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/gitlab/nav/top_nav_menu_builder.rb b/lib/gitlab/nav/top_nav_menu_builder.rb
index 721ae1889b8..dca3432a6a1 100644
--- a/lib/gitlab/nav/top_nav_menu_builder.rb
+++ b/lib/gitlab/nav/top_nav_menu_builder.rb
@@ -6,9 +6,15 @@ module Gitlab
def initialize
@primary = []
@secondary = []
+ @last_header_added = nil
end
- def add_primary_menu_item(**args)
+ def add_primary_menu_item(header: nil, **args)
+ if header && (header != @last_header_added)
+ add_menu_header(dest: @primary, title: header)
+ @last_header_added = header
+ end
+
add_menu_item(dest: @primary, **args)
end
@@ -30,6 +36,12 @@ module Gitlab
dest.push(item)
end
+
+ def add_menu_header(dest:, **args)
+ header = ::Gitlab::Nav::TopNavMenuHeader.build(**args)
+
+ dest.push(header)
+ end
end
end
end