forked from spen/seminar
Merge pull request 'Fix function name conflict.' (#7) from 123/seminar:master into master
Reviewed-on: spen/seminar#7
This commit is contained in:
commit
f25c6b6934
|
@ -30,9 +30,9 @@ module Admin::SeminarsFieldHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_address
|
def render_address
|
||||||
control_group_wrapper do |key,value|
|
control_group_wrapper_for_sm do |key,value|
|
||||||
value = (can_muti_lang_input? ? @prefiled_value[key] : @prefiled_value) rescue nil
|
value = (can_muti_lang_input_for_sm? ? @prefiled_value[key] : @prefiled_value) rescue nil
|
||||||
key_field = can_muti_lang_input? ? "[#{key}]" : ""
|
key_field = can_muti_lang_input_for_sm? ? "[#{key}]" : ""
|
||||||
place_holder= @panel_setting["placeholder"][key] rescue ''
|
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_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}))
|
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
|
def render_checkbox
|
||||||
@prefiled_value ||=[]
|
@prefiled_value ||=[]
|
||||||
control_group_wrapper do
|
control_group_wrapper_for_sm do
|
||||||
a = self.typeE[:option_list].collect do |key,value|
|
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"))
|
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 ""
|
end.join.html_safe rescue ""
|
||||||
|
@ -63,7 +63,7 @@ module Admin::SeminarsFieldHelper
|
||||||
if date_is_range?
|
if date_is_range?
|
||||||
# fill_from = @attribute_value.get_date(:from) rescue nil
|
# fill_from = @attribute_value.get_date(:from) rescue nil
|
||||||
# fill_to = @attribute_value.get_date(:to) 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']
|
case self.typeC['format']
|
||||||
when 'format1'
|
when 'format1'
|
||||||
|
@ -112,8 +112,8 @@ module Admin::SeminarsFieldHelper
|
||||||
tmp = datetime_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y")), 'yyyy')
|
tmp = datetime_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y")), 'yyyy')
|
||||||
end
|
end
|
||||||
|
|
||||||
control_group_wrapper{tmp}
|
control_group_wrapper_for_sm{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{date_select(get_field_name_base,nil,@markup_options.merge(:default=>@prefiled_value),:class=>"input-small")}
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -136,7 +136,7 @@ module Admin::SeminarsFieldHelper
|
||||||
|
|
||||||
def render_radio_button
|
def render_radio_button
|
||||||
@prefiled_value ||=[]
|
@prefiled_value ||=[]
|
||||||
control_group_wrapper do
|
control_group_wrapper_for_sm do
|
||||||
self.typeE[:option_list].collect do |key,value|
|
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"))
|
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
|
end.join.html_safe
|
||||||
|
@ -145,7 +145,7 @@ module Admin::SeminarsFieldHelper
|
||||||
def render_seminar_preferred_session
|
def render_seminar_preferred_session
|
||||||
@prefiled_value ||=[]
|
@prefiled_value ||=[]
|
||||||
@prefiled_value = Array(@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|
|
@member.summary_chioices.map.with_index do |value,key|
|
||||||
key = key.to_s
|
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"))
|
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
|
def render_select
|
||||||
prompt = @panel_setting["initial"][I18n.locale.to_s] rescue nil
|
prompt = @panel_setting["initial"][I18n.locale.to_s] rescue nil
|
||||||
@markup_options.merge!(:prompt => prompt) unless prompt.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
|
end
|
||||||
|
|
||||||
def render_text_area
|
def render_text_area
|
||||||
control_group_wrapper do |key,value|
|
control_group_wrapper_for_sm do |key,value|
|
||||||
if !@prefiled_value.nil?
|
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
|
else
|
||||||
value = nil
|
value = nil
|
||||||
end
|
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 ''
|
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'))
|
text_area_tag(name1, value,@markup_options.merge(:placeholder=>place_holder,:class=>'ckeditor input-medium form-control'))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_text_field
|
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 ? "[]" : ""
|
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 ''
|
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'))
|
text_field_tag(name1, value,@markup_options.merge(:placeholder=>place_holder,:class=>'input-medium form-control'))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -210,7 +210,7 @@ protected
|
||||||
end
|
end
|
||||||
# div_class_ary = ["tab-pane" ,"fade","#{get_pairing_tab_class({})}_#{key}"]
|
# div_class_ary = ["tab-pane" ,"fade","#{get_pairing_tab_class({})}_#{key}"]
|
||||||
div_class_ary = ["tab-pane" ,"fade"]
|
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}"
|
div_id = "ckeditor_#{get_pairing_tab_class({})}_#{key}"
|
||||||
else
|
else
|
||||||
div_id = "#{get_pairing_tab_class({})}_#{key}"
|
div_id = "#{get_pairing_tab_class({})}_#{key}"
|
||||||
|
@ -229,7 +229,7 @@ protected
|
||||||
tmp2 = content_tag(:div,:class => 'btn-group', :data=>{:toggle=>"buttons-radio"}) do
|
tmp2 = content_tag(:div,:class => 'btn-group', :data=>{:toggle=>"buttons-radio"}) do
|
||||||
buff2 = valid_locales.each.collect do |key|
|
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}"
|
# 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}"]
|
link_entry_ary = ["#ckeditor_#{get_pairing_tab_class({})}","_#{key}"]
|
||||||
else
|
else
|
||||||
link_entry_ary = ["##{get_pairing_tab_class({})}","_#{key}"]
|
link_entry_ary = ["##{get_pairing_tab_class({})}","_#{key}"]
|
||||||
|
@ -301,7 +301,7 @@ protected
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def controls_wrapper(*add_more_params,&block)
|
def controls_wrapper_for_sm(*add_more_params,&block)
|
||||||
result = Array.new
|
result = Array.new
|
||||||
add_more_counter = ""
|
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 << lang_panel_tabbable_wrapper(add_more_params,&block)
|
||||||
result << gen_modal_dialog if self.markup == "address"
|
result << gen_modal_dialog if self.markup == "address"
|
||||||
# result << add_more_unt if can_add_more
|
# result << add_more_unt if can_add_more
|
||||||
|
@ -335,11 +335,11 @@ protected
|
||||||
result[0]
|
result[0]
|
||||||
end
|
end
|
||||||
|
|
||||||
end # of def controls_wrapper(&block)
|
end # of def controls_wrapper_for_sm(&block)
|
||||||
|
|
||||||
def control_group_wrapper(&block)
|
def control_group_wrapper_for_sm(&block)
|
||||||
div_class = can_muti_lang_input? ? "col-sm-10 controls" : "col-sm-10 controls"
|
div_class = can_muti_lang_input_for_sm? ? "col-sm-10 controls" : "col-sm-10 controls"
|
||||||
# div_class = can_muti_lang_input? ? "control-group language-swich" : "control-group"
|
# div_class = can_muti_lang_input_for_sm? ? "control-group language-swich" : "control-group"
|
||||||
result = ""
|
result = ""
|
||||||
|
|
||||||
case self.markup
|
case self.markup
|
||||||
|
@ -351,7 +351,7 @@ protected
|
||||||
multipleInputs =
|
multipleInputs =
|
||||||
content_tag(:div,:class=>"add-target") do
|
content_tag(:div,:class=>"add-target") do
|
||||||
@attribute_value.add_more_counter.times.collect do |t|
|
@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.join('').html_safe # of add_more fields
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -363,20 +363,20 @@ protected
|
||||||
# result = label + multipleInputs + add_more_unt
|
# result = label + multipleInputs + add_more_unt
|
||||||
# result = label + 一堆的輸入框(要用 multipleInput editMore 包起來) + add_more btn + hidden_fields
|
# result = label + 一堆的輸入框(要用 multipleInput editMore 包起來) + add_more btn + hidden_fields
|
||||||
else
|
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
|
end
|
||||||
|
|
||||||
when "address"
|
when "address"
|
||||||
|
|
||||||
# address = content_tag :div,:class=>"multipleInput editMore" do
|
# address = content_tag :div,:class=>"multipleInput editMore" do
|
||||||
address = content_tag :div,:class=>"col-sm-10" 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
|
end # of div multipleInput editMore
|
||||||
|
|
||||||
result = address
|
result = address
|
||||||
|
|
||||||
else
|
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
|
end
|
||||||
result = result + end_block
|
result = result + end_block
|
||||||
result.html_safe
|
result.html_safe
|
||||||
|
@ -387,7 +387,7 @@ protected
|
||||||
def add_more_unt
|
def add_more_unt
|
||||||
temp_field_name = get_basic_field_name_base + '[temp]'
|
temp_field_name = get_basic_field_name_base + '[temp]'
|
||||||
add_more = content_tag :p,:class=> 'add-btn' do
|
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]",@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 << hidden_field_tag("#{temp_field_name}[count]",get_basic_field_name_base,:class=>"field_name", :id=>nil)
|
||||||
content
|
content
|
||||||
|
@ -458,7 +458,7 @@ protected
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def can_muti_lang_input?
|
def can_muti_lang_input_for_sm?
|
||||||
if self.markup == "address"
|
if self.markup == "address"
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
|
@ -483,9 +483,9 @@ protected
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
def show_set_field(field_sets,key_field,key_index,field,markup='text_field')
|
def show_set_field_for_sm(field_sets,key_field,key_index,field,markup='text_field')
|
||||||
@show_set_field = true
|
@show_set_field_for_sm = true
|
||||||
def self.can_muti_lang_input?
|
def self.can_muti_lang_input_for_sm?
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
def self.can_add_more
|
def self.can_add_more
|
||||||
|
@ -524,7 +524,7 @@ protected
|
||||||
end
|
end
|
||||||
@attribute_value = field_sets
|
@attribute_value = field_sets
|
||||||
@prefiled_value = field_sets[field]
|
@prefiled_value = field_sets[field]
|
||||||
a = control_group_wrapper do |key,value|
|
a = control_group_wrapper_for_sm do |key,value|
|
||||||
add_more_blank = ""
|
add_more_blank = ""
|
||||||
if markup=='text_field'
|
if markup=='text_field'
|
||||||
if key_field == 'seminar_email_sets'
|
if key_field == 'seminar_email_sets'
|
||||||
|
@ -540,7 +540,7 @@ protected
|
||||||
@key_field = nil
|
@key_field = nil
|
||||||
@key_index = nil
|
@key_index = nil
|
||||||
@field = nil
|
@field = nil
|
||||||
@show_set_field = nil
|
@show_set_field_for_sm = nil
|
||||||
return a.html_safe
|
return a.html_safe
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -192,10 +192,10 @@
|
||||||
<%= t("seminar_signup.#{attr_signup.field_name}") %>
|
<%= t("seminar_signup.#{attr_signup.field_name}") %>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<%= 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') %>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<%= 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') %>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="hidden" class="field_name" name='<%= "seminar_main[seminar_signup_field_sets_attributes][#{signup_index}][field_name]" %>' value="<%= attr_signup.field_name %>">
|
<input type="hidden" class="field_name" name='<%= "seminar_main[seminar_signup_field_sets_attributes][#{signup_index}][field_name]" %>' value="<%= attr_signup.field_name %>">
|
||||||
|
@ -231,10 +231,10 @@
|
||||||
<%= t("seminar_signup.#{attr_signup.field_name}") %>
|
<%= t("seminar_signup.#{attr_signup.field_name}") %>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<%= 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') %>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<%= 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') %>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="hidden" class="field_name" name='<%= "seminar_main[seminar_submission_field_sets_attributes][#{submission_index}][field_name]" %>' value="<%= attr_signup.field_name %>">
|
<input type="hidden" class="field_name" name='<%= "seminar_main[seminar_submission_field_sets_attributes][#{submission_index}][field_name]" %>' value="<%= attr_signup.field_name %>">
|
||||||
|
@ -346,7 +346,7 @@
|
||||||
<%= t('seminar.email_title') %>
|
<%= t('seminar.email_title') %>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<%= 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') %>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -355,7 +355,7 @@
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<%= 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') %>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
Loading…
Reference in New Issue