Class: SolidusAdmin::Layout::Navigation::Component
- Inherits:
-
BaseComponent
- Object
- BaseComponent
- SolidusAdmin::Layout::Navigation::Component
- Defined in:
- app/components/solidus_admin/layout/navigation/component.rb
Instance Method Summary collapse
- #before_render ⇒ Object
-
#initialize(store:, logo_path: SolidusAdmin::Config.logo_path, items: SolidusAdmin::Config.menu_items) ⇒ Component
constructor
A new instance of Component.
- #items ⇒ Object
Constructor Details
#initialize(store:, logo_path: SolidusAdmin::Config.logo_path, items: SolidusAdmin::Config.menu_items) ⇒ Component
Returns a new instance of Component.
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'app/components/solidus_admin/layout/navigation/component.rb', line 4 def initialize( store:, logo_path: SolidusAdmin::Config.logo_path, items: SolidusAdmin::Config. ) @logo_path = logo_path @items = items.map do |attrs| children = attrs[:children].to_a.map { SolidusAdmin::MenuItem.new(**_1, top_level: false) } SolidusAdmin::MenuItem.new(**attrs, children:, top_level: true) end @store = store end |
Instance Method Details
#before_render ⇒ Object
17 18 19 20 21 |
# File 'app/components/solidus_admin/layout/navigation/component.rb', line 17 def before_render url = @store.url url = "https://#{url}" unless url.start_with?("http") @store_url = url end |
#items ⇒ Object
23 24 25 |
# File 'app/components/solidus_admin/layout/navigation/component.rb', line 23 def items @items.sort_by(&:position) end |