Sha256: 51e46298fc977af50357b0fdb499584171ebca1954ab91f0c752fb820ff03b10

Contents?: true

Size: 662 Bytes

Versions: 2

Compression:

Stored size: 662 Bytes

Contents

# frozen_string_literal: true

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

  # @param item [SolidusAdmin::MainNavItem
  # @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

2 entries across 2 versions & 1 rubygems

Version Path
solidus_admin-0.0.2 app/components/solidus_admin/sidebar/item/component.rb
solidus_admin-0.0.1 app/components/solidus_admin/sidebar/item/component.rb