Class: Admin::HhSpecialsController
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
27
28
29
30
31
32
33
34
35
|
# File 'app/controllers/admin/hh_specials_controller.rb', line 27
def create
@hh_sp = HhSpecial.new hh_special_params
if @hh_sp.save
redirect_to admin_hh_specials_path, notice: 'Add success'
else
flash[:error] = @hh_sp.errors.full_messages.to_sentence
render 'edit'
end
end
|
#destroy ⇒ Object
37
38
39
40
41
42
43
44
|
# File 'app/controllers/admin/hh_specials_controller.rb', line 37
def destroy
if @hh_sp.update active: 0
redirect_to admin_hh_specials_path, notice: 'Data updated'
else
flash[:error] = @hh_sp.errors.full_messages.to_sentence
render 'edit'
end
end
|
#edit ⇒ Object
12
|
# File 'app/controllers/admin/hh_specials_controller.rb', line 12
def edit; end
|
#index ⇒ Object
4
5
6
7
8
9
10
|
# File 'app/controllers/admin/hh_specials_controller.rb', line 4
def index
set_meta_tags title: 'HH Special'
@grid = ::Admin::HhSpecialsGrid.new(params[:admin_hh_specials_grid]) do |scope|
scope.page(params[:page]).per(50)
end
fresh_when @grid.assets.cache_key
end
|
#new ⇒ Object
23
24
25
|
# File 'app/controllers/admin/hh_specials_controller.rb', line 23
def new
@hh_sp = HhSpecial.new
end
|
#update ⇒ Object
14
15
16
17
18
19
20
21
|
# File 'app/controllers/admin/hh_specials_controller.rb', line 14
def update
if @hh_sp.update hh_special_params
redirect_to admin_hh_specials_path, notice: 'Data updated'
else
flash[:error] = @hh_sp.errors.full_messages.to_sentence
render 'edit'
end
end
|