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



61
62
63
# File 'app/models/pageflow/entry_at_revision.rb', line 61

def emphasize_chapter_beginning
  revision.configuration['emphasize_chapter_beginning']
end

#emphasize_new_pagesObject



65
66
67
# File 'app/models/pageflow/entry_at_revision.rb', line 65

def emphasize_new_pages
  revision.configuration['emphasize_new_pages']
end

#home_buttonObject



49
50
51
# File 'app/models/pageflow/entry_at_revision.rb', line 49

def home_button
  HomeButton.new(revision, theming)
end

#manual_startObject



57
58
59
# File 'app/models/pageflow/entry_at_revision.rb', line 57

def manual_start
  revision.configuration['manual_start']
end

#overview_buttonObject



53
54
55
# File 'app/models/pageflow/entry_at_revision.rb', line 53

def overview_button
  OverviewButton.new(revision)
end

#resolve_widgets(options = {}) ⇒ Object



41
42
43
# File 'app/models/pageflow/entry_at_revision.rb', line 41

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

#themeObject



45
46
47
# File 'app/models/pageflow/entry_at_revision.rb', line 45

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