Class: OkonomiUiKit::Components::NavigationGroupBuilder
- Inherits:
-
Object
- Object
- OkonomiUiKit::Components::NavigationGroupBuilder
- Defined in:
- app/helpers/okonomi_ui_kit/components/navigation.rb
Instance Attribute Summary collapse
-
#links ⇒ Object
readonly
Returns the value of attribute links.
-
#navigation_component ⇒ Object
readonly
Returns the value of attribute navigation_component.
-
#view ⇒ Object
readonly
Returns the value of attribute view.
Instance Method Summary collapse
-
#initialize(view, navigation_component) ⇒ NavigationGroupBuilder
constructor
A new instance of NavigationGroupBuilder.
- #nav_link(title, path, icon: nil, initials: nil, exact: false, target: nil) ⇒ Object
- #render_links ⇒ Object
- #style(*args) ⇒ Object
Constructor Details
#initialize(view, navigation_component) ⇒ NavigationGroupBuilder
Returns a new instance of NavigationGroupBuilder.
71 72 73 74 75 |
# File 'app/helpers/okonomi_ui_kit/components/navigation.rb', line 71 def initialize(view, ) @view = view @navigation_component = @links = [] end |
Instance Attribute Details
#links ⇒ Object (readonly)
Returns the value of attribute links.
69 70 71 |
# File 'app/helpers/okonomi_ui_kit/components/navigation.rb', line 69 def links @links end |
#navigation_component ⇒ Object (readonly)
Returns the value of attribute navigation_component.
69 70 71 |
# File 'app/helpers/okonomi_ui_kit/components/navigation.rb', line 69 def @navigation_component end |
#view ⇒ Object (readonly)
Returns the value of attribute view.
69 70 71 |
# File 'app/helpers/okonomi_ui_kit/components/navigation.rb', line 69 def view @view end |
Instance Method Details
#nav_link(title, path, icon: nil, initials: nil, exact: false, target: nil) ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'app/helpers/okonomi_ui_kit/components/navigation.rb', line 77 def nav_link(title, path, icon: nil, initials: nil, exact: false, target: nil) = { exact: exact, class: style(:link, :base), active_class: style(:link, :active) } [:target] = target if target.present? @links << view.tag.li do view.render "okonomi/components/navigation/link", path: path, title: title, icon: icon, initials: initials, options: , style_helper: self end end |
#render_links ⇒ Object
101 102 103 |
# File 'app/helpers/okonomi_ui_kit/components/navigation.rb', line 101 def render_links view.safe_join(@links) end |
#style(*args) ⇒ Object
97 98 99 |
# File 'app/helpers/okonomi_ui_kit/components/navigation.rb', line 97 def style(*args) .style(*args) end |