Class: Kadmin::Navbar::Section
- Inherits:
-
Object
- Object
- Kadmin::Navbar::Section
- 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
-
#css_classes ⇒ Array<String>
readonly
List of additional CSS classes.
-
#id ⇒ Object
readonly
Unique ID for the section; for a gem, it is recommended to use the top level namespace.
-
#links ⇒ Hash<String, Kadmin::Navbar::Link>
readonly
Links in the section, with keys being the link’s path.
-
#text ⇒ String
readonly
Title displayed for the section (or HTML).
Instance Method Summary collapse
-
#initialize(id:, text:, links:, css_classes: []) ⇒ Section
constructor
A new instance of Section.
Methods included from Presentable
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_classes ⇒ Array<String> (readonly)
Returns list of additional CSS classes.
21 22 23 |
# File 'app/components/kadmin/navbar/section.rb', line 21 def css_classes @css_classes end |
#id ⇒ Object (readonly)
Returns 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 |
#links ⇒ Hash<String, Kadmin::Navbar::Link> (readonly)
Returns links in the section, with keys being the link’s path.
18 19 20 |
# File 'app/components/kadmin/navbar/section.rb', line 18 def links @links end |
#text ⇒ String (readonly)
Returns title displayed for the section (or HTML).
15 16 17 |
# File 'app/components/kadmin/navbar/section.rb', line 15 def text @text end |