Class: Pageflow::Page

Inherits:
ApplicationRecord show all
Includes:
SerializedConfiguration
Defined in:
app/models/pageflow/page.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SerializedConfiguration

#configuration

Instance Attribute Details

#is_firstObject

Returns the value of attribute is_first.



7
8
9
# File 'app/models/pageflow/page.rb', line 7

def is_first
  @is_first
end

Instance Method Details

#configuration=(value) ⇒ Object



23
24
25
26
# File 'app/models/pageflow/page.rb', line 23

def configuration=(value)
  self.display_in_navigation = value['display_in_navigation']
  super
end

#copy_to(chapter) ⇒ Object



28
29
30
# File 'app/models/pageflow/page.rb', line 28

def copy_to(chapter)
  chapter.pages << dup
end

#ensure_perma_idObject



32
33
34
# File 'app/models/pageflow/page.rb', line 32

def ensure_perma_id
  self.perma_id ||= (Page.maximum(:perma_id) || 0) + 1
end

#page_typeObject



19
20
21
# File 'app/models/pageflow/page.rb', line 19

def page_type
  Pageflow.config.page_types.find_by_name!(template)
end

#titleObject



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

def title
  configuration['title'].presence || configuration['additional_title']
end