From 7c1164842d7127a39da3b981999659cef17552a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B1=E5=8D=9A=E4=BA=9E?= Date: Fri, 16 Dec 2022 20:02:44 +0800 Subject: [PATCH] Fix bug. --- app/assets/stylesheets/ask/ask.css | 2 +- app/helpers/admin/asks_helper.rb | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/app/assets/stylesheets/ask/ask.css b/app/assets/stylesheets/ask/ask.css index f468a9c..dd0d2b5 100644 --- a/app/assets/stylesheets/ask/ask.css +++ b/app/assets/stylesheets/ask/ask.css @@ -56,5 +56,5 @@ /*驗證碼*/ .text-error { color: #b94a48; - font-size: 10px; + font-size: 0.83em; } \ No newline at end of file diff --git a/app/helpers/admin/asks_helper.rb b/app/helpers/admin/asks_helper.rb index 40fc394..78e2572 100644 --- a/app/helpers/admin/asks_helper.rb +++ b/app/helpers/admin/asks_helper.rb @@ -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 "
#{value_locale}
".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]}" + "" end.join end when 'checkbox'