Compare commits

...

32 Commits

Author SHA1 Message Date
邱博亞 023b8413e0 fix error after update carrierwave 2024-04-09 12:57:21 +08:00
rulingcom b0116e3d5a added fix for edit page 2024-04-02 21:51:42 +08:00
邱博亞 06d09747b6 Fix bug. 2024-03-21 22:25:30 +08:00
邱博亞 f4bae16281 Fix bug. 2024-03-21 22:22:24 +08:00
rulingcom 85291c1e99 added tshirt size and changed label 2024-03-21 18:15:50 +08:00
邱博亞 2cea54660f Add instructions field.
Add instructions field.
2024-02-28 16:29:24 +08:00
邱博亞 f432b1a16a Fix bug. 2024-02-28 15:23:38 +08:00
邱博亞 ee91898333 Fix indent. 2024-02-28 15:22:48 +08:00
邱博亞 9f9c76a0d4 Prepare to support ruby 3.3. 2024-02-28 15:22:09 +08:00
Bomrah Harry d7651a1716 fix email and name issue 2023-10-27 20:06:14 +08:00
Bomrah Harry 41128244d2 updated translate file 2023-10-27 19:48:18 +08:00
Bomrah Harry bedb08bf82 added name checking for the form 2023-10-27 18:27:48 +08:00
Bomrah Harry 8398bb2c65 fixed date format 2023-10-16 10:51:51 +08:00
Bomrah Harry 11e6cf516b fix date issue 2023-10-16 00:39:21 +08:00
邱博亞 ddb8da9eca clean page on OrbitHelper 2023-10-15 23:21:00 +08:00
邱博亞 06bc2b1531 chinese params with uri encode 2023-10-15 22:54:11 +08:00
Bomrah Harry e92256e0b6 added email confirmed field 2023-10-13 19:00:34 +08:00
Bomrah Harry 4dbd540335 added confirm counter, re signup msg, added token 2023-10-12 21:12:15 +08:00
邱博亞 a38f3214b1 驗證碼自動刷新 2023-10-11 22:42:04 +08:00
邱博亞 6cadd24992 修復錯誤訊息無法顯示問題,將表單改為ajax送出 2023-10-11 22:04:17 +08:00
邱博亞 2b15ecb5fe 使用者體驗 2023-10-11 08:48:34 +08:00
Bomrah Harry 9d4e1e0945 added password reset pattern 2023-10-11 00:17:13 +08:00
邱博亞 e6d4227b71 fix error 2023-10-10 22:49:16 +08:00
邱博亞 6c3b5ca75f backup remote change 2023-10-10 12:38:28 +08:00
Bomrah Harry 383d1f5862 signup ok msg 2023-10-08 00:47:37 +08:00
Bomrah Harry fc52e6001d added table as default view 2023-10-08 00:41:45 +08:00
Bomrah Harry d110b8e129 add translations 2023-10-08 00:33:13 +08:00
Bomrah Harry c937242f76 changed translations 2023-10-07 22:45:48 +08:00
Bomrah Harry dbff09dbc0 i1. Signup form: remove member button(hide added fields and content), all fields become required after add member, hide page title
2. Login refill form interface
3. Back office file upload field problem, files will disappear after edit and submit
4. Signup number change to day and time or any other form that user cannot recognize order
5. Add 1 more field: “ Sent Email 寄送郵件“, show sent Email type and time
6. Show time log in the back office signee list page for: form submission, Email Confirmed, Signup Confirmed, Sent Email
7. Wordings:
Forgot password link to reset page: “重設密碼” change to  設定密碼 Set Password
Confirmation Email link to the page: “Confirm OK” —> ” 認證通過 “ ; “Confirm Not OK” —> “連結已失效”
2023-10-07 22:34:07 +08:00
Bomrah Harry 64a8077e5b new changes for forms and various other things 2023-10-05 19:40:03 +08:00
Bomrah Harry 7b6aba492b language change 2023-10-05 01:14:15 +08:00
Bomrah Harry 4a0f4081ff new stuff 2023-10-05 00:38:24 +08:00
44 changed files with 2283 additions and 542 deletions

View File

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

View File

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

View File

@ -60,7 +60,7 @@ class Admin::SeminarSignupsController < OrbitAdminController
@seminar_signup.destroy @seminar_signup.destroy
redirect_to "/admin/seminars/#{@seminar_main_id}/seminar_signup" redirect_to "/admin/seminars/#{@seminar_main_id}/seminar_signup?type=table"
end end
private private

View File

@ -682,6 +682,55 @@ class Admin::SeminarsController < OrbitAdminController
redirect_to "/admin/seminars/@seminar_id.to_s/seminar_signup" redirect_to "/admin/seminars/@seminar_id.to_s/seminar_signup"
end end
def create_email_set
SeminarEmailSet.create_new_fields(params[:id])
redirect_to "/admin/seminars/#{params[:id]}/edit"
end
def seminar_signup_success
@seminar = SeminarMain.find(params[:id])
end
def seminar_signup_success_save
@seminar = SeminarMain.find(params[:id])
params.require(:seminar_main).permit!
@seminar.update_attributes(params[:seminar_main])
@seminar.save
redirect_to admin_seminars_path
end
def send_notifying_email
sent_time = DateTime.now
@seminar = SeminarMain.find_by(:id => params[:seminar_id])
seminar_signup = @seminar.seminar_signups.where(:email => params[:email]).first
if !seminar_signup.blank?
extra_text = "<p> #{nl2br(params[:text])} </p>"
if params[:type] == "reset_password"
seminar_signup.status = 'C'
token = seminar_signup.generate_token
extra_text += "<br><a href='#{request.protocol + request.host_with_port + "/" + I18n.locale.to_s + "/seminar/" + @seminar.to_param}/?method=reset_password_page&token=#{token}&cid=#{seminar_signup.id.to_s}'>#{t("seminar.click_here_to_confirm")}</a>"
end
send_mail(params[:type], seminar_signup.email, @seminar.id.to_s, extra_text)
seminar_signup.emails_sent << params[:type]
seminar_signup.emails_sent_time << sent_time
seminar_signup.save
end
render :json => {
"type" => t("seminar.#{params[:type]}"),
"sent_time" => sent_time.strftime("%Y/%m/%d %H:%M"),
"success" => true
}.to_json
end
def get_predefined_text
seminar = SeminarMain.find(params[:seminar_id])
text = seminar.seminar_email_sets.where(:field_name => params[:type]).first.content[I18n.locale]
render :json => {
"success" => true,
"html" => text
}
end
private private
def set_seminar def set_seminar
@ -758,7 +807,7 @@ class Admin::SeminarsController < OrbitAdminController
end end
end end
@email_set = [] @email_set = []
['signup','submission','add_file','edit_file'].each do |field_name| ['signup','submission','add_file','edit_file', 'reset_password', "special_reminder"].each do |field_name|
email_set = @seminar.seminar_email_sets.select{|v| v.field_name==field_name} email_set = @seminar.seminar_email_sets.select{|v| v.field_name==field_name}
if email_set.length==0 if email_set.length==0
title = Hash.new title = Hash.new

View File

@ -3,7 +3,7 @@ class SeminarsController < ApplicationController
include MemberHelper include MemberHelper
include ActionView::Context #vary important (only add this can access @@session from view) include ActionView::Context #vary important (only add this can access @@session from view)
include Admin::SeminarsHelper include Admin::SeminarsHelper
FrontendMethods = ["show_privacy", "show_data", "check_email", "check_availability", "signup_ok", "add_file", "edit_file", "con_login", "con_upload", "con_logout"] FrontendMethods = ["show_privacy", "show_data", "check_email", "check_name", "check_availability", "signup_ok", "add_file", "edit_file", "con_login", "con_upload", "con_logout","confirm_email_page","reset_password_page","edit_login_seminar_signup"]
# include SimpleCaptcha::ControllerHelpers # include SimpleCaptcha::ControllerHelpers
def index def index
@ -295,7 +295,7 @@ class SeminarsController < ApplicationController
if last_path.include?("?") if last_path.include?("?")
referer_url = split_path[0...-1].join('/') + '/' + last_path.split('?')[0] referer_url = split_path[0...-1].join('/') + '/' + last_path.split('?')[0]
uri_query = last_path.split("?")[1..-1].join('?') uri_query = last_path.split("?")[1..-1].join('?')
uri_query.gsub!(/notice=[^&]*/,'').gsub!(/&+$/,'') uri_query = uri_query.gsub(/notice=[^&]*/,'').gsub(/&+$/,'')
if uri_query.blank? if uri_query.blank?
referer_url = referer_url + "?notice=#{notice_words}" referer_url = referer_url + "?notice=#{notice_words}"
else else
@ -345,7 +345,7 @@ class SeminarsController < ApplicationController
sign_up = link_to(sign_up_text, seminar.get_frontend_url(seminar_url), :target=>'_blank', :title=>sign_up_text) sign_up = link_to(sign_up_text, seminar.get_frontend_url(seminar_url), :target=>'_blank', :title=>sign_up_text)
end end
if !seminar.registration_status.blank? && seminar.registration_status.include?('C') && seminar.contribute_start_date <= time_now && ( seminar.contribute_end_date.nil? || seminar.contribute_end_date+1 >= time_now ) if !seminar.registration_status.blank? && seminar.registration_status.include?('C') && (seminar.contribute_start_date.nil? || seminar.contribute_start_date <= time_now) && ( seminar.contribute_end_date.nil? || seminar.contribute_end_date+1 >= time_now )
if @@session[:seminar_signup_id].present? && @@session[:seminar_main_id] == seminar.id if @@session[:seminar_signup_id].present? && @@session[:seminar_main_id] == seminar.id
button_text = t('seminar_signup.uploads') button_text = t('seminar_signup.uploads')
contribute_action = link_to(button_text, seminar.get_frontend_url(seminar_url, :con_upload), :title=>button_text) contribute_action = link_to(button_text, seminar.get_frontend_url(seminar_url, :con_upload), :title=>button_text)
@ -380,6 +380,19 @@ class SeminarsController < ApplicationController
seminar_signup = SeminarSignup.new seminar_signup = SeminarSignup.new
time_now = Time.now time_now = Time.now
referer_url = OrbitHelper.request.referer
if (referer_url.nil? || referer_url.match(/(\?|&)method=show_privacy/).nil?) && !OrbitHelper.request.params[:notice]
return {
"seminar" => seminar,
"seminar_signup" => seminar_signup,
"time_now" => time_now,
"redirect_to" => "#{OrbitHelper.url_to_show(seminar.to_param)}?method=show_privacy"
}
end
{ {
"seminar" => seminar, "seminar" => seminar,
"seminar_signup" => seminar_signup, "seminar_signup" => seminar_signup,
@ -391,18 +404,36 @@ class SeminarsController < ApplicationController
def check_email def check_email
params = OrbitHelper.params params = OrbitHelper.params
success = true
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 ? t('seminar.already_used') : t('seminar.available') result = count > 0 ? t('seminar.already_used') : t('seminar.available')
else success = count > 0 ? false : true
result = t('seminar.please_enter_email')
end end
{ render :json => {
"result" => result "result" => result,
} "success" => success
}.to_json
end
def check_name
params = OrbitHelper.params
success = true
if !params[:name].blank?
count = SeminarSignup.where(:name => params[:name], :seminar_main_id => params[:no]).count
result = count > 0 ? t('seminar.already_used') : t('seminar.available')
success = count > 0 ? false : true
end
render :json => {
"result" => result,
"success" => success
}.to_json
end end
@ -420,12 +451,18 @@ class SeminarsController < ApplicationController
end end
def create def create
OrbitHelper.set_page(nil)
referer_url = request.referer
if referer_url
params[:url] = URI.parse(referer_url).path.sub(/\/[^\/]*$/, '').sub(/^\/#{I18n.locale}/, '')
end
OrbitHelper.set_params(params, current_user)
seminar_id = params[:seminar_signup][:seminar_main_id] seminar_id = params[:seminar_signup][:seminar_main_id]
@seminar = SeminarMain.where(id: seminar_id).first @seminar = SeminarMain.where(id: seminar_id).first
if @seminar.enable_recaptcha && (!gotcha_valid?) if @seminar.enable_recaptcha && (!gotcha_valid?)
notice_words = t('recaptcha.errors.verification_failed') notice_words = t('recaptcha.errors.verification_failed')
referer_url = get_referer_url_for_notice(notice_words) referer_url = get_referer_url_for_notice(notice_words)
redirect_to referer_url, :notice => notice_words show_alert(notice_words)
return return
end end
signup_limit = @seminar.signup_limit signup_limit = @seminar.signup_limit
@ -444,7 +481,7 @@ class SeminarsController < ApplicationController
else else
notice_words = t('seminar.sign_up_is_full') notice_words = t('seminar.sign_up_is_full')
referer_url = get_referer_url_for_notice(notice_words) referer_url = get_referer_url_for_notice(notice_words)
redirect_to referer_url, :notice => notice_words show_alert(notice_words)
return return
end end
end end
@ -453,12 +490,15 @@ class SeminarsController < ApplicationController
if signup_limit <= signup_count if signup_limit <= signup_count
notice_words = t('seminar.sign_up_is_full') notice_words = t('seminar.sign_up_is_full')
referer_url = get_referer_url_for_notice(notice_words) referer_url = get_referer_url_for_notice(notice_words)
redirect_to referer_url, :notice => notice_words show_alert(notice_words)
return return
end end
end end
end end
@signup = SeminarSignup.where(email: params[:seminar_signup][:email], seminar_main_id: seminar_id ).first @signup = SeminarSignup.where(email: params[:seminar_signup][:email], seminar_main_id: seminar_id ).first
if @signup.blank?
@signup = SeminarSignup.where(name: params[:seminar_signup][:name], seminar_main_id: seminar_id ).first
end
@seminar_signup = SeminarSignup.new(seminar_signup_params) @seminar_signup = SeminarSignup.new(seminar_signup_params)
not_signup_yet = @signup.blank? not_signup_yet = @signup.blank?
@ -486,16 +526,23 @@ class SeminarsController < ApplicationController
@seminar.save @seminar.save
end end
extra_text = "<br>#{I18n.t('seminar_signup.serial_number')}: #{@seminar_signup.display_serial_number}" 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, # extra_text += render_to_string("seminars/signup_email_contents",:locals=>{:seminar=>@seminar, :seminar_signup=>@seminar_signup},:layout=>false)
:seminar_signup=>@seminar_signup},:layout=>false)
if params['seminar_signup']['status']=='C' if params['seminar_signup']['status']=='C'
status_param = '&status=' status_param = '&status='
send_mail('submission',params[:seminar_signup][:email],params[:seminar_signup][:seminar_main_id],extra_text) if(@seminar.seminar_email_sets.where(:field_name => "signup").first.is_confirmation)
extra_text += "<br><div><a href='#{request.protocol + request.host_with_port + OrbitHelper.url_to_show(@seminar.to_param)}?method=confirm_email_page&token=#{@seminar_signup.token}&cid=#{@seminar_signup.id.to_s}'>" + t("seminar.click_here_to_confirm") + "</a></div>"
end
send_mail('signup',params[:seminar_signup][:email],params[:seminar_signup][:seminar_main_id],extra_text)
else else
status_param = '' status_param = ''
if(@seminar.seminar_email_sets.where(:field_name => "signup").first.is_confirmation)
extra_text += "<br><div><a href='#{request.protocol + request.host_with_port + OrbitHelper.url_to_show(@seminar.to_param)}?method=confirm_email_page&token=#{@seminar_signup.token}&cid=#{@seminar_signup.id.to_s}'>" + t("seminar.click_here_to_confirm") + "</a></div>"
end
send_mail('signup',params[:seminar_signup][:email],params[:seminar_signup][:seminar_main_id],extra_text) send_mail('signup',params[:seminar_signup][:email],params[:seminar_signup][:seminar_main_id],extra_text)
end end
redirect_to "#{params[:referer_url].to_s.chomp('/').gsub(/\/([^\/?#]+)(|[^\/]+)$/){|f| '/'+$1}}?method=signup_ok#{status_param}&serial_number=#{@seminar_signup.display_serial_number}"
redirect_with_js("#{params[:referer_url].to_s.chomp('/').gsub(/\/([^\/?#]+)(|[^\/]+)$/){|f| '/'+$1}}?method=signup_ok#{status_param}&serial_number=#{@seminar_signup.display_serial_number}&seminar=#{@seminar.uid}")
else else
if has_counter if has_counter
OrbitHelper::SharedMutex.synchronize do OrbitHelper::SharedMutex.synchronize do
@ -503,29 +550,79 @@ class SeminarsController < ApplicationController
end end
end end
if !not_signup_yet if !not_signup_yet
notice_words = t('seminar.email_exist') notice_words = t('seminar.email_or_name_exist')
referer_url = get_referer_url_for_notice(notice_words) referer_url = get_referer_url_for_notice(notice_words)
redirect_to referer_url, :notice => notice_words show_alert(notice_words)
else else
notice_words = t('seminar.sign_up_failed') notice_words = t('seminar.sign_up_failed')
referer_url = get_referer_url_for_notice(notice_words) referer_url = get_referer_url_for_notice(notice_words)
redirect_to referer_url, :notice => notice_words show_alert(notice_words)
end end
end end
end end
def update_signup_form
OrbitHelper.set_page(nil)
referer_url = request.referer
if referer_url
params[:url] = URI.parse(referer_url).path.sub(/\/[^\/]*$/, '').sub(/^\/#{I18n.locale}/, '')
end
params = OrbitHelper.params
tmp_seminar_signup_params = seminar_signup_params
@seminar_signup = SeminarSignup.find(params[:signup_id])
@seminar_signup.update_attributes(tmp_seminar_signup_params)
@seminar_signup.generate_token
if !params[:seminar_signup_values].nil?
params[:seminar_signup_values].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[:id], field_value)
end
seminar_reviews = SeminarReview.where(:seminar_main_id=>@seminar_signup.seminar_main_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}
@seminar.seminar_reviews.each do |sr|
unassigned_seminar_signup_ids = unassigned_seminar_signup_ids - sr.all_seminar_signup_ids
end
@seminar.unassigned_seminar_signup_ids = unassigned_seminar_signup_ids
@seminar.save
end
extra_text = "<br>#{I18n.t('seminar_signup.serial_number')}: #{@seminar_signup.display_serial_number}"
if tmp_seminar_signup_params['status']=='C'
status_param = '&status='
if(@seminar.seminar_email_sets.where(:field_name => "signup").first.is_confirmation)
extra_text += "<br><div><a href='#{request.protocol + request.host_with_port + OrbitHelper.url_to_show(@seminar.to_param)}?method=confirm_email_page&token=#{@seminar_signup.token}&cid=#{@seminar_signup.id.to_s}'>" + t("seminar.click_here_to_confirm") + "</a></div>"
end
send_mail('signup',tmp_seminar_signup_params[:email],tmp_seminar_signup_params[:seminar_main_id],extra_text)
else
status_param = ''
if(@seminar.seminar_email_sets.where(:field_name => "signup").first.is_confirmation)
extra_text += "<br><div><a href='#{request.protocol + request.host_with_port + OrbitHelper.url_to_show(@seminar.to_param)}?method=confirm_email_page&token=#{@seminar_signup.token}&cid=#{@seminar_signup.id.to_s}'>" + t("seminar.click_here_to_confirm") + "</a></div>"
end
send_mail('signup',tmp_seminar_signup_params[:email],tmp_seminar_signup_params[:seminar_main_id],extra_text)
end
redirect_with_js("#{params[:referer_url].to_s.chomp('/').gsub(/\/([^\/?#]+)(|[^\/]+)$/){|f| '/'+$1}}?method=signup_ok#{status_param}&serial_number=#{@seminar_signup.display_serial_number}&seminar=#{@seminar.uid}")
end
def signup_ok def signup_ok
params = OrbitHelper.params params = OrbitHelper.params
{"serial_number"=> params[:serial_number]} msg = SeminarMain.where(:uid => params[:seminar]).first.signup_success
{
"serial_number"=> params[:serial_number],
"message" => msg
}
end end
def add_file_proc def add_file_proc
update_params = seminar_signup_contribute_params.merge('seminar_submission_values'=>params['seminar_submission_values']) update_params = seminar_signup_contribute_params.merge('seminar_submission_values'=>params['seminar_submission_values'].to_h)
flag = true flag = true
update_params.permit! update_params.permit!
if !update_params['seminar_submission_values'].nil? if update_params['seminar_submission_values'].present?
if update_params['seminar_submission_values']['0']['value'].nil?
flag = false
else
if update_params['seminar_submission_values']['0']['value'].class==String if update_params['seminar_submission_values']['0']['value'].class==String
value = update_params['seminar_submission_values']['0']['value'] value = update_params['seminar_submission_values']['0']['value']
if !value.to_s.blank? if !value.to_s.blank?
@ -538,6 +635,7 @@ class SeminarsController < ApplicationController
end end
end end
end end
end
else else
flag = false flag = false
end end
@ -574,9 +672,12 @@ class SeminarsController < ApplicationController
def update def update
@con = SeminarSignupContribute.find(params[:seminar_signup_contribute][:id]) @con = SeminarSignupContribute.find(params[:seminar_signup_contribute][:id])
update_params = seminar_signup_contribute_params.merge('seminar_submission_values'=>params['seminar_submission_values']) update_params = seminar_signup_contribute_params.merge('seminar_submission_values'=>params['seminar_submission_values'].to_h)
update_params.permit! update_params.permit!
unless update_params['seminar_submission_values'].nil? if update_params['seminar_submission_values'].present?
if update_params['seminar_submission_values']['0']['value'].nil?
flag = false
else
flag = true flag = true
if update_params['seminar_submission_values']['0']['value'].class==String if update_params['seminar_submission_values']['0']['value'].class==String
value = update_params['seminar_submission_values']['0']['value'] value = update_params['seminar_submission_values']['0']['value']
@ -590,6 +691,7 @@ class SeminarsController < ApplicationController
end end
end end
end end
end
if flag if flag
update_params['seminar_submission_values']['0']['value']['en'] = ' ' update_params['seminar_submission_values']['0']['value']['en'] = ' '
end end
@ -697,6 +799,16 @@ class SeminarsController < ApplicationController
seminar_signup = SeminarSignup.find_by(_id: @@session[:seminar_signup_id], seminar_main_id: @@session[:seminar_main_id] ) rescue nil seminar_signup = SeminarSignup.find_by(_id: @@session[:seminar_signup_id], seminar_main_id: @@session[:seminar_main_id] ) rescue nil
show = true
seminar.seminar_submission_field_sets.each do |ssf|
if ssf.disabled && ssf.hidden
show = false
else
show = true
break
end
end
else else
seminar = {} seminar = {}
@ -707,11 +819,32 @@ class SeminarsController < ApplicationController
{ {
'time_now' => time_now, 'time_now' => time_now,
'seminar' => seminar, 'seminar' => seminar,
'seminar_signup' => seminar_signup 'seminar_signup' => seminar_signup,
"show" => show
} }
end end
def edit_login_seminar_signup #copy from show
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] ) rescue nil
else
seminar = {}
seminar_signup = {}
end
module_app = ModuleApp.where(:key => "seminar").first
categories = module_app.categories
time_now = Time.now
{
"seminar" => seminar,
"seminar_signup" => seminar_signup,
"time_now" => time_now
}
end
def con_logout def con_logout
# redirect_to page_for_seminar_url # redirect_to page_for_seminar_url
@ -733,6 +866,55 @@ class SeminarsController < ApplicationController
end end
def reset_email
end
def reset_password_page
params = OrbitHelper.params
seminar = SeminarMain.find_by(uid: params[:uid])
seminar_signup = seminar.seminar_signups.where(:status=>'C', :id=> params[:cid], :token => params[:token]).first
password_pattern = ""
if(seminar.seminar_signup_field_sets.count != 0)
password_pattern = seminar.seminar_signup_field_sets.where(:field_name => "password").first.validator rescue ""
end
status = false
if(!seminar_signup.nil?)
status = true
end
{
"status" => status,
"seminar" => seminar,
"pattern" => password_pattern,
"cid" => params[:cid],
"token" => params[:token]
}
end
def confirm_email_page
confirm = false
params = OrbitHelper.params
uid = params[:uid]
if uid.nil?
uid = params[:page].split('-').last
end
seminar = SeminarMain.where(:uid => uid).first
if(!seminar.nil?)
signup = seminar.seminar_signups.where(:id => params[:cid], :token => params[:token]).first
if(!signup.nil?)
signup.token = nil
signup.is_confirmed = true
signup.is_confirmed_date = DateTime.now
signup.signup_confirmed_counter = signup.signup_confirmed_counter + 1
signup.save
confirm = true
end
end
{
"confirm" => confirm,
"url" => OrbitHelper.url_to_show(seminar.to_param)
}
end
def con_login_proc def con_login_proc
seminar = SeminarMain.find_by(id: params[:seminar_signup][:seminar_main_id]) seminar = SeminarMain.find_by(id: params[:seminar_signup][:seminar_main_id])
@ -751,6 +933,35 @@ class SeminarsController < ApplicationController
end end
def reset_confirm_password_proc
params = OrbitHelper.params
seminar = SeminarMain.find(params[:seminar_id])
redirect_to "#{params[:referer_url].to_s.chomp('/')}/?method=reset_password_page" if seminar.nil?
seminar_signup = seminar.seminar_signups.where(:status =>'C', :token => params[:reset_token], :id => params[:cid]).first
if !seminar_signup.blank?
seminar_signup.password = params[:password]
seminar_signup.token = nil
seminar_signup.save
redirect_to "#{params[:referer_url].to_s.chomp('/')}/?method=con_login", :notice => t('seminar_signup.password_changed')
else
redirect_to "#{params[:referer_url].to_s.chomp('/')}/?method=con_login", :notice => t('seminar_signup.password_changed_not_ok')
end
end
def reset_password_proc
@seminar = SeminarMain.find_by(id: params[:seminar_signup][:seminar_main_id])
seminar_signup = SeminarSignup.where(:status=>'C', :email=> params[:user_name], :seminar_main_id => params[:seminar_signup][:seminar_main_id]).first
if !seminar_signup.blank?
token = seminar_signup.generate_token
extra_text = "<br><a href='#{request.protocol + request.host_with_port + params[:referer_url].to_s.chomp('/')}/?method=reset_password_page&token=#{token}&cid=#{seminar_signup.id.to_s}'>#{t("seminar.click_here_to_confirm")}</a>"
send_mail('reset_password', seminar_signup.email, @seminar.id.to_s, extra_text)
redirect_to "#{params[:referer_url].to_s.chomp('/')}/?method=reset_email", :notice => t('seminar_signup.reset_email_sent')
else
redirect_to "#{params[:referer_url].to_s.chomp('/')}/?method=reset_email", :notice => t('seminar_signup.email_not_found')
end
end
def seminar_signup_params def seminar_signup_params
params.require(:seminar_signup).permit! params.require(:seminar_signup).permit!
end end
@ -762,22 +973,20 @@ class SeminarsController < ApplicationController
def seminar_signup_values_params def seminar_signup_values_params
params.require(:seminar_signup_values).permit! params.require(:seminar_signup_values).permit!
end end
def send_mail(field_name,email,seminar_id,extra_text="")
email_set = @seminar.seminar_email_sets.select{|v| v.field_name == field_name} private
if email_set.length==0 def show_alert(notice_words)
mail = Email.create(mail_to:[email], respond_to do |format|
module_app_key:"seminar", format.js{
template:"email/#{field_name}_email.html.erb", render :js => "$('.rucaptcha-image').click();alert('#{notice_words}');"
mail_sentdate:Time.current, }
mail_subject: t("seminar.email_#{field_name}_success"), end
template_data:{'seminar_id'=>seminar_id,'locale'=>I18n.locale,'extra_text'=> extra_text}) end
elsif !(email_set[0].disabled) def redirect_with_js(url)
mail = Email.create(mail_to:[email], respond_to do |format|
module_app_key:"seminar", format.js{
template:"email/#{field_name}_email.html.erb", render :js => "window.location.href = '#{url}';"
mail_sentdate:Time.current, }
mail_subject: email_set[0].title[I18n.locale],
template_data:{'seminar_id'=>seminar_id,'locale'=>I18n.locale,'extra_text'=> extra_text})
end end
end end
end end

View File

@ -7,6 +7,7 @@ module Admin::SeminarsFieldHelper
include ActionView::Helpers::RenderingHelper include ActionView::Helpers::RenderingHelper
include ActionView::Context include ActionView::Context
include OrbitBasis::RenderAnywhere include OrbitBasis::RenderAnywhere
include ::MemberHelper
include OrbitFormHelper include OrbitFormHelper
@ -29,6 +30,20 @@ module Admin::SeminarsFieldHelper
content_tag(:div,str,:class=>"tab-pane fade",:id=>(get_field_name_base+"tab_#{lang}")) content_tag(:div,str,:class=>"tab-pane fade",:id=>(get_field_name_base+"tab_#{lang}"))
end end
def render_instructions
control_group_wrapper_for_sm do |key,value|
if !@prefiled_value.nil?
value = can_muti_lang_input_for_sm? ? @prefiled_value[key] : @prefiled_value
else
value = nil
end
key = can_muti_lang_input_for_sm? ? "#{key}" : I18n.locale
instructions = (typeG["instructions"].blank? ? "" : typeG["instructions"][key])
name1 = can_muti_lang_input_for_sm? ? (get_field_name_base + "[#{key}]") : get_field_name_base
instructions.html_safe
end
end
def render_address def render_address
control_group_wrapper_for_sm do |key,value| control_group_wrapper_for_sm do |key,value|
value = (can_muti_lang_input_for_sm? ? @prefiled_value[key] : @prefiled_value) rescue nil value = (can_muti_lang_input_for_sm? ? @prefiled_value[key] : @prefiled_value) rescue nil
@ -168,7 +183,7 @@ module Admin::SeminarsFieldHelper
key = can_muti_lang_input_for_sm? ? "#{key}" : I18n.locale key = can_muti_lang_input_for_sm? ? "#{key}" : I18n.locale
place_holder= typeD["placeholder"][key] rescue '' place_holder= typeD["placeholder"][key] rescue ''
name1 = can_muti_lang_input_for_sm? ? (get_field_name_base + "[#{key}]") : get_field_name_base name1 = can_muti_lang_input_for_sm? ? (get_field_name_base + "[#{key}]") : get_field_name_base
text_area_tag(name1, value, @markup_options.merge(:placeholder=>place_holder,:class=>'ckeditor input-medium form-control')) text_area_tag(name1, value, @markup_options.merge(:placeholder=>place_holder,:class=>'input-medium form-control', :maxlength=> 300, :style => "width:500px;height:200px"))
end end
end end
@ -187,14 +202,32 @@ module Admin::SeminarsFieldHelper
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}]" : ""
field_name = [get_field_name_base,add_more_blank,key_field].join field_name = [get_field_name_base,add_more_blank,key_field].join
file_required =@require ? 'required="required"' : '' file_required =@require && !value ? 'required="required"' : ''
"<div class=\"file-selector\"><label class=\"ui-button\"> "<div class=\"file-selector\"><label class=\"ui-button\">
<input style=\"position: absolute;width:0.1em;opacity: 0;padding: 0;border: 0;opacity: 0;left: 50%;top: 0;\" class=\"upload\" name=\"#{field_name}\" #{file_required} type=\"file\" /> <input style=\"position: absolute;width:0.1em;opacity: 0;padding: 0;border: 0;opacity: 0;left: 50%;top: 0;\" class=\"upload\" name=\"#{field_name}\" #{file_required} type=\"file\" accept=\".pdf,.png,.jpg,.odf\" onchange=\"if(this.files[0].size > 1048576*20){alert('#{I18n.t("seminar.file_limit_hint")}');this.value = '';}else{var ext = this.value.match(/\.([^\.]+)$/)[1];if (!['pdf','png','jpg','odf'].includes(ext)){alert('#{I18n.t("seminar.file_format_hint")}');this.value='';}}\" />
<i class=\"fa fa-file\"></i> #{I18n.t('file.upload')} <i class=\"fa fa-file\"></i> #{I18n.t('file.upload')}
</label><div class=\"filename\"></div></div>#{value}".html_safe </label><div class=\"filename\"></div></div>#{value}".html_safe
end end
end end
def render_email
a = control_group_wrapper_for_sm do |key,value|
place_holder= typeA["placeholder"][I18n.locale] rescue ''
email_field_tag(get_field_name_base, value, @markup_options.merge(:placeholder=>place_holder,:class=>'input-medium form-control', title: I18n.t("seminar.email_hint"))) +
(content_tag :div,:class=>"loader" do
end)
end
end
def render_phone
a = control_group_wrapper_for_sm do |key,value|
place_holder= typeA["placeholder"][I18n.locale] rescue ''
text_field_tag(get_field_name_base, value, @markup_options.merge(:placeholder=>place_holder,:class=>'input-medium form-control', pattern: "[\\d\\+\\-\\(\\)]{10,13}", title: I18n.t("seminar.phone_hint"))) + (content_tag :p do
"(#{I18n.t("seminar.phone_hint")})"
end)
end
end
def date_is_range? def date_is_range?
is_range = "false" is_range = "false"
data = get_data data = get_data
@ -454,7 +487,8 @@ protected
def form_label def form_label
if self.markup == "text_area" if self.markup == "text_area"
plc = typeD["placeholder"][I18n.locale].to_s.blank? ? nil : "(#{typeD["placeholder"][I18n.locale]})" # plc = typeD["placeholder"][I18n.locale].to_s.blank? ? nil : "(#{typeD["placeholder"][I18n.locale]})"
plc = nil
label_tag(key, '' , :class=>"col-sm-2 control-label muted") do label_tag(key, '' , :class=>"col-sm-2 control-label muted") do
concat (!@require.blank? ? '*'+title : title) concat (!@require.blank? ? '*'+title : title)
if plc if plc

View File

@ -50,6 +50,24 @@ module Admin::SeminarsHelper
end end
# return "/#{I18n.locale}#{page.url}/#{seminar.to_param}" # return "/#{I18n.locale}#{page.url}/#{seminar.to_param}"
end end
def send_mail(field_name,email,seminar_id,extra_text="")
email_set = @seminar.seminar_email_sets.select{|v| v.field_name == field_name}
if email_set.length==0
mail = Email.create(mail_to:[email],
module_app_key:"seminar",
template:"email/#{field_name}_email.html.erb",
mail_sentdate:Time.current,
mail_subject: t("seminar.email_#{field_name}_success"),
template_data:{'seminar_id'=>seminar_id,'locale'=>I18n.locale,'extra_text'=> extra_text})
elsif !(email_set[0].disabled)
mail = Email.create(mail_to:[email],
module_app_key:"seminar",
template:"email/#{field_name}_email.html.erb",
mail_sentdate:Time.current,
mail_subject: email_set[0].title[I18n.locale],
template_data:{'seminar_id'=>seminar_id,'locale'=>I18n.locale,'extra_text'=> extra_text})
end
end
module MultiLang module MultiLang
extend self extend self
extend ActionView::Helpers::FormTagHelper extend ActionView::Helpers::FormTagHelper

View File

@ -6,5 +6,6 @@ class SeminarEmailSet
field :title field :title
field :content field :content
field :disabled, type: Boolean, default: false field :disabled, type: Boolean, default: false
field :is_confirmation, type: Boolean, default: false
belongs_to :seminar_main belongs_to :seminar_main
end end

View File

@ -18,6 +18,7 @@ class SeminarMain
field :title, as: :slug_title, type: String, localize: true field :title, as: :slug_title, type: String, localize: true
field :speaker, localize: true field :speaker, localize: true
field :content, localize: true field :content, localize: true
field :signup_success, localize: true
field :act_place, localize: true field :act_place, localize: true
field :enable_summary_choice, :type => Boolean, :default => false field :enable_summary_choice, :type => Boolean, :default => false
field :summary_chioice_type, :type => String, :default => "checkbox" field :summary_chioice_type, :type => String, :default => "checkbox"
@ -693,4 +694,8 @@ class SeminarMain
def enable_review_result def enable_review_result
self.assign_mode == 2 self.assign_mode == 2
end end
def to_param
tmp = super()
URI.encode(tmp)
end
end end

View File

@ -3,11 +3,19 @@ class SeminarSignup
include Mongoid::Document include Mongoid::Document
include Mongoid::Timestamps include Mongoid::Timestamps
HiddenFields = ['seminar_signup_id','_id', 'created_at', 'updated_at','seminar_main_id',"serial_number","final_session","final_sessions","preferred_sessions",'seminar_session_id',"seminar_session_ids","preferred_session","sort_number","abstract_number","presentation_type", "filename"] HiddenFields = ['seminar_signup_id','_id', 'created_at', 'updated_at','seminar_main_id',"serial_number","final_session","final_sessions","preferred_sessions",'seminar_session_id',"seminar_session_ids","preferred_session","sort_number","abstract_number","presentation_type", "filename", "token", "reset_token", "emails_sent"]
DefaultEnableFields = ['status','name','tel','phone','email','password','recaptcha'] DefaultEnableFields = ['status','name','tel','phone','email','password','recaptcha']
field :sort_number , type: Integer, default: 10000 field :sort_number , type: Integer, default: 10000
field :status field :status
field :token
field :is_confirmed, type: Boolean, default: false # for email confirmation
field :signup_confirmed, type: Boolean, default: false
field :is_confirmed_date, type: DateTime
field :signup_confirmed_date, type: DateTime
field :signup_confirmed_counter, type: Integer, default: 0
field :emails_sent, type: Array, default: []
field :emails_sent_time, type: Array, default: []
field :name # become Last Name for TICC field :name # become Last Name for TICC
field :tel, type: String # become First Name for TICC field :tel, type: String # become First Name for TICC
field :unit, localize: true #Only localize for preserving old record field :unit, localize: true #Only localize for preserving old record
@ -51,10 +59,12 @@ class SeminarSignup
[l, (tmp ? tmp : unit)] [l, (tmp ? tmp : unit)]
end.to_h end.to_h
if self.serial_number.nil? if self.serial_number.nil?
last_serial_number = SeminarMain.where(:id=>self.seminar_main_id).max(:last_serial_number).to_i # last_serial_number = SeminarMain.where(:id=>self.seminar_main_id).max(:last_serial_number).to_i
self.serial_number = last_serial_number + 1 # self.serial_number = last_serial_number + 1
SeminarMain.where(:id=>self.seminar_main_id).update_all({"$inc"=>{"last_serial_number"=>1}}) # SeminarMain.where(:id=>self.seminar_main_id).update_all({"$inc"=>{"last_serial_number"=>1}})
self.serial_number = DateTime.now.to_i
end end
self.token = SecureRandom.hex(5)
end end
after_destroy do after_destroy do
seminar_main = self.seminar_main seminar_main = self.seminar_main
@ -80,6 +90,13 @@ class SeminarSignup
seminar_session.save seminar_session.save
end end
end end
def generate_token
token = SecureRandom.hex(5)
self.token = token
self.save
return token
end
def display_serial_number def display_serial_number
display_format_string(self.serial_number,4) display_format_string(self.serial_number,4)
end end
@ -175,4 +192,8 @@ class SeminarSignup
return all_fields return all_fields
end end
end end
def emails_sent_groups
emails_sent.zip([nil]*(emails_sent.length-emails_sent_time.length) + emails_sent_time.collect{|v| v.in_time_zone})
end
end end

View File

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

View File

@ -5,6 +5,7 @@ class SeminarSignupFieldSet
field :field_name, type: String field :field_name, type: String
field :placeholder field :placeholder
field :name field :name
field :validator
field :disabled, type: Boolean, default: false field :disabled, type: Boolean, default: false
field :hidden, type: Boolean, default: false field :hidden, type: Boolean, default: false
belongs_to :seminar_main belongs_to :seminar_main

View File

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

View File

@ -1,4 +1,4 @@
<%= form_for @seminar_signup, url: admin_seminar_signup_path(@seminar_signup), html: {class: "form-horizontal main-forms"} do |f| %> <%= form_for @seminar_signup, url: admin_seminar_signup_path(@seminar_signup), html: {class: "form-horizontal main-forms", multipart: true} do |f| %>
<fieldset> <fieldset>
<% content_for :page_specific_css do %> <% content_for :page_specific_css do %>
@ -14,7 +14,15 @@
<%= 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">
.emails_sent_groups{
display: inline-block;
}
.emails_sent_time{
min-height: 1em;
display: inline-block;
}
</style>
<!-- Input Area --> <!-- Input Area -->
<div class="input-area"> <div class="input-area">
@ -92,6 +100,63 @@
<div class="controls"> <div class="controls">
<%= f.email_field :email, :class=>"input-block-level", :placeholder=> signup_field.placeholder[I18n.locale], :required => true %> <%= f.email_field :email, :class=>"input-block-level", :placeholder=> signup_field.placeholder[I18n.locale], :required => true %>
</div> </div>
<div class="controls">
<label class="radio-inline">
<%= f.check_box :is_confirmed, :checked => (@seminar_signup.is_confirmed)%>
<%= f.hidden_field :is_confirmed_date %>
<%= t('seminar_signup.is_confirmed') %>
</label>
</div>
<br />
<div class="controls">
<label for="send_email" class="control-label muted"><%= t("seminar_signup.send_email") %></label>
<div class="controls">
<select name="send_email" id="send_email">
<option value=""><%= t("seminar.select_email_type") %></option>
<option value="reset_password"><%= t("seminar.reset_password") %></option>
<option value="special_reminder"><%= t("seminar.special_reminder") %></option>
</select>
</div>
</div>
<br />
<div class="controls">
<label class="control-label muted"><%= t("seminar_signup.predefined_text") %></label>
<div class="controls">
<p id="predefined_text">&nbsp;</p>
</div>
</div>
<br />
<div class="controls">
<label for="send_email_text" class="control-label muted"><%= t("seminar_signup.send_email_text") %></label>
<div class="controls">
<textarea class="" name="send_email_text" id="send_email_text" row="20" col="30"></textarea>
</div>
</div>
<br />
<div class="controls">
<div class="controls">
<a class="btn" id="send_email_button"><%= t("seminar.send_email_button") %></a>
</div>
</div>
<br />
<div class="controls">
<label for="" class="control-label muted"><%= t("seminar_signup.emails_already_sent") %></label>
<div class="controls" id="emails_sent">
<% @seminar_signup.emails_sent_groups.each do |em, em_date| %>
<span class="emails_sent_groups">
<span class="label label-success">
<%= t("seminar.#{em}") %>
</span>
<br />
<span class="emails_sent_time">
<% if em_date %>
<%= em_date.strftime("%Y/%m/%d %H:%M") %>
<% end %>
</span>
</span>
<% end %>
</div>
</div>
<% elsif signup_field.field_name == 'note' %> <% elsif signup_field.field_name == 'note' %>
<div class="controls"> <div class="controls">
<div class="input-append"> <div class="input-append">
@ -170,7 +235,7 @@
<div class="control-group"> <div class="control-group">
<%= rf.block_helper(@seminar,@form_index,false,"seminar_signup",@seminar_signup, rf.to_require) %> <%= rf.block_helper(@seminar,@form_index,false,"seminar_signup",@seminar_signup, rf.markup == "file_field" ? false : rf.to_require) %>
</div> </div>
@ -178,7 +243,13 @@
<% end %> <% end %>
<div class="controls">
<label class="radio-inline">
<%= f.check_box :signup_confirmed, :checked => (@seminar_signup.signup_confirmed)%>
<%= f.hidden_field :signup_confirmed_date %>
<%= t('seminar_signup.registration_complete') %>
</label>
</div>
</div> </div>
@ -194,3 +265,77 @@
</fieldset> </fieldset>
<% end %> <% end %>
<script>
$(document).ready(function(){
$("#send_email").on("change", function(){
if($(this).val() != ""){
let type = $(this).val();
$.ajax({
url : "/admin/seminars/get_predefined_text",
data : {"type" : type, "seminar_id": "<%= @seminar.id %>"},
dataType : "json",
type : "get",
success : function(data){
if (type === 'reset_password'){
$('#seminar_signup_status_c').click();
}
if( data.success == true ){
$("#predefined_text").html(data.html);
}
}
})
}
})
$("#send_email_button").on("click",function(){
if($("#seminar_signup_email").val() == ""){
alert("No email");
return false;
}
if($("#send_email").val() != ""){
$.ajax({
url : "/admin/seminars/send_notifying_email",
data : {
"type" : $("#send_email").val(),
"email" : $("#seminar_signup_email").val(),
"text" : $("#send_email_text").val(),
"seminar_id": "<%= @seminar.id %>"
},
dataType : "json",
type : "post",
success : function(data){
if( data.success == true ){
alert("Email Sent");
$("#emails_sent").append('<span class="emails_sent_groups"><span class="label label-success">'+ data.type +'</span><br/><span class="emails_sent_time">' +data.sent_time +'</span></span>');
}
}
})
}
return false;
})
})
$(".upload").on("change",function(){
filenamedom = $(this).parent().parent().find(".filename");
filenameA = $(this).val().split('\\');
filenamedom.text(filenameA[filenameA.length - 1]);
})
$("#seminar_signup_signup_confirmed").on("change",function () {
if(this.checked){
dt = new Date();
format = dt.getFullYear() + "/" + (dt.getMonth() + 1) + "/" + dt.getDate() + " " + dt.getHours() + ":" + dt.getMinutes();
$("#seminar_signup_signup_confirmed_date").val(format);
}else{
$("#seminar_signup_signup_confirmed_date").val("");
}
})
$("#seminar_signup_is_confirmed").on("change",function () {
if(this.checked){
dt = new Date();
format = dt.getFullYear() + "/" + (dt.getMonth() + 1) + "/" + dt.getDate() + " " + dt.getHours() + ":" + dt.getMinutes();
$("#seminar_signup_is_confirmed_date").val(format);
}else{
$("#seminar_signup_is_confirmed_date").val("");
}
})
</script>

View File

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

View File

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

View File

@ -184,6 +184,7 @@
<th><%= t('seminar.placeholder') %></th> <th><%= t('seminar.placeholder') %></th>
<th><%= t('seminar.disable') %></th> <th><%= t('seminar.disable') %></th>
<th><%= t('seminar.hidden') %></th> <th><%= t('seminar.hidden') %></th>
<th><%= t('seminar.validator') %> <br /> (Use regex pattern)</th>
</thead> </thead>
<tbody> <tbody>
<% @signup_sets.each_with_index do |attr_signup,signup_index| %> <% @signup_sets.each_with_index do |attr_signup,signup_index| %>
@ -208,6 +209,13 @@
<%= check_box_tag("seminar_main[seminar_signup_field_sets_attributes][#{signup_index}][hidden]", true ,attr_signup.hidden) %> <%= check_box_tag("seminar_main[seminar_signup_field_sets_attributes][#{signup_index}][hidden]", true ,attr_signup.hidden) %>
<% end %> <% end %>
</td> </td>
<% if attr_signup.field_name == "password" %>
<td>
<%= text_field_tag("seminar_main[seminar_signup_field_sets_attributes][#{signup_index}][validator]", attr_signup.validator) %>
</td>
<% else %>
<td>&nbsp;</td>
<% end %>
</tr> </tr>
<% end %> <% end %>
</tbody> </tbody>
@ -325,9 +333,19 @@
<%= t('seminar.email_edit_file') %> <%= t('seminar.email_edit_file') %>
</a> </a>
</li> </li>
<li class="">
<a href="#email_set4" data-toggle="tab">
<%= t('seminar.email_forgot_password') %>
</a>
</li>
<li class="">
<a href="#email_set5" data-toggle="tab">
<%= t('seminar.email_special_reminder') %>
</a>
</li>
</ul> </ul>
<div class="tab-content"> <div class="tab-content">
<% (0..3).each do |index1| %> <% (0..5).each do |index1| %>
<% active_email_set = index1==0 ? ' active' : '' %> <% active_email_set = index1==0 ? ' active' : '' %>
<div class="tab-pane<%= active_email_set %>" id="email_set<%= index1 %>" style="padding: 1.2em;"> <div class="tab-pane<%= active_email_set %>" id="email_set<%= index1 %>" style="padding: 1.2em;">
<table style="width:100%;"> <table style="width:100%;">
@ -341,6 +359,17 @@
<%= check_box_tag("seminar_main[seminar_email_sets_attributes][#{index1}][disabled]", true ,@email_set[index1].disabled) %> <%= check_box_tag("seminar_main[seminar_email_sets_attributes][#{index1}][disabled]", true ,@email_set[index1].disabled) %>
</td> </td>
</tr> </tr>
<% if index1 == 0 %>
<tr>
<td>
<%= t('seminar.is_confirmation') %>
</td>
<td>
<input type="hidden" class="field_set" name='<%= "seminar_main[seminar_email_sets_attributes][#{index1}][is_confirmation]" %>' value="false">
<%= check_box_tag("seminar_main[seminar_email_sets_attributes][#{index1}][is_confirmation]", true ,@email_set[index1].is_confirmation) %>
</td>
</tr>
<% end %>
<tr> <tr>
<td> <td>
<%= t('seminar.email_title') %> <%= t('seminar.email_title') %>

View File

@ -28,6 +28,7 @@
<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="/admin/seminars/<%=seminar.id.to_s%>/seminar_submission_field"><%= t('seminar.set_seminar_submission_field') %></a></li>
<li><a href="/admin/seminars/<%=seminar.id.to_s%>/seminar_signup_success"><%= t('seminar.seminar_signup_success') %></a></li>
<li><a href="<%=reviewer_setting_admin_seminar_path(seminar.id)%>"><%= t('seminar.reviewer_setting') %></a></li> <li><a href="<%=reviewer_setting_admin_seminar_path(seminar.id)%>"><%= t('seminar.reviewer_setting') %></a></li>
<li><a href="<%=template_setting_admin_seminar_path(seminar.id)%>"><%= t('seminar.template_setting') %></a></li> <li><a href="<%=template_setting_admin_seminar_path(seminar.id)%>"><%= t('seminar.template_setting') %></a></li>
<li><a href="<%=sub_page_setting_admin_seminar_path(seminar.id)%>"><%= t('seminar.sub_page_setting') %></a></li> <li><a href="<%=sub_page_setting_admin_seminar_path(seminar.id)%>"><%= t('seminar.sub_page_setting') %></a></li>
@ -40,7 +41,7 @@
</td> </td>
<td><%= SeminarMain.time_range(seminar.seminar_start_date, seminar.seminar_end_date) %></td> <td><%= SeminarMain.time_range(seminar.seminar_start_date, seminar.seminar_end_date) %></td>
<td><%= SeminarMain.time_range(seminar.signup_start_date, seminar.signup_end_date) %></td> <td><%= SeminarMain.time_range(seminar.signup_start_date, seminar.signup_end_date) %></td>
<td><a href="/admin/seminars/<%=seminar.id.to_s%>/seminar_signup"> <td><a href="/admin/seminars/<%=seminar.id.to_s%>/seminar_signup?type=table">
<% @seminar_review = seminar.seminar_reviews.where(:reviewer_id => current_user.member_profile_id.to_s).first %> <% @seminar_review = seminar.seminar_reviews.where(:reviewer_id => current_user.member_profile_id.to_s).first %>
<% if @seminar_review.present? && !@can_edit %> <% if @seminar_review.present? && !@can_edit %>
<%= @seminar_review.get_all_seminar_signup_ids.count %> <%= @seminar_review.get_all_seminar_signup_ids.count %>

View File

@ -52,14 +52,39 @@
val += "<div class=\"quick-edit\"> val += "<div class=\"quick-edit\">
<ul class=\"nav nav-pills\">" <ul class=\"nav nav-pills\">"
if @can_edit if @can_edit
val += "<li><a href=\"/admin/seminar_signups/#{seminar_signup.id}/edit\">#{t(:edit)}</a></li> val += content_tag :li do
<li><a href=\"#{admin_seminar_signup_path(seminar_signup.id)}\" class=\"delete text-error\" rel=\"nofollow\" data-method=\"delete\" data-confirm=\"Are you sure?\">#{t(:delete_)}</a></li>" link_to t(:edit), edit_admin_seminar_signup_path(seminar_signup.id)
end
val += content_tag :li do
link_to t(:delete_), admin_seminar_signup_path(seminar_signup.id), class: "text-error", method: :delete, "data-confirm" => "Are you sure?"
end
end end
val += "</ul> val += "</ul>
</div>" </div>"
%> %>
<% elsif names[1] == 'status' %> <% elsif names[1] == 'status' %>
<% val = t("seminar.registration_status_#{seminar_signup.status}") if !seminar_signup.status.blank? %> <% val = t("seminar.registration_status_#{seminar_signup.status}") if !seminar_signup.status.blank? %>
<% elsif names[1] == 'is_confirmed' %>
<% if seminar_signup.is_confirmed
val = "<span class='label label-success'>#{t("seminar_signup.email_confirmed")}(#{seminar_signup.signup_confirmed_counter.to_s})</span>"
else
val = "<span class='label label-danger'>#{t("seminar_signup.email_not_confirmed")}</span>"
end
%>
<% elsif names[1] == 'signup_confirmed' %>
<% if seminar_signup.signup_confirmed
val = "<span class='label label-success'>#{t("seminar_signup.signup_confirmed")}</span>"
else
val = "<span class='label label-danger'>#{t("seminar_signup.signup_not_confirmed")}</span>"
end
%>
<% elsif names[1] == 'signup_confirmed_date' %>
<% val = seminar_signup.signup_confirmed_date.strftime("%Y/%m/%d %H:%M") rescue ""
%>
<% elsif names[1] == 'is_confirmed_date' %>
<%
val = seminar_signup.is_confirmed_date.strftime("%Y/%m/%d %H:%M") rescue ""
%>
<% elsif names[1] != 'recaptcha' %> <% elsif names[1] != 'recaptcha' %>
<% val = seminar_signup.send("#{names[1]}") %> <% val = seminar_signup.send("#{names[1]}") %>
<% end %> <% end %>
@ -69,8 +94,12 @@
val += "<div class=\"quick-edit\"> val += "<div class=\"quick-edit\">
<ul class=\"nav nav-pills\">" <ul class=\"nav nav-pills\">"
if @can_edit if @can_edit
val += "<li><a href=\"/admin/seminar_signups/#{seminar_signup.id}/edit\">#{t(:edit)}</a></li> val += content_tag :li do
<li><a href=\"#{admin_seminar_signup_path(seminar_signup.id)}\" class=\"delete text-error\" rel=\"nofollow\" data-method=\"delete\" data-confirm=\"Are you sure?\">#{t(:delete_)}</a></li>" link_to t(:edit), edit_admin_seminar_signup_path(seminar_signup.id)
end
val += content_tag :li do
link_to t(:delete_), admin_seminar_signup_path(seminar_signup.id), class: "text-error", method: :delete, "data-confirm" => "Are you sure?"
end
end end
val += "</ul> val += "</ul>
</div>" </div>"

View File

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

View File

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

View File

@ -0,0 +1,63 @@
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/main-forms" %>
<%= stylesheet_link_tag "lib/main-list" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/module-area" %>
<% end %>
<h2><%= t('seminar.seminar') %></h2>
<%= form_for @seminar, url: "/admin/seminars/#{@seminar.id.to_s}/seminar_signup_success_save", html: {class: "form-horizontal main-forms"} do |f| %>
<fieldset>
<!-- Input Area -->
<div class="input-area">
<!-- Language Tabs -->
<div class="nav-name"><strong><%= t(:language) %></strong></div>
<ul class="nav nav-pills language-nav">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<li class="<%= 'active' if i == 0 %>">
<a data-toggle="tab" href=".<%= locale %>"><%= t(locale) %></a>
</li>
<% end %>
</ul>
<!-- Language -->
<div class="tab-content language-area">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
<div class="control-group input-content">
<label class="control-label muted"><%= t('seminar.seminar_signup_success') %></label>
<div class="controls">
<div class="textarea">
<%= f.fields_for :signup_success_translations do |f| %>
<%= f.cktext_area locale, rows: 5, class: "input-block-level", :value => (@seminar.signup_success_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
</div>
</div>
<% end %>
</div>
</div>
<!-- Form Actions -->
<div class="form-actions">
<%= get_referer_url[:action] rescue "" %>
<%= f.submit t('submit'), class: 'btn btn-primary' %>
<input type="hidden" name="referer_url" value="<%= get_referer_url %>">
<%= link_to t('cancel'), admin_seminars_path, :class=>"btn" %>
</div>
</fieldset>
<% end %>

View File

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

View File

@ -0,0 +1,9 @@
<% email_set = SeminarMain.where(id:@data['seminar_id']).first.seminar_email_sets.select{|v| v.field_name == 'reset_password'} %>
<% if email_set.length != 0 %>
<% if !(email_set[0].content.nil?) %>
<%= email_set[0].content[@data['locale']].html_safe %>
<% end %>
<% else %>
<%= t('seminar.email_add_file_content') %>
<% end %>
<%= (@data['extra_text'] rescue "").to_s.html_safe %>

View File

@ -1,4 +1,5 @@
<% email_set = SeminarMain.where(id:@data['seminar_id']).first.seminar_email_sets.select{|v| v.field_name == 'signup'} %> <% email_set = SeminarMain.where(id:@data['seminar_id']).first.seminar_email_sets.select{|v| v.field_name == 'signup'} %>
<%= (@data['extra_text'] rescue "").to_s.html_safe %>
<% if email_set.length != 0 %> <% if email_set.length != 0 %>
<% if !(email_set[0].content.nil?) %> <% if !(email_set[0].content.nil?) %>
<%= email_set[0].content[@data['locale']].html_safe %> <%= email_set[0].content[@data['locale']].html_safe %>
@ -6,4 +7,3 @@
<% else %> <% else %>
<%= t('seminar.email_signup_content') %> <%= t('seminar.email_signup_content') %>
<% end %> <% end %>
<%= (@data['extra_text'] rescue "").to_s.html_safe %>

View File

@ -0,0 +1,9 @@
<% email_set = SeminarMain.where(id:@data['seminar_id']).first.seminar_email_sets.select{|v| v.field_name == 'special_reminder'} %>
<% if email_set.length != 0 %>
<% if !(email_set[0].content.nil?) %>
<%= email_set[0].content[@data['locale']].html_safe %>
<% end %>
<% else %>
<%= t('seminar.email_add_file_content') %>
<% end %>
<%= (@data['extra_text'] rescue "").to_s.html_safe %>

View File

@ -9,7 +9,7 @@
color: red; color: red;
} }
</style> </style>
<% if (@seminar.contribute_start_date <= @time_now && (@seminar.contribute_end_date.nil? or @seminar.contribute_end_date+1 >= @time_now ) rescue false) %> <% if (@seminar.contribute_start_date.nil? || @seminar.contribute_start_date <= @time_now) && (@seminar.contribute_end_date.nil? or @seminar.contribute_end_date+1 >= @time_now ) %>
<section id="main-wrap"> <section id="main-wrap">
<div class="sign-in have-other-sign-in"> <div class="sign-in have-other-sign-in">
@ -39,6 +39,9 @@
<%= password_field_tag :password, nil, :placeholder => t(:dots), :id=>"user_password" %> <%= password_field_tag :password, nil, :placeholder => t(:dots), :id=>"user_password" %>
</div> </div>
<br/> <br/>
<div class="control-group clear">
<a href="<%= request.original_url.split(request.env["HTTP_HOST"]).last.split('?').first + "?method=reset_email" %>"><%= t('seminar_signup.forgot_password') %></a>
</div>
<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 %>">
<input type="hidden" name="seminar_signup[seminar_main_id]" value="<%= @seminar.id %>"> <input type="hidden" name="seminar_signup[seminar_main_id]" value="<%= @seminar.id %>">
<button class="btn btn-primary" name="button" type="submit"><%= t('seminar_signup.login') %></button> <button class="btn btn-primary" name="button" type="submit"><%= t('seminar_signup.login') %></button>

View File

@ -9,9 +9,9 @@
data1 = @seminar.seminar_submission_field_sets.select{|v| v.field_name=='title'}[0] data1 = @seminar.seminar_submission_field_sets.select{|v| v.field_name=='title'}[0]
data2 = @seminar.seminar_submission_field_sets.select{|v| v.field_name=='description'}[0] data2 = @seminar.seminar_submission_field_sets.select{|v| v.field_name=='description'}[0]
data3 = @seminar.seminar_submission_field_sets.select{|v| v.field_name=='file'}[0] data3 = @seminar.seminar_submission_field_sets.select{|v| v.field_name=='file'}[0]
show1 = !(data1.disabled) rescue false show1 = data1 ? !(data1.disabled) : false
show2 = !(data2.disabled) rescue false show2 = data2 ? !(data2.disabled) : false
show3 = !(data3.disabled) rescue false show3 = data3 ? !(data3.disabled) : false
name1 = data1['name'][I18n.locale] name1 = data1['name'][I18n.locale]
name2 = data2['name'][I18n.locale] name2 = data2['name'][I18n.locale]
name3 = data3['name'][I18n.locale] name3 = data3['name'][I18n.locale]
@ -21,17 +21,17 @@
else else
prefix_url = OrbitHelper.url_to_show(@seminar.to_param) prefix_url = OrbitHelper.url_to_show(@seminar.to_param)
end end
%> %>
<% if @seminar.contribute_start_date <= @time_now and ( @seminar.contribute_end_date.nil? or @seminar.contribute_end_date+1 >= @time_now ) %> <h3 style="display:block;"><%= @seminar.title %></h3>
<% if (@seminar.contribute_start_date.nil? || @seminar.contribute_start_date <= @time_now) && ( @seminar.contribute_end_date.nil? || @seminar.contribute_end_date+1 >= @time_now ) %>
<% begin %> <% begin %>
<% if !session[:seminar_signup_id].blank? %> <% if !session[:seminar_signup_id].blank? %>
<%= t('seminar_signup.serial_number') %>: <%=@seminar_signup.display_serial_number rescue ""%> <%= t('seminar_signup.serial_number') %>: <%=@seminar_signup.display_serial_number rescue ""%>
<a href="<%= prefix_url %>?method=con_logout&con_no=<%= @seminar.id %>" class='btn btn-primary'><%= t('seminar_signup.logout') %></a> <a href="<%= prefix_url %>?method=con_logout&con_no=<%= @seminar.id %>" class='btn btn-primary' style="display:inline;"><%= t('seminar_signup.logout') %></a>
<a href="<%= prefix_url %>?method=edit_login_seminar_signup&con_no=<%= @seminar.id %>" class='btn btn-primary' style="display:inline;"><%= t('seminar_signup.edit_form') %></a>
<% if data["show"] %>
<table class="table table-hover table-striped seminar-index"> <table class="table table-hover table-striped seminar-index">
<caption>
<h3><%= @seminar.title %></h3>
</caption>
<thead> <thead>
<tr> <tr>
<% if show1 %> <% if show1 %>
@ -91,6 +91,7 @@
<%= link_to content_tag(:i, nil, :class => 'icon-plus') +' '+ t('seminar_signup.new_'), prefix_url + '?method=add_file', :class => 'btn btn-primary' %> <%= link_to content_tag(:i, nil, :class => 'icon-plus') +' '+ t('seminar_signup.new_'), prefix_url + '?method=add_file', :class => 'btn btn-primary' %>
<% end %>
<% end %> <% end %>
<br /> <br />
<br /> <br />

View File

@ -0,0 +1,21 @@
<% # encoding: utf-8 %>
<%
data = action_data("confirm_email_page")
if data["url"]
url = data["url"]
end
%>
<br>
<% if (data['confirm'] == true) %>
<%= t('seminar.confirm_ok') %>
<br>
<a href="<%= url %>?method=con_login" class="btn btn-primary">
<%= t('seminar.click_to_contribute') %>
</a>
<% else %>
<%= t('seminar.confirm_not_ok') %>
<br>
<a href="<%= url %>?method=show_data" class="btn btn-primary">
<%= t('seminar.back') %>
</a>
<% end %>

View File

@ -0,0 +1,506 @@
<%
data = action_data
@seminar = data["seminar"]
@seminar_signup = data["seminar_signup"]
@time_now = data["time_now"]
@form_index = 0
if data["prefix_url"]
prefix_url = data["prefix_url"]
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)
signup_is_full = @seminar.signup_is_full?
%>
<style>
.error {
color: red;
}
</style>
<% 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') %>
<% elsif signup_is_full %>
<%= t('seminar.sign_up_is_full') %>
<% else %>
<%#= stylesheet_link_tag "lib/main-forms" %>
<%= stylesheet_link_tag "basic/bootstrap-datetimepicker" %>
<%= javascript_include_tag "lib/bootstrap-datetimepicker" %>
<%= javascript_include_tag "lib/datetimepicker/date.time.picker.js" %>
<%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %>
<% notice = flash["notice"] || params[:notice] %>
<% flash.each do |key, msg| %>
<% next if key.to_s == "notice" %>
<%= content_tag :p, msg, :class => [key, "alert alert-error in fade"], :style => "color: red; font-weight: bold;" %>
<% end %>
<% if notice.present? %>
<%= content_tag :p, params[:notice], :class => ["notice alert alert-error in fade"], :style => "color: red; font-weight: bold;" %>
<script type="text/javascript">
window.alert("<%=notice%>");
</script>
<% end %>
<style type="text/css">
.checkbox input[type=checkbox], .checkbox-inline input[type=checkbox], .radio input[type=radio], .radio-inline input[type=radio] {
position: relative;
margin: 0;
}
</style>
<%= form_for @seminar_signup, url: (@seminar_signup.new_record? ? seminars_path : update_signup_form_seminars_path), html: {class: "content form-horizontal" , :id=>"new-seminar-signup", multipart: true} do |f| %>
<fieldset>
<!-- Title -->
<div class="form-group">
<label for="title" class="col-sm-2 control-label"><%#= t('seminar.title') %></label>
<div class="col-sm-10">
<h3><%= @seminar.title %></h3>
</div>
</div>
<% if !@seminar.signup_note.blank? %>
<div class="form-group">
<label for="note" class="col-sm-2 control-label"><%= t('seminar.note') %></label>
<div class="col-sm-10">
<%= @seminar.signup_note.html_safe %>
</div>
</div>
<% end %>
<div>
<div class="col-sm-12" style="text-align: center;"> *(<%= t('seminar.required') %>) </div>
</div>
<% if @seminar.seminar_signup_field_sets.count != 0 %>
<% @seminar.seminar_signup_field_sets.each do |signup_field| %>
<% if !(signup_field.disabled) && signup_field.field_name != 'recaptcha' && signup_field.field_name != 'password' %>
<div class="form-group<%= (@seminar.registration_status[0] == 'G' && (signup_field.field_name == 'password' || signup_field.field_name == "status")) ? ' hide' : '' %>" id="<%= signup_field.field_name == 'password' ? 'registration_status' : '' %>">
<label for="<%= signup_field['name'][I18n.locale] %>" class="col-sm-2 control-label">
<% if !(['address','note'].include? signup_field.field_name) %>
*
<% end %>
<%= signup_field['name'][I18n.locale] %>
</label>
<% if signup_field.field_name == 'status' %>
<% status_translations = ['G','C'].map{|c| [c, t("seminar.registration_status_#{c}")] }.to_h %>
<% status_translations = {'G'=>'No','C'=>'Yes'} if (signup_field.name.values.select{|v| v.include?('?') || v.include?('是否')}.count != 0 rescue false) %>
<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');" %> <%= status_translations['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) %> <%= status_translations['C'] %>
</label>
<% end %>
</div>
<% elsif signup_field.field_name == 'unit' %>
<div class="col-sm-10">
<%= f.text_field 'unit', :class=>"input-medium form-control", :value => (@seminar_signup.send("unit_translations")[locale] rescue nil), :placeholder=> "#{signup_field.placeholder[I18n.locale]}", :required => true %>
</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, :title => t("seminar_signup.email_check") %>
<div class="loader"></div>
</div>
<% elsif signup_field.field_name == 'password' %>
<div class="col-sm-10">
<%= f.password_field :password, :class=>"input-medium form-control availibility", :id=>signup_field['field_name'], :placeholder=> signup_field.placeholder[I18n.locale], :pattern => signup_field.validator, :title => t("seminar_signup.password_check") %>
</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>
<% elsif signup_field.field_name == 'tel' %>
<div class="col-sm-10">
<%= f.text_field :tel, :class=>"input-medium form-control", :placeholder=> signup_field.placeholder[I18n.locale], :required => true, pattern: "[\\d\\+\\-\\(\\)]{10,13}", title: t("seminar.phone_hint") %>
<p>(<%= t("seminar.phone_hint") %>)</p>
</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 => true %>
</div>
<% end %>
</div>
<% end %>
<% end %>
<% else %>
<div class="form-group">
<label for="status" class="col-sm-2 control-label"><%= t('seminar.registration_status') %></label>
<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>
</div>
<!-- Name to Last Name -->
<div class="form-group">
<label for="name" class="col-sm-2 control-label">*<%= t('seminar_signup.name') %></label>
<div class="col-sm-10">
<%= f.text_field :name, :class=>"input-medium form-control", :id=>'name', :placeholder=> t('seminar_signup.name'), :required => true %>
</div>
</div>
<!-- Tel to First Name -->
<div class="form-group">
<label for="tel" class="col-sm-2 control-label">*<%= t('seminar_signup.tel') %></label>
<div class="col-sm-10">
<%= f.text_field :tel, :class=>"input-medium form-control", :placeholder=> t('seminar_signup.tel'), :required => true, pattern: "[\\d\\+\\-\\(\\)]+" %>
</div>
</div>
<!-- Email -->
<div class="form-group">
<label for="email" class="col-sm-2 control-label">*<%= t(:email) %></label>
<div class="col-sm-10">
<%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> t(:email), :required => true %>
</div>
</div>
<div class="form-group <%= @seminar.registration_status[0] == 'C' ? '' : 'hide' %>" id="registration_status">
<label for="password" class="col-sm-2 control-label">*<%= t('seminar_signup.password') %></label>
<div class="col-sm-10">
<%= f.text_field :password, :class=>"input-medium form-control", :placeholder=> t('seminar_signup.password') %>
<%= t('seminar_signup.password_message') %>
</div>
</div>
<% end %>
<%
group = 1
counter = 0
%>
<% @seminar.seminar_signup_fields.where(:disabled=>false).asc(:sort_number, :_id).each_with_index do |rf, idx| %>
<% if(idx == 6) %>
<div id="optional">
<% end %>
<% if(idx % 6 == 0) && idx != 0 %>
<% group += 1 %>
<% if @seminar_signup.seminar_signup_values[@form_index] && !@seminar_signup.seminar_signup_values[@form_index].value.blank? %>
<div id="group<%= group %>">
<% else %>
<div id="group<%= group %>" style="display:none;">
<% end %>
<% end %>
<% counter += 1 %>
<div class="form-group">
<%= rf.block_helper(@seminar,@form_index,false,"seminar_signup",@seminar_signup, rf.to_require) %>
</div>
<% if(counter % 6 == 0) && idx != 5 %>
<% counter = 0 %>
</div>
<% end %>
<% if(idx == 30) %>
<div id="optional">
<% end %>
<% @form_index = @form_index +1 %>
<% end %>
</div>
<div class="form-group" style="text-align:center;margin:10px 0;">
<button id="add-member" class="btn btn-primary" style="display:inline; width: 150px;position: relative;float: left;"><%= t("seminar_signup.add_member") %></button>
<button id="remove-member" class="btn btn-primary" style="display:inline;position: relative;float: right; background:red; border-color:red;display: none;"><%= t("seminar_signup.remove_member") %></button>
</div>
<!-- 驗證碼 -->
<% if @seminar.seminar_signup_field_sets.count != 0 && @seminar_signup.new_record? %>
<% if !(@seminar.seminar_signup_field_sets.select{|v| v.field_name=='recaptcha'}[0].disabled) %>
<div class="form-group">
<label for="note" class="col-sm-2 control-label"><%= t('seminar_signup.recaptcha') %></label>
<div class="col-sm-10">
<%= gotcha_error %>
<%= gotcha %>
</div>
</div>
<% end %>
<% end %>
<!-- <div class="form-group">
<label for="note" class="col-sm-2 control-label"><%#= t('nkuht_donate.recaptcha') %></label>
<div class="col-sm-10">
<%#= show_simple_captcha %>
</div>
</div> -->
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<label>
<input id="agree" name="agree" value="1" type="checkbox" required="required" <% if !@seminar_signup.new_record? %>checked="checked"<%end%>>
<a href="<%= prefix_url %>?method=show_privacy" target="_blank" style="color: black;"><%= t("seminar_signup.agree")%></a>
</label>
</div>
</div>
<div class="form-group">
<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 rescue "/" %>">
<input type="hidden" name="seminar_signup[seminar_main_id]" value="<%= @seminar.id %>">
<% if !@seminar_signup.new_record? %>
<input type="hidden" name="signup_id" value="<%= @seminar_signup.id %>">
<% end %>
<%= f.submit "Submit", class: 'btn btn-primary', :id => 'button-mail' %>
<%= f.button "Delete", type: 'reset', class: 'btn' %>
</div>
</div>
</fieldset>
<% end %>
<script type="text/javascript">
(function(){
function check_repeat_value(event) {
var validated = true;
var all_values = $.map($('input[name^="seminar_signup_values"]:visible'), function(v) {
return [[v, $(v).val()]];
}).filter(function(v){
return v[1] != ''
});
var values = [];
for (var i=0;i< all_values.length;i++){
if (values.includes(all_values[i][1])){
all_values[i][0].setCustomValidity("<%= t('seminar.repeat_hint') %>");
all_values[i][0].focus();
$(all_values[i][0]).parents('form')[0].reportValidity();
validated = false;
$(all_values[i][0]).one('keyup change', function(){
this.setCustomValidity("");
});
break;
}
values.push(all_values[i][1]);
}
return validated;
}
function uploadSubmit(form){
$.ajax({
type: 'post',
method: 'post',
async: false,
contentType: false,
processData: false,
dataType: "script",
url: $(form).attr('action'),
data: new FormData(form)
});
}
$(".rucaptcha-image").siblings("input[type=\"text\"]").attr("placeholder","Verification");
var validated = false,
chks = false,
pwd = $('#seminar_signup_password')
$('input[type=submit]').on('click', function(){
var form = $(this).parents('form')[0];
if (form){
window.setTimeout(function(){
form.reportValidity();
}, 500);
}
});
$("form.content").submit(function(event) {
if (!check_repeat_value(event)){
return false;
}
if ($('*[name^="seminar_signup_values"]:visible')){
$('input[name^="seminar_signup_values"]:visible').map(function(k, v) {
return $(v).val();
});
}
if ($('#seminar_signup_status_c:checked').val() == 'C'){
if (pwd.val() == ''){
pwd.attr('required', true);
pwd.focus();
alert( '<%= t('seminar_signup.password') %>' + ' is required');
return false;
}
}
<%
@seminar.seminar_signup_fields.where(:disabled=>false).asc(:sort_number, :_id).each do |rf|
if rf.markup == 'checkbox'
%>
var checkedCount = $("input[type=checkbox][id^=seminar_signup_values_<%= rf.id %>]:checked").length;
if (checkedCount == 0){
alert( '<%= rf.title %>' + ' is required');
return false;
}
<%
end
end
%>
var form = $(this),
isChecked = $('#agree:checked').val()?true:false;
if(!isChecked){
return false;
}
uploadSubmit(this);
return false;
});
$('input[type="email"]').blur(function(){
var type = $(this).attr("id"),
loader = $(this).parent().find('.loader'),
elem = $(this),
value = $(this).val() || null;
var checkAvailability = function(){
$.ajax({
url : "<%= "/xhr/seminars/check_email/#{@seminar.id}" %>",
data : {"type" : type, "email" : value},
dataType : "json",
type : "get",
success : function(data){
if( data.success == true ){
loader.removeClass("error");
}else{
loader.addClass("error");
}
loader.text(data.result);
}
});
};
if( value ){
if (!this.checkValidity()){
loader.addClass("error");
loader.text("<%= t("seminar.email_hint") %>");
return;
}else{
loader.removeClass("error");
loader.text("");
}
if(type == "seminar_signup_email"){
loader.text("Checking...")
checkAvailability();
}
}
});
$(".upload").on("change",function(){
let filenamedom = $(this).parent().parent().find(".filename");
let filenameA = $(this).val().split('\\');
filenamedom.text(filenameA[filenameA.length - 1]);
})
$("#optional label").each(function(){
if($(this).hasClass("control-label")){
$(this).text("*" + $(this).text());
}
})
// $("#seminar_signup_values_3_value").removeAttr("placeholder");
let currentGroup = 1 + $("#new-seminar-signup div[id^=group]:visible").length;
function showGroup($group, init){
$group.show();
$group.find('.fake-clean-file').remove();
$group.find('input,textarea').attr("required", true);
if(init){
$group.find('input.tick').attr("checked", true);
}
}
function hideGroup($group){
$group.hide();
$group.find("input[type!=hidden], textarea").val("");
$.each($group.find("input[type=file]"), function(k, v) {
$(v).after("<input class=\"fake-clean-file\" type=\"hidden\" name=\""+$(v).attr('name')+"\" value=\"\">");
});
$group.find('input,textarea').attr("required", false);
}
if (currentGroup > 1){
$("#remove-member").show();
for (var i = 1; i <= currentGroup; i++){
showGroup($("#group" + i), true);
}
}
$("input.first-tick").attr("checked",true);
$("#add-member").on("click",function () {
if(currentGroup < 5){
$("#remove-member").show();
currentGroup++;
if(currentGroup == 5){
$(this).hide();
}
}
showGroup($("#group" + currentGroup));
return false;
})
$("#remove-member").on("click",function () {
$("#add-member").show();
if(currentGroup > 0){
hideGroup($("#group" + currentGroup));
currentGroup--;
if(currentGroup == 1){
$(this).hide();
}
}
return false;
})
})();
</script>
<% end %>

View File

@ -0,0 +1,50 @@
<% # encoding: utf-8 %>
<%
data = action_data("con_login")
@seminar = data["seminar"]
@time_now = data["time_now"]
%>
<style type="text/css">
.alert-error{
color: red;
}
</style>
<section id="main-wrap">
<div class="sign-in have-other-sign-in">
<% flash.each do |key, msg| %>
<%= content_tag :p, msg, :class => [key, "alert alert-error in fade"] %>
<% end %>
<div class="form">
<h2><%= @seminar.title %></h2>
<h3 class="login-logo"><%= t('seminar_signup.forgot_password') %></h3>
<div>
<input name="utf8" type="hidden" value="" />
<input name="authenticity_token" type="hidden" value="" />
</div>
<div class="form-block">
<div class="form-list clearfix">
<%= form_tag reset_password_proc_seminars_path, :class => 'content' do %>
<div class="control-group clear">
<label for="user_email">
<i class="icon-user"></i><%=t('seminar_signup.email_address')%>
</label>
<%= text_field_tag :user_name, params[:user_name], :placeholder => t('seminar_signup.email_address'), :id=>"user_email" %>
</div>
<br/>
<input type="hidden" name="referer_url" value="<%= request.original_url.split(request.env["HTTP_HOST"]).last.split('?').first %>">
<input type="hidden" name="seminar_signup[seminar_main_id]" value="<%= @seminar.id %>">
<button class="btn btn-primary" name="button" type="submit"><%= t('seminar_signup.reset') %></button>
<% end %>
</div>
</div>
<br/>
</div>
</div>
</section>
<script type="text/javascript">
$(document).ready(function(){
var max_width = Math.max.apply(null, $(".form .control-group label").map(function(i,el){return $(el).width()}));
$(".form .control-group label").width(max_width);
})
</script>

View File

@ -0,0 +1,74 @@
<% # encoding: utf-8 %>
<%
data = action_data
@seminar = data["seminar"]
%>
<style type="text/css">
.alert-error{
color: red;
}
</style>
<section id="main-wrap">
<% if data["status"] %>
<div class="sign-in have-other-sign-in">
<% flash.each do |key, msg| %>
<%= content_tag :p, msg, :class => [key, "alert alert-error in fade"] %>
<% end %>
<div class="form">
<h2><%= @seminar.title %></h2>
<h3 class="login-logo"><%= t('seminar_signup.forgot_password') %></h3>
<div>
<input name="utf8" type="hidden" value="" />
<input name="authenticity_token" type="hidden" value="" />
</div>
<div class="form-block">
<div class="form-list clearfix">
<%= form_tag reset_confirm_password_proc_seminars_path, :class => 'content', :id =>"change-password-form" do %>
<div class="control-group clear">
<label for="user_password">
<i class="icon-user"></i><%=t('seminar_signup.password')%>
</label>
<%= password_field_tag :password, nil, :placeholder => t(:dots), :id=>"user_password", :required=> true, :pattern => data["pattern"], :title => t("seminar_signup.password_check") %>
</div>
<div class="control-group clear">
<label for="confirm_user_password">
<i class="icon-user"></i><%=t('seminar_signup.confirm_password')%>
</label>
<%= password_field_tag :confirm_password, nil, :placeholder => t(:dots), :id=>"confirm_user_password", :required=> true %>
</div>
<p class="alert-error" id="confirm-error"></p>
<br/>
<input type="hidden" name="referer_url" value="<%= request.original_url.split(request.env["HTTP_HOST"]).last.split('?').first %>">
<input type="hidden" name="seminar_id" value="<%= @seminar.id %>">
<input type="hidden" name="cid" value="<%= params[:cid] %>">
<input type="hidden" name="reset_token" value="<%= data['token'] %>" />
<button class="btn btn-primary" name="button" type="submit"><%= t('seminar_signup.reset') %></button>
<% end %>
</div>
</div>
<br/>
</div>
</div>
<% else %>
<p>Invalid URL</p>
<% end %>
</section>
<script type="text/javascript">
$(document).ready(function(){
var max_width = Math.max.apply(null, $(".form .control-group label").map(function(i,el){return $(el).width()}));
$(".form .control-group label").width(max_width);
})
form = document.querySelector("#change-password-form");
form.onsubmit = function () {
var up = document.querySelector("#user_password").value,
cup = document.querySelector("#confirm_user_password").value
if(up != cup){
document.querySelector("#confirm-error").textContent = "<%= t("seminar_signup.password_mismatch") %>"
return false;
}else{
return true;
}
}
</script>

View File

@ -14,6 +14,11 @@
sign_up_overdue = @seminar.signup_end_date && @time_now && (@seminar.signup_end_date + 1.day <= @time_now) sign_up_overdue = @seminar.signup_end_date && @time_now && (@seminar.signup_end_date + 1.day <= @time_now)
signup_is_full = @seminar.signup_is_full? signup_is_full = @seminar.signup_is_full?
%> %>
<style>
.error {
color: red;
}
</style>
<% if !registration_is_open %> <% if !registration_is_open %>
<%= t('seminar.sign_up_not_open') %> <%= t('seminar.sign_up_not_open') %>
@ -53,14 +58,14 @@
margin: 0; margin: 0;
} }
</style> </style>
<%= form_for @seminar_signup, url: seminars_path, html: {class: "content form-horizontal" , :id=>"new-seminar-signup", multipart: true} do |f| %> <%= form_for @seminar_signup, url: (@seminar_signup.new_record? ? seminars_path : update_signup_form_seminars_path), html: {class: "content form-horizontal" , :id=>"new-seminar-signup", multipart: true} do |f| %>
<fieldset> <fieldset>
<!-- Title --> <!-- Title -->
<div class="form-group"> <div class="form-group">
<label for="title" class="col-sm-2 control-label"><%= t('seminar.title') %></label> <label for="title" class="col-sm-2 control-label"><%#= t('seminar.title') %></label>
<div class="col-sm-10"> <div class="col-sm-10">
<%= @seminar.title %> <h3><%= @seminar.title %></h3>
</div> </div>
</div> </div>
<% if !@seminar.signup_note.blank? %> <% if !@seminar.signup_note.blank? %>
@ -76,8 +81,8 @@
</div> </div>
<% if @seminar.seminar_signup_field_sets.count != 0 %> <% if @seminar.seminar_signup_field_sets.count != 0 %>
<% @seminar.seminar_signup_field_sets.each do |signup_field| %> <% @seminar.seminar_signup_field_sets.each do |signup_field| %>
<% if !(signup_field.disabled) && signup_field.field_name != 'recaptcha' %> <% if !(signup_field.disabled) && signup_field.field_name != 'recaptcha' && signup_field.field_name != 'password' %>
<div class="form-group<%= (@seminar.registration_status[0] == 'G' && signup_field.field_name == 'password') ? ' hide' : '' %>" id="<%= signup_field.field_name == 'password' ? 'registration_status' : '' %>"> <div class="form-group<%= (@seminar.registration_status[0] == 'G' && (signup_field.field_name == 'password' || signup_field.field_name == "status")) ? ' hide' : '' %>" id="<%= signup_field.field_name == 'password' ? 'registration_status' : '' %>">
<label for="<%= signup_field['name'][I18n.locale] %>" class="col-sm-2 control-label"> <label for="<%= signup_field['name'][I18n.locale] %>" class="col-sm-2 control-label">
<% if !(['address','note'].include? signup_field.field_name) %> <% if !(['address','note'].include? signup_field.field_name) %>
* *
@ -124,7 +129,12 @@
</div> </div>
<% elsif signup_field.field_name == 'email' %> <% elsif signup_field.field_name == 'email' %>
<div class="col-sm-10"> <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(' <%= prefix_url %>?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> <%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> signup_field.placeholder[I18n.locale], :required => true, :title => t("seminar_signup.email_check") %>
<div class="loader"></div>
</div>
<% elsif signup_field.field_name == 'password' %>
<div class="col-sm-10">
<%= f.password_field :password, :class=>"input-medium form-control availibility", :id=>signup_field['field_name'], :placeholder=> signup_field.placeholder[I18n.locale], :pattern => signup_field.validator, :title => t("seminar_signup.password_check") %>
</div> </div>
<% elsif signup_field.field_name == 'note' %> <% elsif signup_field.field_name == 'note' %>
<div class="col-sm-10"> <div class="col-sm-10">
@ -145,9 +155,19 @@
</div> </div>
</div> </div>
</div> </div>
<% elsif signup_field.field_name == 'tel' %>
<div class="col-sm-10">
<%= f.text_field :tel, :class=>"input-medium form-control", :placeholder=> signup_field.placeholder[I18n.locale], :required => true, pattern: "[\\d\\+\\-\\(\\)]{10,13}", title: t("seminar.phone_hint") %>
<p>(<%= t("seminar.phone_hint") %>)</p>
</div>
<% elsif signup_field.field_name == 'name' %>
<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 => true %>
<div class="loader"></div>
</div>
<% else %> <% else %>
<div class="col-sm-10"> <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) %> <%= f.text_field signup_field['field_name'], :class=>"input-medium form-control", :id=>signup_field['field_name'], :placeholder=> signup_field.placeholder[I18n.locale], :required => true %>
</div> </div>
<% end %> <% end %>
</div> </div>
@ -182,7 +202,7 @@
<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">
<%= f.text_field :tel, :class=>"input-medium form-control", :placeholder=> t('seminar_signup.tel'), :required => true %> <%= f.text_field :tel, :class=>"input-medium form-control", :placeholder=> t('seminar_signup.tel'), :required => true, pattern: "[\\d\\+\\-\\(\\)]+" %>
</div> </div>
</div> </div>
@ -190,7 +210,7 @@
<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>
<div class="col-sm-10"> <div class="col-sm-10">
<%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> t(:email), :required => true %> <a href="#" onclick="window.open(' <%= prefix_url %>?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> <%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> t(:email), :required => true %>
</div> </div>
</div> </div>
@ -203,21 +223,46 @@
</div> </div>
<% end %> <% end %>
<% @seminar.seminar_signup_fields.where(:disabled=>false).asc(:sort_number, :_id).each do |rf| %> <%
group = 1
counter = 0
%>
<% @seminar.seminar_signup_fields.where(:disabled=>false).asc(:sort_number, :_id).each_with_index do |rf, idx| %>
<% if(idx == 6) %>
<div id="optional">
<% end %>
<% if(idx % 6 == 0) && idx != 0 %>
<% group += 1 %>
<% if @seminar_signup.seminar_signup_values[@form_index] && !@seminar_signup.seminar_signup_values[@form_index].value.blank? %>
<div id="group<%= group %>">
<% else %>
<div id="group<%= group %>" style="display:none;">
<% end %>
<% end %>
<% counter += 1 %>
<div class="form-group"> <div class="form-group">
<%= rf.block_helper(@seminar,@form_index,false,"seminar_signup",@seminar_signup, rf.to_require) %> <%= rf.block_helper(@seminar,@form_index,false,"seminar_signup",@seminar_signup, rf.to_require) %>
</div> </div>
<% if(counter % 6 == 0) && idx != 5 %>
<% counter = 0 %>
</div>
<% end %>
<% if(idx == 30) %>
<div id="optional">
<% end %>
<% @form_index = @form_index +1 %> <% @form_index = @form_index +1 %>
<% end %> <% end %>
</div>
<div class="form-group" style="text-align:center;margin:10px 0;">
<button id="add-member" class="btn btn-primary" style="display:inline; width: 150px;position: relative;float: left;"><%= t("seminar_signup.add_member") %></button>
<button id="remove-member" class="btn btn-primary" style="display:inline;position: relative;float: right; background:red; border-color:red;display: none;"><%= t("seminar_signup.remove_member") %></button>
</div>
<!-- 驗證碼 --> <!-- 驗證碼 -->
<% if @seminar.seminar_signup_field_sets.count != 0 %> <% if @seminar.seminar_signup_field_sets.count != 0 && @seminar_signup.new_record? %>
<% if !(@seminar.seminar_signup_field_sets.select{|v| v.field_name=='recaptcha'}[0].disabled) %> <% 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>
@ -239,8 +284,8 @@
<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">
<label> <label>
<input id="agree" name="agree" value="1" type="checkbox" required="required"> <input id="agree" name="agree" value="1" type="checkbox" required="required" <% if !@seminar_signup.new_record? %>checked="checked"<%end%>>
<a href="<%= prefix_url %>?method=show_privacy" target="_blank"><%= t("seminar_signup.agree")%></a> <a href="<%= prefix_url %>?method=show_privacy" target="_blank" style="color: black;"><%= t("seminar_signup.agree")%></a>
</label> </label>
</div> </div>
</div> </div>
@ -249,6 +294,9 @@
<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 rescue "/" %>"> <input type="hidden" name="referer_url" value="<%= request.original_url.split(request.env["HTTP_HOST"]).last rescue "/" %>">
<input type="hidden" name="seminar_signup[seminar_main_id]" value="<%= @seminar.id %>"> <input type="hidden" name="seminar_signup[seminar_main_id]" value="<%= @seminar.id %>">
<% if !@seminar_signup.new_record? %>
<input type="hidden" name="signup_id" value="<%= @seminar_signup.id %>">
<% end %>
<%= f.submit "Submit", class: 'btn btn-primary', :id => 'button-mail' %> <%= f.submit "Submit", class: 'btn btn-primary', :id => 'button-mail' %>
<%= f.button "Delete", type: 'reset', class: 'btn' %> <%= f.button "Delete", type: 'reset', class: 'btn' %>
</div> </div>
@ -260,12 +308,62 @@
<script type="text/javascript"> <script type="text/javascript">
(function(){ (function(){
function check_repeat_value(event) {
var validated = true;
var all_values = $.map($('input[name^="seminar_signup_values"]:visible'), function(v) {
return [[v, $(v).val()]];
}).filter(function(v){
return v[1] != ''
});
var values = [];
for (var i=0;i< all_values.length;i++){
if (values.includes(all_values[i][1])){
all_values[i][0].setCustomValidity("<%= t('seminar.repeat_hint') %>");
all_values[i][0].focus();
$(all_values[i][0]).parents('form')[0].reportValidity();
validated = false;
$(all_values[i][0]).one('keyup change', function(){
this.setCustomValidity("");
});
break;
}
values.push(all_values[i][1]);
}
return validated;
}
function uploadSubmit(form){
$.ajax({
type: 'post',
method: 'post',
async: false,
contentType: false,
processData: false,
dataType: "script",
url: $(form).attr('action'),
data: new FormData(form)
});
}
$(".rucaptcha-image").siblings("input[type=\"text\"]").attr("placeholder","Verification"); $(".rucaptcha-image").siblings("input[type=\"text\"]").attr("placeholder","Verification");
var validated = false, var validated = false,
chks = false, chks = false,
pwd = $('#seminar_signup_password') pwd = $('#seminar_signup_password')
$('input[type=submit]').on('click', function(){
var form = $(this).parents('form')[0];
if (form){
window.setTimeout(function(){
form.reportValidity();
}, 500);
}
});
$("form.content").submit(function(event) { $("form.content").submit(function(event) {
if (!check_repeat_value(event)){
return false;
}
if ($('*[name^="seminar_signup_values"]:visible')){
$('input[name^="seminar_signup_values"]:visible').map(function(k, v) {
return $(v).val();
});
}
if ($('#seminar_signup_status_c:checked').val() == 'C'){ if ($('#seminar_signup_status_c:checked').val() == 'C'){
@ -302,41 +400,129 @@
return false; return false;
} }
uploadSubmit(this);
return false;
}); });
$('#name').blur(function(){
var type = $(this).attr("id"),
$(".availibility").blur(function(){ loader = $(this).parent().find('.loader'),
elem = $(this),
value = $(this).val().trim() || null;
var checkAvailability = function(){
$.ajax({
url : "<%= "/xhr/seminars/check_name/#{@seminar.id}" %>",
data : {"type" : type, "name" : value},
dataType : "json",
type : "get",
success : function(data){
if( data.success == true ){
loader.removeClass("error");
}else{
loader.addClass("error");
}
loader.text(data.result);
}
})
}
loader.text("Checking...")
checkAvailability();
});
$('input[type="email"]').blur(function(){
var type = $(this).attr("id"), var type = $(this).attr("id"),
loader = $(this).parent().find('.loader'), loader = $(this).parent().find('.loader'),
elem = $(this), elem = $(this),
value = $(this).val() || null; value = $(this).val() || null;
var checkAvailability = function(){ var checkAvailability = function(){
$.ajax({ $.ajax({
url : "<%= "#{prefix_url}?method=check_availability&no=#{@seminar.id}" %>", url : "<%= "/xhr/seminars/check_email/#{@seminar.id}" %>",
data : {"type" : type, "value" : value}, data : {"type" : type, "email" : value},
dataType : "json", dataType : "json",
type : "get", type : "get",
success : function(data){ success : function(data){
if( data.success == true ){ if( data.success == true ){
loader.removeClass("error");
alert("1tttt");
}else{ }else{
loader.addClass("error");
alert("1ssss2");
} }
loader.text(data.result);
} }
}) });
} };
if( value ){ if( value ){
if (!this.checkValidity()){
loader.addClass("error");
loader.text("<%= t("seminar.email_hint") %>");
return;
}else{
loader.removeClass("error");
loader.text("");
}
if(type == "seminar_signup_email"){ if(type == "seminar_signup_email"){
loader.text("Checking...")
checkAvailability(); checkAvailability();
} }
} }
});
$(".upload").on("change",function(){
let filenamedom = $(this).parent().parent().find(".filename");
let filenameA = $(this).val().split('\\');
filenamedom.text(filenameA[filenameA.length - 1]);
}) })
$("#optional label").each(function(){
if($(this).hasClass("control-label")){
$(this).text("*" + $(this).text());
}
})
// $("#seminar_signup_values_3_value").removeAttr("placeholder");
let currentGroup = 1 + $("#new-seminar-signup div[id^=group]:visible").length;
function showGroup($group){
$group.show();
$group.find('.fake-clean-file').remove();
$group.find('input,textarea').attr("required", true);
}
function hideGroup($group){
$group.hide();
$group.find("input[type!=hidden], textarea").val("");
$.each($group.find("input[type=file]"), function(k, v) {
$(v).after("<input class=\"fake-clean-file\" type=\"hidden\" name=\""+$(v).attr('name')+"\" value=\"\">");
});
$group.find('input,textarea').attr("required", false);
}
if (currentGroup > 1){
$("#remove-member").show();
for (var i = 1; i < currentGroup; i++){
showGroup($("#group" + i));
}
}
$("#add-member").on("click",function () {
if(currentGroup < 5){
$("#remove-member").show();
currentGroup++;
if(currentGroup == 5){
$(this).hide();
}
}
showGroup($("#group" + currentGroup));
return false;
})
$("#remove-member").on("click",function () {
$("#add-member").show();
if(currentGroup > 0){
hideGroup($("#group" + currentGroup));
currentGroup--;
if(currentGroup == 1){
$(this).hide();
}
}
return false;
})
})(); })();
</script> </script>

View File

@ -8,7 +8,8 @@
end end
%> %>
<%= t('seminar_signup.success_message') %> <%#= t('seminar_signup.success_message') %>
<%= data["message"].html_safe %>
<br> <br>
<%=t('seminar_signup.serial_number') %>: <%=data["serial_number"] rescue ""%> <%=t('seminar_signup.serial_number') %>: <%=data["serial_number"] rescue ""%>
<% if !params['status'].nil? %> <% if !params['status'].nil? %>

View File

@ -45,3 +45,11 @@ markups:
ext_support: false ext_support: false
panel: typeF panel: typeF
display_only: seminar_submission_field display_only: seminar_submission_field
email:
panel: typeA
phone:
panel: typeA
instructions:
muti_lang_input_supprt: false
ext_support: false
panel: typeG

View File

@ -6,6 +6,10 @@ en:
lists: lists:
markups: markups:
seminar_preferred_session: Preferred Session seminar_preferred_session: Preferred Session
email: Email
phone: Phone
instructions: Instructions
restful_actions: restful_actions:
edit_seminar_review: Review edit_seminar_review: Review
copy: Copy copy: Copy
@ -27,6 +31,12 @@ en:
abstract_number: Abstract number abstract_number: Abstract number
presentation_type: Presentation presentation_type: Presentation
seminar: seminar:
repeat_hint: Input text must unique!
phone_hint: "Can only include number, +, -, and ()!(length: 10~13)"
email_hint: Email is not complete!
text_area_hint: Limit 300 characters
file_limit_hint: File Size cannot larger than 20MB!
file_format_hint: only support .pdf, .png, .jpg, .odf extensions!
signup_limit: Signup Limit signup_limit: Signup Limit
participant_list: Participant list participant_list: Participant list
back: Back back: Back
@ -86,7 +96,7 @@ en:
dashboard: Dashboard dashboard: Dashboard
display_field: Display field display_field: Display field
note: Note note: Note
email_exist: "Email exist!" email_email_or_name_existexist: "Email or name exist!"
email_signup_success: Signup success email_signup_success: Signup success
email_submission_success: Submission registration success email_submission_success: Submission registration success
email_add_file_success: Add file success email_add_file_success: Add file success
@ -102,6 +112,20 @@ en:
email_edit_file: Edit file email_edit_file: Edit file
email_add_file: Add file email_add_file: Add file
auto_send_email_set: Auto send email setting auto_send_email_set: Auto send email setting
email_forgot_password: Forgot Password
email_special_reminder: Special Reminder
special_reminder: Special Reminder
email_reset_password_content: Forgot Password
email_reset_password_success: Forgot Password
email_special_reminder_content: Special Reminder
email_special_reminder_success: Special Reminder
is_confirmation: Confirmation Email
select_email_type: Select Email Type
send_email_button: Send email
click_here_to_confirm: Please click this link / 請點選此連結
confirm_ok: Email confirmed
confirm_not_ok: Email cannot be confirmed
validator: Validator
click_to_contribute: Click here to contribute click_to_contribute: Click here to contribute
required: Required required: Required
already_used: Already Used already_used: Already Used
@ -119,7 +143,6 @@ en:
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 #審查開始日期
review: Reveiw #審稿
blank_no_limit: Allow Blank Value #空白無限制 blank_no_limit: Allow Blank Value #空白無限制
export_csv: Export CSV #匯出CSV export_csv: Export CSV #匯出CSV
recaptcha: Recaptcha #驗證碼 recaptcha: Recaptcha #驗證碼
@ -158,6 +181,8 @@ en:
sign_up_is_full: "Sign up is FULL!" sign_up_is_full: "Sign up is FULL!"
sign_up_failed: "Sign up failed!" sign_up_failed: "Sign up failed!"
contribute_file_count: Count of Contribute Files #投稿檔案數 contribute_file_count: Count of Contribute Files #投稿檔案數
seminar_signup_success: Signup Success Message
reset_password: Reset Password
frontend: frontend:
seminar: Semianr #研討會前台 seminar: Semianr #研討會前台
@ -190,12 +215,12 @@ en:
note: Note #註解 note: Note #註解
time: 'Start / End Time' #(開始/結束)時間 time: 'Start / End Time' #(開始/結束)時間
place: Place #地點 place: Place #地點
agree: "Accept Privacy and Personal Information Protection Policy of the Site" agree: "I agree with all terms"
privacy_statement: 'Privacy and Personal Information Protection Policy of the Site' privacy_statement: 'Privacy and Personal Information Protection Policy of the Site'
recaptcha: Verification code recaptcha: Verification code
signup_field: Sign Up Field #圈選項目 signup_field: Sign Up Field #圈選項目
uploads: Uploads #上傳檔案 uploads: Uploads #上傳檔案
con_login: Submission #投稿者登入 con_login: Login #投稿者登入
file_name: File Name #稿件名稱 file_name: File Name #稿件名稱
file_note: Summary #摘要 file_note: Summary #摘要
files: Files #檔案 files: Files #檔案
@ -213,3 +238,31 @@ en:
checkbox: Multiple choice checkbox: Multiple choice
radio: Single choice radio: Single choice
choices: Choices choices: Choices
forgot_password: Set Password
reset_email_sent: Reset Email Sent
login_failed: Login Failed
email_not_found: Email not found
reset: Reset
email_reset_password_success: Password reset
click_on_link: Please click on the link below to reset your password
confirm_password: Confirm Password
password_mismatch: Password mismatch
password_changed: Password changed successfully
password_changed_not_ok: There was an error changing password
password_check: Must contain at least one number and one uppercase and lowercase letter, and at least 8 or more characters
email_check: Invalid email format
is_confirmed: Email Confirmed
signup_confirmed: Signup Confirmed
registration_complete: Registration Complete
email_confirmed: Email Confirmed
email_not_confirmed: Email not confirmed
signup_not_confirmed: Signup not confirmed
send_email: Send Email
edit_form: Edit Form
emails_already_sent: Emails Already Sent
is_confirmed_date: Email confirmed time
signup_confirmed_date: Signup confirmed time
add_member: Add Member
remove_member: Remove Member
send_email_text: Additional text to send
predefined_text: Predifined email text

View File

@ -6,6 +6,9 @@ zh_tw:
lists: lists:
markups: markups:
seminar_preferred_session: Preferred Session seminar_preferred_session: Preferred Session
email: 電子信箱
phone: 電話
instructions: "說明文字 Instructions"
restful_actions: restful_actions:
edit_seminar_review: 審查 edit_seminar_review: 審查
@ -28,6 +31,12 @@ zh_tw:
abstract_number: 摘要編號 abstract_number: 摘要編號
presentation_type: 發表方式 presentation_type: 發表方式
seminar: seminar:
repeat_hint: 輸入內容不能重複
phone_hint: "僅可輸入數字及+ - ()長度限制10~13"
email_hint: Email信箱不完整
text_area_hint: 字數最多只能300個字
file_limit_hint: 檔案不能超過20MB!
file_format_hint: 只能上傳.pdf, .png, .jpg, .odf格式
signup_limit: 報名限制人數 signup_limit: 報名限制人數
participant_list: 參加者名單 participant_list: 參加者名單
back: 回上一頁 back: 回上一頁
@ -87,7 +96,7 @@ zh_tw:
dashboard: 儀錶板 dashboard: 儀錶板
display_field: 顯示的欄位 display_field: 顯示的欄位
note: 附註 note: 附註
email_exist: "email已存在!" email_or_name_exist: 隊名或Email已存在
email_signup_success: 報名成功 email_signup_success: 報名成功
email_submission_success: 投稿註冊成功 email_submission_success: 投稿註冊成功
email_add_file_success: 新增上傳成功 email_add_file_success: 新增上傳成功
@ -103,6 +112,20 @@ zh_tw:
email_edit_file: 編輯上傳 email_edit_file: 編輯上傳
email_add_file: 新增上傳 email_add_file: 新增上傳
auto_send_email_set: 自動發信設定 auto_send_email_set: 自動發信設定
email_forgot_password: 忘記密碼
email_special_reminder: 特殊通知
special_reminder: 特殊通知
email_reset_password_content: 忘記密碼
email_reset_password_success: 忘記密碼
email_special_reminder_content: 特殊通知
email_special_reminder_success: 特殊通知
is_confirmation: 認證Email
click_here_to_confirm: Please click this link / 請點選此連結
confirm_ok: 認證通過
confirm_not_ok: 連結已失效
select_email_type: 選擇Email種類
send_email_button: 寄送Email
validator: 驗證
click_to_contribute: 按此登入投稿 click_to_contribute: 按此登入投稿
required: '必填, necessary' required: '必填, necessary'
already_used: 已存在 already_used: 已存在
@ -120,7 +143,6 @@ zh_tw:
reviewer: 審查委員 reviewer: 審查委員
review_end_date: 審查結束日期 review_end_date: 審查結束日期
review_start_date: 審查開始日期 review_start_date: 審查開始日期
review: 審稿
blank_no_limit: 空白無限制 blank_no_limit: 空白無限制
export_csv: 匯出CSV export_csv: 匯出CSV
recaptcha: 驗證碼 recaptcha: 驗證碼
@ -159,6 +181,8 @@ zh_tw:
sign_up_is_full: "報名已額滿!" sign_up_is_full: "報名已額滿!"
sign_up_failed: "報名失敗" sign_up_failed: "報名失敗"
contribute_file_count: 投稿檔案數 contribute_file_count: 投稿檔案數
seminar_signup_success: 送出註冊表單訊息頁
reset_password: 設定密碼
frontend: frontend:
seminar: 研討會前台 seminar: 研討會前台
@ -191,26 +215,53 @@ zh_tw:
note: 註解 note: 註解
time: (開始/結束)時間 time: (開始/結束)時間
place: 地點 place: 地點
agree: 同意接受本站個資及隱私權保護宣告(Agree upon personal data protection declaration of this web) agree: 已確認閱讀相關條款
privacy_statement: '個資及隱私權保護宣告' privacy_statement: '個資及隱私權保護宣告'
recaptcha: 驗證碼 recaptcha: 驗證碼
signup_field: 圈選項目 signup_field: 圈選項目
uploads: 上傳檔案 uploads: 上傳檔案
con_login: Submission con_login: 登入
file_name: 稿件名稱 file_name: 稿件名稱
file_note: 摘要 file_note: 摘要
files: 檔案 files: 檔案
logout: Logout logout: 登出
logouting: 登出中 logouting: 登出中
success_message: '您的報名已成功,感謝您的參與。' success_message: '您的報名已成功,感謝您的參與。'
email_address: Email address email_address: Email位址
_password: Password _password: 密碼
login: Login login: 登入
new_: '新增(load abstract)' new_: '新增(upload abstract)'
load_file: load file load_file: 上傳檔案
enable_summary_choice: 開啟摘要選項 enable_summary_choice: 開啟摘要選項
summary_choice_type: 摘要選項類型 summary_choice_type: 摘要選項類型
select: 下拉選單 select: 下拉選單
checkbox: 多選 checkbox: 多選
radio: 單選 radio: 單選
choices: 選項 choices: 選項
forgot_password: 設定密碼
reset_email_sent: 重設密碼Email已送出
login_failed: 登入失敗
email_not_found: 找不到Email
reset: 重設
click_on_link: 請點選下方連結後重設密碼。
confirm_password: 確認密碼
password_mismatch: 密碼不正確
password_changed: 密碼更新成功
password_changed_not_ok: 更新密碼時發生錯誤
password_check: 至少須包含數字及大小寫英文字母共8碼
email_check: 不正確的Email格式
is_confirmed: Email已確認
signup_confirmed: 註冊已查核確認
registration_complete: 註冊程序完成
email_confirmed: Email已確認
email_not_confirmed: Email尚未確認
signup_not_confirmed: 註冊尚未查核確認
send_email: 寄送Email
edit_form: 編輯註冊表單
emails_already_sent: 已寄送Email
add_member: 增加組員
remove_member: 移除組員
is_confirmed_date: Email認證時間
signup_confirmed_date: 註冊查核確認時間
send_email_text: 附加額外文字內容
predefined_text: 預設郵件內容

View File

@ -64,6 +64,8 @@ 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_signup_success'
patch 'seminar_signup_success_save'
get 'seminar_submission_field' get 'seminar_submission_field'
get 'seminar_signup_admin_setting' get 'seminar_signup_admin_setting'
post 'update_seminar_signup_admin_setting' post 'update_seminar_signup_admin_setting'
@ -81,6 +83,10 @@ Rails.application.routes.draw do
patch 'update_template_setting' patch 'update_template_setting'
get 'sub_page_setting' get 'sub_page_setting'
end end
collection do
post "send_notifying_email"
get "get_predefined_text"
end
end end
get 'seminar/enquiry_for_applicants' => "seminars#enquiry_for_applicants" get 'seminar/enquiry_for_applicants' => "seminars#enquiry_for_applicants"
post 'seminar/update_seminar_review' => "seminars#update_seminar_review" post 'seminar/update_seminar_review' => "seminars#update_seminar_review"
@ -101,12 +107,16 @@ Rails.application.routes.draw do
get ':slug_title-:uid', to: 'seminars#show' get ':slug_title-:uid', to: 'seminars#show'
post 'con_login_proc', to: 'seminars#con_login_proc' post 'con_login_proc', to: 'seminars#con_login_proc'
post 'con_logout_proc', to: 'seminars#con_logout_proc' post 'con_logout_proc', to: 'seminars#con_logout_proc'
post 'reset_password_proc', to: 'seminars#reset_password_proc'
post 'reset_confirm_password_proc', to: 'seminars#reset_confirm_password_proc'
post 'add_file_proc', to: 'seminars#add_file_proc' post 'add_file_proc', to: 'seminars#add_file_proc'
post 'edit_file_proc', to: 'seminars#edit_file_proc' post 'edit_file_proc', to: 'seminars#edit_file_proc'
post 'del_file', to: 'seminars#del_file' post 'del_file', to: 'seminars#del_file'
patch 'update_signup_form', to: 'seminars#update_signup_form'
end end
end end
get "/xhr/seminars/check_email/:no" => "seminars#check_email"
get "/xhr/seminars/check_name/:no" => "seminars#check_name"
end end
end end

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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