Class: Pageflow::EntryAtRevision

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Conversion
Defined in:
app/models/pageflow/entry_at_revision.rb

Overview

A simplified view of an entry at a given revision. Hides the revision concept and makes revision attributes available along with entry attributes.

Direct Known Subclasses

DraftEntry, PublishedEntry

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(entry, revision, theme: nil) ⇒ EntryAtRevision

Returns a new instance of EntryAtRevision.



10
11
12
13
14
# File 'app/models/pageflow/entry_at_revision.rb', line 10

def initialize(entry, revision, theme: nil)
  @entry = entry
  @revision = revision
  @theme = theme
end

Instance Attribute Details

#entryObject (readonly)

Returns the value of attribute entry.



8
9
10
# File 'app/models/pageflow/entry_at_revision.rb', line 8

def entry
  @entry
end

#revisionObject (readonly)

Returns the value of attribute revision.



8
9
10
# File 'app/models/pageflow/entry_at_revision.rb', line 8

def revision
  @revision
end

Instance Method Details

#emphasize_chapter_beginningObject



63
64
65
# File 'app/models/pageflow/entry_at_revision.rb', line 63

def emphasize_chapter_beginning
  revision.configuration['emphasize_chapter_beginning']
end

#emphasize_new_pagesObject



67
68
69
# File 'app/models/pageflow/entry_at_revision.rb', line 67

def emphasize_new_pages
  revision.configuration['emphasize_new_pages']
end

#home_buttonObject



51
52
53
# File 'app/models/pageflow/entry_at_revision.rb', line 51

def home_button
  HomeButton.new(revision, site)
end

#manual_startObject



59
60
61
# File 'app/models/pageflow/entry_at_revision.rb', line 59

def manual_start
  revision.configuration['manual_start']
end

#overview_buttonObject



55
56
57
# File 'app/models/pageflow/entry_at_revision.rb', line 55

def overview_button
  OverviewButton.new(revision)
end

#resolve_widgets(options = {}) ⇒ Object



43
44
45
# File 'app/models/pageflow/entry_at_revision.rb', line 43

def resolve_widgets(options = {})
  widgets.resolve(Pageflow.config_for(entry), options)
end

#themeObject



47
48
49
# File 'app/models/pageflow/entry_at_revision.rb', line 47

def theme
  @theme ||= CustomizedTheme.find(entry: entry, theme: revision.theme)
end