Class: Admin::FooterBannersController
Overview
typed: ignore frozen_string_literal: true
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
#assign_channels ⇒ Object
49
50
51
52
53
54
55
|
# File 'app/controllers/admin/footer_banners_controller.rb', line 49
def assign_channels
if Channel. ad_channel_params
redirect_back fallback_location: back_fallback_location, notice: "#{t('activerecord.model.channel_ad.name')} updated"
else
redirect_back fallback_location: back_fallback_location, notice: "#{t('activerecord.model.channel_ad.name')} error"
end
end
|
#create ⇒ Object
19
20
21
22
23
24
25
26
27
|
# File 'app/controllers/admin/footer_banners_controller.rb', line 19
def create
@channel_ad = ChannelAd.new(ad_params)
if @channel_ad.save
redirect_to , notice: "#{t('activerecord.model.channel_ad.name')} created."
else
render action: 'new'
end
end
|
#destroy ⇒ Object
37
38
39
40
41
|
# File 'app/controllers/admin/footer_banners_controller.rb', line 37
def destroy
@channel_ad.destroy
redirect_to , notice: "#{t('activerecord.model.channel_ad.name')} removed."
end
|
#edit ⇒ Object
17
|
# File 'app/controllers/admin/footer_banners_controller.rb', line 17
def edit; end
|
#index ⇒ Object
5
6
7
8
9
10
11
|
# File 'app/controllers/admin/footer_banners_controller.rb', line 5
def index
@grid = AdminFooterBannersGrid.new(params[:admin_banners_grid]) do |scope|
scope.page(params[:page])
end
etag = CityHash.hash32([self.class.to_s, @grid.assets.cache_key])
return unless stale?(etag: etag)
end
|
#new ⇒ Object
13
14
15
|
# File 'app/controllers/admin/footer_banners_controller.rb', line 13
def new
@channel_ad = ChannelAd.new
end
|
#update ⇒ Object
29
30
31
32
33
34
35
|
# File 'app/controllers/admin/footer_banners_controller.rb', line 29
def update
if @channel_ad.update_attributes(ad_params)
redirect_to , notice: "#{t('activerecord.model.channel_ad.name')} updated."
else
render action: 'edit'
end
end
|
#view_channels ⇒ Object
43
44
45
46
47
|
# File 'app/controllers/admin/footer_banners_controller.rb', line 43
def view_channels
@channels = Channel.sort_channel_id.tagged_with(Channel::EXTERNAL_BOOKING)
@channel_ads = ChannelAd.all
@footer_banner_ad_manager = ChannelAdManager.includes(:channel_ad).where(ad_type: :footer_banner)
end
|