Class: Admin::PackageTypesController

Inherits:
BaseController show all
Defined in:
app/controllers/admin/package_types_controller.rb

Overview

typed: ignore frozen_string_literal: true

Constant Summary

Constants inherited from BaseController

BaseController::INTERNAL_SERVER_ERROR_MESSAGE

Instance Method Summary collapse

Methods inherited from BaseController

#destroy_session, #identity_cache_memoization, #sign_in_page, #user_developer_session

Methods included from LogrageCustomLogger

#append_info_to_payload

Methods included from AdminHelper

#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?

Methods included from UpdateLocaleConcern

#setup_locale

Methods inherited from ApplicationController

#after_sign_in_path_for, #after_sign_out_path_for, #default_url_options, #identity_cache_memoization, #render_not_found, #routing_error, search_params_key=

Methods included from ControllerHelpers

#check_boolean_param, #get_banners, #inventory_params, #reservation_params

Instance Method Details

#destroyObject



26
27
28
29
30
31
32
# File 'app/controllers/admin/package_types_controller.rb', line 26

def destroy
  if params.key?(:restaurant_id)
    destroy_restaurant
  else
    destroy_package_type
  end
end

#editObject



16
# File 'app/controllers/admin/package_types_controller.rb', line 16

def edit; end

#indexObject



7
8
9
10
11
12
13
14
# File 'app/controllers/admin/package_types_controller.rb', line 7

def index
  set_meta_tags title: 'Restaurant Package Type Overview'
  @grid = ::Admin::PackageTypesGrid.new(params[:package_typees_grid]) do |scope|
    scope.page(params[:page]).per(50)
  end
  etag = CityHash.hash32([self.class.to_s, @grid.assets.cache_key, params])
  return unless stale?(etag: etag)
end

#updateObject



18
19
20
21
22
23
24
# File 'app/controllers/admin/package_types_controller.rb', line 18

def update
  if @package_type.update_attributes package_type_param
    redirect_to admin_package_types_path, notice: 'Package Type successfully updated'
  else
    render :edit
  end
end