Fix bug. Add signup limit feature. #2

Merged
chiu merged 7 commits from 123/seminar:master into master 2023-01-11 10:13:37 +00:00
15 changed files with 289 additions and 272 deletions
Showing only changes of commit c756faf89f - Show all commits

View File

@ -96,7 +96,7 @@ function inputAppendLength() {
// 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]",
var fields = $('#sub_seminar_main').length ? "sub_seminar_main[seminar_submission_fields_attributes]" : "seminar_main[seminar_submission_fields_attributes]",
data = {
_add_more: ["add_more_" +l, fields+"["+l+"]["+type+"][add_more]"],
_calendar: ["calendar_" +l, fields+"["+l+"]["+type+"][calendar]"],
@ -110,7 +110,7 @@ function setData(l, type, ol) {
_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]"],
_destroy: ["destroy_" +l, fields+"["+l+"][_destroy]"],
_to_require: ["to_require_" +l, fields+"["+l+"][to_require]"],
};
return data;
@ -270,6 +270,7 @@ $(function() {
attributesArray = [];
attributesHeaderLength = null;
templateType = null;
var default_templateType = 'typeA';
attributeIndex = null;
if($('.add-target').length) {
inputAppendLength();
@ -286,7 +287,7 @@ $(function() {
};
attributesHeaderLength = $('.attributes:not(:hidden)').length+1;
attributesLength = $('#attributes-area .attributes').length;
$("#template-attributes").tmpl(setData(attributesLength, templateType, appendIndex)).appendTo( "#attributes-area" );
$("#template-attributes").tmpl(setData(attributesLength, default_templateType, appendIndex)).appendTo( "#attributes-area" );
$('.toggle-check').togglebox();
});
@ -426,7 +427,7 @@ $(function() {
if(!$('.attributes:not(:hidden)').length) {
$('#attributes-area').addClass('clickHere');
};
}).find('.attribute_field_to_delete').attr('value', 'true');;
}).find('.attribute_field_destroy').attr('value', 'true');;
};
if($(this).hasClass('trigger')) {
// appendIndex = $(this).closest('.controls').find('.input-append').length;

View File

@ -96,7 +96,7 @@ function inputAppendLength() {
// Role Attribute Template Data
function setData(l, type, ol) {
var fields = $('#info').length ? "info[seminar_signup_fields]" : $('#sub_seminar_main').length ? "sub_seminar_main[seminar_signup_fields]" : "seminar_main[seminar_signup_fields]",
var fields = $('#sub_seminar_main').length ? "sub_seminar_main[seminar_signup_fields_attributes]" : "seminar_main[seminar_signup_fields_attributes]",
data = {
_add_more: ["add_more_" +l, fields+"["+l+"]["+type+"][add_more]"],
_calendar: ["calendar_" +l, fields+"["+l+"]["+type+"][calendar]"],
@ -110,7 +110,7 @@ function setData(l, type, ol) {
_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]"],
_destroy: ["destroy_" +l, fields+"["+l+"][_destroy]"],
_to_require: ["to_require_" +l, fields+"["+l+"][to_require]"],
};
return data;
@ -270,6 +270,7 @@ $(function() {
attributesArray = [];
attributesHeaderLength = null;
templateType = null;
var default_templateType = 'typeA';
attributeIndex = null;
if($('.add-target').length) {
inputAppendLength();
@ -286,10 +287,7 @@ $(function() {
};
attributesHeaderLength = $('.attributes:not(:hidden)').length+1;
attributesLength = $('#attributes-area .attributes').length;
if(templateType == null){
templateType = "typeA";
}
$("#template-attributes").tmpl(setData(attributesLength, templateType, appendIndex)).appendTo( "#attributes-area" );
$("#template-attributes").tmpl(setData(attributesLength, default_templateType, appendIndex)).appendTo( "#attributes-area" );
$('.toggle-check').togglebox();
});
@ -429,7 +427,7 @@ $(function() {
if(!$('.attributes:not(:hidden)').length) {
$('#attributes-area').addClass('clickHere');
};
}).find('.attribute_field_to_delete').attr('value', 'true');;
}).find('.attribute_field_destroy').attr('value', 'true');;
};
if($(this).hasClass('trigger')) {
// appendIndex = $(this).closest('.controls').find('.input-append').length;

View File

@ -501,26 +501,13 @@ class Admin::SeminarsController < OrbitAdminController
@seminar_params["reviewer_ids"] = [] if @seminar_params["reviewer_ids"].nil?
@seminar_params["organizer_id"] = nil if @seminar_params["organizer_id"].nil?
end
if @seminar_params[:seminar_signup_fields]
@seminar_params[:seminar_signup_fields].each do |a|
@field_name = 'seminar_main'
field_status = a.last[:id].present?
@attribute_field = SeminarSignupField.add_seminar_signup_field(@seminar, a.last, a.last[:id], field_status)
@attribute = @seminar
end
if @seminar_params[:seminar_signup_fields_attributes]
@seminar.update_attributes(@seminar_params.slice(:seminar_signup_fields_attributes))
flash.now[:notice] = "Updated Fields"
@seminar.seminar_signup_fields.each{|t| t.destroy if t["to_delete"] == true}
redirect_to admin_seminars_path and return
elsif @seminar_params[: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
elsif @seminar_params[:seminar_submission_fields_attributes]
@seminar.update_attributes(@seminar_params.slice(:seminar_submission_fields_attributes))
flash.now[:notice] = "Updated Fields"
@seminar.seminar_submission_fields.each{|t| t.destroy if t["to_delete"] == true}
if @seminar.seminar_submission_fields.select{|sf| sf.markup == "seminar_preferred_session"}.count != 0
@seminar.update(:assign_mode => 2)
default_sort_number = SeminarSignup.fields['sort_number'].options[:default]
@ -553,7 +540,6 @@ class Admin::SeminarsController < OrbitAdminController
end
redirect_to admin_seminars_path and return
else
if !seminar_params['seminar_links_attributes'].nil?
seminar_params['seminar_links_attributes'].each do |idx,link|
seminar_params['seminar_links_attributes'].delete(idx.to_s) if link['url'].blank?
@ -562,6 +548,7 @@ class Admin::SeminarsController < OrbitAdminController
@seminar.update_user_id = current_user.id
if @seminar.update_attributes(seminar_params)
@seminar.update_enable_recaptcha
@seminar.seminar_signup_fields.each{|t| t.destroy if t["to_delete"] == true}
redirect_to params['referer_url'] and return
else

View File

@ -1,5 +1,4 @@
class SeminarsController < ApplicationController
helper MemberHelper
include MemberHelper
include ActionView::Context #vary important (only add this can access @@session from view)
@ -25,36 +24,38 @@ class SeminarsController < ApplicationController
time_now = DateTime.now
session = OrbitHelper.request.session
seminars = seminars.map do |seminar|
link_url = OrbitHelper.url_to_show(seminar.to_param)
if !seminar.registration_status.blank? && (seminar.signup_start_date <= time_now rescue false) && ( seminar.signup_end_date.nil? || seminar.signup_end_date+1 >= time_now )
sign_up = ('<a href="'+ link_url + '" target="_blank">' + I18n.t('seminar.signup') + '</a>').html_safe
elsif seminar.registration_status.blank?
sign_up = I18n.t('seminar.sign_up_not_open')
elsif (seminar.signup_start_date > @time_now rescue false)
sign_up = I18n.t('seminar.sign_up_not_yet')
link_url = OrbitHelper.url_to_plugin_show(seminar.to_param, 'seminar')
registration_is_open = seminar.registration_status.present?
sign_up_not_yet = seminar.signup_start_date && @time_now && @seminar.signup_start_date > @time_now
sign_up_overdue = seminar.signup_end_date && @time_now && (@seminar.signup_end_date + 1.day <= @time_now)
seminar_url = (@custom_slug ? OrbitHelper.url_to_show(@custom_slug) : OrbitHelper.url_to_show(seminar.to_param))
if !registration_is_open
sign_up = t('seminar.sign_up_not_open')
elsif sign_up_not_yet
sign_up = t('seminar.sign_up_not_yet')
elsif sign_up_overdue
sign_up = t('seminar.sign_up_overdue')
else
sign_up = I18n.t('seminar.sign_up_overdue')
sign_up_text = t('seminar.signup')
sign_up = link_to(sign_up_text, seminar.get_frontend_url(link_url), :target=>'_blank', :title=>sign_up_text)
end
if !seminar.registration_status.blank? && seminar.registration_status.include?('C') && (seminar.contribute_start_date <= time_now rescue false) && ( seminar.contribute_end_date.nil? || (seminar.contribute_end_date+1 >= time_now rescue false) )
sign_up += "<span style=\"margin-left: 1em;\">".html_safe
if !session[:seminar_signup_id].blank?
if session[:seminar_main_id] == seminar.id
sign_up += ('<a href="'+ link_url + '?method=con_upload">' + t('seminar_signup.uploads') + '</a>').html_safe
sign_up += content_tag :span, :style=> "margin-left: 1em;" do
if session[:seminar_signup_id].present? && session[:seminar_main_id] == seminar.id
button_text = t('seminar_signup.uploads')
link_to(button_text, seminar.get_frontend_url(link_url, :con_upload), {:title=>button_text})
else
sign_up += ('<a href="'+ link_url + '?method=con_login">' + t('seminar_signup.con_login') + '</a>').html_safe
button_text = t('seminar_signup.con_login')
link_to(button_text, seminar.get_frontend_url(link_url, :con_login), {:title=>button_text})
end
else
sign_up += ('<a href="'+ link_url + '?method=con_login">' + t('seminar_signup.con_login') + '</a>').html_safe
end
sign_up += "</span>".html_safe
end
files = seminar.seminar_files.map{|file| { "file_url" => file.file.url, "file_title" => (file.title.blank? ? File.basename(file.file.path) : file.title rescue '') } } rescue []
files.delete(nil)
links = seminar.seminar_links.map{|link| { "link_url" => link.url, "link_title" => (link.title.blank? ? link.url : link.title) } } rescue []
links = seminar.seminar_links.map{|link| { "link_url" => link.url, "link_title" => (link.title.blank? ? link.url : link.title rescue '') } } rescue []
{"title" => seminar.title,
"subtitle" => sign_up,
"category" => (seminar.category.title rescue ""),
"link_to_show" => (link_url == "#" ? '' : link_url + "?method=show_data"),
"link_to_show" => (OrbitHelper.instance_variable_get(:@url_to_plugin_show_blank) ? 'javascript:void(0)' : seminar.get_frontend_url(link_url, :show_data)),
"postdate" => seminar.seminar_start_date,
"statuses" => {},
"bulletin_links" => links,
@ -185,14 +186,12 @@ class SeminarsController < ApplicationController
sign_up = t('seminar.sign_up_overdue')
end
if !seminar.registration_status.blank? && seminar.registration_status.include?('C') && seminar.contribute_start_date <= time_now && ( seminar.contribute_end_date.nil? || seminar.contribute_end_date+1 >= time_now )
if !@@session[:seminar_signup_id].blank?
if @@session[:seminar_main_id] == seminar.id
contribute_action = ('<a href="'+ submission_url + '?method=con_upload">' + t('seminar_signup.uploads') + '</a>').html_safe
else
contribute_action = ('<a href="'+ submission_url + '?method=con_login">' + t('seminar_signup.con_login') + '</a>').html_safe
end
if @@session[:seminar_signup_id].present? && @@session[:seminar_main_id] == seminar.id
button_text = t('seminar_signup.uploads')
contribute_action = link_to(button_text, submission_url + '?method=con_upload', :title=>button_text)
else
contribute_action = ('<a href="'+ submission_url + '?method=con_login">' + t('seminar_signup.con_login') + '</a>').html_safe
button_text = t('seminar_signup.con_login')
contribute_action = link_to(button_text, submission_url + '?method=con_login', :title=>button_text)
end
end
data = {
@ -288,6 +287,23 @@ class SeminarsController < ApplicationController
:params=>params,:session=>@@session},:layout=>false).html_safe
end
end
def get_referer_url_for_notice(notice_words)
referer_url = params[:referer_url].to_s
split_path = referer_url.split("/")
last_path = split_path.last
if last_path.include?("?")
referer_url = split_path[0...-1].join('/') + '/' + last_path.split('?')[0]
uri_query = last_path.split("?")[1..-1].join('?')
uri_query.gsub!(/notice=[^&]*/,'').gsub!(/&+$/,'')
if uri_query.blank?
referer_url = referer_url + "?notice=#{notice_words}"
else
referer_url = referer_url + "?#{uri_query}&notice=#{notice_words}"
end
else
referer_url = referer_url + "?notice=#{notice_words}"
end
end
def show_privacy
params = OrbitHelper.params
@ -310,31 +326,31 @@ class SeminarsController < ApplicationController
params = OrbitHelper.params
seminar = SeminarMain.find_by(uid: params[:uid])
if !seminar.registration_status.blank? && seminar.signup_start_date <= time_now && ( seminar.signup_end_date.nil? || seminar.signup_end_date+1 >= time_now )
sign_up = ('<a href="'+ (@custom_slug ? OrbitHelper.url_to_show(@custom_slug) : OrbitHelper.url_to_show(seminar.to_param)) + @registration_postfix.to_s + '" target="_blank">' + t('seminar.signup') + '</a>').html_safe
elsif seminar.registration_status.blank?
registration_is_open = seminar.registration_status.present?
sign_up_not_yet = seminar.signup_start_date && @time_now && @seminar.signup_start_date > @time_now
sign_up_overdue = seminar.signup_end_date && @time_now && (@seminar.signup_end_date + 1.day <= @time_now)
seminar_url = (@custom_slug ? OrbitHelper.url_to_show(@custom_slug) : OrbitHelper.url_to_show(seminar.to_param))
if !registration_is_open
sign_up = t('seminar.sign_up_not_open')
elsif seminar.signup_start_date > time_now
elsif sign_up_not_yet
sign_up = t('seminar.sign_up_not_yet')
else
elsif sign_up_overdue
sign_up = t('seminar.sign_up_overdue')
else
sign_up_text = t('seminar.signup')
sign_up = link_to(sign_up_text, seminar.get_frontend_url(seminar_url), :target=>'_blank', :title=>sign_up_text)
end
if !seminar.registration_status.blank? && seminar.registration_status.include?('C') && seminar.contribute_start_date <= time_now && ( seminar.contribute_end_date.nil? || seminar.contribute_end_date+1 >= time_now )
if !@@session[:seminar_signup_id].blank?
if @@session[:seminar_main_id] == seminar.id
contribute_action = ('<a href="'+ OrbitHelper.url_to_show(seminar.to_param) + '?method=con_upload">' + t('seminar_signup.uploads') + '</a>').html_safe
else
contribute_action = ('<a href="'+ OrbitHelper.url_to_show(seminar.to_param) + '?method=con_login">' + t('seminar_signup.con_login') + '</a>').html_safe
end
if @@session[:seminar_signup_id].present? && @@session[:seminar_main_id] == seminar.id
button_text = t('seminar_signup.uploads')
contribute_action = link_to(button_text, seminar.get_frontend_url(seminar_url, :con_upload), :title=>button_text)
else
contribute_action = ('<a href="'+ OrbitHelper.url_to_show(seminar.to_param) + '?method=con_login">' + t('seminar_signup.con_login') + '</a>').html_safe
button_text = t('seminar_signup.con_login')
contribute_action = link_to(button_text, seminar.get_frontend_url(seminar_url, :con_login), :title=>button_text)
end
end
{
'seminar' => seminar,
'sign_up' => sign_up,
@ -400,84 +416,62 @@ class SeminarsController < ApplicationController
end
def create
@signup = SeminarSignup.where(email: params[:seminar_signup][:email], seminar_main_id: params[:seminar_signup][:seminar_main_id] ).first
seminar_id = params[:seminar_signup][:seminar_main_id]
@seminar = SeminarMain.where(id: seminar_id).first
if @seminar.enable_recaptcha && (!gotcha_valid?)
notice_words = t('recaptcha.errors.verification_failed')
referer_url = get_referer_url_for_notice(notice_words)
redirect_to referer_url, :notice => notice_words
return
end
@signup = SeminarSignup.where(email: params[:seminar_signup][:email], seminar_main_id: seminar_id ).first
@seminar_signup = SeminarSignup.new(seminar_signup_params)
@seminar = SeminarMain.where(id:params[:seminar_signup][:seminar_main_id]).first
if @seminar.seminar_signup_field_sets.count!=0
flag = @seminar.seminar_signup_field_sets.select{|v| v.field_name=='recaptcha'}[0].disabled
else
flag = false
end
if gotcha_valid? || flag
if @signup.blank? && @seminar_signup.save
# if gotcha_valid? && @seminar_signup.save
if !params[:seminar_signup_values].nil?
seminar_signup_values_params.each_with_index do |r,i|
field_value = r.last[:id].present?
@custom_field_value = SeminarSignupValue.put_field_values(@seminar_signup, r.last, r.last[:seminar_signup_field_id], field_value)
end
seminar_reviews = SeminarReview.where(:seminar_main_id=>@seminar.id).to_a
seminar_reviews.each{|sr| sr.save}
@seminar = @seminar_signup.seminar_main
unassigned_seminar_signup_ids = @seminar.seminar_signup_ids.map{|s| s.to_s}
unassigned_seminar_signup_ids.push(@seminar_signup.id.to_s)
seminar_reviews = SeminarReview.where(:seminar_main_id=>@seminar.id).to_a
seminar_reviews.each do |sr|
unassigned_seminar_signup_ids = unassigned_seminar_signup_ids - sr.all_seminar_signup_ids
end
@seminar.unassigned_seminar_signup_ids << @seminar_signup.id.to_s
@seminar.unassigned_mode_1_seminar_signup_ids << @seminar_signup.id.to_s
@seminar.save
else
@seminar.unassigned_seminar_signup_ids << @seminar_signup.id.to_s
@seminar.unassigned_mode_1_seminar_signup_ids << @seminar_signup.id.to_s
@seminar.save
not_signup_yet = @signup.blank?
if not_signup_yet && @seminar_signup.save
if !params[:seminar_signup_values].nil?
seminar_signup_values_params.each_with_index do |r,i|
field_value = r.last[:id].present?
@custom_field_value = SeminarSignupValue.put_field_values(@seminar_signup, r.last, r.last[:seminar_signup_field_id], field_value)
end
extra_text = "<br>#{I18n.t('seminar_signup.serial_number')}: #{@seminar_signup.display_serial_number}"
extra_text += render_to_string("seminars/signup_email_contents",:locals=>{:seminar=>@seminar,
:seminar_signup=>@seminar_signup},:layout=>false)
if params['seminar_signup']['status']=='C'
status_param = '&status='
send_mail('submission',params[:seminar_signup][:email],params[:seminar_signup][:seminar_main_id],extra_text)
else
status_param = ''
send_mail('signup',params[:seminar_signup][:email],params[:seminar_signup][:seminar_main_id],extra_text)
seminar_reviews = SeminarReview.where(:seminar_main_id=>@seminar.id).to_a
seminar_reviews.each{|sr| sr.save}
@seminar = @seminar_signup.seminar_main
unassigned_seminar_signup_ids = @seminar.seminar_signup_ids.map{|s| s.to_s}
unassigned_seminar_signup_ids.push(@seminar_signup.id.to_s)
seminar_reviews = SeminarReview.where(:seminar_main_id=>@seminar.id).to_a
seminar_reviews.each do |sr|
unassigned_seminar_signup_ids = unassigned_seminar_signup_ids - sr.all_seminar_signup_ids
end
redirect_to "#{params[:referer_url].to_s.chomp('/')}/?method=signup_ok#{status_param}&serial_number=#{@seminar_signup.display_serial_number}"
@seminar.unassigned_seminar_signup_ids << @seminar_signup.id.to_s
@seminar.unassigned_mode_1_seminar_signup_ids << @seminar_signup.id.to_s
@seminar.save
else
if !@signup.blank?
redirect_to "#{params[:referer_url]}", :notice => 'mail已存在'
else
referer_url = params[:referer_url].to_s
if referer_url.split("/").last.include?("?")
uri_query = referer_url.split("?").last.gsub(/notice=[^&]*/,'')
if uri_query == ""
referer_url = referer_url.split("?")[0...-1].join("?") + "?notice=#{t('recaptcha.errors.verification_failed')}"
else
referer_url = referer_url.split("?")[0...-1].join("?") + "&notice=#{t('recaptcha.errors.verification_failed')}"
end
else
referer_url = referer_url + "?notice=#{t('recaptcha.errors.verification_failed')}"
end
redirect_to referer_url, :notice => t('recaptcha.errors.verification_failed')
end
@seminar.unassigned_seminar_signup_ids << @seminar_signup.id.to_s
@seminar.unassigned_mode_1_seminar_signup_ids << @seminar_signup.id.to_s
@seminar.save
end
else
referer_url = params[:referer_url].to_s
if referer_url.split("/").last.include?("?")
uri_query = referer_url.split("?").last.gsub(/notice=[^&]*/,'')
if uri_query == ""
referer_url = referer_url.split("?")[0...-1].join("?") + "?notice=#{t('recaptcha.errors.verification_failed')}"
else
referer_url = referer_url.split("?")[0...-1].join("?") + "&notice=#{t('recaptcha.errors.verification_failed')}"
end
extra_text = "<br>#{I18n.t('seminar_signup.serial_number')}: #{@seminar_signup.display_serial_number}"
extra_text += render_to_string("seminars/signup_email_contents",:locals=>{:seminar=>@seminar,
:seminar_signup=>@seminar_signup},:layout=>false)
if params['seminar_signup']['status']=='C'
status_param = '&status='
send_mail('submission',params[:seminar_signup][:email],params[:seminar_signup][:seminar_main_id],extra_text)
else
referer_url = referer_url + "?notice=#{t('recaptcha.errors.verification_failed')}"
status_param = ''
send_mail('signup',params[:seminar_signup][:email],params[:seminar_signup][:seminar_main_id],extra_text)
end
redirect_to "#{params[:referer_url].to_s.chomp('/').gsub(/\/([^\/?#]+)(|[^\/]+)$/){|f| '/'+$1}}?method=signup_ok#{status_param}&serial_number=#{@seminar_signup.display_serial_number}"
else
if !not_signup_yet
notice_words = t('seminar.email_exist')
referer_url = get_referer_url_for_notice(notice_words)
redirect_to referer_url, :notice => notice_words
else
notice_words = t('seminar.sign_up_failed')
referer_url = get_referer_url_for_notice(notice_words)
redirect_to referer_url, :notice => notice_words
end
redirect_to referer_url, :notice => t('recaptcha.errors.verification_failed')
end
end

View File

@ -9,6 +9,7 @@ class SeminarMain
include Slug
ChoiceTypes = ["checkbox","radio","select"]
ExceptFieldSetDisplays = ["password", "recaptcha"]
field :enable_recaptcha, :type => Boolean
field :annc_count, :type => Integer, :default => 0
field :album_count, :type => Integer, :default => 0
field :copy_id
@ -25,11 +26,11 @@ class SeminarMain
"F. Environmental and Reaction Engineering","G. Industrial Applications",
"H. Student Oral Presentation Contest (in English)","I. Student Poster Competition"
]
field :seminar_start_date, :type => Date, :default => Time.now
field :seminar_end_date, :type => Date, :default => Time.now
field :seminar_start_date, :type => Date, :default => Date.today
field :seminar_end_date, :type => Date, :default => Date.today
field :signup_start_date, :type => Date, :default => Time.now
field :signup_end_date, :type => Date, :default => Time.now
field :signup_start_date, :type => Date, :default => Date.today
field :signup_end_date, :type => Date, :default => Date.today
field :contribute_start_date, :type => Date
field :contribute_end_date, :type => Date
@ -229,6 +230,33 @@ class SeminarMain
Page.where(:bind_model=>self.class.to_s,:bind_uid=>self.uid).destroy
end
end
def get_frontend_url(tmp_seminar_url, call_action=nil)
@enable_custom_template = self.enable_custom_template
if call_action.nil?
if @enable_custom_template
extra_url = '/home/registration'
else
extra_url = ''
end
elsif call_action == :show_data
if @enable_custom_template
extra_url = '/home/introduction'
else
extra_url = '?method=show_data'
end
else
if @enable_custom_template
extra_url = "/home/submission"
else
extra_url = "?method=#{call_action}"
end
end
tmp_seminar_url + extra_url
end
def update_enable_recaptcha
self.enable_recaptcha = (self.seminar_signup_field_sets.where(:field_name=>'recaptcha', :disabled.ne=>true).count != 0)
self.save
end
def self.time_range(date1 = null, date2 = null)
if !date1.blank?

View File

@ -6,14 +6,14 @@ class SeminarSignupField
include ::Admin::SeminarsFieldHelper
field :key, type: String
field :af_count
# 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_delete, type: Boolean, default: false
field :to_require,type: Boolean, default: true
@ -27,7 +27,15 @@ class SeminarSignupField
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 do |record|
record.instance_variable_set(:@key_changed, record.key_changed?)
true
end
after_save do |record|
if record.instance_variable_get(:@key_changed)
record.seminar_signup_values.update_all(:key=>record.key)
end
end
def markup_value
get_data["option_list"]
end
@ -100,24 +108,16 @@ class SeminarSignupField
def self.add_seminar_signup_field(seminar,seminar_param, seminar_signup_field_id=nil,field_status)
@field_name = 'seminar'
if field_status.eql?(true)
@seminar_signup_field_counter = seminar.seminar_signup_fields.count rescue nil
@seminar_signup_field = self.find(seminar_signup_field_id) rescue nil
old_key = @seminar_signup_field.key
@seminar_signup_field.update(seminar_param)
@seminar_signup_field.save
attribute_values = @seminar_signup_field.seminar_signup_values
if attribute_values.count > 0
attribute_values.each do |av|
av.key = seminar_param["key"]
av.save
end
if @seminar_signup_field.nil?
@seminar_signup_field = seminar.seminar_signup_fields.build(seminar_param)
@seminar_signup_field.save
else
@seminar_signup_field.update(seminar_param)
end
@seminar_signup_field[:af_count] = @seminar_signup_field_counter
else
@seminar_signup_field_counter = seminar.seminar_signup_fields.count rescue nil
@seminar_signup_field = seminar.seminar_signup_fields.build(seminar_param) rescue nil
@seminar_signup_field = seminar.seminar_signup_fields.build(seminar_param)
@seminar_signup_field.save
@seminar_signup_field[:af_count] = @seminar_signup_field_counter
end
return @seminar_signup_field
end

View File

@ -6,14 +6,14 @@ class SeminarSubmissionField
include ::Admin::SeminarsFieldHelper
field :key, type: String
field :af_count
# 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_delete, type: Boolean, default: false
field :to_require,type: Boolean, default: true
@ -27,6 +27,15 @@ class SeminarSubmissionField
has_many :seminar_submission_values, autosave: true, dependent: :destroy
accepts_nested_attributes_for :seminar_submission_values, :allow_destroy => true
before_save :check_option_list
before_save do |record|
record.instance_variable_set(:@key_changed, record.key_changed?)
true
end
after_save do |record|
if record.instance_variable_get(:@key_changed)
record.seminar_submission_values.update_all(:key=>record.key)
end
end
def get_basic_field_name_org
"seminar_submission_values"
end
@ -125,24 +134,16 @@ class SeminarSubmissionField
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
if @seminar_submission_field.nil?
@seminar_submission_field = seminar.seminar_submission_fields.build(seminar_param)
@seminar_submission_field.save
else
@seminar_submission_field.update(seminar_param)
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 = seminar.seminar_submission_fields.build(seminar_param)
@seminar_submission_field.save
@seminar_submission_field[:af_count] = @seminar_submission_field_counter
end
return @seminar_submission_field
end

View File

@ -1,16 +1,16 @@
<div class="attributes default <%= attribute_field.disabled ? 'disabled' : ''%>">
<%
attribute_field.af_count ? @af_counter = attribute_field_counter + attribute_field.af_count : @af_counter = attribute_field_counter
@af_counter = attribute_field_counter
%>
<div class="attributes-header clearfix">
<div class="toggle-control" style="float: right;">
<div class="togglebox <%= attribute_field.disabled ? 'disabled' : ''%>">
<%= hidden_field "#{@field_name}[seminar_signup_fields][#{@af_counter}]","disabled",:value=>attribute_field.disabled,:class=>"toggle-check", :data=>{:deploy=>"right"} %>
<%= hidden_field "#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}]","disabled",:value=>attribute_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_signup_fields][#{@af_counter}]","to_delete",:value=>false,:class=>"attribute_field_to_delete"%>
<%= hidden_field "#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}]","_destroy",:value=>false,:class=>"attribute_field_destroy"%>
<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>
@ -18,27 +18,27 @@
<div class="control-group">
<label class="control-label muted" for="key_<%= @af_counter %>"><%= t(:key) %></label>
<div class="controls">
<%= text_field "#{@field_name}[seminar_signup_fields][#{@af_counter}]","key",:value=>attribute_field.key, :data=>{:type=>"key"} %>
<%= text_field "#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}]","key",:value=>attribute_field.key, :data=>{:type=>"key"} %>
</div>
</div>
<%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:values=>attribute_field.title_translations,:class_ext=>"pull-left",:label_ext=>t(:name),:field_name=>"#{@field_name}[seminar_signup_fields][#{@af_counter}][title_translations]"}%>
<%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:values=>attribute_field.title_translations,:class_ext=>"pull-left",:label_ext=>t(:name),:field_name=>"#{@field_name}[seminar_signup_fields_attributes][#{@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_signup_fields][#{@af_counter}]", "to_require", "true",:checked => (attribute_field.to_require == true ? true : false), :data=>{:type=>"search_true"}) %><%= t(:yes_)%>
<%= radio_button("#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}]", "to_require", "true",:checked => (attribute_field.to_require == true ? true : false), :data=>{:type=>"search_true"}) %><%= t(:yes_)%>
</label>
<label class="radio inline">
<%= radio_button("#{@field_name}[seminar_signup_fields][#{@af_counter}]", "to_require", "false",:checked => (attribute_field.to_require == false ? true : false), :data=>{:type=>"search_false"}) %><%= t(:no_)%>
<%= radio_button("#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}]", "to_require", "false",:checked => (attribute_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_signup_fields][#{@af_counter}][markup]"%>>
<select class="dataType" data-type="select" name=<%= "#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}][markup]"%>>
<%$seminar_list[:markups].each do |key,val|%>
<% next if val["display_only"] && val["display_only"] != "seminar_signup_field" %>
<% if key != 'address' %>
@ -57,25 +57,25 @@
<label class="control-label muted"><%= t(:enabled_for)%></label>
<div class="controls">
<label class="checkbox inline">
<%= check_box_tag("#{@field_name}[seminar_signup_fields][#{@af_counter}][typeA][cross_lang]","true",attribute_field["typeA"]["cross_lang"],:data=>{:type=>"cross_lang"}) %>
<%= check_box_tag("#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}][typeA][cross_lang]","true",attribute_field["typeA"]["cross_lang"],:data=>{:type=>"cross_lang"}) %>
<%= t(:cross_lang) %>
</label>
<label class="checkbox inline">
<%= check_box_tag("#{@field_name}[seminar_signup_fields][#{@af_counter}][typeA][add_more]","true",attribute_field["typeA"]["add_more"],:data=>{:type=>"add_more"}) %>
<%= check_box_tag("#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}][typeA][add_more]","true",attribute_field["typeA"]["add_more"],:data=>{:type=>"add_more"}) %>
<%= t(:add_more)%>
</label>
</div>
</div>
<%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:values=>attribute_field["typeA"]["placeholder"],:field_name=>"#{@field_name}[seminar_signup_fields][#{@af_counter}][typeA][placeholder]"}%>
<%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:values=>attribute_field["typeA"]["placeholder"],:field_name=>"#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}][typeA][placeholder]"}%>
<% end if show_seminar_type_panel(attribute_field,"typeA") != 'typeA hide' %>
<%= content_tag :div,:class=>"field-type default fade in #{show_seminar_type_panel(attribute_field,"typeB")}" do %>
<%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:label_ext=>t(:initial),:values=>attribute_field["typeB"]["initial"],:field_name=>"#{@field_name}[seminar_signup_fields][#{@af_counter}][typeB][initial]"}%>
<%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:label_ext=>t(:initial),:values=>attribute_field["typeB"]["initial"],:field_name=>"#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}][typeB][initial]"}%>
<% if attribute_field.self_defined_markup_options?%>
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:values=>attribute_field["option_list"],:field_name=> "#{@field_name}[seminar_signup_fields][#{@af_counter}][attribute][seminar][statuses]"} %>
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:values=>attribute_field["option_list"],:field_name=> "#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}][attribute][seminar][statuses]"} %>
<%else #normal list%>
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:values=>attribute_field["option_list"],:field_name=> "#{@field_name}[seminar_signup_fields][#{@af_counter}][typeB][option_list]"} %>
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:values=>attribute_field["option_list"],:field_name=> "#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}][typeB][option_list]"} %>
<% end #of self_defined_markup_options?%>
<% end if show_seminar_type_panel(attribute_field,"typeB") != 'typeB hide' %>
@ -84,17 +84,17 @@
<div class="control-group">
<label class="control-label"><%= t("date.format")%></label>
<div class="controls">
<%= select "#{@field_name}[seminar_signup_fields][#{@af_counter}][typeC]","format",Admin::AttributeValuesViewHelper::OPT,:class=>"dataType",:selected=>attribute_field["typeC"]["format"] %>
<%= select "#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}][typeC]","format",Admin::AttributeValuesViewHelper::OPT,:class=>"dataType",:selected=>attribute_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_signup_fields][#{@af_counter}][typeC]", "is_range", "false",:checked => (!attribute_field.date_is_range? ? true : false)) %><%= t(:yes_)%>
<%= radio_button("#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}][typeC]", "is_range", "false",:checked => (!attribute_field.date_is_range? ? true : false)) %><%= t(:yes_)%>
</label>
<label class="radio inline">
<%= radio_button("#{@field_name}[seminar_signup_fields][#{@af_counter}][typeC]", "is_range", "true",:checked => (attribute_field.date_is_range? ? true : false)) %><%= t(:no_)%>
<%= radio_button("#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}][typeC]", "is_range", "true",:checked => (attribute_field.date_is_range? ? true : false)) %><%= t(:no_)%>
</label>
</div>
</div>
@ -102,10 +102,10 @@
<label class="control-label"><%= t("date.calendar")%></label>
<div class="controls">
<label class="radio inline">
<%= radio_button("#{@field_name}[seminar_signup_fields][#{@af_counter}][typeC]", "calendar", "west_calendar",:checked =>(attribute_field["typeC"]["calendar"]== "west_calendar" ? true : false)) %><%= t("date.west_calendar")%>
<%= radio_button("#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}][typeC]", "calendar", "west_calendar",:checked =>(attribute_field["typeC"]["calendar"]== "west_calendar" ? true : false)) %><%= t("date.west_calendar")%>
</label>
<label class="radio inline">
<%= radio_button("#{@field_name}[seminar_signup_fields][#{@af_counter}][typeC]", "calendar", "tw_calendar",:checked =>(attribute_field["typeC"]["calendar"]== "tw_calendar" ? true : false)) %><%= t("date.tw_calendar")%>
<%= radio_button("#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}][typeC]", "calendar", "tw_calendar",:checked =>(attribute_field["typeC"]["calendar"]== "tw_calendar" ? true : false)) %><%= t("date.tw_calendar")%>
</label>
</div>
</div>
@ -116,18 +116,18 @@
<label class="control-label"><%= t(:enabled_for)%></label>
<div class="controls">
<label class="checkbox inline">
<%= check_box_tag("#{@field_name}[seminar_signup_fields][#{@af_counter}][typeD][cross_lang]","true",attribute_field["typeD"]["cross_lang"]) %>
<%= check_box_tag("#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}][typeD][cross_lang]","true",attribute_field["typeD"]["cross_lang"]) %>
<%= t(:cross_lang)%>
</label>
</div>
</div>
<%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:field_name=>"#{@field_name}[seminar_signup_fields][#{@af_counter}][typeD][placeholder]",:values=>attribute_field["typeD"]["placeholder"]} %>
<%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:field_name=>"#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}][typeD][placeholder]",:values=>attribute_field["typeD"]["placeholder"]} %>
<% end if show_seminar_type_panel(attribute_field,"typeD") != 'typeD hide' %>
<%= content_tag :div,:class=>"field-type default fade in #{show_seminar_type_panel(attribute_field,"typeE")}" do%>
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:field_name=>"#{@field_name}[seminar_signup_fields][#{@af_counter}][typeE][option_list]",:values=>attribute_field["typeE"]["option_list"]}%>
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:field_name=>"#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}][typeE][option_list]",:values=>attribute_field["typeE"]["option_list"]}%>
<% end if show_seminar_type_panel(attribute_field,"typeE") != 'typeE hide' %>
<%= hidden_field "#{@field_name}[seminar_signup_fields][#{@af_counter}]","id",:value=>attribute_field.id%>
<%= hidden_field "#{@field_name}[seminar_signup_fields_attributes][#{@af_counter}]","id",:value=>attribute_field.id%>
</div>

View File

@ -1,16 +1,16 @@
<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
@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"} %>
<%= hidden_field "#{@field_name}[seminar_submission_fields_attributes][#{@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"%>
<%= hidden_field "#{@field_name}[seminar_submission_fields_attributes][#{@af_counter}]","_destroy",:value=>false,:class=>"attribute_field_destroy"%>
<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>
@ -18,27 +18,27 @@
<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"} %>
<%= text_field "#{@field_name}[seminar_submission_fields_attributes][#{@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]"}%>
<%= 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_attributes][#{@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_)%>
<%= radio_button("#{@field_name}[seminar_submission_fields_attributes][#{@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_)%>
<%= radio_button("#{@field_name}[seminar_submission_fields_attributes][#{@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]"%>>
<select class="dataType" data-type="select" name=<%= "#{@field_name}[seminar_submission_fields_attributes][#{@af_counter}][markup]"%>>
<%$seminar_list[:markups].each do |key,val|%>
<% next if val["display_only"] && val["display_only"] != "seminar_submission_field" %>
<% if key != 'address' %>
@ -57,25 +57,25 @@
<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"}) %>
<%= check_box_tag("#{@field_name}[seminar_submission_fields_attributes][#{@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"}) %>
<%= check_box_tag("#{@field_name}[seminar_submission_fields_attributes][#{@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]"}%>
<%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:values=>attribute_submission_field["typeA"]["placeholder"],:field_name=>"#{@field_name}[seminar_submission_fields_attributes][#{@af_counter}][typeA][placeholder]"}%>
<% end if show_seminar_type_panel(attribute_submission_field,"typeA") != 'typeA hide' %>
<%= content_tag :div,:class=>"field-type default fade in #{show_seminar_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]"}%>
<%= 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_attributes][#{@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]"} %>
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:values=>attribute_submission_field["option_list"],:field_name=> "#{@field_name}[seminar_submission_fields_attributes][#{@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]"} %>
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:values=>attribute_submission_field["option_list"],:field_name=> "#{@field_name}[seminar_submission_fields_attributes][#{@af_counter}][typeB][option_list]"} %>
<% end #of self_defined_markup_options?%>
<% end if show_seminar_type_panel(attribute_submission_field,"typeB") != 'typeB hide' %>
@ -84,17 +84,17 @@
<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"] %>
<%= select "#{@field_name}[seminar_submission_fields_attributes][#{@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_)%>
<%= radio_button("#{@field_name}[seminar_submission_fields_attributes][#{@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_)%>
<%= radio_button("#{@field_name}[seminar_submission_fields_attributes][#{@af_counter}][typeC]", "is_range", "true",:checked => (attribute_submission_field.date_is_range? ? true : false)) %><%= t(:no_)%>
</label>
</div>
</div>
@ -102,10 +102,10 @@
<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")%>
<%= radio_button("#{@field_name}[seminar_submission_fields_attributes][#{@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")%>
<%= radio_button("#{@field_name}[seminar_submission_fields_attributes][#{@af_counter}][typeC]", "calendar", "tw_calendar",:checked =>(attribute_submission_field["typeC"]["calendar"]== "tw_calendar" ? true : false)) %><%= t("date.tw_calendar")%>
</label>
</div>
</div>
@ -116,16 +116,16 @@
<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"]) %>
<%= check_box_tag("#{@field_name}[seminar_submission_fields_attributes][#{@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"]} %>
<%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:field_name=>"#{@field_name}[seminar_submission_fields_attributes][#{@af_counter}][typeD][placeholder]",:values=>attribute_submission_field["typeD"]["placeholder"]} %>
<% end if show_seminar_type_panel(attribute_submission_field,"typeD") != 'typeD hide' %>
<%= content_tag :div,:class=>"field-type default fade in #{show_seminar_type_panel(attribute_submission_field,"typeE")}" do%>
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:field_name=>"#{@field_name}[seminar_submission_fields][#{@af_counter}][typeE][option_list]",:values=>attribute_submission_field["typeE"]["option_list"]}%>
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:field_name=>"#{@field_name}[seminar_submission_fields_attributes][#{@af_counter}][typeE][option_list]",:values=>attribute_submission_field["typeE"]["option_list"]}%>
<% end if show_seminar_type_panel(attribute_submission_field,"typeE") != 'typeE hide' %>
<%= content_tag :div,:class=>"field-type default fade in #{show_seminar_type_panel(attribute_submission_field,"typeF")}" do%>
<div class="control-group">
@ -139,6 +139,6 @@
</div>
</div>
<% end if show_seminar_type_panel(attribute_submission_field,"typeF") != 'typeF hide' %>
<%= hidden_field "#{@field_name}[seminar_submission_fields][#{@af_counter}]","id",:value=>attribute_submission_field.id%>
<%= hidden_field "#{@field_name}[seminar_submission_fields_attributes][#{@af_counter}]","id",:value=>attribute_submission_field.id%>
</div>

View File

@ -32,10 +32,11 @@
<% @seminar.seminar_signup_field_customs.each do |field_set| %>
<% s = field_set.seminar_signup_field %>
<% next if (s.nil? || s.key.blank?) %>
<% default_hidden << "seminar_signup_field_custom.#{s.key}" if (field_set.hidden) %>
<% default_hidden << "seminar_signup_fields.#{s.key}" if (field_set.hidden) %>
<% end %>
<% end %>
<% @seminar.seminar_signup_fields.each do |s| %>
<% next if s.title.blank? %>
<% default_hidden << "seminar_signup_fields.#{s.key}" %>
<% @field_names << "seminar_signup_fields.#{s.key}" %>
<% @field_name_translations << s.title %>
@ -110,16 +111,18 @@
<% @field_name_translations << t(th) %>
<% end %>
<% end %>
<% seminar_signup_field_customs = SeminarSignupFieldCustom.all.map{|field_set| SeminarSignupField.where(id: field_set.seminar_signup_field_id).first}.select{|s| !s.nil?}.uniq{|s| s.key } %>
<% seminar_signup_fields = SeminarSignupField.where(:key.nin=>["", nil]).uniq{|s| s.key} %>
<% seminar_signup_field_customs = SeminarSignupFieldCustom.where(:seminar_signup_field_id.in=> seminar_signup_fields.map(&:id)).to_a %>
<% if seminar_signup_field_customs.count != 0 %>
<% seminar_signup_field_customs.each do |s| %>
<% seminar_signup_field_customs.each do |field_set| %>
<% s = field_set.seminar_signup_field %>
<% next if (s.nil? || s.key.blank?) %>
<% default_hidden << "seminar_signup_field_custom.#{s.key}" if (field_set.hidden) %>
<% next if s.title.blank? %>
<% default_hidden << "seminar_signup_fields.#{s.key}" if (field_set.hidden) %>
<% end %>
<% end %>
<% seminar_signup_fields = SeminarSignupField.all.uniq{|s| s.key} %>
<% seminar_signup_fields.each do |s| %>
<% next if s.title.blank? %>
<% default_hidden << "seminar_signup_fields.#{s.key}" %>
<% @field_names << "seminar_signup_fields.#{s.key}" %>
<% @field_name_translations << s.title %>
<% end %>
@ -138,8 +141,9 @@
<% default_show << "seminar_signup_contributes.description" if show3 %>
<% @field_names << 'seminar_signup_contributes.description' %>
<% @field_name_translations << t('seminar_signup.description') %>
<% seminar_submission_fields = SeminarSignupField.all.uniq{|s| s.key} %>
<% seminar_submission_fields = SeminarSubmissionField.where(:key.nin=>["", nil]).uniq{|s| s.key} %>
<% seminar_submission_fields.each do |s| %>
<% next if s.title.blank? %>
<% @field_names << "seminar_submission_fields.#{s.key}" %>
<% @field_name_translations << s.title %>
<% end %>

View File

@ -6,7 +6,7 @@
<input class="toggle-check" data-deploy="right" id="${_disabled[0]}" name="${_disabled[1]}" type="hidden" value="false">
<a class="btn btn-mini pull-right btn-danger delete" href="#"><i class="icon-trash"></i> Delete</a>
<a class="btn btn-mini pull-right btn-inverse reply hide" href="#"><i class="icons-reply"></i> Reply</a>
<input class="attribute_field_to_delete" id="${_to_delete[0]}" name="${_to_delete[1]}" type="hidden" value="false">
<input class="attribute_field_destroy" id="${_destroy[0]}" name="${_destroy[1]}" type="hidden" value="false">
<h4>Field <span>${attributesHeaderLength}</span></h4>
</div>
<div class="attributes-body">

View File

@ -23,25 +23,26 @@
<tbody>
<%
@seminars.each do |seminar|
if !seminar.registration_status.blank? and (seminar.signup_start_date <= @time_now rescue false) and ( seminar.signup_end_date.nil? or seminar.signup_end_date+1 >= @time_now )
sign_up = ('<a href="'+ OrbitHelper.url_to_show(seminar.to_param) + '" target="_blank">' + t('seminar.signup') + '</a>').html_safe
elsif seminar.registration_status.blank?
sign_up = t('seminar.sign_up_not_open')
elsif (seminar.signup_start_date > @time_now rescue false)
sign_up = t('seminar.sign_up_not_yet')
else
sign_up = t('seminar.sign_up_overdue')
end
registration_is_open = seminar.registration_status.present?
sign_up_not_yet = seminar.signup_start_date && @time_now && seminar.signup_start_date > @time_now
sign_up_overdue = seminar.signup_end_date && @time_now && (seminar.signup_end_date + 1.day <= @time_now)
seminar_url = OrbitHelper.url_to_show(seminar.to_param)
if !registration_is_open
sign_up = t('seminar.sign_up_not_open')
elsif sign_up_not_yet
sign_up = t('seminar.sign_up_not_yet')
elsif sign_up_overdue
sign_up = t('seminar.sign_up_overdue')
else
sign_up_text = t('seminar.signup')
sign_up = link_to(sign_up_text, seminar.get_frontend_url(seminar_url), :target=>'_blank', :title=>sign_up_text)
end
seminar_title = seminar.title
%>
<tr>
<td><%= seminar.category.title %></td>
<td>
<% if (seminar.enable_custom_template rescue false) %>
<%= ('<a href="'+ OrbitHelper.url_to_show(seminar.to_param) + '/home/introduction" target="_blank">' + seminar.title + '</a>').html_safe %>
<% else %>
<%= ('<a href="'+ OrbitHelper.url_to_show(seminar.to_param) + '?method=show_data" target="_blank">' + seminar.title + '</a>').html_safe %>
<% end %>
<%= link_to(seminar_title, seminar.get_frontend_url(seminar_url, :show_data), :target=>'_blank', :title=>seminar_title) %>
</td>
<td><%= SeminarMain.time_range(seminar.seminar_start_date, seminar.seminar_end_date) %></td>
<td><%= seminar.act_place %></td>
@ -49,15 +50,13 @@
<%= sign_up %> <br />
<%=
if !seminar.registration_status.blank? and seminar.registration_status.include?('C') and (seminar.contribute_start_date <= @time_now rescue false) and ( seminar.contribute_end_date.nil? or (seminar.contribute_end_date+1 >= @time_now rescue false) )
if !session[:seminar_signup_id].blank?
if session[:seminar_main_id] == seminar.id
('<a href="'+ OrbitHelper.url_to_show(seminar.to_param) + '?method=con_upload">' + t('seminar_signup.uploads') + '</a>').html_safe
else
('<a href="'+ OrbitHelper.url_to_show(seminar.to_param) + '?method=con_login">' + t('seminar_signup.con_login') + '</a>').html_safe
end
if registration_is_open && seminar.registration_status.include?('C') && (seminar.contribute_start_date.nil? || seminar.contribute_start_date <= @time_now rescue false) && ( seminar.contribute_end_date.nil? || (seminar.contribute_end_date+1.day >= @time_now rescue false) )
if session[:seminar_signup_id].present? && session[:seminar_main_id] == seminar.id
button_text = t('seminar_signup.uploads')
link_to(button_text, seminar.get_frontend_url(seminar_url, :con_upload), :title=>button_text)
else
('<a href="'+ OrbitHelper.url_to_show(seminar.to_param) + '?method=con_login">' + t('seminar_signup.con_login') + '</a>').html_safe
button_text = t('seminar_signup.con_login')
link_to(button_text, seminar.get_frontend_url(seminar_url, :con_login), :title=>button_text)
end
end
%>

View File

@ -9,9 +9,22 @@
else
prefix_url = OrbitHelper.url_to_show(@seminar.to_param)
end
registration_is_open = @seminar.registration_status.present?
sign_up_not_yet = @seminar.signup_start_date && @time_now && @seminar.signup_start_date > @time_now
sign_up_overdue = @seminar.signup_end_date && @time_now && (@seminar.signup_end_date + 1.day <= @time_now)
%>
<% if !@seminar.registration_status.blank? and @seminar.signup_start_date < @time_now and ( @seminar.signup_end_date.nil? or @seminar.signup_end_date+1 > @time_now ) %>
<% if !registration_is_open %>
<%= t('seminar.sign_up_not_open') %>
<% elsif sign_up_not_yet %>
<%= t('seminar.sign_up_not_yet') %>
<% elsif sign_up_overdue %>
<%= t('seminar.sign_up_overdue') %>
<% else %>
<%#= stylesheet_link_tag "lib/main-forms" %>
<%= stylesheet_link_tag "basic/bootstrap-datetimepicker" %>
<%= javascript_include_tag "lib/bootstrap-datetimepicker" %>
@ -322,16 +335,4 @@ alert("1ssss2");
})();
</script>
<% elsif @seminar.registration_status.blank? %>
<%= t('seminar.sign_up_not_open') %>
<% elsif @seminar.signup_start_date > @time_now %>
<%= t('seminar.sign_up_not_yet') %>
<% else %>
<%= t('seminar.sign_up_overdue') %>
<% end %>

View File

@ -85,6 +85,7 @@ en:
dashboard: Dashboard
display_field: Display field
note: Note
email_exist: "Email exist!"
email_signup_success: Signup success
email_submission_success: Submission registration success
email_add_file_success: Add file success
@ -153,6 +154,7 @@ en:
sign_up_not_yet: Does Not Yet Allow Sign Up #報名時間未開始
sign_up_not_open: Does Not Open Sign Up #未開放報名
sign_up_overdue: Sign Up Overdue #報名時間已過
sign_up_failed: "Sign up failed!"
contribute_file_count: Count of Contribute Files #投稿檔案數
frontend:

View File

@ -86,6 +86,7 @@ zh_tw:
dashboard: 儀錶板
display_field: 顯示的欄位
note: 附註
email_exist: "email已存在!"
email_signup_success: 報名成功
email_submission_success: 投稿註冊成功
email_add_file_success: 新增上傳成功
@ -154,6 +155,7 @@ zh_tw:
sign_up_not_yet: 報名時間未開始
sign_up_not_open: 未開放報名
sign_up_overdue: 報名時間已過
sign_up_failed: "報名失敗"
contribute_file_count: 投稿檔案數
frontend: