Compare commits

..

19 Commits

Author SHA1 Message Date
chiu 8addfd0631 Merge pull request 'Hide empty time field.' (#21) from 123/seminar:master into master
Reviewed-on: https://gitlab.tp.rulingcom.com/spen/seminar/pulls/21
2024-04-15 16:26:46 +00:00
邱博亞 496dc1181f Hide empty time field. 2024-04-16 00:25:55 +08:00
chiu d62248c9e0 Merge pull request 'Add hidden class when sign_up_not_yet.' (#20) from 123/seminar:master into master
Reviewed-on: https://gitlab.tp.rulingcom.com/spen/seminar/pulls/20
2024-04-15 16:13:37 +00:00
邱博亞 5a31d2c709 Add hidden class when sign_up_not_yet. 2024-04-16 00:10:12 +08:00
邱博亞 aadc929ae0 Merge pull request 'Add hidden class when sign_up_overdue.' (#19) from 123/seminar:master into master
Reviewed-on: https://gitlab.tp.rulingcom.com/spen/seminar/pulls/19
2024-04-15 23:58:58 +08:00
邱博亞 f05280d97d Add hidden class when sign_up_overdue. 2024-04-15 23:57:48 +08:00
chiu be3af16a12 Merge pull request 'master' (#18) from 123/seminar:master into master
Reviewed-on: https://gitlab.tp.rulingcom.com/spen/seminar/pulls/18
2024-04-09 13:06:06 +00:00
邱博亞 382df44068 fix error after update carrierwave 2024-04-09 12:57:03 +08:00
邱博亞 e4790f8490 Fix bug. 2024-03-21 22:26:05 +08:00
邱博亞 cb7cad9c74 Fix bug. 2024-03-21 22:24:39 +08:00
邱博亞 8b9bfaab8d Fix bug. 2024-03-21 22:20:27 +08:00
邱博亞 52755f9afe sync codes from 123/seminar. 2024-03-21 21:57:22 +08:00
chiu 397046e9b4 Merge pull request 'Add instructions field.' (#17) from 123/seminar:master into master
Reviewed-on: https://gitlab.tp.rulingcom.com/spen/seminar/pulls/17
2024-02-28 08:38:54 +00:00
邱博亞 ca4a2f86f2 Add instructions field. 2024-02-28 16:31:31 +08:00
chiu a934972e72 Merge pull request 'master' (#16) from 123/seminar:master into master
Reviewed-on: https://gitlab.tp.rulingcom.com/spen/seminar/pulls/16
2024-02-28 07:00:37 +00:00
邱博亞 1e52c3bf91 Fix bug. 2024-02-28 14:17:06 +08:00
邱博亞 d6b2d23462 Add instructions field. 2024-02-28 14:17:06 +08:00
邱博亞 40831d3b8c Fix indent. 2024-02-28 14:17:06 +08:00
邱博亞 1ae15033a8 Prepare to support ruby 3.3. 2024-02-24 21:22:45 +08:00
33 changed files with 657 additions and 719 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

@ -556,13 +556,6 @@ class Admin::SeminarsController < OrbitAdminController
render action: :edit and return render action: :edit and return
end end
end end
Rails.logger.info "&&&&&&&&&&&&&&"
if @seminar_params[:seminar_email_sets_attributes]
Rails.logger.info "*********************"
Rails.logger.info @seminar_params[:seminar_email_sets_attributes]
@seminar.update_attributes(@seminar_params[:seminar_email_sets_attributes])
flash.now[:notice] = "Updated Fields"
end
end end
redirect_to admin_seminars_path redirect_to admin_seminars_path
end end

View File

@ -8,13 +8,13 @@ class SeminarsController < ApplicationController
def index def index
time_now = Time.now time_now = Time.now
seminars = SeminarMain.all.desc(:seminar_start_date).filter_by_categories seminars = SeminarMain.all.desc(:seminar_start_date).filter_by_categories
{ {
"seminars" => seminars, "seminars" => seminars,
'time_now' => time_now, 'time_now' => time_now,
"total_pages" => seminars.total_pages "total_pages" => seminars.total_pages
} }
end end
def widget def widget
@ -85,7 +85,7 @@ class SeminarsController < ApplicationController
prefix_url = OrbitHelper.request.path.split("-").first + "-#{params[:uid]}" prefix_url = OrbitHelper.request.path.split("-").first + "-#{params[:uid]}"
@prefix_url = prefix_url @prefix_url = prefix_url
@registration_postfix = "/home/registration" @registration_postfix = "/home/registration"
header_data = "<a href=\"#{prefix_url}#{home_page.url}\">Home</a> | " + header_data = "<a href=\"#{prefix_url}#{home_page.url}\">Home</a> | " +
"<a href=\"/\">Main Site</a>" "<a href=\"/\">Main Site</a>"
content_style = seminar_template_setting.content_style content_style = seminar_template_setting.content_style
background_style = seminar_template_setting.background_style background_style = seminar_template_setting.background_style
@ -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!(/&+$/,'') #rescue nil 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
@ -334,6 +334,7 @@ class SeminarsController < ApplicationController
seminar_url = (@prefix_url ? @prefix_url : OrbitHelper.url_to_show(seminar.to_param)) seminar_url = (@prefix_url ? @prefix_url : OrbitHelper.url_to_show(seminar.to_param))
if !registration_is_open if !registration_is_open
sign_up = t('seminar.sign_up_not_open') sign_up = t('seminar.sign_up_not_open')
sign_up_not_yet = true
elsif sign_up_not_yet elsif sign_up_not_yet
sign_up = t('seminar.sign_up_not_yet') sign_up = t('seminar.sign_up_not_yet')
elsif sign_up_overdue elsif sign_up_overdue
@ -345,7 +346,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)
@ -360,6 +361,7 @@ class SeminarsController < ApplicationController
'sign_up' => sign_up, 'sign_up' => sign_up,
'contribute_action' => contribute_action, 'contribute_action' => contribute_action,
'time_now' => time_now, 'time_now' => time_now,
'sign_up_not_yet' => sign_up_not_yet,
'contribute_time_range' => SeminarMain.time_range(seminar.contribute_start_date, seminar.contribute_end_date), 'contribute_time_range' => SeminarMain.time_range(seminar.contribute_start_date, seminar.contribute_end_date),
'sign_up_time_range' => SeminarMain.time_range(seminar.signup_start_date, seminar.signup_end_date), 'sign_up_time_range' => SeminarMain.time_range(seminar.signup_start_date, seminar.signup_end_date),
'seminar_time_range' => SeminarMain.time_range(seminar.seminar_start_date, seminar.seminar_end_date) 'seminar_time_range' => SeminarMain.time_range(seminar.seminar_start_date, seminar.seminar_end_date)
@ -391,18 +393,18 @@ 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')
success = count > 0 ? false : true else
result = t('seminar.please_enter_email')
end end
render :json => { {
"result" => result, "result" => result
"success" => success }
}.to_json
end end
@ -522,20 +524,24 @@ class SeminarsController < ApplicationController
def add_file_proc def add_file_proc
update_params = seminar_signup_contribute_params.merge('seminar_submission_values'=>params['seminar_submission_values']) 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'].class==String if update_params['seminar_submission_values']['0']['value'].nil?
value = update_params['seminar_submission_values']['0']['value'] flag = false
if !value.to_s.blank?
flag = false
end
else else
update_params['seminar_submission_values']['0']['value'].each do |key,value| if update_params['seminar_submission_values']['0']['value'].class==String
if !value.to_s.blank? value = update_params['seminar_submission_values']['0']['value']
if !value.to_s.blank?
flag = false flag = false
end end
else
update_params['seminar_submission_values']['0']['value'].each do |key,value|
if !value.to_s.blank?
flag = false
end
end
end end
end end
else else
@ -574,20 +580,24 @@ 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?
flag = true if update_params['seminar_submission_values']['0']['value'].nil?
if update_params['seminar_submission_values']['0']['value'].class==String flag = false
value = update_params['seminar_submission_values']['0']['value']
if !value.to_s.blank?
flag = false
end
else else
update_params['seminar_submission_values']['0']['value'].each do |key,value| flag = true
if !value.to_s.blank? if update_params['seminar_submission_values']['0']['value'].class==String
value = update_params['seminar_submission_values']['0']['value']
if !value.to_s.blank?
flag = false flag = false
end end
else
update_params['seminar_submission_values']['0']['value'].each do |key,value|
if !value.to_s.blank?
flag = false
end
end
end end
end end
if flag if flag
@ -733,12 +743,6 @@ class SeminarsController < ApplicationController
end end
def reset_email
end
def reset_password_page
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])
@ -752,43 +756,11 @@ class SeminarsController < ApplicationController
redirect_to "#{params[:referer_url].to_s.chomp('/')}/?method=con_upload" redirect_to "#{params[:referer_url].to_s.chomp('/')}/?method=con_upload"
else else
redirect_to "#{params[:referer_url].to_s.chomp('/')}/?method=con_login", :notice => t('seminar_signup.login_failed') redirect_to "#{params[:referer_url].to_s.chomp('/')}/?method=con_login", :notice => '登入失敗'
end end
end end
def reset_confirm_password_proc
seminar_signup = SeminarSignup.where(:status=>'C', :reset_token=> params[:token], :seminar_main_id => params[:seminar_signup][:seminar_main_id]).first
if !seminar_signup.blank?
params.permit!
seminar_signup.password = params[:password]
seminar_signup.reset_token = ""
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"
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_reset_token
mail = Email.create(mail_to:params[:user_name],
module_app_key:"seminar",
template:"email/reset_password_email.html.erb",
mail_sentdate:Time.current,
mail_subject: t("seminar_signup.email_reset_password_success"),
template_data:{'url'=> request.protocol + request.host_with_port + "#{params[:referer_url].to_s.chomp('/')}/?method=reset_password_page&token=#{token}",'locale'=>I18n.locale})
# mail.deliver
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
@ -816,6 +788,6 @@ class SeminarsController < ApplicationController
mail_sentdate:Time.current, mail_sentdate:Time.current,
mail_subject: email_set[0].title[I18n.locale], mail_subject: email_set[0].title[I18n.locale],
template_data:{'seminar_id'=>seminar_id,'locale'=>I18n.locale,'extra_text'=> extra_text}) template_data:{'seminar_id'=>seminar_id,'locale'=>I18n.locale,'extra_text'=> extra_text})
end end
end end
end end

View File

@ -26,7 +26,21 @@ module Admin::SeminarsFieldHelper
end end
def lang_tab(str,lang) def lang_tab(str,lang)
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
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 end
def render_address def render_address
@ -50,14 +64,14 @@ module Admin::SeminarsFieldHelper
def render_checkbox def render_checkbox
@prefiled_value ||=[] @prefiled_value ||=[]
control_group_wrapper_for_sm do control_group_wrapper_for_sm do
a = self.typeE[:option_list].collect do |key,value| a = self.typeE[:option_list].collect do |key,value|
label_tag("#{get_basic_field_name_org}_#{self.id}_#{key}",check_box_tag(get_field_name_base+"[#{key}]", true , (@prefiled_value.include?(key) ? true : false), { :id=>"#{get_basic_field_name_org}_#{self.id}_#{key}"})+value[I18n.locale.to_s],@markup_options.merge(:class=>"checkbox inline")) label_tag("#{get_basic_field_name_org}_#{self.id}_#{key}",check_box_tag(get_field_name_base+"[#{key}]", true , (@prefiled_value.include?(key) ? true : false), { :id=>"#{get_basic_field_name_org}_#{self.id}_#{key}"})+value[I18n.locale.to_s],@markup_options.merge(:class=>"checkbox inline"))
end.join.html_safe rescue "" end.join.html_safe rescue ""
end end
end end
def render_date def render_date
d = DateTime.now() d = DateTime.now()
if date_is_range? if date_is_range?
@ -81,13 +95,13 @@ module Admin::SeminarsFieldHelper
when 'format3' when 'format3'
fill_from = (@prefiled_value && @prefiled_value["from"] ) ? @prefiled_value["from"] : d.strftime("%Y/%m") fill_from = (@prefiled_value && @prefiled_value["from"] ) ? @prefiled_value["from"] : d.strftime("%Y/%m")
fill_to = (@prefiled_value && @prefiled_value["to"] ) ? @prefiled_value["to"] : d.strftime("%Y/%m/") fill_to = (@prefiled_value && @prefiled_value["to"] ) ? @prefiled_value["to"] : d.strftime("%Y/%m/")
buf = datetime_picker(get_field_name_base+'[from]', fill_from, 'yyyy/MM') buf = datetime_picker(get_field_name_base+'[from]', fill_from, 'yyyy/MM')
buf << ' ~ ' buf << ' ~ '
buf << datetime_picker(get_field_name_base+'[to]', fill_to, 'yyyy/MM') buf << datetime_picker(get_field_name_base+'[to]', fill_to, 'yyyy/MM')
when 'format4' when 'format4'
fill_from = (@prefiled_value && @prefiled_value["from"] ) ? @prefiled_value["from"] : d.strftime("%Y") fill_from = (@prefiled_value && @prefiled_value["from"] ) ? @prefiled_value["from"] : d.strftime("%Y")
fill_to = (@prefiled_value && @prefiled_value["to"] ) ? @prefiled_value["to"] : d.strftime("%Y") fill_to = (@prefiled_value && @prefiled_value["to"] ) ? @prefiled_value["to"] : d.strftime("%Y")
buf = datetime_picker(get_field_name_base+'[from]', fill_from, 'yyyy') buf = datetime_picker(get_field_name_base+'[from]', fill_from, 'yyyy')
buf << ' ~ ' buf << ' ~ '
buf << datetime_picker(get_field_name_base+'[to]', fill_to, 'yyyy') buf << datetime_picker(get_field_name_base+'[to]', fill_to, 'yyyy')
end end
@ -107,13 +121,13 @@ module Admin::SeminarsFieldHelper
when 'format2' when 'format2'
tmp = datetime_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y/%m/%d")), 'yyyy/MM/dd') tmp = datetime_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y/%m/%d")), 'yyyy/MM/dd')
when 'format3' when 'format3'
tmp = datetime_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y/%m")), 'yyyy/MM') tmp = datetime_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y/%m")), 'yyyy/MM')
when 'format4' when 'format4'
tmp = datetime_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y")), 'yyyy') tmp = datetime_picker(get_field_name_base, (@prefiled_value ? @prefiled_value : d.strftime("%Y")), 'yyyy')
end end
control_group_wrapper_for_sm{tmp} control_group_wrapper_for_sm{tmp}
# control_group_wrapper_for_sm{date_select(get_field_name_base,nil,@markup_options.merge(:default=>@prefiled_value),:class=>"input-small")} # control_group_wrapper_for_sm{date_select(get_field_name_base,nil,@markup_options.merge(:default=>@prefiled_value),:class=>"input-small")}
end end
end end
@ -131,7 +145,7 @@ module Admin::SeminarsFieldHelper
end end
def render_date_durnation #Need re-write low priority def render_date_durnation #Need re-write low priority
end end
def render_radio_button def render_radio_button
@ -179,7 +193,7 @@ module Admin::SeminarsFieldHelper
place_holder= typeA["placeholder"][key_field] rescue '' place_holder= typeA["placeholder"][key_field] rescue ''
name1 = can_muti_lang_input_for_sm? ? ([get_field_name_base,add_more_blank,"[#{key_field}]"].join) : ([get_field_name_base,add_more_blank].join) name1 = can_muti_lang_input_for_sm? ? ([get_field_name_base,add_more_blank,"[#{key_field}]"].join) : ([get_field_name_base,add_more_blank].join)
text_field_tag(name1, value, @markup_options.merge(:placeholder=>place_holder,:class=>'input-medium form-control')) text_field_tag(name1, value, @markup_options.merge(:placeholder=>place_holder,:class=>'input-medium form-control'))
end end
end end
def render_file_field def render_file_field
@ -199,9 +213,9 @@ module Admin::SeminarsFieldHelper
is_range = "false" is_range = "false"
data = get_data data = get_data
if !data.nil? if !data.nil?
is_range = data['is_range'] if data.has_key? "is_range" is_range = data['is_range'] if data.has_key? "is_range"
end end
is_range == "true" is_range == "true"
end end
protected protected
@ -239,7 +253,7 @@ protected
div_class << (key == I18n.locale ? " active in" : '') div_class << (key == I18n.locale ? " active in" : '')
content_tag(:div,yield(key,value), :id=>div_id,:class=>div_class) content_tag(:div,yield(key,value), :id=>div_id,:class=>div_class)
end# of VALID_LOCALES.collect for tabed input end# of VALID_LOCALES.collect for tabed input
tmp2 = content_tag(:div,:class => 'btn-group', :data=>{:toggle=>"buttons-radio"}) do tmp2 = content_tag(:div,:class => 'btn-group', :data=>{:toggle=>"buttons-radio"}) do
buff2 = valid_locales.each.collect do |key| buff2 = valid_locales.each.collect do |key|
# link_entry = self.add_more ? "#{add_more_tab(:tab_btn,loop_counter,key)}" : "#tab"+id.to_s+"_#{key}" # link_entry = self.add_more ? "#{add_more_tab(:tab_btn,loop_counter,key)}" : "#tab"+id.to_s+"_#{key}"
if @show_set_field_for_sm && @markup=='text_area' if @show_set_field_for_sm && @markup=='text_area'
@ -262,7 +276,7 @@ protected
else else
# tmp = content_tag :div,:class=> (add_more || self.markup=='address') ? "input-append" : "tab-content" do # tmp = content_tag :div,:class=> (add_more || self.markup=='address') ? "input-append" : "tab-content" do
tmp1 = tmp1 =
content_tag :div,:class=> "tab-content" do content_tag :div,:class=> "tab-content" do
buff = valid_locales.collect do |key| buff = valid_locales.collect do |key|
@ -289,7 +303,7 @@ protected
end end
tmp2 = content_tag(:div,:class => 'btn-group', :data=>{:toggle=>"buttons-radio"}) do tmp2 = content_tag(:div,:class => 'btn-group', :data=>{:toggle=>"buttons-radio"}) do
buff2 = valid_locales.each.collect do |key| buff2 = valid_locales.each.collect do |key|
# link_entry = self.add_more ? "#{add_more_tab(:tab_btn,loop_counter,key)}" : "#tab"+id.to_s+"_#{key}" # link_entry = self.add_more ? "#{add_more_tab(:tab_btn,loop_counter,key)}" : "#tab"+id.to_s+"_#{key}"
link_entry_ary = ["##{get_pairing_tab_class({})}","_#{key}"] link_entry_ary = ["##{get_pairing_tab_class({})}","_#{key}"]
@ -304,7 +318,7 @@ protected
end # of content ul end # of content ul
tmp = content_tag :div,:class=> "input-append" do tmp = content_tag :div,:class=> "input-append" do
tmp1 << tmp2 tmp1 << tmp2
end end
@ -319,8 +333,8 @@ protected
add_more_counter = "" add_more_counter = ""
if can_add_more if can_add_more
add_more_counter = add_more_params[0][:counter] add_more_counter = add_more_params[0][:counter]
add_more_value = add_more_params[0][:value] add_more_value = add_more_params[0][:value]
end end
if can_muti_lang_input_for_sm? if can_muti_lang_input_for_sm?
@ -330,7 +344,7 @@ protected
else #cross lang field else #cross lang field
case can_add_more case can_add_more
when true when true
value = add_more_params[0][:value] value = add_more_params[0][:value]
result << content_tag(:div,:class=>"input-append"){yield(nil,value) + link_to((content_tag :i,'',:class=>'icon-trash'),"#",:class=>"btn remove-input") } result << content_tag(:div,:class=>"input-append"){yield(nil,value) + link_to((content_tag :i,'',:class=>'icon-trash'),"#",:class=>"btn remove-input") }
# result << add_more_unt # result << add_more_unt
else else
@ -346,7 +360,7 @@ protected
end # of def controls_wrapper_for_sm(&block) end # of def controls_wrapper_for_sm(&block)
def control_group_wrapper_for_sm(&block) def control_group_wrapper_for_sm(&block)
div_class = can_muti_lang_input_for_sm? ? "col-sm-10 controls" : "col-sm-10 controls" div_class = can_muti_lang_input_for_sm? ? "col-sm-10 controls" : "col-sm-10 controls"
# div_class = can_muti_lang_input_for_sm? ? "control-group language-swich" : "control-group" # div_class = can_muti_lang_input_for_sm? ? "control-group language-swich" : "control-group"
result = "" result = ""
@ -357,7 +371,7 @@ protected
if can_add_more if can_add_more
multipleInputs = multipleInputs =
content_tag(:div,:class=>"add-target") do content_tag(:div,:class=>"add-target") do
@attribute_value.add_more_counter.times.collect do |t| @attribute_value.add_more_counter.times.collect do |t|
controls_wrapper_for_sm(:value=>(@prefiled_value[t] rescue nil),:counter=>t,&block) controls_wrapper_for_sm(:value=>(@prefiled_value[t] rescue nil),:counter=>t,&block)
@ -366,8 +380,8 @@ protected
temp = content_tag(:div, multipleInputs + add_more_unt, :class=>'add-input') temp = content_tag(:div, multipleInputs + add_more_unt, :class=>'add-input')
result = form_label + content_tag(:div,temp,:class=>div_class) result = form_label + content_tag(:div,temp,:class=>div_class)
# result = label + multipleInputs + add_more_unt # result = label + multipleInputs + add_more_unt
# result = label + 一堆的輸入框(要用 multipleInput editMore 包起來) + add_more btn + hidden_fields # result = label + 一堆的輸入框(要用 multipleInput editMore 包起來) + add_more btn + hidden_fields
@ -385,7 +399,7 @@ protected
result = address result = address
else else
result = form_label + content_tag(:div, controls_wrapper_for_sm(&block),:class=>div_class, :id => "yessss") result = form_label + content_tag(:div,controls_wrapper_for_sm(&block),:class=>div_class)
end end
result = result + end_block result = result + end_block
result.html_safe result.html_safe
@ -393,7 +407,7 @@ protected
end end
def add_more_unt def add_more_unt
temp_field_name = get_basic_field_name_base + '[temp]' temp_field_name = get_basic_field_name_base + '[temp]'
add_more = content_tag :p,:class=> 'add-btn' do add_more = content_tag :p,:class=> 'add-btn' do
content = link_to (content_tag :i,I18n.t(:add),:class=>"icon-plus"),"#","data-roles"=>"role_a",:class=>"trigger #{can_muti_lang_input_for_sm? ? 'textLengInput' : 'textInput' } btn btn-small btn-primary" content = link_to (content_tag :i,I18n.t(:add),:class=>"icon-plus"),"#","data-roles"=>"role_a",:class=>"trigger #{can_muti_lang_input_for_sm? ? 'textLengInput' : 'textInput' } btn btn-small btn-primary"
@ -432,7 +446,7 @@ protected
prefix = opts[:prefix] prefix = opts[:prefix]
suffix = opts[:suffix] suffix = opts[:suffix]
str = get_basic_field_name_base.gsub("[","_").gsub("]",'') str = get_basic_field_name_base.gsub("[","_").gsub("]",'')
str = prefix.nil? ? str : prefix+ str str = prefix.nil? ? str : prefix+ str
suffix.nil? ? str : str + suffix suffix.nil? ? str : str + suffix
end end
@ -471,7 +485,7 @@ protected
if self.markup == "address" if self.markup == "address"
return true return true
else else
$seminar_list[:markups][markup]["muti_lang_input_supprt"] and !(get_data["cross_lang"] == "true") $seminar_list[:markups][markup]["muti_lang_input_supprt"] and !(get_data["cross_lang"] == "true")
end end
end end
@ -533,29 +547,23 @@ protected
end end
@attribute_value = field_sets @attribute_value = field_sets
@prefiled_value = field_sets[field] @prefiled_value = field_sets[field]
add_more_blank = "" a = control_group_wrapper_for_sm do |key,value|
if markup=='text_field' add_more_blank = ""
a = control_group_wrapper_for_sm do |key,value| if markup=='text_field'
# debugger if key_field == 'seminar_email_sets'
if key_field == 'seminar_email_sets' inside = text_field_tag([get_field_name_base,"[#{key}]"].join,value,:class=>'input-medium form-control')
inside = text_field_tag([get_field_name_base,"[#{key}]"].join,value,:class=>'input-medium form-control') else
else inside = text_field_tag([get_field_name_base,"[#{key}]"].join,value)
inside = text_field_tag([get_field_name_base,"[#{key}]"].join,value)
end
inside
end end
else else
a = "<label>" + t(:en) + "</label>" inside = cktext_area("seminar_main[#{@key_field}][#{@key_index}][#{@field}]","#{key}",value:value)
a = a + cktext_area("seminar_main[#{@key_field}][#{@key_index}][#{@field}]","en",value:@prefiled_value['en'])
a = a + "<label>" + t(:zh_tw) + "</label>"
a = a + cktext_area("seminar_main[#{@key_field}][#{@key_index}][#{@field}]","zh_tw",value:@prefiled_value['zh_tw'])
end end
inside
end
@key_field = nil @key_field = nil
@key_index = nil @key_index = nil
@field = nil @field = nil
@show_set_field_for_sm = nil @show_set_field_for_sm = nil
return a.html_safe return a.html_safe
end end
end end

View File

@ -8,7 +8,6 @@ class SeminarSignup
field :sort_number , type: Integer, default: 10000 field :sort_number , type: Integer, default: 10000
field :status field :status
field :reset_token
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
@ -27,7 +26,7 @@ class SeminarSignup
field :seminar_session_ids, type: Array, default: [] field :seminar_session_ids, type: Array, default: []
has_many :seminar_signup_values, :autosave => true, :dependent => :destroy has_many :seminar_signup_values, :autosave => true, :dependent => :destroy
has_many :seminar_signup_contributes, :autosave => true, :dependent => :destroy has_many :seminar_signup_contributes, :autosave => true, :dependent => :destroy
accepts_nested_attributes_for :seminar_signup_values, allow_destroy: true accepts_nested_attributes_for :seminar_signup_values, allow_destroy: true
accepts_nested_attributes_for :seminar_signup_contributes, allow_destroy: true accepts_nested_attributes_for :seminar_signup_contributes, allow_destroy: true
scope :sort_ordered, ->{ order_by(:sort_number=>1,:created_at=>1) } scope :sort_ordered, ->{ order_by(:sort_number=>1,:created_at=>1) }
@ -81,13 +80,6 @@ class SeminarSignup
seminar_session.save seminar_session.save
end end
end end
def generate_reset_token
reset_token = SecureRandom.hex(5)
self.reset_token = reset_token
self.save
return reset_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

View File

@ -15,15 +15,16 @@ class SeminarSignupField
field :built_in, type: Boolean, default: false field :built_in, type: Boolean, default: false
field :disabled, type: Boolean, default: false field :disabled, type: Boolean, default: false
# field :to_delete, type: Boolean, default: false # field :to_delete, type: Boolean, default: false
field :to_require,type: Boolean, default: true field :to_require,type: Boolean, default: true
field :typeA, type: Hash, default: {cross_lang: false} field :typeA, type: Hash, default: {cross_lang: false}
field :typeB, type: Hash, default: {} field :typeB, type: Hash, default: {}
field :typeC, type: Hash, default: {calendar: "west_calendar", format: "format3"} field :typeC, type: Hash, default: {calendar: "west_calendar", format: "format3"}
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
@ -57,8 +58,8 @@ class SeminarSignupField
def option_list def option_list
if self_defined_markup_options? if self_defined_markup_options?
#Class need to have corresponding field and value agent #Class need to have corresponding field and value agent
# Ex: For "status" the class must have field called "statuses" for the relation and "statuses_for_select" for the select function # Ex: For "status" the class must have field called "statuses" for the relation and "statuses_for_select" for the select function
method = self.seminar.method(self[:key].pluralize+"_for_"+markup) method = self.seminar.method(self[:key].pluralize+"_for_"+markup)
return (method.call rescue {}) return (method.call rescue {})
elsif self[:option_list].nil? || (self[:option_list].empty?) elsif self[:option_list].nil? || (self[:option_list].empty?)
@ -103,7 +104,7 @@ class SeminarSignupField
def is_built_in? def is_built_in?
self.built_in self.built_in
end end
def is_disabled? def is_disabled?
self.disabled self.disabled
end end
@ -131,7 +132,7 @@ class SeminarSignupField
if self[field]["cross_lang"] != var["cross_lang"] if self[field]["cross_lang"] != var["cross_lang"]
case var["cross_lang"] case var["cross_lang"]
when "true" #from no-add_more to add_more when "true" #from no-add_more to add_more
cross_lang_convert(:to_cross_lang) cross_lang_convert(:to_cross_lang)
else #from add_more to no-add_more else #from add_more to no-add_more
cross_lang_convert(:to_no_cross_lang) cross_lang_convert(:to_no_cross_lang)
end # of case end # of case
@ -142,23 +143,23 @@ class SeminarSignupField
if self["typeA"]["add_more"] != var["add_more"] if self["typeA"]["add_more"] != var["add_more"]
case var["add_more"] case var["add_more"]
when "true" #from no-add_more to add_more when "true" #from no-add_more to add_more
add_more_convert(:to_add_more) add_more_convert(:to_add_more)
else #from add_more to no-add_more else #from add_more to no-add_more
add_more_convert(:to_no_add_more) add_more_convert(:to_no_add_more)
end # of case end # of case
end # of if end # of if
end end
def cross_lang_convert(opt) def cross_lang_convert(opt)
end end
def check_option_list def check_option_list
self[:option_list] = self[panel]["option_list"] rescue nil self[:option_list] = self[panel]["option_list"] rescue nil
end end
def add_more_convert(opt) def add_more_convert(opt)
end end
end end

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

@ -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

@ -552,8 +552,6 @@
$(".summary_choice_block").css("display","none"); $(".summary_choice_block").css("display","none");
} }
}) })
// $("div#seminar_main_seminar_email_sets_attributes_0_content_en").attr('id',"div_seminar_main_seminar_email_sets_attributes_0_content_en");
// $("div#seminar_main_seminar_email_sets_attributes_0_content_zh_tw").attr('id',"div_seminar_main_seminar_email_sets_attributes_0_content_zh_tw");
}); });
</script> </script>
<% end %> <% end %>

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

@ -1,16 +1,16 @@
<% content_for :page_specific_css do -%> <% content_for :page_specific_css do -%>
<%= stylesheet_link_tag "lib/wrap-nav.css" %> <%= stylesheet_link_tag "lib/wrap-nav.css" %>
<%= stylesheet_link_tag "lib/pageslide.css" %> <%= stylesheet_link_tag "lib/pageslide.css" %>
<%= stylesheet_link_tag "lib/main-forms.css" %> <%= stylesheet_link_tag "lib/main-forms.css" %>
<%= stylesheet_link_tag "lib/togglebox.css" %> <%= stylesheet_link_tag "lib/togglebox.css" %>
<% end -%> <% end -%>
<% content_for :page_specific_javascript do -%> <% content_for :page_specific_javascript do -%>
<%= javascript_include_tag "lib/jquery.tmpl.min.js" %> <%= javascript_include_tag "lib/jquery.tmpl.min.js" %>
<%= 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 %>
@ -19,7 +19,7 @@
<fieldset> <fieldset>
<div id="attributes-area" class="input-area sortable"> <div id="attributes-area" class="input-area sortable">
<%= render partial: "attribute_field",collection: @attribute.seminar_signup_fields.asc(:sort_number, :_id)%> <%= render partial: "attribute_field", collection: @attribute.seminar_signup_fields.asc(:sort_number, :_id)%>
</div> </div>
<div class="form-actions"> <div class="form-actions">

View File

@ -1,15 +1,15 @@
<% content_for :page_specific_css do -%> <% content_for :page_specific_css do -%>
<%= stylesheet_link_tag "lib/wrap-nav.css" %> <%= stylesheet_link_tag "lib/wrap-nav.css" %>
<%= stylesheet_link_tag "lib/pageslide.css" %> <%= stylesheet_link_tag "lib/pageslide.css" %>
<%= stylesheet_link_tag "lib/main-forms.css" %> <%= stylesheet_link_tag "lib/main-forms.css" %>
<%= stylesheet_link_tag "lib/togglebox.css" %> <%= stylesheet_link_tag "lib/togglebox.css" %>
<% end -%> <% end -%>
<% content_for :page_specific_javascript do -%> <% content_for :page_specific_javascript do -%>
<%= 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

@ -1,4 +0,0 @@
<p><%= t("seminar_signup.click_on_link") %></p>
<div>
<a href="<%= @data['url'].html_safe %>" target="_blank"><%= t("seminar_signup.reset") %></a>
</div>

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,12 +39,8 @@
<%= 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>
<% end %> <% end %>
</div> </div>

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]
@ -22,12 +22,11 @@
prefix_url = OrbitHelper.url_to_show(@seminar.to_param) prefix_url = OrbitHelper.url_to_show(@seminar.to_param)
end end
%> %>
<% if (@seminar.contribute_start_date.nil? || @seminar.contribute_start_date <= @time_now) && ( @seminar.contribute_end_date.nil? || @seminar.contribute_end_date+1 >= @time_now ) %>
<% if @seminar.contribute_start_date <= @time_now and ( @seminar.contribute_end_date.nil? or @seminar.contribute_end_date+1 >= @time_now ) %>
<% begin %> <% begin %>
<% if !session[:seminar_signup_id].blank? %> <% if !session[:seminar_signup_id].blank? %>
<%=t('seminar_signup.serial_number') %>: <%=@seminar_signup.display_serial_number rescue ""%> <%=t('seminar_signup.serial_number') %>: <%=@seminar_signup.display_serial_number rescue ""%>
<a href="<%= prefix_url %>?method=con_logout&con_no=<%= @seminar.id %>" class='btn btn-primary' style="display: block; width: 150px;"><%= t('seminar_signup.logout') %></a> <a href="<%= prefix_url %>?method=con_logout&con_no=<%= @seminar.id %>" class='btn btn-primary'><%= t('seminar_signup.logout') %></a>
<table class="table table-hover table-striped seminar-index"> <table class="table table-hover table-striped seminar-index">
<caption> <caption>
@ -70,19 +69,13 @@
<td><%= description.html_safe %></td> <td><%= description.html_safe %></td>
<% end %> <% end %>
<% if show3 %> <% if show3 %>
<td> <td><%= link_to seminar_signup_contribute.disp_filename, seminar_signup_contribute.file.url, {:target => '_blank', :title => Nokogiri::HTML(description.gsub("<br>"," , ")).text, :download=>seminar_signup_contribute.disp_filename} if seminar_signup_contribute.file.file %></td>
<% if show2 %>
<%= link_to seminar_signup_contribute.disp_filename, seminar_signup_contribute.file.url, {:target => '_blank', :title => Nokogiri::HTML(description.gsub("<br>"," , ")).text, :download=>seminar_signup_contribute.disp_filename} if seminar_signup_contribute.file.file %>
<% else %>
<%= link_to seminar_signup_contribute.disp_filename, seminar_signup_contribute.file.url, {:target => '_blank', :title => seminar_signup_contribute.disp_filename, :download=>seminar_signup_contribute.disp_filename} if seminar_signup_contribute.file.file %>
<% end %>
</td>
<% end %> <% end %>
<% if seminar_submission_field %> <% if seminar_submission_field %>
<td><%= seminar_signup_contribute.seminar_submission_values.where(:seminar_submission_field=>seminar_submission_field).first.get_value_by_locale(I18n.locale) %></td> <td><%= seminar_signup_contribute.seminar_submission_values.where(:seminar_submission_field=>seminar_submission_field).first.get_value_by_locale(I18n.locale) %></td>
<% end %> <% end %>
<td> <td>
<%= link_to t(:edit), prefix_url + '?method=edit_file&con_no=' + seminar_signup_contribute.id, :class => 'btn btn-primary', :style => 'display:block; width: 150px;' %> <%= link_to t(:edit), prefix_url + '?method=edit_file&con_no=' + seminar_signup_contribute.id, :class => 'btn btn-primary' %>
<%= form_tag(del_file_seminars_path, {method: "post"}) do |f| %> <%= form_tag(del_file_seminars_path, {method: "post"}) do |f| %>
<%= submit_tag t(:delete_), class: "btn btn-primary" %> <%= submit_tag t(:delete_), class: "btn btn-primary" %>
<%= hidden_field_tag "referer_url", request.original_url.split(request.env["HTTP_HOST"]).last.split('?').first %> <%= hidden_field_tag "referer_url", request.original_url.split(request.env["HTTP_HOST"]).last.split('?').first %>
@ -96,7 +89,7 @@
<% if ( @seminar.contribute_file_count.blank? or @seminar_signup.seminar_signup_contributes.count < @seminar.contribute_file_count.to_i ) %> <% if ( @seminar.contribute_file_count.blank? or @seminar_signup.seminar_signup_contributes.count < @seminar.contribute_file_count.to_i ) %>
<%= link_to content_tag(:i, nil, :class => 'icon-plus') +' '+ t('seminar_signup.new_'), prefix_url + '?method=add_file', :class => 'btn btn-primary' , :style => 'display:block; width: 150px;' %> <%= link_to content_tag(:i, nil, :class => 'icon-plus') +' '+ t('seminar_signup.new_'), prefix_url + '?method=add_file', :class => 'btn btn-primary' %>
<% end %> <% end %>
<br /> <br />

View File

@ -6,14 +6,12 @@
@time_now = data["time_now"] @time_now = data["time_now"]
%> %>
<% begin %> <% begin %>
<table class="table seminar-index"> <table class="table table-hover table-striped seminar-index">
<caption> <caption>
<% page = OrbitHelper.page rescue Page.where(:page_id => OrbitHelper.params[:page_id]).first %> <% page = OrbitHelper.page rescue Page.where(:page_id => OrbitHelper.params[:page_id]).first %>
<h3><%= page.name rescue t('seminar.seminar') %></h3> <h3><%= page.name rescue t('seminar.seminar') %></h3>
</caption> </caption>
<% <thead>
=begin%>
<thead>
<tr> <tr>
<th class="col-md-2"><%= t(:category) %></th> <th class="col-md-2"><%= t(:category) %></th>
<th class="col-md-3"><%= t('seminar.title') %></th> <th class="col-md-3"><%= t('seminar.title') %></th>
@ -21,9 +19,7 @@
<th class="col-md-2"><%= t('seminar_signup.place') %></th> <th class="col-md-2"><%= t('seminar_signup.place') %></th>
<th class="col-md-2"><%= t('seminar.signup') %></th> <th class="col-md-2"><%= t('seminar.signup') %></th>
</tr> </tr>
</thead> </thead>
<%
=end%>
<tbody> <tbody>
<% <%
@seminars.each do |seminar| @seminars.each do |seminar|
@ -47,9 +43,9 @@
seminar_title = seminar.title seminar_title = seminar.title
%> %>
<tr> <tr>
<td><%= seminar.category.title %></td>
<td> <td>
<%= seminar_title %> <%= link_to(seminar_title, seminar.get_frontend_url(seminar_url, :show_data), :target=>'_blank', :title=>seminar_title) %>
<%#= link_to(seminar_title, seminar.get_frontend_url(seminar_url, :show_data), :target=>'_blank', :title=>seminar_title) %>
</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><%= seminar.act_place %></td> <td><%= seminar.act_place %></td>

View File

@ -1,50 +0,0 @@
<% # 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

@ -1,70 +0,0 @@
<% # 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_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 %>
</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_signup[seminar_main_id]" value="<%= @seminar.id %>">
<input type="hidden" name="reset_token" value="<%= params['token'] %>" />
<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);
})
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

@ -36,11 +36,6 @@
<%= javascript_include_tag "lib/bootstrap-datetimepicker" %> <%= javascript_include_tag "lib/bootstrap-datetimepicker" %>
<%= javascript_include_tag "lib/datetimepicker/date.time.picker.js" %> <%= javascript_include_tag "lib/datetimepicker/date.time.picker.js" %>
<%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %> <%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %>
<style>
.error{
color: red;
}
</style>
<% notice = flash["notice"] || params[:notice] %> <% notice = flash["notice"] || params[:notice] %>
<% flash.each do |key, msg| %> <% flash.each do |key, msg| %>
<% next if key.to_s == "notice" %> <% next if key.to_s == "notice" %>
@ -63,8 +58,8 @@
<!-- Title --> <!-- Title -->
<div class="form-group"> <div class="form-group">
<label for="title" class="col-sm-2 control-label hide"><%= t('seminar.title') %></label> <label for="title" class="col-sm-2 control-label"><%= t('seminar.title') %></label>
<div class="col-sm-10 seminar-title"> <div class="col-sm-10">
<%= @seminar.title %> <%= @seminar.title %>
</div> </div>
</div> </div>
@ -82,7 +77,7 @@
<% 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' %>
<div class="form-group<%= (@seminar.registration_status[0] == 'G' && signup_field.field_name == 'password') ? ' hide' : '' %><%= (signup_field.hidden) ? ' hide' : '' %>" id="<%= signup_field.field_name == 'password' ? 'registration_status' : '' %>"> <div class="form-group<%= (@seminar.registration_status[0] == 'G' && signup_field.field_name == 'password') ? ' hide' : '' %>" id="<%= signup_field.field_name == 'password' ? 'registration_status' : '' %>">
<label for="<%= signup_field['name'][I18n.locale] %>" class="col-sm-2 control-label"> <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) %>
* *
@ -129,8 +124,7 @@
</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 %> <%= 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>
<div class="loader"></div>
</div> </div>
<% elsif signup_field.field_name == 'note' %> <% elsif signup_field.field_name == 'note' %>
<div class="col-sm-10"> <div class="col-sm-10">
@ -209,31 +203,18 @@
</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 % 4 == 0) && idx != 0 %>
<% group += 1 %>
<div id="group<%= group %>" style="display:none;">
<% 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 % 4 == 0) && idx != 3 %>
<% counter = 0 %>
</div>
<% end %>
<% @form_index = @form_index +1 %> <% @form_index = @form_index +1 %>
<% end %> <% end %>
<div class="form-group" style="text-align:center;margin:10px 0;">
<button id="add-member" class="btn btn-primary" style="display:inline; width: 150px">增加組員</button>
</div>
<!-- 驗證碼 --> <!-- 驗證碼 -->
<% if @seminar.seminar_signup_field_sets.count != 0 %> <% if @seminar.seminar_signup_field_sets.count != 0 %>
@ -329,41 +310,34 @@
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 : "<%= "/xhr/seminars/check_email/#{@seminar.id}" %>", url : "<%= "#{prefix_url}?method=check_availability&no=#{@seminar.id}" %>",
data : {"type" : type, "email" : value}, data : {"type" : type, "value" : 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");
}else{ alert("1tttt");
loader.addClass("error"); }else{
}
loader.text(data.result); alert("1ssss2");
} }
})
}
if( value ){
if(type == "seminar_signup_email"){
loader.text("Checking...")
checkAvailability();
} }
} })
}) }
let currentGroup = 1;
$("#add-member").on("click",function () { if( value ){
if(currentGroup < 5){ if(type == "seminar_signup_email"){
currentGroup++; checkAvailability();
$("#group" + currentGroup).show();
if(currentGroup == 5){
$(this).attr("disabled","disabled").hide();
} }
} }
return false;
}) })
})(); })();
</script> </script>

View File

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

View File

@ -13,7 +13,7 @@
<%=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? %>
<br> <br>
<a href="<%= prefix_url %>?method=con_login" class="btn btn-primary" style="display: block; width: 250px;"> <a href="<%= prefix_url %>?method=con_login" class="btn btn-primary">
<%= t('seminar.click_to_contribute') %> <%= t('seminar.click_to_contribute') %>
</a> </a>
<% else %> <% else %>

View File

@ -44,4 +44,8 @@ markups:
muti_lang_input_supprt: false muti_lang_input_supprt: false
ext_support: false ext_support: false
panel: typeF panel: typeF
display_only: seminar_submission_field display_only: seminar_submission_field
instructions:
muti_lang_input_supprt: false
ext_support: false
panel: typeG

View File

@ -5,7 +5,9 @@ en:
label: "" label: ""
lists: lists:
markups: markups:
seminar_preferred_session: Preferred Session seminar_preferred_session: Preferred Session
instructions: Instructions
restful_actions: restful_actions:
edit_seminar_review: Review edit_seminar_review: Review
copy: Copy copy: Copy
@ -46,12 +48,12 @@ en:
home_setting: Home Setting home_setting: Home Setting
sub_page_setting: Sub Page Setting sub_page_setting: Sub Page Setting
menu: menu:
introduction: Introduction introduction: Introduction
news: News news: News
registration: Registration registration: Registration
registered_participants: Registered Participants registered_participants: Registered Participants
submission: Submission submission: Submission
album: Album album: Album
introduction: Introduction introduction: Introduction
announcement_limit: Announcement ;imit announcement_limit: Announcement ;imit
album_limit: Album limit album_limit: Album limit
@ -160,7 +162,7 @@ en:
contribute_file_count: Count of Contribute Files #投稿檔案數 contribute_file_count: Count of Contribute Files #投稿檔案數
frontend: frontend:
seminar: Semianr #研討會前台 seminar: Semianr #研討會前台
seminar_item: seminar_item:
new_item: New Item #新增項目 new_item: New Item #新增項目
@ -205,21 +207,11 @@ en:
email_address: Email address email_address: Email address
_password: Password _password: Password
login: Login login: Login
new_: 'Upload' new_: 'Load abstract'
load_file: load file load_file: load file
enable_summary_choice: Enable summary choice enable_summary_choice: Enable summary choice
summary_choice_type: Summary choice type summary_choice_type: Summary choice type
select: Select box select: Select box
checkbox: Multiple choice checkbox: Multiple choice
radio: Single choice radio: Single choice
choices: Choices choices: Choices
forgot_password: Forgot 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 missmatch
password_changed: Password changed successfully

View File

@ -5,7 +5,8 @@ zh_tw:
label: "" label: ""
lists: lists:
markups: markups:
seminar_preferred_session: Preferred Session seminar_preferred_session: Preferred Session
instructions: "說明文字 Instructions"
restful_actions: restful_actions:
edit_seminar_review: 審查 edit_seminar_review: 審查
@ -47,12 +48,12 @@ zh_tw:
home_setting: 首頁設定 home_setting: 首頁設定
sub_page_setting: 內頁設定 sub_page_setting: 內頁設定
menu: menu:
introduction: 介紹 introduction: 介紹
news: 公告 news: 公告
registration: 註冊 registration: 註冊
registered_participants: 註冊參與者 registered_participants: 註冊參與者
submission: 投稿 submission: 投稿
album: 相簿 album: 相簿
introduction: 介紹 introduction: 介紹
announcement_limit: 公告上限 announcement_limit: 公告上限
album_limit: 相簿上限 album_limit: 相簿上限
@ -103,8 +104,8 @@ zh_tw:
email_edit_file: 編輯上傳 email_edit_file: 編輯上傳
email_add_file: 新增上傳 email_add_file: 新增上傳
auto_send_email_set: 自動發信設定 auto_send_email_set: 自動發信設定
click_to_contribute: 按此登入上傳切結書 click_to_contribute: 按此登入投稿
required: '必填' required: '必填, necessary'
already_used: 已存在 already_used: 已存在
please_enter_email: 請輸入Email please_enter_email: 請輸入Email
available: 可使用 available: 可使用
@ -161,7 +162,7 @@ zh_tw:
contribute_file_count: 投稿檔案數 contribute_file_count: 投稿檔案數
frontend: frontend:
seminar: 研討會前台 seminar: 研討會前台
seminar_item: seminar_item:
new_item: 新增項目 new_item: 新增項目
@ -191,7 +192,7 @@ zh_tw:
note: 註解 note: 註解
time: (開始/結束)時間 time: (開始/結束)時間
place: 地點 place: 地點
agree: 參賽隊伍或其法定代理人皆同意「個人資料蒐集處理利用告知書」、「活動須知」。註冊表單填寫完成後將上傳每位參賽者的「參賽切結書」。 agree: 同意接受本站個資及隱私權保護宣告(Agree upon personal data protection declaration of this web)
privacy_statement: '個資及隱私權保護宣告' privacy_statement: '個資及隱私權保護宣告'
recaptcha: 驗證碼 recaptcha: 驗證碼
signup_field: 圈選項目 signup_field: 圈選項目
@ -202,25 +203,15 @@ zh_tw:
files: 檔案 files: 檔案
logout: Logout logout: Logout
logouting: 登出中 logouting: 登出中
success_message: '感謝您們報名「臺北程式設計節2023城市運行大黑客松」收到此Email代表您們已順利填寫註冊表單。請接續上傳每位參賽者的「參賽切結書」以完成報名流程作業。' success_message: '您的報名已成功,感謝您的參與。'
email_address: Email address email_address: Email address
_password: Password _password: Password
login: Login login: Login
new_: '新增' new_: '新增(load abstract)'
load_file: 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: Forgot Password
reset_email_sent: Reset Email Sent
login_failed: 登入失敗
email_not_found: Email not found
reset: Reset
email_reset_password_success: Password reset
click_on_link: 請點選下方連結後重設密碼。
confirm_password: Confirm Password
password_mismatch: Password missmatch
password_changed: Password changed successfully

View File

@ -53,7 +53,7 @@ Rails.application.routes.draw do
SeminarSubmissionField.create_indexes SeminarSubmissionField.create_indexes
end end
locales = Site.first.in_use_locales rescue I18n.available_locales locales = Site.first.in_use_locales rescue I18n.available_locales
scope "(:locale)", locale: Regexp.new(locales.join("|")) do scope "(:locale)", locale: Regexp.new(locales.join("|")) do
namespace :admin do namespace :admin do
resources :seminars do resources :seminars do
@ -100,15 +100,13 @@ Rails.application.routes.draw do
collection do collection 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 'reset_password_proc', to: 'seminars#reset_password_proc'
post 'reset_confirm_password_proc', to: 'seminars#reset_confirm_password_proc'
post 'con_logout_proc', to: 'seminars#con_logout_proc' post 'con_logout_proc', to: 'seminars#con_logout_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'
end end
end end
get "/xhr/seminars/check_email/:no" => "seminars#check_email"
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
@ -333,7 +333,7 @@ module CustomAnnouncementsHelper
begin begin
data = @data# rescue nil data = @data# rescue nil
rescue Exception => e rescue Exception => e
write_debug_file(e,'custom_announcements',@target_action) if Site::DEBUG write_debug_file(e,'custom_announcements',@target_action) if Site::DEBUG
end end
if !data.nil? if !data.nil?
wrap_elements = doc.css("*[data-list][data-level='0']") wrap_elements = doc.css("*[data-list][data-level='0']")
@ -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,153 +2,155 @@ require "yaml"
module CustomAnnouncement module CustomAnnouncement
class Engine < ::Rails::Engine class Engine < ::Rails::Engine
initializer "custom_announcement" do initializer "custom_announcement" do
begin Rails.application.config.to_prepare do
translate_data = Dir["#{CustomAnnouncement::Engine.root}/config/locales/*.yml"] .map{|yaml_file| YAML.load(File.read(yaml_file))}
data = {}
key1 = {}
key2 = {}
key3 = {}
key4 = {}
key1_attr = []
key2_attr = []
key3_attr = []
key4_attr = []
data_item = {}
key_item1 = {}
key_item2 = {}
key_item3 = {}
value_item1 = {}
value_item2 = {}
value_item3 = {}
value2_item1 = {}
value2_item2 = {}
key1_options = ['small_size','medium_size','orignal_size']
key2_options = ['not_enable_tabs','enable_tabs_with_categories_include_all','enable_tabs_with_categories']
key3_options = ['default','upper_left','lower_left','upper_right','lower_right']
key4_options = ['the_same_as_data_count','display_all_in_other_tabs']
key1_options.each_with_index do |k,i|
key1_attr[i] = {}
end
key2_options.each_with_index do |k,i|
key2_attr[i] = {}
end
key3_options.each_with_index do |k,i|
key3_attr[i] = {}
end
key4_options.each_with_index do |k,i|
key4_attr[i] = {}
end
translate_data.each do |t_data|
v = t_data.values
k = t_data.keys[0]
key1[k] = v[0]['custom_announcement']['picture_showing_size']
key2[k] = v[0]['custom_announcement']['tabs_options']
key3[k] = v[0]['custom_announcement']['read_more_position_options']
key4[k] = v[0]['custom_announcement']['all_tabs_setting']
key1_options.each_with_index do |kk,i|
key1_attr[i][k] = v[0]['custom_announcement'][kk]
end
key2_options.each_with_index do |kk,i|
key2_attr[i][k] = v[0]['custom_announcement'][kk]
end
key3_options.each_with_index do |kk,i|
key3_attr[i][k] = v[0]['custom_announcement'][kk]
end
key4_options.each_with_index do |kk,i|
key4_attr[i][k] = v[0]['custom_announcement'][kk]
end
key_item1[k] = v[0]['custom_announcement']['showing_back_and_next']
key_item2[k] = v[0]['custom_announcement']['enable_search']
value_item1[k] = v[0]['custom_announcement']['not_show']
value_item2[k] = v[0]['custom_announcement']['show_bottom']
value_item3[k] = v[0]['custom_announcement']['show_top']
value2_item1[k] = v[0]['custom_announcement']['no']
value2_item2[k] = v[0]['custom_announcement']['yes']
end
data[key1] = key1_attr
data[key2] = key2_attr
data[key3] = key3_attr
data[key4] = key4_attr
data_item[key_item1] = [value_item1,value_item2,value_item3]
data_item[key_item2] = [value2_item1,value2_item2]
require File.expand_path('../../../app/models/custom_anns_cache', __FILE__)
if defined? CustomAnnsCache
CustomAnnsCache.destroy_all
end
rescue => e
puts ['error in custom_announcement',e]
end
OrbitApp.registration "CustomAnnouncement", :type => "ModuleApp" do
module_label "custom_announcement.custom_announcement"
base_url File.expand_path File.dirname(__FILE__)
widget_methods ["widget","random_custom_announcement_widget", "tag_cloud"]
widget_settings [{"data_count"=>30,"enable_custom_widget_data"=>true}]
taggable "CustomBulletin"
categorizable
authorizable
frontend_enabled
feeds_url "/xhr/custom_announcements/feeds"
data_count 1..30
begin begin
show_options data translate_data = Dir["#{CustomAnnouncement::Engine.root}/config/locales/*.yml"] .map{|yaml_file| YAML.load(File.read(yaml_file))}
show_option_items data_item data = {}
rescue => e key1 = {}
puts ['there_was_no_show_option_method',e] key2 = {}
key3 = {}
key4 = {}
key1_attr = []
key2_attr = []
key3_attr = []
key4_attr = []
data_item = {}
key_item1 = {}
key_item2 = {}
key_item3 = {}
value_item1 = {}
value_item2 = {}
value_item3 = {}
value2_item1 = {}
value2_item2 = {}
key1_options = ['small_size','medium_size','orignal_size']
key2_options = ['not_enable_tabs','enable_tabs_with_categories_include_all','enable_tabs_with_categories']
key3_options = ['default','upper_left','lower_left','upper_right','lower_right']
key4_options = ['the_same_as_data_count','display_all_in_other_tabs']
key1_options.each_with_index do |k,i|
key1_attr[i] = {}
end
key2_options.each_with_index do |k,i|
key2_attr[i] = {}
end
key3_options.each_with_index do |k,i|
key3_attr[i] = {}
end
key4_options.each_with_index do |k,i|
key4_attr[i] = {}
end
translate_data.each do |t_data|
v = t_data.values
k = t_data.keys[0]
key1[k] = v[0]['custom_announcement']['picture_showing_size']
key2[k] = v[0]['custom_announcement']['tabs_options']
key3[k] = v[0]['custom_announcement']['read_more_position_options']
key4[k] = v[0]['custom_announcement']['all_tabs_setting']
key1_options.each_with_index do |kk,i|
key1_attr[i][k] = v[0]['custom_announcement'][kk]
end
key2_options.each_with_index do |kk,i|
key2_attr[i][k] = v[0]['custom_announcement'][kk]
end
key3_options.each_with_index do |kk,i|
key3_attr[i][k] = v[0]['custom_announcement'][kk]
end
key4_options.each_with_index do |kk,i|
key4_attr[i][k] = v[0]['custom_announcement'][kk]
end
key_item1[k] = v[0]['custom_announcement']['showing_back_and_next']
key_item2[k] = v[0]['custom_announcement']['enable_search']
value_item1[k] = v[0]['custom_announcement']['not_show']
value_item2[k] = v[0]['custom_announcement']['show_bottom']
value_item3[k] = v[0]['custom_announcement']['show_top']
value2_item1[k] = v[0]['custom_announcement']['no']
value2_item2[k] = v[0]['custom_announcement']['yes']
end
data[key1] = key1_attr
data[key2] = key2_attr
data[key3] = key3_attr
data[key4] = key4_attr
data_item[key_item1] = [value_item1,value_item2,value_item3]
data_item[key_item2] = [value2_item1,value2_item2]
require File.expand_path('../../../app/models/custom_anns_cache', __FILE__)
if defined? CustomAnnsCache
CustomAnnsCache.destroy_all
end
rescue => e
puts ['error in custom_announcement',e]
end end
side_bar do OrbitApp.registration "CustomAnnouncement", :type => "ModuleApp" do
set_sidebar_order(100) rescue nil module_label "custom_announcement.custom_announcement"
head_label_i18n 'custom_announcement.custom_announcement', icon_class: "icon-bullhorn" base_url File.expand_path File.dirname(__FILE__)
available_for "users" widget_methods ["widget","random_custom_announcement_widget", "tag_cloud"]
active_for_controllers (['admin/custom_announcements']) widget_settings [{"data_count"=>30,"enable_custom_widget_data"=>true}]
head_link_path "admin_custom_announcements_path" taggable "CustomBulletin"
categorizable
authorizable
frontend_enabled
feeds_url "/xhr/custom_announcements/feeds"
data_count 1..30
begin
show_options data
show_option_items data_item
rescue => e
puts ['there_was_no_show_option_method',e]
end
side_bar do
set_sidebar_order(100) rescue nil
head_label_i18n 'custom_announcement.custom_announcement', icon_class: "icon-bullhorn"
available_for "users"
active_for_controllers (['admin/custom_announcements'])
head_link_path "admin_custom_announcements_path"
context_link 'custom_announcement.all_articles',
:link_path=>"admin_custom_announcements_path" ,
:priority=>1,
:active_for_action=>{'admin/custom_announcements'=>'index'},
:available_for => 'users'
# context_link 'new_',
# :link_path=>"new_admin_custom_announcement_path" ,
# :priority=>2,
# :active_for_action=>{'admin/custom_announcements'=>'new'},
# :available_for => 'sub_managers'
context_link 'categories',
:link_path=>"admin_module_app_categories_path" ,
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'custom_announcement').id}",
:priority=>3,
:active_for_action=>{'admin/custom_announcements'=>'categories'},
:active_for_category => 'CustomAnnouncement',
:available_for => 'managers'
context_link 'tags',
:link_path=>"admin_module_app_tags_path" ,
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'custom_announcement').id}",
:priority=>4,
:active_for_action=>{'admin/custom_announcements'=>'tags'},
:active_for_tag => 'CustomAnnouncement',
:available_for => 'managers'
context_link 'custom_announcement.feed_list',
:link_path=>"admin_custom_announcement_feed_path" ,
:priority=>5,
:active_for_action=>{'admin/custom_announcements'=>'feed'},
:available_for => 'managers'
context_link 'custom_announcement.import',
:link_path=>"admin_custom_announcement_import_path" ,
:priority=>6,
:active_for_action=>{'admin/custom_announcements'=>'import'},
:available_for => 'managers'
context_link 'custom_announcement.settings',
:link_path=>"admin_custom_announcement_settings_path" ,
:priority=>6,
:active_for_action=>{'admin/custom_announcements'=>'settings'},
:available_for => 'managers'
end
context_link 'custom_announcement.all_articles',
:link_path=>"admin_custom_announcements_path" ,
:priority=>1,
:active_for_action=>{'admin/custom_announcements'=>'index'},
:available_for => 'users'
# context_link 'new_',
# :link_path=>"new_admin_custom_announcement_path" ,
# :priority=>2,
# :active_for_action=>{'admin/custom_announcements'=>'new'},
# :available_for => 'sub_managers'
context_link 'categories',
:link_path=>"admin_module_app_categories_path" ,
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'custom_announcement').id}",
:priority=>3,
:active_for_action=>{'admin/custom_announcements'=>'categories'},
:active_for_category => 'CustomAnnouncement',
:available_for => 'managers'
context_link 'tags',
:link_path=>"admin_module_app_tags_path" ,
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'custom_announcement').id}",
:priority=>4,
:active_for_action=>{'admin/custom_announcements'=>'tags'},
:active_for_tag => 'CustomAnnouncement',
:available_for => 'managers'
context_link 'custom_announcement.feed_list',
:link_path=>"admin_custom_announcement_feed_path" ,
:priority=>5,
:active_for_action=>{'admin/custom_announcements'=>'feed'},
:available_for => 'managers'
context_link 'custom_announcement.import',
:link_path=>"admin_custom_announcement_import_path" ,
:priority=>6,
:active_for_action=>{'admin/custom_announcements'=>'import'},
:available_for => 'managers'
context_link 'custom_announcement.settings',
:link_path=>"admin_custom_announcement_settings_path" ,
:priority=>6,
:active_for_action=>{'admin/custom_announcements'=>'settings'},
:available_for => 'managers'
end end
# temp = YAML.load_file(File.join(Rails.root,"config","mongoid.yml"))
# dbsettings = temp["production"]["sessions"]["default"]
# s = Moped::Session.new(dbsettings["hosts"])
# s.use dbsettings["database"]
# s[:custom_bulletins].indexes.create({expirable_created_at: 1},{ expireAfterSeconds: 180 })
end end
# temp = YAML.load_file(File.join(Rails.root,"config","mongoid.yml"))
# dbsettings = temp["production"]["sessions"]["default"]
# s = Moped::Session.new(dbsettings["hosts"])
# s.use dbsettings["database"]
# s[:custom_bulletins].indexes.create({expirable_created_at: 1},{ expireAfterSeconds: 180 })
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,94 +1,96 @@
module CustomGallery module CustomGallery
class Engine < ::Rails::Engine class Engine < ::Rails::Engine
initializer "custom_gallery" do initializer "custom_gallery" do
begin Rails.application.config.to_prepare do
translate_data = Dir["#{CustomGallery::Engine.root}/config/locales/*.yml"] .map{|yaml_file| YAML.load(File.read(yaml_file))} begin
data = {} translate_data = Dir["#{CustomGallery::Engine.root}/config/locales/*.yml"] .map{|yaml_file| YAML.load(File.read(yaml_file))}
key1 = {} data = {}
value1 = {} key1 = {}
value2 = {} value1 = {}
value3 = {} value2 = {}
translate_data.each do |t_data| value3 = {}
v = t_data.values translate_data.each do |t_data|
k = t_data.keys[0] v = t_data.values
key1[k] = v[0]['custom_gallery']['inner_page_layout'] k = t_data.keys[0]
value1[k] = v[0]['custom_gallery']['grid_style'] key1[k] = v[0]['custom_gallery']['inner_page_layout']
value2[k] = v[0]['custom_gallery']['card_style'] value1[k] = v[0]['custom_gallery']['grid_style']
value3[k] = v[0]['custom_gallery']['slideshow_style'] value2[k] = v[0]['custom_gallery']['card_style']
value3[k] = v[0]['custom_gallery']['slideshow_style']
end
data[key1] = [value1,value2,value3]
rescue => e
puts ['error in custom_gallery',e]
end end
data[key1] = [value1,value2,value3]
rescue => e
puts ['error in custom_gallery',e]
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()
elsif CustomAlbumSetting.count > 1 elsif CustomAlbumSetting.count > 1
CustomAlbumSetting.all.to_a[1..-1].each do |custom_album_setting| CustomAlbumSetting.all.to_a[1..-1].each do |custom_album_setting|
custom_album_setting.destroy custom_album_setting.destroy
end
end end
end end
end
OrbitApp.registration "CustomGallery", :type => "ModuleApp" do
OrbitApp.registration "CustomGallery", :type => "ModuleApp" do module_label "custom_gallery.custom_gallery"
module_label "custom_gallery.custom_gallery" base_url File.expand_path File.dirname(__FILE__)
base_url File.expand_path File.dirname(__FILE__) widget_methods ["widget","custom_album_widget"]
widget_methods ["widget","custom_album_widget"] # widget_settings []
# widget_settings [] widget_settings [{"data_count"=>30,"enable_custom_widget_data"=>true}]
widget_settings [{"data_count"=>30,"enable_custom_widget_data"=>true}] models_to_cache [:custom_album,:custom_album_image]
models_to_cache [:custom_album,:custom_album_image] taggable "CustomAlbum"
taggable "CustomAlbum" categorizable
categorizable authorizable
authorizable frontend_enabled
frontend_enabled data_count 1..30
data_count 1..30 begin
begin show_option_items data
show_option_items data rescue => e
rescue => e puts ['there_was_no_show_option_method',e]
puts ['there_was_no_show_option_method',e] end
end side_bar do
side_bar do set_sidebar_order(100) rescue nil
set_sidebar_order(100) rescue nil head_label_i18n 'custom_gallery.custom_gallery', icon_class: "fa fa-file-image-o"
head_label_i18n 'custom_gallery.custom_gallery', icon_class: "fa fa-file-image-o" available_for "users"
available_for "users" active_for_controllers (['admin/custom_galleries','admin/images'])
active_for_controllers (['admin/custom_galleries','admin/images']) head_link_path "admin_custom_galleries_path"
head_link_path "admin_custom_galleries_path"
context_link 'custom_gallery.all', context_link 'custom_gallery.all',
:link_path=>"admin_custom_galleries_path" , :link_path=>"admin_custom_galleries_path" ,
:priority=>1, :priority=>1,
:active_for_action=>{'admin/custom_galleries'=>"index"}, :active_for_action=>{'admin/custom_galleries'=>"index"},
:available_for => 'users' :available_for => 'users'
# context_link 'custom_gallery.new', # context_link 'custom_gallery.new',
# :link_path=>"new_admin_custom_gallery_path" , # :link_path=>"new_admin_custom_gallery_path" ,
# :priority=>2, # :priority=>2,
# :active_for_action=>{'admin/custom_galleries'=>"new"}, # :active_for_action=>{'admin/custom_galleries'=>"new"},
# :available_for => 'sub_managers' # :available_for => 'sub_managers'
context_link 'categories', context_link 'categories',
:link_path=>"admin_module_app_categories_path" , :link_path=>"admin_module_app_categories_path" ,
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'custom_gallery').id}", :link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'custom_gallery').id}",
:priority=>3, :priority=>3,
:active_for_action=>{'admin/custom_galleries'=>'categories'}, :active_for_action=>{'admin/custom_galleries'=>'categories'},
:active_for_category => 'CustomGallery', :active_for_category => 'CustomGallery',
:available_for => 'managers' :available_for => 'managers'
context_link 'tags', context_link 'tags',
:link_path=>"admin_module_app_tags_path" , :link_path=>"admin_module_app_tags_path" ,
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'custom_gallery').id}", :link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'custom_gallery').id}",
:priority=>4, :priority=>4,
:active_for_action=>{'admin/custom_galleries'=>'tags'}, :active_for_action=>{'admin/custom_galleries'=>'tags'},
:active_for_tag => 'CustomGallery', :active_for_tag => 'CustomGallery',
:available_for => 'managers' :available_for => 'managers'
context_link 'setting', context_link 'setting',
:link_path=>"admin_custom_galleries_setting_path" , :link_path=>"admin_custom_galleries_setting_path" ,
:priority=>5, :priority=>5,
:active_for_action=>{'admin/custom_galleries'=>'setting'}, :active_for_action=>{'admin/custom_galleries'=>'setting'},
:available_for => 'managers' :available_for => 'managers'
end end
end
end end
end end
end end

View File

@ -1,55 +1,56 @@
module Seminar module Seminar
class Engine < ::Rails::Engine class Engine < ::Rails::Engine
initializer "seminar" do initializer "seminar" do
OrbitApp.registration "Seminar", :type => "ModuleApp" do Rails.application.config.to_prepare do
module_label "seminar.seminar" OrbitApp.registration "Seminar", :type => "ModuleApp" do
base_url File.expand_path File.dirname(__FILE__) module_label "seminar.seminar"
authorizable base_url File.expand_path File.dirname(__FILE__)
categorizable authorizable
frontend_enabled categorizable
data_count 1..20 frontend_enabled
widget_methods ["widget"] data_count 1..20
widget_settings [{"data_count"=>30}] widget_methods ["widget"]
side_bar do widget_settings [{"data_count"=>30}]
head_label_i18n 'seminar.seminar', icon_class: "icon-globe" side_bar do
available_for "users" head_label_i18n 'seminar.seminar', icon_class: "icon-globe"
active_for_controllers (['admin/seminars']) available_for "users"
head_link_path "admin_seminars_path" active_for_controllers (['admin/seminars'])
head_link_path "admin_seminars_path"
context_link 'list_', context_link 'list_',
:link_path=>"admin_seminars_path" , :link_path=>"admin_seminars_path" ,
:priority=>1, :priority=>1,
:active_for_action=>{'admin/seminars'=>'index'}, :active_for_action=>{'admin/seminars'=>'index'},
:available_for => 'users' :available_for => 'users'
context_link 'new_', context_link 'new_',
:link_path=>"new_admin_seminar_path" , :link_path=>"new_admin_seminar_path" ,
:priority=>2, :priority=>2,
:active_for_action=>{'admin/seminars'=>'new'}, :active_for_action=>{'admin/seminars'=>'new'},
:available_for => 'sub_managers' :available_for => 'sub_managers'
context_link 'categories', context_link 'categories',
:link_path=>"admin_module_app_categories_path" , :link_path=>"admin_module_app_categories_path" ,
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'seminar').id}", :link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'seminar').id}",
:priority=>3, :priority=>3,
:active_for_action=>{'admin/seminars'=>'categories'}, :active_for_action=>{'admin/seminars'=>'categories'},
:active_for_category => 'Seminar', :active_for_category => 'Seminar',
:available_for => 'managers' :available_for => 'managers'
context_link 'seminar.set_seminar_items', context_link 'seminar.set_seminar_items',
:link_path=>"admin_seminar_items_path" , :link_path=>"admin_seminar_items_path" ,
:priority=>4, :priority=>4,
:active_for_action=>{'admin/seminars'=>'seminar_items'}, :active_for_action=>{'admin/seminars'=>'seminar_items'},
:available_for => 'managers' :available_for => 'managers'
context_link 'seminar.set_seminar_agreements', context_link 'seminar.set_seminar_agreements',
:link_path=>"admin_seminar_agreements_path" , :link_path=>"admin_seminar_agreements_path" ,
:priority=>5, :priority=>5,
:active_for_action=>{'admin/seminars'=>'seminar_agreements'}, :active_for_action=>{'admin/seminars'=>'seminar_agreements'},
:available_for => 'managers' :available_for => 'managers'
context_link 'seminar.enquiry_for_applicants', context_link 'seminar.enquiry_for_applicants',
:link_path=>"admin_seminar_enquiry_for_applicants_path" , :link_path=>"admin_seminar_enquiry_for_applicants_path" ,
:priority=>6, :priority=>6,
: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