Method: Sibu::PagesHelper#sections

Defined in:
app/helpers/sibu/pages_helper.rb

#sections(id, tag, html_opts = {}, &block) ⇒ Object



131
132
133
134
135
136
137
# File 'app/helpers/sibu/pages_helper.rb', line 131

def sections(id, tag, html_opts = {}, &block)
  (@sb_entity.find_or_init(id)["elements"].map.with_index do |elt, i|
    @sb_section = [id, elt["id"]]
    opts = action_name != 'show' ? html_opts.merge({"data-sb-id" => @sb_section.join('|'), "data-sb-repeat" => true, "data-sb-entity" => @sb_entity == @site ? 'site' : 'page'}) : html_opts
    (tag, capture(self, i, &block), opts)
  end).join('').html_safe
end