parent
ed1ebc8ec3
commit
f83fb71f2a
|
@ -5,10 +5,10 @@ class Admin::SeminarsController < OrbitAdminController
|
||||||
include Admin::SeminarsHelper
|
include Admin::SeminarsHelper
|
||||||
helper Admin::SeminarsFieldHelper
|
helper Admin::SeminarsFieldHelper
|
||||||
before_action ->(module_app = @app_title) { set_variables module_app }
|
before_action ->(module_app = @app_title) { set_variables module_app }
|
||||||
before_action :set_seminar, only: [:edit, :set_write_off, :seminar_signup, :destroy,:seminar_signup_admin_setting,:update_seminar_signup_admin_setting,:get_reviewer_block,:update_seminar_review,:reviewer_setting,:update_reviewer_setting]
|
before_action :set_seminar, only: [:edit, :set_write_off, :seminar_signup, :destroy,:seminar_signup_admin_setting,:update_seminar_signup_admin_setting,:get_reviewer_block,:get_session_block,:update_seminar_review,:update_seminar_session,:reviewer_setting,:update_reviewer_setting]
|
||||||
before_action :set_seminar_signup_admin_setting, only: [:seminar_signup,:seminar_signup_admin_setting,:update_seminar_signup_admin_setting,:get_reviewer_block]
|
before_action :set_seminar_signup_admin_setting, only: [:seminar_signup,:seminar_signup_admin_setting,:update_seminar_signup_admin_setting,:get_reviewer_block,:get_session_block]
|
||||||
before_action :check_permission_for_seminar, only: [:seminar_signup,:get_reviewer_block]
|
before_action :check_permission_for_seminar, only: [:seminar_signup,:get_reviewer_block,:get_session_block]
|
||||||
before_action :check_manager_for_seminar, only: [:seminar_signup_admin_setting,:update_seminar_signup_admin_setting,:update_seminar_review]
|
before_action :check_manager_for_seminar, only: [:seminar_signup_admin_setting,:update_seminar_signup_admin_setting,:update_seminar_review,:update_seminar_session]
|
||||||
def initialize
|
def initialize
|
||||||
super
|
super
|
||||||
@app_title = "seminar"
|
@app_title = "seminar"
|
||||||
|
@ -89,9 +89,12 @@ class Admin::SeminarsController < OrbitAdminController
|
||||||
#render :html => seminar_params and return
|
#render :html => seminar_params and return
|
||||||
@seminar.update_attributes(seminar_params)
|
@seminar.update_attributes(seminar_params)
|
||||||
unassigned_seminar_signup_ids = @seminar.seminar_signup_ids.map{|s| s.to_s}
|
unassigned_seminar_signup_ids = @seminar.seminar_signup_ids.map{|s| s.to_s}
|
||||||
|
unassigned_mode_1_seminar_signup_ids = unassigned_seminar_signup_ids.dup
|
||||||
@seminar.seminar_reviews.each do |sr|
|
@seminar.seminar_reviews.each do |sr|
|
||||||
|
unassigned_mode_1_seminar_signup_ids = unassigned_mode_1_seminar_signup_ids - sr.get_all_seminar_signup_ids(1)
|
||||||
unassigned_seminar_signup_ids = unassigned_seminar_signup_ids - sr.all_seminar_signup_ids
|
unassigned_seminar_signup_ids = unassigned_seminar_signup_ids - sr.all_seminar_signup_ids
|
||||||
end
|
end
|
||||||
|
@seminar.unassigned_mode_1_seminar_signup_ids = unassigned_mode_1_seminar_signup_ids
|
||||||
@seminar.unassigned_seminar_signup_ids = unassigned_seminar_signup_ids
|
@seminar.unassigned_seminar_signup_ids = unassigned_seminar_signup_ids
|
||||||
@seminar.save
|
@seminar.save
|
||||||
redirect_to admin_seminars_path
|
redirect_to admin_seminars_path
|
||||||
|
@ -119,10 +122,14 @@ class Admin::SeminarsController < OrbitAdminController
|
||||||
end
|
end
|
||||||
unless @can_edit
|
unless @can_edit
|
||||||
if @seminar_signups.class != Array
|
if @seminar_signups.class != Array
|
||||||
seminar_signup_ids = SeminarReview.where(:reviewer_id=>reviewer_id).pluck(:seminar_signup_ids).flatten
|
seminar_review = SeminarReview.where(:reviewer_id=>reviewer_id)
|
||||||
remove_seminar_signup_ids = SeminarReview.where(:reviewer_id=>reviewer_id).pluck(:remove_seminar_signup_ids).flatten
|
seminar_signup_ids = seminar_review.pluck(:seminar_signup_ids).flatten
|
||||||
default_seminar_signup_ids = SeminarReview.where(:reviewer_id=>reviewer_id).pluck(:default_seminar_signup_ids).flatten
|
remove_seminar_signup_ids = seminar_review.pluck(:remove_seminar_signup_ids).flatten
|
||||||
all_seminar_signup_ids = seminar_signup_ids - remove_seminar_signup_ids + default_seminar_signup_ids
|
assign_ids = []
|
||||||
|
seminars = SeminarMain.where(:id.in => seminar_review.pluck(:seminar_main_id))
|
||||||
|
final_assign_signup_ids = SeminarSession.where(:id.in=>seminar_review.pluck(:seminar_session_ids).flatten,:seminar_main_id.in=>seminars.where(:assign_mode=>1).pluck(:id)).pluck(:seminar_signup_ids).flatten
|
||||||
|
default_seminar_signup_ids = seminar_review.where(:seminar_main_id.in=>seminars.where(:assign_mode=>0).pluck(:id)).pluck(:default_seminar_signup_ids).flatten
|
||||||
|
all_seminar_signup_ids = seminar_signup_ids - remove_seminar_signup_ids + final_assign_signup_ids + default_seminar_signup_ids
|
||||||
|
|
||||||
ids2 = SeminarSignup.where(:seminar_main_id.in=> SeminarMain.where(:organizer_id=>current_user.member_profile_id).pluck(:id)).pluck(:id)
|
ids2 = SeminarSignup.where(:seminar_main_id.in=> SeminarMain.where(:organizer_id=>current_user.member_profile_id).pluck(:id)).pluck(:id)
|
||||||
|
|
||||||
|
@ -130,6 +137,18 @@ class Admin::SeminarsController < OrbitAdminController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
def get_hide_session
|
||||||
|
seminar_main = SeminarMain.find(params[:id]) rescue nil
|
||||||
|
if seminar_main.nil?
|
||||||
|
render :nothing => true
|
||||||
|
else
|
||||||
|
@seminar = seminar_main
|
||||||
|
@seminar_sessions = @seminar.seminar_sessions
|
||||||
|
@hide_session_ids = (0...seminar_main.summary_chioices.count).to_a - Array(seminar_main.session_show_ids)
|
||||||
|
@hide_sessions = @hide_session_ids.zip(seminar_main.summary_chioices[Range.new(@hide_session_ids[0],@hide_session_ids[-1])]).to_h
|
||||||
|
render :layout => false
|
||||||
|
end
|
||||||
|
end
|
||||||
def get_hide_reviewer
|
def get_hide_reviewer
|
||||||
seminar_main = SeminarMain.find(params[:id]) rescue nil
|
seminar_main = SeminarMain.find(params[:id]) rescue nil
|
||||||
if seminar_main.nil?
|
if seminar_main.nil?
|
||||||
|
@ -137,9 +156,18 @@ class Admin::SeminarsController < OrbitAdminController
|
||||||
else
|
else
|
||||||
@hide_reviewer_ids = Array(seminar_main.reviewer_ids) - Array(seminar_main.reviewer_show_ids)
|
@hide_reviewer_ids = Array(seminar_main.reviewer_ids) - Array(seminar_main.reviewer_show_ids)
|
||||||
@hide_reviewers = MemberProfile.where(:id.in=>@hide_reviewer_ids)
|
@hide_reviewers = MemberProfile.where(:id.in=>@hide_reviewer_ids)
|
||||||
|
@reviewers = seminar_main.seminar_reviews.where(:reviewer_id.in=>@hide_reviewer_ids).to_a
|
||||||
render :layout => false
|
render :layout => false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
def get_session_block
|
||||||
|
@session_id = params[:session_id].to_i
|
||||||
|
unless (@seminar.session_show_ids.include?(@session_id) rescue false)
|
||||||
|
@seminar.session_show_ids << @session_id
|
||||||
|
@seminar.save
|
||||||
|
end
|
||||||
|
render :layout => false
|
||||||
|
end
|
||||||
def get_reviewer_block
|
def get_reviewer_block
|
||||||
@reviewer_id = params[:reviewer_id]
|
@reviewer_id = params[:reviewer_id]
|
||||||
unless (@seminar.reviewer_show_ids.include?(@reviewer_id) rescue false)
|
unless (@seminar.reviewer_show_ids.include?(@reviewer_id) rescue false)
|
||||||
|
@ -148,6 +176,42 @@ class Admin::SeminarsController < OrbitAdminController
|
||||||
end
|
end
|
||||||
render :layout => false
|
render :layout => false
|
||||||
end
|
end
|
||||||
|
def update_seminar_session
|
||||||
|
if @seminar.nil?
|
||||||
|
render :json => {:success => false}
|
||||||
|
else
|
||||||
|
seminar_main = @seminar
|
||||||
|
session_id = params[:session_id].to_i
|
||||||
|
seminar_main.save
|
||||||
|
seminar_session = @seminar.seminar_sessions.where(:key=>session_id).first
|
||||||
|
if params[:mode] == "append"
|
||||||
|
@seminar_signup.update(:final_session=>session_id)
|
||||||
|
seminar_session.seminar_signup_ids << @seminar_signup.id.to_s
|
||||||
|
@seminar_signup.update(:seminar_session_id=>seminar_session.id)
|
||||||
|
seminar_main.assign_mode = 1
|
||||||
|
seminar_session.save
|
||||||
|
seminar_main.unassigned_mode_1_seminar_signup_ids.delete(@seminar_signup.id.to_s)
|
||||||
|
elsif params[:mode] == "remove"
|
||||||
|
@seminar_signup.update(:final_session=>nil)
|
||||||
|
seminar_session.seminar_signup_ids.delete(@seminar_signup.id.to_s)
|
||||||
|
@seminar_signup.update(:seminar_session_id=>nil)
|
||||||
|
seminar_session.save
|
||||||
|
seminar_main.assign_mode = 0 if seminar_main.seminar_sessions.where(:seminar_signup_ids.ne=>[]).count == 0
|
||||||
|
seminar_main.unassigned_mode_1_seminar_signup_ids << @seminar_signup.id.to_s
|
||||||
|
elsif params[:mode] == "hide"
|
||||||
|
if seminar_main.session_show_ids.nil?
|
||||||
|
seminar_main.session_show_ids = (0...seminar_main.summary_chioices.count).to_a[0..1]
|
||||||
|
end
|
||||||
|
seminar_main.session_show_ids.delete(session_id)
|
||||||
|
elsif params[:mode] == "show"
|
||||||
|
seminar_main.session_show_ids = seminar_main.session_show_ids.to_a + Array(session_id)
|
||||||
|
else
|
||||||
|
render :json => {:success => false} and return
|
||||||
|
end
|
||||||
|
seminar_main.save
|
||||||
|
render :json => {:success => true}
|
||||||
|
end
|
||||||
|
end
|
||||||
def update_seminar_review
|
def update_seminar_review
|
||||||
if @seminar_review.nil?
|
if @seminar_review.nil?
|
||||||
render :json => {:success => false}
|
render :json => {:success => false}
|
||||||
|
@ -157,10 +221,12 @@ class Admin::SeminarsController < OrbitAdminController
|
||||||
@seminar_review.seminar_signup_ids << params[:signup_id]
|
@seminar_review.seminar_signup_ids << params[:signup_id]
|
||||||
@seminar_review.remove_seminar_signup_ids.delete(params[:signup_id])
|
@seminar_review.remove_seminar_signup_ids.delete(params[:signup_id])
|
||||||
seminar_main.unassigned_seminar_signup_ids.delete(params[:signup_id])
|
seminar_main.unassigned_seminar_signup_ids.delete(params[:signup_id])
|
||||||
|
seminar_main.unassigned_mode_1_seminar_signup_ids.delete(params[:signup_id])
|
||||||
elsif params[:mode] == "remove"
|
elsif params[:mode] == "remove"
|
||||||
@seminar_review.seminar_signup_ids.delete(params[:signup_id])
|
@seminar_review.seminar_signup_ids.delete(params[:signup_id])
|
||||||
@seminar_review.remove_seminar_signup_ids << params[:signup_id]
|
@seminar_review.remove_seminar_signup_ids << params[:signup_id]
|
||||||
seminar_main.unassigned_seminar_signup_ids << params[:signup_id]
|
seminar_main.unassigned_seminar_signup_ids << params[:signup_id]
|
||||||
|
seminar_main.unassigned_mode_1_seminar_signup_ids << params[:signup_id]
|
||||||
elsif params[:mode] == "hide"
|
elsif params[:mode] == "hide"
|
||||||
if seminar_main.reviewer_show_ids.nil?
|
if seminar_main.reviewer_show_ids.nil?
|
||||||
seminar_main.reviewer_show_ids = seminar_main.reviewer_ids[0..1]
|
seminar_main.reviewer_show_ids = seminar_main.reviewer_ids[0..1]
|
||||||
|
@ -190,7 +256,7 @@ class Admin::SeminarsController < OrbitAdminController
|
||||||
sort = {params[:sort].to_sym=>params[:order]}
|
sort = {params[:sort].to_sym=>params[:order]}
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
sort = {:signup_start_date=>"desc"}
|
sort = {:signup_start_date=>"desc",:created_at=>"desc"}
|
||||||
end
|
end
|
||||||
|
|
||||||
@seminars = SeminarMain.all.order_by(sort).with_categories(filters("category"))
|
@seminars = SeminarMain.all.order_by(sort).with_categories(filters("category"))
|
||||||
|
@ -222,8 +288,9 @@ class Admin::SeminarsController < OrbitAdminController
|
||||||
if can_see_seminar_signup(@seminar)
|
if can_see_seminar_signup(@seminar)
|
||||||
if !admin_for_seminar(@seminar)
|
if !admin_for_seminar(@seminar)
|
||||||
@seminar_review = @seminar.seminar_reviews.where(:reviewer_id => current_user.member_profile_id.to_s).first
|
@seminar_review = @seminar.seminar_reviews.where(:reviewer_id => current_user.member_profile_id.to_s).first
|
||||||
@seminar_signups = @seminar_signups.where(:id.in=>@seminar_review.all_seminar_signup_ids) rescue []
|
@seminar_signups = @seminar_signups.where(:id.in=>@seminar_review.get_all_seminar_signup_ids) rescue []
|
||||||
end
|
end
|
||||||
|
@seminar_signups = @seminar_signups.sort_ordered
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.xlsx {
|
format.xlsx {
|
||||||
response.headers['Content-Disposition'] = 'attachment; filename="' + filename + '"'
|
response.headers['Content-Disposition'] = 'attachment; filename="' + filename + '"'
|
||||||
|
@ -233,7 +300,16 @@ class Admin::SeminarsController < OrbitAdminController
|
||||||
render :nothing => true
|
render :nothing => true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
def copy
|
||||||
|
@seminar = SeminarMain.find(params[:id]).clone_new
|
||||||
|
@member = MemberProfile.where(:id.in=>@seminar.reviewer_ids).to_a
|
||||||
|
@email_set = @seminar.seminar_email_sets
|
||||||
|
@signup_sets = @seminar.seminar_signup_field_sets
|
||||||
|
@submission_set = @seminar.seminar_submission_field_sets
|
||||||
|
@custom_set = @seminar.seminar_signup_field_customs
|
||||||
|
@seminar_items = SeminarItem.all
|
||||||
|
@review = @seminar.seminar_reviews.first
|
||||||
|
end
|
||||||
def new
|
def new
|
||||||
@member = nil
|
@member = nil
|
||||||
@seminar = SeminarMain.new
|
@seminar = SeminarMain.new
|
||||||
|
@ -256,13 +332,34 @@ class Admin::SeminarsController < OrbitAdminController
|
||||||
seminar_signup_set_params = seminar_main_params['seminar_signup_field_sets']
|
seminar_signup_set_params = seminar_main_params['seminar_signup_field_sets']
|
||||||
seminar_submission_set_params = seminar_main_params['seminar_submission_field_sets']
|
seminar_submission_set_params = seminar_main_params['seminar_submission_field_sets']
|
||||||
seminar_email_sets_params = seminar_main_params['seminar_email_sets']
|
seminar_email_sets_params = seminar_main_params['seminar_email_sets']
|
||||||
|
seminar_signup_field_customs_params = seminar_main_params["seminar_signup_field_customs"].to_hash
|
||||||
|
seminar_main_params["seminar_signup_field_customs"].each do |k,v|
|
||||||
|
v.delete "title"
|
||||||
|
end
|
||||||
seminar_main_params.delete(:seminar_signup_field_sets)
|
seminar_main_params.delete(:seminar_signup_field_sets)
|
||||||
seminar_main_params.delete(:seminar_submission_field_sets)
|
seminar_main_params.delete(:seminar_submission_field_sets)
|
||||||
seminar_main_params.delete(:seminar_email_sets)
|
seminar_main_params.delete(:seminar_email_sets)
|
||||||
seminar = SeminarMain.new(seminar_main_params)
|
seminar = SeminarMain.new(seminar_main_params)
|
||||||
seminar.create_user_id = current_user.id
|
seminar.create_user_id = current_user.id
|
||||||
seminar.update_user_id = current_user.id
|
seminar.update_user_id = current_user.id
|
||||||
|
if seminar.copy_id && params["clone_signups"].blank?
|
||||||
|
seminar.except_clone_relations = ["seminar_signups","seminar_signup_values"]
|
||||||
|
end
|
||||||
seminar.save
|
seminar.save
|
||||||
|
if seminar.copy_id
|
||||||
|
seminar_signup_set_params.each do |key,value|
|
||||||
|
seminar.seminar_signup_field_sets[key.to_i].update_attributes(value) rescue nil
|
||||||
|
end
|
||||||
|
seminar_submission_set_params.each do |key,value|
|
||||||
|
seminar.seminar_submission_field_sets[key.to_i].update_attributes(value) rescue nil
|
||||||
|
end
|
||||||
|
seminar_email_sets_params.each do |key,value|
|
||||||
|
seminar.seminar_email_sets[key.to_i].update_attributes(value) rescue nil
|
||||||
|
end
|
||||||
|
seminar_signup_field_customs_params.each_with_index do |(key,value),i|
|
||||||
|
seminar.seminar_signup_field_customs[i].update(:seminar_signup_field_id => seminar.seminar_signup_fields.where(:title=>value["title"]).first.id) rescue nil
|
||||||
|
end
|
||||||
|
else
|
||||||
seminar_signup_set_params.each do |key,value|
|
seminar_signup_set_params.each do |key,value|
|
||||||
seminar.seminar_signup_field_sets.create(value)
|
seminar.seminar_signup_field_sets.create(value)
|
||||||
end
|
end
|
||||||
|
@ -272,6 +369,7 @@ class Admin::SeminarsController < OrbitAdminController
|
||||||
seminar_email_sets_params.each do |key,value|
|
seminar_email_sets_params.each do |key,value|
|
||||||
seminar.seminar_email_sets.create(value)
|
seminar.seminar_email_sets.create(value)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
redirect_to params['referer_url']
|
redirect_to params['referer_url']
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -393,8 +491,14 @@ class Admin::SeminarsController < OrbitAdminController
|
||||||
else
|
else
|
||||||
@seminar_signups = @seminar.seminar_signups.where(:name=>/#{params[:search]}/)
|
@seminar_signups = @seminar.seminar_signups.where(:name=>/#{params[:search]}/)
|
||||||
end
|
end
|
||||||
|
elsif params[:type] == "session"
|
||||||
|
@seminar_signups = @seminar.seminar_signups.where(:final_session => nil, :name=>/#{params[:search]}/)
|
||||||
else
|
else
|
||||||
@seminar_signups = SeminarSignup.where(:id.in => @seminar.unassigned_seminar_signup_ids, :name=>/#{params[:search]}/)
|
unassigned_seminar_signup_ids = @seminar.unassigned_seminar_signup_ids
|
||||||
|
if @seminar.assign_mode == 1
|
||||||
|
unassigned_seminar_signup_ids = @seminar.unassigned_mode_1_seminar_signup_ids
|
||||||
|
end
|
||||||
|
@seminar_signups = @seminar.seminar_signups.where(:id.in => unassigned_seminar_signup_ids, :name=>/#{params[:search]}/)
|
||||||
end
|
end
|
||||||
OrbitHelper.set_params(params,current_user)
|
OrbitHelper.set_params(params,current_user)
|
||||||
@access_level = OrbitHelper.user_access_level?
|
@access_level = OrbitHelper.user_access_level?
|
||||||
|
@ -407,7 +511,7 @@ class Admin::SeminarsController < OrbitAdminController
|
||||||
end
|
end
|
||||||
unless @can_edit
|
unless @can_edit
|
||||||
@seminar_review = @seminar.seminar_reviews.where(:reviewer_id => current_user.member_profile_id.to_s).first
|
@seminar_review = @seminar.seminar_reviews.where(:reviewer_id => current_user.member_profile_id.to_s).first
|
||||||
@seminar_signups = @seminar.seminar_signups.where(:id.in=>@seminar_review.all_seminar_signup_ids)
|
@seminar_signups = @seminar.seminar_signups.where(:id.in=>@seminar_review.get_all_seminar_signup_ids)
|
||||||
end
|
end
|
||||||
@seminar_signups = @seminar_signups.sort_ordered.page(params[:page]).per(10)
|
@seminar_signups = @seminar_signups.sort_ordered.page(params[:page]).per(10)
|
||||||
if request.xhr?
|
if request.xhr?
|
||||||
|
@ -422,15 +526,17 @@ class Admin::SeminarsController < OrbitAdminController
|
||||||
def update_seminar_signup_admin_setting
|
def update_seminar_signup_admin_setting
|
||||||
@seminar_signup_admin_setting.update_attributes(params.require(:seminar_signup_admin_setting).permit!)
|
@seminar_signup_admin_setting.update_attributes(params.require(:seminar_signup_admin_setting).permit!)
|
||||||
if params[:id] != "enquiry_for_applicants"
|
if params[:id] != "enquiry_for_applicants"
|
||||||
redirect_to seminar_signup_admin_seminar_path(params[:id])
|
redirect_to seminar_signup_admin_seminar_path(params[:id]) + "?type=#{params[:page]}"
|
||||||
else
|
else
|
||||||
redirect_to admin_seminar_enquiry_for_applicants_path
|
redirect_to admin_seminar_enquiry_for_applicants_path
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
def set_seminar_signup_admin_setting
|
def set_seminar_signup_admin_setting
|
||||||
@seminar_signup_admin_setting = SeminarSignupAdminSetting.where(:seminar_main_id=>params[:id]).first
|
page = params[:type] || params[:page]
|
||||||
|
page = nil if page.blank?
|
||||||
|
@seminar_signup_admin_setting = SeminarSignupAdminSetting.where(:seminar_main_id=>params[:id],:page=>page).first
|
||||||
if @seminar_signup_admin_setting.nil?
|
if @seminar_signup_admin_setting.nil?
|
||||||
@seminar_signup_admin_setting = SeminarSignupAdminSetting.create(:seminar_main_id=>params[:id])
|
@seminar_signup_admin_setting = SeminarSignupAdminSetting.create(:seminar_main_id=>params[:id],:page=>page)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
def edit_seminar_signup
|
def edit_seminar_signup
|
||||||
|
@ -456,6 +562,8 @@ class Admin::SeminarsController < OrbitAdminController
|
||||||
if params[:action] == "update_seminar_review"
|
if params[:action] == "update_seminar_review"
|
||||||
@seminar_review = SeminarReview.find(params[:id]) rescue nil
|
@seminar_review = SeminarReview.find(params[:id]) rescue nil
|
||||||
@seminar = @seminar_review.seminar_main
|
@seminar = @seminar_review.seminar_main
|
||||||
|
elsif params[:action] == "update_seminar_session"
|
||||||
|
@seminar_signup = SeminarSignup.find(params[:signup_id]) rescue nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -464,7 +572,7 @@ class Admin::SeminarsController < OrbitAdminController
|
||||||
end
|
end
|
||||||
def create_set (save_flag)
|
def create_set (save_flag)
|
||||||
SeminarSignup.attribute_names.each do |attr_signup|
|
SeminarSignup.attribute_names.each do |attr_signup|
|
||||||
if !(['_id', 'created_at', 'updated_at','seminar_main_id'].include? attr_signup)
|
if !(['_id', 'created_at', 'updated_at','seminar_main_id','final_session','seminar_session_id'].include? attr_signup)
|
||||||
signup_set = @seminar.seminar_signup_field_sets.select{|v| v.field_name==attr_signup }
|
signup_set = @seminar.seminar_signup_field_sets.select{|v| v.field_name==attr_signup }
|
||||||
if signup_set.length==0
|
if signup_set.length==0
|
||||||
if ['status','name','tel','phone','email','password'].include? attr_signup
|
if ['status','name','tel','phone','email','password'].include? attr_signup
|
||||||
|
|
|
@ -39,12 +39,12 @@ module Admin::SeminarsFieldHelper
|
||||||
|
|
||||||
add_ext= @attribute_value.address_key[key] rescue {}
|
add_ext= @attribute_value.address_key[key] rescue {}
|
||||||
|
|
||||||
result << hidden_field_tag(get_basic_field_name_base+"[address_key][#{key}][county]",add_ext["county"],:class=>"county_#{key}")
|
result << hidden_field_tag(get_basic_field_name_base+"[address_key][#{key}][county]",add_ext["county"],:class=>"county_#{key}", :id=>nil)
|
||||||
result << hidden_field_tag(get_basic_field_name_base+"[address_key][#{key}][street_address]",add_ext["street_address"],:class=>"street_address_#{key}")
|
result << hidden_field_tag(get_basic_field_name_base+"[address_key][#{key}][street_address]",add_ext["street_address"],:class=>"street_address_#{key}", :id=>nil)
|
||||||
result << hidden_field_tag(get_basic_field_name_base+"[address_key][#{key}][city]",add_ext["city"],:class=>"city_#{key}")
|
result << hidden_field_tag(get_basic_field_name_base+"[address_key][#{key}][city]",add_ext["city"],:class=>"city_#{key}", :id=>nil)
|
||||||
result << hidden_field_tag(get_basic_field_name_base+"[address_key][#{key}][zip]",add_ext["zip"],:class=>"zip_#{key}")
|
result << hidden_field_tag(get_basic_field_name_base+"[address_key][#{key}][zip]",add_ext["zip"],:class=>"zip_#{key}", :id=>nil)
|
||||||
result << hidden_field_tag(get_basic_field_name_base+"[address_key][#{key}][country]",add_ext["country"],:class=>"country_#{key}")
|
result << hidden_field_tag(get_basic_field_name_base+"[address_key][#{key}][country]",add_ext["country"],:class=>"country_#{key}", :id=>nil)
|
||||||
result << hidden_field_tag(get_basic_field_name_base+"[address_key][#{key}][indicator]",add_ext["indicator"],:class=>"indicator_#{key}")
|
result << hidden_field_tag(get_basic_field_name_base+"[address_key][#{key}][indicator]",add_ext["indicator"],:class=>"indicator_#{key}", :id=>nil)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ protected
|
||||||
if self.markup=='text_area' #or self.markup=='address'
|
if self.markup=='text_area' #or self.markup=='address'
|
||||||
tmp1 = valid_locales.collect do |key|
|
tmp1 = valid_locales.collect do |key|
|
||||||
if !@prefiled_value.nil?
|
if !@prefiled_value.nil?
|
||||||
value = @prefiled_value[key] rescue nil
|
value = @prefiled_value[key] || @prefiled_value[key.to_s] rescue nil
|
||||||
else
|
else
|
||||||
value = nil
|
value = nil
|
||||||
end
|
end
|
||||||
|
@ -203,7 +203,6 @@ protected
|
||||||
div_class_ary = ["tab-pane" ,"fade"]
|
div_class_ary = ["tab-pane" ,"fade"]
|
||||||
if @show_set_field && @markup=='text_area'
|
if @show_set_field && @markup=='text_area'
|
||||||
div_id = "ckeditor_#{get_pairing_tab_class({})}_#{key}"
|
div_id = "ckeditor_#{get_pairing_tab_class({})}_#{key}"
|
||||||
puts 'ckeditor_'
|
|
||||||
else
|
else
|
||||||
div_id = "#{get_pairing_tab_class({})}_#{key}"
|
div_id = "#{get_pairing_tab_class({})}_#{key}"
|
||||||
end
|
end
|
||||||
|
@ -245,7 +244,7 @@ protected
|
||||||
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|
|
||||||
value = @prefiled_value[key] rescue nil
|
value = @prefiled_value[key] || @prefiled_value[key.to_s] rescue nil
|
||||||
# div_class_ary = ["tab-pane" ,"fade","#{get_pairing_tab_class({})}_#{key}"]
|
# div_class_ary = ["tab-pane" ,"fade","#{get_pairing_tab_class({})}_#{key}"]
|
||||||
div_class_ary = ["tab-pane" ,"fade"]
|
div_class_ary = ["tab-pane" ,"fade"]
|
||||||
|
|
||||||
|
@ -380,8 +379,8 @@ protected
|
||||||
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? ? '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? ? 'textLengInput' : 'textInput' } btn btn-small btn-primary"
|
||||||
content << hidden_field_tag("#{temp_field_name}[count]",@attribute_value.add_more_counter ,:class=>"list_count")
|
content << hidden_field_tag("#{temp_field_name}[count]",@attribute_value.add_more_counter ,:class=>"list_count", :id=>nil)
|
||||||
content << hidden_field_tag("#{temp_field_name}[count]",get_basic_field_name_base,:class=>"field_name")
|
content << hidden_field_tag("#{temp_field_name}[count]",get_basic_field_name_base,:class=>"field_name", :id=>nil)
|
||||||
content
|
content
|
||||||
end # of div
|
end # of div
|
||||||
# add_more = content_tag :div,:class=> 'controls' do
|
# add_more = content_tag :div,:class=> 'controls' do
|
||||||
|
@ -396,9 +395,9 @@ protected
|
||||||
|
|
||||||
def end_block
|
def end_block
|
||||||
if @new_attribute
|
if @new_attribute
|
||||||
hidden_field_tag(get_basic_field_name_base+"[#{get_basic_field_name}_id]",id,:for=>"field_#{@index}")
|
hidden_field_tag(get_basic_field_name_base+"[#{get_basic_field_name}_id]",id,:for=>"field_#{@index}", :id=>nil)
|
||||||
else
|
else
|
||||||
hidden_field_tag(get_basic_field_name_base+"[id]",@attribute_value.id,:for=>"field_#{@index}")
|
hidden_field_tag(get_basic_field_name_base+"[id]",@attribute_value.id,:for=>"field_#{@index}", :id=>nil)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -495,8 +494,12 @@ protected
|
||||||
''
|
''
|
||||||
end
|
end
|
||||||
def self.end_block
|
def self.end_block
|
||||||
|
unless @attribute_value.new_record?
|
||||||
hidden_field_tag("seminar_main[#{@key_field}][#{@key_index}]"+"[id]",
|
hidden_field_tag("seminar_main[#{@key_field}][#{@key_index}]"+"[id]",
|
||||||
@attribute_value.id,:for=>"field_#{@key_index}")
|
@attribute_value.id,:for=>"field_#{@key_index}", :id=>nil)
|
||||||
|
else
|
||||||
|
""
|
||||||
|
end
|
||||||
end
|
end
|
||||||
@key_field = key_field
|
@key_field = key_field
|
||||||
@field = field
|
@field = field
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
class SeminarMain
|
class SeminarMain
|
||||||
|
require 'fileutils'
|
||||||
include Mongoid::Document
|
include Mongoid::Document
|
||||||
include Mongoid::Timestamps
|
include Mongoid::Timestamps
|
||||||
|
|
||||||
|
@ -7,6 +8,8 @@ class SeminarMain
|
||||||
include OrbitCategory::Categorizable
|
include OrbitCategory::Categorizable
|
||||||
include Slug
|
include Slug
|
||||||
ChoiceTypes = ["checkbox","radio","select"]
|
ChoiceTypes = ["checkbox","radio","select"]
|
||||||
|
field :copy_id
|
||||||
|
field :except_clone_relations, :type=>Array, :default => []
|
||||||
field :signup_note, localize: true
|
field :signup_note, localize: true
|
||||||
field :title, as: :slug_title, type: String, localize: true
|
field :title, as: :slug_title, type: String, localize: true
|
||||||
field :speaker, localize: true
|
field :speaker, localize: true
|
||||||
|
@ -36,12 +39,16 @@ class SeminarMain
|
||||||
field :update_user_id
|
field :update_user_id
|
||||||
field :reviewer_ids
|
field :reviewer_ids
|
||||||
field :reviewer_show_ids
|
field :reviewer_show_ids
|
||||||
|
field :session_show_ids
|
||||||
field :unassigned_seminar_signup_ids
|
field :unassigned_seminar_signup_ids
|
||||||
|
field :unassigned_mode_1_seminar_signup_ids
|
||||||
field :review_start_date, :type => Date
|
field :review_start_date, :type => Date
|
||||||
field :review_end_date, :type => Date
|
field :review_end_date, :type => Date
|
||||||
field :last_serial_number, :type => Integer, :default => 0
|
field :last_serial_number, :type => Integer, :default => 0
|
||||||
|
field :assign_mode, :type => Integer, :default => 0 # 0 => 用default signup ids來分配 ,1 => 用final_session來分配
|
||||||
belongs_to :seminar_item
|
belongs_to :seminar_item
|
||||||
belongs_to :organizer , :class_name=>"MemberProfile", :foreign_key => :organizer_id
|
belongs_to :organizer , :class_name=>"MemberProfile", :foreign_key => :organizer_id
|
||||||
|
has_many :seminar_sessions, :autosave => true, :dependent => :destroy
|
||||||
has_many :seminar_links, :autosave => true, :dependent => :destroy
|
has_many :seminar_links, :autosave => true, :dependent => :destroy
|
||||||
has_many :seminar_files, :autosave => true, :dependent => :destroy
|
has_many :seminar_files, :autosave => true, :dependent => :destroy
|
||||||
has_many :seminar_item_contents, :autosave => true, :dependent => :destroy
|
has_many :seminar_item_contents, :autosave => true, :dependent => :destroy
|
||||||
|
@ -53,6 +60,7 @@ class SeminarMain
|
||||||
has_many :seminar_submission_field_sets, autosave: true, dependent: :destroy
|
has_many :seminar_submission_field_sets, autosave: true, dependent: :destroy
|
||||||
has_many :seminar_email_sets, autosave: true, dependent: :destroy
|
has_many :seminar_email_sets, autosave: true, dependent: :destroy
|
||||||
has_many :seminar_signup_field_customs, :autosave => true, :dependent => :destroy
|
has_many :seminar_signup_field_customs, :autosave => true, :dependent => :destroy
|
||||||
|
accepts_nested_attributes_for :seminar_sessions, :allow_destroy => true
|
||||||
accepts_nested_attributes_for :seminar_links, :allow_destroy => true
|
accepts_nested_attributes_for :seminar_links, :allow_destroy => true
|
||||||
accepts_nested_attributes_for :seminar_files, :allow_destroy => true
|
accepts_nested_attributes_for :seminar_files, :allow_destroy => true
|
||||||
accepts_nested_attributes_for :seminar_item_contents, :allow_destroy => true
|
accepts_nested_attributes_for :seminar_item_contents, :allow_destroy => true
|
||||||
|
@ -68,7 +76,7 @@ class SeminarMain
|
||||||
module_app_key = "seminar"
|
module_app_key = "seminar"
|
||||||
add_module_app_member_ids = []
|
add_module_app_member_ids = []
|
||||||
remove_module_app_member_ids = []
|
remove_module_app_member_ids = []
|
||||||
if self.reviewer_ids_changed?
|
if self.reviewer_ids_changed? && (self.copy_id.nil? || !self.new_record?)
|
||||||
new_reviewer_ids = self.reviewer_ids.to_a - self.reviewer_ids_was.to_a
|
new_reviewer_ids = self.reviewer_ids.to_a - self.reviewer_ids_was.to_a
|
||||||
remove_reviewer_ids = self.reviewer_ids_was.to_a - self.reviewer_ids.to_a
|
remove_reviewer_ids = self.reviewer_ids_was.to_a - self.reviewer_ids.to_a
|
||||||
new_reviewer_ids.each do |reviewer_id|
|
new_reviewer_ids.each do |reviewer_id|
|
||||||
|
@ -81,9 +89,12 @@ class SeminarMain
|
||||||
end
|
end
|
||||||
unassigned_seminar_signup_ids = self.seminar_signup_ids.map{|s| s.to_s}
|
unassigned_seminar_signup_ids = self.seminar_signup_ids.map{|s| s.to_s}
|
||||||
seminar_reviews = self.seminar_reviews
|
seminar_reviews = self.seminar_reviews
|
||||||
|
unassigned_mode_1_seminar_signup_ids = unassigned_seminar_signup_ids.dup
|
||||||
seminar_reviews.each do |sr|
|
seminar_reviews.each do |sr|
|
||||||
|
unassigned_mode_1_seminar_signup_ids = unassigned_mode_1_seminar_signup_ids - sr.get_all_seminar_signup_ids(1)
|
||||||
unassigned_seminar_signup_ids = unassigned_seminar_signup_ids - sr.all_seminar_signup_ids
|
unassigned_seminar_signup_ids = unassigned_seminar_signup_ids - sr.all_seminar_signup_ids
|
||||||
end
|
end
|
||||||
|
self.unassigned_mode_1_seminar_signup_ids = unassigned_mode_1_seminar_signup_ids
|
||||||
self.unassigned_seminar_signup_ids = unassigned_seminar_signup_ids
|
self.unassigned_seminar_signup_ids = unassigned_seminar_signup_ids
|
||||||
end
|
end
|
||||||
if self.organizer_id_changed?
|
if self.organizer_id_changed?
|
||||||
|
@ -114,9 +125,50 @@ class SeminarMain
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if self.enable_summary_choice
|
||||||
|
(0...self.summary_chioices.count).to_a.each do |i|
|
||||||
|
seminar_session = self.seminar_sessions.where(:key=>i).first
|
||||||
|
if seminar_session.nil?
|
||||||
|
self.seminar_sessions << SeminarSession.new(:key=>i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
(self.summary_chioices.count...self.summary_chioices_was.to_a.count).to_a.each do |i|
|
||||||
|
self.seminar_sessions.where(:key=>i).destroy
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
before_create do
|
before_create do
|
||||||
self.unassigned_seminar_signup_ids = []
|
self.unassigned_seminar_signup_ids = []
|
||||||
|
self.unassigned_mode_1_seminar_signup_ids = []
|
||||||
|
if self.copy_id.present?
|
||||||
|
clone_new(true)
|
||||||
|
self.created_at = DateTime.now
|
||||||
|
self.updated_at = DateTime.now
|
||||||
|
end
|
||||||
|
end
|
||||||
|
after_create do
|
||||||
|
if self.copy_id.present?
|
||||||
|
self.seminar_signup_fields.each do |seminar_signup_field|
|
||||||
|
seminar_signup_field.seminar_signup_values.update_all(:key=>seminar_signup_field.key)
|
||||||
|
end
|
||||||
|
self.seminar_submission_fields.each do |seminar_submission_field|
|
||||||
|
seminar_submission_field.seminar_submission_values.update_all(:key=>seminar_submission_field.key)
|
||||||
|
end
|
||||||
|
current_reviewer_ids = self.reviewer_ids.to_a
|
||||||
|
self.seminar_reviews.where(:reviewer_id.nin=>current_reviewer_ids).destroy
|
||||||
|
module_app_key = "seminar"
|
||||||
|
current_reviewer_ids.each do |reviewer_id|
|
||||||
|
seminar_review = self.seminar_reviews.select{|sr| sr.reviewer_id == reviewer_id}.first
|
||||||
|
if seminar_review.nil?
|
||||||
|
self.seminar_reviews << SeminarReview.create(:reviewer_id=>reviewer_id,:seminar_main=>self)
|
||||||
|
user = User.where(:member_profile_id=>reviewer_id).first
|
||||||
|
if user.present?
|
||||||
|
user.extra_link_module_app_keys << module_app_key
|
||||||
|
user.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
after_initialize do
|
after_initialize do
|
||||||
unless self.new_record?
|
unless self.new_record?
|
||||||
|
@ -128,10 +180,11 @@ class SeminarMain
|
||||||
save_flag = true
|
save_flag = true
|
||||||
end
|
end
|
||||||
if seminar_reviews.count != 0 && self.review_start_date.nil? && self.review_end_date.nil?
|
if seminar_reviews.count != 0 && self.review_start_date.nil? && self.review_end_date.nil?
|
||||||
seminar_review = seminar_reviews.first
|
review_start_date = seminar_reviews.pluck(:review_start_date).select{|t| t.present?}.first.to_datetime rescue nil
|
||||||
self.review_start_date = seminar_review.review_start_date rescue nil
|
review_end_date = seminar_reviews.pluck(:review_end_date).select{|t| t.present?}.first.to_datetime rescue nil
|
||||||
self.review_end_date = seminar_review.review_end_date rescue nil
|
self.review_start_date = review_start_date
|
||||||
unless (self.review_start_date.nil? && self.review_end_date.nil?)
|
self.review_end_date = review_end_date
|
||||||
|
if (self.review_start_date_changed? || self.review_end_date_changed?)
|
||||||
save_flag = true
|
save_flag = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -140,6 +193,10 @@ class SeminarMain
|
||||||
self.unassigned_seminar_signup_ids = self.seminar_signup_ids.map{|s| s.to_s}
|
self.unassigned_seminar_signup_ids = self.seminar_signup_ids.map{|s| s.to_s}
|
||||||
save_flag = true
|
save_flag = true
|
||||||
end
|
end
|
||||||
|
if self.unassigned_mode_1_seminar_signup_ids.nil?
|
||||||
|
self.unassigned_mode_1_seminar_signup_ids = self.seminar_signup_ids.map{|s| s.to_s}
|
||||||
|
save_flag = true
|
||||||
|
end
|
||||||
unless self.last_serial_number_changed_from_default?
|
unless self.last_serial_number_changed_from_default?
|
||||||
self.seminar_signups.sort_ordered.each do |ss|
|
self.seminar_signups.sort_ordered.each do |ss|
|
||||||
if ss.serial_number.nil?
|
if ss.serial_number.nil?
|
||||||
|
@ -150,7 +207,7 @@ class SeminarMain
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
self.save if save_flag
|
self.save(:validate=>false) if save_flag
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
def self.time_range(date1 = null, date2 = null)
|
def self.time_range(date1 = null, date2 = null)
|
||||||
|
@ -184,5 +241,208 @@ class SeminarMain
|
||||||
value = values.detect {|value| value.seminar_signup_field_id == field_id} rescue nil
|
value = values.detect {|value| value.seminar_signup_field_id == field_id} rescue nil
|
||||||
value ? value : nil
|
value ? value : nil
|
||||||
end
|
end
|
||||||
|
def clone_new(clone_mode=false)
|
||||||
|
@records_all = {}
|
||||||
|
if clone_mode
|
||||||
|
clone_target = self.class.find(object.copy_id) rescue nil
|
||||||
|
else
|
||||||
|
clone_target = self
|
||||||
|
end
|
||||||
|
seminar,clone_target = clone_new_for_object(self,clone_target,clone_mode)
|
||||||
|
if clone_mode
|
||||||
|
copy_settings = SeminarSignupAdminSetting.where(:seminar_main_id=>clone_target.id.to_s).to_a
|
||||||
|
copy_settings.each do |setting|
|
||||||
|
new_setting = setting.dup
|
||||||
|
new_setting.seminar_main_id = seminar.id.to_s
|
||||||
|
new_setting.save
|
||||||
|
end
|
||||||
|
count_array = (0...self.seminar_sessions.to_a.count).to_a
|
||||||
|
count_array.each do |i|
|
||||||
|
seminar_session = self.seminar_sessions[i]
|
||||||
|
seminar_session.seminar_signup_ids = map_seminar_signup_ids(seminar_session.seminar_signup_ids)
|
||||||
|
end
|
||||||
|
self.unassigned_seminar_signup_ids = map_seminar_signup_ids(clone_target.unassigned_seminar_signup_ids)
|
||||||
|
self.unassigned_mode_1_seminar_signup_ids = map_seminar_signup_ids(clone_target.unassigned_mode_1_seminar_signup_ids)
|
||||||
|
|
||||||
|
need_change_seminar_signups = self.seminar_signups.where(:seminar_session_id.ne=>nil).to_a
|
||||||
|
count_array = (0...need_change_seminar_signups.count).to_a
|
||||||
|
count_array.each do |i|
|
||||||
|
seminar_signup = need_change_seminar_signups[i]
|
||||||
|
if seminar_signup.seminar_session_id.present?
|
||||||
|
seminar_signup.seminar_session_id = @records_all["seminar_session_ids"][seminar_signup.seminar_session_id] rescue nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
count_array = (0...self.seminar_reviews.to_a.count).to_a
|
||||||
|
change_fields = [:seminar_signup_ids, :remove_seminar_signup_ids, :default_seminar_signup_ids]
|
||||||
|
count_array.each do |i|
|
||||||
|
seminar_review = self.seminar_reviews[i]
|
||||||
|
change_fields.each do |f|
|
||||||
|
seminar_review.send("#{f}=",map_seminar_signup_ids( seminar_review.send(f)))
|
||||||
|
end
|
||||||
|
seminar_review.seminar_session_ids = seminar_review.seminar_session_ids.map{|seminar_session_id| @records_all["seminar_session_ids"][seminar_session_id] rescue nil}.select{|id| !id.nil?}
|
||||||
|
seminar_review.default_topics = seminar_review.default_topics.map do |default_topic|
|
||||||
|
fn,id = default_topic.split(".")
|
||||||
|
if fn == "seminar_signup_fields"
|
||||||
|
id = @records_all["seminar_signup_field_ids"][BSON::ObjectId(id)].to_s rescue nil
|
||||||
|
elsif fn == "seminar_submission_fields"
|
||||||
|
id = @records_all["seminar_submission_field_ids"][BSON::ObjectId(id)].to_s rescue nil
|
||||||
|
end
|
||||||
|
"#{fn}.#{id}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
seminar
|
||||||
|
end
|
||||||
|
end
|
||||||
|
def map_seminar_signup_ids(old_seminar_signup_ids)
|
||||||
|
if @records_all["seminar_signup_ids"].present?
|
||||||
|
old_seminar_signup_ids.map{|seminar_signup_id| @records_all["seminar_signup_ids"][BSON::ObjectId(seminar_signup_id)]}
|
||||||
|
else
|
||||||
|
[]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
def clone_new_for_object(object,clone_target=nil,clone_mode=false)
|
||||||
|
if clone_mode
|
||||||
|
new_object = object
|
||||||
|
clone_target = object.class.find(object.copy_id) rescue nil if clone_target.nil?
|
||||||
|
else
|
||||||
|
clone_target = object if clone_target.nil?
|
||||||
|
new_object = object.dup
|
||||||
|
end
|
||||||
|
@records_all["#{new_object.class.to_s.underscore.singularize}_ids"] = {} if @records_all["#{new_object.class.to_s.underscore.singularize}_ids"].nil?
|
||||||
|
begin
|
||||||
|
@records_all["#{new_object.class.to_s.underscore.singularize}_ids"][clone_target.id] = object.id
|
||||||
|
rescue
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
if !clone_target.nil? && !new_object.nil?
|
||||||
|
initialize_fields = ["uid","created_at","updated_at"]
|
||||||
|
initialize_fields.each do |f|
|
||||||
|
new_object.send("#{f}=",nil) if new_object.fields.keys.include?(f)
|
||||||
|
end
|
||||||
|
relations_fields = clone_target.relations.except("impressions").keys
|
||||||
|
all_fields = clone_target.fields.keys - relations_fields
|
||||||
|
all_fields = all_fields - relations_fields.map{|k| "#{k}_id"}
|
||||||
|
all_fields = all_fields - relations_fields.map{|k| "#{k.singularize}_ids"}
|
||||||
|
new_object_class_name = new_object.class.to_s.underscore
|
||||||
|
relations_fields = clone_target.relations.except("impressions").keys
|
||||||
|
unsort_relation_keys = clone_target.relations.keys
|
||||||
|
unless @parent_level
|
||||||
|
fields_to_delete = [new_object_class_name]
|
||||||
|
tmp_relations_fields = [new_object_class_name]
|
||||||
|
while relations_fields.count > 0
|
||||||
|
tmp_singularize_relations_fields = tmp_relations_fields.map{|f| f.singularize}
|
||||||
|
approve_append = nil
|
||||||
|
relations_fields.each do |k|
|
||||||
|
belongs_to_class = clone_target.relations[k].class_name.constantize.relations.select{|k,v| v.macro == :belongs_to}.keys
|
||||||
|
has_many_class = clone_target.relations[k].class_name.constantize.relations.select{|k,v| v.macro == :has_many}.keys
|
||||||
|
if (belongs_to_class - tmp_singularize_relations_fields).count == 0
|
||||||
|
other_has_many_class = (has_many_class - unsort_relation_keys)
|
||||||
|
if other_has_many_class.count == 0
|
||||||
|
tmp_relations_fields << k
|
||||||
|
else
|
||||||
|
result = other_has_many_class.map do |k|
|
||||||
|
belongs_to_class = k.classify.constantize.relations.select{|kk,v| v.macro == :belongs_to}.keys
|
||||||
|
has_many_class = k.classify.constantize.relations.select{|kk,v| v.macro == :has_many}.keys
|
||||||
|
if (belongs_to_class - tmp_singularize_relations_fields).count == 0
|
||||||
|
true
|
||||||
|
else
|
||||||
|
fields_to_delete = fields_to_delete.concat(belongs_to_class)
|
||||||
|
tmp_relations_fields.concat(belongs_to_class)
|
||||||
|
false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if result.select{|t| !t}.count == 0
|
||||||
|
if (fields_to_delete.map{|f| f.pluralize} - tmp_relations_fields).count == 0
|
||||||
|
tmp_relations_fields << k
|
||||||
|
elsif clone_target.relations[k].class_name.constantize.fields.keys.include?("key")
|
||||||
|
tmp_relations_fields << k
|
||||||
|
elsif (clone_target.relations[k].class_name.constantize.relations.keys.map{|f| f.singularize} & fields_to_delete).count != 0
|
||||||
|
approve_append = k
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
elsif !unsort_relation_keys.include?(clone_target.relations[k].class_name.underscore) && !unsort_relation_keys.include?(clone_target.relations[k].class_name.underscore.pluralize)
|
||||||
|
tmp_relations_fields << k
|
||||||
|
end
|
||||||
|
end
|
||||||
|
tmp_relations_fields << approve_append if approve_append.present?
|
||||||
|
approve_append = nil
|
||||||
|
relations_fields = relations_fields - tmp_relations_fields
|
||||||
|
end
|
||||||
|
relations_fields = tmp_relations_fields
|
||||||
|
fields_to_delete.each{|f| relations_fields.delete(f)}
|
||||||
|
end
|
||||||
|
@parent_level = true
|
||||||
|
if clone_mode
|
||||||
|
all_fields.each do |f|
|
||||||
|
next if f == "uid"
|
||||||
|
unless new_object.send("#{f}_changed?") && new_object.send("#{f}_changed_from_default?")
|
||||||
|
new_object.send("#{f}=",clone_target.send(f))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
relations_fields.each do |f|
|
||||||
|
no_dup_flag = false
|
||||||
|
if clone_target.relations[f].macro == :belongs_to
|
||||||
|
no_dup_flag = new_object.send(f).present?
|
||||||
|
elsif clone_target.relations[f].macro == :has_many
|
||||||
|
no_dup_flag = new_object.send(f).to_a.count != 0
|
||||||
|
end
|
||||||
|
if clone_target.relations[f].macro == :belongs_to || clone_target.relations[f].class_name == "MemberProfile"
|
||||||
|
if @records_all["#{f}_ids"].nil?
|
||||||
|
new_object.send("#{f}_id=",clone_target.send("#{f}_id"))
|
||||||
|
else
|
||||||
|
new_object.send("#{f}_id=",(@records_all["#{f}_ids"][clone_target.send("#{f}_id")]))
|
||||||
|
end
|
||||||
|
elsif clone_target.relations[f].macro == :has_many
|
||||||
|
next if self.except_clone_relations.include?(f)
|
||||||
|
clone_relations = []
|
||||||
|
need_clone_relations = clone_target.send(f).asc(:_id).to_a
|
||||||
|
file_flag = false
|
||||||
|
need_clone_relations.each_with_index do |r,i|
|
||||||
|
clone_relation = new_object.send(f)[i]
|
||||||
|
clone_relation = r.dup if clone_relation.nil?
|
||||||
|
initialize_fields.each do |f|
|
||||||
|
clone_relation.send("#{f}=",nil) if clone_relation.fields.keys.include?(f)
|
||||||
|
end
|
||||||
|
check_fields = clone_relation.fields.except(initialize_fields)
|
||||||
|
check_fields.keys.each do |f|
|
||||||
|
if (clone_relation.send(f).class.to_s.match(/uploader/i) rescue false)
|
||||||
|
if clone_relation[f].blank?
|
||||||
|
clone_relation[f] = r[f]
|
||||||
|
source_filepath = r.send(f).file.file
|
||||||
|
if clone_mode
|
||||||
|
dest_filepath = clone_relation.send(f).file.file
|
||||||
|
FileUtils.mkdir_p(File.dirname(dest_filepath))
|
||||||
|
FileUtils.cp(source_filepath,dest_filepath)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
file_flag = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
clone_relations << clone_relation
|
||||||
|
end
|
||||||
|
if !no_dup_flag || (no_dup_flag && file_flag)
|
||||||
|
new_object_relations = new_object.send(f).to_a
|
||||||
|
if new_object_relations.count != 0
|
||||||
|
if clone_relations.count > new_object_relations.count
|
||||||
|
clone_relations = clone_relations[0...new_object_relations.count]
|
||||||
|
else
|
||||||
|
clone_relations = clone_relations.concat(new_object.send(f)[clone_relations.count...new_object_relations.count])
|
||||||
|
end
|
||||||
|
new_object.send("#{f}=",clone_relations)
|
||||||
|
else
|
||||||
|
new_object.send("#{f}=",clone_relations)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
count_array = (0...new_object.send(f).to_a.count).to_a
|
||||||
|
count_array.each do |i|
|
||||||
|
clone_new_for_object(new_object.send(f)[i],need_clone_relations[i],true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
new_object.copy_id = clone_target.id if new_object.fields.keys.include?("copy_id")
|
||||||
|
return new_object, clone_target
|
||||||
|
end
|
||||||
end
|
end
|
|
@ -13,21 +13,41 @@ class SeminarReview
|
||||||
field :default_seminar_signup_ids, :type => Array, :default => []
|
field :default_seminar_signup_ids, :type => Array, :default => []
|
||||||
field :default_topics, :type => Array, :default => []
|
field :default_topics, :type => Array, :default => []
|
||||||
field :default_topics_values, :type => Array, :default => []
|
field :default_topics_values, :type => Array, :default => []
|
||||||
|
field :final_session
|
||||||
|
field :session_ids
|
||||||
|
field :seminar_session_ids
|
||||||
belongs_to :seminar_main
|
belongs_to :seminar_main
|
||||||
after_initialize do
|
after_initialize do
|
||||||
unless self.new_record?
|
unless self.new_record?
|
||||||
|
save_flag = false
|
||||||
if (self.reviewer_id.class == Array rescue false)
|
if (self.reviewer_id.class == Array rescue false)
|
||||||
reviewer_ids = self.reviewer_id[1..-1]
|
reviewer_ids = self.reviewer_id[1..-1]
|
||||||
reviewer_ids.each do |reviewer_id|
|
reviewer_ids.each do |reviewer_id|
|
||||||
self.class.create(:reviewer_id=>reviewer_id,:seminar_main=>self.seminar_main)
|
self.class.create(:reviewer_id=>reviewer_id,:seminar_main=>self.seminar_main)
|
||||||
end
|
end
|
||||||
self.reviewer_id = self.reviewer_id.first
|
self.reviewer_id = self.reviewer_id.first
|
||||||
self.save
|
save_flag = true
|
||||||
end
|
end
|
||||||
|
if (self.session_ids.nil? rescue true)
|
||||||
|
session_ids = []
|
||||||
|
self.default_topics.each_with_index do |t,i|
|
||||||
|
next if t != "seminar_signup_contributes.description"
|
||||||
|
session_ids << self.default_topics_values[i]
|
||||||
|
end
|
||||||
|
session_ids = session_ids.flatten.map{|i| i.to_i}
|
||||||
|
self.session_ids = session_ids
|
||||||
|
save_flag = true
|
||||||
|
end
|
||||||
|
if self.seminar_session_ids.nil? && self.session_ids.class == Array
|
||||||
|
self.seminar_session_ids = self.seminar_main.seminar_sessions.where(:key.in=>self.session_ids).pluck(:id) rescue nil
|
||||||
|
save_flag = true
|
||||||
|
end
|
||||||
|
self.save(:validate=>false) if save_flag
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
before_save do
|
before_save do
|
||||||
default_seminar_signup_ids = []
|
default_seminar_signup_ids = []
|
||||||
|
self.session_ids = []
|
||||||
self.default_topics.each_with_index do |topic,i|
|
self.default_topics.each_with_index do |topic,i|
|
||||||
fn,id = (topic.split(".") rescue [])
|
fn,id = (topic.split(".") rescue [])
|
||||||
next if fn.nil?
|
next if fn.nil?
|
||||||
|
@ -37,9 +57,13 @@ class SeminarReview
|
||||||
seminar_signup_contribute_ids = SeminarSubmissionValue.where(:seminar_submission_field_id=>id,:val.in=>self.default_topics_values[i].to_a).pluck(:seminar_signup_contribute)
|
seminar_signup_contribute_ids = SeminarSubmissionValue.where(:seminar_submission_field_id=>id,:val.in=>self.default_topics_values[i].to_a).pluck(:seminar_signup_contribute)
|
||||||
default_seminar_signup_ids += SeminarSignupContribute.where(:id.in=>seminar_signup_contribute_ids).pluck(:seminar_signup_id)
|
default_seminar_signup_ids += SeminarSignupContribute.where(:id.in=>seminar_signup_contribute_ids).pluck(:seminar_signup_id)
|
||||||
elsif fn == "seminar_signup_contributes"
|
elsif fn == "seminar_signup_contributes"
|
||||||
default_seminar_signup_ids += SeminarSignupContribute.where(:description.in=>self.default_topics_values[i].to_a).pluck(:seminar_signup_id)
|
seminar_signup_ids_from_contribute = SeminarSignupContribute.where(:description.in=>self.default_topics_values[i].to_a).pluck(:seminar_signup_id)
|
||||||
|
seminar_signup_ids_from_contribute = seminar_signup_ids_from_contribute & (self.seminar_main.seminar_signups.pluck(:id) rescue [])
|
||||||
|
default_seminar_signup_ids += seminar_signup_ids_from_contribute
|
||||||
|
self.session_ids = self.session_ids.concat(self.default_topics_values[i].map{|v| v.to_i})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
self.seminar_session_ids = self.seminar_main.seminar_sessions.where(:key.in=>self.session_ids.to_a).pluck(:id) rescue []
|
||||||
default_seminar_signup_ids.uniq!
|
default_seminar_signup_ids.uniq!
|
||||||
default_seminar_signup_ids = default_seminar_signup_ids.map{|s| s.to_s}
|
default_seminar_signup_ids = default_seminar_signup_ids.map{|s| s.to_s}
|
||||||
self.default_seminar_signup_ids = default_seminar_signup_ids
|
self.default_seminar_signup_ids = default_seminar_signup_ids
|
||||||
|
@ -47,8 +71,16 @@ class SeminarReview
|
||||||
def review
|
def review
|
||||||
MemberProfile.find(self.reviewer_id) rescue nil
|
MemberProfile.find(self.reviewer_id) rescue nil
|
||||||
end
|
end
|
||||||
|
def get_all_seminar_signup_ids(mode = nil)
|
||||||
|
if (self.default_topics.include?("seminar_signup_contributes.description") && self.seminar_main.assign_mode == 1) || mode == 1
|
||||||
|
final_assign_signup_ids = SeminarSession.where(:id.in=>self.seminar_session_ids).pluck(:seminar_signup_ids).flatten rescue []
|
||||||
|
self.seminar_signup_ids - self.remove_seminar_signup_ids + final_assign_signup_ids
|
||||||
|
else
|
||||||
|
all_seminar_signup_ids
|
||||||
|
end
|
||||||
|
end
|
||||||
def all_seminar_signup_ids
|
def all_seminar_signup_ids
|
||||||
seminar_signup_ids - remove_seminar_signup_ids + default_seminar_signup_ids
|
self.seminar_signup_ids - self.remove_seminar_signup_ids + self.default_seminar_signup_ids
|
||||||
end
|
end
|
||||||
def append_default_signup_id(signup_id)
|
def append_default_signup_id(signup_id)
|
||||||
sid = signup_id.to_s
|
sid = signup_id.to_s
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
# encoding: utf-8
|
||||||
|
class SeminarSession
|
||||||
|
|
||||||
|
include Mongoid::Document
|
||||||
|
include Mongoid::Timestamps
|
||||||
|
|
||||||
|
field :key
|
||||||
|
belongs_to :seminar_main
|
||||||
|
field :seminar_signup_ids, :type => Array, :default => []
|
||||||
|
def seminar_signups
|
||||||
|
SeminarSignup.where(:id.in=>seminar_signup_ids)
|
||||||
|
end
|
||||||
|
end
|
|
@ -15,11 +15,11 @@ class SeminarSignup
|
||||||
field :password
|
field :password
|
||||||
field :note, localize: true
|
field :note, localize: true
|
||||||
field :serial_number
|
field :serial_number
|
||||||
|
field :final_session
|
||||||
belongs_to :seminar_main
|
belongs_to :seminar_main
|
||||||
|
field :seminar_session_id
|
||||||
has_many :seminar_signup_values
|
has_many :seminar_signup_values, :autosave => true, :dependent => :destroy
|
||||||
has_many :seminar_signup_contributes
|
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
|
||||||
|
@ -28,13 +28,16 @@ class SeminarSignup
|
||||||
before_create do
|
before_create do
|
||||||
unit = self.unit_translations.values.select{|v| v.present?}.first
|
unit = self.unit_translations.values.select{|v| v.present?}.first
|
||||||
self.unit_translations = I18n.available_locales.map{|l| [l.to_s,unit]}.to_h
|
self.unit_translations = I18n.available_locales.map{|l| [l.to_s,unit]}.to_h
|
||||||
|
if self.serial_number.nil?
|
||||||
s = SeminarMain.find(self.seminar_main)
|
s = SeminarMain.find(self.seminar_main)
|
||||||
s.last_serial_number += 1
|
s.last_serial_number += 1
|
||||||
self.serial_number = s.last_serial_number
|
self.serial_number = s.last_serial_number
|
||||||
s.save(:validate=>false)
|
s.save(:validate=>false)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
after_destroy do
|
after_destroy do
|
||||||
seminar_main = self.seminar_main
|
seminar_main = self.seminar_main
|
||||||
|
if seminar_main.present?
|
||||||
seminar_reviews = seminar_main.seminar_reviews
|
seminar_reviews = seminar_main.seminar_reviews
|
||||||
id = self.id.to_s
|
id = self.id.to_s
|
||||||
seminar_reviews.each do |sr|
|
seminar_reviews.each do |sr|
|
||||||
|
@ -49,6 +52,12 @@ class SeminarSignup
|
||||||
seminar_main.save
|
seminar_main.save
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
seminar_session = SeminarSession.where(:id=>self.seminar_session_id).first
|
||||||
|
if seminar_session
|
||||||
|
seminar_session.seminar_signup_ids.delete(self.id.to_s)
|
||||||
|
seminar_session.save
|
||||||
|
end
|
||||||
|
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
|
||||||
|
|
|
@ -4,4 +4,5 @@ class SeminarSignupAdminSetting
|
||||||
include Mongoid::Timestamps
|
include Mongoid::Timestamps
|
||||||
field :display_field , type: Array , default: []
|
field :display_field , type: Array , default: []
|
||||||
field :seminar_main_id
|
field :seminar_main_id
|
||||||
|
field :page
|
||||||
end
|
end
|
|
@ -5,4 +5,7 @@ class SeminarSignupFieldCustom
|
||||||
field :seminar_signup_field_id
|
field :seminar_signup_field_id
|
||||||
field :hidden, type: Boolean, default: true
|
field :hidden, type: Boolean, default: true
|
||||||
belongs_to :seminar_main
|
belongs_to :seminar_main
|
||||||
|
def seminar_signup_field
|
||||||
|
SeminarSignupField.find(self.seminar_signup_field_id) rescue nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -209,7 +209,14 @@ def unset_all_lang_values
|
||||||
end #of data_proc
|
end #of data_proc
|
||||||
|
|
||||||
def check_key
|
def check_key
|
||||||
self.key = self.seminar_signup_field.key
|
if self.seminar_signup_field_id.present? && self.seminar_signup_field.nil?
|
||||||
|
begin
|
||||||
|
self.seminar_signup_field = SeminarSignupField.find(self.seminar_signup_field_id)
|
||||||
|
rescue
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self.key = self.seminar_signup_field.key rescue nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def method_missing(*field)
|
def method_missing(*field)
|
||||||
|
|
|
@ -206,7 +206,14 @@ end
|
||||||
end #of data_proc
|
end #of data_proc
|
||||||
|
|
||||||
def check_key
|
def check_key
|
||||||
self.key = self.seminar_submission_field.key
|
if self.seminar_submission_field_id.present? && self.seminar_submission_field.nil?
|
||||||
|
begin
|
||||||
|
self.seminar_submission_field = SeminarSubmissionField.find(self.seminar_submission_field_id)
|
||||||
|
rescue
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self.key = self.seminar_submission_field.key rescue nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def method_missing(*field)
|
def method_missing(*field)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<%
|
<%
|
||||||
multi_helper = Admin::SeminarsHelper::MultiLang
|
multi_helper = Admin::SeminarsHelper::MultiLang
|
||||||
|
new_record = @seminar.new_record? && @seminar.copy_id.nil?
|
||||||
%>
|
%>
|
||||||
<% content_for :page_specific_css do %>
|
<% content_for :page_specific_css do %>
|
||||||
<%= stylesheet_link_tag "lib/main-forms" %>
|
<%= stylesheet_link_tag "lib/main-forms" %>
|
||||||
|
@ -54,14 +55,14 @@
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label muted"><%= t('seminar.seminar_start_date') %></label>
|
<label class="control-label muted"><%= t('seminar.seminar_start_date') %></label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<%= f.datetime_picker :seminar_start_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => @seminar.new_record? %>
|
<%= f.datetime_picker :seminar_start_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => new_record %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label muted"><%= t('seminar.seminar_end_date') %></label>
|
<label class="control-label muted"><%= t('seminar.seminar_end_date') %></label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<%= f.datetime_picker :seminar_end_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => @seminar.new_record? %>
|
<%= f.datetime_picker :seminar_end_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => new_record %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
|
@ -70,6 +71,14 @@
|
||||||
<%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'seminar_main[organizer_id]', email_members:Array(f.object.organizer), index: "1", select_name: 'organizer_id'} %>
|
<%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'seminar_main[organizer_id]', email_members:Array(f.object.organizer), index: "1", select_name: 'organizer_id'} %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<% if params[:action] == "copy" %>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label muted"><%= t('seminar.clone_signups') %></label>
|
||||||
|
<div class="controls">
|
||||||
|
<%= check_box_tag("clone_signups",true) %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
@ -92,14 +101,14 @@
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label muted"><%= t('seminar.signup_start_date') %></label>
|
<label class="control-label muted"><%= t('seminar.signup_start_date') %></label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<%= f.datetime_picker :signup_start_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => @seminar.new_record? %>
|
<%= f.datetime_picker :signup_start_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => new_record %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label muted"><%= t('seminar.signup_end_date') %></label>
|
<label class="control-label muted"><%= t('seminar.signup_end_date') %></label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<%= f.datetime_picker :signup_end_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => @seminar.new_record? %>
|
<%= f.datetime_picker :signup_end_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => new_record %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -107,14 +116,14 @@
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label muted"><%= t('seminar.contribute_start_date') %></label>
|
<label class="control-label muted"><%= t('seminar.contribute_start_date') %></label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<%= f.datetime_picker :contribute_start_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => @seminar.new_record? %>
|
<%= f.datetime_picker :contribute_start_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => new_record %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label muted"><%= t('seminar.contribute_end_date') %></label>
|
<label class="control-label muted"><%= t('seminar.contribute_end_date') %></label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<%= f.datetime_picker :contribute_end_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => @seminar.new_record? %>
|
<%= f.datetime_picker :contribute_end_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => new_record %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -149,13 +158,13 @@
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label muted"><%= t('seminar.review_start_date') %></label>
|
<label class="control-label muted"><%= t('seminar.review_start_date') %></label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<%= f.datetime_picker :review_start_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => @seminar.new_record? %>
|
<%= f.datetime_picker :review_start_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => new_record %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
<label class="control-label muted"><%= t('seminar.review_end_date') %></label>
|
<label class="control-label muted"><%= t('seminar.review_end_date') %></label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<%= f.datetime_picker :review_end_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => @seminar.new_record? %>
|
<%= f.datetime_picker :review_end_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => new_record %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -272,7 +281,11 @@
|
||||||
<input type="hidden" class="field_set" name='<%= "seminar_main[seminar_signup_field_customs][#{custom_index}][hidden]" %>' value="false">
|
<input type="hidden" class="field_set" name='<%= "seminar_main[seminar_signup_field_customs][#{custom_index}][hidden]" %>' value="false">
|
||||||
<%= check_box_tag("seminar_main[seminar_signup_field_customs][#{custom_index}][hidden]", true ,attr_custom.hidden) %>
|
<%= check_box_tag("seminar_main[seminar_signup_field_customs][#{custom_index}][hidden]", true ,attr_custom.hidden) %>
|
||||||
</td>
|
</td>
|
||||||
|
<% if !attr_custom.new_record? %>
|
||||||
<input for="field_0" id="seminar_main_seminar_signup_field_customs_<%= custom_index.to_s %>_id" name="seminar_main[seminar_signup_field_customs][<%= custom_index.to_s %>][id]" type="hidden" value="<%= attr_custom.id.to_s %>">
|
<input for="field_0" id="seminar_main_seminar_signup_field_customs_<%= custom_index.to_s %>_id" name="seminar_main[seminar_signup_field_customs][<%= custom_index.to_s %>][id]" type="hidden" value="<%= attr_custom.id.to_s %>">
|
||||||
|
<% elsif f.object.copy_id.present? %>
|
||||||
|
<input name="seminar_main[seminar_signup_field_customs][<%= custom_index.to_s %>][title]" type="hidden" value="<%= attr_custom.seminar_signup_field.title.to_s %>">
|
||||||
|
<% end %>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -457,7 +470,7 @@
|
||||||
<div class="add-target">
|
<div class="add-target">
|
||||||
</div>
|
</div>
|
||||||
<p class="add-btn">
|
<p class="add-btn">
|
||||||
<%= hidden_field_tag 'seminar_file_field_count', @seminar.seminar_files.count %>
|
<%= hidden_field_tag 'seminar_file_field_count', @seminar.seminar_files.to_a.count %>
|
||||||
<a id="add_file" class="trigger btn btn-small btn-primary"><i class="icons-plus"></i> <%= t(:add) %></a>
|
<a id="add_file" class="trigger btn btn-small btn-primary"><i class="icons-plus"></i> <%= t(:add) %></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,24 @@
|
||||||
<% if form_file.new_record? %>
|
<% new_record = form_file.new_record? && form_file["file"].blank? %>
|
||||||
|
<% if new_record %>
|
||||||
<div class="fileupload fileupload-new start-line" data-provides="fileupload">
|
<div class="fileupload fileupload-new start-line" data-provides="fileupload">
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="fileupload fileupload-exists start-line" data-provides="fileupload">
|
<div class="fileupload fileupload-exists start-line" data-provides="fileupload">
|
||||||
<% if form_file.file.blank? %>
|
<% if form_file.file.blank? && form_file["file"].blank? %>
|
||||||
<%= t(:no_file) %>
|
<%= t(:no_file) %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= link_to content_tag(:i) + form_file.file_identifier, form_file.file.url, {:class => 'file-link file-type', :target => '_blank', :title => form_file.file_identifier} %>
|
<% belongs_to_record = form_file.relations.select{|k,v| v.macro == :belongs_to}.first[0] rescue nil %>
|
||||||
|
<% url = form_file.file.url %>
|
||||||
|
<% if belongs_to_record.present? && (form_file.send(belongs_to_record).copy_id.present? rescue false) %>
|
||||||
|
<% begin
|
||||||
|
belongs_to_record = belongs_to_record.classify.constantize.find(form_file.send(belongs_to_record).copy_id)
|
||||||
|
target_form_files = belongs_to_record.send(form_file.class.to_s.underscore+"s")
|
||||||
|
target_form_file = target_form_files.select{|ff| ff["file"] == form_file["file"]}.first
|
||||||
|
url = target_form_file.file.url
|
||||||
|
rescue
|
||||||
|
nil
|
||||||
|
end %>
|
||||||
|
<% end %>
|
||||||
|
<%= link_to content_tag(:i) + form_file.file_identifier, url, {:class => 'file-link file-type', :target => '_blank', :title => form_file.file_identifier} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<div class="input-prepend input-append">
|
<div class="input-prepend input-append">
|
||||||
|
@ -16,7 +29,7 @@
|
||||||
</span>
|
</span>
|
||||||
<div class="uneditable-input input-medium">
|
<div class="uneditable-input input-medium">
|
||||||
<i class="icon-file fileupload-exists"></i>
|
<i class="icon-file fileupload-exists"></i>
|
||||||
<span class="fileupload-preview"><%= (form_file.new_record? || form_file.file.blank?) ? t(:select_file) : t(:change_file) %></span>
|
<span class="fileupload-preview"><%= (new_record) ? t(:select_file) : t(:change_file) %></span>
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
<span class="add-on icons-pencil" title='<%= t(:alternative) %>'></span>
|
<span class="add-on icons-pencil" title='<%= t(:alternative) %>'></span>
|
||||||
|
@ -40,13 +53,13 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
<% if form_file.new_record? %>
|
<% if new_record %>
|
||||||
<span class="delete_file add-on btn" title="<%= t(:delete_) %>">
|
<span class="delete_file add-on btn" title="<%= t(:delete_) %>">
|
||||||
<a class="icon-trash"></a>
|
<a class="icon-trash"></a>
|
||||||
</span>
|
</span>
|
||||||
<% else %>
|
<% else %>
|
||||||
<span class="remove_existing_record add-on btn" title="<%= t(:remove) %>">
|
<span class="remove_existing_record add-on btn" title="<%= t(:remove) %>">
|
||||||
<%= f.hidden_field :id %>
|
<%= f.hidden_field :id unless form_file.new_record?%>
|
||||||
<a class="icon-remove"></a>
|
<a class="icon-remove"></a>
|
||||||
<%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %>
|
<%= f.hidden_field :_destroy, :value => nil, :class => 'should_destroy' %>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
<ul class="nav nav-pills">
|
<ul class="nav nav-pills">
|
||||||
<% if admin_for_seminar(seminar) %>
|
<% if admin_for_seminar(seminar) %>
|
||||||
<li><a href="/admin/seminars/<%=seminar.id.to_s%>/edit"><%= t(:edit) %></a></li>
|
<li><a href="/admin/seminars/<%=seminar.id.to_s%>/edit"><%= t(:edit) %></a></li>
|
||||||
|
<li><a href="/admin/seminars/<%=seminar.id.to_s%>/copy"><%= t("seminar.copy") %></a></li>
|
||||||
<li><a href="<%= admin_seminar_item_contents_path(:seminar_main_id=>seminar.id.to_s) %>"><%= t('seminar.set_seminar_item_content') %></a></li>
|
<li><a href="<%= admin_seminar_item_contents_path(:seminar_main_id=>seminar.id.to_s) %>"><%= t('seminar.set_seminar_item_content') %></a></li>
|
||||||
<li><a href="/admin/seminars/<%=seminar.id.to_s%>/seminar_signup_field"><%= t('seminar.set_seminar_signup_field') %></a></li>
|
<li><a href="/admin/seminars/<%=seminar.id.to_s%>/seminar_signup_field"><%= t('seminar.set_seminar_signup_field') %></a></li>
|
||||||
<li><a href="/admin/seminars/<%=seminar.id.to_s%>/seminar_submission_field"><%= t('seminar.set_seminar_submission_field') %></a></li>
|
<li><a href="/admin/seminars/<%=seminar.id.to_s%>/seminar_submission_field"><%= t('seminar.set_seminar_submission_field') %></a></li>
|
||||||
|
@ -38,7 +39,7 @@
|
||||||
<td><a href="/admin/seminars/<%=seminar.id.to_s%>/seminar_signup">
|
<td><a href="/admin/seminars/<%=seminar.id.to_s%>/seminar_signup">
|
||||||
<% @seminar_review = seminar.seminar_reviews.where(:reviewer_id => current_user.member_profile_id.to_s).first %>
|
<% @seminar_review = seminar.seminar_reviews.where(:reviewer_id => current_user.member_profile_id.to_s).first %>
|
||||||
<% if @seminar_review.present? && !@can_edit %>
|
<% if @seminar_review.present? && !@can_edit %>
|
||||||
<%= @seminar_review.all_seminar_signup_ids.count %>
|
<%= @seminar_review.get_all_seminar_signup_ids.count %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= seminar.seminar_signups.count %>
|
<%= seminar.seminar_signups.count %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
<div class="reviewer_block" data-id="<%=seminar_review.id.to_s%>" data-count="<%=count%>">
|
<div class="reviewer_block" data-id="<%=seminar_review.id.to_s%>" data-count="<%=count%>">
|
||||||
<h5><%= MemberProfile.find(reviewer_id).name rescue "" %></h5>
|
<h5><%= MemberProfile.find(reviewer_id).name rescue "" %></h5>
|
||||||
<span class="zoom_out_btn">-</span>
|
<span class="zoom_out_btn">-</span>
|
||||||
<% @seminar_signups = SeminarSignup.where(:id.in=>seminar_review.all_seminar_signup_ids).sort_ordered %>
|
<% @seminar_signups = SeminarSignup.where(:id.in=>seminar_review.get_all_seminar_signup_ids).sort_ordered %>
|
||||||
<% @seminar_signups = @seminar_signups.page(params["page_no#{count}"]).per(5) %>
|
<% @seminar_signups = @seminar_signups.page(params["page_no#{count}"]).per(5) %>
|
||||||
<% @seminar_signups = @seminar_signups.page(0) if @seminar_signups.to_a.count == 0 %>
|
<% @seminar_signups = @seminar_signups.page(0) if @seminar_signups.to_a.count == 0 %>
|
||||||
<%= render :partial => "seminar_signup_render_table",:locals=>{:@seminar_signups=>@seminar_signups,:@drag => true,:@include_blank=>true,:@reviewer_id=>seminar_review.id.to_s} %>
|
<%= render :partial => "seminar_signup_render_table",:locals=>{:@seminar_signups=>@seminar_signups,:@drag => true,:@include_blank=>true,:@reviewer_id=>seminar_review.id.to_s} %>
|
||||||
|
|
|
@ -0,0 +1,233 @@
|
||||||
|
<h3 class="pull-left"><%= @seminar.title %></h3>
|
||||||
|
<div style="clear: both;"></div>
|
||||||
|
<% org_seminar_signups = @seminar_signups %>
|
||||||
|
<% session_translation = (@seminar.seminar_submission_field_sets.select{|v| v.field_name=='description'}[0]['name'][I18n.locale] rescue "Session") %>
|
||||||
|
<div style="float: left;width: 50%;">
|
||||||
|
<h4><%= session_translation %></h4>
|
||||||
|
<% session_show_ids = @seminar.session_show_ids %>
|
||||||
|
<% if session_show_ids.nil?
|
||||||
|
session_show_ids = (0...@seminar.summary_chioices.count).to_a[0..1]
|
||||||
|
@seminar.update(:session_show_ids=>session_show_ids)
|
||||||
|
end
|
||||||
|
%>
|
||||||
|
<% count = 0 %>
|
||||||
|
<% session_show_ids.each do |session_id| %>
|
||||||
|
<% next if session_id >= @seminar.summary_chioices.count %>
|
||||||
|
<% count += 1 %>
|
||||||
|
<div class="session_block" data-id="<%=session_id%>" data-count="<%=count%>">
|
||||||
|
<h5><%= @seminar.summary_chioices[session_id] %></h5>
|
||||||
|
<span class="zoom_out_btn">-</span>
|
||||||
|
<% seminar_session = @seminar.seminar_sessions.where(:key=>session_id).first %>
|
||||||
|
<% @seminar_signups = seminar_session.seminar_signups.sort_ordered %>
|
||||||
|
<% @seminar_signups = @seminar_signups.page(params["page_no#{count}"]).per(5) %>
|
||||||
|
<% @seminar_signups = @seminar_signups.page(0) if @seminar_signups.to_a.count == 0 %>
|
||||||
|
<%= render :partial => "seminar_signup_render_table",:locals=>{:@seminar_signups=>@seminar_signups,:@drag => true,:@include_blank=>true,:@reviewer_id=>session_id} %>
|
||||||
|
<%
|
||||||
|
pagination_html = content_tag :div, class: "bottomnav clearfix", style: "position: static;" do
|
||||||
|
content_tag :div, paginate(@seminar_signups), class: "pagination pagination-centered"
|
||||||
|
end
|
||||||
|
%>
|
||||||
|
<%= pagination_html.gsub(/page_no#{count}=\d*/,"").gsub('&&','&').gsub(/page=(\d*)/m){|ff| ff.gsub("page=#{$1}","page=#{params[:page]}&page_no#{count}=#{$1}")}.html_safe %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% if count != 2 && @seminar.summary_chioices.count >= 2 %>
|
||||||
|
<% (0...(2-count)).each do |i| %>
|
||||||
|
<div class="blank_block session_block">
|
||||||
|
<i class="fa fa-plus-circle add_btn"></i>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<% @seminar_signups = org_seminar_signups
|
||||||
|
@include_blank = false
|
||||||
|
@reviewer_id = nil
|
||||||
|
%>
|
||||||
|
<div style="float: right;width: 50%;" data-count="<%=count+=1%>">
|
||||||
|
<div id="main-table" style="overflow: scroll;">
|
||||||
|
<h5><%= t('seminar.unassigned_session_signups',{:session=>session_translation}) %></h5>
|
||||||
|
<%= render :partial => "seminar_signup_render_table" %>
|
||||||
|
</div>
|
||||||
|
<%=
|
||||||
|
content_tag :div, class: "bottomnav clearfix", style: "position: static;" do
|
||||||
|
content_tag :div, paginate(@seminar_signups), class: "pagination pagination-centered"
|
||||||
|
end
|
||||||
|
%>
|
||||||
|
</div>
|
||||||
|
<% unless request.xhr? %>
|
||||||
|
<div id='dialog-confirm' title="<%= t("seminar.select_session",{:session=>session_translation}) %>" style="display: none;">
|
||||||
|
<div style="clear:both;"></div>
|
||||||
|
<div id="info_texts">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="bottomnav clearfix">
|
||||||
|
<div class="action pull-right">
|
||||||
|
<%= link_to content_tag(:i, nil, :class => 'icon-cog icon-white') + t("seminar.field_display_setting"), seminar_signup_admin_setting_admin_seminar_path(params[:id]) + "?page=session", :class => 'btn btn-primary' %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
function generate_pagination(session_id,index=1,start=1,end=1,active=1){
|
||||||
|
var pagination = $('<div class="pagination pagination-centered">');
|
||||||
|
pagination.append('<div class="pagination"><ul></ul></div>');
|
||||||
|
var href = "<%=get_session_block_admin_seminar_path(@seminar.id)%>?session_id="+session_id+"&page_no"+index+"=new_page_no";
|
||||||
|
if(active != start){
|
||||||
|
pagination.find("ul").append("<li class=\"first\"><a href=\""+href.replace('new_page_no',1)+"\">« First</a></li>");
|
||||||
|
pagination.find("ul").append("<li class=\"prev\"><a href=\""+href.replace('new_page_no',active-1)+"\">‹ Prev</a></li>");
|
||||||
|
}
|
||||||
|
for(var i=start;i<end;i++){
|
||||||
|
if(i == active){
|
||||||
|
pagination.find("ul").append("<li class=\"page active\"><a href=\""+href.replace('new_page_no',i)+"\">"+i+"</a></li>");
|
||||||
|
}else{
|
||||||
|
pagination.find("ul").append("<li class=\"page\"><a href=\""+href.replace('new_page_no',i)+"\">"+i+"</a></li>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(active != end && end != 1){
|
||||||
|
pagination.find("ul").append("<li class=\"next\"><a href=\""+href.replace('new_page_no',active+1)+"\">Next ›</a></li>");
|
||||||
|
pagination.find("ul").append("<li class=\"last\"><a href=\""+href.replace('new_page_no',end)+"\">Last »</a></li>");
|
||||||
|
}
|
||||||
|
return pagination.prop("outerHTML");
|
||||||
|
}
|
||||||
|
function adjust_height(){
|
||||||
|
var bottom_offset = $(".bottomnav").eq(1).offset().top;
|
||||||
|
var top_offset = [$('ul.pull-right').offset().top,$('h3.pull-left').offset().top];
|
||||||
|
var top_height = [$('ul.pull-right').height(),$("h3.pull-left").height()];
|
||||||
|
var top_all_offset_bottom = top_offset.map(function(d,i){return d+top_height[i]});
|
||||||
|
top_all_offset_bottom = Math.max.apply(null, top_all_offset_bottom);
|
||||||
|
var bottom_height = $(".bottomnav")[0].offsetHeight;
|
||||||
|
var block_height;// = bottom_offset - top_all_offset_bottom - bottom_height - 100;
|
||||||
|
block_height = $(window).height() - top_all_offset_bottom - bottom_height - 100;
|
||||||
|
$("#main-table").height(block_height);
|
||||||
|
$(".session_block").height(block_height / 2);
|
||||||
|
}
|
||||||
|
function a_tag_xhr_request(ele){
|
||||||
|
var href = $(ele).attr("href");
|
||||||
|
var div_block = $(ele).parents(".bottomnav").parent();
|
||||||
|
var index = div_block.data("count");
|
||||||
|
$.get(href).done(function(data){
|
||||||
|
var $d = $(data);
|
||||||
|
div_block.html($d.find('[data-count='+index+']').html());
|
||||||
|
$(".pagination a").attr("onclick","a_tag_xhr_request(this);return false;");
|
||||||
|
adjust_height();
|
||||||
|
window.history.pushState(data,null,href);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
function init_func(){
|
||||||
|
adjust_height();
|
||||||
|
$(".zoom_out_btn").off("click").on("click",function(){
|
||||||
|
var parent = $(this).parent();
|
||||||
|
var session_id = parent.data("id");
|
||||||
|
$.post("<%=update_seminar_session_admin_seminar_path(params[:id])%>",{session_id: session_id,mode: "hide"}).done(function(data){
|
||||||
|
console.log(data);
|
||||||
|
parent.css("display","none");
|
||||||
|
parent.before('<div class="blank_block session_block">'+
|
||||||
|
'<i class="fa fa-plus-circle add_btn"></i>'+
|
||||||
|
'</div>');
|
||||||
|
init_func();
|
||||||
|
})
|
||||||
|
})
|
||||||
|
$(".blank_block .add_btn").off("click").on("click",function(){
|
||||||
|
var ele = $(this).parent();
|
||||||
|
$.get("<%=get_hide_session_admin_seminar_path(@seminar.id)%>").done(function(data){
|
||||||
|
$("#info_texts").html(data);
|
||||||
|
$( "#dialog-confirm" ).dialog({
|
||||||
|
resizable: true,
|
||||||
|
minHeight: 300,
|
||||||
|
maxHeight: 400,
|
||||||
|
modal: true,
|
||||||
|
width: '80%',
|
||||||
|
close: function(){$( this ).dialog( "close" );},
|
||||||
|
open: function(){
|
||||||
|
$(".selected_item").click(function(){
|
||||||
|
var session_id = $(this).data("id");
|
||||||
|
$.get("<%=get_session_block_admin_seminar_path(params[:id])%>",{session_id: session_id,type: "<%=params[:type]%>"}).done(function(data){
|
||||||
|
ele.prop("outerHTML",data);
|
||||||
|
init_func();
|
||||||
|
$( "#dialog-confirm" ).dialog( "close" );
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
$(".pagination a").attr("onclick","a_tag_xhr_request(this);return false;")
|
||||||
|
$( ".table tbody" ).sortable({
|
||||||
|
revert: true,
|
||||||
|
handle: ".brand",
|
||||||
|
connectWith: ".table tbody",
|
||||||
|
start: function(event, ui){
|
||||||
|
$(".session_block").css("overflow","hidden");
|
||||||
|
},
|
||||||
|
stop: function(event, ui){
|
||||||
|
$(".session_block").css("overflow","");
|
||||||
|
},
|
||||||
|
update: function(event, ui) {
|
||||||
|
var target = $(event.target);
|
||||||
|
var mode = "";
|
||||||
|
var session_id = target.data("id");
|
||||||
|
var signup_id = ui.item.data("id");
|
||||||
|
if(ui.item.parent().data("id") == session_id){
|
||||||
|
mode = "append";
|
||||||
|
}else{
|
||||||
|
mode = "remove";
|
||||||
|
}
|
||||||
|
if(target.find("tr").not(".blank_tr").length == 0){
|
||||||
|
target.find(".blank_tr").css("display","");
|
||||||
|
}else{
|
||||||
|
target.find(".blank_tr").css("display","none");
|
||||||
|
}
|
||||||
|
if(session_id != undefined){
|
||||||
|
$.post("<%=update_seminar_session_admin_seminar_path(params[:id])%>",{session_id: session_id,mode: mode,signup_id: signup_id}).done(function(data){
|
||||||
|
console.log(data);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
$(document).ready(function(){
|
||||||
|
|
||||||
|
init_func();
|
||||||
|
})
|
||||||
|
$(window).resize(function(){
|
||||||
|
adjust_height();
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<style type="text/css">
|
||||||
|
.icons-list-2 {
|
||||||
|
cursor: all-scroll;
|
||||||
|
}
|
||||||
|
.session_block{
|
||||||
|
overflow: scroll;
|
||||||
|
border: 0.2em solid black;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.zoom_out_btn{
|
||||||
|
width: 1em;
|
||||||
|
height: 1em;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
background: #454545;
|
||||||
|
color: #FFFFFF;
|
||||||
|
font-size: 2em;
|
||||||
|
text-align: center;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.blank_block .add_btn {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
font-size: 3em;
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
margin: -10px 0 0 -10px;
|
||||||
|
display: inline-block;
|
||||||
|
font-family: FontAwesome;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: normal;
|
||||||
|
line-height: 1;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<% end %>
|
|
@ -14,7 +14,7 @@
|
||||||
<div class="pagination pagination-centered"><%= (paginate(@seminar_signups) rescue nil) %></div>
|
<div class="pagination pagination-centered"><%= (paginate(@seminar_signups) rescue nil) %></div>
|
||||||
<% if @can_edit %>
|
<% if @can_edit %>
|
||||||
<div class="action pull-right">
|
<div class="action pull-right">
|
||||||
<%= link_to content_tag(:i, nil, :class => 'icon-cog icon-white') + t("seminar.field_display_setting"), seminar_signup_admin_setting_admin_seminar_path(params[:id]), :class => 'btn btn-primary' %>
|
<%= link_to content_tag(:i, nil, :class => 'icon-cog icon-white') + t("seminar.field_display_setting"), seminar_signup_admin_setting_admin_seminar_path(params[:id]) + "?page=table", :class => 'btn btn-primary' %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
<%= form_for @seminar, url: admin_seminars_path, html: {class: "form-horizontal main-forms"} do |f| %>
|
||||||
|
<fieldset>
|
||||||
|
<%= f.hidden_field :copy_id %>
|
||||||
|
<%= render :partial => 'form', locals: {f: f} %>
|
||||||
|
</fieldset>
|
||||||
|
<% end %>
|
|
@ -1,12 +1,13 @@
|
||||||
<ul class="checkbox-card">
|
<ul class="checkbox-card">
|
||||||
<% @hide_reviewers.each do |member|%>
|
<% @hide_reviewers.each do |member|%>
|
||||||
|
<% reviewer = @reviewers.select{|r| r.reviewer_id == member.id.to_s}.first %>
|
||||||
<% member_name = member.name %>
|
<% member_name = member.name %>
|
||||||
<% member_id = member.id.to_s %>
|
<% member_id = member.id.to_s %>
|
||||||
<% member_pic_url = ((member.avatar.file.present? rescue false) ? member.avatar.url : "/assets/member-pic.png") %>
|
<% member_pic_url = ((member.avatar.file.present? rescue false) ? member.avatar.url : "/assets/member-pic.png") %>
|
||||||
<li class="filter-item selected_item selected_member check-item" data-id="<%=member_id%>" style="margin: 0 10px 10px 0;">
|
<li class="filter-item selected_item selected_member check-item" data-id="<%=member_id%>" style="margin: 0 10px 10px 0;">
|
||||||
<label style="height: 100%;padding: 0;max-width: 20%;">
|
<label style="height: 100%;padding: 0;max-width: 20%;">
|
||||||
<img style="max-height: 100%;" alt="Member pic" class="member-pic" src="<%=member_pic_url%>">
|
<img style="max-height: 100%;" alt="Member pic" class="member-pic" src="<%=member_pic_url%>">
|
||||||
<span class="user-name" style="float: right;width: 95px;padding-top: 8px;font-size: 1em;position: absolute;padding-left: 0.5em;"><%=member_name%></span>
|
<span class="user-name" style="float: right;width: 95px;padding-top: 8px;font-size: 1em;position: absolute;padding-left: 0.5em;"><%=member_name%><span class="badge badge-info"><%= reviewer.get_all_seminar_signup_ids.count %></span></span>
|
||||||
</label>
|
</label>
|
||||||
<input name="member_ids[]" type="hidden" value="<%=member_id%>">
|
<input name="member_ids[]" type="hidden" value="<%=member_id%>">
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
<ul class="checkbox-card">
|
||||||
|
<% @hide_sessions.each do |i,session|%>
|
||||||
|
<% seminar_session = @seminar_sessions.where(:key=>i).first %>
|
||||||
|
<li class="filter-item selected_item selected_member check-item" data-id="<%=i%>" style="margin: 0 10px 10px 0;">
|
||||||
|
<label style="height: 100%;padding: 0;max-width: 100%;position: relative;">
|
||||||
|
<div class="session-name"><%=session%><span class="badge badge-info"><%= seminar_session.seminar_signup_ids.count %></span></div>
|
||||||
|
</label>
|
||||||
|
<input name="session_ids[]" type="hidden" value="<%=i%>">
|
||||||
|
</li>
|
||||||
|
<div style="clear: both;"></div>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
<style type="text/css">
|
||||||
|
.checkbox-card li:hover label span, .checkbox-card li:hover label span.user-name{
|
||||||
|
color: #363636;
|
||||||
|
}
|
||||||
|
.checkbox-card li:hover{
|
||||||
|
background-color: #cccccc;
|
||||||
|
}
|
||||||
|
.selected_item{
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.session-name{
|
||||||
|
float: right;
|
||||||
|
width: 100%;
|
||||||
|
padding-top: 0.5em;
|
||||||
|
font-size: 1em;
|
||||||
|
padding-left: 0.5em;
|
||||||
|
background: #bdb9b9;
|
||||||
|
}
|
||||||
|
.session-name:hover{
|
||||||
|
background: #9a9898;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -3,7 +3,7 @@
|
||||||
<div class="reviewer_block" data-id="<%=seminar_review.id.to_s%>">
|
<div class="reviewer_block" data-id="<%=seminar_review.id.to_s%>">
|
||||||
<h5><%= MemberProfile.find(@reviewer_id).name rescue "" %></h5>
|
<h5><%= MemberProfile.find(@reviewer_id).name rescue "" %></h5>
|
||||||
<span class="zoom_out_btn">-</span>
|
<span class="zoom_out_btn">-</span>
|
||||||
<% @seminar_signups = SeminarSignup.where(:id.in=>seminar_review.all_seminar_signup_ids).sort_ordered %>
|
<% @seminar_signups = SeminarSignup.where(:id.in=>seminar_review.get_all_seminar_signup_ids).sort_ordered %>
|
||||||
<%= render :partial => "seminar_signup_render_table",:locals=>{:@seminar_signups=>@seminar_signups.page(params[:page]).per(5),:@drag => true,:@include_blank=>true,:@reviewer_id=>seminar_review.id.to_s} %>
|
<%= render :partial => "seminar_signup_render_table",:locals=>{:@seminar_signups=>@seminar_signups.page(params[:page]).per(5),:@drag => true,:@include_blank=>true,:@reviewer_id=>seminar_review.id.to_s} %>
|
||||||
<%=
|
<%=
|
||||||
content_tag :div, class: "bottomnav clearfix", style: "position: static;" do
|
content_tag :div, class: "bottomnav clearfix", style: "position: static;" do
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
<% if @session_id < @seminar.summary_chioices.count %>
|
||||||
|
<div class="session_block" data-id="<%=@session_id%>">
|
||||||
|
<h5><%= @seminar.summary_chioices[@session_id] %></h5>
|
||||||
|
<span class="zoom_out_btn">-</span>
|
||||||
|
<% @seminar_signups = @seminar.seminar_signups.where(:final_session=>@session_id).sort_ordered %>
|
||||||
|
<%= render :partial => "seminar_signup_render_table",:locals=>{:@seminar_signups=>@seminar_signups.page(params[:page]).per(5),:@drag => true,:@include_blank=>true} %>
|
||||||
|
<%=
|
||||||
|
content_tag :div, class: "bottomnav clearfix", style: "position: static;" do
|
||||||
|
content_tag :div, paginate(@seminar_signups), class: "pagination pagination-centered"
|
||||||
|
end
|
||||||
|
%>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
|
@ -3,11 +3,19 @@
|
||||||
if(document.querySelectorAll("#orbit-bar").length==0) location.reload();
|
if(document.querySelectorAll("#orbit-bar").length==0) location.reload();
|
||||||
</script>
|
</script>
|
||||||
<% if @can_edit %>
|
<% if @can_edit %>
|
||||||
<ul class="pull-right"><li><a href="?type=" class="btn"><%= t('seminar.dashboard') %></a></li><li><a href="?type=table" class="btn"><%= t('seminar.table') %></a></li></ul>
|
<ul class="pull-right">
|
||||||
|
<li><a href="?type=" class="btn <%='active' if params[:type] == ''%>"><%= t('seminar.dashboard') %></a></li>
|
||||||
|
<% if @seminar.enable_summary_choice %>
|
||||||
|
<li><a href="?type=session" class="btn <%='active' if params[:type] == 'session'%>"><%= t('seminar.session_dashboard') %></a></li>
|
||||||
|
<% end %>
|
||||||
|
<li><a href="?type=table" class="btn <%='active' if params[:type] == 'table'%>"><%= t('seminar.table') %></a></li>
|
||||||
|
</ul>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if params[:type] == "table" || (!@can_edit) %>
|
<% if params[:type] == "table" || (!@can_edit) %>
|
||||||
<div style="clear: both;"></div>
|
<div style="clear: both;"></div>
|
||||||
<%= render :partial => 'seminar_signup_table' %>
|
<%= render :partial => 'seminar_signup_table' %>
|
||||||
|
<% elsif params[:type] == "session" %>
|
||||||
|
<%=render :partial => 'seminar_signup_session_dashboard' %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= render :partial => 'seminar_signup_dashboard' %>
|
<%= render :partial => 'seminar_signup_dashboard' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= hidden_field_tag :id, params[:id] %>
|
<%= hidden_field_tag :id, params[:id] %>
|
||||||
|
<%= hidden_field_tag :page, params[:page] %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Form Actions -->
|
<!-- Form Actions -->
|
||||||
|
|
|
@ -5,6 +5,7 @@ en:
|
||||||
label: ""
|
label: ""
|
||||||
|
|
||||||
restful_actions:
|
restful_actions:
|
||||||
|
copy: Copy
|
||||||
act_signup: Sign Up Info #報名資料
|
act_signup: Sign Up Info #報名資料
|
||||||
seminar_submission_field: Seminar Submission Field
|
seminar_submission_field: Seminar Submission Field
|
||||||
seminar_signup_field: Seminar Signup Field
|
seminar_signup_field: Seminar Signup Field
|
||||||
|
@ -19,6 +20,10 @@ en:
|
||||||
verification_failed: Verification Failed #驗證碼錯誤
|
verification_failed: Verification Failed #驗證碼錯誤
|
||||||
|
|
||||||
seminar:
|
seminar:
|
||||||
|
clone_signups: Clone Signups
|
||||||
|
copy: Copy
|
||||||
|
select_session: Select %{session}
|
||||||
|
unassigned_session_signups: Unassigned %{session} Signups
|
||||||
submitter_without_reviewer: Submitter without reviewer
|
submitter_without_reviewer: Submitter without reviewer
|
||||||
are_you_want_to_remove: "Are you really want to remove?"
|
are_you_want_to_remove: "Are you really want to remove?"
|
||||||
add_assign_fields: Add assign fields
|
add_assign_fields: Add assign fields
|
||||||
|
@ -30,6 +35,7 @@ en:
|
||||||
enquiry_for_applicants: Enquiry for applicants
|
enquiry_for_applicants: Enquiry for applicants
|
||||||
field_display_setting: Field display setting
|
field_display_setting: Field display setting
|
||||||
table: Table
|
table: Table
|
||||||
|
session_dashboard: Session Dashboard
|
||||||
dashboard: Dashboard
|
dashboard: Dashboard
|
||||||
display_field: Display field
|
display_field: Display field
|
||||||
note: Note
|
note: Note
|
||||||
|
|
|
@ -5,6 +5,7 @@ zh_tw:
|
||||||
label: ""
|
label: ""
|
||||||
|
|
||||||
restful_actions:
|
restful_actions:
|
||||||
|
copy: 複製
|
||||||
act_signup: 報名資料
|
act_signup: 報名資料
|
||||||
seminar_submission_field: 上傳介面欄位
|
seminar_submission_field: 上傳介面欄位
|
||||||
seminar_signup_field: 報名欄位
|
seminar_signup_field: 報名欄位
|
||||||
|
@ -19,6 +20,10 @@ zh_tw:
|
||||||
verification_failed: 驗證碼錯誤
|
verification_failed: 驗證碼錯誤
|
||||||
|
|
||||||
seminar:
|
seminar:
|
||||||
|
clone_signups: 複製報名人
|
||||||
|
copy: 複製
|
||||||
|
select_session: 選擇%{session}
|
||||||
|
unassigned_session_signups: 未指派%{session}之報名人
|
||||||
submitter_without_reviewer: 未分派審查委員報名者
|
submitter_without_reviewer: 未分派審查委員報名者
|
||||||
are_you_want_to_remove: 你確定要刪除?
|
are_you_want_to_remove: 你確定要刪除?
|
||||||
add_assign_fields: 新增分派欄位
|
add_assign_fields: 新增分派欄位
|
||||||
|
@ -30,6 +35,7 @@ zh_tw:
|
||||||
enquiry_for_applicants: 查詢報名人
|
enquiry_for_applicants: 查詢報名人
|
||||||
field_display_setting: 欄位顯示設定
|
field_display_setting: 欄位顯示設定
|
||||||
table: 列表
|
table: 列表
|
||||||
|
session_dashboard: 主題(Session)儀錶板
|
||||||
dashboard: 儀錶板
|
dashboard: 儀錶板
|
||||||
display_field: 顯示的欄位
|
display_field: 顯示的欄位
|
||||||
note: 附註
|
note: 附註
|
||||||
|
|
|
@ -6,6 +6,7 @@ Rails.application.routes.draw do
|
||||||
namespace :admin do
|
namespace :admin do
|
||||||
resources :seminars do
|
resources :seminars do
|
||||||
member do
|
member do
|
||||||
|
get 'copy'
|
||||||
get 'export'
|
get 'export'
|
||||||
get 'set_write_off'
|
get 'set_write_off'
|
||||||
get 'seminar_signup'
|
get 'seminar_signup'
|
||||||
|
@ -16,10 +17,13 @@ Rails.application.routes.draw do
|
||||||
post 'update_seminar_signup_admin_setting'
|
post 'update_seminar_signup_admin_setting'
|
||||||
patch 'update_seminar_signup_admin_setting'
|
patch 'update_seminar_signup_admin_setting'
|
||||||
get 'get_hide_reviewer'
|
get 'get_hide_reviewer'
|
||||||
|
get 'get_hide_session'
|
||||||
get 'get_reviewer_block'
|
get 'get_reviewer_block'
|
||||||
|
get 'get_session_block'
|
||||||
get 'reviewer_setting'
|
get 'reviewer_setting'
|
||||||
post 'update_reviewer_setting'
|
post 'update_reviewer_setting'
|
||||||
patch 'update_reviewer_setting'
|
patch 'update_reviewer_setting'
|
||||||
|
post 'update_seminar_session'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
get 'seminar/enquiry_for_applicants' => "seminars#enquiry_for_applicants"
|
get 'seminar/enquiry_for_applicants' => "seminars#enquiry_for_applicants"
|
||||||
|
|
Loading…
Reference in New Issue