Module | Cms::PageHelper |
In: |
app/helpers/cms/page_helper.rb
|
# File app/helpers/cms/page_helper.rb, line 26 26: def cms_toolbar 27: instance_variable_get("@content_for_layout") 28: end
# File app/helpers/cms/page_helper.rb, line 7 7: def container(name) 8: content = instance_variable_get("@content_for_#{name}") 9: if logged_in? && @mode == "edit" 10: render :partial => 'cms/pages/edit_container', :locals => {:name => name, :content => content} 11: else 12: content 13: end 14: end
# File app/helpers/cms/page_helper.rb, line 16 16: def container_has_block?(name, &block) 17: has_block = (@mode == "edit") || current_page.connectable_count_for_container(name) > 0 18: logger.info "mode = #{@mode}, has_block = #{has_block}" 19: if block_given? 20: concat(capture(&block)) if has_block 21: else 22: has_block 23: end 24: end
# File app/helpers/cms/page_helper.rb, line 30 30: def render_breadcrumbs(options={}) 31: start = options[:from_top] || 0 32: show_parent = options[:show_parent].nil? ? false : options[:show_parent] 33: ancestors = current_page.ancestors 34: items = [] 35: ancestors[start..ancestors.size].each_with_index do |sec,i| 36: items << content_tag(:li, 37: link_to(h(sec.name), sec.actual_path), 38: (i == 0 ? {:class => "first"} : {})) 39: end 40: if !show_parent && current_page.section.path == current_page.path 41: items[items.size-1] = content_tag(:li, h(current_page.section.name)) 42: else 43: items << content_tag(:li, h(current_page.page_title)) 44: end 45: content_tag(:ul, "\n #{items.join("\n ")}\n", :class => "breadcrumbs") 46: end
# File app/helpers/cms/page_helper.rb, line 48 48: def render_portlet(name) 49: portlets = Portlet.all(:conditions => ["name = ?", name.to_s]) 50: if portlets.size > 1 51: @mode == "edit" ? "ERROR: Multiple Portlets with name '#{name}'" : nil 52: elsif portlets.empty? 53: @mode == "edit" ? "ERROR: No Portlet with name '#{name}'" : nil 54: else 55: render_connectable(portlets.first) 56: end 57: end