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.



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

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



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

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



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

def id
  @id
end

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

Returns:



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

def links
  @links
end

#textString (readonly)

Returns title displayed for the section (or HTML).

Returns:

  • (String)

    title displayed for the section (or HTML)



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

def text
  @text
end