debian-mirror-gitlab/lib/sidebars/projects/menus/external_wiki_menu.rb

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

61 lines
1.3 KiB
Ruby
Raw Normal View History

2021-06-08 01:23:25 +05:30
# frozen_string_literal: true
module Sidebars
module Projects
module Menus
class ExternalWikiMenu < ::Sidebars::Menu
override :link
def link
external_wiki.external_wiki_url
end
override :extra_container_html_options
def extra_container_html_options
{
target: '_blank',
rel: 'noopener noreferrer',
class: 'shortcuts-external_wiki'
}
end
override :extra_collapsed_container_html_options
def extra_collapsed_container_html_options
{
target: '_blank',
rel: 'noopener noreferrer'
}
end
override :title
def title
s_('ExternalWikiService|External wiki')
end
override :sprite_icon
def sprite_icon
'external-link'
end
override :render?
def render?
external_wiki.present?
end
2023-07-09 08:55:56 +05:30
override :serialize_as_menu_item_args
def serialize_as_menu_item_args
super.merge({
item_id: :external_wiki,
super_sidebar_parent: ::Sidebars::Projects::SuperSidebarMenus::PlanMenu
})
end
2021-06-08 01:23:25 +05:30
private
def external_wiki
@external_wiki ||= context.project.external_wiki
end
end
end
end
end