class UzuUzu::Page
Public Class Methods
page_id_tree(parent_page_id=nil)
click to toggle source
# File lib/uzuuzu-cms/model/page.rb, line 81 def self.page_id_tree(parent_page_id=nil) self.tree(:id, parent_page_id) end
page_name_tree(parent_page_id=nil)
click to toggle source
# File lib/uzuuzu-cms/model/page.rb, line 88 def self.page_name_tree(parent_page_id=nil) self.tree(:name, parent_page_id) end
tree(column=nil, parent_page_id=nil)
click to toggle source
# File lib/uzuuzu-cms/model/page.rb, line 95 def self.tree(column=nil, parent_page_id=nil) ary = self.all(:parent_page_id => parent_page_id) return nil if ary.nil? or ary.length <= 0 tree_map = {} ary.each do |record| child_tree = self.tree(column, record.id) if colomn key = record.send(column) else key = self end tree_map[key] = self.tree(column, record.id) end tree_map end
Public Instance Methods
contents_render(options={}, locals={})
click to toggle source
# File lib/uzuuzu-cms/model/page.rb, line 150 def contents_render(options={}, locals={}) unless @contents_body @contents_body = contents.map do |content| content.render(options, locals) end.join("\n") end @contents_body end
css_urls()
click to toggle source
# File lib/uzuuzu-cms/model/page.rb, line 118 def css_urls value = [] self.csses.each do |css| value << css end value += self.parent.abs_csses if self.parent value += self.layout_fix.csses if self.layout_fix value += ::UzuUzu.info.csses unless self.parent self.contents.each do |content| value += content.csses end value.map do |css| css.url end end
js_urls()
click to toggle source
# File lib/uzuuzu-cms/model/page.rb, line 134 def js_urls value = [] self.javascripts.each do |js| value << js end value += self.parent.abs_javascripts if self.parent value += self.layout_fix.javascripts if self.layout_fix value += ::UzuUzu.info.javascripts unless self.parent self.contents.each do |content| value += content.javascripts end value.map do |js| js.url end end
layout_fix()
click to toggle source
# File lib/uzuuzu-cms/model/page.rb, line 111 def layout_fix value = self.layout value ||= self.parent.abs_layout if self.parent value ||= ::UzuUzu.info.layout value end
page_title()
click to toggle source
# File lib/uzuuzu-cms/model/page.rb, line 159 def page_title "#{self.title} - #{::UzuUzu.info.title}" end
render(options={}, locals={})
click to toggle source
# File lib/uzuuzu-cms/model/page.rb, line 163 def render(options={}, locals={}) self.layout_fix.render(options, locals) end
reverse_look_up(column=nil)
click to toggle source
# File lib/uzuuzu-cms/model/page.rb, line 56 def reverse_look_up(column=nil) if column key = self.send(column) else key = self end child_tree = parent.reverse_look_up(self) if parent {key => child_tree} end