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
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_classes ⇒ Array<String> (readonly)
Returns list of additional CSS classes
20 21 22 |
# File 'app/components/kadmin/navbar/section.rb', line 20 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
11 12 13 |
# File 'app/components/kadmin/navbar/section.rb', line 11 def id @id end |
#links ⇒ Hash<String, Kadmin::Navbar::Link> (readonly)
Returns links in the section, with keys being the link's path
17 18 19 |
# File 'app/components/kadmin/navbar/section.rb', line 17 def links @links end |
#text ⇒ String (readonly)
Returns title displayed for the section (or HTML)
14 15 16 |
# File 'app/components/kadmin/navbar/section.rb', line 14 def text @text end |