Class: Workarea::Admin::CatalogProductsController

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

Instance Method Summary collapse

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

#contentObject



32
33
# File 'app/controllers/workarea/admin/catalog_products_controller.rb', line 32

def content
end

#destroyObject



38
39
40
41
42
# File 'app/controllers/workarea/admin/catalog_products_controller.rb', line 38

def destroy
  @product.destroy
  flash[:success] = t('workarea.admin.catalog_products.flash_messages.deleted')
  redirect_to catalog_products_path
end

#detailsObject



49
50
51
52
# File 'app/controllers/workarea/admin/catalog_products_controller.rb', line 49

def details
  @values = Catalog::DetailsQueries.find_details(params[:name], params[:q])
  render 'workarea/admin/shared/values'
end

#filtersObject



44
45
46
47
# File 'app/controllers/workarea/admin/catalog_products_controller.rb', line 44

def filters
  @values = Catalog::DetailsQueries.find_filters(params[:name], params[:q])
  render 'workarea/admin/shared/values'
end

#indexObject



9
10
11
12
13
14
15
# File 'app/controllers/workarea/admin/catalog_products_controller.rb', line 9

def index
  search = Search::AdminProducts.new(
    params.merge(autocomplete: request.xhr?)
  )

  @search = Admin::SearchViewModel.new(search, view_model_options)
end

#insightsObject



35
36
# File 'app/controllers/workarea/admin/catalog_products_controller.rb', line 35

def insights
end

#showObject



17
# File 'app/controllers/workarea/admin/catalog_products_controller.rb', line 17

def show; end

#updateObject



19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/controllers/workarea/admin/catalog_products_controller.rb', line 19

def update
  set_details
  set_filters

  if @product.update_attributes(params[:product])
    flash[:success] = t('workarea.admin.catalog_products.flash_messages.saved')
    redirect_to catalog_product_path(@product)
  else
    flash[:error] = @product.errors.full_messages
    render :edit, status: :unprocessable_entity
  end
end