Class: Admin::CustomLabelsController
Constant Summary
BaseController::INTERNAL_SERVER_ERROR_MESSAGE
Instance Method Summary
collapse
#destroy_session, #identity_cache_memoization, #sign_in_page, #user_developer_session
#append_info_to_payload
#dynamic_pricings_formatter, #link_to_admin_reservations_path_by_id, #link_to_admin_restaurants_path_by_id, #link_to_log, #optional_locales, #optional_locales_with_labels, #staff_signed_in?
#setup_locale
#after_sign_in_path_for, #after_sign_out_path_for, #default_url_options, #identity_cache_memoization, #render_not_found, #routing_error, search_params_key=
#check_boolean_param, #get_banners, #inventory_params, #reservation_params
Instance Method Details
#create ⇒ Object
22
23
24
25
26
27
28
29
30
|
# File 'app/controllers/admin/custom_labels_controller.rb', line 22
def create
@custom_label = CustomLabel.new custom_label_params
if @custom_label.save
redirect_to admin_custom_labels_path, notice: 'Add success'
else
flash[:error] = @custom_label.errors.full_messages.to_sentence
render 'edit'
end
end
|
#destroy ⇒ Object
44
45
46
47
48
49
50
51
52
|
# File 'app/controllers/admin/custom_labels_controller.rb', line 44
def destroy
return redirect_to [:admin, :custom_labels], notice: 'not permitted' if @custom_label.defined_label.present?
if @custom_label.destroy
redirect_to admin_custom_labels_path, notice: 'Delete success'
else
redirect_to admin_custom_labels_path, alert: 'Delete failed'
end
end
|
#edit ⇒ Object
32
|
# File 'app/controllers/admin/custom_labels_controller.rb', line 32
def edit; end
|
#index ⇒ Object
8
9
10
11
12
13
14
|
# File 'app/controllers/admin/custom_labels_controller.rb', line 8
def index
set_meta_tags title: 'Custom Labels Overview'
@grid = ::Admin::CustomLabelsGrid.new(params[:admin_custom_labels_grid]) do |scope|
scope.page(params[:page]).per(50)
end
fresh_when @grid.assets.cache_key
end
|
#new ⇒ Object
16
17
18
|
# File 'app/controllers/admin/custom_labels_controller.rb', line 16
def new
@custom_label = CustomLabel.new
end
|
#show ⇒ Object
20
|
# File 'app/controllers/admin/custom_labels_controller.rb', line 20
def show; end
|
#update ⇒ Object
36
37
38
39
40
41
42
|
# File 'app/controllers/admin/custom_labels_controller.rb', line 36
def update
if @custom_label.update custom_label_params
redirect_to admin_custom_labels_path, notice: 'Data updated'
else
render 'edit'
end
end
|