Class: Kadmin::Navbar::Link
- Inherits:
-
Object
- Object
- Kadmin::Navbar::Link
- Includes:
- Presentable
- Defined in:
- app/components/kadmin/navbar/link.rb
Overview
A navigation link for use with the navbar items
Defined Under Namespace
Classes: Presenter
Instance Attribute Summary collapse
-
#css_classes ⇒ Array<String>
readonly
List of additional CSS classes.
-
#engine ⇒ Rails::Engine
readonly
Only pass if you want to access engine routes.
-
#path ⇒ String
readonly
Path for the given link.
-
#text ⇒ String
readonly
Text of the link.
Instance Method Summary collapse
-
#initialize(text:, path:, engine: nil, css_classes: []) ⇒ Rails::Application
constructor
App application providing URL helpers; if you’re in an engine, pass your engine.
Methods included from Presentable
Constructor Details
#initialize(text:, path:, engine: nil, css_classes: []) ⇒ Rails::Application
Returns app application providing URL helpers; if you’re in an engine, pass your engine.
26 27 28 29 30 31 |
# File 'app/components/kadmin/navbar/link.rb', line 26 def initialize(text:, path:, engine: nil, css_classes: []) @text = text.freeze @path = path.freeze @css_classes = Array.wrap(css_classes).dup.freeze @engine = engine || Rails.application end |
Instance Attribute Details
#css_classes ⇒ Array<String> (readonly)
Returns list of additional CSS classes.
17 18 19 |
# File 'app/components/kadmin/navbar/link.rb', line 17 def css_classes @css_classes end |
#engine ⇒ Rails::Engine (readonly)
Returns only pass if you want to access engine routes.
20 21 22 |
# File 'app/components/kadmin/navbar/link.rb', line 20 def engine @engine end |
#path ⇒ String (readonly)
Returns path for the given link.
14 15 16 |
# File 'app/components/kadmin/navbar/link.rb', line 14 def path @path end |
#text ⇒ String (readonly)
Returns text of the link.
11 12 13 |
# File 'app/components/kadmin/navbar/link.rb', line 11 def text @text end |