Module: Decidim::ControllerHelpers
- Included in:
 - SearchesController
 
- Defined in:
 - lib/decidim/controller_helpers.rb
 
Class Method Summary collapse
Instance Method Summary collapse
- #expose(presentation_data) ⇒ Object
 - #present(presenter, options = {}) ⇒ Object
 - #presenter(presenter_type = :template) ⇒ Object
 
Class Method Details
.included(base_class) ⇒ Object
      10 11 12  | 
    
      # File 'lib/decidim/controller_helpers.rb', line 10 def self.included(base_class) base_class.helper_method(:presenter) end  | 
  
Instance Method Details
#expose(presentation_data) ⇒ Object
      25 26 27 28 29 30 31 32 33  | 
    
      # File 'lib/decidim/controller_helpers.rb', line 25 def expose(presentation_data) presentation_data.each do |attribute, value| if presenter.respond_to?("#{attribute}=") presenter.public_send("#{attribute}=", value) else instance_variable_set("@#{attribute}", value) end end end  | 
  
#present(presenter, options = {}) ⇒ Object
      14 15 16 17 18 19  | 
    
      # File 'lib/decidim/controller_helpers.rb', line 14 def present(presenter, = {}) presenter_type = .fetch(:for, :template) presenter.attach_controller(self) rectify_presenters[presenter_type] = presenter end  | 
  
#presenter(presenter_type = :template) ⇒ Object
      21 22 23  | 
    
      # File 'lib/decidim/controller_helpers.rb', line 21 def presenter(presenter_type = :template) rectify_presenters[presenter_type] end  |