Class: Workarea::Admin::BulkActionSequentialProductEditsController

Inherits:
ApplicationController
  • Object
show all
Includes:
BulkVariantSaving
Defined in:
app/controllers/workarea/admin/bulk_action_sequential_product_edits_controller.rb

Instance Method Summary collapse

Methods included from BulkVariantSaving

#save_variant_on_product

Methods inherited from ApplicationController

#current_user, #find_sort, #wrap_in_view_model, wrap_in_view_model

Methods included from Publishing

#allow_publishing!, #allow_publishing?, #set_publishing_options

Methods included from Visiting

#most_visited

Instance Method Details

#editObject



11
12
13
# File 'app/controllers/workarea/admin/bulk_action_sequential_product_edits_controller.rb', line 11

def edit
  render :publishing
end

#productObject



27
28
# File 'app/controllers/workarea/admin/bulk_action_sequential_product_edits_controller.rb', line 27

def product
end

#publishObject



15
16
17
18
19
20
21
22
23
24
25
# File 'app/controllers/workarea/admin/bulk_action_sequential_product_edits_controller.rb', line 15

def publish
  publish = SavePublishing.new(nil, params)

  if publish.perform
    self.current_release = publish.release
    redirect_to first_product_path
  else
    flash[:error] = publish.errors.full_messages
    render :publishing
  end
end

#update_productObject



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'app/controllers/workarea/admin/bulk_action_sequential_product_edits_controller.rb', line 30

def update_product
  set_details
  set_filters
  set_images
  set_variants

  if @product.update_attributes(params[:product])
    if @bulk_action.last?
      flash[:success] = t('workarea.admin.bulk_action_sequential_product_edits.flash_messages.done')
      redirect_to catalog_products_path
    else
      flash[:success] = t('workarea.admin.bulk_action_sequential_product_edits.flash_messages.saved')
      redirect_to next_product_path
    end
  else
    flash[:error] = @product.errors.full_messages
    render :product, status: :unprocessable_entity
  end
end