Module: Admin::RegionsHelper
- Included in:
- ApplicationHelper
- Defined in:
- app/helpers/admin/regions_helper.rb
Instance Method Summary collapse
Instance Method Details
#lazy_initialize_region_set ⇒ Object
23 24 25 26 27 28 29 |
# File 'app/helpers/admin/regions_helper.rb', line 23 def lazy_initialize_region_set unless @region_set @controller_name ||= @_controller.controller_name @template_name ||= @_controller.template_name @region_set = admin.send(@controller_name).send(@template_name) end end |
#render_region(region, options = {}, &block) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/helpers/admin/regions_helper.rb', line 2 def render_region(region, = {}, &block) lazy_initialize_region_set default_partials = TrustyCms::AdminUI::RegionPartials.new(self) if block_given? block.call(default_partials) ([:locals] ||= {}).merge!(defaults: default_partials) end output = @region_set[region].compact.map do |partial| begin render .merge(partial: partial) rescue ::ActionView::MissingTemplate # couldn't find template default_partials[partial] rescue ::ActionView::TemplateError => e # error in template raise e end end.join.html_safe # comment out all the html logging # Rails.logger.error(output) block_given? ? concat(output) : output end |