Class: Kadmin::Navbar::Section::Presenter
- Defined in:
 - app/components/kadmin/navbar/section.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 a list item with the section text as header, and a sub-list for the links.
 
Methods inherited from Presenter
Constructor Details
This class inherits a constructor from Kadmin::Presenter
Instance Method Details
#generate(**_options) ⇒ ActiveSupport::SafeBuffer
Generates a list item with the section text as header, and a sub-list for the links
      33 34 35 36 37 38 39 40 41 42  | 
    
      # File 'app/components/kadmin/navbar/section.rb', line 33 def generate(**) current_section_id = @view.controller.class.try(:navbar_section).to_s section_links = ActiveSupport::SafeBuffer.new css_classes = self.css_classes.dup css_classes = css_classes << 'active open' if !current_section_id.nil? && current_section_id == self.id self.links.each { |link| section_links << link.present(@view).render } return "<li class='#{css_classes.join(' ')}'><a>#{self.text} <i class='fa arrow'></i></a><ul>#{section_links}</ul></li>".html_safe end  |