Class: Admin::SeosController

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

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

#generate_aiObject



5
6
7
8
9
10
11
12
13
14
15
# File 'app/controllers/admin/seos_controller.rb', line 5

def generate_ai
  restaurant = Restaurant.find_by(id: params[:seo_id])
  unless restaurant
    flash[:alert] = 'Restaurant not found.'
    redirect_to edit_admin_restaurant_path(restaurant.id)
    return
  end
  ::Restaurants::SeoDataGeneratorWorker.perform_async(restaurant.id)
  flash[:notice] = "SEO data generation for #{restaurant.name_en} has been initiated."
  redirect_to edit_admin_restaurant_path(restaurant.id)
end

#help_with_ai_formObject



17
18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/admin/seos_controller.rb', line 17

def help_with_ai_form
  @restaurant = @seo.restaurant.decorate
  schema = cell(:schema, @restaurant)
  @jsonld = {
    organization: schema.as_organization,
    product: schema.as_product,
    service: schema.as_service
  }

  @meta_tags_prompt = generate_meta_tags_prompt(@restaurant)
end

#prompt_formObject



29
30
# File 'app/controllers/admin/seos_controller.rb', line 29

def prompt_form
end

#update_promptObject



32
33
34
35
36
37
38
39
40
# File 'app/controllers/admin/seos_controller.rb', line 32

def update_prompt
  seo_prompt = params[:settings][:seo_prompt_to_generate_meta_tags]
  seo_prompt_to_describe_image = params[:settings][:seo_prompt_to_describe_image_menu]

  update_seo_prompt(seo_prompt, :seo_prompt_to_generate_meta_tags)
  update_seo_prompt(seo_prompt_to_describe_image, :seo_prompt_to_describe_image_menu)

  redirect_back fallback_location: prompt_form_admin_seos_path
end