Class: Pageflow::PublishedEntry
- Inherits:
-
Object
- Object
- Pageflow::PublishedEntry
- Extended by:
- ActiveModel::Naming
- Includes:
- ActiveModel::Conversion
- Defined in:
- app/models/pageflow/published_entry.rb
Instance Attribute Summary collapse
-
#entry ⇒ Object
readonly
Returns the value of attribute entry.
-
#revision ⇒ Object
readonly
Returns the value of attribute revision.
Class Method Summary collapse
Instance Method Summary collapse
- #cache_key ⇒ Object
- #home_button ⇒ Object
-
#initialize(entry, revision = nil) ⇒ PublishedEntry
constructor
A new instance of PublishedEntry.
- #stylesheet_cache_key ⇒ Object
- #stylesheet_model ⇒ Object
- #thumbnail_url(*args) ⇒ Object
Constructor Details
#initialize(entry, revision = nil) ⇒ PublishedEntry
16 17 18 19 20 |
# File 'app/models/pageflow/published_entry.rb', line 16 def initialize(entry, revision = nil) @entry = entry @revision = revision || entry.published_revision @custom_revision = !!revision end |
Instance Attribute Details
#entry ⇒ Object (readonly)
Returns the value of attribute entry.
6 7 8 |
# File 'app/models/pageflow/published_entry.rb', line 6 def entry @entry end |
#revision ⇒ Object (readonly)
Returns the value of attribute revision.
6 7 8 |
# File 'app/models/pageflow/published_entry.rb', line 6 def revision @revision end |
Class Method Details
.find(id, scope = Entry) ⇒ Object
34 35 36 |
# File 'app/models/pageflow/published_entry.rb', line 34 def self.find(id, scope = Entry) PublishedEntry.new(scope.published.find(id)) end |
Instance Method Details
#cache_key ⇒ Object
38 39 40 |
# File 'app/models/pageflow/published_entry.rb', line 38 def cache_key "#{self.class.model_name.cache_key}/#{entry.cache_key}-#{revision.cache_key}" end |
#home_button ⇒ Object
42 43 44 |
# File 'app/models/pageflow/published_entry.rb', line 42 def HomeButton.new(revision, theming) end |
#stylesheet_cache_key ⇒ Object
26 27 28 |
# File 'app/models/pageflow/published_entry.rb', line 26 def stylesheet_cache_key revision.cache_key end |
#stylesheet_model ⇒ Object
22 23 24 |
# File 'app/models/pageflow/published_entry.rb', line 22 def stylesheet_model custom_revision? ? revision : entry end |
#thumbnail_url(*args) ⇒ Object
30 31 32 |
# File 'app/models/pageflow/published_entry.rb', line 30 def thumbnail_url(*args) pages.first.try(:thumbnail_url, *args) || ImageFile.new..url(*args) end |