Sha256: 9370642f4d57f3d1c16a78bf2d99b9ef8aad0073aa9a5b77313a70cfb3411523

Contents?: true

Size: 626 Bytes

Versions: 4

Compression:

Stored size: 626 Bytes

Contents

module Workarea
  module Api
    module Storefront
      class SearchSuggestionViewModel < Workarea::Storefront::SearchSuggestionViewModel
        def url
          helpers = Api::Storefront::Engine.routes.url_helpers

          if suggestion_type == 'product'
            helpers.product_path(product)
          elsif suggestion_type == 'search'
            helpers.search_path(q: name)
          elsif suggestion_type == 'category'
            helpers.category_path(source['slug'])
          elsif suggestion_type == 'page'
            helpers.page_path(source['slug'])
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
workarea-api-4.4.7 storefront/app/view_models/workarea/api/storefront/search_suggestion_view_model.rb
workarea-api-storefront-4.4.7 app/view_models/workarea/api/storefront/search_suggestion_view_model.rb
workarea-api-4.4.6 storefront/app/view_models/workarea/api/storefront/search_suggestion_view_model.rb
workarea-api-storefront-4.4.6 app/view_models/workarea/api/storefront/search_suggestion_view_model.rb