Class: Pageflow::Page
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Pageflow::Page
- Defined in:
- app/models/pageflow/page.rb
Instance Attribute Summary collapse
-
#is_first ⇒ Object
Returns the value of attribute is_first.
Instance Method Summary collapse
- #configuration ⇒ Object
- #configuration=(value) ⇒ Object
- #copy_to(chapter) ⇒ Object
- #ensure_perma_id ⇒ Object
- #page_type ⇒ Object
- #thumbnail_file ⇒ Object
- #thumbnail_url(*args) ⇒ Object
- #title ⇒ Object
Instance Attribute Details
#is_first ⇒ Object
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
#configuration ⇒ Object
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. = 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_id ⇒ Object
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_type ⇒ Object
27 28 29 |
# File 'app/models/pageflow/page.rb', line 27 def page_type Pageflow.config.page_types.find_by_name!(template) end |
#thumbnail_file ⇒ Object
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 |
#title ⇒ Object
15 16 17 |
# File 'app/models/pageflow/page.rb', line 15 def title configuration['title'].presence || configuration['additional_title'] end |