Class: Sidebars::Panel
- Inherits:
-
Object
- Object
- Sidebars::Panel
- Extended by:
- Gitlab::Utils::Override
- Includes:
- Concerns::PositionableList
- Defined in:
- lib/sidebars/panel.rb
Direct Known Subclasses
Admin::Panel, Explore::Panel, Groups::Panel, Organizations::Panel, Sidebars::Projects::Panel, Search::Panel, UserProfile::Panel, UserSettings::Panel, YourWork::Panel
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#hidden_menu ⇒ Object
readonly
Returns the value of attribute hidden_menu.
-
#scope_menu ⇒ Object
readonly
Returns the value of attribute scope_menu.
Instance Method Summary collapse
- #add_menu(menu) ⇒ Object
- #aria_label ⇒ Object
- #configure_menus ⇒ Object
- #container ⇒ Object
-
#initialize(context) ⇒ Panel
constructor
A new instance of Panel.
- #insert_menu_after(after_menu, new_menu) ⇒ Object
- #insert_menu_before(before_menu, new_menu) ⇒ Object
- #remove_menu(menu_to_remove) ⇒ Object
- #render? ⇒ Boolean
- #renderable_menus ⇒ Object
- #replace_menu(menu_to_replace, new_menu) ⇒ Object
- #set_hidden_menu(hidden_menu) ⇒ Object
- #set_scope_menu(scope_menu) ⇒ Object
- #super_sidebar_context_header ⇒ Object
-
#super_sidebar_menu_items ⇒ Object
Serializes every renderable menu and returns a flattened result.
Methods included from Gitlab::Utils::Override
extended, extensions, included, method_added, override, prepended, queue_verification, verify!
Methods included from Concerns::PositionableList
#add_element, #insert_element_after, #insert_element_before, #remove_element, #replace_element
Constructor Details
#initialize(context) ⇒ Panel
Returns a new instance of Panel.
10 11 12 13 14 15 16 17 |
# File 'lib/sidebars/panel.rb', line 10 def initialize(context) @context = context = nil = nil = [] end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
8 9 10 |
# File 'lib/sidebars/panel.rb', line 8 def context @context end |
#hidden_menu ⇒ Object (readonly)
Returns the value of attribute hidden_menu.
8 9 10 |
# File 'lib/sidebars/panel.rb', line 8 def end |
#scope_menu ⇒ Object (readonly)
Returns the value of attribute scope_menu.
8 9 10 |
# File 'lib/sidebars/panel.rb', line 8 def end |
Instance Method Details
#add_menu(menu) ⇒ Object
23 24 25 |
# File 'lib/sidebars/panel.rb', line 23 def () add_element(, ) end |
#aria_label ⇒ Object
51 52 53 |
# File 'lib/sidebars/panel.rb', line 51 def aria_label raise NotImplementedError end |
#configure_menus ⇒ Object
19 20 21 |
# File 'lib/sidebars/panel.rb', line 19 def # No-op end |
#container ⇒ Object
73 74 75 |
# File 'lib/sidebars/panel.rb', line 73 def container context.container end |
#insert_menu_after(after_menu, new_menu) ⇒ Object
31 32 33 |
# File 'lib/sidebars/panel.rb', line 31 def (, ) insert_element_after(, , ) end |
#insert_menu_before(before_menu, new_menu) ⇒ Object
27 28 29 |
# File 'lib/sidebars/panel.rb', line 27 def (, ) insert_element_before(, , ) end |
#remove_menu(menu_to_remove) ⇒ Object
39 40 41 |
# File 'lib/sidebars/panel.rb', line 39 def () remove_element(, ) end |
#render? ⇒ Boolean
55 56 57 |
# File 'lib/sidebars/panel.rb', line 55 def render? .any? end |
#renderable_menus ⇒ Object
59 60 61 |
# File 'lib/sidebars/panel.rb', line 59 def ||= .select(&:render?) end |
#replace_menu(menu_to_replace, new_menu) ⇒ Object
35 36 37 |
# File 'lib/sidebars/panel.rb', line 35 def (, ) replace_element(, , ) end |
#set_hidden_menu(hidden_menu) ⇒ Object
47 48 49 |
# File 'lib/sidebars/panel.rb', line 47 def () = end |
#set_scope_menu(scope_menu) ⇒ Object
43 44 45 |
# File 'lib/sidebars/panel.rb', line 43 def () = end |
#super_sidebar_context_header ⇒ Object
69 70 71 |
# File 'lib/sidebars/panel.rb', line 69 def raise NotImplementedError end |
#super_sidebar_menu_items ⇒ Object
Serializes every renderable menu and returns a flattened result
64 65 66 67 |
# File 'lib/sidebars/panel.rb', line 64 def ||= .flat_map(&:serialize_for_super_sidebar) end |