Sha256: cdc2efa14ae78b44a04fd8ce25db8de042f76d71a398bc1fbdd09f702a2720f5

Contents?: true

Size: 719 Bytes

Versions: 3

Compression:

Stored size: 719 Bytes

Contents

module Workarea
  module Search
    class StorefrontSearch
      class TemplateWithContent
        include Middleware

        def call(response)
          if response.has_filters?
            yield
            return
          end

          if response.total.zero? && response.content_total.zero?
            response.template = 'no_results'
          elsif response.params[:type].present?
            response.template = response.params[:type]
          elsif response.params[:sort].present?
            response.template = 'show'
          elsif response.content_total > response.total
            response.template = 'content'
          else
            yield
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
workarea-content_search-1.1.0 app/queries/workarea/search/storefront_search/template_with_content.rb
workarea-content_search-1.0.9 app/queries/workarea/search/storefront_search/template_with_content.rb
workarea-content_search-1.0.8 app/queries/workarea/search/storefront_search/template_with_content.rb