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.
25 26 27 28 29 30 |
# File 'app/components/kadmin/navbar/link.rb', line 25 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.
16 17 18 |
# File 'app/components/kadmin/navbar/link.rb', line 16 def css_classes @css_classes end |
#engine ⇒ Rails::Engine (readonly)
Returns only pass if you want to access engine routes.
19 20 21 |
# File 'app/components/kadmin/navbar/link.rb', line 19 def engine @engine end |
#path ⇒ String (readonly)
Returns path for the given link.
13 14 15 |
# File 'app/components/kadmin/navbar/link.rb', line 13 def path @path end |
#text ⇒ String (readonly)
Returns text of the link.
10 11 12 |
# File 'app/components/kadmin/navbar/link.rb', line 10 def text @text end |