Sha256: d799e0d036679eec5c6b11fc5918e5294298a1a928f854655925dcc2ae122e34

Contents?: true

Size: 813 Bytes

Versions: 28

Compression:

Stored size: 813 Bytes

Contents

module Workarea
  module Admin
    class SearchCustomizationProductRulesViewModel < ProductRulesPreviewViewModel
      # Fetches search results of products for product search. Extends
      # search class with {Search::AdminProductRulesPreview} to allow
      # overriding display rules.
      #
      # @return [Workarea::Search::ProductSearch]
      #   enumerable collection of the search results
      #
      def search
        @search ||= Search::ProductSearch.new(
          q: model.query,
          rules: model.product_rules.usable,
          page: options[:page] || 1,
          show_all: show_all?
        ).tap { |s| s.extend(Search::AdminProductRulesPreview) }
      end

      def display_results?
        true # With query we can always show preview even without rules
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
workarea-admin-3.5.27 app/view_models/workarea/admin/search_customization_product_rules_view_model.rb
workarea-admin-3.5.26 app/view_models/workarea/admin/search_customization_product_rules_view_model.rb
workarea-admin-3.5.25 app/view_models/workarea/admin/search_customization_product_rules_view_model.rb
workarea-admin-3.5.23 app/view_models/workarea/admin/search_customization_product_rules_view_model.rb
workarea-admin-3.5.22 app/view_models/workarea/admin/search_customization_product_rules_view_model.rb
workarea-admin-3.5.21 app/view_models/workarea/admin/search_customization_product_rules_view_model.rb
workarea-admin-3.5.20 app/view_models/workarea/admin/search_customization_product_rules_view_model.rb
workarea-admin-3.5.19 app/view_models/workarea/admin/search_customization_product_rules_view_model.rb
workarea-admin-3.5.18 app/view_models/workarea/admin/search_customization_product_rules_view_model.rb
workarea-admin-3.5.17 app/view_models/workarea/admin/search_customization_product_rules_view_model.rb
workarea-admin-3.5.16 app/view_models/workarea/admin/search_customization_product_rules_view_model.rb
workarea-admin-3.5.15 app/view_models/workarea/admin/search_customization_product_rules_view_model.rb
workarea-admin-3.5.14 app/view_models/workarea/admin/search_customization_product_rules_view_model.rb
workarea-admin-3.5.13 app/view_models/workarea/admin/search_customization_product_rules_view_model.rb
workarea-admin-3.5.12 app/view_models/workarea/admin/search_customization_product_rules_view_model.rb
workarea-admin-3.5.11 app/view_models/workarea/admin/search_customization_product_rules_view_model.rb
workarea-admin-3.5.10 app/view_models/workarea/admin/search_customization_product_rules_view_model.rb
workarea-admin-3.5.9 app/view_models/workarea/admin/search_customization_product_rules_view_model.rb
workarea-admin-3.5.8 app/view_models/workarea/admin/search_customization_product_rules_view_model.rb
workarea-admin-3.5.7 app/view_models/workarea/admin/search_customization_product_rules_view_model.rb