diff --git a/app/helpers/admin/application_forms_field_helper.rb b/app/helpers/admin/application_forms_field_helper.rb index e48ad0a..492fbbd 100644 --- a/app/helpers/admin/application_forms_field_helper.rb +++ b/app/helpers/admin/application_forms_field_helper.rb @@ -30,9 +30,9 @@ module Admin::ApplicationFormsFieldHelper 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_af do |key,value| + value = (can_muti_lang_input_for_af? ? @prefiled_value[key] : @prefiled_value) rescue nil + key_field = can_muti_lang_input_for_af? ? "[#{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::ApplicationFormsFieldHelper def render_checkbox @prefiled_value ||=[] - control_group_wrapper do + control_group_wrapper_for_af 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::ApplicationFormsFieldHelper 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_af do case self.typeC['format'] when 'format1' @@ -112,8 +112,8 @@ module Admin::ApplicationFormsFieldHelper 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_af{tmp} + # control_group_wrapper_for_af{date_select(get_field_name_base,nil,@markup_options.merge(:default=>@prefiled_value),:class=>"input-small")} end end @@ -136,7 +136,7 @@ module Admin::ApplicationFormsFieldHelper def render_radio_button @prefiled_value ||=[] - control_group_wrapper do + control_group_wrapper_for_af 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::ApplicationFormsFieldHelper def render_application_form_preferred_session @prefiled_value ||=[] @prefiled_value = Array(@prefiled_value) - control_group_wrapper do + control_group_wrapper_for_af 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::ApplicationFormsFieldHelper 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_af{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_af do |key,value| if !@prefiled_value.nil? - value = can_muti_lang_input? ? @prefiled_value[key] : @prefiled_value + value = can_muti_lang_input_for_af? ? @prefiled_value[key] : @prefiled_value else value = nil end - key = can_muti_lang_input? ? "#{key}" : I18n.locale + key = can_muti_lang_input_for_af? ? "#{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_af? ? (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_af 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_af? ? "#{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_af? ? ([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_af && @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_af && @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_af(*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_af? 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_af(&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_af(&block) + div_class = can_muti_lang_input_for_af? ? "col-sm-10 controls" : "col-sm-10 controls" + # div_class = can_muti_lang_input_for_af? ? "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_af(: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_af(&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_af(&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_af(&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_af? ? '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_af? 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_af(field_sets,key_field,key_index,field,markup='text_field') + @show_set_field_for_af = true + def self.can_muti_lang_input_for_af? 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_af do |key,value| add_more_blank = "" if markup=='text_field' if key_field == 'application_form_email_sets' @@ -540,7 +540,7 @@ protected @key_field = nil @key_index = nil @field = nil - @show_set_field = nil + @show_set_field_for_af = nil return a.html_safe end end \ No newline at end of file diff --git a/app/views/admin/application_forms/_form.html.erb b/app/views/admin/application_forms/_form.html.erb index 0551ced..9721a91 100644 --- a/app/views/admin/application_forms/_form.html.erb +++ b/app/views/admin/application_forms/_form.html.erb @@ -117,10 +117,10 @@ <%= t("application_form_signup.#{attr_signup.field_name}") %>