Sha256: cff593ba2ce7b3e1a42cc227994b4efb18886c640a488a9f0028c4a3ee01afec

Contents?: true

Size: 685 Bytes

Versions: 62

Compression:

Stored size: 685 Bytes

Contents

module Workarea
  module Storefront
    module ProductBrowsing
      extend ActiveSupport::Concern
      include Pagination

      def product_browse_cache_key
        @product_browse_cache_key ||= options
          .except(:user)
          .to_a
          .sort
          .flatten
          .reject(&:blank?)
          .join('/')
      end

      def has_filters?
        facets.any?(&:selected?)
      end

      def filters
        search_query.facets.reduce({}) do |memo, facet|
          memo[facet.system_name] = facet.selections if facet.selected?
          memo
        end
      end

      def facets
        search_query.facets.reject(&:useless?)
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-storefront-3.4.13 app/view_models/workarea/storefront/product_browsing.rb
workarea-storefront-3.4.12 app/view_models/workarea/storefront/product_browsing.rb