diff options
Diffstat (limited to 'lib/sidebars/menu_item.rb')
-rw-r--r-- | lib/sidebars/menu_item.rb | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/lib/sidebars/menu_item.rb b/lib/sidebars/menu_item.rb index efdedf6c3bd..becff240034 100644 --- a/lib/sidebars/menu_item.rb +++ b/lib/sidebars/menu_item.rb @@ -4,11 +4,11 @@ module Sidebars class MenuItem include ::Sidebars::Concerns::LinkWithHtmlOptions - attr_reader :title, :link, :active_routes, :item_id, :container_html_options, :sprite_icon, :sprite_icon_html_options, :hint_html_options, :has_pill, :pill_count + attr_reader :title, :link, :active_routes, :item_id, :container_html_options, :sprite_icon, :sprite_icon_html_options, :hint_html_options, :has_pill, :pill_count, :super_sidebar_parent, :super_sidebar_before alias_method :has_pill?, :has_pill # rubocop: disable Metrics/ParameterLists - def initialize(title:, link:, active_routes:, item_id: nil, container_html_options: {}, sprite_icon: nil, sprite_icon_html_options: {}, hint_html_options: {}, has_pill: false, pill_count: nil) + def initialize(title:, link:, active_routes:, item_id: nil, container_html_options: {}, sprite_icon: nil, sprite_icon_html_options: {}, hint_html_options: {}, has_pill: false, pill_count: nil, super_sidebar_parent: nil, super_sidebar_before: nil) @title = title @link = link @active_routes = active_routes @@ -19,6 +19,8 @@ module Sidebars @hint_html_options = hint_html_options @has_pill = has_pill @pill_count = pill_count + @super_sidebar_before = super_sidebar_before + @super_sidebar_parent = super_sidebar_parent end # rubocop: enable Metrics/ParameterLists @@ -30,6 +32,25 @@ module Sidebars true end + def serialize_for_super_sidebar + { + title: title, + icon: sprite_icon, + link: link, + active_routes: active_routes, + pill_count: has_pill ? pill_count : nil + # Check whether support is needed for the following properties, + # in order to get feature parity with the HAML renderer + # https://gitlab.com/gitlab-org/gitlab/-/issues/391864 + # + # container_html_options + # hint_html_options + # nav_link_html_options + # + # item_id + } + end + def nav_link_html_options { data: { |