Sha256: 0a2dfe90104fd6645857071dfa57b5690369461010c1ac2feb41a1b0d841d32b

Contents?: true

Size: 671 Bytes

Versions: 4

Compression:

Stored size: 671 Bytes

Contents

# frozen_string_literal: true

# Menu item within a {Sidebar}
class SolidusAdmin::Layout::Navigation::Item::Component < SolidusAdmin::BaseComponent
  with_collection_parameter :item

  # @param item [SolidusAdmin::MenuItem]
  # @param fullpath [String] the current path
  # @param url_helpers [#solidus_admin, #spree] context for generating paths
  def initialize(
    item:,
    fullpath: "#",
    url_helpers: Struct.new(:spree, :solidus_admin).new(spree, solidus_admin)
  )
    @item = item
    @url_helpers = url_helpers
    @fullpath = fullpath
  end

  def path
    @item.path(@url_helpers)
  end

  def active?
    @item.active?(@url_helpers, @fullpath)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
solidus_admin-0.3.1 app/components/solidus_admin/layout/navigation/item/component.rb
solidus_admin-0.3.0 app/components/solidus_admin/layout/navigation/item/component.rb
solidus_admin-0.2.0 app/components/solidus_admin/layout/navigation/item/component.rb
solidus_admin-0.1.0 app/components/solidus_admin/layout/navigation/item/component.rb