Class: Kadmin::Navbar::Section

Inherits:
Object
  • Object
show all
Includes:
Presentable
Defined in:
app/components/kadmin/navbar/section.rb

Overview

A navigation section is a way of grouping several navigation links

Defined Under Namespace

Classes: Presenter

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Presentable

#present

Constructor Details

#initialize(id:, text:, links:, css_classes: []) ⇒ Section

Returns a new instance of Section



22
23
24
25
26
27
# File 'app/components/kadmin/navbar/section.rb', line 22

def initialize(id:, text:, links:, css_classes: [])
  @id = id.to_s.freeze
  @text = text.freeze
  @links = links.freeze
  @css_classes = Array.wrap(css_classes).dup.freeze
end

Instance Attribute Details

#css_classesArray<String> (readonly)

Returns list of additional CSS classes

Returns:

  • (Array<String>)

    list of additional CSS classes



20
21
22
# File 'app/components/kadmin/navbar/section.rb', line 20

def css_classes
  @css_classes
end

#idObject (readonly)

Returns unique ID for the section; for a gem, it is recommended to use the top level namespace

Returns:

  • (Object)

    unique ID for the section; for a gem, it is recommended to use the top level namespace



11
12
13
# File 'app/components/kadmin/navbar/section.rb', line 11

def id
  @id
end

Returns links in the section, with keys being the link's path

Returns:



17
18
19
# File 'app/components/kadmin/navbar/section.rb', line 17

def links
  @links
end

#textString (readonly)

Returns title displayed for the section (or HTML)

Returns:

  • (String)

    title displayed for the section (or HTML)



14
15
16
# File 'app/components/kadmin/navbar/section.rb', line 14

def text
  @text
end