Sha256: 44dd04bb11c0afbaa76b21233010c5dbcd8a7643aebfdaecda950f2cec8e856d
Contents?: true
Size: 993 Bytes
Versions: 3
Compression:
Stored size: 993 Bytes
Contents
module RegionHelper def render_region(name, classes="", &block) @block_content = (block_given? ? block : @blocks.select{ |b| b.where_to_show == name }) unless @block_content.blank? build_regions(name, classes, (@block_content.class == Proc ? @block_content : render_block_wrappers)) end end def build_regions(name, classes, innards) @regions = region_wrapper("#{name}-blocks", "container-twelve", innards) @regions = region_wrapper("#{name}-blocks-container", "clearfix", @regions) @regions = region_wrapper("#{name}-blocks-wrapper", "cleafix #{classes}", @regions) @regions end def region_wrapper(id, html_class, innards="") content_tag :div, :id => id, :class => html_class do innards.class == Proc ? innards.call : raw(innards) end end def render_block_wrappers @block_content.map! do |block| render(:partial => "dust/blocks/block", :locals => {:block => block}) end @block_content.join("\n") end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dust-cms-0.0.07 | app/helpers/region_helper.rb |
dust-cms-0.0.06 | app/helpers/region_helper.rb |
dust-cms-0.0.05 | app/helpers/region_helper.rb |