Class: Spree::PageSections::Footer

Inherits:
Spree::PageSection show all
Defined in:
app/models/spree/page_sections/footer.rb

Constant Summary collapse

BACKGROUND_COLOR_DEFAULT =
'#F5F5F4'
TOP_PADDING_DEFAULT =
32
BOTTOM_PADDING_DEFAULT =
32
TOP_BORDER_WIDTH_DEFAULT =
0

Constants inherited from Spree::PageSection

Spree::PageSection::BORDER_COLOR_DEFAULT, Spree::PageSection::BOTTOM_BORDER_WIDTH_DEFAULT, Spree::PageSection::TEXT_COLOR_DEFAULT

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Spree::PageSection

#can_be_deleted?, #can_be_sorted?, #copy_rich_text_fields_from, #deep_clone, #deep_clone_links, #display_name, #dup, #lazy?, #lazy_path, #restore_design_settings_to_defaults, #rich_text_fields, #role, #theme, #to_partial_path

Class Method Details

.roleObject



14
15
16
# File 'app/models/spree/page_sections/footer.rb', line 14

def self.role
  'footer'
end

Instance Method Details

#available_blocks_to_addObject



30
31
32
# File 'app/models/spree/page_sections/footer.rb', line 30

def available_blocks_to_add
  [Spree::PageBlocks::Nav]
end

#blocks_available?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'app/models/spree/page_sections/footer.rb', line 26

def blocks_available?
  true
end

#can_sort_blocks?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'app/models/spree/page_sections/footer.rb', line 22

def can_sort_blocks?
  true
end

#default_blocksObject



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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'app/models/spree/page_sections/footer.rb', line 34

def default_blocks
  shop_default_links = [
    Spree::PageLink.new(
      linkable: pages.find_by(type: 'Spree::Pages::ShopAll')
    )
  ]

  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'))

    shop_default_links << Spree::PageLink.new(linkable: on_sale_collection) if on_sale_collection.present?
    shop_default_links << Spree::PageLink.new(linkable: new_arrivals_collection) if new_arrivals_collection.present?
  end

  [
    Spree::PageBlocks::Nav.new(
      preferred_label: 'Shop',
      default_links: shop_default_links
    ),
    Spree::PageBlocks::Nav.new(
      preferred_label: 'Account',
      default_links: [
        Spree::PageLink.new(
          label: 'My Account',
          linkable: pages.find_by(type: 'Spree::Pages::Account')
        ),
        Spree::PageLink.new(
          label: 'Favorites',
          linkable: pages.find_by(type: 'Spree::Pages::Wishlist')
        )
      ]
    ),
    Spree::PageBlocks::Nav.new(
      preferred_label: 'Company',
      default_links: []
    ),
    Spree::PageBlocks::Nav.new(
      preferred_label: 'Info',
      default_links: [
        Spree::PageLink.new(
          label: 'Privacy Policy',
          linkable: store.customer_privacy_policy
        ),
        Spree::PageLink.new(
          label: 'Terms of Service',
          linkable: store.customer_terms_of_service
        ),
      ]
    ),
  ]
end

#icon_nameObject



18
19
20
# File 'app/models/spree/page_sections/footer.rb', line 18

def icon_name
  'layout-bottombar'
end

#pagesObject



89
90
91
# File 'app/models/spree/page_sections/footer.rb', line 89

def pages
  @pages ||= theme.pages
end