Class: Pageflow::Page

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/pageflow/page.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#is_firstObject

Returns the value of attribute is_first


5
6
7
# File 'app/models/pageflow/page.rb', line 5

def is_first
  @is_first
end

Instance Method Details

#configurationObject


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

def configuration
  super || {}
end

#configuration=(value) ⇒ Object


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

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

#copy_to(chapter) ⇒ Object


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

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

#ensure_perma_idObject


44
45
46
# File 'app/models/pageflow/page.rb', line 44

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

#page_typeObject


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

def page_type
  Pageflow.config.lookup_page_type(template)
end

#thumbnail_fileObject


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

def thumbnail_file
  ThumbnailFileResolver.new(page_type.thumbnail_candidates, configuration).find
end

#thumbnail_url(*args) ⇒ Object


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

def thumbnail_url(*args)
  thumbnail_file.thumbnail_url(*args)
end

#titleObject


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

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