Class: OkonomiUiKit::Components::NavigationGroupBuilder

Inherits:
Object
  • Object
show all
Defined in:
app/helpers/okonomi_ui_kit/components/navigation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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, navigation_component)
  @view = view
  @navigation_component = navigation_component
  @links = []
end

Instance Attribute Details

Returns the value of attribute links.



69
70
71
# File 'app/helpers/okonomi_ui_kit/components/navigation.rb', line 69

def links
  @links
end

Returns the value of attribute navigation_component.



69
70
71
# File 'app/helpers/okonomi_ui_kit/components/navigation.rb', line 69

def navigation_component
  @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



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)
  options = {
    exact: exact,
    class: style(:link, :base),
    active_class: style(:link, :active)
  }

  options[: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: options,
                style_helper: self
  end
end


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)
  navigation_component.style(*args)
end