module PageHelper

Public Instance Methods

confirm_destroy_message(page) click to toggle source
# File app/helpers/page_helper.rb, line 16
def confirm_destroy_message(page)
  msg = "Really delete"
  if page.title.blank?
    msg = "#{msg} page?"
  else
    msg = "#{msg} #{page.title}?"
  end
  
  if page.children.any?
    msg = "#{msg} And delete all of its children?"
  end
  
  msg
end
render_page(path, options = {}) click to toggle source

Look for a matching Page, but if none, fall back on Rails’ template rendering

# File app/helpers/page_helper.rb, line 3
def render_page(path, options = {})
  page = Page.find_by_path(path)
  if page
    render({ :inline => page.body }.merge(options))
  else
    render({ :partial => path }.merge(options))
  end
end
updated(page) click to toggle source
# File app/helpers/page_helper.rb, line 12
def updated(page)
  "<span title=\"Created on #{page.created_at}\">#{time_ago_in_words(page.updated_at, true)} ago</span> by #{page.updated_by.try :name}".html_safe
end