Class: Spree::BackendConfiguration::MenuItem
- Inherits:
-
Object
- Object
- Spree::BackendConfiguration::MenuItem
- Defined in:
- lib/spree/backend_configuration/menu_item.rb
Overview
An item which should be drawn in the admin menu
Instance Attribute Summary collapse
-
#condition ⇒ Object
readonly
Returns the value of attribute condition.
-
#icon ⇒ Object
readonly
Returns the value of attribute icon.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#match_path ⇒ Object
readonly
Returns the value of attribute match_path.
-
#partial ⇒ Object
readonly
Returns the value of attribute partial.
-
#position ⇒ Object
Returns the value of attribute position.
-
#sections ⇒ Object
readonly
Returns the value of attribute sections.
Instance Method Summary collapse
-
#initialize(sections, icon, condition: nil, label: nil, partial: nil, url: nil, position: nil, match_path: nil) ⇒ MenuItem
constructor
A new instance of MenuItem.
- #url ⇒ Object
Constructor Details
#initialize(sections, icon, condition: nil, label: nil, partial: nil, url: nil, position: nil, match_path: nil) ⇒ MenuItem
Returns a new instance of MenuItem.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/spree/backend_configuration/menu_item.rb', line 27 def initialize( sections, icon, condition: nil, label: nil, partial: nil, url: nil, position: nil, match_path: nil ) @condition = condition || -> { true } @sections = sections @icon = icon @label = label || sections.first @partial = partial @url = url @position = position @match_path = match_path end |
Instance Attribute Details
#condition ⇒ Object (readonly)
Returns the value of attribute condition.
7 8 9 |
# File 'lib/spree/backend_configuration/menu_item.rb', line 7 def condition @condition end |
#icon ⇒ Object (readonly)
Returns the value of attribute icon.
7 8 9 |
# File 'lib/spree/backend_configuration/menu_item.rb', line 7 def icon @icon end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
7 8 9 |
# File 'lib/spree/backend_configuration/menu_item.rb', line 7 def label @label end |
#match_path ⇒ Object (readonly)
Returns the value of attribute match_path.
7 8 9 |
# File 'lib/spree/backend_configuration/menu_item.rb', line 7 def match_path @match_path end |
#partial ⇒ Object (readonly)
Returns the value of attribute partial.
7 8 9 |
# File 'lib/spree/backend_configuration/menu_item.rb', line 7 def partial @partial end |
#position ⇒ Object
Returns the value of attribute position.
9 10 11 |
# File 'lib/spree/backend_configuration/menu_item.rb', line 9 def position @position end |
#sections ⇒ Object (readonly)
Returns the value of attribute sections.
7 8 9 |
# File 'lib/spree/backend_configuration/menu_item.rb', line 7 def sections @sections end |
Instance Method Details
#url ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/spree/backend_configuration/menu_item.rb', line 48 def url if @url.respond_to?(:call) @url.call else @url end end |