This commit is contained in:
邱博亞 2022-12-16 20:02:44 +08:00
parent 58a78b8265
commit 7c1164842d
2 changed files with 16 additions and 5 deletions

View File

@ -56,5 +56,5 @@
/*驗證碼*/
.text-error {
color: #b94a48;
font-size: 10px;
font-size: 0.83em;
}

View File

@ -44,7 +44,7 @@ module Admin::AsksHelper
def create_lang_panel_for_ask(field)
tmp2 = content_tag(:div,:class => 'btn-group', :data=>{:toggle=>"buttons-radio"}) do
I18n.available_locales.collect do |key|
link_entry_ary = ["##{field}","_#{key}"]
link_entry_ary = ["##{field}", "_#{key}", @field_postfix]
link_entry = link_entry_ary.join
link_to(I18n.t(key),link_entry,:data=>{:toggle=>"tab"},:class=>"btn #{(key == I18n.locale ? "active" : nil)}",:for=>key)
end.join.html_safe
@ -56,9 +56,14 @@ module Admin::AsksHelper
else
all_field = (get_input_name_for_ask + "[#{field}][parant]").gsub(/[\[@]/,'_').gsub(/\]/,'')
end
if @field_postfix.nil?
@field_postfix = 1
else
@field_postfix += 1
end
tmp = (I18n.available_locales.collect do |locale|
active_flag = ((locale == I18n.locale) ? ' active' : '')
content_tag(:div,:class => "tab-content#{active_flag}",:id=>"#{all_field}_#{locale}") do
content_tag(:div,:class => "tab-content#{active_flag}",:id=>"#{all_field}_#{locale}#{@field_postfix}") do
value_locale = value[locale.to_s] rescue nil
"<div class=\"show_field\" id=\"#{index1 ? "#{get_input_name_for_ask}[#{index1}][#{field}][#{locale}]" : "#{get_input_name_for_ask}[#{field}][#{locale}]"}\">#{value_locale}</div>".html_safe
end
@ -88,9 +93,14 @@ module Admin::AsksHelper
else
all_field = (get_input_name_for_ask + "[#{field}][parant]").gsub(/[\[@]/,'_').gsub(/\]/,'')
end
if @field_postfix.nil?
@field_postfix = 1
else
@field_postfix += 1
end
tmp = (I18n.available_locales.collect do |locale|
active_flag = ((locale == I18n.locale) ? ' active' : '')
content_tag(:div,:class => "tab-content#{active_flag}",:id=>"#{all_field}_#{locale}") do
content_tag(:div,:class => "tab-content#{active_flag}",:id=>"#{all_field}_#{locale}#{@field_postfix}") do
value_locale = value[locale.to_s] rescue nil
if !index1.nil?
self.__send__("#{type_of_tag}_tag","#{get_input_name_for_ask}[#{index1}][#{field}][#{locale}]",value_locale,custom_options)
@ -291,8 +301,9 @@ module Admin::AsksHelper
if lock
format_checkbox(v['options'],value)
else
field_name_underscre = field_name.gsub(/(\[|\])/,'_').gsub('__','_').chomp('_')
readonly ? (v['options'][value.to_s][I18n.locale] rescue '') : Array(v['options']).select{|index1,option| option['disabled'] != 'true'}.collect do |index1,option|
"#{radio_button_tag(field_name,index1,value==index1,{:required => v['required']=='true'})}#{option[I18n.locale]}"
"<label class=\"radio-inline\" for=\"#{field_name_underscre}_#{index1}\">#{radio_button_tag(field_name,index1,value==index1,{:required => v['required']=='true'})}#{option[I18n.locale]}</label>"
end.join
end
when 'checkbox'