Sha256: 3ad6ff25d236c185c3544ada94127cd688e3068841c90bccfe09ee9f47484f20

Contents?: true

Size: 802 Bytes

Versions: 21

Compression:

Stored size: 802 Bytes

Contents

module Spree
  module Admin
    class ImagesController < ResourceController
      before_action :load_data

      create.before :set_viewable
      update.before :set_viewable

      private

      def location_after_destroy
        admin_product_images_url(@product)
      end

      def location_after_save
        admin_product_images_url(@product)
      end

      def load_data
        @product = Product.friendly.find(params[:product_id])
        @variants = @product.variants.collect do |variant|
          [variant.sku_and_options_text, variant.id]
        end
        @variants.insert(0, [Spree.t(:all), @product.master.id])
      end

      def set_viewable
        @image.viewable_type = 'Spree::Variant'
        @image.viewable_id = params[:image][:viewable_id]
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
solidus_backend-2.1.1 app/controllers/spree/admin/images_controller.rb
solidus_backend-2.0.3 app/controllers/spree/admin/images_controller.rb
solidus_backend-1.4.2 app/controllers/spree/admin/images_controller.rb
solidus_backend-1.3.2 app/controllers/spree/admin/images_controller.rb
solidus_backend-2.0.2 app/controllers/spree/admin/images_controller.rb
solidus_backend-1.4.1 app/controllers/spree/admin/images_controller.rb
solidus_backend-2.1.0 app/controllers/spree/admin/images_controller.rb
solidus_backend-2.1.0.rc1 app/controllers/spree/admin/images_controller.rb
solidus_backend-2.0.1 app/controllers/spree/admin/images_controller.rb
solidus_backend-2.1.0.beta1 app/controllers/spree/admin/images_controller.rb
solidus_backend-2.0.0 app/controllers/spree/admin/images_controller.rb
solidus_backend-1.4.0 app/controllers/spree/admin/images_controller.rb
solidus_backend-2.0.0.rc1 app/controllers/spree/admin/images_controller.rb
solidus_backend-1.4.0.rc1 app/controllers/spree/admin/images_controller.rb
solidus_backend-2.0.0.beta1 app/controllers/spree/admin/images_controller.rb
solidus_backend-1.4.0.beta1 app/controllers/spree/admin/images_controller.rb
solidus_backend-1.3.1 app/controllers/spree/admin/images_controller.rb
solidus_backend-1.3.0 app/controllers/spree/admin/images_controller.rb
solidus_backend-1.3.0.rc2 app/controllers/spree/admin/images_controller.rb
solidus_backend-1.3.0.rc1 app/controllers/spree/admin/images_controller.rb