From 5b7cac3970f89015866ebe28dfd6679ba09ad033 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B1=E5=8D=9A=E4=BA=9E?= Date: Sat, 31 Dec 2022 15:27:56 +0800 Subject: [PATCH] fix error --- app/controllers/admin/asks_controller.rb | 5 +++-- app/helpers/admin/asks_helper.rb | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/controllers/admin/asks_controller.rb b/app/controllers/admin/asks_controller.rb index e74dcd3..49644c6 100644 --- a/app/controllers/admin/asks_controller.rb +++ b/app/controllers/admin/asks_controller.rb @@ -282,7 +282,7 @@ class Admin::AsksController < OrbitAdminController when 'title','name','mail','phone','appointment' text = text.gsub(format_text,@ask_question.send(format_text[1...-1]).to_s) when 'category' - cat = Category.find(@ask_question.ask_category_id).title rescue '' + cat = Category.find(@ask_question.category_id).title rescue '' text = text.gsub(format_text,cat) when 'name|mask' name_tp = @ask_question.name.to_s @@ -330,6 +330,7 @@ class Admin::AsksController < OrbitAdminController @print_setting = AskPrintSetting.first if @print_setting.nil? @save_name = @print_setting.save_name rescue '' @print_text = @print_setting.print_format rescue '' + @print_text = ""+ @print_text ask_setting = AskCategorySetting.where(category_id: @ask_question.category_id.to_s, :use_default.ne=>true).first ask_setting = AskSetting.first if ask_setting.nil? custom_fields = ask_setting.custom_fields @@ -465,7 +466,7 @@ class Admin::AsksController < OrbitAdminController locals: { :ask_category_settings => ask_category_settings, :fields_with_key_group => fields_with_key_group, - :categories => categories, + :categories => categories.collect{|c| [c.id, c]}.to_h, :ask_questions => ask_questions } end diff --git a/app/helpers/admin/asks_helper.rb b/app/helpers/admin/asks_helper.rb index 78e2572..4d8c872 100644 --- a/app/helpers/admin/asks_helper.rb +++ b/app/helpers/admin/asks_helper.rb @@ -321,7 +321,7 @@ module Admin::AsksHelper file_value = value[0] rescue nil file_path = value[1] rescue nil file_required = v['required']=='true' ? 'required="required"' : '' - readonly ? "#{file_value}" : "