Compare commits
2 Commits
cbb211401b
...
df25703375
Author | SHA1 | Date |
---|---|---|
邱博亞 | df25703375 | |
邱博亞 | d1266dcfa1 |
|
@ -530,7 +530,9 @@ class AsksController < ApplicationController
|
||||||
old_input = old_.find('input, select');
|
old_input = old_.find('input, select');
|
||||||
if(new_input.length != 0 && old_input.length != 0){
|
if(new_input.length != 0 && old_input.length != 0){
|
||||||
if(new_input.length == old_input.length){
|
if(new_input.length == old_input.length){
|
||||||
old_.clone().replaceAll(new_);
|
var old_clone = old_.clone();
|
||||||
|
old_clone.find('input, select').attr('name', new_input.attr('name'));
|
||||||
|
old_clone.replaceAll(new_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,10 @@
|
||||||
yes_trans = t('ask.yes')
|
yes_trans = t('ask.yes')
|
||||||
no_trans = t('ask.no')
|
no_trans = t('ask.no')
|
||||||
locale = I18n.locale.to_s
|
locale = I18n.locale.to_s
|
||||||
|
ask_setting = AskCategorySetting.enabled.where(category_id: question.category_id.to_s).first
|
||||||
|
ask_setting = AskSetting.first if ask_setting.nil?
|
||||||
|
is_cat_record = (ask_setting.class == AskCategorySetting)
|
||||||
|
tmp_ask_cat_id = (is_cat_record ? ask_setting.id.to_s : '')
|
||||||
%>
|
%>
|
||||||
<% @data['disp_fields_infos'].each do |f, field_info| %>
|
<% @data['disp_fields_infos'].each do |f, field_info| %>
|
||||||
<% next if f == 'recaptcha' %>
|
<% next if f == 'recaptcha' %>
|
||||||
|
@ -24,8 +28,25 @@
|
||||||
is_cat = false
|
is_cat = false
|
||||||
is_custom = false
|
is_custom = false
|
||||||
if f.include?("@")
|
if f.include?("@")
|
||||||
f = field_info["key"]
|
field = f
|
||||||
is_custom = true
|
is_custom = true
|
||||||
|
is_field_enable = false
|
||||||
|
if field.start_with?("default@")
|
||||||
|
f = is_cat_record ? field : field[8..-1]
|
||||||
|
v = ask_setting.custom_fields[f]
|
||||||
|
if v
|
||||||
|
is_field_enable = true
|
||||||
|
end
|
||||||
|
elsif field.start_with?("custom@") && is_cat_record
|
||||||
|
if field.include?(tmp_ask_cat_id)
|
||||||
|
f = field[8+tmp_ask_cat_id.length..-1]
|
||||||
|
v = ask_setting.custom_fields[f]
|
||||||
|
if v
|
||||||
|
is_field_enable = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
next if !is_field_enable
|
||||||
elsif f == 'ask_category_id'
|
elsif f == 'ask_category_id'
|
||||||
f = 'category_id'
|
f = 'category_id'
|
||||||
is_cat = true
|
is_cat = true
|
||||||
|
@ -50,9 +71,9 @@
|
||||||
elsif type == "date"
|
elsif type == "date"
|
||||||
val = val["datetime"].values[0].values rescue []
|
val = val["datetime"].values[0].values rescue []
|
||||||
if val.count == 2
|
if val.count == 2
|
||||||
val = val[0].gsub('-', '/') + " ~ " + val[1].gsub('-', '/')
|
val = val[0].to_s.gsub('-', '/') + " ~ " + val[1].to_s.gsub('-', '/')
|
||||||
else
|
else
|
||||||
val = val[0].gsub('-', '/')
|
val = val[0].to_s.gsub('-', '/')
|
||||||
end
|
end
|
||||||
elsif type == "instructions"
|
elsif type == "instructions"
|
||||||
val = field_info["instructions"][locale].to_s.html_safe rescue ""
|
val = field_info["instructions"][locale].to_s.html_safe rescue ""
|
||||||
|
|
Loading…
Reference in New Issue