Class: Nav::TreeComponent
- Inherits:
-
SparkComponents::Component
- Object
- SparkComponents::Component
- Nav::TreeComponent
- Defined in:
- app/components/spark/nav/tree_component.rb
Instance Method Summary collapse
Instance Method Details
#before_render ⇒ Object
7 8 9 |
# File 'app/components/spark/nav/tree_component.rb', line 7 def before_render data_attr tree: id end |
#group_expanded?(node) ⇒ Boolean
47 48 49 50 51 52 53 54 55 |
# File 'app/components/spark/nav/tree_component.rb', line 47 def (node) ||= begin @view.( id ) rescue nil end && !![ node ] end |
#render ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'app/components/spark/nav/tree_component.rb', line 37 def render content_tag(:ul, tag_attrs) do items.each { |item| # Wrap links in `<li>`s if it's a link item = content_tag(:li, item, class: "nav-item-wrapper", role: "none") if item.respond_to?(:href) concat item } end end |