Class: Kadmin::Navbar::Link::Presenter
- Defined in:
- app/components/kadmin/navbar/link.rb
Overview
Generates HTML for use in the main Kadmin layout to build the navigation sidebar
Instance Method Summary collapse
-
#generate(**_options) ⇒ ActiveSupport::SafeBuffer
Generates HTML to present the section.
Methods inherited from Presenter
Constructor Details
This class inherits a constructor from Kadmin::Presenter
Instance Method Details
#generate(**_options) ⇒ ActiveSupport::SafeBuffer
Generates HTML to present the section
36 37 38 39 40 41 42 |
# File 'app/components/kadmin/navbar/link.rb', line 36 def generate(**) css_classes = self.css_classes css_classes = self.css_classes.dup << 'active' if @view.controller.request.path == self.path contents = @view.link_to(self.text.to_s.html_safe, self.path) return %(<li class="#{css_classes.join(' ')}">#{contents}</li>).html_safe end |