Merge branch 'master' into 'master'

Master



See merge request !2
This commit is contained in:
wmcheng 2019-12-31 01:42:43 +08:00
commit 5acd0429fb
35 changed files with 2224 additions and 445 deletions

View File

@ -0,0 +1,494 @@
// Retrieve the initial data
function temporary() {
attributesArray.length = 0;
$('.attributes').each(function() {
var attributesData = {},
$selectType = $('.dataType').data().type;
// Capture "attributes-body" within the input[type = "text"] val
$(this).find('.attributes-body').find('input[type="text"]').each(function(i) {
var $type = $(this).data().type;
attributesData[$type] = $(this).val();
});
// Capture "attributes-body" within the input[type = "radio"] checked
$(this).find('.attributes-body').find('input[type="radio"]').each(function(i) {
var $type = $(this).data().type;
attributesData[$type] = $(this).prop("checked");
});
// Capture "attributes-body" within the dataType selected
$(this).find('.attributes-body').find('.dataType').children("option:selected").each(function () {
attributesData[$selectType] = {};
attributesData[$selectType].index = $(this).index();
attributesData[$selectType].name = $(this).attr('ref');
if($(this).attr('ref') == 'typeB' || $(this).attr('ref') == 'typeE' || $(this).attr('ref') == 'typeF') {
attributesData[$selectType].option = [];
}
});
// Capture "field-type" within the input[type = "text"] val
$(this).find('.field-type').find('input[type="text"]').each(function(i) {
var $type = $(this).data().type;
if(!$type.match('option_lang')) {
attributesData[$selectType][$type] = $(this).val();
}
});
$(this).find('.field-type .add-target').find('.input-append').each(function() {
var append = []
$(this).children('input[type="text"]').each(function() {
var val = $(this).val();
append.push(val);
});
attributesData[$selectType].option.push(append);
})
// Capture "field-type" within the input[type = "checkbox"] checked
$(this).find('.field-type').find('input[type="checkbox"]').each(function() {
var $type = $(this).data().type;
attributesData[$selectType][$type] = $(this).prop("checked");
});
// Capture "field-type" within the input[type = "radio"] checked
$(this).find('.field-type').find('input[type="radio"]').each(function() {
var $type = $(this).data().type;
attributesData[$selectType][$type] = $(this).prop("checked");
});
// Capture "field-type" within the dataType selected
$(this).find('.field-type').find('select').children("option:selected").each(function () {
attributesData[$selectType].dateFormat = $(this).index();
});
attributesArray.push(attributesData);
});
};
// Determine the Append input length
function inputAppendLength() {
$('.add-target').each(function(i) {
if($(this).children('.input-append:not(:hidden)').length == 1 || $(this).children('.input-append').length == 1) {
$(this).children('.input-append').each(function() {
if($(this).children('div').hasClass('tab-content')) {
var btnLength = $(this).children('.btn').length;
$(this).find('.btn').eq(btnLength-2).addClass('last');
$(this).find('.remove-input').addClass('hide');
} else {
var mediumLength = $(this).children('.input-medium').length;
$(this).children('.input-medium').eq(mediumLength-1).addClass('last');
$(this).children('.remove-input').addClass('hide');
}
});
} else {
$(this).children('.input-append').each(function() {
if($(this).children('div').hasClass('tab-content')) {
$(this).find('.btn').removeClass('last');
$(this).find('.remove-input').removeClass('hide');
} else {
$(this).children('.input-medium').removeClass('last');
$(this).children('.remove-input').removeClass('hide');
}
});
}
});
};
// Role Attribute Template Data
function setData(l, type, ol) {
var fields = $('#info').length ? "info[seminar_submission_fields]" : $('#sub_seminar_main').length ? "sub_seminar_main[seminar_submission_fields]" : "seminar_main[seminar_submission_fields]",
data = {
_add_more: ["add_more_" +l, fields+"["+l+"]["+type+"][add_more]"],
_calendar: ["calendar_" +l, fields+"["+l+"]["+type+"][calendar]"],
_cross_lang: ["cross_lang_" +l, fields+"["+l+"]["+type+"][cross_lang]"],
_disabled: ["disabled_" +l, fields+"["+l+"][disabled]"],
_format: ["format_" +l, fields+"["+l+"]["+type+"][format]"],
_initial: ["initial_" +l, fields+"["+l+"]["+type+"][initial]"],
_is_range: ["is_range_" +l, fields+"["+l+"]["+type+"][is_range]"],
_key: ["key_" +l, fields+"["+l+"][key]"],
_markup: fields+"["+l+"][markup]",
_option_list: ["option_list_"+l+"_"+ol, fields+"["+l+"]["+type+"][option_list]["+ol+"]", "option_list_"+ol],
_placeholder: ["placeholder_" +l, fields+"["+l+"]["+type+"][placeholder]"],
_title_translations: ["title_translations_" +l, fields+"["+l+"][title_translations]"],
_to_delete: ["to_delete_" +l, fields+"["+l+"][to_delete]"],
_to_require: ["to_require_" +l, fields+"["+l+"][to_require]"],
};
return data;
}
// Get Default Address Form
function getAddressForm(trigger, element, decide) {
if(decide) {
addressVal.length = addressArray.length = 0;
var addressAllVal = [];
var inputNameArray = [];
trigger.closest('.input-append').find('.tab-pane').each(function() {
var adderssText = $(this).children('input[type="text"]').val(),
addersshidden = '',
addressData = {},
inputName = [];
$(this).children('input:not(:first)').each(function(j) {
var name = $(this).attr('name'),
val = $(this).val();
addersshidden += val;
addressData[name] = val;
inputName.push(name);
});
addressArray.push(addressData);
addressAllVal.push(adderssText);
inputNameArray.push(inputName);
if(adderssText != addersshidden) {
addressVal.push(false);
} else {
addressVal.push(true);
}
});
element.find('.tab-pane').each(function(i) {
$(this).find('textarea, input[type="text"]').each(function(j) {
$(this).attr('name',inputNameArray[i][j]);
});
if(addressVal[i]) {
$(this).find('textarea, input[type="text"]').each(function(j) {
$(this).val(addressArray[i][$(this).attr('name')]);
});
} else {
$(this).find('textarea').val(addressAllVal[i]);
$(this).find('input[type="text"]').each(function(j) {
$(this).val('');
});
}
});
};
element.off('show');
};
// Return Address Form
function returnAddressForm(element, decide) {
if(decide) {
addressArray.length = 0;
element.find('.tab-pane').each(function(i) {
var addressData = {};
$(this).find('textarea, input[type="text"]').each(function(j) {
var name = $(this).attr('name'),
val = $(this).val();
addressData[name] = val;
});
addressArray.push(addressData);
});
$.map(addressInputId, function(n, i) {
var v = '';
$('#'+n).find('input[type="hidden"]').each(function() {
$(this).val(addressArray[i][$(this).attr('name')]);
v += addressArray[i][$(this).attr('name')]
});
$('#'+n).find('input[type="text"]').each(function() {
$(this).val(v);
});
});
};
returnDecide = false;
};
$(function() {
appendIndex = null;
if($('#user-forms').length) {
addressVal = [];
addressArray = [];
addressInputId = [];
seminar_mainType = null;
returnDecide = false;
$('.attributes').each(function() {
if($(this).find('.toggle-check').attr('value') == "true") {
$(this).addClass('disabled').children('.attributes-body').hide();
}
});
$('.returnDecide').on(clickEvent, function() {
returnDecide = true;
})
$('#address-field').on('hidden', function () {
$('.btn[data-toggle="modal"]').removeClass('active').blur();
$(this).find('.nav-tabs > li').removeClass('active').eq(0).addClass('active');
$(this).find('.tab-content > .tab-pane').removeClass('active in').eq(0).addClass('active in');
$(this).on('show', getAddressForm(null, $(this), false));
returnAddressForm($(this), returnDecide)
});
$('.control-group').delegate('.btn[data-toggle="modal"]', 'click', function() {
var $trigger = $(this);
addressInputId.length = 0;
$(this).closest('.input-append').find('.tab-pane').each(function() {
addressInputId.push($(this).attr('id'));
});
$('#address-field').on('show', getAddressForm($trigger, $('#address-field'), true));
});
$('#user-forms').delegate('.togglebox, .delete, .trigger, .remove-input', clickEvent, function(event) {
if($(this).hasClass('togglebox')) {
var seminar_main_staus = [];
if($(this).hasClass('disable')) {
$(this).find('.toggle-check')
.attr('value', 'false')
.closest('.attributes')
.removeClass('disabled')
.children('.attributes-body')
.fadeIn(300);
} else {
$(this).find('.toggle-check')
.attr('value', 'true')
.closest('.attributes')
.addClass('disabled')
.children('.attributes-body')
.fadeOut(300)
.find('.check')
.attr("checked",false)
.attr("value",seminar_main_staus);
}
$(this).toggleClass('disable');
};
if($(this).hasClass('remove-input')) {
$(this).closest('.input-append').fadeOut(300, function() {
$(this).remove();
inputAppendLength();
});
};
if($(this).hasClass('trigger')) {
appendIndex = $(this).closest('.controls').find('.input-append').length;
nameNumber = $(this).closest('.controls').find('.input-append:eq(0)').find('input').eq(0).attr('name');
nameNumber = nameNumber.match(/[^[\D\]]+(?=])/g)[0];
seminar_mainType = $(this).data('seminar_mains')
if($(this).hasClass('textInput')) {
$("#template-text").tmpl().appendTo($(this).closest('.controls').find('.add-target'));
} else if ($(this).hasClass('textLengInput')) {
$("#template-text-language").tmpl().appendTo($(this).closest('.controls').find('.add-target'));
} else if ($(this).hasClass('address')) {
$("#template-address").tmpl().appendTo($(this).closest('.controls').find('.add-target'));
}
inputAppendLength();
};
event.preventDefault();
});
inputAppendLength();
} else {
attributesArray = [];
attributesHeaderLength = null;
templateType = null;
attributeIndex = null;
if($('.add-target').length) {
inputAppendLength();
}
if(!$('.attributes').length) {
$('#attributes-area').addClass('clickHere');
} else {
temporary();
};
$('.add-attributes').on(clickEvent, function() {
if($('#attributes-area').hasClass('clickHere')) {
$('#attributes-area').removeClass('clickHere');
};
attributesHeaderLength = $('.attributes:not(:hidden)').length+1;
attributesLength = $('#attributes-area .attributes').length;
$("#template-attributes").tmpl(setData(attributesLength, templateType, appendIndex)).appendTo( "#attributes-area" );
$('.toggle-check').togglebox();
});
$('.attributes.default').each(function(i) {
$(this).children('.field-type').not('.default').hide();
$(this).find('input[type="text"]').on('keyup', function() {
$(this).trigger("checking");
});
$(this).find('input[type="radio"], input[type="checkbox"], select').change(function() {
$(this).trigger("checking");
});
$(this).delegate('input[type="text"], input[type="radio"], input[type="checkbox"], select', 'checking', function(e) {
var e = e.target.type,
$data = $(this).data().type;
switch(e) {
case 'text':
var val = $(this).val();
if(!$(this).closest('.field-type').length) {
$data = attributesArray[i][$data];
} else if(!$(this).closest('.add-target').length) {
$data = attributesArray[i].select[$data];
} else {
appendIndex = $(this).parent('.input-append').index()
optionIndex = $(this).index()
$data = attributesArray[i].select.option[appendIndex][optionIndex];
}
if(val != $data) {
$(this).closest('.attributes').find('.reply').removeClass('hide');
}
break;
case 'radio':
var checked = $(this).prop("checked");
$data = attributesArray[i][$data];
if(checked != $data) {
$(this).closest('.attributes').find('.reply').removeClass('hide');
}
break;
case 'checkbox':
var checked = $(this).prop("checked");
$data = attributesArray[i].select[$data];
if(checked != $data) {
$(this).closest('.attributes').find('.reply').removeClass('hide');
}
break;
case 'select-one':
var ref,
$data = attributesArray[i].select.name;
$(this).children("option:selected").each(function() {
ref = $(this).attr('ref');
});
if(ref != $data) {
$(this).closest('.attributes').find('.reply').removeClass('hide');
}
break;
};
});
$(this).delegate('.reply', clickEvent, function() {
var $bodyText = $(this).parent('.attributes-header').siblings('.attributes-body').find('input[type="text"]'),
$bodyRadio = $(this).parent('.attributes-header').siblings('.attributes-body').find('input[type="radio"]'),
$bodySelected = $(this).parent('.attributes-header').siblings('.attributes-body').find('.dataType').children("option"),
$fieldTypeO = $(this).parent('.attributes-header').siblings('.field-type.default'),
$fieldTypeN = $(this).parent('.attributes-header').siblings('.field-type').not('.default');
$bodyText.each(function() {
var $type = $(this).data().type;
$(this).val(attributesArray[i][$type]);
});
$bodyRadio.each(function() {
var $type = $(this).data().type;
$(this).prop("checked", attributesArray[i][$type])
});
$fieldTypeO.find('input[type="text"]').each(function() {
var $type = $(this).data().type;
if(!$type.match('option_lang')) {
$(this).val(attributesArray[i].select[$type]);
}
});
$fieldTypeO.find('.add-target').find('.input-append').each(function(k) {
$(this).children('input[type="text"]').each(function(j) {
$(this).val(attributesArray[i].select.option[k][j]);
// var val = $(this).val();
// append.push(val);
});
})
$fieldTypeO.find('input[type="checkbox"], input[type="radio"]').each(function() {
var $type = $(this).data().type;
$(this).prop("checked", attributesArray[i].select[$type]);
});
$fieldTypeO.find('select').children("option").eq(attributesArray[i].select.dateFormat).prop('selected',true);
$bodySelected.eq(attributesArray[i].select.index).prop('selected',true);
$fieldTypeO.show();
$fieldTypeN.empty().hide();
$(this).addClass('hide')
return false
})
});
$('#attributes-area').delegate('.togglebox, .delete, .trigger, .remove-input', clickEvent, function(event) {
if($(this).hasClass('togglebox')) {
if($(this).hasClass('disable')) {
$(this).find('.toggle-check')
.attr('value', 'false')
.closest('.attributes')
.removeClass('disabled')
.find('input, select')
.removeAttr('disabled')
.end('.attributes')
.find('.btn-group .btn')
.removeClass('disabled')
.end().find('.attribute_field_disabled').attr('value', 'false');
if($(this).closest('.attributes').find('.dataType').children("option:selected").attr('ref')) {
$(this).closest('.attributes').find('.field-type').addClass('in').find('.control-group').delay(150).fadeIn(300);
}
} else {
$(this).find('.toggle-check')
.attr('value', 'true')
.closest('.attributes')
.addClass('disabled')
.find('.attributes-body input, .attributes-body select')
.attr({'disabled': 'disabled'})
.end('.attributes')
.find('.btn-group .btn')
.addClass('disabled')
.end().find('.attribute_field_disabled').attr('value', 'true')
.end().find('.field-type .control-group').fadeOut(300, function() {
$(this).parent('.field-type').removeClass('in');
});
}
$(this).toggleClass('disable');
};
if($(this).hasClass('delete')) {
$(this).closest('.attributes').fadeOut(300, function() {
$('.attributes:not(:hidden)').each(function(i) {
$(this).find('.attributes-header h4 span').text(i+1);
});
attributesHeaderLength = $('.attributes:not(:hidden)').length+1;
if(!$('.attributes:not(:hidden)').length) {
$('#attributes-area').addClass('clickHere');
};
}).find('.attribute_field_to_delete').attr('value', 'true');;
};
if($(this).hasClass('trigger')) {
// appendIndex = $(this).closest('.controls').find('.input-append').length;
appendIndex = $(this).closest('.controls').find('.input-append:last-child').children('input:first-child').attr('name');
// appendIndex = appendIndex.split("][");
// appendIndex = parseInt(appendIndex[appendIndex.length-2])+1;
appendIndex = parseInt(appendIndex.match(/[^[\D\]]+(?=])/g)[1])+1;
console.log(appendIndex)
attributeIndex = $(this).closest('.attributes').index();
templateType = $(this).closest('.attributes').find('.dataType').children("option:selected").attr('ref');
$("#template-input-append").tmpl(setData(attributeIndex, templateType, appendIndex)).appendTo($(this).closest('.controls').find('.add-target'));
inputAppendLength();
};
if($(this).hasClass('remove-input')) {
$(this).parent('.input-append').fadeOut(300, function() {
$(this).remove()
inputAppendLength();
});
}
event.preventDefault();
});
$('#attributes-area').delegate('.dataType', 'change', function() {
$(this).children("option:selected").each(function () {
var target = $(this).closest('.attributes').find('.field-type').not('.default');
attributeIndex = $(this).closest('.attributes').index();
appendIndex = 0
// $(this).closest('.attributes').find('.add-target').find('.input-append').length;
if($(this).closest('.attributes').hasClass('default')){
var i = $(this).closest('.attributes').index()
if($(this).attr('ref') == attributesArray[i].select.name) {
$(this).closest('.attributes').find('.field-type.default').show()
target.empty().hide();
} else {
$(this).closest('.attributes').find('.field-type.default').hide()
if($(this).attr('ref')) {
templateType = $(this).attr('ref');
target.removeAttr('class').addClass('field-type fade in ' + templateType).empty();
$("#template-type").tmpl(setData(attributeIndex, templateType, appendIndex)).appendTo(target);
if(templateType == 'typeB' || templateType == 'typeE' || templateType == 'typeF') {
inputAppendLength();
}
} else {
target.removeAttr('class').addClass('field-type fade')
target.empty();
};
target.show();
}
} else {
if($(this).attr('ref')) {
templateType = $(this).attr('ref');
target.removeAttr('class').addClass('field-type fade in ' + templateType).empty();
$("#template-type").tmpl(setData(attributeIndex, templateType, appendIndex)).appendTo(target);
if(templateType == 'typeB' || templateType == 'typeE' || templateType == 'typeF') {
inputAppendLength();
}
} else {
target.removeAttr('class').addClass('field-type fade')
target.empty();
};
}
});
});
}
});

View File

@ -0,0 +1,18 @@
@media (max-width:767px){
.form-group{
justify-content:flex-start !important;
flex-wrap: wrap;
&>span{
padding-left: 0.7em;
&>br{
display:none;
}
}
&>.col-sm-10.controls{
width:100%;
textarea{
min-height: 8em;
}
}
}
}

View File

@ -1,3 +0,0 @@
// Place all the styles related to the seminar controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View File

@ -9,7 +9,7 @@ class Admin::SeminarSignupsController < OrbitAdminController
end end
def edit def edit
OrbitHelper.set_params(params,current_user)
params[:controller] = "admin/seminars" params[:controller] = "admin/seminars"
@seminar_signup = SeminarSignup.find(params[:id]) @seminar_signup = SeminarSignup.find(params[:id])

View File

@ -2,7 +2,7 @@
class Admin::SeminarsController < OrbitAdminController class Admin::SeminarsController < OrbitAdminController
require 'axlsx' require 'axlsx'
helper Admin::SeminarsFieldHelper
before_action ->(module_app = @app_title) { set_variables module_app } before_action ->(module_app = @app_title) { set_variables module_app }
before_action :set_seminar, only: [:edit, :set_write_off, :seminar_signup, :destroy] before_action :set_seminar, only: [:edit, :set_write_off, :seminar_signup, :destroy]
@ -60,6 +60,10 @@ class Admin::SeminarsController < OrbitAdminController
def new def new
@member = nil @member = nil
@seminar = SeminarMain.new @seminar = SeminarMain.new
create_set (false)
@signup_sets = @seminar.seminar_signup_field_sets
@submission_set = @seminar.seminar_submission_field_sets
@custom_set = @seminar.seminar_signup_field_customs
@seminar_items = SeminarItem.all @seminar_items = SeminarItem.all
@review = @seminar.seminar_reviews.new() @review = @seminar.seminar_reviews.new()
end end
@ -71,25 +75,51 @@ class Admin::SeminarsController < OrbitAdminController
seminar_params['seminar_links_attributes'].delete(idx.to_s) if link['url'].blank? seminar_params['seminar_links_attributes'].delete(idx.to_s) if link['url'].blank?
end end
end end
seminar_main_params = seminar_params
seminar = SeminarMain.new(seminar_params) seminar_signup_set_params = seminar_main_params['seminar_signup_field_sets']
seminar_submission_set_params = seminar_main_params['seminar_submission_field_sets']
seminar_main_params.delete(:seminar_signup_field_sets)
seminar_main_params.delete(:seminar_submission_field_sets)
seminar = SeminarMain.new(seminar_main_params)
seminar.create_user_id = current_user.id seminar.create_user_id = current_user.id
seminar.update_user_id = current_user.id seminar.update_user_id = current_user.id
seminar.save seminar.save
seminar_signup_set_params.each do |key,value|
seminar.seminar_signup_field_sets.create(value)
end
seminar_submission_set_params.each do |key,value|
seminar.seminar_submission_field_sets.create(value)
end
redirect_to params['referer_url'] redirect_to params['referer_url']
end end
def edit def edit
@seminar_items = SeminarItem.all @seminar_items = SeminarItem.all
attribute = SeminarMain.where(id: params[:id]) @seminar = SeminarMain.where(id: params[:id]).first
if attribute.first.seminar_reviews.first.nil? @seminar.seminar_signup_field_sets.each do |signup_field_set|
@review = attribute.first.seminar_reviews.new() if !(SeminarSignup.attribute_names.include? signup_field_set.field_name) && signup_field_set.field_name != 'recaptcha'
signup_field_set.delete
end
end
@seminar.seminar_submission_field_sets.each do |submission_field_set|
if !(SeminarSignupContribute.attribute_names.include? submission_field_set.field_name)
submission_field_set.delete
end
end
@seminar.seminar_signup_field_customs.each do |custom_set|
if !(@seminar.seminar_signup_fields.collect(&:id).include? custom_set.seminar_signup_field_id)
custom_set.delete
end
end
create_set (true)
@signup_sets = @seminar.seminar_signup_field_sets
@submission_set = @seminar.seminar_submission_field_sets
@custom_set = @seminar.seminar_signup_field_customs
if @seminar.seminar_reviews.first.nil?
@review = @seminar.seminar_reviews.new()
else else
@review = attribute.first.seminar_reviews.first @review = @seminar.seminar_reviews.first
end end
@member = MemberProfile.find(@review.reviewer_id) rescue nil @member = MemberProfile.find(@review.reviewer_id) rescue nil
end end
@ -113,7 +143,16 @@ class Admin::SeminarsController < OrbitAdminController
@seminar.seminar_signup_fields.each{|t| t.destroy if t["to_delete"] == true} @seminar.seminar_signup_fields.each{|t| t.destroy if t["to_delete"] == true}
redirect_to admin_seminars_path redirect_to admin_seminars_path
elsif params[:seminar_main][:seminar_submission_fields]
params[:seminar_main][:seminar_submission_fields].each do |a|
@field_name = 'seminar_main'
field_status = a.last[:id].present?
@attribute_field = SeminarSubmissionField.add_seminar_signup_field(@seminar, a.last, a.last[:id], field_status)
@attribute = @seminar
end
flash.now[:notice] = "Updated Fields"
@seminar.seminar_submission_fields.each{|t| t.destroy if t["to_delete"] == true}
redirect_to admin_seminars_path
else else
if !seminar_params['seminar_links_attributes'].nil? if !seminar_params['seminar_links_attributes'].nil?
@ -123,7 +162,6 @@ class Admin::SeminarsController < OrbitAdminController
end end
@seminar.update_user_id = current_user.id @seminar.update_user_id = current_user.id
if @seminar.update_attributes(seminar_params) if @seminar.update_attributes(seminar_params)
@seminar.seminar_signup_fields.each{|t| t.destroy if t["to_delete"] == true} @seminar.seminar_signup_fields.each{|t| t.destroy if t["to_delete"] == true}
redirect_to params['referer_url'] redirect_to params['referer_url']
@ -158,6 +196,13 @@ class Admin::SeminarsController < OrbitAdminController
@class = 'seminars' @class = 'seminars'
end end
def seminar_submission_field
@field_name = 'seminar_main'
@attribute = SeminarMain.find(params[:id])
@attribute_type = 'seminar'
@class = 'seminars'
end
def seminar_signup def seminar_signup
if !params[:search].blank? if !params[:search].blank?
@ -193,5 +238,75 @@ class Admin::SeminarsController < OrbitAdminController
def seminar_params def seminar_params
params.require(:seminar_main).permit! params.require(:seminar_main).permit!
end end
def create_set (save_flag)
SeminarSignup.attribute_names.each do |attr_signup|
if !(['_id', 'created_at', 'updated_at','seminar_main_id'].include? attr_signup)
signup_set = @seminar.seminar_signup_field_sets.select{|v| v.field_name==attr_signup }
if signup_set.length==0
if ['status','name','tel','phone','email','password'].include? attr_signup
disabled = false
else
disabled = true
end
if ['status','name','tel'].include? attr_signup
hidden = false
else
hidden = true
end
name1 = Hash.new
now_locale = I18n.locale
I18n.available_locales.each do |locale|
I18n.locale = locale
name1[locale] = t("seminar_signup.#{attr_signup}")
end
I18n.locale = now_locale
if save_flag
@seminar.seminar_signup_field_sets.create(field_name:attr_signup,disabled:disabled,hidden:hidden,name:name1,placeholder:name1)
else
@seminar.seminar_signup_field_sets.new(field_name:attr_signup,disabled:disabled,hidden:hidden,name:name1,placeholder:name1)
end
end
end
end
signup_set = @seminar.seminar_signup_field_sets.select{|v| v.field_name== 'recaptcha' }
if signup_set.length==0
name1 = Hash.new
now_locale = I18n.locale
I18n.available_locales.each do |locale|
I18n.locale = locale
name1[locale] = t("seminar_signup.recaptcha")
end
I18n.locale = now_locale
if save_flag
@seminar.seminar_signup_field_sets.create(field_name:'recaptcha',name:name1,placeholder:name1,hidden:true)
else
@seminar.seminar_signup_field_sets.new(field_name:'recaptcha',name:name1,placeholder:name1,hidden:true)
end
end
SeminarSignupContribute.attribute_names.each do |attr_submission|
if !(['_id', 'created_at', 'updated_at','seminar_signup_id'].include? attr_submission)
signup_set = @seminar.seminar_submission_field_sets.select{|v| v.field_name==attr_submission }
if signup_set.length==0
name1 = Hash.new
now_locale = I18n.locale
I18n.available_locales.each do |locale|
I18n.locale = locale
name1[locale] = t("seminar_signup.#{attr_submission}")
end
I18n.locale = now_locale
if save_flag
@seminar.seminar_submission_field_sets.create(field_name:attr_submission,name:name1,placeholder:name1)
else
@seminar.seminar_submission_field_sets.new(field_name:attr_submission,name:name1,placeholder:name1)
end
end
end
end
@seminar.seminar_signup_fields.all.map{|v| v}.each do |field|
set = @seminar.seminar_signup_field_customs.select{|v| v.seminar_signup_field_id==field.id}
if set.length == 0
@seminar.seminar_signup_field_customs.create(seminar_signup_field_id:field.id)
end
end
end
end end

View File

@ -105,9 +105,9 @@ class SeminarsController < ApplicationController
if !params[:email].blank? if !params[:email].blank?
count = SeminarSignup.where(:email => params[:email], :seminar_main_id => params[:no]).count count = SeminarSignup.where(:email => params[:email], :seminar_main_id => params[:no]).count
result = count > 0 ? '已存在' : '可使用' result = count > 0 ? t('seminar.already_used') : t('seminar.available')
else else
result = '請輸入email' result = t('seminar.please_enter_email')
end end
{ {
@ -134,7 +134,7 @@ class SeminarsController < ApplicationController
@signup = SeminarSignup.where(email: params[:seminar_signup][:email], seminar_main_id: params[:seminar_signup][:seminar_main_id] ).first @signup = SeminarSignup.where(email: params[:seminar_signup][:email], seminar_main_id: params[:seminar_signup][:seminar_main_id] ).first
@seminar_signup = SeminarSignup.new(seminar_signup_params) @seminar_signup = SeminarSignup.new(seminar_signup_params)
if gotcha_valid? #if gotcha_valid?
if @signup.blank? && @seminar_signup.save if @signup.blank? && @seminar_signup.save
# if gotcha_valid? && @seminar_signup.save # if gotcha_valid? && @seminar_signup.save
@ -144,8 +144,12 @@ class SeminarsController < ApplicationController
@custom_field_value = SeminarSignupValue.put_field_values(@seminar_signup, r.last, r.last[:seminar_signup_field_id], field_value) @custom_field_value = SeminarSignupValue.put_field_values(@seminar_signup, r.last, r.last[:seminar_signup_field_id], field_value)
end end
end end
if params['seminar_signup']['status']=='C'
redirect_to "#{params[:referer_url]}/?method=signup_ok" status_param = '&status='
else
status_param = ''
end
redirect_to "#{params[:referer_url]}/?method=signup_ok#{status_param}"
else else
if !@signup.blank? if !@signup.blank?
redirect_to "#{params[:referer_url]}", :notice => 'mail已存在' redirect_to "#{params[:referer_url]}", :notice => 'mail已存在'
@ -153,9 +157,9 @@ class SeminarsController < ApplicationController
redirect_to "#{params[:referer_url]}", :notice => t('recaptcha.errors.verification_failed') redirect_to "#{params[:referer_url]}", :notice => t('recaptcha.errors.verification_failed')
end end
end end
else #else
redirect_to "#{params[:referer_url]}", :notice => t('recaptcha.errors.verification_failed') # redirect_to "#{params[:referer_url]}", :notice => t('recaptcha.errors.verification_failed')
end #end
end end
@ -164,8 +168,25 @@ class SeminarsController < ApplicationController
def add_file_proc def add_file_proc
@con = SeminarSignupContribute.new(seminar_signup_contribute_params) update_params = seminar_signup_contribute_params.merge('seminar_submission_values'=>params['seminar_submission_values'])
flag = true
update_params.permit!
if update_params['seminar_submission_values']['0']['value'].class==String
value = update_params['seminar_submission_values']['0']['value']
if !value.to_s.blank?
flag = false
end
else
update_params['seminar_submission_values']['0']['value'].each do |key,value|
if !value.to_s.blank?
flag = false
end
end
end
if flag
update_params['seminar_submission_values']['0']['value']['en'] = ' '
end
@con = SeminarSignupContribute.new(update_params)
if @con.save if @con.save
redirect_to "#{params[:referer_url]}/?method=con_upload" redirect_to "#{params[:referer_url]}/?method=con_upload"
@ -176,12 +197,28 @@ class SeminarsController < ApplicationController
end end
def update def update
@con = SeminarSignupContribute.find(params[:seminar_signup_contribute][:id]) @con = SeminarSignupContribute.find(params[:seminar_signup_contribute][:id])
@con.update_attributes(seminar_signup_contribute_params) update_params = seminar_signup_contribute_params.merge('seminar_submission_values'=>params['seminar_submission_values'])
flag = true
update_params.permit!
if update_params['seminar_submission_values']['0']['value'].class==String
value = update_params['seminar_submission_values']['0']['value']
if !value.to_s.blank?
flag = false
end
else
update_params['seminar_submission_values']['0']['value'].each do |key,value|
if !value.to_s.blank?
flag = false
end
end
end
if flag
update_params['seminar_submission_values']['0']['value']['en'] = ' '
end
@con.update_attributes(update_params)
if @con.save if @con.save
redirect_to "#{params[:referer_url]}/?method=con_upload" redirect_to "#{params[:referer_url]}/?method=con_upload"
else else
redirect_to "#{params[:referer_url]}", :notice => t('recaptcha.errors.verification_failed') redirect_to "#{params[:referer_url]}", :notice => t('recaptcha.errors.verification_failed')
@ -207,7 +244,6 @@ class SeminarsController < ApplicationController
if !@@session[:seminar_main_id].blank? if !@@session[:seminar_main_id].blank?
seminar = SeminarMain.find_by(id: @@session[:seminar_main_id]) seminar = SeminarMain.find_by(id: @@session[:seminar_main_id])
seminar_signup = SeminarSignup.find_by(_id: @@session[:seminar_signup_id], seminar_main_id: @@session[:seminar_main_id] ) seminar_signup = SeminarSignup.find_by(_id: @@session[:seminar_signup_id], seminar_main_id: @@session[:seminar_main_id] )
else else
@ -230,11 +266,19 @@ class SeminarsController < ApplicationController
def edit_file def edit_file
params = OrbitHelper.params params = OrbitHelper.params
if !@@session[:seminar_main_id].blank?
seminar = SeminarMain.find_by(id: @@session[:seminar_main_id])
seminar_signup = SeminarSignup.find_by(_id: @@session[:seminar_signup_id], seminar_main_id: @@session[:seminar_main_id] )
else
seminar = {}
seminar_signup = {}
end
con = SeminarSignupContribute.find(params[:con_no]) con = SeminarSignupContribute.find(params[:con_no])
puts ['con',con.inspect]
{ {
'con' => con 'con' => con,
'seminar' => seminar,
'seminar_signup' => seminar_signup
} }
end end

View File

@ -52,8 +52,8 @@ module Admin::SeminarsFieldHelper
@prefiled_value ||=[] @prefiled_value ||=[]
control_group_wrapper do control_group_wrapper do
a = self.typeE[:option_list].collect do |key,value| a = self.typeE[:option_list].collect do |key,value|
label_tag(key,check_box_tag(get_field_name_base+"[#{key}]", true , (@prefiled_value.include?(key) ? true : false), { :id=>"seminar_signup_values_#{self.id}"})+value[I18n.locale.to_s],@markup_options.merge(:class=>"checkbox inline")) label_tag(key,check_box_tag(get_field_name_base+"[#{key}]", true , (@prefiled_value.include?(key) ? true : false), { :id=>"#{get_basic_field_name_org}_#{self.id}"})+value[I18n.locale.to_s],@markup_options.merge(:class=>"checkbox inline"))
end.join rescue "" end.join.html_safe rescue ""
end end
end end
@ -139,7 +139,7 @@ module Admin::SeminarsFieldHelper
control_group_wrapper do control_group_wrapper do
self.typeE[:option_list].collect do |key,value| self.typeE[:option_list].collect do |key,value|
label_tag(key,radio_button_tag(get_field_name_base, key , (@prefiled_value.include?(key) ? true : false), {:required=>@require})+value[I18n.locale.to_s],@markup_options.merge(:class=>"radio inline")) label_tag(key,radio_button_tag(get_field_name_base, key , (@prefiled_value.include?(key) ? true : false), {:required=>@require})+value[I18n.locale.to_s],@markup_options.merge(:class=>"radio inline"))
end.join end.join.html_safe
end end
end end
@ -151,19 +151,25 @@ module Admin::SeminarsFieldHelper
def render_text_area def render_text_area
control_group_wrapper do |key,value| control_group_wrapper do |key,value|
if !@prefiled_value.nil?
value = can_muti_lang_input? ? @prefiled_value[key] : @prefiled_value value = can_muti_lang_input? ? @prefiled_value[key] : @prefiled_value
key = can_muti_lang_input? ? "[#{key}]" : "" else
place_holder= @panel_setting["placeholder"][I18n.locale.to_s] rescue '' value = nil
text_area_tag(get_field_name_base + key, value,@markup_options.merge(:placeholder=>place_holder)) end
key = can_muti_lang_input? ? "#{key}" : I18n.locale
place_holder= typeD["placeholder"][key] rescue ''
name1 = can_muti_lang_input? ? (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
end end
def render_text_field def render_text_field
a = control_group_wrapper do |key,value| a = control_group_wrapper do |key,value|
add_more_blank = can_add_more ? "[]" : "" add_more_blank = can_add_more ? "[]" : ""
key_field = can_muti_lang_input? ? "[#{key}]" : "" key_field = can_muti_lang_input? ? "#{key}" : I18n.locale
place_holder= @panel_setting["placeholder"][key] rescue '' place_holder= typeA["placeholder"][key_field] rescue ''
text_field_tag([get_field_name_base,add_more_blank,key_field].join, value,@markup_options.merge(:placeholder=>place_holder)) name1 = can_muti_lang_input? ? ([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
end end
@ -187,14 +193,16 @@ protected
add_more_counter = '' add_more_counter = ''
if self.markup=='text_area' #or self.markup=='address' if self.markup=='text_area' #or self.markup=='address'
tmp1 = valid_locales.collect do |key| tmp1 = valid_locales.collect do |key|
if !@prefiled_value.nil?
value = @prefiled_value[key] rescue nil value = @prefiled_value[key] rescue nil
else
value = nil
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"]
div_id = "#{get_pairing_tab_class({})}_#{key}" div_id = "#{get_pairing_tab_class({})}_#{key}"
if can_add_more if can_add_more
add_more_value = add_more_params[0][:value] add_more_value = add_more_params[0][:value]
add_more_counter = add_more_params[0][:counter] add_more_counter = add_more_params[0][:counter]
@ -206,8 +214,6 @@ protected
div_class << (key == I18n.locale ? " active in" : '') div_class << (key == I18n.locale ? " active in" : '')
content_tag(:div,yield(key,value), :id=>div_id,:class=>div_class) content_tag(:div,yield(key,value), :id=>div_id,:class=>div_class)
end# of VALID_LOCALES.collect for tabed input end# of VALID_LOCALES.collect for tabed input
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}"
@ -221,12 +227,9 @@ protected
buff2 << link_to((content_tag :i,'',:class=>'icon-trash'),"#",:class=>"btn remove-input") if self.add_more buff2 << link_to((content_tag :i,'',:class=>'icon-trash'),"#",:class=>"btn remove-input") if self.add_more
buff2.join.html_safe buff2.join.html_safe
end # of content ul end # of content ul
tmp = content_tag :div,:class=> "tab-content textarea-lang" do tmp = content_tag :div,:class=> "tab-content textarea-lang" do
tmp2 << tmp1.join('').html_safe tmp2 << tmp1.join('').html_safe
end end
else else
# tmp = content_tag :div,:class=> (add_more || self.markup=='address') ? "input-append" : "tab-content" do # tmp = content_tag :div,:class=> (add_more || self.markup=='address') ? "input-append" : "tab-content" do
@ -283,7 +286,7 @@ protected
def controls_wrapper(*add_more_params,&block) def controls_wrapper(*add_more_params,&block)
result = '' result = Array.new
add_more_counter = "" add_more_counter = ""
if can_add_more if can_add_more
@ -296,7 +299,6 @@ protected
if can_muti_lang_input? if can_muti_lang_input?
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
else #cross lang field else #cross lang field
@ -312,8 +314,11 @@ protected
end end
if self.markup == "address"
result.html_safe result
else
result[0]
end
end # of def controls_wrapper(&block) end # of def controls_wrapper(&block)
@ -344,7 +349,6 @@ protected
# 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(&block),:class=>div_class)
end end
when "address" when "address"
@ -358,10 +362,8 @@ protected
else else
result = form_label + content_tag(:div,controls_wrapper(&block),:class=>div_class) result = form_label + content_tag(:div,controls_wrapper(&block),:class=>div_class)
end end
result = result + end_block
result << end_block
result.html_safe result.html_safe
end end
@ -387,7 +389,7 @@ protected
def end_block def end_block
if @new_attribute if @new_attribute
hidden_field_tag(get_basic_field_name_base+"[seminar_signup_field_id]",id,:for=>"field_#{@index}") hidden_field_tag(get_basic_field_name_base+"[#{get_basic_field_name}_id]",id,:for=>"field_#{@index}")
else else
hidden_field_tag(get_basic_field_name_base+"[id]",@attribute_value.id,:for=>"field_#{@index}") hidden_field_tag(get_basic_field_name_base+"[id]",@attribute_value.id,:for=>"field_#{@index}")
end end
@ -410,8 +412,16 @@ protected
suffix.nil? ? str : str + suffix suffix.nil? ? str : str + suffix
end end
def get_basic_field_name_org
"seminar_signup_values"
end
def get_basic_field_name
"seminar_signup_field"
end
def get_basic_field_name_base def get_basic_field_name_base
"seminar_signup_values[#{@index}]" "#{get_basic_field_name_org}[#{@index}]"
end end
def get_field_name_base def get_field_name_base
@ -419,8 +429,15 @@ protected
end end
def form_label def form_label
if self.markup == "text_area"
plc = typeD["placeholder"][I18n.locale].to_s.blank? ? '' : "(#{typeD["placeholder"][I18n.locale]})"
"<span style='margin-right: 0.5em;'>"+
label_tag(key,(!@require.blank? ? '*'+title : title),:class=>"col-sm-2 control-label muted",:style =>'display: contents;')+
tag(:br)+"#{plc}</span>"
else
label_tag(key,(!@require.blank? ? '*'+title : title),:class=>"col-sm-2 control-label muted") label_tag(key,(!@require.blank? ? '*'+title : title),:class=>"col-sm-2 control-label muted")
end end
end
def can_muti_lang_input? def can_muti_lang_input?
if self.markup == "address" if self.markup == "address"
@ -447,5 +464,49 @@ protected
} }
) )
end end
def show_set_field(field_sets,key_field,key_index,field)
def self.can_muti_lang_input?
true
end
def self.can_add_more
false
end
def self.markup
'text_field'
end
def self.add_more
false
end
@new_attribute = false
@key_index = key_index
def self.key
@key_index
end
def self.form_label
''
end
def self.end_block
hidden_field_tag("seminar_main[#{@key_field}][#{@key_index}]"+"[id]",@attribute_value.id,:for=>"field_#{@key_index}")
end
@key_field = key_field
@field = field
def self.get_basic_field_name_base
"seminar_main[#{@key_field}][#{@key_index}][#{@field}]"
end
def self.get_field_name_base
"seminar_main[#{@key_field}][#{@key_index}][#{@field}]"
end
@attribute_value = field_sets
@prefiled_value = field_sets[field]
a = content_tag(:span,:class => 'btn-group') do
control_group_wrapper do |key,value|
add_more_blank = ""
text_field_tag([get_field_name_base,"[#{key}]"].join,value)
end
end
@key_field = nil
@key_index = nil
@field = nil
return a.html_safe
end
end end

View File

@ -34,17 +34,22 @@ class SeminarMain
has_many :seminar_files, :autosave => true, :dependent => :destroy has_many :seminar_files, :autosave => true, :dependent => :destroy
has_many :seminar_item_contents, :autosave => true, :dependent => :destroy has_many :seminar_item_contents, :autosave => true, :dependent => :destroy
has_many :seminar_signups, :autosave => true, :dependent => :destroy has_many :seminar_signups, :autosave => true, :dependent => :destroy
has_many :seminar_submission_fields, :autosave => true, :dependent => :destroy
has_many :seminar_signup_fields, :autosave => true, :dependent => :destroy has_many :seminar_signup_fields, :autosave => true, :dependent => :destroy
has_many :seminar_reviews, :autosave => true, :dependent => :destroy has_many :seminar_reviews, :autosave => true, :dependent => :destroy
has_many :seminar_signup_field_sets, autosave: true, dependent: :destroy
has_many :seminar_submission_field_sets, autosave: true, dependent: :destroy
has_many :seminar_signup_field_customs, :autosave => true, :dependent => :destroy
accepts_nested_attributes_for :seminar_links, :allow_destroy => true accepts_nested_attributes_for :seminar_links, :allow_destroy => true
accepts_nested_attributes_for :seminar_files, :allow_destroy => true accepts_nested_attributes_for :seminar_files, :allow_destroy => true
accepts_nested_attributes_for :seminar_item_contents, :allow_destroy => true accepts_nested_attributes_for :seminar_item_contents, :allow_destroy => true
accepts_nested_attributes_for :seminar_signups, :allow_destroy => true accepts_nested_attributes_for :seminar_signups, :allow_destroy => true
accepts_nested_attributes_for :seminar_submission_fields, :allow_destroy => true
accepts_nested_attributes_for :seminar_signup_fields, :allow_destroy => true accepts_nested_attributes_for :seminar_signup_fields, :allow_destroy => true
accepts_nested_attributes_for :seminar_reviews, :allow_destroy => true accepts_nested_attributes_for :seminar_reviews, :allow_destroy => true
accepts_nested_attributes_for :seminar_signup_field_sets, :allow_destroy => true
accepts_nested_attributes_for :seminar_submission_field_sets, :allow_destroy => true
accepts_nested_attributes_for :seminar_signup_field_customs, :allow_destroy => true
def self.time_range(date1 = null, date2 = null) def self.time_range(date1 = null, date2 = null)
if !date1.blank? if !date1.blank?

View File

@ -5,9 +5,9 @@ class SeminarSignup
include Mongoid::Timestamps include Mongoid::Timestamps
field :status field :status
field :name field :name # become Last Name for TICC
field :tel, type: String # become First Name for TICC
field :unit, localize: true field :unit, localize: true
field :tel, type: String
field :phone, type: String field :phone, type: String
field :fax, type: String field :fax, type: String
field :email, type: String field :email, type: String

View File

@ -3,12 +3,11 @@ class SeminarSignupContribute
include Mongoid::Document include Mongoid::Document
include Mongoid::Timestamps include Mongoid::Timestamps
mount_uploader :file, AssetUploader
field :description
field :title field :title
mount_uploader :file, AssetUploader
field :description
belongs_to :seminar_signup belongs_to :seminar_signup
has_many :seminar_submission_values, autosave: true, dependent: :destroy
accepts_nested_attributes_for :seminar_submission_values, :allow_destroy => true
end end

View File

@ -25,6 +25,7 @@ class SeminarSignupField
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
before_save :check_option_list before_save :check_option_list
def markup_value def markup_value

View File

@ -0,0 +1,8 @@
class SeminarSignupFieldCustom
include Mongoid::Document
include Mongoid::Timestamps
field :seminar_signup_field_id
field :hidden, type: Boolean, default: true
belongs_to :seminar_main
end

View File

@ -0,0 +1,11 @@
class SeminarSignupFieldSet
include Mongoid::Document
include Mongoid::Timestamps
field :field_name, type: String
field :placeholder
field :name
field :disabled, type: Boolean, default: false
field :hidden, type: Boolean, default: false
belongs_to :seminar_main
end

View File

@ -154,9 +154,14 @@ class SeminarSignupValue
def self.put_field_values(member, field_value_param, field_value_id=nil,field_value_status) def self.put_field_values(member, field_value_param, field_value_id=nil,field_value_status)
if field_value_status.eql?(true) if field_value_status.eql?(true)
@seminar_signup_field_value = self.find(field_value_id) rescue nil @seminar_signup_field_value = member.seminar_signup_values.find(field_value_id) rescue nil
if @seminar_signup_field_value!=nil
puts ['yes']
@seminar_signup_field_value.update(field_value_param) rescue nil @seminar_signup_field_value.update(field_value_param) rescue nil
@seminar_signup_field_value.save rescue nil @seminar_signup_field_value.save rescue nil
else
puts ['no']
end
else else
@seminar_signup_field_value = member.seminar_signup_values.build(field_value_param) rescue nil @seminar_signup_field_value = member.seminar_signup_values.build(field_value_param) rescue nil
@seminar_signup_field_value.save @seminar_signup_field_value.save

View File

@ -0,0 +1,186 @@
class SeminarSubmissionField
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::Attributes::Dynamic
include ::AttributeFieldsHelper
include ::Admin::SeminarsFieldHelper
field :key, type: String
field :af_count
field :title, type: String, localize: true
field :markup, default: "text_field"
field :option_list, type: Hash,default: {}
field :markup_options, type: Hash
field :built_in, type: Boolean, default: false
field :disabled, type: Boolean, default: false
field :to_delete, type: Boolean, default: false
field :to_require,type: Boolean, default: true
field :typeA, type: Hash, default: {cross_lang: false}
field :typeB, type: Hash, default: {}
field :typeC, type: Hash, default: {calendar: "west_calendar", format: "format3"}
field :typeD, type: Hash, default: {cross_lang: false}
field :typeE, type: Hash, default: {}
belongs_to :seminar_main
has_many :seminar_submission_values, autosave: true, dependent: :destroy
accepts_nested_attributes_for :seminar_submission_values, :allow_destroy => true
before_save :check_option_list
def get_basic_field_name_org
"seminar_submission_values"
end
def get_basic_field_name
"seminar_submission_field"
end
def block_helper(member,index,disable = false,attribute_type=nil,con_field=nil, to_require=true,rf)
unless self.disabled
@index = index
@require = to_require
@markup_options = markup_options.merge(:disabled=>disable, :required => to_require)
@member = member
if !(con_field.seminar_submission_values.nil?) && con_field.seminar_submission_values!=[]
@attribute_value = con_field.seminar_submission_values.select{|v| v.seminar_submission_field_id.to_s==rf.id.to_s}[0]
else
@attribute_value = nil
end
@attribute_type = attribute_type
@new_attribute = @attribute_value.nil?
@prefiled_value = @attribute_value.value rescue nil
html = (instance_eval("render_#{markup}") rescue "")
return html
end
end
def markup_value
get_data["option_list"]
end
def add_more
(get_data["add_more"] == "true" ? true : false) rescue false
end
def locale
get_data["cross_lang"] == "true" ? false : true
end
def self_defined_markup_options?
(self.seminar.method(self[:key].pluralize.to_sym) && self.seminar.method(self[:key].pluralize+"_for_"+markup)) rescue false
end
def option_list
if self_defined_markup_options?
#Class need to have corresponding field and value agent
# Ex: For "status" the class must have field called "statuses" for the relation and "statuses_for_select" for the select function
method = self.seminar.method(self[:key].pluralize+"_for_"+markup)
return (method.call rescue {})
elsif self[:option_list].nil? || (self[:option_list].empty?)
return {}
else
return self[:option_list]
end
end
def markup_options=(var)
self[:markup_options] = (eval(var) rescue {})
end
def markup_options
if self[:markup_options].nil?
return {}
else
Hash[self[:markup_options].map{|key,val|[key.to_sym,val]}] rescue {}
end
end
def panel
panel = LIST[:markups][self[:markup]]["panel"]
end
def get_data
self[panel]
end
def typeA=(var)
check_add_more_convert(var)
check_cross_lang_convert(var,"typeA")
self["typeA"] = var
end
def typeD=(var)
check_cross_lang_convert(var,"typeD")
self["typeD"] = var
end
def is_built_in?
self.built_in
end
def is_disabled?
self.disabled
end
def self.add_seminar_signup_field(seminar,seminar_param, seminar_submission_field_id=nil,field_status)
@field_name = 'seminar'
if field_status.eql?(true)
@seminar_submission_field_counter = seminar.seminar_submission_fields.count rescue nil
@seminar_submission_field = self.find(seminar_submission_field_id) rescue nil
old_key = @seminar_submission_field.key
@seminar_submission_field.update(seminar_param)
@seminar_submission_field.save
attribute_values = @seminar_submission_field.seminar_submission_values
if attribute_values.count > 0
attribute_values.each do |av|
av.key = seminar_param["key"]
av.save
end
end
@seminar_submission_field[:af_count] = @seminar_submission_field_counter
else
@seminar_submission_field_counter = seminar.seminar_submission_fields.count rescue nil
@seminar_submission_field = seminar.seminar_submission_fields.build(seminar_param) rescue nil
@seminar_submission_field.save
@seminar_submission_field[:af_count] = @seminar_submission_field_counter
end
return @seminar_submission_field
end
protected
def check_cross_lang_convert(var,field)
if self[field]["cross_lang"] != var["cross_lang"]
case var["cross_lang"]
when "true" #from no-add_more to add_more
cross_lang_convert(:to_cross_lang)
else #from add_more to no-add_more
cross_lang_convert(:to_no_cross_lang)
end # of case
end # of if
end
def check_add_more_convert(var)
if self["typeA"]["add_more"] != var["add_more"]
case var["add_more"]
when "true" #from no-add_more to add_more
add_more_convert(:to_add_more)
else #from add_more to no-add_more
add_more_convert(:to_no_add_more)
end # of case
end # of if
end
def cross_lang_convert(opt)
end
def check_option_list
self[:option_list] = self[panel]["option_list"] rescue nil
end
def add_more_convert(opt)
end
end

View File

@ -0,0 +1,11 @@
class SeminarSubmissionFieldSet
include Mongoid::Document
include Mongoid::Timestamps
field :field_name, type: String
field :placeholder
field :name
field :disabled, type: Boolean, default: false
field :hidden, type: Boolean, default: false
belongs_to :seminar_main
end

View File

@ -0,0 +1,212 @@
class SeminarSubmissionValue
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::Attributes::Dynamic
include ::AttributeValuesHelper
include ::Admin::SeminarsValuesHelper
field :key, type: String
belongs_to :seminar_submission_field
belongs_to :seminar_signup_contribute
before_save :check_key
before_save :data_proc
def add_more_counter
index_max = self["val"].count rescue 0
index_max == 0 ? 1 : index_max
end
def value(index = nil)
site = Site.first
result = case self.seminar_submission_field.markup
when 'text_field','text_area'
if self.seminar_submission_field.add_more and (self.seminar_submission_field.markup == "text_field")
index.nil? ? self["val"] : self["val"][index]
else
self.seminar_submission_field.get_data["cross_lang"] =="true" ? self["val"] : Hash[site.valid_locales.collect{|lang| [lang,self[lang.to_sym]]}]
end
when 'select','radio_button','address'
self["val"]
when 'date'
if !self["val"].blank? and !self["val"]['(1i)'].blank?
"#{self["val"]['(1i)']}/#{self["val"]['(2i)']}/#{self["val"]['(3i)']}"
else
self["val"]
end
when 'checkbox'
self["val"]
end #end of case self.seminar_submission_field.markup
end
def value=(value)
#save everything to temp_data waiting for futher process
self[:temp_data] = value
end
def get_field_value
if (self.seminar_submission_field.markup.eql?("text_field") || self.seminar_submission_field.markup.eql?("text_area"))
field_value = self.value[I18n.locale]
elsif (self.seminar_submission_field.markup.eql?("select") || self.seminar_submission_field.markup.eql?("radio_button"))
field_value = self.seminar_submission_field.markup_value["#{self.value}"][I18n.locale] rescue nil
elsif self.seminar_submission_field.markup.eql?("address")
field_value = rf[:address_key][I18n.locale].map{|k,v| v}.delete_if(&:blank?).join(', ')
elsif self.seminar_submission_field.markup.eql?("date")
case self.seminar_submission_field.typeC['format']
when 'format1'
field_value = self.value.to_date.strftime("%Y/%m/%d")
when 'format2'
field_value = self.value.to_date.strftime("%Y/%m/%d")
when 'format3'
field_value = self.value.to_date.strftime("%Y/%m")
when 'format4'
field_value = self.value.to_date.strftime("%Y")
end
elsif self.seminar_submission_field.markup.eql?("checkbox")
field_value = self.value.map {|v| self.seminar_submission_field.markup_value["#{v}"][I18n.locale]}.join(', ') rescue nil
end
field_value = (field_value =~ /\A#{URI::regexp(['http', 'https'])}\z/) ? "<a href='#{field_value}' target='blank'>#{field_value}</a>" : field_value
field_value = (field_value =~ /\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i) ? "<a href='mailto:#{field_value}'>#{field_value}</a>" : field_value
if !field_value.blank?
{
"key" => self.seminar_submission_field.key,
"title" => self.seminar_submission_field.title,
"value" => field_value,
"val" => field_value = self.value
}
else
{
"key" => self.seminar_submission_field.key,
"title" => self.seminar_submission_field.title,
"value" => "",
"val" => field_value = self.value
}
end
end
def get_value_by_locale(locale,add_more_index=nil)
case self.seminar_submission_field.markup
when "text_field"
case self.seminar_submission_field.add_more
when true
if self.seminar_submission_field.locale
add_more_index.nil? ? self.value.collect{|t| t[locale.to_s]}.join(",") : self.value(add_more_index)[locale]
else
add_more_index.nil? ? self.value.join(",") : self.value(add_more_index)
end
when false
self.seminar_submission_field.locale ? self[locale.to_s] : self.value
end
when "select"
markup_values = self.seminar_submission_field.self_defined_markup_options? ? self.seminar_submission_field.markup_value : self.seminar_submission_field.markup_value
markup_values[self.value][locale.to_s] rescue 'NoData'
when "text_area"
self.seminar_submission_field.locale ? self[locale.to_s] : self.value
when "date"
if self.seminar_submission_field.date_is_range?
get_date_by_format(:from) + ' ~ ' + get_date_by_format(:to)
# self.value["from"] + ' ~ ' + self.value["to"]
else
get_date_by_format
# self.value
end
when "address"
self.value[locale.to_s]
when "radio_button"
markup_values = self.seminar_submission_field.markup_value
markup_values[self.value][locale.to_s]
when "checkbox"
markup_values = self.seminar_submission_field.markup_value
self.value.collect{|key| markup_values["#{key}"][I18n.locale]}.join(",")
when "date_durnation"
self.value
else
self.seminar_submission_field.locale ? self[locale.to_s] : self.value
end
end
def get_date(item = nil)
case item
when :from
# data = self[:val]["from"]
data = self.value["from"]
when :to
# data = self[:val]["to"]
data = self.value["to"]
when nil
# data = self[:val]
data = self.value
end
# Date.new(data["(1i)"].to_i,data["(2i)"].to_i,data["(3i)"].to_i) rescue nil
end
def self.put_field_values(member, field_value_param, field_value_id=nil,field_value_status)
if field_value_status.eql?(true)
@seminar_submission_field_value = self.find(field_value_id) rescue nil
@seminar_submission_field_value.update(field_value_param) rescue nil
@seminar_submission_field_value.save rescue nil
else
@seminar_submission_field_value = member.seminar_submission_values.build(field_value_param) rescue nil
@seminar_submission_field_value.save
end
return @seminar_submission_field_value
end
protected
def unset_all_lang_values
VALID_LOCALES.each{|t| self.unset t}
end
def data_proc
unless self[:temp_data].nil?
case self.seminar_submission_field.markup
when "address"
self["val"] = self["temp_data"]
when 'text_field','text_area'
if self.seminar_submission_field.add_more
self["val"] = self["temp_data"]
else # if not add_more
if self.seminar_submission_field.can_muti_lang_input?
self[:temp_data].each do |key,val|
self[key] = val
end if(!self.seminar_submission_field.get_data[:cross_lang])
else
self["val"] = self[:temp_data]
end
end # of self.seminar_submission_field.add_more
when 'select','date','radio_button'
self["val"] = self[:temp_data]
when 'checkbox'
self["val"] = self[:temp_data].keys
end #end of case self.seminar_submission_field.markup
end # of self[:temp_data].nil?
self.unset('temp_data')
self.unset('temp')
end #of data_proc
def check_key
self.key = self.seminar_submission_field.key
end
def method_missing(*field)
if field.size < 1
self[field[0]]
else
self[(field[0].to_s.delete "=")] = field[1]
end
end
end

View File

@ -24,42 +24,40 @@
<!-- Title --> <!-- Title -->
<div class="control-group"> <div class="control-group">
<label class="control-label muted"><%= t('seminar.title') %></label> <label for="title" class="control-label muted"><%= t('seminar.title') %></label>
<div class="controls"> <div class="controls">
<%= @seminar.title %> <%= @seminar.title %>
</div> </div>
</div> </div>
<% if @seminar.seminar_signup_field_sets.count != 0 %>
<div class="control-group"> <% @seminar.seminar_signup_field_sets.each do |signup_field| %>
<label for="status" class="control-label muted"><%= t('seminar.registration_status') %></label> <% if !(signup_field.disabled) && signup_field.field_name != 'recaptcha' %>
<div class="controls"> <div class="control-group<%= (@seminar.registration_status[0] == 'G' && signup_field.field_name == 'password') ? ' hide' : '' %>" id="<%= signup_field.field_name == 'password' ? 'registration_status' : '' %>">
<label class="radio inline"> <label for="<%= signup_field['name'][I18n.locale] %>" class="control-label muted">
<%= f.radio_button :status, 'G', :checked => true , :onclick => "$('#registration_status').addClass('hide');" %> <%= t('seminar.registration_status_G') %> <%= signup_field['name'][I18n.locale] %>
</label> </label>
<label class="radio inline"> <% if signup_field.field_name == 'status' %>
<%= f.radio_button :status, 'C', :onclick => "$('#registration_status').removeClass('hide');" %> <%= t('seminar.registration_status_C') %>
</label>
</div>
</div>
<!-- Name -->
<div class="control-group">
<label class="control-label muted"><%= t('seminar_signup.name') %></label>
<div class="controls"> <div class="controls">
<%= f.text_field :name, :class => "input-block-level", placeholder: t('seminar_signup.name') %> <% if @seminar.registration_status.include?('G') %>
<label class="radio-inline">
<%= f.radio_button :status, 'G', :checked => (@seminar_signup.status=='G'), :onclick => "$('#registration_status').addClass('hide');" %> <%= t('seminar.registration_status_G') %>
</label>
<% end %>
<% if @seminar.registration_status.include?('C') %>
<label class="radio-inline">
<%= f.radio_button :status, 'C', :onclick => "$('#registration_status').removeClass('hide');", :checked => (@seminar_signup.status=='C') %> <%= t('seminar.registration_status_C') %>
</label>
<% end %>
</div> </div>
</div> <% elsif signup_field.field_name == 'unit' %>
<!-- unit -->
<div class="control-group">
<label class="control-label muted"><%= t('seminar_signup.unit') %></label>
<div class="controls"> <div class="controls">
<div class="input-append"> <div class="input-append">
<div class="tab-content"> <div class="tab-content">
<% @site_in_use_locales.each_with_index do |locale, i| %> <% @site_in_use_locales.each_with_index do |locale, i| %>
<div class="tab-pane fade <%= ( i == 0 ) ? "active in" : '' %>" id="unit_<%= locale %>"> <div class="tab-pane fade <%= ( i == 0 ) ? "active in" : '' %>" id="unit_<%= locale %>">
<%= f.fields_for "unit_translations".to_sym do |f| %> <%= f.fields_for "unit_translations".to_sym do |f| %>
<%= f.text_field locale, :class=>"input-block-level", :value => (@seminar_signup.send("unit_translations")[locale] rescue nil), :placeholder=> "#{t(locale.to_s)}", :required => true %> <%= f.text_field locale, :class=>"input-block-level", :value => (@seminar_signup.send("unit_translations")[locale] rescue nil), :placeholder=> "#{signup_field.placeholder[I18n.locale]}", :required => true %>
<% end %> <% end %>
</div> </div>
<% end %> <% end %>
@ -71,43 +69,14 @@
</div> </div>
</div> </div>
</div> </div>
</div> <% elsif signup_field.field_name == 'address' %>
<!-- Tel -->
<div class="control-group">
<label class="control-label muted"><%= t('seminar_signup.tel') %></label>
<div class="controls"> <div class="controls">
<%= f.text_field :tel, :class=>"input-block-level", :placeholder=> t('seminar_signup.tel'), :required => true %>
</div>
</div>
<!-- Phone -->
<div class="control-group">
<label class="control-label muted"><%= t('seminar_signup.phone') %></label>
<div class="controls">
<%= f.text_field :phone, :class=>"input-block-level", :placeholder=> t('seminar_signup.phone') %>
</div>
</div>
<!-- Fax -->
<div class="control-group">
<label class="control-label muted"><%= t('seminar_signup.fax') %></label>
<div class="controls">
<%= f.text_field :phone, :class=>"input-block-level", :placeholder=> t('seminar_signup.fax') %>
</div>
</div>
<!-- address -->
<div class="control-group">
<label class="control-label muted"><%= t("seminar_signup.address") %></label>
<div class="controls">
<div class="input-append"> <div class="input-append">
<div class="tab-content"> <div class="tab-content">
<% @site_in_use_locales.each_with_index do |locale, i| %> <% @site_in_use_locales.each_with_index do |locale, i| %>
<div class="tab-pane fade <%= ( i == 0 ) ? "active in" : '' %>" id="address_<%= locale %>"> <div class="tab-pane fade <%= ( i == 0 ) ? "active in" : '' %>" id="address_<%= locale %>">
<%= f.fields_for "address_translations".to_sym do |f| %> <%= f.fields_for "address_translations".to_sym do |f| %>
<%= f.text_field locale, :class=>"input-block-level", :value => (@seminar_signup.send("address_translations")[locale] rescue nil), :placeholder=> "#{t(locale.to_s)}" %> <%= f.text_field locale, :class=>"input-block-level", :value => (@seminar_signup.send("address_translations")[locale] rescue nil), :placeholder=> "#{signup_field.placeholder[I18n.locale]}" %>
<% end %> <% end %>
</div> </div>
<% end %> <% end %>
@ -119,49 +88,92 @@
</div> </div>
</div> </div>
</div> </div>
<% elsif signup_field.field_name == 'email' %>
<div class="controls">
<%= f.email_field :email, :class=>"input-block-level", :placeholder=> signup_field.placeholder[I18n.locale], :required => true %>
</div>
<% elsif signup_field.field_name == 'note' %>
<div class="controls">
<div class="input-append">
<div class="tab-content">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<div class="tab-pane fade <%= ( i == 0 ) ? "active in" : '' %>" id="note_<%= locale %>">
<%= f.fields_for "note_translations".to_sym do |f| %>
<%= f.text_area locale, rows: 5, :class=>"input-block-level", :value => (@seminar_signup.send("note_translations")[locale] rescue nil), :placeholder=> "#{signup_field.placeholder[I18n.locale]}" %>
<% end %>
</div>
<% end %>
</div>
<div class="btn-group" data-toggle="buttons-radio">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<a class="btn <%= ( i == 0 ) ? "active" : '' %>" href="#note_<%= locale %>" data-toggle="tab"><%= t(locale.to_s) %></a>
<% end %>
</div>
</div>
</div>
<% else %>
<div class="controls">
<%= f.text_field signup_field['field_name'], :class=>"input-block-level", :id=>signup_field['field_name'], :placeholder=> signup_field.placeholder[I18n.locale], :required => (signup_field.field_name=='password' ? false : true) %>
</div>
<% end %>
</div>
<% end %>
<% end %>
<% else %>
<div class="control-group">
<label for="status" class="control-label muted"><%= t('seminar.registration_status') %></label>
<div class="controls">
<% if @seminar.registration_status.include?('G') %>
<label class="radio-inline">
<%= f.radio_button :status, 'G', :checked => true , :onclick => "$('#registration_status').addClass('hide');" %> <%= t('seminar.registration_status_G') %>
</label>
<% end %>
<% if @seminar.registration_status.include?('C') %>
<label class="radio-inline">
<%= f.radio_button :status, 'C', :onclick => "$('#registration_status').removeClass('hide');", :checked => (@seminar.registration_status.count == 1 and @seminar.registration_status.include?('C') ? true : false) %> <%= t('seminar.registration_status_C') %>
</label>
<% end %>
</div>
</div>
<div>
<div class="col-sm-12"> *(required) </div>
</div>
<!-- Name to Last Name -->
<div class="control-group">
<label for="name" class="control-label muted">*<%= t('seminar_signup.name') %></label>
<div class="controls">
<%= f.text_field :name, :class=>"input-block-level", :id=>'name', :placeholder=> t('seminar_signup.name'), :required => true %>
</div>
</div>
<!-- Tel to First Name -->
<div class="control-group">
<label for="tel" class="control-label muted">*<%= t('seminar_signup.tel') %></label>
<div class="controls">
<%= f.text_field :tel, :class=>"input-block-level", :placeholder=> t('seminar_signup.tel'), :required => true %>
</div>
</div> </div>
<!-- Email --> <!-- Email -->
<div class="control-group"> <div class="control-group">
<label class="control-label muted"><%= t(:email) %></label> <label for="email" class="control-label muted">*<%= t(:email) %></label>
<div class="controls"> <div class="controls">
<%= f.email_field :email, :class=>"input-block-level", :placeholder=> t(:email), :required => true %> <%= f.email_field :email, :class=>"input-block-level", :placeholder=> t(:email), :required => true %> <a href="#" onclick="window.open(' <%= OrbitHelper.url_to_show(@seminar.to_param) %>?method=check_email&no=<%=@seminar.id%>&layout=false&email='+ $('input[type=email]').val() , 'check mail', config='height=100,width=300');" class="btn btn-primary">check mail</a>
</div> </div>
</div> </div>
<!-- password --> <div class="control-group <%= @seminar.registration_status[0] == 'C' ? '' : 'hide' %>" id="registration_status">
<div class="control-group <%= @seminar_signup.status == 'C' ? '' : 'hide' %>" id="registration_status"> <label for="password" class="control-label muted">*<%= t('seminar_signup.password') %></label>
<label class="control-label muted"><%= t('seminar_signup.password') %></label>
<div class="controls"> <div class="controls">
<%= f.text_field :password, :class=>"input-block-level", :placeholder=> t('seminar_signup.password') %> <%= f.text_field :password, :class=>"input-block-level", :placeholder=> t('seminar_signup.password') %>
<%= t('seminar_signup.password_message') %>
</div> </div>
</div> </div>
<!-- Note -->
<div class="control-group">
<label class="control-label muted"><%= t('seminar_signup.note') %></label>
<div class="controls">
<div class="tab-content textarea-lang">
<div class="btn-group" data-toggle="buttons-radio">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<a class="btn <%= ( i == 0 ) ? "active" : '' %>" href="#note_<%= locale %>" for="<%= locale %>" data-toggle="tab"><%= t(locale.to_s) %></a>
<% end %> <% end %>
</div> <% @form_index = 0 %>
<% @site_in_use_locales.each_with_index do |locale, i| %>
<div class="tab-pane fade <%= ( i == 0 ) ? "active in" : '' %>" id="note_<%= locale %>">
<%= f.fields_for "note_translations".to_sym do |f| %>
<%= f.text_area locale, rows: 5, :class=>"input-block-level", :value => (@seminar_signup.send("note_translations")[locale] rescue nil), :placeholder=> "#{t(locale.to_s)}" %>
<% end %>
</div>
<% end %>
</div>
</div>
</div>
<hr>
<% @seminar.seminar_signup_fields.asc(:_id).each do |rf| %> <% @seminar.seminar_signup_fields.asc(:_id).each do |rf| %>
<div class="control-group"> <div class="control-group">
@ -175,6 +187,7 @@
<% end %> <% end %>
</div> </div>
</div> </div>

View File

@ -0,0 +1,132 @@
<div class="attributes default <%= attribute_submission_field.disabled ? 'disabled' : ''%>">
<%
attribute_submission_field.af_count ? @af_counter = attribute_submission_field_counter + attribute_submission_field.af_count : @af_counter = attribute_submission_field_counter
%>
<div class="attributes-header clearfix">
<div class="toggle-control" style="float: right;">
<div class="togglebox <%= attribute_submission_field.disabled ? 'disabled' : ''%>">
<%= hidden_field "#{@field_name}[seminar_submission_fields][#{@af_counter}]","disabled",:value=>attribute_submission_field.disabled,:class=>"toggle-check", :data=>{:deploy=>"right"} %>
<label><b></b></label>
</div>
</div>
<a class="btn btn-mini pull-right btn-danger delete" href="#"><i class="icon-trash"></i> <%= t(:delete_)%></a>
<%= hidden_field "#{@field_name}[seminar_submission_fields][#{@af_counter}]","to_delete",:value=>false,:class=>"attribute_submission_field_to_delete"%>
<a class="btn btn-mini pull-right btn-inverse reply hide" href="#"><i class="icons-reply"></i> Reset</a>
<h4>Field <span><%= @af_counter + 1 %></span></h4>
</div>
<div class="attributes-body">
<div class="control-group">
<label class="control-label muted" for="key_<%= @af_counter %>"><%= t(:key) %></label>
<div class="controls">
<%= text_field "#{@field_name}[seminar_submission_fields][#{@af_counter}]","key",:value=>attribute_submission_field.key, :data=>{:type=>"key"} %>
</div>
</div>
<%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:values=>attribute_submission_field.title_translations,:class_ext=>"pull-left",:label_ext=>t(:name),:field_name=>"#{@field_name}[seminar_submission_fields][#{@af_counter}][title_translations]"}%>
<div class="control-group">
<label class="control-label muted" for=""><%= t('seminar.to_require') %></label>
<div class="controls">
<label class="radio inline">
<%= radio_button("#{@field_name}[seminar_submission_fields][#{@af_counter}]", "to_require", "true",:checked => (attribute_submission_field.to_require == true ? true : false), :data=>{:type=>"search_true"}) %><%= t(:yes_)%>
</label>
<label class="radio inline">
<%= radio_button("#{@field_name}[seminar_submission_fields][#{@af_counter}]", "to_require", "false",:checked => (attribute_submission_field.to_require == false ? true : false), :data=>{:type=>"search_false"}) %><%= t(:no_)%>
</label>
</div>
</div>
<div class="control-group">
<label class="control-label muted" for=""><%= t(:type)%></label>
<div class="controls">
<select class="dataType" data-type="select" name=<%= "#{@field_name}[seminar_submission_fields][#{@af_counter}][markup]"%>>
<%LIST[:markups].each do |key,val|%>
<% if key != 'address' %>
<option value="<%= key %>" <%= attribute_submission_field.markup == key ? 'selected="selected"' : '' %> ref="<%=val["panel"]%>"><%=t("lists.markups."+key)%></option >
<% end %>
<% end %>
</select>
</div>
</div>
</div>
<div class="field-type fade"></div>
<%= content_tag :div,:class=>"field-type default fade in #{show_type_panel(attribute_submission_field,"typeA")}" do%>
<div class="control-group">
<label class="control-label muted"><%= t(:enabled_for)%></label>
<div class="controls">
<label class="checkbox inline">
<%= check_box_tag("#{@field_name}[seminar_submission_fields][#{@af_counter}][typeA][cross_lang]","true",attribute_submission_field["typeA"]["cross_lang"],:data=>{:type=>"cross_lang"}) %>
<%= t(:cross_lang) %>
</label>
<label class="checkbox inline">
<%= check_box_tag("#{@field_name}[seminar_submission_fields][#{@af_counter}][typeA][add_more]","true",attribute_submission_field["typeA"]["add_more"],:data=>{:type=>"add_more"}) %>
<%= t(:add_more)%>
</label>
</div>
</div>
<%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:values=>attribute_submission_field["typeA"]["placeholder"],:field_name=>"#{@field_name}[seminar_submission_fields][#{@af_counter}][typeA][placeholder]"}%>
<% end if show_type_panel(attribute_submission_field,"typeA") != 'typeA hide' %>
<%= content_tag :div,:class=>"field-type default fade in #{show_type_panel(attribute_submission_field,"typeB")}" do %>
<%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:label_ext=>t(:initial),:values=>attribute_submission_field["typeB"]["initial"],:field_name=>"#{@field_name}[seminar_submission_fields][#{@af_counter}][typeB][initial]"}%>
<% if attribute_submission_field.self_defined_markup_options?%>
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:values=>attribute_submission_field["option_list"],:field_name=> "#{@field_name}[seminar_submission_fields][#{@af_counter}][attribute][seminar][statuses]"} %>
<%else #normal list%>
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:values=>attribute_submission_field["option_list"],:field_name=> "#{@field_name}[seminar_submission_fields][#{@af_counter}][typeB][option_list]"} %>
<% end #of self_defined_markup_options?%>
<% end if show_type_panel(attribute_submission_field,"typeB") != 'typeB hide' %>
<%= content_tag :div,:class=>"field-type default fade in #{show_type_panel(attribute_submission_field,"typeC")}" do %>
<div class="control-group">
<label class="control-label"><%= t("date.format")%></label>
<div class="controls">
<%= select "#{@field_name}[seminar_submission_fields][#{@af_counter}][typeC]","format",Admin::AttributeValuesViewHelper::OPT,:class=>"dataType",:selected=>attribute_submission_field["typeC"]["format"] %>
</div>
</div>
<div class="control-group">
<label class="control-label"><%= t("date.range")%></label>
<div class="controls">
<label class="radio inline">
<%= radio_button("#{@field_name}[seminar_submission_fields][#{@af_counter}][typeC]", "is_range", "false",:checked => (!attribute_submission_field.date_is_range? ? true : false)) %><%= t(:yes_)%>
</label>
<label class="radio inline">
<%= radio_button("#{@field_name}[seminar_submission_fields][#{@af_counter}][typeC]", "is_range", "true",:checked => (attribute_submission_field.date_is_range? ? true : false)) %><%= t(:no_)%>
</label>
</div>
</div>
<div class="control-group">
<label class="control-label"><%= t("date.calendar")%></label>
<div class="controls">
<label class="radio inline">
<%= radio_button("#{@field_name}[seminar_submission_fields][#{@af_counter}][typeC]", "calendar", "west_calendar",:checked =>(attribute_submission_field["typeC"]["calendar"]== "west_calendar" ? true : false)) %><%= t("date.west_calendar")%>
</label>
<label class="radio inline">
<%= radio_button("#{@field_name}[seminar_submission_fields][#{@af_counter}][typeC]", "calendar", "tw_calendar",:checked =>(attribute_submission_field["typeC"]["calendar"]== "tw_calendar" ? true : false)) %><%= t("date.tw_calendar")%>
</label>
</div>
</div>
<% end if show_type_panel(attribute_submission_field,"typeC") != 'typeC hide' %>
<%= content_tag :div,:class=>"field-type default fade in #{show_type_panel(attribute_submission_field,"typeD")}" do%>
<div class="control-group">
<label class="control-label"><%= t(:enabled_for)%></label>
<div class="controls">
<label class="checkbox inline">
<%= check_box_tag("#{@field_name}[seminar_submission_fields][#{@af_counter}][typeD][cross_lang]","true",attribute_submission_field["typeD"]["cross_lang"]) %>
<%= t(:cross_lang)%>
</label>
</div>
</div>
<%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:field_name=>"#{@field_name}[seminar_submission_fields][#{@af_counter}][typeD][placeholder]",:values=>attribute_submission_field["typeD"]["placeholder"]} %>
<% end if show_type_panel(attribute_submission_field,"typeD") != 'typeD hide' %>
<%= content_tag :div,:class=>"field-type default fade in #{show_type_panel(attribute_submission_field,"typeE")}" do%>
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:field_name=>"#{@field_name}[seminar_submission_fields][#{@af_counter}][typeE][option_list]",:values=>attribute_submission_field["typeE"]["option_list"]}%>
<% end if show_type_panel(attribute_submission_field,"typeE") != 'typeE hide' %>
<%= hidden_field "#{@field_name}[seminar_submission_fields][#{@af_counter}]","id",:value=>attribute_submission_field.id%>
</div>

View File

@ -10,7 +10,14 @@
<%= javascript_include_tag "lib/file-type" %> <%= javascript_include_tag "lib/file-type" %>
<%= javascript_include_tag "lib/module-area" %> <%= javascript_include_tag "lib/module-area" %>
<% end %> <% end %>
<style type="text/css">
.col-sm-10.controls{
margin-left:0px;
}
.input-append input{
width: 150px;
}
</style>
<!-- Input Area --> <!-- Input Area -->
<div class="input-area"> <div class="input-area">
@ -20,6 +27,9 @@
<li class="active"><a href="#basic" data-toggle="tab"><%= t(:basic) %></a></li> <li class="active"><a href="#basic" data-toggle="tab"><%= t(:basic) %></a></li>
<li><a href="#signup" data-toggle="tab"><%= t('seminar.signup') %></a></li> <li><a href="#signup" data-toggle="tab"><%= t('seminar.signup') %></a></li>
<li><a href="#review" data-toggle="tab"><%= t('seminar.review') %></a></li> <li><a href="#review" data-toggle="tab"><%= t('seminar.review') %></a></li>
<li><a href="#signup_set" data-toggle="tab"><%= t('seminar.signup_set') %></a></li>
<li><a href="#submission_set" data-toggle="tab"><%= t('seminar.submission_set') %></a></li>
<li><a href="#custom_set" data-toggle="tab"><%= t('seminar.custom_set') %></a></li>
</ul> </ul>
<!-- Module --> <!-- Module -->
@ -135,6 +145,104 @@
</div> </div>
<% end %> <% end %>
</div> </div>
<!-- Signup Set Module -->
<div class="tab-pane fade in " id="signup_set" style="padding: 1.2em;">
<table>
<thead>
<th><%= t('seminar.field_name') %></th>
<th><%= t('seminar.name') %></th>
<th><%= t('seminar.placeholder') %></th>
<th><%= t('seminar.disable') %></th>
<th><%= t('seminar.hidden') %></th>
</thead>
<tbody>
<% @signup_sets.each_with_index do |attr_signup,signup_index| %>
<tr>
<td>
<%= t("seminar_signup.#{attr_signup.field_name}") %>
</td>
<td>
<%= show_set_field(attr_signup,'seminar_signup_field_sets',signup_index,'name') %>
</td>
<td>
<%= show_set_field(attr_signup,'seminar_signup_field_sets',signup_index,'placeholder') %>
</td>
<td>
<input type="hidden" class="field_name" name='<%= "seminar_main[seminar_signup_field_sets][#{signup_index}][field_name]" %>' value="<%= attr_signup.field_name %>">
<input type="hidden" class="field_set" name='<%= "seminar_main[seminar_signup_field_sets][#{signup_index}][disabled]" %>' value="false">
<%= check_box_tag("seminar_main[seminar_signup_field_sets][#{signup_index}][disabled]", true ,attr_signup.disabled) %>
</td>
<td>
<% if attr_signup.field_name != 'recaptcha' %>
<input type="hidden" class="field_set" name='<%= "seminar_main[seminar_signup_field_sets][#{signup_index}][hidden]" %>' value="false">
<%= check_box_tag("seminar_main[seminar_signup_field_sets][#{signup_index}][hidden]", true ,attr_signup.hidden) %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<!-- Submission Set Module -->
<div class="tab-pane fade in " id="submission_set" style="padding: 1.2em;">
<table>
<thead>
<th><%= t('seminar.field_name') %></th>
<th><%= t('seminar.name') %></th>
<th><%= t('seminar.placeholder') %></th>
<th><%= t('seminar.disable') %></th>
<th><%= t('seminar.hidden') %></th>
</thead>
<tbody>
<% @submission_set.each_with_index do |attr_signup,submission_index| %>
<tr>
<td>
<%= t("seminar_signup.#{attr_signup.field_name}") %>
</td>
<td>
<%= show_set_field(attr_signup,'seminar_submission_field_sets',submission_index,'name') %>
</td>
<td>
<%= show_set_field(attr_signup,'seminar_submission_field_sets',submission_index,'placeholder') %>
</td>
<td>
<input type="hidden" class="field_name" name='<%= "seminar_main[seminar_submission_field_sets][#{submission_index}][field_name]" %>' value="<%= attr_signup.field_name %>">
<input type="hidden" class="field_set" name='<%= "seminar_main[seminar_submission_field_sets][#{submission_index}][disabled]" %>' value="false">
<%= check_box_tag("seminar_main[seminar_submission_field_sets][#{submission_index}][disabled]", true ,attr_signup.disabled) %>
</td>
<td>
<input type="hidden" class="field_set" name='<%= "seminar_main[seminar_submission_field_sets][#{submission_index}][hidden]" %>' value="false">
<%= check_box_tag("seminar_main[seminar_submission_field_sets][#{submission_index}][hidden]", true ,attr_signup.hidden) %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<!-- Custom Set Module -->
<div class="tab-pane fade in " id="custom_set" style="padding: 1.2em;">
<table>
<thead>
<th style="padding-right: 2em;"><%= t('seminar.field_name') %></th>
<th><%= t('seminar.hidden') %></th>
</thead>
<tbody>
<% @custom_set.each_with_index do |attr_custom,custom_index| %>
<tr>
<td>
<%= SeminarSignupField.where(id:attr_custom.seminar_signup_field_id).first.title rescue '' %>
</td>
<td>
<input type="hidden" class="field_set" name='<%= "seminar_main[seminar_signup_field_customs][#{custom_index}][hidden]" %>' value="false">
<%= check_box_tag("seminar_main[seminar_signup_field_customs][#{custom_index}][hidden]", true ,attr_custom.hidden) %>
</td>
<input for="field_0" id="seminar_main_seminar_signup_field_customs_<%= custom_index.to_s %>_id" name="seminar_main[seminar_signup_field_customs][<%= custom_index.to_s %>][id]" type="hidden" value="<%= attr_custom.id.to_s %>">
</tr>
<% end %>
</tbody>
</table>
</div>
</div> </div>
<!-- Language Tabs --> <!-- Language Tabs -->

View File

@ -1,7 +1,7 @@
<% if form_file.new_record? %> <% if form_file.new_record? %>
<div class="fileupload fileupload-new start-line" data-provides="fileupload"> <div class="fileupload fileupload-new start-line" data-provides="fileupload">
<% else %> <% else %>
<div class="fileupload fileupload-exist start-line" data-provides="fileupload"> <div class="fileupload fileupload-exists start-line" data-provides="fileupload">
<% if form_file.file.blank? %> <% if form_file.file.blank? %>
<%= t(:no_file) %> <%= t(:no_file) %>
<% else %> <% else %>

View File

@ -26,6 +26,7 @@
<li><a href="/admin/seminars/<%=seminar.id.to_s%>/edit"><%= t(:edit) %></a></li> <li><a href="/admin/seminars/<%=seminar.id.to_s%>/edit"><%= t(:edit) %></a></li>
<li><a href="<%= admin_seminar_item_contents_path(:seminar_main_id=>seminar.id.to_s) %>"><%= t('seminar.set_seminar_item_content') %></a></li> <li><a href="<%= admin_seminar_item_contents_path(:seminar_main_id=>seminar.id.to_s) %>"><%= t('seminar.set_seminar_item_content') %></a></li>
<li><a href="/admin/seminars/<%=seminar.id.to_s%>/seminar_signup_field"><%= t('seminar.set_seminar_signup_field') %></a></li> <li><a href="/admin/seminars/<%=seminar.id.to_s%>/seminar_signup_field"><%= t('seminar.set_seminar_signup_field') %></a></li>
<li><a href="/admin/seminars/<%=seminar.id.to_s%>/seminar_submission_field"><%= t('seminar.set_seminar_submission_field') %></a></li>
<li><a href="#" class="delete text-error" rel="/admin/seminars/<%=seminar.id.to_s%>"><%= t(:delete_) %></a></li> <li><a href="#" class="delete text-error" rel="/admin/seminars/<%=seminar.id.to_s%>"><%= t(:delete_) %></a></li>
<% end %> <% end %>
</ul> </ul>

View File

@ -17,16 +17,77 @@
<table class="table main-list"> <table class="table main-list">
<thead> <thead>
<tr class="sort-header"> <tr class="sort-header">
<% if @seminar.seminar_signup_field_sets.count != 0 %>
<% @seminar.seminar_signup_field_sets.each do |field_set| %>
<% if !(field_set.hidden) %>
<th class='span2'><%= field_set.name[I18n.locale] %></th>
<% end %>
<% end %>
<% else %>
<th class='span2'><%= t('seminar_signup.name')%></th> <th class='span2'><%= t('seminar_signup.name')%></th>
<th class='span2'><%= t('seminar_signup.tel')%></th>
<th class='span2'><%= t('seminar.registration_status')%></th> <th class='span2'><%= t('seminar.registration_status')%></th>
<th class='span2'><%= t('seminar_signup.file_note')%></th> <% end %>
<th class='span2'><%= t('seminar_signup.uploads')%></th> <% if @seminar.seminar_signup_field_customs.count != 0 %>
<% @seminar.seminar_signup_field_customs.each do |field_set| %>
<% if !(field_set.hidden) %>
<th class='span2'><%= SeminarSignupField.where(id:field_set.seminar_signup_field_id).first.title rescue '' %></th>
<% end %>
<% end %>
<% end %>
<% if @seminar.seminar_submission_field_sets.count != 0 %>
<% show1 = !(@seminar.seminar_submission_field_sets.select{|v| v.field_name=='title'}[0].hidden)
show2 = !(@seminar.seminar_submission_field_sets.select{|v| v.field_name=='file'}[0].hidden)
show3 = !(@seminar.seminar_submission_field_sets.select{|v| v.field_name=='description'}[0].hidden)
%>
<% else %>
<% show1 = true
show2 = true
show3 = true
%>
<% end %>
<% if show1 %>
<th class='span2'><%= t('seminar_signup.title')%></th>
<% end %>
<% if show2 %>
<th class='span2'><%= t('seminar_signup.file')%></th>
<% end %>
<% if show3 %>
<th class='span2'><%= t('seminar_signup.description')%></th>
<% end %>
<% @seminar.seminar_submission_fields.each do |submission_field| %>
<th class='span2'><%= submission_field.title %></th>
<% end %>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<% @seminar_signups.each do |seminar_signup| %> <% @seminar_signups.each do |seminar_signup| %>
<% len = seminar_signup.seminar_signup_contributes.count %>
<tr> <tr>
<td> <% if @seminar.seminar_signup_field_sets.count != 0 %>
<% @seminar.seminar_signup_field_sets.each do |field_set| %>
<% if !(field_set.hidden) %>
<td rowspan="<%= len==0? 1 : len %>">
<% if field_set.field_name== 'name' %>
<%= seminar_signup.name %>
<div class="quick-edit">
<ul class="nav nav-pills">
<% if can_edit_or_delete?(seminar_signup) %>
<li><a href="/admin/seminar_signups/<%=seminar_signup.id.to_s%>/edit"><%= t(:edit) %></a></li>
<li><a href="#" class="delete text-error" rel="/admin/seminar_signups/<%=seminar_signup.id.to_s%>"><%= t(:delete_) %></a></li>
<% end %>
</ul>
</div>
<% elsif field_set.field_name== 'status' %>
<%= t("seminar.registration_status_#{seminar_signup.status}") if !seminar_signup.status.blank? %>
<% else %>
<%= seminar_signup.send("#{field_set.field_name}") %>
<% end %>
</td>
<% end %>
<% end %>
<% else %>
<td rowspan="<%= len==0? 1 : len %>">
<%= seminar_signup.name %> <%= seminar_signup.name %>
<div class="quick-edit"> <div class="quick-edit">
<ul class="nav nav-pills"> <ul class="nav nav-pills">
@ -37,20 +98,107 @@
</ul> </ul>
</div> </div>
</td> </td>
<td><%= t("seminar.registration_status_#{seminar_signup.status}") if !seminar_signup.status.blank? %> <td rowspan="<%= len==0? 1 : len %>"><%= seminar_signup.tel %></td>
<td rowspan="<%= len==0? 1 : len %>"><%= t("seminar.registration_status_#{seminar_signup.status}") if !seminar_signup.status.blank? %>
</td> </td>
<% end %>
<% if @seminar.seminar_signup_field_customs.count != 0 %>
<% @seminar.seminar_signup_field_customs.each do |field_set| %>
<% if !(field_set.hidden) %>
<td rowspan="<%= len==0? 1 : len %>">
<% seminar_signup.seminar_signup_values.each do |seminar_signup_values| %>
<% if seminar_signup_values.seminar_signup_field_id == field_set.seminar_signup_field_id %>
<% if seminar_signup_values.value.class == String || seminar_signup_values.value.nil? %>
<%= seminar_signup_values.get_value_by_locale(I18n.locale,seminar_signup_values) %>
<% else %>
<% seminar_signup_values.value.each do |key,v| %>
<%= "#{I18n.t(key)}:#{seminar_signup_values.get_value_by_locale(key,seminar_signup_values)}" %>
<br>
<% end %>
<% end %>
<% end %>
<% end %>
</td>
<% end %>
<% end %>
<% end %>
<% count_set = 0 %>
<% if @seminar.seminar_submission_field_sets.count != 0 %>
<% show1 = !(@seminar.seminar_submission_field_sets.select{|v| v.field_name=='title'}[0].hidden)
show2 = !(@seminar.seminar_submission_field_sets.select{|v| v.field_name=='file'}[0].hidden)
show3 = !(@seminar.seminar_submission_field_sets.select{|v| v.field_name=='description'}[0].hidden)
%>
<% @seminar.seminar_submission_field_sets.each do |field_set| %>
<% if !(field_set.hidden) %>
<% count_set+=1 %>
<% end %>
<% end %>
<% else %>
<% show1 = true
show2 = true
show3 = true
%>
<% count_set = 2 %>
<% end %>
<% if len==0 %>
<%
count_field = @seminar.seminar_submission_fields.count
%>
<ul> <ul>
<td> <% for i in 1..count_field+count_set %>
<% seminar_signup.seminar_signup_contributes.collect do |seminar_signup_contribute| %> <td rowspan="1">
<li><%= seminar_signup_contribute.description.to_s.html_safe %></li>
<% end %>
</td> </td>
<td> <% end %>
</ul>
</tr>
<% end %>
<ul>
<% seminar_signup.seminar_signup_contributes.collect do |seminar_signup_contribute| %> <% seminar_signup.seminar_signup_contributes.collect do |seminar_signup_contribute| %>
<li><%= link_to (seminar_signup_contribute.title.blank? ? File.basename(seminar_signup_contribute.file.path) : seminar_signup_contribute.title) , seminar_signup_contribute.file.url, {:target => '_blank', :title => Nokogiri::HTML(seminar_signup_contribute.description).text} if seminar_signup_contribute.file.file %> <% if show1 %>
<td>
<li><%= seminar_signup_contribute.title.to_s %></li>
</td>
<% end %>
<% if show2 %>
<td>
<li>
<%= link_to (seminar_signup_contribute.title.blank? ? File.basename(seminar_signup_contribute.file.path) : seminar_signup_contribute.title) , seminar_signup_contribute.file.url, {:target => '_blank', :title => Nokogiri::HTML(seminar_signup_contribute.description).text} if seminar_signup_contribute.file.file %>
</li> </li>
<% end %>
</td> </td>
<% end %>
<% if show3 %>
<td>
<li><%= seminar_signup_contribute.description.to_s.html_safe %></li>
</td>
<% end %>
<%
count_value = seminar_signup_contribute.seminar_submission_values.count
count_field = @seminar.seminar_submission_fields.count
%>
<% if count_value == count_field %>
<% seminar_signup_contribute.seminar_submission_values.each do |value| %>
<td>
<span style="display: list-item;">
<% if value.value.class == String || value.value.nil? %>
<%= value.get_value_by_locale(I18n.locale,value) %>
<% else %>
<% value.value.each do |key,v| %>
<%= "#{I18n.t(key)}:#{value.get_value_by_locale(key,value)}" %>
<br>
<% end %>
<% end %>
</span>
</td>
<% end %>
<% else %>
<% for i in 1..(count_field-count_value) %>
<td>
</td>
<% end %>
<% end %>
</tr>
<tr>
<% end %>
</ul> </ul>
</tr> </tr>
<% end %> <% end %>

View File

@ -0,0 +1,36 @@
<% content_for :page_specific_css do -%>
<%= stylesheet_link_tag "lib/wrap-nav.css" %>
<%= stylesheet_link_tag "lib/pageslide.css" %>
<%= stylesheet_link_tag "lib/main-forms.css" %>
<%= stylesheet_link_tag "lib/togglebox.css" %>
<% end -%>
<% content_for :page_specific_javascript do -%>
<%= javascript_include_tag "lib/jquery.tmpl.min.js" %>
<%= javascript_include_tag "field-forms-submission.js" %>
<% end -%>
<%= form_for @attribute,:url => admin_seminar_path(@attribute) , :html => { :class=> "form-horizontal main-forms" } do |f| %>
<% if flash.now[:notice].present? %>
<%= flash.now[:notice]%>
<% end %>
<h3><%= @attribute.title %></h3>
<fieldset>
<div id="attributes-area" class="input-area">
<%= render partial: "attribute_submission_field",collection: @attribute.seminar_submission_fields.asc(:_id)%>
</div>
<div class="form-actions">
<button type="button" class="btn btn-success add-attributes"><%= t(:add_attribute_field) %></button>
<%= hidden_field_tag 'id', params[:id] if !params[:id].blank? %>
<%= f.submit t(:submit),:class=>"btn btn-primary"%>
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div>
</fieldset>
<% end %>
<% content_for :page_specific_javascript do -%>
<%= render 'support_member_form_js' %>
<% end -%>

View File

@ -1,5 +1,6 @@
<% # encoding: utf-8 %> <% # encoding: utf-8 %>
<%= stylesheet_link_tag "lib/jquery-ui-1.12.1/jquery-ui.min.css" %> <%= stylesheet_link_tag "lib/jquery-ui-1.12.1/jquery-ui.min.css" %>
<%= stylesheet_link_tag "seminar" %>
<%= javascript_include_tag 'basic.js' %> <%= javascript_include_tag 'basic.js' %>
<% @@session = session %> <% @@session = session %>
<%= yield %> <%= yield %>
@ -8,6 +9,7 @@
@con = data["con"] @con = data["con"]
@seminar = data["seminar"] @seminar = data["seminar"]
@seminar_signup = data["seminar_signup"] @seminar_signup = data["seminar_signup"]
@form_index = 0
%> %>
<% if !session[:seminar_signup_id].blank? %> <% if !session[:seminar_signup_id].blank? %>
@ -15,28 +17,73 @@
<%= form_for @con, url: add_file_proc_seminars_path, html: {class: "content form-horizontal" , :id=>"new-seminar-signup-contribute"} do |f| %> <%= form_for @con, url: add_file_proc_seminars_path, html: {class: "content form-horizontal" , :id=>"new-seminar-signup-contribute"} do |f| %>
<fieldset> <fieldset>
<% if @seminar.seminar_submission_field_sets.count != 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]
data3 = @seminar.seminar_submission_field_sets.select{|v| v.field_name=='file'}[0]
show1 = !(data1.disabled)
show2 = !(data2.disabled)
show3 = !(data3.disabled)
name1 = data1['name'][I18n.locale]
name2 = data2['name'][I18n.locale]
name3 = data3['name'][I18n.locale]
plc1 = data1['placeholder'][I18n.locale]
plc2 = data2['placeholder'][I18n.locale]==t('seminar_signup.description') ? '' : data2['placeholder'][I18n.locale]
plc3 = data3['placeholder'][I18n.locale]==t('seminar_signup.file') ? '' : data3['placeholder'][I18n.locale]
else
show1 = true
show2 = true
show3 = true
name1 = t('seminar_signup.title')
name2 = t('seminar_signup.description')
name3 = t('seminar_signup.file')
plc1 = t('seminar_signup.title')
plc2 = ''
plc3 = ''
end
%>
<% if show1 %>
<div class="form-group"> <div class="form-group">
<label for="file_name" class="col-sm-2 control-label">*<%= t('seminar_signup.file_name') %></label> <label for="file_name" class="col-sm-2 control-label">*<%= name1 %></label>
<div class="col-sm-10"> <div class="col-sm-10">
<%= f.text_field :title, :class=>"input-medium form-control", :id=>'name', :placeholder=> t('seminar_signup.file_name'), :required => true %> <%= f.text_field :title, :class=>"input-medium form-control", :id=>'name', :placeholder=> plc1, :required => true %>
</div> </div>
</div> </div>
<% end %>
<div class="form-group"> <% if show2 %>
<label for="note" class="col-sm-2 control-label"><%= t('seminar_signup.file_note') %></label> <div class="form-group" style="display: flex;justify-content: flex-end;text-align: right;">
<span style="margin-right: 0.5em;">
<label for="note" class="col-sm-2 control-label" style="display: contents;">
<%= name2 %>
</label>
<br>
<%= "(#{plc2})" if !(plc2.to_s.blank?) %>
</span>
<div class="col-sm-10"> <div class="col-sm-10">
<%= f.text_area :description, rows: 5, :class=>"ckeditor input-medium form-control", :placeholder=> t('seminar_signup.file_note') %> <%= f.text_area :description, rows: 5, :class=>"ckeditor input-medium form-control", :placeholder=> plc2 %>
</div> </div>
</div> </div>
<% end %>
<div class="form-group"> <% if show3 %>
<label for="file" class="col-sm-2 control-label"><%= t('seminar_signup.files') %></label> <div class="form-group" style="display: flex;justify-content: flex-end;text-align: right;">
<span style="margin-right: 0.5em;">
<label for="note" class="col-sm-2 control-label" style="display: contents;">
<%= name3 %>
</label>
<br>
<%= "(#{plc3})" if !(plc3.to_s.blank?) %>
</span>
<div class="col-sm-10"> <div class="col-sm-10">
<%= f.file_field :file %> <%= f.file_field :file %>
</div> </div>
</div> </div>
<% end %>
<% @seminar.seminar_submission_fields.asc(:_id).each do |rf| %>
<div class="form-group" style="<%= rf.markup=='text_area' ? 'display: flex;justify-content: flex-end;text-align: right;' : '' %>">
<%= rf.block_helper(@seminar,@form_index,false,"seminar_signup_contribute",@con, rf.to_require,rf) %>
</div>
<% @form_index = @form_index +1 %>
<% end %>
<div class="form-group"> <div class="form-group">
<div class="col-sm-offset-2 col-sm-10"> <div class="col-sm-offset-2 col-sm-10">
<input type="hidden" name="referer_url" value="<%= request.original_url.split(request.env["HTTP_HOST"]).last.split('?').first %>"> <input type="hidden" name="referer_url" value="<%= request.original_url.split(request.env["HTTP_HOST"]).last.split('?').first %>">
@ -45,7 +92,7 @@
<%= f.button t('cancel'), type: 'reset', class: 'btn' %> <%= f.button t('cancel'), type: 'reset', class: 'btn' %>
</div> </div>
</div> </div>
</fieldset>
<% end %> <% end %>
<% else %> <% else %>

View File

@ -6,5 +6,5 @@
<center> <center>
<p><%= result %> </p> <p><%= result %> </p>
<a onClick="window.close()">關閉視窗</a> <a onClick="window.close()"><%= t('seminar.close_window') %></a>
</center> </center>

View File

@ -52,10 +52,9 @@
<%= link_to content_tag(:i, nil, :class => 'icon-plus') +' '+ t('new_'), OrbitHelper.url_to_show(@seminar.to_param) + '?method=add_file', :class => 'btn btn-primary' %> <%= link_to content_tag(:i, nil, :class => 'icon-plus') +' '+ t('new_'), OrbitHelper.url_to_show(@seminar.to_param) + '?method=add_file', :class => 'btn btn-primary' %>
<% end %> <% end %>
<br /> <br />
<br /> <br />
檔案上限: <%= @seminar.contribute_file_count.blank? ? '無' : @seminar.contribute_file_count %> <!-- 檔案上限: <%#= @seminar.contribute_file_count.blank? ? '無' : @seminar.contribute_file_count %> -->
<% else %> <% else %>

View File

@ -1,36 +1,87 @@
<% # encoding: utf-8 %> <% # encoding: utf-8 %>
<%= stylesheet_link_tag "lib/jquery-ui-1.12.1/jquery-ui.min.css" %> <%= stylesheet_link_tag "lib/jquery-ui-1.12.1/jquery-ui.min.css" %>
<%= stylesheet_link_tag "seminar" %>
<%= javascript_include_tag 'basic.js' %> <%= javascript_include_tag 'basic.js' %>
<% @@session = session %>
<%= yield %>
<% <%
data = action_data data = action_data
@con = data["con"] @con = data["con"]
@seminar = data["seminar"]
@seminar_signup = data["seminar_signup"]
@form_index = 0
%> %>
<% if !session[:seminar_signup_id].blank? %> <% if !session[:seminar_signup_id].blank? %>
<%= form_for @con, url: edit_file_proc_seminars_path, html: {class: "content form-horizontal" , :id=>"new-seminar-signup-contribute"} do |f| %> <%= form_for @con, url: edit_file_proc_seminars_path, html: {class: "content form-horizontal" , :id=>"new-seminar-signup-contribute"} do |f| %>
<fieldset> <fieldset>
<% if @seminar.seminar_submission_field_sets.count != 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]
data3 = @seminar.seminar_submission_field_sets.select{|v| v.field_name=='file'}[0]
show1 = !(data1.disabled)
show2 = !(data2.disabled)
show3 = !(data3.disabled)
name1 = data1['name'][I18n.locale]
name2 = data2['name'][I18n.locale]
name3 = data3['name'][I18n.locale]
plc1 = data1['placeholder'][I18n.locale]
plc2 = data2['placeholder'][I18n.locale]==t('seminar_signup.description') ? '' : data2['placeholder'][I18n.locale]
plc3 = data3['placeholder'][I18n.locale]==t('seminar_signup.file') ? '' : data3['placeholder'][I18n.locale]
else
show1 = true
show2 = true
show3 = true
name1 = t('seminar_signup.title')
name2 = t('seminar_signup.description')
name3 = t('seminar_signup.file')
plc1 = t('seminar_signup.title')
plc2 = ''
plc3 = ''
end
%>
<% if show1 %>
<div class="form-group"> <div class="form-group">
<label for="file_name" class="col-sm-2 control-label">*<%= t('seminar_signup.file_name') %></label> <label for="file_name" class="col-sm-2 control-label">*<%= name1 %></label>
<div class="col-sm-10"> <div class="col-sm-10">
<%= f.text_field :title, :class=>"input-medium form-control", :id=>'name', :placeholder=> t('seminar_signup.file_name'), :required => true %> <%= f.text_field :title, :class=>"input-medium form-control", :id=>'name', :placeholder=> plc1, :required => true %>
</div> </div>
</div> </div>
<% end %>
<div class="form-group"> <% if show2 %>
<label for="note" class="col-sm-2 control-label"><%= t('seminar_signup.file_note') %></label> <div class="form-group" style="display: flex;justify-content: flex-end;text-align: right;">
<span style="margin-right: 0.5em;">
<label for="note" class="col-sm-2 control-label" style="display: contents;">
<%= name2 %>
</label>
<br>
<%= "(#{plc2})" if !(plc2.to_s.blank?) %>
</span>
<div class="col-sm-10"> <div class="col-sm-10">
<%= f.text_area :description, rows: 5, :class=>"ckeditor input-medium form-control", :placeholder=> t('seminar_signup.file_note') %> <%= f.text_area :description, rows: 5, :class=>"ckeditor input-medium form-control", :placeholder=> plc2 %>
</div> </div>
</div> </div>
<% end %>
<div class="form-group"> <% if show3 %>
<label for="file" class="col-sm-2 control-label"><%= t('seminar_signup.files') %></label> <div class="form-group" style="display: flex;justify-content: flex-end;text-align: right;">
<span style="margin-right: 0.5em;">
<label for="note" class="col-sm-2 control-label" style="display: contents;">
<%= name3 %>
</label>
<br>
<%= "(#{plc3})" if !(plc3.to_s.blank?) %>
</span>
<div class="col-sm-10"> <div class="col-sm-10">
<%= f.file_field :file %> <%= f.file_field :file %>
</div> </div>
</div> </div>
<% end %>
<% @seminar.seminar_submission_fields.asc(:_id).each do |rf| %>
<div class="form-group" style="<%= rf.markup=='text_area' ? 'display: flex;justify-content: flex-end;text-align: right;' : '' %>">
<%= rf.block_helper(@seminar,@form_index,false,"seminar_signup_contribute",@con, rf.to_require,rf) %>
</div>
<% @form_index = @form_index +1 %>
<% end %>
<div class="form-group"> <div class="form-group">
<div class="col-sm-offset-2 col-sm-10"> <div class="col-sm-offset-2 col-sm-10">
<input type="hidden" name="referer_url" value="<%= request.original_url.split(request.env["HTTP_HOST"]).last.split('?').first %>"> <input type="hidden" name="referer_url" value="<%= request.original_url.split(request.env["HTTP_HOST"]).last.split('?').first %>">
@ -40,7 +91,7 @@
<%= f.button t('cancel'), type: 'reset', class: 'btn' %> <%= f.button t('cancel'), type: 'reset', class: 'btn' %>
</div> </div>
</div> </div>
</fieldset>
<% end %> <% end %>
<% else %> <% else %>

View File

@ -28,7 +28,105 @@
<%= @seminar.title %> <%= @seminar.title %>
</div> </div>
</div> </div>
<% if @seminar.seminar_signup_field_sets.count != 0 %>
<% @seminar.seminar_signup_field_sets.each do |signup_field| %>
<% if signup_field.field_name == 'name' %>
<div>
<div class="col-sm-12" style="text-align: center;"> *(<%= t('seminar.required') %>) </div>
</div>
<% end %>
<% if !(signup_field.disabled) && signup_field.field_name != 'recaptcha' %>
<div class="form-group<%= (@seminar.registration_status[0] == 'G' && signup_field.field_name == 'password') ? ' hide' : '' %>" id="<%= signup_field.field_name == 'password' ? 'registration_status' : '' %>">
<label for="<%= signup_field['name'][I18n.locale] %>" class="col-sm-2 control-label">
<% if !(['status','address','note'].include? signup_field.field_name) %>
*
<% end %>
<%= signup_field['name'][I18n.locale] %>
</label>
<% if signup_field.field_name == 'status' %>
<div class="col-sm-10">
<% if @seminar.registration_status.include?('G') %>
<label class="radio-inline">
<%= f.radio_button :status, 'G', :checked => true , :onclick => "$('#registration_status').addClass('hide');" %> <%= t('seminar.registration_status_G') %>
</label>
<% end %>
<% if @seminar.registration_status.include?('C') %>
<label class="radio-inline">
<%= f.radio_button :status, 'C', :onclick => "$('#registration_status').removeClass('hide');", :checked => (@seminar.registration_status.count == 1 and @seminar.registration_status.include?('C') ? true : false) %> <%= t('seminar.registration_status_C') %>
</label>
<% end %>
</div>
<% elsif signup_field.field_name == 'unit' %>
<div class="col-sm-10">
<div class="input-append">
<div class="tab-content">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<div class="tab-pane fade <%= ( i == 0 ) ? "active in" : '' %>" id="unit_<%= locale %>">
<%= f.fields_for "unit_translations".to_sym do |f| %>
<%= f.text_field locale, :class=>"input-medium form-control", :value => (@seminar_signup.send("unit_translations")[locale] rescue nil), :placeholder=> "#{signup_field.placeholder[I18n.locale]}", :required => true %>
<% end %>
</div>
<% end %>
</div>
<div class="btn-group" data-toggle="buttons-radio">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<a class="btn <%= ( i == 0 ) ? "active" : '' %>" href="#unit_<%= locale %>" data-toggle="tab"><%= t(locale.to_s) %></a>
<% end %>
</div>
</div>
</div>
<% elsif signup_field.field_name == 'address' %>
<div class="col-sm-10">
<div class="input-append">
<div class="tab-content">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<div class="tab-pane fade <%= ( i == 0 ) ? "active in" : '' %>" id="address_<%= locale %>">
<%= f.fields_for "address_translations".to_sym do |f| %>
<%= f.text_field locale, :class=>"input-medium form-control", :value => (@seminar_signup.send("address_translations")[locale] rescue nil), :placeholder=> "#{signup_field.placeholder[I18n.locale]}" %>
<% end %>
</div>
<% end %>
</div>
<div class="btn-group" data-toggle="buttons-radio">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<a class="btn <%= ( i == 0 ) ? "active" : '' %>" href="#address_<%= locale %>" data-toggle="tab"><%= t(locale.to_s) %></a>
<% end %>
</div>
</div>
</div>
<% elsif signup_field.field_name == 'email' %>
<div class="col-sm-10">
<%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> signup_field.placeholder[I18n.locale], :required => true %> <a href="#" onclick="window.open(' <%= OrbitHelper.url_to_show(@seminar.to_param) %>?method=check_email&no=<%=@seminar.id%>&layout=false&email='+ $('input[type=email]').val() , 'check mail', config='height=100,width=300');" class="btn btn-primary">check mail</a>
</div>
<% elsif signup_field.field_name == 'note' %>
<div class="col-sm-10">
<div class="input-append">
<div class="tab-content">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<div class="tab-pane fade <%= ( i == 0 ) ? "active in" : '' %>" id="note_<%= locale %>">
<%= f.fields_for "note_translations".to_sym do |f| %>
<%= f.text_area locale, rows: 5, :class=>"input-medium form-control", :value => (@seminar_signup.send("note_translations")[locale] rescue nil), :placeholder=> "#{signup_field.placeholder[I18n.locale]}" %>
<% end %>
</div>
<% end %>
</div>
<div class="btn-group" data-toggle="buttons-radio">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<a class="btn <%= ( i == 0 ) ? "active" : '' %>" href="#note_<%= locale %>" data-toggle="tab"><%= t(locale.to_s) %></a>
<% end %>
</div>
</div>
</div>
<% else %>
<div class="col-sm-10">
<%= f.text_field signup_field['field_name'], :class=>"input-medium form-control", :id=>signup_field['field_name'], :placeholder=> signup_field.placeholder[I18n.locale], :required => (signup_field.field_name=='password' ? false : true) %>
</div>
<% end %>
</div>
<% end %>
<% end %>
<% else %>
<div class="form-group"> <div class="form-group">
<label for="status" class="col-sm-2 control-label"><%= t('seminar.registration_status') %></label> <label for="status" class="col-sm-2 control-label"><%= t('seminar.registration_status') %></label>
<div class="col-sm-10"> <div class="col-sm-10">
@ -45,7 +143,11 @@
</div> </div>
</div> </div>
<!-- Name --> <div>
<div class="col-sm-12" style="text-align: center;"> *(<%= t('seminar.required') %>) </div>
</div>
<!-- Name to Last Name -->
<div class="form-group"> <div class="form-group">
<label for="name" class="col-sm-2 control-label">*<%= t('seminar_signup.name') %></label> <label for="name" class="col-sm-2 control-label">*<%= t('seminar_signup.name') %></label>
<div class="col-sm-10"> <div class="col-sm-10">
@ -53,30 +155,7 @@
</div> </div>
</div> </div>
<!-- unit --> <!-- Tel to First Name -->
<div class="form-group">
<label for="unit" class="col-sm-2 control-label">*<%= t("seminar_signup.unit")%></label>
<div class="col-sm-10">
<div class="input-append">
<div class="tab-content">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<div class="tab-pane fade <%= ( i == 0 ) ? "active in" : '' %>" id="unit_<%= locale %>">
<%= f.fields_for "unit_translations".to_sym do |f| %>
<%= f.text_field locale, :class=>"input-medium form-control", :value => (@seminar_signup.send("unit_translations")[locale] rescue nil), :placeholder=> "#{t(locale.to_s)}", :required => true %>
<% end %>
</div>
<% end %>
</div>
<div class="btn-group" data-toggle="buttons-radio">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<a class="btn <%= ( i == 0 ) ? "active" : '' %>" href="#unit_<%= locale %>" data-toggle="tab"><%= t(locale.to_s) %></a>
<% end %>
</div>
</div>
</div>
</div>
<!-- Tel -->
<div class="form-group"> <div class="form-group">
<label for="tel" class="col-sm-2 control-label">*<%= t('seminar_signup.tel') %></label> <label for="tel" class="col-sm-2 control-label">*<%= t('seminar_signup.tel') %></label>
<div class="col-sm-10"> <div class="col-sm-10">
@ -84,45 +163,6 @@
</div> </div>
</div> </div>
<!-- Phone -->
<div class="form-group">
<label for="phone" class="col-sm-2 control-label"><%= t('seminar_signup.phone') %></label>
<div class="col-sm-10">
<%= f.text_field :phone, :class=>"input-medium form-control", :placeholder=> t('seminar_signup.phone') %>
</div>
</div>
<!-- Fax -->
<div class="form-group">
<label for="fax" class="col-sm-2 control-label"><%= t('seminar_signup.fax') %></label>
<div class="col-sm-10">
<%= f.text_field :fax, :class=>"input-medium form-control", :placeholder=> t('seminar_signup.fax') %>
</div>
</div>
<!-- address -->
<div class="form-group">
<label for="address" class="col-sm-2 control-label"><%= t("seminar_signup.address")%></label>
<div class="col-sm-10">
<div class="input-append">
<div class="tab-content">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<div class="tab-pane fade <%= ( i == 0 ) ? "active in" : '' %>" id="address_<%= locale %>">
<%= f.fields_for "address_translations".to_sym do |f| %>
<%= f.text_field locale, :class=>"input-medium form-control", :value => (@seminar_signup.send("address_translations")[locale] rescue nil), :placeholder=> "#{t(locale.to_s)}" %>
<% end %>
</div>
<% end %>
</div>
<div class="btn-group" data-toggle="buttons-radio">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<a class="btn <%= ( i == 0 ) ? "active" : '' %>" href="#address_<%= locale %>" data-toggle="tab"><%= t(locale.to_s) %></a>
<% end %>
</div>
</div>
</div>
</div>
<!-- Email --> <!-- Email -->
<div class="form-group"> <div class="form-group">
<label for="email" class="col-sm-2 control-label">*<%= t(:email) %></label> <label for="email" class="col-sm-2 control-label">*<%= t(:email) %></label>
@ -139,29 +179,7 @@
</div> </div>
</div> </div>
<!-- Note -->
<div class="form-group">
<label for="note" class="col-sm-2 control-label"><%= t("seminar_signup.note")%></label>
<div class="col-sm-10">
<div class="input-append">
<div class="tab-content">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<div class="tab-pane fade <%= ( i == 0 ) ? "active in" : '' %>" id="note_<%= locale %>">
<%= f.fields_for "note_translations".to_sym do |f| %>
<%= f.text_area locale, rows: 5, :class=>"input-medium form-control", :value => (@seminar_signup.send("note_translations")[locale] rescue nil), :placeholder=> "#{t(locale.to_s)}" %>
<% end %> <% end %>
</div>
<% end %>
</div>
<div class="btn-group" data-toggle="buttons-radio">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<a class="btn <%= ( i == 0 ) ? "active" : '' %>" href="#note_<%= locale %>" data-toggle="tab"><%= t(locale.to_s) %></a>
<% end %>
</div>
</div>
</div>
</div>
<% @seminar.seminar_signup_fields.asc(:_id).each do |rf| %> <% @seminar.seminar_signup_fields.asc(:_id).each do |rf| %>
<div class="form-group"> <div class="form-group">
@ -176,6 +194,8 @@
<!-- 驗證碼 --> <!-- 驗證碼 -->
<% if @seminar.seminar_signup_field_sets.count != 0 %>
<% if !(@seminar.seminar_signup_field_sets.select{|v| v.field_name=='recaptcha'}[0].disabled) %>
<div class="form-group"> <div class="form-group">
<label for="note" class="col-sm-2 control-label"><%= t('seminar_signup.recaptcha') %></label> <label for="note" class="col-sm-2 control-label"><%= t('seminar_signup.recaptcha') %></label>
<div class="col-sm-10"> <div class="col-sm-10">
@ -183,6 +203,8 @@
<%= gotcha %> <%= gotcha %>
</div> </div>
</div> </div>
<% end %>
<% end %>
<!-- <div class="form-group"> <!-- <div class="form-group">
<label for="note" class="col-sm-2 control-label"><%#= t('nkuht_donate.recaptcha') %></label> <label for="note" class="col-sm-2 control-label"><%#= t('nkuht_donate.recaptcha') %></label>

View File

@ -15,7 +15,7 @@
} }
</style> </style>
<h3>個資及隱私權保護宣告</h3> <h3><%= t('seminar_signup.privacy_statement') %></h3>
<div class="highlight seminar_privacy"> <div class="highlight seminar_privacy">

View File

@ -4,3 +4,9 @@
%> %>
<%= t('seminar_signup.success_message') %> <%= t('seminar_signup.success_message') %>
<% if !params['status'].nil? %>
<br>
<a href="<%= OrbitHelper.url_to_show(params[:slug]) %>?method=con_login">
<%= t('seminar.click_to_contribute') %>
</a>
<% end %>

View File

@ -6,7 +6,9 @@ en:
restful_actions: restful_actions:
act_signup: Sign Up Info #報名資料 act_signup: Sign Up Info #報名資料
seminar_submission_field: Seminar Submission Field
seminar_signup_field: Seminar Signup Field
seminar_signup: Signup Analyze
module_name: module_name:
seminar: Seminar #研討會 seminar: Seminar #研討會
@ -15,6 +17,20 @@ en:
verification_failed: Verification Failed #驗證碼錯誤 verification_failed: Verification Failed #驗證碼錯誤
seminar: seminar:
click_to_contribute: Click here to contribute
required: Required
already_used: Already Used
please_enter_email: Please enter email
available: Available
close_window: Close window
custom_set: Custom Set
field_name: Field Name
placeholder: Placeholder
name: Show Name
disable: Disable
hidden: Hidden(admin)
submission_set: Submission Set
signup_set: Signup Set
reviewer: Reviewer #審查委員 reviewer: Reviewer #審查委員
review_end_date: Review End Date #審查結束日期 review_end_date: Review End Date #審查結束日期
review_start_date: Review Start Date #審查開始日期 review_start_date: Review Start Date #審查開始日期
@ -31,7 +47,7 @@ en:
act_place: Seminar Location #活動地點 act_place: Seminar Location #活動地點
registration_status: Attendee Role #報名身分 registration_status: Attendee Role #報名身分
registration_status_C: Contributor #投稿者 registration_status_C: Contributor #投稿者
registration_status_G: Normal sign up #一般報名 registration_status_G: Attendee #Normal sign up #一般報名
seminar_start_date: Seminar Start Date #活動開始時間 seminar_start_date: Seminar Start Date #活動開始時間
seminar_end_date: Seminar End Date #活動結束時間 seminar_end_date: Seminar End Date #活動結束時間
signup_start_date: Sign Up Start Date #報名開始時間 signup_start_date: Sign Up Start Date #報名開始時間
@ -45,6 +61,7 @@ en:
signup: Sign Up #報名 signup: Sign Up #報名
export: Export #匯出 export: Export #匯出
set_seminar_items: Items #項目 set_seminar_items: Items #項目
set_seminar_submission_field: Set Submission Field
set_seminar_signup_field: Set Sign Up Field #圈選設定 set_seminar_signup_field: Set Sign Up Field #圈選設定
set_seminar_item_content: Set Item Content #項目設定 set_seminar_item_content: Set Item Content #項目設定
set_seminar_agreements: Personal Data Usage Agreements #個資宣告設定 set_seminar_agreements: Personal Data Usage Agreements #個資宣告設定
@ -68,10 +85,14 @@ en:
content: Content #內容 content: Content #內容
seminar_signup: seminar_signup:
status: Attendee Role
title: File Name
description: Summary
file: Files
signup_time: Sign Up Time #報名時間 signup_time: Sign Up Time #報名時間
name: Name name: Name
unit: Unit #單位 unit: Unit #單位
tel: TEL tel: Tel
phone: Mobile telephone phone: Mobile telephone
fax: Fax fax: Fax
address: Address #地址 address: Address #地址
@ -82,6 +103,8 @@ en:
time: 'Start / End Time' #(開始/結束)時間 time: 'Start / End Time' #(開始/結束)時間
place: Place #地點 place: Place #地點
agree: "Accept Privacy and Personal Information Protection Policy of the Site" agree: "Accept Privacy and Personal Information Protection Policy of the Site"
privacy_statement: 'Privacy and Personal Information Protection Policy of the Site'
recaptcha: Verification code
signup_field: Sign Up Field #圈選項目 signup_field: Sign Up Field #圈選項目
uploads: Uploads #上傳檔案 uploads: Uploads #上傳檔案
con_login: Contributor Login #投稿者登入 con_login: Contributor Login #投稿者登入

View File

@ -6,7 +6,9 @@ zh_tw:
restful_actions: restful_actions:
act_signup: 報名資料 act_signup: 報名資料
seminar_submission_field: 上傳介面欄位
seminar_signup_field: 報名欄位
seminar_signup: 報名統計
module_name: module_name:
seminar: 研討會 seminar: 研討會
@ -15,6 +17,20 @@ zh_tw:
verification_failed: 驗證碼錯誤 verification_failed: 驗證碼錯誤
seminar: seminar:
click_to_contribute: 按此登入投稿
required: 必填
already_used: 已存在
please_enter_email: 請輸入Email
available: 可使用
close_window: 關閉視窗
custom_set: 客製化欄位設定
field_name: 欄位名稱
placeholder: 提示文字
name: 顯示名稱
disable: 關閉
hidden: 隱藏(後台)
submission_set: 投稿欄位設定
signup_set: 報名欄位設定
reviewer: 審查委員 reviewer: 審查委員
review_end_date: 審查結束日期 review_end_date: 審查結束日期
review_start_date: 審查開始日期 review_start_date: 審查開始日期
@ -45,6 +61,7 @@ zh_tw:
signup: 報名 signup: 報名
export: 匯出 export: 匯出
set_seminar_items: 項目 set_seminar_items: 項目
set_seminar_submission_field: 上傳介面欄位設定
set_seminar_signup_field: 圈選設定 set_seminar_signup_field: 圈選設定
set_seminar_item_content: 項目設定 set_seminar_item_content: 項目設定
set_seminar_agreements: 個資宣告設定 set_seminar_agreements: 個資宣告設定
@ -68,6 +85,10 @@ zh_tw:
content: 內容 content: 內容
seminar_signup: seminar_signup:
status: 報名身分
title: 稿件名稱
description: 摘要
file: 檔案
signup_time: 報名時間 signup_time: 報名時間
name: 姓名 name: 姓名
unit: 單位 unit: 單位
@ -82,6 +103,7 @@ zh_tw:
time: (開始/結束)時間 time: (開始/結束)時間
place: 地點 place: 地點
agree: 同意接受本站個資及隱私權保護宣告 agree: 同意接受本站個資及隱私權保護宣告
privacy_statement: '個資及隱私權保護宣告'
recaptcha: 驗證碼 recaptcha: 驗證碼
signup_field: 圈選項目 signup_field: 圈選項目
uploads: 上傳檔案 uploads: 上傳檔案

View File

@ -11,6 +11,7 @@ Rails.application.routes.draw do
get 'seminar_signup' get 'seminar_signup'
get 'seminar_item_content' get 'seminar_item_content'
get 'seminar_signup_field' get 'seminar_signup_field'
get 'seminar_submission_field'
end end
end end
resources :seminar_items do resources :seminar_items do

File diff suppressed because one or more lines are too long