Sha256: b9818865f42f9e2b73d6449155e800528b21ead2b4fe8e0916b814a60e1b468d

Contents?: true

Size: 541 Bytes

Versions: 3

Compression:

Stored size: 541 Bytes

Contents

module Workarea
  decorate Storefront::ProductsController, with: :product_videos do
    def video
      model = Catalog::Product.find_by(id: params[:product_id])
      raise InvalidDisplay unless model.active? || current_user.try(:admin?)

      @product = Storefront::ProductViewModel.wrap(
        model,
        view_model_options
      )

      video = @product.videos.detect{ |v| v.id.to_s == params[:video_id] }
      @video = Storefront::ProductVideoViewModel.wrap(
        video,
        view_model_options
      )
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
workarea-product_videos-1.3.0 app/controllers/workarea/storefront/products_controller.decorator
workarea-product_videos-1.2.3 app/controllers/workarea/storefront/products_controller.decorator
workarea-product_videos-1.2.2 app/controllers/workarea/storefront/products_controller.decorator