Sha256: 95cf5d05a44daa962dcaacdfc0500424111668189ecde9648aee21dd72466783
Contents?: true
Size: 934 Bytes
Versions: 1
Compression:
Stored size: 934 Bytes
Contents
module Admin::RegionsHelper def render_region(region, options={}, &block) lazy_initialize_region_set default_partials = TrustyCms::AdminUI::RegionPartials.new(self) if block_given? block.call(default_partials) (options[:locals] ||= {}).merge!(:defaults => default_partials) end output = @region_set[region].compact.map do |partial| begin render options.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 block_given? ? concat(output) : output end 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 end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
trusty-cms-1.0.0 | app/helpers/admin/regions_helper.rb |