Class: Katalyst::Navigation::Item
- Inherits:
-
ApplicationRecord
- Object
- ApplicationRecord
- Katalyst::Navigation::Item
- Defined in:
- app/models/katalyst/navigation/item.rb
Overview
STI base class for menu items (headings, links and buttons)
Constant Summary collapse
- TARGETS =
%i[self _top _blank kpop].index_by(&:itself).freeze
Instance Attribute Summary collapse
-
#children ⇒ Object
Returns the value of attribute children.
-
#depth ⇒ Object
Returns the value of attribute depth.
-
#index ⇒ Object
Returns the value of attribute index.
-
#parent ⇒ Object
Returns the value of attribute parent.
Class Method Summary collapse
Instance Method Summary collapse
-
#item_options ⇒ Object
Entrypoint for combining additional options based on attribute rules.
- #layout? ⇒ Boolean
- #options_for_target ⇒ Object
Instance Attribute Details
#children ⇒ Object
Returns the value of attribute children.
11 12 13 |
# File 'app/models/katalyst/navigation/item.rb', line 11 def children @children end |
#depth ⇒ Object
Returns the value of attribute depth.
11 12 13 |
# File 'app/models/katalyst/navigation/item.rb', line 11 def depth @depth end |
#index ⇒ Object
Returns the value of attribute index.
11 12 13 |
# File 'app/models/katalyst/navigation/item.rb', line 11 def index @index end |
#parent ⇒ Object
Returns the value of attribute parent.
11 12 13 |
# File 'app/models/katalyst/navigation/item.rb', line 11 def parent @parent end |
Class Method Details
.permitted_params ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'app/models/katalyst/navigation/item.rb', line 17 def self.permitted_params %i[ title url visible target type ] end |
Instance Method Details
#item_options ⇒ Object
Entrypoint for combining additional options based on attribute rules
32 33 34 |
# File 'app/models/katalyst/navigation/item.rb', line 32 def end |
#layout? ⇒ Boolean
27 28 29 |
# File 'app/models/katalyst/navigation/item.rb', line 27 def layout? is_a? Layout end |
#options_for_target ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'app/models/katalyst/navigation/item.rb', line 36 def return {} if target == "self" = { target: target } unless target == "_blank" || target == "_top" = { data: { turbo: true, turbo_frame: target } } end end |