Sha256: d0fe9eddf8a10d80d59781633bdb8cf9eb460ea304f28d7904502aa2ccad6350
Contents?: true
Size: 1.04 KB
Versions: 4
Compression:
Stored size: 1.04 KB
Contents
module Spree module V2 module Storefront class CmsSectionSerializer < BaseSerializer set_type :cms_section attributes :name, :content, :settings, :link, :fit, :type, :position Spree::CmsSection::IMAGE_COUNT.each do |count| Spree::CmsSection::IMAGE_SIZE.each do |size| attribute "img_#{count}_#{size}".to_sym do |section| if section.send("image_#{count}").attached? && section.send("img_#{count}_#{size}").present? url_helpers = Rails.application.routes.url_helpers url_helpers.rails_representation_path(section.send("img_#{count}_#{size}"), only_path: true) end end end end attribute :is_fullscreen do |section| section.fullscreen? end belongs_to :linked_resource, polymorphic: { Spree::Cms::Pages::StandardPage => :cms_page, Spree::Cms::Pages::FeaturePage => :cms_page, Spree::Cms::Pages::Homepage => :cms_page } end end end end
Version data entries
4 entries across 4 versions & 1 rubygems