fix error

This commit is contained in:
chiu 2021-02-23 17:28:20 +08:00
parent da75073ecc
commit 4f65a30a85
1 changed files with 6 additions and 6 deletions

View File

@ -178,8 +178,8 @@ class Admin::AsksController < OrbitAdminController
if format_text[-7...-1] == '_title'
case format_text[1...-7]
when /custom\d+/
i = format_text.scan(/\d+/)[0].to_i
k = custom_fields.keys[i-1]
i = format_text.scan(/\d+/)[0]
k = custom_fields.keys.index(i) rescue nil
if !k.blank?
text_tp = custom_fields[k]['field'][I18n.locale] rescue ''
text = text.gsub(format_text,text_tp)
@ -223,16 +223,16 @@ class Admin::AsksController < OrbitAdminController
text = text.gsub(format_text,I18n.t('ask,no'))
end
when /custom\d+\|format/
i = format_text.scan(/\d+/)[0].to_i
k = custom_fields.keys[i-1]
i = format_text.scan(/\d+/)[0]
k = custom_fields.keys.index(i) rescue nil
if !k.blank?
v = custom_fields[k] rescue {}
text_tp = Admin::AsksHelper.show_on_front(k,v,@ask_question.custom_values[k],true,true)
text = text.gsub(format_text,text_tp.to_s)
end
when /custom\d+/
i = format_text.scan(/\d+/)[0].to_i
k = custom_fields.keys[i-1]
i = format_text.scan(/\d+/)[0]
k = custom_fields.keys.index(i) rescue nil
if !k.blank?
v = custom_fields[k] rescue {}
text_tp = Admin::AsksHelper.show_on_front(k,v,@ask_question.custom_values[k],true)