Class: Spree::PageSections::Newsletter

Inherits:
Spree::PageSection show all
Includes:
HasImageAltText
Defined in:
app/models/spree/page_sections/newsletter.rb

Constant Summary

Constants inherited from Spree::PageSection

Spree::PageSection::BACKGROUND_COLOR_DEFAULT, Spree::PageSection::BORDER_COLOR_DEFAULT, Spree::PageSection::BOTTOM_BORDER_WIDTH_DEFAULT, Spree::PageSection::BOTTOM_PADDING_DEFAULT, Spree::PageSection::TEXT_COLOR_DEFAULT, Spree::PageSection::TOP_BORDER_WIDTH_DEFAULT, Spree::PageSection::TOP_PADDING_DEFAULT

Class Method Summary collapse

Instance Method Summary collapse

Methods included from HasImageAltText

#image_alt

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_path, #restore_design_settings_to_defaults, #rich_text_fields, #role, #theme, #to_partial_path

Class Method Details

.roleObject



29
30
31
# File 'app/models/spree/page_sections/newsletter.rb', line 29

def self.role
  'footer'
end

Instance Method Details

#available_blocks_to_addObject



41
42
43
# File 'app/models/spree/page_sections/newsletter.rb', line 41

def available_blocks_to_add
  [Spree::PageBlocks::Image, Spree::PageBlocks::Heading, Spree::PageBlocks::Text, Spree::PageBlocks::NewsletterForm]
end

#blocks_available?Boolean



37
38
39
# File 'app/models/spree/page_sections/newsletter.rb', line 37

def blocks_available?
  true
end

#can_sort_blocks?Boolean



45
46
47
# File 'app/models/spree/page_sections/newsletter.rb', line 45

def can_sort_blocks?
  true
end

#default_blocksObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/models/spree/page_sections/newsletter.rb', line 9

def default_blocks
  @default_blocks.presence || [
    Spree::PageBlocks::Heading.new(
      text: Spree.t('page_sections.newsletter.heading_default'),
      preferred_width_desktop: 50, # in %
      preferred_text_alignment: 'center',
      preferred_container_alignment: 'center',
      preferred_bottom_padding: 8
    ),
    Spree::PageBlocks::Text.new(
      text: Spree.t('page_sections.newsletter.text_default'),
      preferred_text_alignment: 'center',
      preferred_bottom_padding: 32,
      preferred_width_desktop: 50,
      preferred_container_alignment: 'center'
    ),
    Spree::PageBlocks::NewsletterForm.new
  ]
end

#icon_nameObject



49
50
51
# File 'app/models/spree/page_sections/newsletter.rb', line 49

def icon_name
  'mail'
end

#lazy?Boolean



33
34
35
# File 'app/models/spree/page_sections/newsletter.rb', line 33

def lazy?
  !Rails.env.test?
end