Class: Primer::OpenProject::PageHeader::Menu
- Inherits:
-
Component
- Object
- ViewComponent::Base
- Component
- Primer::OpenProject::PageHeader::Menu
- Defined in:
- app/components/primer/open_project/page_header/menu.rb
Overview
A Helper class to create ActionMenus inside the PageHeader action slot It should not be used standalone
Constant Summary
Constants inherited from Component
Component::INVALID_ARIA_LABEL_TAGS
Constants included from Status::Dsl
Constants included from ViewHelper
Constants included from TestSelectorHelper
TestSelectorHelper::TEST_SELECTOR_TAG
Constants included from FetchOrFallbackHelper
FetchOrFallbackHelper::InvalidValueError
Constants included from AttributesHelper
AttributesHelper::PLURAL_ARIA_ATTRIBUTES, AttributesHelper::PLURAL_DATA_ATTRIBUTES
Instance Method Summary collapse
- #before_render ⇒ Object
- #call ⇒ Object
-
#initialize(menu_arguments: {}, button_arguments: {}) ⇒ Menu
constructor
A new instance of Menu.
- #render_in(view_context, &block) ⇒ Object
Methods inherited from Component
Methods included from JoinStyleArgumentsHelper
Methods included from TestSelectorHelper
Methods included from FetchOrFallbackHelper
#fetch_or_fallback, #fetch_or_fallback_boolean, #silence_deprecations?
Methods included from ClassNameHelper
Methods included from AttributesHelper
#aria, #data, #extract_data, #merge_aria, #merge_data, #merge_prefixed_attribute_hashes
Methods included from ExperimentalSlotHelpers
Methods included from ExperimentalRenderHelpers
Constructor Details
#initialize(menu_arguments: {}, button_arguments: {}) ⇒ Menu
Returns a new instance of Menu.
13 14 15 16 17 18 19 20 |
# File 'app/components/primer/open_project/page_header/menu.rb', line 13 def initialize(menu_arguments: {}, button_arguments: {}) callback = .delete(:button_block) @menu = Primer::Alpha::ActionMenu.new(**) @button = @menu.(**) do || callback&.call() end end |
Instance Method Details
#before_render ⇒ Object
28 29 30 |
# File 'app/components/primer/open_project/page_header/menu.rb', line 28 def before_render content end |
#call ⇒ Object
32 33 34 |
# File 'app/components/primer/open_project/page_header/menu.rb', line 32 def call render(@menu) end |
#render_in(view_context, &block) ⇒ Object
22 23 24 25 26 |
# File 'app/components/primer/open_project/page_header/menu.rb', line 22 def render_in(view_context, &block) super(view_context) do block&.call(@menu, @button) end end |