Class: Spree::Admin::ProductsController
Instance Method Summary
collapse
belongs_to, #create, #edit, #new, #update, #update_positions
#set_user_language_locale_key
Instance Method Details
#clone ⇒ Object
36
37
38
39
40
41
42
43
44
45
46
|
# File 'app/controllers/spree/admin/products_controller.rb', line 36
def clone
@new = @product.duplicate
if @new.save
flash[:success] = t('spree.notice_messages.product_cloned')
else
flash[:error] = t('spree.notice_messages.product_not_cloned')
end
redirect_to edit_admin_product_url(@new)
end
|
#destroy ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
|
# File 'app/controllers/spree/admin/products_controller.rb', line 24
def destroy
@product = Spree::Product.friendly.find(params[:id])
@product.discard
flash[:success] = t('spree.notice_messages.product_deleted')
respond_with(@product) do |format|
format.html { redirect_to collection_url }
format.js { render_js_for_destroy }
end
end
|
#index ⇒ Object
19
20
21
22
|
# File 'app/controllers/spree/admin/products_controller.rb', line 19
def index
session[:return_to] = request.url
respond_with(@collection)
end
|
#show ⇒ Object
15
16
17
|
# File 'app/controllers/spree/admin/products_controller.rb', line 15
def show
redirect_to action: :edit
end
|