Module: Spree::Admin::HomeSectionHelper

Defined in:
app/helpers/spree/admin/home_section_helper.rb

Instance Method Summary collapse

Instance Method Details

#parse_home_sections(home_section) ⇒ Object



4
5
6
7
8
# File 'app/helpers/spree/admin/home_section_helper.rb', line 4

def parse_home_sections(home_section)
  return [] unless home_section.section_products?

  parse_products(products: home_section.products_by_position)
end

#parse_products(products:) ⇒ Object



10
11
12
# File 'app/helpers/spree/admin/home_section_helper.rb', line 10

def parse_products(products:)
  products.map { |product| product_presenter(product: product).as_json }
end

#product_presenter(product:) ⇒ Object



14
15
16
# File 'app/helpers/spree/admin/home_section_helper.rb', line 14

def product_presenter(product:)
  presenter(product).parse
end