Sha256: 1aed450f9f10b9239d4f9dcf98bd7bf8b66cc4fc114393c6730e585533588678
Contents?: true
Size: 841 Bytes
Versions: 47
Compression:
Stored size: 841 Bytes
Contents
# frozen_string_literal: true 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 = Spree::Product.friendly.find(params[:product_id]) @variants = @product.variants.collect do |variant| [variant.sku_and_options_text, variant.id] end @variants.insert(0, [t('spree.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
47 entries across 47 versions & 2 rubygems