Class: Page

Inherits:
Content
  • Object
show all
Includes:
ConfigManager
Defined in:
app/models/page.rb

Instance Attribute Summary

Attributes included from ContentBase

#just_changed_published_status

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ConfigManager

append_features, #canonicalize

Methods inherited from Content

#author=, #author_name, find_already_published, #rss_description, search_with, #short_url, #shorten_url, #whiteboard

Methods included from ContentBase

#default_text_filter, #excerpt_text, #generate_html, #html, #html_map, #html_postprocess, #html_preprocess, included, #really_send_notifications, #send_notification_to_user, #text_filter

Class Method Details

.default_orderObject



21
22
23
# File 'app/models/page.rb', line 21

def self.default_order
  "title ASC"
end

Instance Method Details



25
26
27
28
29
30
31
32
# File 'app/models/page.rb', line 25

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

#publish!Object



34
35
36
37
# File 'app/models/page.rb', line 34

def publish!
  self.state = "published"
  save!
end

#published?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'app/models/page.rb', line 39

def published?
  state == "published"
end


15
16
17
# File 'app/models/page.rb', line 15

def set_permalink
  self.name = title.to_permalink if name.blank?
end