Class: Pageflow::HomeButton

Inherits:
Object
  • Object
show all
Defined in:
app/models/pageflow/home_button.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(revision, theming) ⇒ HomeButton


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

def initialize(revision, theming)
  @revision = revision
  @theming = theming
end

Instance Attribute Details

#revisionObject (readonly)

Returns the value of attribute revision


3
4
5
# File 'app/models/pageflow/home_button.rb', line 3

def revision
  @revision
end

#themingObject (readonly)

Returns the value of attribute theming


3
4
5
# File 'app/models/pageflow/home_button.rb', line 3

def theming
  @theming
end

Instance Method Details

#enabled?Boolean


14
15
16
17
18
# File 'app/models/pageflow/home_button.rb', line 14

def enabled?
  revision.home_button_enabled? &&
    theming.theme.has_home_button? &&
    url.present?
end

#enabled_valueObject


24
25
26
# File 'app/models/pageflow/home_button.rb', line 24

def enabled_value
  revision.home_button_enabled?
end

#urlObject


10
11
12
# File 'app/models/pageflow/home_button.rb', line 10

def url
  revision.home_url.presence || theming_home_button_url
end

#url_valueObject


20
21
22
# File 'app/models/pageflow/home_button.rb', line 20

def url_value
  revision.home_url
end