Class: Spree::Pages::Homepage
Instance Method Summary
collapse
Methods inherited from Spree::Page
#create_preview, #custom?, #display_name, #duplicate, #layout_sections?, #preview_url, #promote, #store, #theme
#preview?
Instance Method Details
#customizable? ⇒ Boolean
67
68
69
|
# File 'app/models/spree/pages/homepage.rb', line 67
def customizable?
true
end
|
#default_sections ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
# File 'app/models/spree/pages/homepage.rb', line 18
def default_sections
sections = [
Spree::PageSections::ImageWithText.new(
preferred_top_padding: 0,
preferred_bottom_padding: 26
)
]
collections_taxonomy = store.taxonomies.find_by(name: Spree.t(:taxonomy_collections_name))
if collections_taxonomy.present?
on_sale_collection = collections_taxonomy.taxons.automatic.find_by(name: Spree.t('automatic_taxon_names.on_sale'))
new_arrivals_collection = collections_taxonomy.taxons.automatic.find_by(name: Spree.t('automatic_taxon_names.new_arrivals'))
if on_sale_collection.present?
sections << Spree::PageSections::FeaturedTaxon.new(
preferred_heading: Spree.t('pages_defaults.homepage.featured_taxon_heading_on_sale'),
preferred_use_description_from_admin: true,
preferred_taxon_id: on_sale_collection.id
)
end
if new_arrivals_collection.present?
sections << Spree::PageSections::FeaturedTaxon.new(
preferred_heading: Spree.t('pages_defaults.homepage.featured_taxon_heading_new_arrivals'),
preferred_use_description_from_admin: true,
preferred_taxon_id: new_arrivals_collection.id
)
end
end
sections << Spree::PageSections::ImageWithText.new(
preferred_background_color: '#F0EFE9',
default_blocks: [
Spree::PageBlocks::Heading.new(
text: Spree.t('pages_defaults.homepage.image_with_text_heading'),
preferred_text_alignment: 'left',
preferred_bottom_padding: 8,
preferred_top_padding: 24
),
Spree::PageBlocks::Text.new(
text: Spree.t('pages_defaults.homepage.image_with_text_text'),
preferred_text_alignment: 'left',
preferred_bottom_padding: 16
)
]
)
end
|
#icon_name ⇒ Object
10
11
12
|
# File 'app/models/spree/pages/homepage.rb', line 10
def icon_name
'home'
end
|
#linkable? ⇒ Boolean
14
15
16
|
# File 'app/models/spree/pages/homepage.rb', line 14
def linkable?
true
end
|
#page_builder_url ⇒ Object
4
5
6
7
8
|
# File 'app/models/spree/pages/homepage.rb', line 4
def page_builder_url
return unless page_builder_url_exists?(:root_path)
Spree::Core::Engine.routes.url_helpers.root_path
end
|