Module: Cmsimple::RegionsHelper
- Defined in:
- app/helpers/cmsimple/regions_helper.rb
Instance Method Summary collapse
- #region_content(region) ⇒ Object
- #render_region(region_name, options = {}, &block) ⇒ Object
- #render_snippet(snippet) ⇒ Object
- #resource_regions ⇒ Object
Instance Method Details
#region_content(region) ⇒ Object
8 9 10 11 12 13 |
# File 'app/helpers/cmsimple/regions_helper.rb', line 8 def region_content(region) region.render_snippets do |snippet| render_snippet(snippet) end raw region end |
#render_region(region_name, options = {}, &block) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/helpers/cmsimple/regions_helper.rb', line 15 def render_region(region_name, ={}, &block) content = region_content(resource_regions.send(region_name)) if content.blank? && block_given? content = capture(&block) end if [:tag] = [:html].presence || {} = .merge(:id => region_name, :'data-mercury' => [:region_type] || 'full') content = content_tag [:tag], content, end raw content end |
#render_snippet(snippet) ⇒ Object
32 33 34 35 |
# File 'app/helpers/cmsimple/regions_helper.rb', line 32 def render_snippet(snippet) return '' unless snippet.name.present? render_cell snippet.name, :display, snippet end |
#resource_regions ⇒ Object
4 5 6 |
# File 'app/helpers/cmsimple/regions_helper.rb', line 4 def resource_regions @page.regions end |