fix error

This commit is contained in:
邱博亞 2022-12-31 15:27:56 +08:00
parent 9243160b70
commit 5b7cac3970
2 changed files with 4 additions and 3 deletions

View File

@ -282,7 +282,7 @@ class Admin::AsksController < OrbitAdminController
when 'title','name','mail','phone','appointment' when 'title','name','mail','phone','appointment'
text = text.gsub(format_text,@ask_question.send(format_text[1...-1]).to_s) text = text.gsub(format_text,@ask_question.send(format_text[1...-1]).to_s)
when 'category' 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) text = text.gsub(format_text,cat)
when 'name|mask' when 'name|mask'
name_tp = @ask_question.name.to_s name_tp = @ask_question.name.to_s
@ -330,6 +330,7 @@ class Admin::AsksController < OrbitAdminController
@print_setting = AskPrintSetting.first if @print_setting.nil? @print_setting = AskPrintSetting.first if @print_setting.nil?
@save_name = @print_setting.save_name rescue '' @save_name = @print_setting.save_name rescue ''
@print_text = @print_setting.print_format rescue '' @print_text = @print_setting.print_format rescue ''
@print_text = "<style>img{width: 100%;}</style>"+ @print_text
ask_setting = AskCategorySetting.where(category_id: @ask_question.category_id.to_s, :use_default.ne=>true).first 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? ask_setting = AskSetting.first if ask_setting.nil?
custom_fields = ask_setting.custom_fields custom_fields = ask_setting.custom_fields
@ -465,7 +466,7 @@ class Admin::AsksController < OrbitAdminController
locals: { locals: {
:ask_category_settings => ask_category_settings, :ask_category_settings => ask_category_settings,
:fields_with_key_group => fields_with_key_group, :fields_with_key_group => fields_with_key_group,
:categories => categories, :categories => categories.collect{|c| [c.id, c]}.to_h,
:ask_questions => ask_questions :ask_questions => ask_questions
} }
end end

View File

@ -321,7 +321,7 @@ module Admin::AsksHelper
file_value = value[0] rescue nil file_value = value[0] rescue nil
file_path = value[1] rescue nil file_path = value[1] rescue nil
file_required = v['required']=='true' ? 'required="required"' : '' file_required = v['required']=='true' ? 'required="required"' : ''
readonly ? "<a href=\"#{file_path}\" title=\"file\">#{file_value}</a>" : "<div class=\"file-selector\"><label class=\"ui-button\"> readonly ? (file_path ? "<a href=\"#{file_path}\" title=\"file\">#{file_value}</a>" : "") : "<div class=\"file-selector\"><label class=\"ui-button\">
<input data-src=\"#{file_path}\" style=\"position: absolute;width:0.1em;opacity: 0;padding: 0;border: 0;opacity: 0;left: 50%;top: 0;\" class=\"upload\" name=\"#{field_name}\" #{file_required} type=\"file\" value=\"#{file_value}\"/> <input data-src=\"#{file_path}\" style=\"position: absolute;width:0.1em;opacity: 0;padding: 0;border: 0;opacity: 0;left: 50%;top: 0;\" class=\"upload\" name=\"#{field_name}\" #{file_required} type=\"file\" value=\"#{file_value}\"/>
<i class=\"fa fa-file\"></i> #{t('ask.upload_file')} <i class=\"fa fa-file\"></i> #{t('ask.upload_file')}
</label><div class=\"filename\"></div></div>" </label><div class=\"filename\"></div></div>"