Class: Workarea::Admin::PricingSkusController
Instance Method Summary
collapse
#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
#create ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
|
# File 'app/controllers/workarea/admin/pricing_skus_controller.rb', line 25
def create
@sku.prices = price_params
if @sku.save
flash[:success] =
t('workarea.admin.pricing_skus.saved', sku: @sku.id)
redirect_to pricing_sku_path(@sku)
else
render :new, status: :unprocessable_entity
end
end
|
#edit ⇒ Object
37
38
39
|
# File 'app/controllers/workarea/admin/pricing_skus_controller.rb', line 37
def edit
@sku = PricingSkuViewModel.new(@sku)
end
|
#index ⇒ Object
10
11
12
13
14
15
16
17
18
19
|
# File 'app/controllers/workarea/admin/pricing_skus_controller.rb', line 10
def index
search_params = if product
view_model_options.merge(q: product.skus.join(' '))
else
view_model_options
end
search = Search::AdminPricingSkus.new(search_params)
@search = SearchViewModel.new(search, search_params)
end
|
#show ⇒ Object
21
22
23
|
# File 'app/controllers/workarea/admin/pricing_skus_controller.rb', line 21
def show
@sku = PricingSkuViewModel.new(@sku)
end
|
#update ⇒ Object
41
42
43
44
45
46
47
48
49
50
|
# File 'app/controllers/workarea/admin/pricing_skus_controller.rb', line 41
def update
if @sku.update_attributes(sku_params)
flash[:success] =
t('workarea.admin.pricing_skus.saved', sku: @sku.id)
redirect_to pricing_sku_path(@sku)
else
@sku = PricingSkuViewModel.new(@sku)
render :edit, status: :unprocessable_entity
end
end
|