Sha256: fdf8ecc2cc4ff7a02e20597738e3a84f0018da80a28b1648fcbe4d16e7bb153f

Contents?: true

Size: 837 Bytes

Versions: 29

Compression:

Stored size: 837 Bytes

Contents

module Spree
  module Admin
    class ImagesController < ResourceController
      before_filter :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

29 entries across 29 versions & 1 rubygems

Version Path
spree_backend-2.3.13 app/controllers/spree/admin/images_controller.rb
spree_backend-2.2.14 app/controllers/spree/admin/images_controller.rb
spree_backend-2.3.12 app/controllers/spree/admin/images_controller.rb
spree_backend-2.2.13 app/controllers/spree/admin/images_controller.rb
spree_backend-2.3.11 app/controllers/spree/admin/images_controller.rb
spree_backend-2.2.12 app/controllers/spree/admin/images_controller.rb
spree_backend-2.3.10 app/controllers/spree/admin/images_controller.rb
spree_backend-2.3.9 app/controllers/spree/admin/images_controller.rb
spree_backend-2.2.11 app/controllers/spree/admin/images_controller.rb
spree_backend-2.2.10 app/controllers/spree/admin/images_controller.rb
spree_backend-2.3.8 app/controllers/spree/admin/images_controller.rb
spree_backend-2.3.7 app/controllers/spree/admin/images_controller.rb
spree_backend-2.2.9 app/controllers/spree/admin/images_controller.rb
spree_backend-2.3.6 app/controllers/spree/admin/images_controller.rb
spree_backend-2.2.8 app/controllers/spree/admin/images_controller.rb
spree_backend-2.3.5 app/controllers/spree/admin/images_controller.rb
spree_backend-2.2.7 app/controllers/spree/admin/images_controller.rb
spree_backend-2.3.4 app/controllers/spree/admin/images_controller.rb
spree_backend-2.2.6 app/controllers/spree/admin/images_controller.rb
spree_backend-2.3.3 app/controllers/spree/admin/images_controller.rb