Class: UzuUzu::Controller::Page

Inherits:
Object
  • Object
show all
Defined in:
lib/uzuuzu-cms/controller/page.rb

Instance Method Summary collapse

Instance Method Details

#beforeObject



13
14
15
# File 'lib/uzuuzu-cms/controller/page.rb', line 13

def before
  redirect(rf(Initialize)) unless info.initialize?
end

#id(page_id) ⇒ Object



37
38
39
40
41
42
43
# File 'lib/uzuuzu-cms/controller/page.rb', line 37

def id(page_id)
  page = ::UzuUzu::Page.first(:id => page_id)
  if page.nil?
    not_found
  end
  respond(render_page(page))
end

#index(*breadcrumbs) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/uzuuzu-cms/controller/page.rb', line 20

def index(*breadcrumbs)
  if breadcrumbs.blank?
    not_found
  end
  page = ::UzuUzu::Page.first(:name => breadcrumbs.shift)
  while !breadcrumbs.blank?
    page = page.childs(:name => breadcrumbs.shift) unless page.nil?
  end
  if page.nil?
    not_found
  end
  respond(page.render(self))
end

#top_pageObject



48
49
50
51
52
53
54
# File 'lib/uzuuzu-cms/controller/page.rb', line 48

def top_page
  page = info.top_page
  if page.nil?
    not_found
  end
  respond(render_page(page))
end