Sha256: 34a49b875422fa1c3e779c773400da03c61698d8b5ef2b7a46dbab1540e7c34a
Contents?: true
Size: 1.86 KB
Versions: 3
Compression:
Stored size: 1.86 KB
Contents
module Cms module PageHelper def current_page @page end def container(name) content = instance_variable_get("@content_for_#{name}") if logged_in? && @mode == "edit" render :partial => 'cms/pages/edit_container', :locals => {:name => name, :content => content} else content end end def container_has_block?(name, &block) has_block = (@mode == "edit") || current_page.connectable_count_for_container(name) > 0 logger.info "mode = #{@mode}, has_block = #{has_block}" if block_given? concat(capture(&block)) if has_block else has_block end end def cms_toolbar instance_variable_get("@content_for_layout") end def render_breadcrumbs(options={}) start = options[:from_top] || 0 show_parent = options[:show_parent].nil? ? false : options[:show_parent] ancestors = current_page.ancestors items = [] ancestors[start..ancestors.size].each_with_index do |sec,i| items << content_tag(:li, link_to(h(sec.name), sec.actual_path), (i == 0 ? {:class => "first"} : {})) end if !show_parent && current_page.section.path == current_page.path items[items.size-1] = content_tag(:li, h(current_page.section.name)) else items << content_tag(:li, h(current_page.page_title)) end content_tag(:ul, "\n #{items.join("\n ")}\n", :class => "breadcrumbs") end def render_portlet(name) portlets = Portlet.all(:conditions => ["name = ?", name.to_s]) if portlets.size > 1 @mode == "edit" ? "ERROR: Multiple Portlets with name '#{name}'" : nil elsif portlets.empty? @mode == "edit" ? "ERROR: No Portlet with name '#{name}'" : nil else render_connectable(portlets.first) end end end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
nate-browsercms-3.0.210 | app/helpers/cms/page_helper.rb |
nate-browsercms-3.0.211 | app/helpers/cms/page_helper.rb |
browsercms-3.0.0 | app/helpers/cms/page_helper.rb |