Sha256: 8ba58b573520309fcd14c1ea15742049b27dc22985bbad010010ee66482c0897
Contents?: true
Size: 1.34 KB
Versions: 3
Compression:
Stored size: 1.34 KB
Contents
<% show_empty_sections ||= false remove_automatic_sections ||= false hide_sections ||= [] sections = [ {:yield => :body_content_title, :fallback => page_title, :id => 'body_content_page_title', :title => true}, {:yield => :body_content_left, :fallback => @page.present? ? @page[Page.default_parts.first.to_sym] : nil}, {:yield => :body_content_right, :fallback => @page.present? ? @page[Page.default_parts.second.to_sym] : nil} ].reject {|section| hide_sections.include?(section[:yield]) } css = [] sections.each do |section| dom_id = (section[:id] ||= section[:yield].to_s) section[:html] = (yield(section[:yield])) if section[:html].blank? and !show_empty_sections and !remove_automatic_sections and section.keys.include?(:fallback) section[:html] = section[:fallback] end unless section[:html].blank? unless section[:title] section[:html] = "<div class='clearfix' id='#{dom_id}'>#{section[:html]}</div>".html_safe else section[:html] = "<h1 id='#{dom_id}'>#{section[:html]}</h1>".html_safe end else css << "no_#{dom_id}" end end -%> <div id='body_content' class='clearfix<%= " #{css.join(' ')}" if css.any? %>'> <%= sections.collect {|s| s[:html] }.join("\n") %> </div> <%= render :partial => '/shared/draft_page_message' unless @page.nil? or @page.live? -%>
Version data entries
3 entries across 3 versions & 1 rubygems