Sha256: 9b0cf060749a204e7b391cf12bfa2545bad0a9f7f079626bd3156c9de95f591b

Contents?: true

Size: 702 Bytes

Versions: 12

Compression:

Stored size: 702 Bytes

Contents

module Workarea
  module Api
    module Storefront
      class CategoriesController < Api::Storefront::ApplicationController
        before_action :cache_page

        def index
          models = Catalog::Category.page(params[:page]).select(&:active?)
          @categories = Workarea::Storefront::CategoryViewModel.wrap(
            models,
            view_model_options
          )
        end

        def show
          model = Catalog::Category.find_by(slug: params[:id])
          raise InvalidDisplay unless model.active?

          @category = Workarea::Storefront::CategoryViewModel.wrap(
            model,
            view_model_options
          )
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
workarea-api-4.5.6 storefront/app/controllers/workarea/api/storefront/categories_controller.rb
workarea-api-storefront-4.5.6 app/controllers/workarea/api/storefront/categories_controller.rb
workarea-api-4.5.5 storefront/app/controllers/workarea/api/storefront/categories_controller.rb
workarea-api-storefront-4.5.5 app/controllers/workarea/api/storefront/categories_controller.rb
workarea-api-4.5.4 storefront/app/controllers/workarea/api/storefront/categories_controller.rb
workarea-api-storefront-4.5.4 app/controllers/workarea/api/storefront/categories_controller.rb
workarea-api-4.5.3 storefront/app/controllers/workarea/api/storefront/categories_controller.rb
workarea-api-storefront-4.5.3 app/controllers/workarea/api/storefront/categories_controller.rb
workarea-api-4.5.2 storefront/app/controllers/workarea/api/storefront/categories_controller.rb
workarea-api-storefront-4.5.2 app/controllers/workarea/api/storefront/categories_controller.rb
workarea-api-4.5.0 storefront/app/controllers/workarea/api/storefront/categories_controller.rb
workarea-api-storefront-4.5.0 app/controllers/workarea/api/storefront/categories_controller.rb