Class: Spree::PageSections::ProductDetails

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

Constant Summary collapse

TOP_BORDER_WIDTH_DEFAULT =
0
TOP_PADDING_DEFAULT =
0
BOTTOM_PADDING_DEFAULT =
40

Constants inherited from Spree::PageSection

Spree::PageSection::BACKGROUND_COLOR_DEFAULT, 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



12
13
14
# File 'app/models/spree/page_sections/product_details.rb', line 12

def self.role
  'system'
end

Instance Method Details

#available_blocks_to_addObject



39
40
41
42
43
44
45
46
47
48
49
50
# File 'app/models/spree/page_sections/product_details.rb', line 39

def available_blocks_to_add
  [
    Spree::PageBlocks::Products::Brand,
    Spree::PageBlocks::Products::Title,
    Spree::PageBlocks::Products::Price,
    Spree::PageBlocks::Products::VariantPicker,
    Spree::PageBlocks::Products::QuantitySelector,
    Spree::PageBlocks::Products::BuyButtons,
    Spree::PageBlocks::Products::Description,
    Spree::PageBlocks::Metafields,
  ]
end

#blocks_available?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'app/models/spree/page_sections/product_details.rb', line 31

def blocks_available?
  true
end

#can_sort_blocks?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'app/models/spree/page_sections/product_details.rb', line 35

def can_sort_blocks?
  true
end

#default_blocksObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/models/spree/page_sections/product_details.rb', line 16

def default_blocks
  product_metafield_definition_ids = Spree::MetafieldDefinition.where(resource_type: 'Spree::Product').ids

  [
    Spree::PageBlocks::Products::Brand.new,
    Spree::PageBlocks::Products::Title.new,
    Spree::PageBlocks::Products::Price.new(text: Spree.t(:price), preferred_text_alignment: 'left'),
    Spree::PageBlocks::Products::VariantPicker.new,
    Spree::PageBlocks::Products::QuantitySelector.new,
    Spree::PageBlocks::Products::BuyButtons.new,
    Spree::PageBlocks::Products::Description.new,
    Spree::PageBlocks::Metafields.new(preferred_metafield_definition_ids: product_metafield_definition_ids),
  ]
end

#icon_nameObject



8
9
10
# File 'app/models/spree/page_sections/product_details.rb', line 8

def icon_name
  'list-details'
end