Sha256: 0a2cc75c050ea6031685994d7a17255b9519cfc2d5921b5c1b91bcb531b26448
Contents?: true
Size: 1.17 KB
Versions: 8
Compression:
Stored size: 1.17 KB
Contents
module Voluntary module Helpers module Product def render_product_specific_presenter_if_available(resource, partial_path, method, options = {}) if @presenter.respond_to?(method) @step_presenter = @presenter.send(method) else @step_presenter = nil end render_product_specific_partial_if_available(resource, "#{partial_path}/#{method}", options) end def render_product_specific_partial_if_available(resource, partial_path, options = {}) path = nil partial_path = partial_path.split('/') file_name = partial_path.pop partial_path = partial_path.join('/') if resource && resource.respond_to?(:product) && resource.product path = "products/types/#{directory_for_resource(resource.product)}/#{partial_path}" if File.exist?("#{Rails.root.to_s}/app/views/#{path}/_#{file_name}.html.erb") path = [path, file_name].join('/') else path = nil end end path = [partial_path, file_name].join('/') if path.blank? render path, options end end end end
Version data entries
8 entries across 8 versions & 1 rubygems