Compare commits

..

1 Commits

Author SHA1 Message Date
邱博亞 63aa8f569a 整理core 2023-10-10 13:45:49 +08:00
23 changed files with 358 additions and 967 deletions

View File

@ -110,7 +110,6 @@ function setData(l, type, ol) {
_markup: fields+"["+l+"][markup]", _markup: fields+"["+l+"][markup]",
_option_list: ["option_list_"+l+"_"+ol, fields+"["+l+"]["+type+"][option_list]["+ol+"]", "option_list_"+ol], _option_list: ["option_list_"+l+"_"+ol, fields+"["+l+"]["+type+"][option_list]["+ol+"]", "option_list_"+ol],
_placeholder: ["placeholder_" +l, fields+"["+l+"]["+type+"][placeholder]"], _placeholder: ["placeholder_" +l, fields+"["+l+"]["+type+"][placeholder]"],
_instructions: ["instructions_" +l, fields+"["+l+"]["+type+"][instructions]"],
_title_translations: ["title_translations_" +l, fields+"["+l+"][title_translations]"], _title_translations: ["title_translations_" +l, fields+"["+l+"][title_translations]"],
_destroy: ["destroy_" +l, fields+"["+l+"][_destroy]"], _destroy: ["destroy_" +l, fields+"["+l+"][_destroy]"],
_to_require: ["to_require_" +l, fields+"["+l+"][to_require]"], _to_require: ["to_require_" +l, fields+"["+l+"][to_require]"],
@ -118,34 +117,6 @@ function setData(l, type, ol) {
return data; return data;
} }
// Deinit Template HTML (ex: ckeditor)
function deinit_template_html(_this) {
var ckeditor_areas = _this.find('.ckeditor');
if (typeof(CKEDITOR) == 'object') {
ckeditor_areas.each(function(i,v) {
var name = $(v).attr('name');
if (CKEDITOR.instances[name]) {
CKEDITOR.instances[name].destroy();
}
})
}
return _this;
}
// Init Template HTML (ex: ckeditor)
function init_template_html(_this) {
var ckeditor_areas = _this.find('.ckeditor');
if (typeof(CKEDITOR) == 'object') {
ckeditor_areas.each(function(i,v) {
var name = $(v).attr('name');
if (!CKEDITOR.instances[name]) {
CKEDITOR.replace(name);
}
})
}
return _this;
}
// Get Default Address Form // Get Default Address Form
function getAddressForm(trigger, element, decide) { function getAddressForm(trigger, element, decide) {
if(decide) { if(decide) {
@ -285,11 +256,11 @@ $(function() {
nameNumber = nameNumber.match(/[^[\D\]]+(?=])/g)[0]; nameNumber = nameNumber.match(/[^[\D\]]+(?=])/g)[0];
seminar_mainType = $(this).data('seminar_mains') seminar_mainType = $(this).data('seminar_mains')
if($(this).hasClass('textInput')) { if($(this).hasClass('textInput')) {
init_template_html($("#template-text").tmpl().appendTo($(this).closest('.controls').find('.add-target'))); $("#template-text").tmpl().appendTo($(this).closest('.controls').find('.add-target'));
} else if ($(this).hasClass('textLengInput')) { } else if ($(this).hasClass('textLengInput')) {
init_template_html($("#template-text-language").tmpl().appendTo($(this).closest('.controls').find('.add-target'))); $("#template-text-language").tmpl().appendTo($(this).closest('.controls').find('.add-target'));
} else if ($(this).hasClass('address')) { } else if ($(this).hasClass('address')) {
init_template_html($("#template-address").tmpl().appendTo($(this).closest('.controls').find('.add-target'))); $("#template-address").tmpl().appendTo($(this).closest('.controls').find('.add-target'));
} }
inputAppendLength(); inputAppendLength();
}; };
@ -317,7 +288,7 @@ $(function() {
}; };
attributesHeaderLength = $('.attributes:not(:hidden)').length+1; attributesHeaderLength = $('.attributes:not(:hidden)').length+1;
attributesLength = $('#attributes-area .attributes').length; attributesLength = $('#attributes-area .attributes').length;
init_template_html($("#template-attributes").tmpl(setData(attributesLength, default_templateType, appendIndex)).appendTo( "#attributes-area" )); $("#template-attributes").tmpl(setData(attributesLength, default_templateType, appendIndex)).appendTo( "#attributes-area" );
$('.toggle-check').togglebox(); $('.toggle-check').togglebox();
}); });
@ -468,7 +439,7 @@ $(function() {
console.log(appendIndex) console.log(appendIndex)
attributeIndex = $(this).closest('.attributes').index(); attributeIndex = $(this).closest('.attributes').index();
templateType = $(this).closest('.attributes').find('.dataType').children("option:selected").attr('ref'); templateType = $(this).closest('.attributes').find('.dataType').children("option:selected").attr('ref');
init_template_html($("#template-input-append").tmpl(setData(attributeIndex, templateType, appendIndex)).appendTo($(this).closest('.controls').find('.add-target'))); $("#template-input-append").tmpl(setData(attributeIndex, templateType, appendIndex)).appendTo($(this).closest('.controls').find('.add-target'));
inputAppendLength(); inputAppendLength();
}; };
if($(this).hasClass('remove-input')) { if($(this).hasClass('remove-input')) {
@ -483,7 +454,6 @@ $(function() {
$('#attributes-area').delegate('.dataType', 'change', function() { $('#attributes-area').delegate('.dataType', 'change', function() {
$(this).children("option:selected").each(function () { $(this).children("option:selected").each(function () {
var target = $(this).closest('.attributes').find('.field-type').not('.default'); var target = $(this).closest('.attributes').find('.field-type').not('.default');
deinit_template_html(target);
attributeIndex = $(this).closest('.attributes').index(); attributeIndex = $(this).closest('.attributes').index();
appendIndex = 0 appendIndex = 0
// $(this).closest('.attributes').find('.add-target').find('.input-append').length; // $(this).closest('.attributes').find('.add-target').find('.input-append').length;
@ -497,7 +467,7 @@ $(function() {
if($(this).attr('ref')) { if($(this).attr('ref')) {
templateType = $(this).attr('ref'); templateType = $(this).attr('ref');
target.removeAttr('class').addClass('field-type fade in ' + templateType).empty(); target.removeAttr('class').addClass('field-type fade in ' + templateType).empty();
init_template_html($("#template-type").tmpl(setData(attributeIndex, templateType, appendIndex)).appendTo(target)); $("#template-type").tmpl(setData(attributeIndex, templateType, appendIndex)).appendTo(target);
if(templateType == 'typeB' || templateType == 'typeE' || templateType == 'typeF') { if(templateType == 'typeB' || templateType == 'typeE' || templateType == 'typeF') {
inputAppendLength(); inputAppendLength();
} }
@ -511,7 +481,7 @@ $(function() {
if($(this).attr('ref')) { if($(this).attr('ref')) {
templateType = $(this).attr('ref'); templateType = $(this).attr('ref');
target.removeAttr('class').addClass('field-type fade in ' + templateType).empty(); target.removeAttr('class').addClass('field-type fade in ' + templateType).empty();
init_template_html($("#template-type").tmpl(setData(attributeIndex, templateType, appendIndex)).appendTo(target)); $("#template-type").tmpl(setData(attributeIndex, templateType, appendIndex)).appendTo(target);
if(templateType == 'typeB' || templateType == 'typeE' || templateType == 'typeF') { if(templateType == 'typeB' || templateType == 'typeE' || templateType == 'typeF') {
inputAppendLength(); inputAppendLength();
} }

View File

@ -110,7 +110,6 @@ function setData(l, type, ol) {
_markup: fields+"["+l+"][markup]", _markup: fields+"["+l+"][markup]",
_option_list: ["option_list_"+l+"_"+ol, fields+"["+l+"]["+type+"][option_list]["+ol+"]", "option_list_"+ol], _option_list: ["option_list_"+l+"_"+ol, fields+"["+l+"]["+type+"][option_list]["+ol+"]", "option_list_"+ol],
_placeholder: ["placeholder_" +l, fields+"["+l+"]["+type+"][placeholder]"], _placeholder: ["placeholder_" +l, fields+"["+l+"]["+type+"][placeholder]"],
_instructions: ["instructions_" +l, fields+"["+l+"]["+type+"][instructions]"],
_title_translations: ["title_translations_" +l, fields+"["+l+"][title_translations]"], _title_translations: ["title_translations_" +l, fields+"["+l+"][title_translations]"],
_destroy: ["destroy_" +l, fields+"["+l+"][_destroy]"], _destroy: ["destroy_" +l, fields+"["+l+"][_destroy]"],
_to_require: ["to_require_" +l, fields+"["+l+"][to_require]"], _to_require: ["to_require_" +l, fields+"["+l+"][to_require]"],
@ -118,34 +117,6 @@ function setData(l, type, ol) {
return data; return data;
} }
// Deinit Template HTML (ex: ckeditor)
function deinit_template_html(_this) {
var ckeditor_areas = _this.find('.ckeditor');
if (typeof(CKEDITOR) == 'object') {
ckeditor_areas.each(function(i,v) {
var name = $(v).attr('name');
if (CKEDITOR.instances[name]) {
CKEDITOR.instances[name].destroy();
}
})
}
return _this;
}
// Init Template HTML (ex: ckeditor)
function init_template_html(_this) {
var ckeditor_areas = _this.find('.ckeditor');
if (typeof(CKEDITOR) == 'object') {
ckeditor_areas.each(function(i,v) {
var name = $(v).attr('name');
if (!CKEDITOR.instances[name]) {
CKEDITOR.replace(name);
}
})
}
return _this;
}
// Get Default Address Form // Get Default Address Form
function getAddressForm(trigger, element, decide) { function getAddressForm(trigger, element, decide) {
if(decide) { if(decide) {
@ -285,11 +256,11 @@ $(function() {
nameNumber = nameNumber.match(/[^[\D\]]+(?=])/g)[0]; nameNumber = nameNumber.match(/[^[\D\]]+(?=])/g)[0];
seminar_mainType = $(this).data('seminar_mains') seminar_mainType = $(this).data('seminar_mains')
if($(this).hasClass('textInput')) { if($(this).hasClass('textInput')) {
init_template_html($("#template-text").tmpl().appendTo($(this).closest('.controls').find('.add-target'))); $("#template-text").tmpl().appendTo($(this).closest('.controls').find('.add-target'));
} else if ($(this).hasClass('textLengInput')) { } else if ($(this).hasClass('textLengInput')) {
init_template_html($("#template-text-language").tmpl().appendTo($(this).closest('.controls').find('.add-target'))); $("#template-text-language").tmpl().appendTo($(this).closest('.controls').find('.add-target'));
} else if ($(this).hasClass('address')) { } else if ($(this).hasClass('address')) {
init_template_html($("#template-address").tmpl().appendTo($(this).closest('.controls').find('.add-target'))); $("#template-address").tmpl().appendTo($(this).closest('.controls').find('.add-target'));
} }
inputAppendLength(); inputAppendLength();
}; };
@ -317,7 +288,7 @@ $(function() {
}; };
attributesHeaderLength = $('.attributes:not(:hidden)').length+1; attributesHeaderLength = $('.attributes:not(:hidden)').length+1;
attributesLength = $('#attributes-area .attributes').length; attributesLength = $('#attributes-area .attributes').length;
init_template_html($("#template-attributes").tmpl(setData(attributesLength, default_templateType, appendIndex)).appendTo( "#attributes-area" )); $("#template-attributes").tmpl(setData(attributesLength, default_templateType, appendIndex)).appendTo( "#attributes-area" );
$('.toggle-check').togglebox(); $('.toggle-check').togglebox();
}); });
@ -467,7 +438,7 @@ $(function() {
appendIndex = parseInt(appendIndex.match(/[^[\D\]]+(?=])/g)[1])+1; appendIndex = parseInt(appendIndex.match(/[^[\D\]]+(?=])/g)[1])+1;
attributeIndex = $(this).closest('.attributes').index(); attributeIndex = $(this).closest('.attributes').index();
templateType = $(this).closest('.attributes').find('.dataType').children("option:selected").attr('ref'); templateType = $(this).closest('.attributes').find('.dataType').children("option:selected").attr('ref');
init_template_html($("#template-input-append").tmpl(setData(attributeIndex, templateType, appendIndex)).appendTo($(this).closest('.controls').find('.add-target'))); $("#template-input-append").tmpl(setData(attributeIndex, templateType, appendIndex)).appendTo($(this).closest('.controls').find('.add-target'));
inputAppendLength(); inputAppendLength();
}; };
if($(this).hasClass('remove-input')) { if($(this).hasClass('remove-input')) {
@ -482,7 +453,6 @@ $(function() {
$('#attributes-area').delegate('.dataType', 'change', function() { $('#attributes-area').delegate('.dataType', 'change', function() {
$(this).children("option:selected").each(function () { $(this).children("option:selected").each(function () {
var target = $(this).closest('.attributes').find('.field-type').not('.default'); var target = $(this).closest('.attributes').find('.field-type').not('.default');
deinit_template_html(target);
attributeIndex = $(this).closest('.attributes').index(); attributeIndex = $(this).closest('.attributes').index();
appendIndex = 0 appendIndex = 0
// $(this).closest('.attributes').find('.add-target').find('.input-append').length; // $(this).closest('.attributes').find('.add-target').find('.input-append').length;
@ -496,7 +466,7 @@ $(function() {
if($(this).attr('ref')) { if($(this).attr('ref')) {
templateType = $(this).attr('ref'); templateType = $(this).attr('ref');
target.removeAttr('class').addClass('field-type fade in ' + templateType).empty(); target.removeAttr('class').addClass('field-type fade in ' + templateType).empty();
init_template_html($("#template-type").tmpl(setData(attributeIndex, templateType, appendIndex)).appendTo(target)); $("#template-type").tmpl(setData(attributeIndex, templateType, appendIndex)).appendTo(target);
if(templateType == 'typeB' || templateType == 'typeE' || templateType == 'typeF') { if(templateType == 'typeB' || templateType == 'typeE' || templateType == 'typeF') {
inputAppendLength(); inputAppendLength();
} }
@ -510,7 +480,7 @@ $(function() {
if($(this).attr('ref')) { if($(this).attr('ref')) {
templateType = $(this).attr('ref'); templateType = $(this).attr('ref');
target.removeAttr('class').addClass('field-type fade in ' + templateType).empty(); target.removeAttr('class').addClass('field-type fade in ' + templateType).empty();
init_template_html($("#template-type").tmpl(setData(attributeIndex, templateType, appendIndex)).appendTo(target)); $("#template-type").tmpl(setData(attributeIndex, templateType, appendIndex)).appendTo(target);
if(templateType == 'typeB' || templateType == 'typeE' || templateType == 'typeF') { if(templateType == 'typeB' || templateType == 'typeE' || templateType == 'typeF') {
inputAppendLength(); inputAppendLength();
} }

View File

@ -334,7 +334,6 @@ class SeminarsController < ApplicationController
seminar_url = (@prefix_url ? @prefix_url : OrbitHelper.url_to_show(seminar.to_param)) seminar_url = (@prefix_url ? @prefix_url : OrbitHelper.url_to_show(seminar.to_param))
if !registration_is_open if !registration_is_open
sign_up = t('seminar.sign_up_not_open') sign_up = t('seminar.sign_up_not_open')
sign_up_not_yet = true
elsif sign_up_not_yet elsif sign_up_not_yet
sign_up = t('seminar.sign_up_not_yet') sign_up = t('seminar.sign_up_not_yet')
elsif sign_up_overdue elsif sign_up_overdue
@ -346,7 +345,7 @@ class SeminarsController < ApplicationController
sign_up = link_to(sign_up_text, seminar.get_frontend_url(seminar_url), :target=>'_blank', :title=>sign_up_text) sign_up = link_to(sign_up_text, seminar.get_frontend_url(seminar_url), :target=>'_blank', :title=>sign_up_text)
end end
if !seminar.registration_status.blank? && seminar.registration_status.include?('C') && (seminar.contribute_start_date.nil? || seminar.contribute_start_date <= time_now) && ( seminar.contribute_end_date.nil? || seminar.contribute_end_date+1 >= time_now ) if !seminar.registration_status.blank? && seminar.registration_status.include?('C') && seminar.contribute_start_date <= time_now && ( seminar.contribute_end_date.nil? || seminar.contribute_end_date+1 >= time_now )
if @@session[:seminar_signup_id].present? && @@session[:seminar_main_id] == seminar.id if @@session[:seminar_signup_id].present? && @@session[:seminar_main_id] == seminar.id
button_text = t('seminar_signup.uploads') button_text = t('seminar_signup.uploads')
contribute_action = link_to(button_text, seminar.get_frontend_url(seminar_url, :con_upload), :title=>button_text) contribute_action = link_to(button_text, seminar.get_frontend_url(seminar_url, :con_upload), :title=>button_text)
@ -361,7 +360,6 @@ class SeminarsController < ApplicationController
'sign_up' => sign_up, 'sign_up' => sign_up,
'contribute_action' => contribute_action, 'contribute_action' => contribute_action,
'time_now' => time_now, 'time_now' => time_now,
'sign_up_not_yet' => sign_up_not_yet,
'contribute_time_range' => SeminarMain.time_range(seminar.contribute_start_date, seminar.contribute_end_date), 'contribute_time_range' => SeminarMain.time_range(seminar.contribute_start_date, seminar.contribute_end_date),
'sign_up_time_range' => SeminarMain.time_range(seminar.signup_start_date, seminar.signup_end_date), 'sign_up_time_range' => SeminarMain.time_range(seminar.signup_start_date, seminar.signup_end_date),
'seminar_time_range' => SeminarMain.time_range(seminar.seminar_start_date, seminar.seminar_end_date) 'seminar_time_range' => SeminarMain.time_range(seminar.seminar_start_date, seminar.seminar_end_date)
@ -524,13 +522,10 @@ class SeminarsController < ApplicationController
def add_file_proc def add_file_proc
update_params = seminar_signup_contribute_params.merge('seminar_submission_values'=>params['seminar_submission_values'].to_h) update_params = seminar_signup_contribute_params.merge('seminar_submission_values'=>params['seminar_submission_values'])
flag = true flag = true
update_params.permit! update_params.permit!
if update_params['seminar_submission_values'].present? if !update_params['seminar_submission_values'].nil?
if update_params['seminar_submission_values']['0']['value'].nil?
flag = false
else
if update_params['seminar_submission_values']['0']['value'].class==String if update_params['seminar_submission_values']['0']['value'].class==String
value = update_params['seminar_submission_values']['0']['value'] value = update_params['seminar_submission_values']['0']['value']
if !value.to_s.blank? if !value.to_s.blank?
@ -543,7 +538,6 @@ class SeminarsController < ApplicationController
end end
end end
end end
end
else else
flag = false flag = false
end end
@ -580,12 +574,9 @@ class SeminarsController < ApplicationController
def update def update
@con = SeminarSignupContribute.find(params[:seminar_signup_contribute][:id]) @con = SeminarSignupContribute.find(params[:seminar_signup_contribute][:id])
update_params = seminar_signup_contribute_params.merge('seminar_submission_values'=>params['seminar_submission_values'].to_h) update_params = seminar_signup_contribute_params.merge('seminar_submission_values'=>params['seminar_submission_values'])
update_params.permit! update_params.permit!
if update_params['seminar_submission_values'].present? unless update_params['seminar_submission_values'].nil?
if update_params['seminar_submission_values']['0']['value'].nil?
flag = false
else
flag = true flag = true
if update_params['seminar_submission_values']['0']['value'].class==String if update_params['seminar_submission_values']['0']['value'].class==String
value = update_params['seminar_submission_values']['0']['value'] value = update_params['seminar_submission_values']['0']['value']
@ -599,7 +590,6 @@ class SeminarsController < ApplicationController
end end
end end
end end
end
if flag if flag
update_params['seminar_submission_values']['0']['value']['en'] = ' ' update_params['seminar_submission_values']['0']['value']['en'] = ' '
end end

View File

@ -21,114 +21,7 @@ module Admin::SeminarsFieldHelper
@new_attribute = @attribute_value.nil? @new_attribute = @attribute_value.nil?
@attribute_value = @attribute_value || signup.seminar_signup_values.build(seminar_signup_field_id: id) @attribute_value = @attribute_value || signup.seminar_signup_values.build(seminar_signup_field_id: id)
@prefiled_value = @attribute_value.value rescue nil @prefiled_value = @attribute_value.value rescue nil
return instance_eval("render_#{markup}") rescue "" return instance_eval("render_#{markup}(#{required})") rescue ""
end
end
def lang_tab(str,lang)
content_tag(:div,str,:class=>"tab-pane fade",:id=>(get_field_name_base+"tab_#{lang}"))
end
def render_instructions
control_group_wrapper_for_sm do |key,value|
if !@prefiled_value.nil?
value = can_muti_lang_input_for_sm? ? @prefiled_value[key] : @prefiled_value
else
value = nil
end
key = can_muti_lang_input_for_sm? ? "#{key}" : I18n.locale
instructions = (typeG["instructions"].blank? ? "" : typeG["instructions"][key])
name1 = can_muti_lang_input_for_sm? ? (get_field_name_base + "[#{key}]") : get_field_name_base
instructions.html_safe
end
end
def render_address
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}))
add_ext= @attribute_value.address_key[key] rescue {}
result << hidden_field_tag(get_basic_field_name_base+"[address_key][#{key}][county]",add_ext["county"],:class=>"county_#{key}", :id=>nil)
result << hidden_field_tag(get_basic_field_name_base+"[address_key][#{key}][street_address]",add_ext["street_address"],:class=>"street_address_#{key}", :id=>nil)
result << hidden_field_tag(get_basic_field_name_base+"[address_key][#{key}][city]",add_ext["city"],:class=>"city_#{key}", :id=>nil)
result << hidden_field_tag(get_basic_field_name_base+"[address_key][#{key}][zip]",add_ext["zip"],:class=>"zip_#{key}", :id=>nil)
result << hidden_field_tag(get_basic_field_name_base+"[address_key][#{key}][country]",add_ext["country"],:class=>"country_#{key}", :id=>nil)
result << hidden_field_tag(get_basic_field_name_base+"[address_key][#{key}][indicator]",add_ext["indicator"],:class=>"indicator_#{key}", :id=>nil)
end
end
def render_checkbox
@prefiled_value ||=[]
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 ""
end
end
def render_date
d = DateTime.now()
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_for_sm do
case self.typeC['format']
when 'format1'
fill_from = (@prefiled_value && @prefiled_value["from"] ) ? @prefiled_value["from"] : d.strftime("%Y/%m/%d %H:%M")
fill_to = (@prefiled_value && @prefiled_value["to"] ) ? @prefiled_value["to"] : d.strftime("%Y/%m/%d %H:%M")
buf = datetime_picker(get_field_name_base+'[from]', fill_from, 'yyyy/MM/dd hh:mm', true)
buf << ' ~ '
buf << datetime_picker(get_field_name_base+'[to]', fill_to, 'yyyy/MM/dd hh:mm', true)
when 'format2'
fill_from = (@prefiled_value && @prefiled_value["from"] ) ? @prefiled_value["from"] : d.strftime("%Y/%m/%d")
fill_to = (@prefiled_value && @prefiled_value["to"] ) ? @prefiled_value["to"] : d.strftime("%Y/%m/%d")
buf = datetime_picker(get_field_name_base+'[from]', fill_from, 'yyyy/MM/dd')
buf << ' ~ '
buf << datetime_picker(get_field_name_base+'[to]', fill_to, 'yyyy/MM/dd')
when 'format3'
fill_from = (@prefiled_value && @prefiled_value["from"] ) ? @prefiled_value["from"] : d.strftime("%Y/%m")
fill_to = (@prefiled_value && @prefiled_value["to"] ) ? @prefiled_value["to"] : d.strftime("%Y/%m/")
buf = datetime_picker(get_field_name_base+'[from]', fill_from, 'yyyy/MM')
buf << ' ~ '
buf << datetime_picker(get_field_name_base+'[to]', fill_to, 'yyyy/MM')
when 'format4'
fill_from = (@prefiled_value && @prefiled_value["from"] ) ? @prefiled_value["from"] : d.strftime("%Y")
fill_to = (@prefiled_value && @prefiled_value["to"] ) ? @prefiled_value["to"] : d.strftime("%Y")
buf = datetime_picker(get_field_name_base+'[from]', fill_from, 'yyyy')
buf << ' ~ '
buf << datetime_picker(get_field_name_base+'[to]', fill_to, 'yyyy')
end
# buf = date_select(get_field_name_base+'[from]',nil,@markup_options.merge(:default=>fill_from),:class=>"input-small")
# buf << ' ~ '
# buf << date_select(get_field_name_base+'[to]',nil,@markup_options.merge(:default=>fill_to),:class=>"input-small")
buf
end
else
# @prefiled_value = @attribute_value.get_date
# @prefiled_value = @attribute_value.get_date
case self.typeC['format']
when 'format1'
tmp = datetime_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y/%m/%d %H:%M")), 'yyyy/MM/dd hh:mm', true)
when 'format2'
tmp = datetime_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y/%m/%d")), 'yyyy/MM/dd')
when 'format3'
tmp = datetime_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y/%m")), 'yyyy/MM')
when 'format4'
tmp = datetime_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y")), 'yyyy')
end
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
end end
@ -144,19 +37,7 @@ module Admin::SeminarsFieldHelper
end end
end end
def render_date_durnation #Need re-write low priority def render_seminar_preferred_session(required = false)
end
def render_radio_button
@prefiled_value ||=[]
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
end
end
def render_seminar_preferred_session
@prefiled_value ||=[] @prefiled_value ||=[]
@prefiled_value = Array(@prefiled_value) @prefiled_value = Array(@prefiled_value)
control_group_wrapper_for_sm do control_group_wrapper_for_sm do
@ -166,290 +47,9 @@ module Admin::SeminarsFieldHelper
end.join.html_safe end.join.html_safe
end if @seminar_main.enable_summary_choice end if @seminar_main.enable_summary_choice
end end
def render_select
prompt = @panel_setting["initial"][I18n.locale.to_s] rescue nil
@markup_options.merge!(:prompt => prompt) unless prompt.nil?
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_for_sm do |key,value|
if !@prefiled_value.nil?
value = can_muti_lang_input_for_sm? ? @prefiled_value[key] : @prefiled_value
else
value = nil
end
key = can_muti_lang_input_for_sm? ? "#{key}" : I18n.locale
place_holder= typeD["placeholder"][key] rescue ''
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_for_sm do |key,value|
add_more_blank = can_add_more ? "[]" : ""
key_field = can_muti_lang_input_for_sm? ? "#{key}" : I18n.locale
place_holder= typeA["placeholder"][key_field] rescue ''
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
def render_file_field
a = control_group_wrapper_for_sm do |key,value|
add_more_blank = can_add_more ? "[]" : ""
key_field = can_muti_lang_input? ? "[#{key}]" : ""
field_name = [get_field_name_base,add_more_blank,key_field].join
file_required =@require ? 'required="required"' : ''
"<div class=\"file-selector\"><label class=\"ui-button\">
<input style=\"position: absolute;width:0.1em;opacity: 0;padding: 0;border: 0;opacity: 0;left: 50%;top: 0;\" class=\"upload\" name=\"#{field_name}\" #{file_required} type=\"file\" />
<i class=\"fa fa-file\"></i> #{I18n.t('file.upload')}
</label><div class=\"filename\"></div></div>#{value}".html_safe
end
end
def date_is_range?
is_range = "false"
data = get_data
if !data.nil?
is_range = data['is_range'] if data.has_key? "is_range"
end
is_range == "true"
end
protected protected
def valid_locales
site = Site.first
[I18n.locale]+(site.valid_locales-[I18n.locale])
end
def lang_panel_tabbable_wrapper_for_sm(add_more_params,&block)
add_more_counter = ''
if self.markup=='text_area' #or self.markup=='address'
tmp1 = valid_locales.collect do |key|
if !@prefiled_value.nil?
value = @prefiled_value[key] || @prefiled_value[key.to_s] rescue nil
else
value = nil
end
# div_class_ary = ["tab-pane" ,"fade","#{get_pairing_tab_class({})}_#{key}"]
div_class_ary = ["tab-pane" ,"fade"]
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}"
end
if can_add_more
add_more_value = add_more_params[0][:value]
add_more_counter = add_more_params[0][:counter]
value = add_more_value[key] rescue nil
div_class_ary << "add_more_item_#{add_more_counter}"
end
div_class = div_class_ary.join(" ")
div_class << (key == I18n.locale ? " active in" : '')
content_tag(:div,yield(key,value), :id=>div_id,:class=>div_class)
end# of VALID_LOCALES.collect for tabed input
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_for_sm && @markup=='text_area'
link_entry_ary = ["#ckeditor_#{get_pairing_tab_class({})}","_#{key}"]
else
link_entry_ary = ["##{get_pairing_tab_class({})}","_#{key}"]
end
link_entry_ary << ".add_more_item_#{add_more_counter}" if can_add_more
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 # of VALID_LOCALES.collect for tabs
buff2 << link_to((content_tag :i,'',:class=>'icon-edit'),"##{get_pairing_tab_class({})}_m_window", :role=>"button",:class=>'btn',:data=>{:toggle=>"modal"}) if self.markup == 'address'
buff2 << link_to((content_tag :i,'',:class=>'icon-trash'),"#",:class=>"btn remove-input") if self.add_more
buff2.join.html_safe
end # of content ul
tmp = content_tag :div,:class=> "tab-content textarea-lang" do
tmp2 << tmp1.join('').html_safe
end
else
# tmp = content_tag :div,:class=> (add_more || self.markup=='address') ? "input-append" : "tab-content" do
tmp1 =
content_tag :div,:class=> "tab-content" do
buff = valid_locales.collect do |key|
value = @prefiled_value[key] || @prefiled_value[key.to_s] rescue nil
# div_class_ary = ["tab-pane" ,"fade","#{get_pairing_tab_class({})}_#{key}"]
div_class_ary = ["tab-pane" ,"fade"]
div_id = "#{get_pairing_tab_class({})}_#{key}"
if can_add_more
add_more_value = add_more_params[0][:value]
add_more_counter = add_more_params[0][:counter]
value = add_more_value[key] rescue nil
div_class_ary << "add_more_item_#{add_more_counter}"
end
div_class = div_class_ary.join(" ")
div_class << (key == I18n.locale ? " active in" : '')
content_tag(:div,yield(key,value), :id=>div_id,:class=>div_class)
end# of VALID_LOCALES.collect for tabed input
buff.join('').html_safe
end
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}"
link_entry_ary = ["##{get_pairing_tab_class({})}","_#{key}"]
link_entry_ary << ".add_more_item_#{add_more_counter}" if can_add_more
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 # of VALID_LOCALES.collect for tabs
buff2 << link_to((content_tag :i,'',:class=>'icon-edit'),"#address-field", :role=>"button",:class=>'btn',:data=>{:toggle=>"modal"}) if self.markup == 'address'
buff2 << link_to((content_tag :i,'',:class=>'icon-trash'),"#",:class=>"btn remove-input") if self.add_more
buff2.join.html_safe
end # of content ul
tmp = content_tag :div,:class=> "input-append" do
tmp1 << tmp2
end
end
end
def controls_wrapper_for_sm(*add_more_params,&block)
result = Array.new
add_more_counter = ""
if can_add_more
add_more_counter = add_more_params[0][:counter]
add_more_value = add_more_params[0][:value]
end
if can_muti_lang_input_for_sm?
result << lang_panel_tabbable_wrapper_for_sm(add_more_params,&block)
result << gen_modal_dialog if self.markup == "address"
# result << add_more_unt if can_add_more
else #cross lang field
case can_add_more
when true
value = add_more_params[0][:value]
result << content_tag(:div,:class=>"input-append"){yield(nil,value) + link_to((content_tag :i,'',:class=>'icon-trash'),"#",:class=>"btn remove-input") }
# result << add_more_unt
else
value = @prefiled_value
result << yield(nil,value)
end
end
if self.markup == "address"
result
else
result[0]
end
end # of def controls_wrapper_for_sm(&block)
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
when "text_field"
if can_add_more
multipleInputs =
content_tag(:div,:class=>"add-target") do
@attribute_value.add_more_counter.times.collect do |t|
controls_wrapper_for_sm(:value=>(@prefiled_value[t] rescue nil),:counter=>t,&block)
end.join('').html_safe # of add_more fields
end
temp = content_tag(:div, multipleInputs + add_more_unt, :class=>'add-input')
result = form_label + content_tag(:div,temp,:class=>div_class)
# result = label + multipleInputs + add_more_unt
# result = label + 一堆的輸入框(要用 multipleInput editMore 包起來) + add_more btn + hidden_fields
else
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_for_sm(&block), :class=>'add-input')
end # of div multipleInput editMore
result = address
else
result = form_label + content_tag(:div,controls_wrapper_for_sm(&block),:class=>div_class)
end
result = result + end_block
result.html_safe
end
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_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
end # of div
# add_more = content_tag :div,:class=> 'controls' do
# content_tag :span,:class=> 'help-block' do
# content = link_to (content_tag :i,I18n.t(:add),:class=>"icon-plus-sign"),"#",:class=>'addinput'
# content << hidden_field_tag("#{temp_field_name}[count]",@attribute_value.add_more_counter ,:class=>"list_count")
# content << hidden_field_tag("#{temp_field_name}[count]",get_basic_field_name_base,:class=>"field_name")
# content
# end # of span
# end # of div
end
def end_block
if @new_attribute
hidden_field_tag(get_basic_field_name_base+"[#{get_basic_field_name}_id]",id,:for=>"field_#{@index}", :id=>nil)
else
hidden_field_tag(get_basic_field_name_base+"[id]",@attribute_value.id,:for=>"field_#{@index}", :id=>nil)
end
end
def add_more_tab(mode,counter,key)
case mode
when :input_field
get_pairing_tab_class(:suffix=>['','tab'+counter.to_s,key].join('-'))
when :tab_btn
".#{get_pairing_tab_class(:suffix=>['','tab'+counter.to_s,key].join('-'))}"
end
end
def get_pairing_tab_class(opts)
prefix = opts[:prefix]
suffix = opts[:suffix]
str = get_basic_field_name_base.gsub("[","_").gsub("]",'')
str = prefix.nil? ? str : prefix+ str
suffix.nil? ? str : str + suffix
end
def get_basic_field_name_org def get_basic_field_name_org
"seminar_signup_values" "seminar_signup_values"
end end
@ -462,25 +62,6 @@ protected
"#{get_basic_field_name_org}[#{@index}]" "#{get_basic_field_name_org}[#{@index}]"
end end
def get_field_name_base
get_basic_field_name_base + "[value]"
end
def form_label
if self.markup == "text_area"
plc = typeD["placeholder"][I18n.locale].to_s.blank? ? nil : "(#{typeD["placeholder"][I18n.locale]})"
label_tag(key, '' , :class=>"col-sm-2 control-label muted") do
concat (!@require.blank? ? '*'+title : title)
if plc
concat tag(:br)
concat plc
end
end
else
label_tag(key,(!@require.blank? ? '*'+title : title),:class=>"col-sm-2 control-label muted")
end
end
def can_muti_lang_input_for_sm? def can_muti_lang_input_for_sm?
if self.markup == "address" if self.markup == "address"
return true return true
@ -488,24 +69,6 @@ protected
$seminar_list[:markups][markup]["muti_lang_input_supprt"] and !(get_data["cross_lang"] == "true") $seminar_list[:markups][markup]["muti_lang_input_supprt"] and !(get_data["cross_lang"] == "true")
end end
end end
def can_add_more
if self.markup == "address"
return false
else
add_more
end
end
def gen_modal_dialog
render_anywhere("shared/attribute_field/address_modal_dialog",{
:field_name=>title,
:html_id=>"address-field",
:btn_class => "#{get_pairing_tab_class({})}",
:field_name_basic => get_basic_field_name_base
}
)
end
def show_set_field_for_sm(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_for_sm = true @show_set_field_for_sm = true
def self.can_muti_lang_input_for_sm? def self.can_muti_lang_input_for_sm?

View File

@ -24,7 +24,6 @@ class SeminarSignupField
field :typeD, type: Hash, default: {cross_lang: false} field :typeD, type: Hash, default: {cross_lang: false}
field :typeE, type: Hash, default: {} field :typeE, type: Hash, default: {}
field :typeF, type: Hash, default: {} field :typeF, type: Hash, default: {}
field :typeG, type: Hash, default: {}
belongs_to :seminar_main belongs_to :seminar_main
has_many :seminar_signup_values, autosave: true, dependent: :destroy has_many :seminar_signup_values, autosave: true, dependent: :destroy
accepts_nested_attributes_for :seminar_signup_values, :allow_destroy => true accepts_nested_attributes_for :seminar_signup_values, :allow_destroy => true

View File

@ -24,7 +24,6 @@ class SeminarSubmissionField
field :typeD, type: Hash, default: {cross_lang: false} field :typeD, type: Hash, default: {cross_lang: false}
field :typeE, type: Hash, default: {} field :typeE, type: Hash, default: {}
field :typeF, type: Hash, default: {cross_lang: "true"} field :typeF, type: Hash, default: {cross_lang: "true"}
field :typeG, type: Hash, default: {}
belongs_to :seminar_main belongs_to :seminar_main
has_many :seminar_submission_values, autosave: true, dependent: :destroy has_many :seminar_submission_values, autosave: true, dependent: :destroy
accepts_nested_attributes_for :seminar_submission_values, :allow_destroy => true accepts_nested_attributes_for :seminar_submission_values, :allow_destroy => true

View File

@ -129,34 +129,6 @@
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:field_name=>"#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}][typeE][option_list]",:values=>attribute_field["typeE"]["option_list"]}%> <%= render :partial=>"shared/attribute_field/list_block",:locals=>{:field_name=>"#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}][typeE][option_list]",:values=>attribute_field["typeE"]["option_list"]}%>
<% end if show_seminar_type_panel(attribute_field,"typeE") != 'typeE hide' %> <% end if show_seminar_type_panel(attribute_field,"typeE") != 'typeE hide' %>
<%= content_tag :div,:class=>"field-type default fade in #{show_seminar_type_panel(attribute_field,"typeG")}" do%>
<% typeG_field_name = "#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}][typeG][instructions]" %>
<%= content_tag :div, class: "control-group" do %>
<label class="control-label muted" for=""><%= t('lists.markups.instructions') %></label>
<div class="controls">
<div class="input-append">
<div class="btn-group-clearfix">
<div class="btn-group" data-toggle="buttons-radio">
<% @site_in_use_locales.each do |locale| %>
<% active = (locale == @site_in_use_locales.first ? "active" : "") %>
<%= link_to t(locale).to_s,"##{name_to_id(typeG_field_name)}_#{locale}",:class=>"btn #{active}",:data=>{:toggle=>"tab"}%>
<% end %>
</div>
</div>
<div class="tab-content">
<% @site_in_use_locales.each do |locale| %>
<% active = (locale == @site_in_use_locales.first ? "active in" : "'") %>
<%= content_tag :div, {class: "tab-pane fade #{active}", id: "#{name_to_id(typeG_field_name)}_#{locale}"} do %>
<% locale_value = (attribute_field["typeG"].present? ? attribute_field["typeG"]["instructions"][locale.to_s] : "") %>
<%= text_area(typeG_field_name, locale, value: locale_value, placeholder: "#{t(locale).to_s}", data: {:type=>"lang_#{locale}"}, class: 'ckeditor') %>
<% end %>
<% end %>
</div>
</div>
</div>
<% end %>
<% end if show_seminar_type_panel(attribute_field,"typeG") != 'typeG hide' %>
<%= hidden_field "#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}]","id",:value=>attribute_field.id%> <%= hidden_field "#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}]","id",:value=>attribute_field.id%>
</div> </div>

View File

@ -128,7 +128,6 @@
<%= content_tag :div,:class=>"field-type default fade in #{show_seminar_type_panel(attribute_submission_field,"typeE")}" do%> <%= content_tag :div,:class=>"field-type default fade in #{show_seminar_type_panel(attribute_submission_field,"typeE")}" do%>
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:field_name=>"#{@field_name}[seminar_submission_fields_attributes][#{@af_counter}][typeE][option_list]",:values=>attribute_submission_field["typeE"]["option_list"]}%> <%= render :partial=>"shared/attribute_field/list_block",:locals=>{:field_name=>"#{@field_name}[seminar_submission_fields_attributes][#{@af_counter}][typeE][option_list]",:values=>attribute_submission_field["typeE"]["option_list"]}%>
<% end if show_seminar_type_panel(attribute_submission_field,"typeE") != 'typeE hide' %> <% end if show_seminar_type_panel(attribute_submission_field,"typeE") != 'typeE hide' %>
<%= content_tag :div,:class=>"field-type default fade in #{show_seminar_type_panel(attribute_submission_field,"typeF")}" do%> <%= content_tag :div,:class=>"field-type default fade in #{show_seminar_type_panel(attribute_submission_field,"typeF")}" do%>
<div class="control-group"> <div class="control-group">
<label class="control-label muted" for=""><%= t(:options)%></label> <label class="control-label muted" for=""><%= t(:options)%></label>
@ -141,35 +140,6 @@
</div> </div>
</div> </div>
<% end if show_seminar_type_panel(attribute_submission_field,"typeF") != 'typeF hide' %> <% end if show_seminar_type_panel(attribute_submission_field,"typeF") != 'typeF hide' %>
<%= content_tag :div,:class=>"field-type default fade in #{show_seminar_type_panel(attribute_submission_field,"typeG")}" do%>
<% typeG_field_name = "#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}][typeG][instructions]" %>
<%= content_tag :div, class: "control-group" do %>
<label class="control-label muted" for=""><%= t('lists.markups.instructions') %></label>
<div class="controls">
<div class="input-append">
<div class="btn-group-clearfix">
<div class="btn-group" data-toggle="buttons-radio">
<% @site_in_use_locales.each do |locale| %>
<% active = (locale == @site_in_use_locales.first ? "active" : "") %>
<%= link_to t(locale).to_s,"##{name_to_id(typeG_field_name)}_#{locale}",:class=>"btn #{active}",:data=>{:toggle=>"tab"}%>
<% end %>
</div>
</div>
<div class="tab-content">
<% @site_in_use_locales.each do |locale| %>
<% active = (locale == @site_in_use_locales.first ? "active in" : "'") %>
<%= content_tag :div, {class: "tab-pane fade #{active}", id: "#{name_to_id(typeG_field_name)}_#{locale}"} do %>
<% locale_value = (attribute_submission_field["typeG"].present? ? attribute_submission_field["typeG"]["instructions"][locale.to_s] : "") %>
<%= text_area(typeG_field_name, locale, value: locale_value, placeholder: "#{t(locale).to_s}", data: {:type=>"lang_#{locale}"}, class: 'ckeditor') %>
<% end %>
<% end %>
</div>
</div>
</div>
<% end %>
<% end if show_seminar_type_panel(attribute_submission_field,"typeG") != 'typeG hide' %>
<%= hidden_field "#{@field_name}[seminar_submission_fields_attributes][#{@af_counter}]","id",:value=>attribute_submission_field.id%> <%= hidden_field "#{@field_name}[seminar_submission_fields_attributes][#{@af_counter}]","id",:value=>attribute_submission_field.id%>
</div> </div>

View File

@ -112,7 +112,7 @@
<script id="template-type" type="text/x-tmpl"> <script id="template-type" type="text/x-tmpl">
{{if templateType == 'typeA' || templateType == 'typeD'}} {{if templateType == 'typeA' || templateType == 'typeD' || templateType == 'typeG'}}
<div class="control-group"> <div class="control-group">
<label class="control-label muted"><%= t(:enabled_for)%></label> <label class="control-label muted"><%= t(:enabled_for)%></label>
<div class="controls"> <div class="controls">
@ -122,7 +122,7 @@
<%= t(:cross_lang) %> <%= t(:cross_lang) %>
</label> </label>
{{/if}} {{/if}}
{{if templateType == 'typeA'}} {{if templateType == 'typeA' || templateType == 'typeG'}}
<label class="checkbox inline"> <label class="checkbox inline">
<input type="checkbox" data-type="extendable_field" id="${_add_more[0]}" name="${_add_more[1]}" value="true"> <input type="checkbox" data-type="extendable_field" id="${_add_more[0]}" name="${_add_more[1]}" value="true">
<%= t(:add_more)%> <%= t(:add_more)%>
@ -257,35 +257,6 @@
</div> </div>
</div> </div>
{{/if}} {{/if}}
{{if templateType == 'typeG'}}
<div class="control-group">
<label class="control-label muted">
<%= t('lists.markups.instructions') %>
</label>
<div class="controls">
<div class="input-append">
<div class="btn-group-clearfix">
<div class="btn-group" data-toggle="buttons-radio">
<% @site_in_use_locales.each do |locale| %>
<% active = (locale == @site_in_use_locales.first ? "active" : "") %>
<a class="btn <%= active %>" href="${'#'+_instructions[0]+'_<%= locale %>'}" data-toggle="tab">
<%= t(locale).to_s %>
</a>
<% end %>
</div>
</div>
<div class="tab-content">
<% @site_in_use_locales.each do |locale| %>
<% active = (locale == @site_in_use_locales.first ? "active" : "") %>
<div class="tab-pane <%= active %> fade in" id="${_instructions[0]+'_<%= locale %>'}">
<textarea class="ckeditor" data-type="lang_<%= locale %>" placeholder="<%= t(locale).to_s %>" name="${_instructions[1]+'[<%= locale %>]'}"></textarea>
</div>
<% end %>
</div>
</div>
</div>
</div>
{{/if}}
</script> </script>

View File

@ -10,7 +10,7 @@
<%= javascript_include_tag "seminar-field-forms.js" %> <%= javascript_include_tag "seminar-field-forms.js" %>
<% end -%> <% end -%>
<%= form_for @attribute, url: admin_seminar_path(@attribute) , html: { class: "form-horizontal main-forms" } do |f| %> <%= form_for @attribute,:url => admin_seminar_path(@attribute) , :html => { :class=> "form-horizontal main-forms" } do |f| %>
<% if flash.now[:notice].present? %> <% if flash.now[:notice].present? %>
<%= flash.now[:notice]%> <%= flash.now[:notice]%>
<% end %> <% end %>

View File

@ -9,7 +9,7 @@
<%= javascript_include_tag "lib/jquery.tmpl.min.js" %> <%= javascript_include_tag "lib/jquery.tmpl.min.js" %>
<%= javascript_include_tag "seminar-field-forms-submission.js" %> <%= javascript_include_tag "seminar-field-forms-submission.js" %>
<% end -%> <% end -%>
<%= form_for @attribute, url: admin_seminar_path(@attribute) , html: { class: "form-horizontal main-forms" } do |f| %> <%= form_for @attribute,:url => admin_seminar_path(@attribute) , :html => { :class=> "form-horizontal main-forms" } do |f| %>
<% if flash.now[:notice].present? %> <% if flash.now[:notice].present? %>
<%= flash.now[:notice]%> <%= flash.now[:notice]%>
<% end %> <% end %>

View File

@ -9,7 +9,7 @@
color: red; color: red;
} }
</style> </style>
<% if (@seminar.contribute_start_date.nil? || @seminar.contribute_start_date <= @time_now) && (@seminar.contribute_end_date.nil? or @seminar.contribute_end_date+1 >= @time_now ) %> <% if (@seminar.contribute_start_date <= @time_now && (@seminar.contribute_end_date.nil? or @seminar.contribute_end_date+1 >= @time_now ) rescue false) %>
<section id="main-wrap"> <section id="main-wrap">
<div class="sign-in have-other-sign-in"> <div class="sign-in have-other-sign-in">

View File

@ -9,9 +9,9 @@
data1 = @seminar.seminar_submission_field_sets.select{|v| v.field_name=='title'}[0] data1 = @seminar.seminar_submission_field_sets.select{|v| v.field_name=='title'}[0]
data2 = @seminar.seminar_submission_field_sets.select{|v| v.field_name=='description'}[0] data2 = @seminar.seminar_submission_field_sets.select{|v| v.field_name=='description'}[0]
data3 = @seminar.seminar_submission_field_sets.select{|v| v.field_name=='file'}[0] data3 = @seminar.seminar_submission_field_sets.select{|v| v.field_name=='file'}[0]
show1 = data1 ? !(data1.disabled) : false show1 = !(data1.disabled) rescue false
show2 = data2 ? !(data2.disabled) : false show2 = !(data2.disabled) rescue false
show3 = data3 ? !(data3.disabled) : false show3 = !(data3.disabled) rescue false
name1 = data1['name'][I18n.locale] name1 = data1['name'][I18n.locale]
name2 = data2['name'][I18n.locale] name2 = data2['name'][I18n.locale]
name3 = data3['name'][I18n.locale] name3 = data3['name'][I18n.locale]
@ -22,7 +22,7 @@
prefix_url = OrbitHelper.url_to_show(@seminar.to_param) prefix_url = OrbitHelper.url_to_show(@seminar.to_param)
end end
%> %>
<% if (@seminar.contribute_start_date.nil? || @seminar.contribute_start_date <= @time_now) && ( @seminar.contribute_end_date.nil? || @seminar.contribute_end_date+1 >= @time_now ) %> <% if @seminar.contribute_start_date <= @time_now and ( @seminar.contribute_end_date.nil? or @seminar.contribute_end_date+1 >= @time_now ) %>
<% begin %> <% begin %>
<% if !session[:seminar_signup_id].blank? %> <% if !session[:seminar_signup_id].blank? %>
<%=t('seminar_signup.serial_number') %>: <%=@seminar_signup.display_serial_number rescue ""%> <%=t('seminar_signup.serial_number') %>: <%=@seminar_signup.display_serial_number rescue ""%>

View File

@ -10,7 +10,6 @@
@seminar_time_range = data["seminar_time_range"] @seminar_time_range = data["seminar_time_range"]
@contribute_time_range = data["contribute_time_range"] @contribute_time_range = data["contribute_time_range"]
@contribute_action = data["contribute_action"] @contribute_action = data["contribute_action"]
@sign_up_not_yet = data["sign_up_not_yet"]
%> %>
@ -20,7 +19,7 @@
<th class="seminarive-title-field"><%= t(:category) %></th> <th class="seminarive-title-field"><%= t(:category) %></th>
<td class="seminarive-title-value"><%= @seminar.category.title %></td> <td class="seminarive-title-value"><%= @seminar.category.title %></td>
</tr> </tr>
<tr <%= 'class="hidden"'.html_safe if @seminar_time_range.blank? %>> <tr>
<th class="seminarive-title-field"><i class="fa fa-calendar fa-fw"></i><%= t('seminar.event_during') %></th> <th class="seminarive-title-field"><i class="fa fa-calendar fa-fw"></i><%= t('seminar.event_during') %></th>
<td class="seminarive-title-value"><%= @seminar_time_range %></td> <td class="seminarive-title-value"><%= @seminar_time_range %></td>
</tr> </tr>
@ -40,7 +39,7 @@
<td class="seminarive-title-value"><%= nl2br(@seminar.content) %></td> <td class="seminarive-title-value"><%= nl2br(@seminar.content) %></td>
</tr> </tr>
<% end %> <% end %>
<tr <%= 'class="hidden"'.html_safe if @sign_up_time_range.blank? %>> <tr>
<th class="seminarive-title-field"><i class="fa fa-calendar fa-fw"></i><%= t('seminar.signup_during') %></th> <th class="seminarive-title-field"><i class="fa fa-calendar fa-fw"></i><%= t('seminar.signup_during') %></th>
<td class="seminarive-title-value"><%= @sign_up_time_range %></td> <td class="seminarive-title-value"><%= @sign_up_time_range %></td>
</tr> </tr>
@ -50,7 +49,7 @@
<td class="seminarive-title-value"><%= @contribute_time_range %></td> <td class="seminarive-title-value"><%= @contribute_time_range %></td>
</tr> </tr>
<% end %> <% end %>
<tr <%= 'class="hidden"'.html_safe if @sign_up_not_yet && @contribute_action.blank? %>> <tr>
<th class="seminarive-title-field"><%= t('seminar.signup') %></th> <th class="seminarive-title-field"><%= t('seminar.signup') %></th>
<td class="seminarive-title-value"><%= @sign_up %><br /><%= @contribute_action %></td> <td class="seminarive-title-value"><%= @sign_up %><br /><%= @contribute_action %></td>
</tr> </tr>

View File

@ -45,7 +45,3 @@ markups:
ext_support: false ext_support: false
panel: typeF panel: typeF
display_only: seminar_submission_field display_only: seminar_submission_field
instructions:
muti_lang_input_supprt: false
ext_support: false
panel: typeG

View File

@ -6,8 +6,6 @@ en:
lists: lists:
markups: markups:
seminar_preferred_session: Preferred Session seminar_preferred_session: Preferred Session
instructions: Instructions
restful_actions: restful_actions:
edit_seminar_review: Review edit_seminar_review: Review
copy: Copy copy: Copy

View File

@ -6,7 +6,6 @@ zh_tw:
lists: lists:
markups: markups:
seminar_preferred_session: Preferred Session seminar_preferred_session: Preferred Session
instructions: "說明文字 Instructions"
restful_actions: restful_actions:
edit_seminar_review: 審查 edit_seminar_review: 審查

View File

@ -320,9 +320,9 @@ module CustomAnnouncementsHelper
if @target_action == "index" if @target_action == "index"
filename = overridehtml.nil? ? params[:layout_type] : overridehtml filename = overridehtml.nil? ? params[:layout_type] : overridehtml
f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', 'custom_announcement', "#{filename}.html.erb") f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', 'custom_announcement', "#{filename}.html.erb")
if !File.exist?(f) if !File.exists?f
f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', 'custom_announcement', "index.html.erb") f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', 'custom_announcement', "index.html.erb")
if !File.exist?(f) if !File.exists?f
return "<div class='well'>Maybe the administrator has changed the theme, please select the index page design again from the page settings.</div>".html_safe return "<div class='well'>Maybe the administrator has changed the theme, please select the index page design again from the page settings.</div>".html_safe
end end
end end
@ -362,7 +362,7 @@ module CustomAnnouncementsHelper
else else
filename = overridehtml.nil? ? @target_action : overridehtml filename = overridehtml.nil? ? @target_action : overridehtml
f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', 'custom_announcement', "#{filename}.html.erb") f = File.join(Rails.root, 'app', 'templates', "#{@key}", 'modules', 'custom_announcement', "#{filename}.html.erb")
if File.exist?(f) if File.exists?f
file = File.open(f) file = File.open(f)
doc = Nokogiri::HTML(file, nil, "UTF-8") doc = Nokogiri::HTML(file, nil, "UTF-8")
file.close file.close
@ -464,7 +464,7 @@ module CustomAnnouncementsHelper
layout_types = [] layout_types = []
@key = Site.first.template @key = Site.first.template
f = File.join("#{Rails.root}/app/templates/#{@key}/modules/#{module_app}/info.json") f = File.join("#{Rails.root}/app/templates/#{@key}/modules/#{module_app}/info.json")
if File.exist?(f) if File.exists?f
info = File.read(f) info = File.read(f)
hash = JSON.parse(info) rescue {} hash = JSON.parse(info) rescue {}
frontends = hash["frontend"] || [] frontends = hash["frontend"] || []

View File

@ -2,7 +2,6 @@ require "yaml"
module CustomAnnouncement module CustomAnnouncement
class Engine < ::Rails::Engine class Engine < ::Rails::Engine
initializer "custom_announcement" do initializer "custom_announcement" do
Rails.application.config.to_prepare do
begin begin
translate_data = Dir["#{CustomAnnouncement::Engine.root}/config/locales/*.yml"] .map{|yaml_file| YAML.load(File.read(yaml_file))} translate_data = Dir["#{CustomAnnouncement::Engine.root}/config/locales/*.yml"] .map{|yaml_file| YAML.load(File.read(yaml_file))}
data = {} data = {}
@ -153,4 +152,3 @@ module CustomAnnouncement
end end
end end
end end
end

View File

@ -502,7 +502,7 @@ class Admin::CustomGalleriesController < OrbitAdminController
theater_link: admin_image_path(values), theater_link: admin_image_path(values),
description: values.description, description: values.description,
title: values.title, title: values.title,
file: values.file.as_json, file: values.file.as_json[:file],
custom_gallery_custom_album_id: values.custom_album_id, custom_gallery_custom_album_id: values.custom_album_id,
order: values.order, order: values.order,
tags: values.tags} tags: values.tags}

View File

@ -242,7 +242,7 @@ class CustomGalleriesController < ApplicationController
title: values.title, title: values.title,
alt_title: alt_text, alt_title: alt_text,
url: values.file.url, url: values.file.url,
file: values.file.as_json, file: values.file.as_json[:file],
custom_gallery_custom_album_id: values.custom_album_id, custom_gallery_custom_album_id: values.custom_album_id,
tags: values.tags} tags: values.tags}
end end

View File

@ -1,7 +1,6 @@
module CustomGallery module CustomGallery
class Engine < ::Rails::Engine class Engine < ::Rails::Engine
initializer "custom_gallery" do initializer "custom_gallery" do
Rails.application.config.to_prepare do
begin begin
translate_data = Dir["#{CustomGallery::Engine.root}/config/locales/*.yml"] .map{|yaml_file| YAML.load(File.read(yaml_file))} translate_data = Dir["#{CustomGallery::Engine.root}/config/locales/*.yml"] .map{|yaml_file| YAML.load(File.read(yaml_file))}
data = {} data = {}
@ -22,7 +21,7 @@ module CustomGallery
puts ['error in custom_gallery',e] puts ['error in custom_gallery',e]
end end
require File.join(CustomGallery::Engine.root, 'app/models/custom_album_setting') require File.expand_path('../../../app/models/custom_album_setting', __FILE__)
if defined?(CustomAlbumSetting) if defined?(CustomAlbumSetting)
if CustomAlbumSetting.first.nil? if CustomAlbumSetting.first.nil?
CustomAlbumSetting.create() CustomAlbumSetting.create()
@ -94,4 +93,3 @@ module CustomGallery
end end
end end
end end
end

View File

@ -1,7 +1,6 @@
module Seminar module Seminar
class Engine < ::Rails::Engine class Engine < ::Rails::Engine
initializer "seminar" do initializer "seminar" do
Rails.application.config.to_prepare do
OrbitApp.registration "Seminar", :type => "ModuleApp" do OrbitApp.registration "Seminar", :type => "ModuleApp" do
module_label "seminar.seminar" module_label "seminar.seminar"
base_url File.expand_path File.dirname(__FILE__) base_url File.expand_path File.dirname(__FILE__)
@ -50,7 +49,7 @@ module Seminar
:active_for_action=>{'admin/seminars'=>'enquiry_for_applicants'}, :active_for_action=>{'admin/seminars'=>'enquiry_for_applicants'},
:available_for => 'users' :available_for => 'users'
end end
end
end end
end end
end end