Class: Blacklight::Response::ViewTypeComponent
- Inherits:
 - 
      Component
      
        
- Object
 - ViewComponent::Base
 - Component
 - Blacklight::Response::ViewTypeComponent
 
 
- Defined in:
 - app/components/blacklight/response/view_type_component.rb
 
Overview
Render spellcheck results for a search query
Constant Summary
Constants inherited from Component
Instance Method Summary collapse
- #before_render ⇒ Object
 - 
  
    
      #initialize(response:, search_state:, views: {}, selected: nil)  ⇒ ViewTypeComponent 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of ViewTypeComponent.
 - #render? ⇒ Boolean
 
Methods inherited from Component
Constructor Details
#initialize(response:, search_state:, views: {}, selected: nil) ⇒ ViewTypeComponent
Returns a new instance of ViewTypeComponent.
      10 11 12 13 14 15  | 
    
      # File 'app/components/blacklight/response/view_type_component.rb', line 10 def initialize(response:, search_state:, views: {}, selected: nil) @response = response @views = views @search_state = search_state @selected = selected end  | 
  
Instance Method Details
#before_render ⇒ Object
      17 18 19 20 21 22 23  | 
    
      # File 'app/components/blacklight/response/view_type_component.rb', line 17 def before_render return if views.any? @views.each do |key, config| with_view(key: key, view: config, selected: @selected == key, search_state: @search_state) end end  | 
  
#render? ⇒ Boolean
      25 26 27  | 
    
      # File 'app/components/blacklight/response/view_type_component.rb', line 25 def render? views.many? && !@response.empty? end  |