Sha256: 7d1b07d46513546fce96cac6f1232333c485a2ddb6f2158b209c00be73403375

Contents?: true

Size: 933 Bytes

Versions: 4

Compression:

Stored size: 933 Bytes

Contents

class Page < Content
  belongs_to :user
  validates_presence_of :name, :title, :body
  validates_uniqueness_of :name

  content_fields :body

  def self.default_order
    'name ASC'
  end

  def self.search_paginate(search_hash, paginate_hash)
    list_function = ["Page"] + function_search_no_draft(search_hash)
    paginate_hash[:order] = 'title ASC'
    list_function << "paginate(paginate_hash)"
    eval(list_function.join('.'))
  end

  def permalink_url(anchor=nil, only_path=false)
    blog.url_for(
      :controller => '/articles',
      :action => 'view_page',
      :name => name, 
      :anchor => anchor,
      :only_path => only_path
    )
  end

  def self.find_by_published_at
    super(:created_at)
  end


  def edit_url
    blog.url_for(:controller => "/admin/pages", :action =>"edit", :id => id)
  end
  
  def delete_url
    blog.url_for(:controller => "/admin/pages", :action =>"destroy", :id => id)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
typo-5.5 app/models/page.rb
typo-5.4.4 app/models/page.rb
typo-5.4.3 app/models/page.rb
typo-5.4.2 app/models/page.rb