Module: ComponentParty::ActionView::Renderer

Defined in:
lib/component_party/action_view/renderer.rb

Instance Method Summary collapse

Instance Method Details

#normalize_component_path!(_context, options) ⇒ void

An example of options argumento passed by Rails are { :prefixes=>["devise/sessions", "devise", "application"], :template=>"new", :layout=> a Proc }



31
32
33
34
35
36
37
38
39
# File 'lib/component_party/action_view/renderer.rb', line 31

def normalize_component_path!(_context, options)
  if options[:component] == true
    options[:component] = Pathname.new(options[:prefixes].first.to_s).join(options[:template]).to_s
    options[:prefixes] = [ComponentParty.configuration.component_folder_for_actions]
  else
    options[:component]
    options[:prefixes] = []
  end
end

#normalize_data_for_component_rendering!(context, options) ⇒ void



20
21
22
23
# File 'lib/component_party/action_view/renderer.rb', line 20

def normalize_data_for_component_rendering!(context, options)
  normalize_component_path!(context, options)
  context.instance_variable_set('@current_component_path', options[:component])
end