From 5a59677e41635507291807db7be59bd2109c8d26 Mon Sep 17 00:00:00 2001 From: BoHung Chiu Date: Wed, 8 Mar 2023 11:18:13 +0800 Subject: [PATCH] Fix function name conflict. --- app/helpers/admin/seminars_field_helper.rb | 72 +++++++++++----------- app/views/admin/seminars/_form.html.erb | 12 ++-- 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/app/helpers/admin/seminars_field_helper.rb b/app/helpers/admin/seminars_field_helper.rb index cb1a445..d2cc36f 100644 --- a/app/helpers/admin/seminars_field_helper.rb +++ b/app/helpers/admin/seminars_field_helper.rb @@ -30,9 +30,9 @@ module Admin::SeminarsFieldHelper end def render_address - control_group_wrapper do |key,value| - value = (can_muti_lang_input? ? @prefiled_value[key] : @prefiled_value) rescue nil - key_field = can_muti_lang_input? ? "[#{key}]" : "" + control_group_wrapper_for_sm do |key,value| + value = (can_muti_lang_input_for_sm? ? @prefiled_value[key] : @prefiled_value) rescue nil + key_field = can_muti_lang_input_for_sm? ? "[#{key}]" : "" place_holder= @panel_setting["placeholder"][key] rescue '' # result = text_area_tag(get_field_name_base + key_field, value,@markup_options.merge({:placeholder=>place_holder,:for=>key})) result = text_field_tag(get_field_name_base + key_field, value,@markup_options.merge({:placeholder=>place_holder,:for=>key})) @@ -50,7 +50,7 @@ module Admin::SeminarsFieldHelper def render_checkbox @prefiled_value ||=[] - control_group_wrapper do + control_group_wrapper_for_sm do a = self.typeE[:option_list].collect do |key,value| label_tag("#{get_basic_field_name_org}_#{self.id}_#{key}",check_box_tag(get_field_name_base+"[#{key}]", true , (@prefiled_value.include?(key) ? true : false), { :id=>"#{get_basic_field_name_org}_#{self.id}_#{key}"})+value[I18n.locale.to_s],@markup_options.merge(:class=>"checkbox inline")) end.join.html_safe rescue "" @@ -63,7 +63,7 @@ module Admin::SeminarsFieldHelper if date_is_range? # fill_from = @attribute_value.get_date(:from) rescue nil # fill_to = @attribute_value.get_date(:to) rescue nil - control_group_wrapper do + control_group_wrapper_for_sm do case self.typeC['format'] when 'format1' @@ -112,8 +112,8 @@ module Admin::SeminarsFieldHelper tmp = datetime_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y")), 'yyyy') end - control_group_wrapper{tmp} - # control_group_wrapper{date_select(get_field_name_base,nil,@markup_options.merge(:default=>@prefiled_value),:class=>"input-small")} + control_group_wrapper_for_sm{tmp} + # control_group_wrapper_for_sm{date_select(get_field_name_base,nil,@markup_options.merge(:default=>@prefiled_value),:class=>"input-small")} end end @@ -136,7 +136,7 @@ module Admin::SeminarsFieldHelper def render_radio_button @prefiled_value ||=[] - control_group_wrapper do + control_group_wrapper_for_sm do self.typeE[:option_list].collect do |key,value| label_tag("#{get_basic_field_name_org}_#{self.id}_#{key}",radio_button_tag(get_field_name_base, key , (@prefiled_value.include?(key) ? true : false), {:required=>@require,:id=>"#{get_basic_field_name_org}_#{self.id}_#{key}"})+value[I18n.locale.to_s],@markup_options.merge(:class=>"radio inline")) end.join.html_safe @@ -145,7 +145,7 @@ module Admin::SeminarsFieldHelper def render_seminar_preferred_session @prefiled_value ||=[] @prefiled_value = Array(@prefiled_value) - control_group_wrapper do + control_group_wrapper_for_sm do @member.summary_chioices.map.with_index do |value,key| key = key.to_s label_tag("#{get_basic_field_name_org}_#{self.id}_#{key}",radio_button_tag(get_field_name_base, key , ((@prefiled_value.include?(key) || @prefiled_value.include?(key.to_i)) ? true : false), {:required=>@require,:id=>"#{get_basic_field_name_org}_#{self.id}_#{key}"})+value,@markup_options.merge(:class=>"radio inline")) @@ -155,29 +155,29 @@ module Admin::SeminarsFieldHelper def render_select prompt = @panel_setting["initial"][I18n.locale.to_s] rescue nil @markup_options.merge!(:prompt => prompt) unless prompt.nil? - control_group_wrapper{select_tag( get_field_name_base,options_for_select(self.typeB["option_list"].collect{|p| [p[1][I18n.locale.to_s],p[0]]},@prefiled_value),@markup_options)} rescue "" + control_group_wrapper_for_sm{select_tag( get_field_name_base,options_for_select(self.typeB["option_list"].collect{|p| [p[1][I18n.locale.to_s],p[0]]},@prefiled_value),@markup_options)} rescue "" end def render_text_area - control_group_wrapper do |key,value| + control_group_wrapper_for_sm do |key,value| if !@prefiled_value.nil? - value = can_muti_lang_input? ? @prefiled_value[key] : @prefiled_value + value = can_muti_lang_input_for_sm? ? @prefiled_value[key] : @prefiled_value else value = nil end - key = can_muti_lang_input? ? "#{key}" : I18n.locale + key = can_muti_lang_input_for_sm? ? "#{key}" : I18n.locale place_holder= typeD["placeholder"][key] rescue '' - name1 = can_muti_lang_input? ? (get_field_name_base + "[#{key}]") : get_field_name_base + name1 = can_muti_lang_input_for_sm? ? (get_field_name_base + "[#{key}]") : get_field_name_base text_area_tag(name1, value,@markup_options.merge(:placeholder=>place_holder,:class=>'ckeditor input-medium form-control')) end end def render_text_field - a = control_group_wrapper do |key,value| + a = control_group_wrapper_for_sm do |key,value| add_more_blank = can_add_more ? "[]" : "" - key_field = can_muti_lang_input? ? "#{key}" : I18n.locale + key_field = can_muti_lang_input_for_sm? ? "#{key}" : I18n.locale place_holder= typeA["placeholder"][key_field] rescue '' - name1 = can_muti_lang_input? ? ([get_field_name_base,add_more_blank,"[#{key_field}]"].join) : ([get_field_name_base,add_more_blank].join) + name1 = can_muti_lang_input_for_sm? ? ([get_field_name_base,add_more_blank,"[#{key_field}]"].join) : ([get_field_name_base,add_more_blank].join) text_field_tag(name1, value,@markup_options.merge(:placeholder=>place_holder,:class=>'input-medium form-control')) end end @@ -210,7 +210,7 @@ protected end # div_class_ary = ["tab-pane" ,"fade","#{get_pairing_tab_class({})}_#{key}"] div_class_ary = ["tab-pane" ,"fade"] - if @show_set_field && @markup=='text_area' + if @show_set_field_for_sm && @markup=='text_area' div_id = "ckeditor_#{get_pairing_tab_class({})}_#{key}" else div_id = "#{get_pairing_tab_class({})}_#{key}" @@ -229,7 +229,7 @@ protected tmp2 = content_tag(:div,:class => 'btn-group', :data=>{:toggle=>"buttons-radio"}) do buff2 = valid_locales.each.collect do |key| # link_entry = self.add_more ? "#{add_more_tab(:tab_btn,loop_counter,key)}" : "#tab"+id.to_s+"_#{key}" - if @show_set_field && @markup=='text_area' + if @show_set_field_for_sm && @markup=='text_area' link_entry_ary = ["#ckeditor_#{get_pairing_tab_class({})}","_#{key}"] else link_entry_ary = ["##{get_pairing_tab_class({})}","_#{key}"] @@ -301,7 +301,7 @@ protected end - def controls_wrapper(*add_more_params,&block) + def controls_wrapper_for_sm(*add_more_params,&block) result = Array.new add_more_counter = "" @@ -312,7 +312,7 @@ protected - if can_muti_lang_input? + if can_muti_lang_input_for_sm? result << lang_panel_tabbable_wrapper(add_more_params,&block) result << gen_modal_dialog if self.markup == "address" # result << add_more_unt if can_add_more @@ -335,11 +335,11 @@ protected result[0] end - end # of def controls_wrapper(&block) + end # of def controls_wrapper_for_sm(&block) - def control_group_wrapper(&block) - div_class = can_muti_lang_input? ? "col-sm-10 controls" : "col-sm-10 controls" - # div_class = can_muti_lang_input? ? "control-group language-swich" : "control-group" + def control_group_wrapper_for_sm(&block) + div_class = can_muti_lang_input_for_sm? ? "col-sm-10 controls" : "col-sm-10 controls" + # div_class = can_muti_lang_input_for_sm? ? "control-group language-swich" : "control-group" result = "" case self.markup @@ -351,7 +351,7 @@ protected multipleInputs = content_tag(:div,:class=>"add-target") do @attribute_value.add_more_counter.times.collect do |t| - controls_wrapper(:value=>(@prefiled_value[t] rescue nil),:counter=>t,&block) + controls_wrapper_for_sm(:value=>(@prefiled_value[t] rescue nil),:counter=>t,&block) end.join('').html_safe # of add_more fields end @@ -363,20 +363,20 @@ protected # result = label + multipleInputs + add_more_unt # result = label + 一堆的輸入框(要用 multipleInput editMore 包起來) + add_more btn + hidden_fields else - result = form_label + content_tag(:div,controls_wrapper(&block),:class=>div_class) + result = form_label + content_tag(:div,controls_wrapper_for_sm(&block),:class=>div_class) end when "address" # address = content_tag :div,:class=>"multipleInput editMore" do address = content_tag :div,:class=>"col-sm-10" do - form_label + content_tag(:div, controls_wrapper(&block), :class=>'add-input') + form_label + content_tag(:div, controls_wrapper_for_sm(&block), :class=>'add-input') end # of div multipleInput editMore result = address else - result = form_label + content_tag(:div,controls_wrapper(&block),:class=>div_class) + result = form_label + content_tag(:div,controls_wrapper_for_sm(&block),:class=>div_class) end result = result + end_block result.html_safe @@ -387,7 +387,7 @@ protected def add_more_unt temp_field_name = get_basic_field_name_base + '[temp]' add_more = content_tag :p,:class=> 'add-btn' do - content = link_to (content_tag :i,I18n.t(:add),:class=>"icon-plus"),"#","data-roles"=>"role_a",:class=>"trigger #{can_muti_lang_input? ? 'textLengInput' : 'textInput' } btn btn-small btn-primary" + content = link_to (content_tag :i,I18n.t(:add),:class=>"icon-plus"),"#","data-roles"=>"role_a",:class=>"trigger #{can_muti_lang_input_for_sm? ? 'textLengInput' : 'textInput' } btn btn-small btn-primary" content << hidden_field_tag("#{temp_field_name}[count]",@attribute_value.add_more_counter ,:class=>"list_count", :id=>nil) content << hidden_field_tag("#{temp_field_name}[count]",get_basic_field_name_base,:class=>"field_name", :id=>nil) content @@ -458,7 +458,7 @@ protected end end - def can_muti_lang_input? + def can_muti_lang_input_for_sm? if self.markup == "address" return true else @@ -483,9 +483,9 @@ protected } ) end - def show_set_field(field_sets,key_field,key_index,field,markup='text_field') - @show_set_field = true - def self.can_muti_lang_input? + def show_set_field_for_sm(field_sets,key_field,key_index,field,markup='text_field') + @show_set_field_for_sm = true + def self.can_muti_lang_input_for_sm? true end def self.can_add_more @@ -524,7 +524,7 @@ protected end @attribute_value = field_sets @prefiled_value = field_sets[field] - a = control_group_wrapper do |key,value| + a = control_group_wrapper_for_sm do |key,value| add_more_blank = "" if markup=='text_field' if key_field == 'seminar_email_sets' @@ -540,7 +540,7 @@ protected @key_field = nil @key_index = nil @field = nil - @show_set_field = nil + @show_set_field_for_sm = nil return a.html_safe end end \ No newline at end of file diff --git a/app/views/admin/seminars/_form.html.erb b/app/views/admin/seminars/_form.html.erb index 2e03105..b35f000 100644 --- a/app/views/admin/seminars/_form.html.erb +++ b/app/views/admin/seminars/_form.html.erb @@ -192,10 +192,10 @@ <%= t("seminar_signup.#{attr_signup.field_name}") %> - <%= show_set_field(attr_signup,'seminar_signup_field_sets_attributes',signup_index,'name') %> + <%= show_set_field_for_sm(attr_signup,'seminar_signup_field_sets_attributes',signup_index,'name') %> - <%= show_set_field(attr_signup,'seminar_signup_field_sets_attributes',signup_index,'placeholder') %> + <%= show_set_field_for_sm(attr_signup,'seminar_signup_field_sets_attributes',signup_index,'placeholder') %> @@ -231,10 +231,10 @@ <%= t("seminar_signup.#{attr_signup.field_name}") %> - <%= show_set_field(attr_signup,'seminar_submission_field_sets_attributes',submission_index,'name') %> + <%= show_set_field_for_sm(attr_signup,'seminar_submission_field_sets_attributes',submission_index,'name') %> - <%= show_set_field(attr_signup,'seminar_submission_field_sets_attributes',submission_index,'placeholder') %> + <%= show_set_field_for_sm(attr_signup,'seminar_submission_field_sets_attributes',submission_index,'placeholder') %> @@ -346,7 +346,7 @@ <%= t('seminar.email_title') %> - <%= show_set_field(@email_set[index1],'seminar_email_sets_attributes',index1,'title','text_field') %> + <%= show_set_field_for_sm(@email_set[index1],'seminar_email_sets_attributes',index1,'title','text_field') %> @@ -355,7 +355,7 @@
- <%= show_set_field(@email_set[index1],'seminar_email_sets_attributes',index1,'content','text_area') %> + <%= show_set_field_for_sm(@email_set[index1],'seminar_email_sets_attributes',index1,'content','text_area') %>