Module: Voluntary::ProductHelper
- Defined in:
- app/helpers/voluntary/product_helper.rb
Instance Method Summary collapse
- #render_product_specific_partial_if_available(resource, partial_path, options = {}) ⇒ Object
- #render_product_specific_presenter_if_available(resource, partial_path, method, options = {}) ⇒ Object
Instance Method Details
#render_product_specific_partial_if_available(resource, partial_path, options = {}) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/helpers/voluntary/product_helper.rb', line 13 def render_product_specific_partial_if_available(resource, partial_path, = {}) 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}" path = [path, file_name].join('/') begin return render(path, ) rescue ActionView::MissingTemplate path = nil end end path = [partial_path, file_name].join('/') if path.blank? render path, end |
#render_product_specific_presenter_if_available(resource, partial_path, method, options = {}) ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'app/helpers/voluntary/product_helper.rb', line 3 def render_product_specific_presenter_if_available(resource, partial_path, method, = {}) 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}", ) end |