Class: Blacklight::HiddenSearchStateComponent
- Inherits:
 - 
      Component
      
        
- Object
 - ViewComponent::Base
 - Component
 - Blacklight::HiddenSearchStateComponent
 
 
- Defined in:
 - app/components/blacklight/hidden_search_state_component.rb
 
Overview
Writes out zero or more <input type=“hidden”> elements, completely representing a hash passed in using Rails-style request parameters for hashes nested with arrays and other hashes.
Constant Summary
Constants inherited from Component
Instance Method Summary collapse
- #call ⇒ Object
 - 
  
    
      #initialize(params:)  ⇒ HiddenSearchStateComponent 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of HiddenSearchStateComponent.
 
Methods inherited from Component
Constructor Details
#initialize(params:) ⇒ HiddenSearchStateComponent
Returns a new instance of HiddenSearchStateComponent.
      9 10 11  | 
    
      # File 'app/components/blacklight/hidden_search_state_component.rb', line 9 def initialize(params:) @params = params.except(:page, :utf8) end  | 
  
Instance Method Details
#call ⇒ Object
      13 14 15 16 17 18 19 20 21 22 23  | 
    
      # File 'app/components/blacklight/hidden_search_state_component.rb', line 13 def call hidden_fields = [] flatten_hash(@params).each do |name, value| value = Array.wrap(value) value.each do |v| hidden_fields << hidden_field_tag(name, v.to_s, id: nil) end end safe_join(hidden_fields, "\n") end  |