This commit is contained in:
邱博亞 2024-07-18 10:40:01 +08:00
parent e786ca6155
commit 0f1dfba46c
1 changed files with 4 additions and 3 deletions

View File

@ -330,11 +330,12 @@ module Admin::AsksHelper
default_key = options_hash.keys[default_idx]
options_values = options_hash.values
value ||= {default_key=>default_key}
readonly ? value.collect{|k1,v1| options_values[v1.to_i][I18n.locale]}.join(', ') : options_hash.collect do |index1,option|
field_name_underscre = field_name.gsub(/(\[|\])/,'_').gsub('__','_').chomp('_')
readonly ? value.collect{|k1,v1| options_values[v1.to_i][I18n.locale]}.join(', ') : ("<span class=\"checkbox\"" + options_hash.collect do |index1,option|
next if option['disabled'] == 'true'
checkbox_option = option[I18n.locale]
"#{check_box_tag("#{field_name}[#{index1}]",index1,value[index1]==index1,{title: checkbox_option})}#{checkbox_option}"
end.compact.join
"<label class=\"checkbox-inline\" for=\"#{field_name_underscre}_#{index1}\">#{check_box_tag("#{field_name}[#{index1}]",index1,value[index1]==index1,{title: checkbox_option})}#{checkbox_option}"
end.compact.join + "</span>")
end
when 'file'
file_value = value[0] rescue nil