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, site) ⇒ HomeButton

Returns a new instance of HomeButton.



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

def initialize(revision, site)
  @revision = revision
  @site = site
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

#siteObject (readonly)

Returns the value of attribute site.



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

def site
  @site
end

Instance Method Details

#enabled?Boolean

Returns:

  • (Boolean)


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

def enabled?
  revision.configuration['home_button_enabled'] &&
    revision.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.configuration['home_button_enabled']
end

#urlObject



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

def url
  revision.configuration['home_url'].presence || site_home_button_url
end

#url_valueObject



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

def url_value
  revision.configuration['home_url']
end