Sha256: c8126e586483aefdb0e4f5e28273edbd00c167110ad528f7a8eec7eeab57f191
Contents?: true
Size: 990 Bytes
Versions: 6
Compression:
Stored size: 990 Bytes
Contents
module Admin::RegionsHelper def render_region(region, options={}, &block) lazy_initialize_region_set default_partials = Radiant::AdminUI::RegionPartials.new(@template) if block_given? junk = capture(default_partials, &block) (options[:locals] ||= {}).merge!(:defaults => default_partials) end output = @region_set[region].compact.map do |partial| begin render options.merge(:partial => partial) rescue ::ActionView::TemplateError => e # error in template raise e rescue ::ActionView::ActionViewError # couldn't find template default_partials[partial] end end.join block_given? ? concat(output, block.binding) : output end def lazy_initialize_region_set unless @region_set @controller_name ||= @controller.controller_name @template_name ||= File.basename(@first_render).split(".").last @region_set = admin.send(@controller_name).send(@template_name) end end end
Version data entries
6 entries across 6 versions & 1 rubygems