Class: Page

Inherits:
Section
  • Object
show all
Defined in:
app/models/page.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Section

#nav_children, #owner, #owners, #published=, register_type, #root_section?, #state, #tag_counts, #to_param, #type

Methods included from Adva::HasPermalink

included

Methods included from Adva::HasOptions

included

Class Method Details

.content_typesObject



9
10
11
# File 'app/models/page.rb', line 9

def content_types
  %w(Article Link)
end

Instance Method Details

#published?(parents = false) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
30
31
32
33
34
35
# File 'app/models/page.rb', line 27

def published?(parents = false)
  if single_article_mode
    # FIXME: duplication with Section class
    return true if self == site.sections.root
    return false if parents && !ancestors.reject(&:published?).empty?
    return contents.first ? contents.first.published? : false
  end
  super
end

#published_atObject



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

def published_at
  return contents.first.published_at if single_article_mode && contents.first
  super
end

#published_at=(published_at) ⇒ Object



19
20
21
22
23
24
25
# File 'app/models/page.rb', line 19

def published_at=(published_at)
  if single_article_mode && contents.first
    contents.first.update_attribute(:published_at, published_at)
  else
    super
  end
end