debian-mirror-gitlab/lib/sidebars/menu_item.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

37 lines
980 B
Ruby
Raw Normal View History

2021-06-08 01:23:25 +05:30
# frozen_string_literal: true
module Sidebars
class MenuItem
2022-01-26 12:08:38 +05:30
include ::Sidebars::Concerns::LinkWithHtmlOptions
2021-06-08 01:23:25 +05:30
attr_reader :title, :link, :active_routes, :item_id, :container_html_options, :sprite_icon, :sprite_icon_html_options, :hint_html_options
def initialize(title:, link:, active_routes:, item_id: nil, container_html_options: {}, sprite_icon: nil, sprite_icon_html_options: {}, hint_html_options: {})
@title = title
@link = link
@active_routes = active_routes
@item_id = item_id
@container_html_options = { aria: { label: title } }.merge(container_html_options)
@sprite_icon = sprite_icon
@sprite_icon_html_options = sprite_icon_html_options
@hint_html_options = hint_html_options
end
def show_hint?
hint_html_options.present?
end
def render?
true
end
2021-09-04 01:27:46 +05:30
def nav_link_html_options
{
data: {
track_label: item_id
}
}
end
2021-06-08 01:23:25 +05:30
end
end