Add preferred session field.
Use preferred session to assign default session. Add review page.
This commit is contained in:
parent
05013dd99a
commit
73e510f840
|
@ -0,0 +1,53 @@
|
|||
# encoding: utf-8
|
||||
class Admin::SeminarReviewResultsController < OrbitAdminController
|
||||
include Admin::SeminarsHelper
|
||||
before_action ->(module_app = @app_title) { set_variables module_app }
|
||||
before_action :set_seminar,:check_permission_for_seminar
|
||||
def initialize
|
||||
super
|
||||
@app_title = "seminar"
|
||||
end
|
||||
def set_seminar
|
||||
@seminar_signup_contribute = SeminarSignupContribute.find(params[:id]) rescue nil
|
||||
@seminar_review_result = @seminar_signup_contribute.seminar_review_result rescue nil
|
||||
@seminar_review_result = SeminarReviewResult.new if @seminar_review_result.nil?
|
||||
@seminar = @seminar_signup_contribute.seminar_signup.seminar_main rescue nil
|
||||
end
|
||||
def check_manager_for_seminar
|
||||
OrbitHelper.set_params(params,current_user)
|
||||
access_level = OrbitHelper.user_access_level?
|
||||
if (access_level.nil? || access_level == "user")
|
||||
if (@seminar.organizer_id != current_user.member_profile_id rescue true)
|
||||
render_401
|
||||
end
|
||||
end
|
||||
end
|
||||
def check_permission_for_seminar
|
||||
OrbitHelper.set_params(params,current_user)
|
||||
access_level = OrbitHelper.user_access_level?
|
||||
if (access_level.nil? || access_level == "user")
|
||||
unless (@seminar.reviewer_ids.include?(current_user.member_profile_id.to_s) rescue false) || (@seminar.organizer_id == current_user.member_profile_id rescue false)
|
||||
render_401
|
||||
else
|
||||
@user_authenticated_categories = ['all']
|
||||
end
|
||||
end
|
||||
end
|
||||
def edit
|
||||
OrbitHelper.set_params(params,current_user)
|
||||
@form_index = 0
|
||||
params[:controller] = "admin/seminars"
|
||||
params[:action] = "edit_seminar_review"
|
||||
end
|
||||
|
||||
def update
|
||||
@seminar_signup_contribute.update_attributes(seminar_signup_contribute_params)
|
||||
redirect_to params[:referer_url]
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def seminar_signup_contribute_params
|
||||
params.require(:seminar_signup_contribute).permit!
|
||||
end
|
||||
end
|
|
@ -0,0 +1,45 @@
|
|||
# encoding: utf-8
|
||||
class Admin::SeminarSubmissionValuesController < OrbitAdminController
|
||||
include Admin::SeminarsHelper
|
||||
before_action ->(module_app = @app_title) { set_variables module_app }
|
||||
before_action :set_seminar,:check_manager_for_seminar
|
||||
def initialize
|
||||
super
|
||||
@app_title = "seminar"
|
||||
end
|
||||
def set_seminar
|
||||
@seminar_submission_value = SeminarSubmissionValue.find(params[:id]) rescue nil
|
||||
@seminar_submission_field = @seminar_submission_value.seminar_submission_field rescue nil
|
||||
@con = @seminar_submission_value.seminar_signup_contribute rescue nil
|
||||
@seminar = @seminar_submission_value.seminar_submission_field.seminar_main rescue nil
|
||||
end
|
||||
def check_manager_for_seminar
|
||||
OrbitHelper.set_params(params,current_user)
|
||||
access_level = OrbitHelper.user_access_level?
|
||||
if (access_level.nil? || access_level == "user")
|
||||
if (@seminar.organizer_id != current_user.member_profile_id rescue true)
|
||||
render_401
|
||||
end
|
||||
end
|
||||
end
|
||||
def edit
|
||||
OrbitHelper.set_params(params,current_user)
|
||||
@form_index = 0
|
||||
render :layout =>false
|
||||
end
|
||||
|
||||
def update
|
||||
begin
|
||||
@seminar_submission_value.update_attributes(seminar_submission_value_params)
|
||||
render :json => {:success=>true,:val=>@seminar_submission_value.get_value_by_locale(I18n.locale)}
|
||||
rescue => e
|
||||
render :json => {:success=>false,:error=>e.to_s}
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def seminar_submission_value_params
|
||||
params.require(:seminar_submission_values).permit!.values.first
|
||||
end
|
||||
end
|
|
@ -124,16 +124,18 @@ class Admin::SeminarsController < OrbitAdminController
|
|||
if @seminar_signups.class != Array
|
||||
seminar_review = SeminarReview.where(:reviewer_id=>reviewer_id)
|
||||
seminar_signup_ids = seminar_review.pluck(:seminar_signup_ids).flatten
|
||||
seminar_sessions = SeminarSession.where(:id.in=>seminar_review.pluck(:seminar_session_ids))
|
||||
remove_seminar_signup_ids = seminar_review.pluck(:remove_seminar_signup_ids).flatten
|
||||
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
|
||||
final_assign_signup_ids = SeminarSession.where(:id.in=>seminar_review.pluck(:seminar_session_ids).flatten,:seminar_main_id.in=>seminars.where(:assign_mode.in=>[1,2]).pluck(:id)).pluck(:seminar_signup_ids,:default_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)
|
||||
|
||||
@seminar_signups = @seminar_signups.where(:id.in=>all_seminar_signup_ids + ids2).sort_ordered.page(params[:page]).per(10)
|
||||
@preferred_sessions = seminar_review.pluck(:session_ids).flatten
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -145,7 +147,7 @@ class Admin::SeminarsController < OrbitAdminController
|
|||
@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
|
||||
@hide_sessions = @hide_session_ids.zip(@hide_session_ids.map{|idx| seminar_main.summary_chioices[idx]}).to_h
|
||||
render :layout => false
|
||||
end
|
||||
end
|
||||
|
@ -162,6 +164,7 @@ class Admin::SeminarsController < OrbitAdminController
|
|||
end
|
||||
def get_session_block
|
||||
@session_id = params[:session_id].to_i
|
||||
@seminar_session = @seminar.seminar_sessions.where(:key=>@session_id).first
|
||||
unless (@seminar.session_show_ids.include?(@session_id) rescue false)
|
||||
@seminar.session_show_ids << @session_id
|
||||
@seminar.save
|
||||
|
@ -184,20 +187,58 @@ class Admin::SeminarsController < OrbitAdminController
|
|||
session_id = params[:session_id].to_i
|
||||
seminar_main.save
|
||||
seminar_session = @seminar.seminar_sessions.where(:key=>session_id).first
|
||||
@seminar_submission_value = nil
|
||||
extra_infos = {}
|
||||
if params[:contribute_id].present?
|
||||
seminar_signup_contribute = SeminarSignupContribute.find(params[:contribute_id])
|
||||
seminar_submission_field = seminar_main.seminar_submission_fields.where(:markup=>"seminar_preferred_session").last
|
||||
if seminar_submission_field
|
||||
@seminar_submission_value = seminar_signup_contribute.seminar_submission_values.where(:seminar_submission_field_id=>seminar_submission_field.id).last
|
||||
end
|
||||
end
|
||||
if params[:mode] == "append"
|
||||
@seminar_signup.update(:final_session=>session_id)
|
||||
if @seminar_submission_value
|
||||
@seminar_submission_value.val = session_id.to_s
|
||||
@seminar_submission_value.save
|
||||
extra_infos = {"edit" => {"target"=>"[data-id=\"#{@seminar_submission_value.id}\"]","text"=>@seminar_submission_value.get_value_by_locale(I18n.locale)}}
|
||||
else
|
||||
@seminar_signup.final_sessions << session_id
|
||||
@seminar_signup.seminar_session_ids << seminar_session.id
|
||||
@seminar_signup.seminar_session_ids = @seminar_signup.seminar_session_ids.uniq
|
||||
@seminar_signup.save
|
||||
seminar_session.seminar_signup_contribute_ids.append(params[:contribute_id])
|
||||
seminar_signup_contribute.update(:final_session=>session_id) rescue nil
|
||||
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_main.assign_mode = 1 if seminar_main.assign_mode != 2
|
||||
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)
|
||||
end
|
||||
elsif params[:mode] == "remove_contribute"
|
||||
if @seminar_submission_value
|
||||
@seminar_submission_value.val = nil
|
||||
@seminar_submission_value.save
|
||||
extra_infos = {"edit" => {"target"=>"[data-id=\"#{@seminar_submission_value.id}\"]","text"=>""}}
|
||||
else
|
||||
seminar_session.seminar_signup_contribute_ids.delete(params[:contribute_id])
|
||||
seminar_signup_contribute.update(:final_session=>nil) rescue nil
|
||||
seminar_session.save
|
||||
seminar_main.assign_mode = 0 if seminar_main.seminar_sessions.where(:seminar_signup_ids.ne=>[]).count == 0
|
||||
end
|
||||
elsif params[:mode] == "remove"
|
||||
if @seminar_submission_value
|
||||
@seminar_submission_value.val = nil
|
||||
@seminar_submission_value.save
|
||||
extra_infos = {"edit" => {"target"=>"[data-id=\"#{@seminar_submission_value.id}\"]","text"=>""}}
|
||||
else
|
||||
@seminar_signup.final_sessions.delete(session_id)
|
||||
@seminar_signup.seminar_session_ids.delete(seminar_session.id)
|
||||
seminar_session.seminar_signup_ids.delete(@seminar_signup.id.to_s)
|
||||
seminar_session.seminar_signup_contribute_ids.delete(params[:contribute_id])
|
||||
seminar_signup_contribute.update(:final_session=>nil) rescue nil
|
||||
@seminar_signup.save
|
||||
seminar_session.save
|
||||
seminar_main.assign_mode = 0 if seminar_main.seminar_sessions.where(:seminar_signup_ids.ne=>[]).count == 0 && seminar_main.assign_mode != 2
|
||||
seminar_main.unassigned_mode_1_seminar_signup_ids << @seminar_signup.id.to_s
|
||||
end
|
||||
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]
|
||||
|
@ -209,7 +250,7 @@ class Admin::SeminarsController < OrbitAdminController
|
|||
render :json => {:success => false} and return
|
||||
end
|
||||
seminar_main.save
|
||||
render :json => {:success => true}
|
||||
render :json => {:success => true}.merge(extra_infos)
|
||||
end
|
||||
end
|
||||
def update_seminar_review
|
||||
|
@ -222,11 +263,24 @@ class Admin::SeminarsController < OrbitAdminController
|
|||
@seminar_review.remove_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])
|
||||
if(params[:contribute_id].present?)
|
||||
@seminar_review.seminar_signup_contribute_ids << params[:contribute_id]
|
||||
@seminar_review.remove_seminar_signup_contribute_ids.delete(params[:contribute_id])
|
||||
end
|
||||
elsif params[:mode] == "remove"
|
||||
@seminar_review.seminar_signup_ids.delete(params[:signup_id])
|
||||
@seminar_review.remove_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]
|
||||
if(params[:contribute_id].present?)
|
||||
@seminar_review.seminar_signup_contribute_ids.delete(params[:contribute_id])
|
||||
@seminar_review.remove_seminar_signup_contribute_ids << params[:contribute_id]
|
||||
end
|
||||
elsif params[:mode] == "remove_contribute"
|
||||
if(params[:contribute_id].present?)
|
||||
@seminar_review.seminar_signup_contribute_ids.delete(params[:contribute_id])
|
||||
@seminar_review.remove_seminar_signup_contribute_ids << params[:contribute_id]
|
||||
end
|
||||
elsif params[:mode] == "hide"
|
||||
if seminar_main.reviewer_show_ids.nil?
|
||||
seminar_main.reviewer_show_ids = seminar_main.reviewer_ids[0..1]
|
||||
|
@ -377,13 +431,14 @@ class Admin::SeminarsController < OrbitAdminController
|
|||
def edit
|
||||
@seminar_items = SeminarItem.all
|
||||
@seminar = SeminarMain.where(id: params[:id]).first
|
||||
except_attributes = ["final_sessions","preferred_sessions","seminar_session_ids","preferred_session","final_session","sort_number","abstract_number","presentation_type"]
|
||||
@seminar.seminar_signup_field_sets.each do |signup_field_set|
|
||||
if !(SeminarSignup.attribute_names.include? signup_field_set.field_name) && signup_field_set.field_name != 'recaptcha'
|
||||
if (!(SeminarSignup.attribute_names.include? signup_field_set.field_name) && signup_field_set.field_name != 'recaptcha') || except_attributes.include?(signup_field_set.field_name)
|
||||
signup_field_set.delete
|
||||
end
|
||||
end
|
||||
@seminar.seminar_submission_field_sets.each do |submission_field_set|
|
||||
if !(SeminarSignupContribute.attribute_names.include? submission_field_set.field_name)
|
||||
if (!(SeminarSignupContribute.attribute_names.include? submission_field_set.field_name)) || except_attributes.include?(submission_field_set.field_name)
|
||||
submission_field_set.delete
|
||||
end
|
||||
end
|
||||
|
@ -432,6 +487,32 @@ class Admin::SeminarsController < OrbitAdminController
|
|||
end
|
||||
flash.now[:notice] = "Updated Fields"
|
||||
@seminar.seminar_submission_fields.each{|t| t.destroy if t["to_delete"] == true}
|
||||
if @seminar.seminar_submission_fields.select{|sf| sf.markup == "seminar_preferred_session"}.count != 0
|
||||
@seminar.update(:assign_mode => 2)
|
||||
default_sort_number = SeminarSignup.fields['sort_number'].options[:default]
|
||||
SeminarSignup.where(:sort_number=>nil).update_all(:sort_number=>default_sort_number)
|
||||
SeminarSignupContribute.where(:sort_number=>nil).update_all(:sort_number=>default_sort_number)
|
||||
preferred_session_field = @seminar.seminar_submission_fields.select{|sf| sf.markup == "seminar_preferred_session"}.first
|
||||
if preferred_session_field.seminar_submission_values.count != 0
|
||||
seminar_submission_values = preferred_session_field.seminar_submission_values.to_a
|
||||
seminar_submission_values.each do |v|
|
||||
next if v.val.to_i.to_s != v.val
|
||||
seminar_session = @seminar.seminar_sessions.where(:key=>v.val.to_i).first
|
||||
seminar_session.default_seminar_signup_ids << v.seminar_signup_contribute.seminar_signup_id.to_s
|
||||
seminar_session.default_seminar_signup_ids = seminar_session.default_seminar_signup_ids.uniq
|
||||
seminar_session.save
|
||||
end
|
||||
Thread.new do
|
||||
SeminarMain.where(:update_old_flag=>false).each{|s| s.fix_old_data}
|
||||
end
|
||||
end
|
||||
else
|
||||
if seminar_main.seminar_sessions.where(:seminar_signup_ids.ne=>[]).count == 0
|
||||
@seminar.update(:assign_mode => 0)
|
||||
else
|
||||
@seminar.update(:assign_mode => 1)
|
||||
end
|
||||
end
|
||||
redirect_to admin_seminars_path
|
||||
else
|
||||
|
||||
|
@ -485,6 +566,12 @@ class Admin::SeminarsController < OrbitAdminController
|
|||
|
||||
def seminar_signup
|
||||
@seminar_signups = []
|
||||
@filter_fields = {}
|
||||
@summary_chioices = @seminar.enable_summary_choice ? @seminar.summary_chioices : []
|
||||
@enable_review_result = @seminar.enable_review_result
|
||||
if @enable_review_result
|
||||
@filter_fields["seminar.assigned_session"] = @summary_chioices.map.with_index{|summary_chioice,i| {:title=>summary_chioice, :id=>i}} rescue []
|
||||
end
|
||||
if params[:type] == "table"
|
||||
if params[:search].to_i != 0
|
||||
@seminar_signups = @seminar.seminar_signups.where(:serial_number=>params[:search].to_i)
|
||||
|
@ -492,10 +579,11 @@ class Admin::SeminarsController < OrbitAdminController
|
|||
@seminar_signups = @seminar.seminar_signups.where(:name=>/#{params[:search]}/)
|
||||
end
|
||||
elsif params[:type] == "session"
|
||||
@seminar_signups = @seminar.seminar_signups.where(:final_session => nil, :name=>/#{params[:search]}/)
|
||||
assigned_seminar_signups = @seminar.seminar_sessions.pluck(:seminar_signup_ids,:default_seminar_signup_ids).flatten
|
||||
@seminar_signups = @seminar.seminar_signups.where(:id.nin=>assigned_seminar_signups)
|
||||
else
|
||||
unassigned_seminar_signup_ids = @seminar.unassigned_seminar_signup_ids
|
||||
if @seminar.assign_mode == 1
|
||||
if @seminar.assign_mode != 0
|
||||
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]}/)
|
||||
|
@ -512,6 +600,16 @@ class Admin::SeminarsController < OrbitAdminController
|
|||
unless @can_edit
|
||||
@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.get_all_seminar_signup_ids)
|
||||
@preferred_sessions = @seminar_review.session_ids
|
||||
if @enable_review_result
|
||||
@filter_fields["seminar.assigned_session"] = @filter_fields["seminar.assigned_session"].select{|h| @preferred_sessions.include?(h[:id])} rescue []
|
||||
end
|
||||
@append_contribute_ids = @seminar_review.seminar_signup_contribute_ids
|
||||
@remove_contribute_ids = @seminar_review.remove_seminar_signup_contribute_ids
|
||||
end
|
||||
if params[:filters] && params[:filters][:assigned_session].present?
|
||||
@preferred_sessions = params[:filters][:assigned_session].map{|s| s.to_i}
|
||||
@seminar_signups = @seminar_signups.where(:preferred_sessions.in=> @preferred_sessions)
|
||||
end
|
||||
@seminar_signups = @seminar_signups.sort_ordered.page(params[:page]).per(10)
|
||||
if request.xhr?
|
||||
|
@ -574,7 +672,9 @@ class Admin::SeminarsController < OrbitAdminController
|
|||
params.require(:seminar_main).permit!
|
||||
end
|
||||
def create_set (save_flag)
|
||||
except_attributes = ["final_sessions","preferred_sessions","seminar_session_ids","preferred_session","final_session","sort_number","abstract_number","presentation_type"]
|
||||
SeminarSignup.attribute_names.each do |attr_signup|
|
||||
next if except_attributes.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 }
|
||||
if signup_set.length==0
|
||||
|
@ -619,6 +719,7 @@ class Admin::SeminarsController < OrbitAdminController
|
|||
end
|
||||
end
|
||||
SeminarSignupContribute.attribute_names.each do |attr_submission|
|
||||
next if except_attributes.include?(attr_submission)
|
||||
if !(['_id', 'created_at', 'updated_at','seminar_signup_id'].include? attr_submission)
|
||||
signup_set = @seminar.seminar_submission_field_sets.select{|v| v.field_name==attr_submission }
|
||||
if signup_set.length==0
|
||||
|
|
|
@ -142,7 +142,16 @@ module Admin::SeminarsFieldHelper
|
|||
end.join.html_safe
|
||||
end
|
||||
end
|
||||
|
||||
def render_seminar_preferred_session
|
||||
@prefiled_value ||=[]
|
||||
@prefiled_value = Array(@prefiled_value)
|
||||
control_group_wrapper do
|
||||
@member.summary_chioices.map.with_index do |value,key|
|
||||
key = key.to_s
|
||||
label_tag("#{get_basic_field_name_org}_#{self.id}_#{key}",radio_button_tag(get_field_name_base, key , ((@prefiled_value.include?(key) || @prefiled_value.include?(key.to_i)) ? true : false), {:required=>@require,:id=>"#{get_basic_field_name_org}_#{self.id}_#{key}"})+value,@markup_options.merge(:class=>"radio inline"))
|
||||
end.join.html_safe
|
||||
end if @member.enable_summary_choice
|
||||
end
|
||||
def render_select
|
||||
prompt = @panel_setting["initial"][I18n.locale.to_s] rescue nil
|
||||
@markup_options.merge!(:prompt => prompt) unless prompt.nil?
|
||||
|
@ -449,7 +458,7 @@ protected
|
|||
if self.markup == "address"
|
||||
return true
|
||||
else
|
||||
LIST[:markups][markup]["muti_lang_input_supprt"] and !(get_data["cross_lang"] == "true")
|
||||
$seminar_list[:markups][markup]["muti_lang_input_supprt"] and !(get_data["cross_lang"] == "true")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
module Admin::SeminarsHelper
|
||||
data = File.open(File.join(File.dirname(__FILE__), '../../../config', 'list.yml')).read
|
||||
$seminar_list = YAML::load(ERB.new(data).result(binding)).symbolize_keys
|
||||
def display_format_string(num, str_length)
|
||||
return format("%0#{str_length}d", num % (10^str_length))
|
||||
end
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
module Admin::SeminarsValuesHelper
|
||||
def show_seminar_type_panel(attribute_field,type)
|
||||
markup = attribute_field.markup
|
||||
$seminar_list[:markups][markup]["panel"] == type ? type : [type,'hide'].join(" ")
|
||||
end
|
||||
def show_west_calender(from_to=nil)
|
||||
case from_to
|
||||
when :to
|
||||
|
|
|
@ -45,7 +45,8 @@ class SeminarMain
|
|||
field :review_start_date, :type => Date
|
||||
field :review_end_date, :type => Date
|
||||
field :last_serial_number, :type => Integer, :default => 0
|
||||
field :assign_mode, :type => Integer, :default => 0 # 0 => 用default signup ids來分配 ,1 => 用final_session來分配
|
||||
field :assign_mode, :type => Integer, :default => 0 # 0 => 用default signup ids來分配 ,1 => 用final_session來分配, 2 => 用final_session來分配(當有preffered session欄位時)
|
||||
field :update_old_flag, :type => Boolean, :default => false
|
||||
belongs_to :seminar_item
|
||||
belongs_to :organizer , :class_name=>"MemberProfile", :foreign_key => :organizer_id
|
||||
has_many :seminar_sessions, :autosave => true, :dependent => :destroy
|
||||
|
@ -178,6 +179,13 @@ class SeminarMain
|
|||
if self["reviewer_ids"].nil?
|
||||
self["reviewer_ids"] = seminar_reviews.pluck(:reviewer_id).flatten.select{|s| !s.nil?}.to_a
|
||||
save_flag = true
|
||||
else
|
||||
self["reviewer_ids"].each do |reviewer_id|
|
||||
seminar_review_to_destroy = seminar_reviews.where(:reviewer_id=>reviewer_id)[1]
|
||||
if seminar_review_to_destroy
|
||||
seminar_review_to_destroy.destroy
|
||||
end
|
||||
end
|
||||
end
|
||||
if seminar_reviews.count != 0 && self.review_start_date.nil? && self.review_end_date.nil?
|
||||
review_start_date = seminar_reviews.pluck(:review_start_date).select{|t| t.present?}.first.to_datetime rescue nil
|
||||
|
@ -264,12 +272,12 @@ class SeminarMain
|
|||
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
|
||||
need_change_seminar_signups = self.seminar_signups.where(:seminar_session_ids.nin=>[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
|
||||
if seminar_signup.seminar_session_ids.present?
|
||||
seminar_signup.seminar_session_ids = seminar_signup.seminar_session_ids.map{|id| @records_all["seminar_session_ids"][id]} rescue []
|
||||
end
|
||||
end
|
||||
count_array = (0...self.seminar_reviews.to_a.count).to_a
|
||||
|
@ -293,15 +301,14 @@ class SeminarMain
|
|||
end
|
||||
seminar
|
||||
end
|
||||
end
|
||||
def map_seminar_signup_ids(old_seminar_signup_ids)
|
||||
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)].to_s rescue ""}.select{|t| t.present?}
|
||||
else
|
||||
[]
|
||||
end
|
||||
end
|
||||
def clone_new_for_object(object,clone_target=nil,clone_mode=false)
|
||||
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?
|
||||
|
@ -386,7 +393,7 @@ def clone_new_for_object(object,clone_target=nil,clone_mode=false)
|
|||
end
|
||||
relations_fields.each do |f|
|
||||
no_dup_flag = false
|
||||
if clone_target.relations[f].macro == :belongs_to
|
||||
if clone_target.relations[f].macro == :belongs_to || clone_target.relations[f].macro == :has_one
|
||||
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
|
||||
|
@ -397,6 +404,32 @@ def clone_new_for_object(object,clone_target=nil,clone_mode=false)
|
|||
else
|
||||
new_object.send("#{f}_id=",(@records_all["#{f}_ids"][clone_target.send("#{f}_id")]))
|
||||
end
|
||||
elsif clone_target.relations[f].macro == :has_one
|
||||
next if self.except_clone_relations.to_s.include?(f)
|
||||
need_clone_relation = clone_target.send(f)
|
||||
clone_relation = new_object.send(f)
|
||||
clone_relation = need_clone_relation.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.send(f).file.nil? rescue true)
|
||||
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
|
||||
elsif (clone_relation.send(f).file rescue nil)
|
||||
clone_relation[f] = File.basename(clone_relation.send(f).file.file.to_s)
|
||||
end
|
||||
file_flag = true
|
||||
end
|
||||
end
|
||||
new_object.send("#{f}=",clone_relation)
|
||||
elsif clone_target.relations[f].macro == :has_many
|
||||
next if self.except_clone_relations.to_s.include?(f)
|
||||
clone_relations = []
|
||||
|
@ -449,4 +482,23 @@ def clone_new_for_object(object,clone_target=nil,clone_mode=false)
|
|||
new_object.copy_id = clone_target.id if new_object.fields.keys.include?("copy_id")
|
||||
return new_object, clone_target
|
||||
end
|
||||
end
|
||||
def fix_old_data
|
||||
unless self.update_old_flag
|
||||
self.seminar_signups.each do |ss|
|
||||
ss.final_sessions = Array(ss.final_session)
|
||||
ss.seminar_session_ids = Array(ss.seminar_session_id)
|
||||
if ss.final_session
|
||||
ss.seminar_signup_contributes.update_all(:final_session=>final_session)
|
||||
SeminarSubmissionValue.where(:seminar_signup_contribute_id.in=> ss.seminar_signup_contributes.pluck(:id)).each{|ssv| ssv.save}
|
||||
end
|
||||
ss.save
|
||||
end
|
||||
self.seminar_sessions.each{|ss| ss.fix_seminar_signup_contribute_ids}
|
||||
self.update(:update_old_flag=>true)
|
||||
end
|
||||
end
|
||||
def enable_review_result
|
||||
self.assign_mode == 2
|
||||
end
|
||||
end
|
|
@ -10,6 +10,8 @@ class SeminarReview
|
|||
field :reviewer_id
|
||||
field :seminar_signup_ids, :type => Array, :default => []
|
||||
field :remove_seminar_signup_ids, :type => Array, :default => []
|
||||
field :seminar_signup_contribute_ids, :type => Array, :default => []
|
||||
field :remove_seminar_signup_contribute_ids, :type => Array, :default => []
|
||||
field :default_seminar_signup_ids, :type => Array, :default => []
|
||||
field :default_topics, :type => Array, :default => []
|
||||
field :default_topics_values, :type => Array, :default => []
|
||||
|
@ -72,9 +74,11 @@ class SeminarReview
|
|||
MemberProfile.find(self.reviewer_id) rescue nil
|
||||
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
|
||||
if (self.default_topics.include?("seminar_signup_contributes.description") && self.seminar_main.assign_mode != 0) || mode != 0
|
||||
final_assign_signup_ids = SeminarSession.where(:id.in=>self.seminar_session_ids).pluck(:seminar_signup_ids).flatten.map{|id| id.to_s} rescue []
|
||||
result = final_assign_signup_ids + self.seminar_signup_ids - self.remove_seminar_signup_ids
|
||||
default_seminar_signup_ids = SeminarSession.where(:id.in=>self.seminar_session_ids).pluck(:default_seminar_signup_ids).flatten
|
||||
default_seminar_signup_ids = SeminarSignup.where(:seminar_session_id=>nil,:id.in=>default_seminar_signup_ids).pluck(:id).map{|id| id.to_s} rescue []
|
||||
result = final_assign_signup_ids + default_seminar_signup_ids + self.seminar_signup_ids - self.remove_seminar_signup_ids
|
||||
result = result.uniq
|
||||
else
|
||||
result = all_seminar_signup_ids
|
||||
|
@ -91,4 +95,24 @@ class SeminarReview
|
|||
self.default_seminar_signup_ids << sid
|
||||
end
|
||||
end
|
||||
def fix_assign
|
||||
seminar_signups = SeminarSignup.where(:id.in=>self.seminar_signup_ids)
|
||||
self.seminar_signup_ids = seminar_signups.pluck(:id).map{|id| id.to_s}
|
||||
seminar_signups = seminar_signups.to_a
|
||||
self.seminar_signup_contribute_ids = seminar_signups.map{|ss| ss.seminar_signup_contribute_ids}.flatten.map{|id| id.to_s}
|
||||
|
||||
remove_seminar_signups = SeminarSignup.where(:id.in=>self.remove_seminar_signup_ids)
|
||||
self.remove_seminar_signup_ids = remove_seminar_signups.pluck(:id).map{|id| id.to_s}
|
||||
remove_seminar_signups = remove_seminar_signups.to_a
|
||||
self.remove_seminar_signup_contribute_ids = remove_seminar_signups.map{|ss| ss.seminar_signup_contribute_ids}.flatten.map{|id| id.to_s}
|
||||
|
||||
self.save
|
||||
end
|
||||
def clear_all_assign
|
||||
self.seminar_signup_ids = []
|
||||
self.remove_seminar_signup_ids = []
|
||||
self.seminar_signup_contribute_ids = []
|
||||
self.remove_seminar_signup_contribute_ids = []
|
||||
self.save
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
class SeminarReviewResult
|
||||
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
PRESENTATION_TYPES = ["oral" , "poster"]
|
||||
field :sort_number , type: Integer , default: -1
|
||||
field :abstract_number , type: String , default: ""
|
||||
field :presentation_type , type: String , default: "" #oral , poster
|
||||
belongs_to :seminar_signup_contribute
|
||||
before_save do
|
||||
self.sort_number = self.abstract_number.match(/[-]{0,1}\d+/)[0].to_i rescue -1
|
||||
end
|
||||
after_save do
|
||||
SeminarSignupContribute.where(:id=>self.seminar_signup_contribute_id).update_all(:sort_number=>self.sort_number,:abstract_number=>self.abstract_number,:presentation_type=>self.presentation_type)
|
||||
SeminarSignup.where(:id.in=>SeminarSignupContribute.where(:id=>self.seminar_signup_contribute_id).pluck(:seminar_signup_id)).update_all(:sort_number=>self.sort_number)
|
||||
end
|
||||
end
|
|
@ -7,7 +7,14 @@ class SeminarSession
|
|||
field :key
|
||||
belongs_to :seminar_main
|
||||
field :seminar_signup_ids, :type => Array, :default => []
|
||||
field :seminar_signup_contribute_ids, :type => Array, :default => []
|
||||
field :default_seminar_signup_ids, :type => Array, :default => []
|
||||
def seminar_signups
|
||||
SeminarSignup.where(:id.in=>seminar_signup_ids)
|
||||
SeminarSignup.any_of({:id.in=>self.seminar_signup_ids},{:preferred_sessions=>self.key,:seminar_session_ids.in=>[[],nil]})
|
||||
end
|
||||
def fix_seminar_signup_contribute_ids
|
||||
@seminar_signup_ids = SeminarSignup.where(:id.in=>self.seminar_signup_ids).pluck(:id).map{|id| id.to_s}
|
||||
self.seminar_signup_contribute_ids = SeminarSignupContribute.where(:seminar_signup_id.in=>@seminar_signup_ids).pluck(:id).map{|id| id.to_s}
|
||||
self.save
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,8 @@ class SeminarSignup
|
|||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
|
||||
field :sort_number , type: Integer, default: 10000
|
||||
|
||||
field :status
|
||||
field :name # become Last Name for TICC
|
||||
field :tel, type: String # become First Name for TICC
|
||||
|
@ -15,15 +17,18 @@ class SeminarSignup
|
|||
field :password
|
||||
field :note, localize: true
|
||||
field :serial_number
|
||||
field :final_session
|
||||
field :final_session #only store old data , not used
|
||||
field :final_sessions
|
||||
field :preferred_sessions, type: Array, default: []
|
||||
belongs_to :seminar_main
|
||||
field :seminar_session_id
|
||||
field :seminar_session_id #only store old data , not used
|
||||
field :seminar_session_ids, type: Array, default: []
|
||||
has_many :seminar_signup_values, :autosave => true, :dependent => :destroy
|
||||
has_many :seminar_signup_contributes, :autosave => true, :dependent => :destroy
|
||||
|
||||
accepts_nested_attributes_for :seminar_signup_values, allow_destroy: true
|
||||
accepts_nested_attributes_for :seminar_signup_contributes, allow_destroy: true
|
||||
scope :sort_ordered, ->{ order_by(:created_at=>1) }
|
||||
scope :sort_ordered, ->{ order_by(:sort_number=>1,:created_at=>1) }
|
||||
|
||||
before_create do
|
||||
unit = self.unit_translations.values.select{|v| v.present?}.first
|
||||
|
@ -64,4 +69,8 @@ class SeminarSignup
|
|||
def display_format_string(num, str_length)
|
||||
return format("%0#{str_length}d", num)
|
||||
end
|
||||
def set_preferred_sessions
|
||||
self.preferred_sessions = self.seminar_signup_contributes.pluck(:preferred_session)
|
||||
self.save
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,10 +4,40 @@ class SeminarSignupContribute
|
|||
include Mongoid::Timestamps
|
||||
|
||||
field :title
|
||||
field :abstract_number , type: String , default: ""
|
||||
field :presentation_type , type: String , default: ""
|
||||
field :sort_number , type: Integer, default: 10000
|
||||
mount_uploader :file, AssetUploader
|
||||
field :description
|
||||
|
||||
field :preferred_session
|
||||
field :final_session
|
||||
belongs_to :seminar_signup
|
||||
has_one :seminar_review_result, dependent: :destroy
|
||||
accepts_nested_attributes_for :seminar_review_result
|
||||
has_many :seminar_submission_values, autosave: true, dependent: :destroy
|
||||
accepts_nested_attributes_for :seminar_submission_values, :allow_destroy => true
|
||||
scope :sort_ordered, ->{ order_by(:sort_number=>1,:created_at=>1) }
|
||||
after_destroy do
|
||||
seminar_signup = self.seminar_signup.reload rescue nil
|
||||
seminar_signup_id = seminar_signup.id.to_s
|
||||
seminar_submission_field_ids = seminar_signup.seminar_main.seminar_submission_fields.where(:markup=>"seminar_preferred_session").pluck(:id) rescue []
|
||||
if seminar_signup && seminar_submission_field_ids.count != 0
|
||||
seminar_signup_contribute_ids = seminar_signup.seminar_signup_contributes.pluck(:id)
|
||||
seminar_submission_values = SeminarSubmissionValue.where(:seminar_signup_contribute_id.in=>seminar_signup_contribute_ids,:seminar_submission_field_id.in=>seminar_submission_field_ids).to_a
|
||||
seminar_sessions = seminar_signup.seminar_main.seminar_sessions.to_a
|
||||
seminar_sessions.each do |ss|
|
||||
ss.default_seminar_signup_ids.delete(seminar_signup_id)
|
||||
ss.save(:validate=>false)
|
||||
end
|
||||
seminar_submission_value = seminar_submission_values.last
|
||||
val = seminar_submission_value["val"].to_i rescue nil
|
||||
unless val.nil?
|
||||
seminar_session = seminar_sessions.select{|ss| ss.key == val}.first
|
||||
if seminar_session
|
||||
seminar_session.default_seminar_signup_ids << seminar_signup_id
|
||||
seminar_session.save(:validate=>false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -22,7 +22,7 @@ class SeminarSignupField
|
|||
field :typeC, type: Hash, default: {calendar: "west_calendar", format: "format3"}
|
||||
field :typeD, type: Hash, default: {cross_lang: false}
|
||||
field :typeE, type: Hash, default: {}
|
||||
|
||||
field :typeF, type: Hash, default: {}
|
||||
belongs_to :seminar_main
|
||||
has_many :seminar_signup_values, autosave: true, dependent: :destroy
|
||||
accepts_nested_attributes_for :seminar_signup_values, :allow_destroy => true
|
||||
|
@ -71,7 +71,7 @@ class SeminarSignupField
|
|||
end
|
||||
|
||||
def panel
|
||||
panel = LIST[:markups][self[:markup]]["panel"]
|
||||
panel = $seminar_list[:markups][self[:markup]]["panel"]
|
||||
end
|
||||
|
||||
def get_data
|
||||
|
|
|
@ -22,7 +22,7 @@ class SeminarSubmissionField
|
|||
field :typeC, type: Hash, default: {calendar: "west_calendar", format: "format3"}
|
||||
field :typeD, type: Hash, default: {cross_lang: false}
|
||||
field :typeE, type: Hash, default: {}
|
||||
|
||||
field :typeF, type: Hash, default: {cross_lang: "true"}
|
||||
belongs_to :seminar_main
|
||||
has_many :seminar_submission_values, autosave: true, dependent: :destroy
|
||||
accepts_nested_attributes_for :seminar_submission_values, :allow_destroy => true
|
||||
|
@ -96,7 +96,7 @@ class SeminarSubmissionField
|
|||
end
|
||||
|
||||
def panel
|
||||
panel = LIST[:markups][self[:markup]]["panel"]
|
||||
panel = $seminar_list[:markups][self[:markup]]["panel"]
|
||||
end
|
||||
|
||||
def get_data
|
||||
|
|
|
@ -6,12 +6,34 @@ class SeminarSubmissionValue
|
|||
include ::Admin::SeminarsValuesHelper
|
||||
|
||||
field :key, type: String
|
||||
|
||||
field :val
|
||||
belongs_to :seminar_submission_field
|
||||
belongs_to :seminar_signup_contribute
|
||||
before_save :check_key
|
||||
before_save :data_proc
|
||||
|
||||
after_save do
|
||||
if (self.seminar_submission_field.markup == "seminar_preferred_session" rescue false)
|
||||
val_change = self.val_change
|
||||
self.seminar_signup_contribute.update(:preferred_session=>val.to_i)
|
||||
self.seminar_signup_contribute.seminar_signup.set_preferred_sessions
|
||||
unless val_change.nil?
|
||||
old_val = val_change[0]
|
||||
new_val = val_change[1]
|
||||
seminar_signup_id = self.seminar_signup_contribute.seminar_signup_id.to_s
|
||||
seminar_sessions = self.seminar_submission_field.seminar_main.seminar_sessions.to_a
|
||||
old_seminar_session = seminar_sessions.select{|ss| ss.key.to_s == old_val}.first
|
||||
if old_seminar_session
|
||||
old_seminar_session.default_seminar_signup_ids.delete seminar_signup_id
|
||||
old_seminar_session.save
|
||||
end
|
||||
new_seminar_session = seminar_sessions.select{|ss| ss.key.to_s == new_val}.first
|
||||
if new_seminar_session
|
||||
new_seminar_session.default_seminar_signup_ids << seminar_signup_id
|
||||
new_seminar_session.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
def add_more_counter
|
||||
index_max = self["val"].count rescue 0
|
||||
index_max == 0 ? 1 : index_max
|
||||
|
@ -26,7 +48,7 @@ class SeminarSubmissionValue
|
|||
else
|
||||
self.seminar_submission_field.get_data["cross_lang"] =="true" ? self["val"] : Hash[site.valid_locales.collect{|lang| [lang,self[lang.to_sym]]}]
|
||||
end
|
||||
when 'select','radio_button','address'
|
||||
when 'select','radio_button','address','seminar_preferred_session'
|
||||
self["val"]
|
||||
when 'date'
|
||||
if !self["val"].blank? and !self["val"]['(1i)'].blank?
|
||||
|
@ -54,6 +76,8 @@ class SeminarSubmissionValue
|
|||
end
|
||||
elsif (seminar_submission_field.markup.eql?("select") || seminar_submission_field.markup.eql?("radio_button"))
|
||||
field_value = seminar_submission_field.markup_value["#{self.value}"][I18n.locale] rescue nil
|
||||
elsif seminar_submission_field.markup.eql?("seminar_preferred_session")
|
||||
field_value = seminar_submission_field.seminar_main.summary_chioices[self.value.to_i] rescue nil
|
||||
elsif seminar_submission_field.markup.eql?("address")
|
||||
field_value = rf[:address_key][I18n.locale].map{|k,v| v}.delete_if(&:blank?).join(', ')
|
||||
elsif seminar_submission_field.markup.eql?("date")
|
||||
|
@ -129,7 +153,8 @@ class SeminarSubmissionValue
|
|||
when "radio_button"
|
||||
markup_values = seminar_submission_field.markup_value
|
||||
markup_values[self.value][locale.to_s]
|
||||
|
||||
when "seminar_preferred_session"
|
||||
seminar_submission_field.seminar_main.summary_chioices[self.value.to_i] rescue nil
|
||||
when "checkbox"
|
||||
markup_values = seminar_submission_field.markup_value
|
||||
self.value.collect{|key| markup_values["#{key}"][I18n.locale]}.join(",")
|
||||
|
@ -195,7 +220,7 @@ end
|
|||
end
|
||||
end # of self.seminar_submission_field.add_more
|
||||
|
||||
when 'select','date','radio_button'
|
||||
when 'select','date','radio_button','seminar_preferred_session'
|
||||
self["val"] = self[:temp_data]
|
||||
when 'checkbox'
|
||||
self["val"] = self[:temp_data].keys
|
||||
|
|
|
@ -0,0 +1,132 @@
|
|||
<style type="text/css">
|
||||
.text_wrap{
|
||||
background: #98fffa;
|
||||
max-height: 20em;
|
||||
overflow-wrap: break-word;
|
||||
overflow: scroll;
|
||||
padding: 0 1.5em;
|
||||
}
|
||||
.text_wrap h4{
|
||||
text-align: center;
|
||||
}
|
||||
object{
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
<%= form_for @seminar_signup_contribute, url: admin_seminar_review_result_path(@seminar_signup_contribute), html: {class: "form-horizontal main-forms"} do |f| %>
|
||||
<% seminar_signup = @seminar_signup_contribute.seminar_signup %>
|
||||
<% referer_url = request.referer %>
|
||||
<fieldset>
|
||||
<% render :partial => "admin/seminars/get_display_fields" %>
|
||||
<% @field_name_translations.each_with_index do |trans,i|%>
|
||||
<% next unless @display_field.include?(@field_names[i]) %>
|
||||
<div class="control-group">
|
||||
<div class="control-label"><%=trans%></div>
|
||||
<div class="controls">
|
||||
<% val = "" %>
|
||||
<% names = @field_names[i].split(".") %>
|
||||
<% if names[0] == "seminar_signup_field_set" %>
|
||||
<% if names[1] == "name" %>
|
||||
<% val = seminar_signup.name %>
|
||||
<% elsif names[1] == 'status' %>
|
||||
<% val = t("seminar.registration_status_#{seminar_signup.status}") if !seminar_signup.status.blank? %>
|
||||
<% elsif names[1] != 'recaptcha' %>
|
||||
<% val = seminar_signup.send("#{names[1]}") %>
|
||||
<% end %>
|
||||
<% elsif names[0] == "default" %>
|
||||
<% if names[2] == "name" %>
|
||||
<% val = seminar_signup.name %>
|
||||
<% elsif names[2] == "tel" %>
|
||||
<% val = seminar_signup.tel %>
|
||||
<% elsif names[2] == "registration_status" %>
|
||||
<% val = t("seminar.registration_status_#{seminar_signup.status}") if !seminar_signup.status.blank? %>
|
||||
<% end %>
|
||||
<% elsif names[0] == "seminar_signup_field_custom" || names[0] == "seminar_signup_fields" %>
|
||||
<% val = seminar_signup.seminar_signup_values.where(:key=>names[1]).first.get_value_by_locale(I18n.locale) rescue "" %>
|
||||
<% elsif names[0] == "seminar_signup_contributes" %>
|
||||
<% if names[1] == "file" %>
|
||||
<% seminar_signup_contribute = @seminar_signup_contribute %>
|
||||
<% description = seminar_signup_contribute.description.to_s %>
|
||||
<% if @seminar.enable_summary_choice
|
||||
if (seminar_signup_contribute.description.to_s.to_i.to_s == seminar_signup_contribute.description)
|
||||
description = @seminar.summary_chioices[seminar_signup_contribute.description.to_i] rescue seminar_signup_contribute.description
|
||||
else
|
||||
description = seminar_signup_contribute.description.map{|i| @seminar.summary_chioices[i.to_i] rescue "" }.join("<br>") rescue seminar_signup_contribute.description
|
||||
end
|
||||
end %>
|
||||
<% file_path = seminar_signup_contribute.file.path %>
|
||||
<% file_title = (seminar_signup_contribute.title.blank? ? File.basename(seminar_signup_contribute.file.path) : seminar_signup_contribute.title) %>
|
||||
<% file_url = seminar_signup_contribute.file.url %>
|
||||
<% file_extname = File.extname(file_path) %>
|
||||
<% if (file_extname.match(/pdf/i) rescue false) %>
|
||||
<% val = "<object data=\"#{file_url}\" type=\"application/pdf\" title=\"#{file_title}\" height=\"500\">
|
||||
<a href=\"#{file_url}\" title=\"#{file_title}\">#{file_title}</a>
|
||||
<embed src=\"#{file_url}\" title=\"#{file_title}\" type=\"application/pdf\" />
|
||||
</object>" %>
|
||||
<% elsif (file_extname.match(/(jpg|jpeg|png|gif|bmp)/i) rescue false) %>
|
||||
<% val = "<a title=\"#{t("seminar.view_original_image")}\" href=\"#{file_url}\" target=\"_blank\"><img src=\"#{file_url}\"alt=\"#{file_title}\" height=\"500\"></a>" %>
|
||||
<% else %>
|
||||
<% file_content = File.read(file_path) rescue "" %>
|
||||
<% if file_content.is_utf8? %>
|
||||
<% file_content = file_content.gsub(/(\r\n|\n)/,"<br>")%>
|
||||
<% val = "<div class=\"text_wrap\"><a class=\"pull-right\" href=\"#{file_url}\" title=\"#{t(:download)}\">#{t(:download)}</a><div style=\"clear: both;\"></div><h4>#{file_title}</h4>#{file_content}</div>"%>
|
||||
<% else %>
|
||||
<% val = link_to( file_title, file_url , {:target => '_blank', :title => Nokogiri::HTML(description.gsub("<br>"," , ")).text} ) if seminar_signup_contribute.file.file %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% if names[1] == "description" %>
|
||||
<% description = @seminar_signup_contribute.send(names[1]) %>
|
||||
<% if @seminar.enable_summary_choice
|
||||
if (description.to_s.to_i.to_s == description)
|
||||
description = @seminar.summary_chioices[description.to_i] rescue description
|
||||
else
|
||||
description = description.map{|i| @seminar.summary_chioices[i.to_i] rescue "" }.join("<br>") rescue description
|
||||
end
|
||||
end %>
|
||||
<% val = description %>
|
||||
<% else %>
|
||||
<% val = @seminar_signup_contribute.send(names[1]).to_s %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% elsif names[0] == "seminar_submission_fields" %>
|
||||
<% val = @seminar_signup_contribute.seminar_submission_values.where(:key=>names[1]).first.get_value_by_locale(I18n.locale) rescue "" %>
|
||||
<% seminar_submission_field = seminar_signup.seminar_main.seminar_submission_fields.where(:key=>names[1]).first %>
|
||||
<% if seminar_submission_field && seminar_submission_field.markup == "seminar_preferred_session"
|
||||
seminar_submission_value = @seminar_signup_contribute.seminar_submission_values.where(:key=>names[1]).first
|
||||
val = "<span data-id=\"#{seminar_submission_value.id rescue ''}\">#{(seminar_submission_value.get_value_by_locale(I18n.locale) rescue "")}</span>"
|
||||
end %>
|
||||
<% elsif names[0] == "seminar_signup" %>
|
||||
<% val = (seminar_signup.send("display_"+names[1]) rescue seminar_signup.send(names[1])) rescue nil %>
|
||||
<% elsif names[0] == "seminar_review_result" %>
|
||||
<% val = @seminar_signup_contribute.send(names[1]) rescue "" %>
|
||||
<% end %>
|
||||
<%= val.html_safe %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<!-- Input Area -->
|
||||
<div class="input-area">
|
||||
<%= f.fields_for :seminar_review_result,@seminar_review_result do |f| %>
|
||||
<div class="control-group">
|
||||
<%= f.label :abstract_number,:class=>"control-label" %>
|
||||
<div class="controls"><%= f.text_field :abstract_number %></div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<%= f.label :presentation_type,:class=>"control-label" %>
|
||||
<div class="controls">
|
||||
<% SeminarReviewResult::PRESENTATION_TYPES.each do |v| %>
|
||||
<label><%= f.radio_button :presentation_type, v %><%=v%></label>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= hidden_field_tag :referer_url, referer_url %>
|
||||
<!-- Form Actions -->
|
||||
<div class="form-actions">
|
||||
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
||||
<%= link_to t('cancel'), referer_url, :class=>"btn" %>
|
||||
</div>
|
||||
</fieldset>
|
||||
<% end %>
|
|
@ -0,0 +1,5 @@
|
|||
<%= form_for @seminar_submission_value, url: admin_seminar_submission_value_path(@seminar_submission_value), html: {class: "form-horizontal main-forms",id: "jquery_form"} do |f| %>
|
||||
<div class="form-group" style="<%= @seminar_submission_field.markup=='text_area' ? 'display: flex;justify-content: flex-end;text-align: right;' : '' %>">
|
||||
<%= @seminar_submission_field.block_helper(@seminar,0,false,"seminar_signup_contribute",@con, @seminar_submission_field.to_require,@seminar_submission_field) %>
|
||||
</div>
|
||||
<% end %>
|
|
@ -39,7 +39,8 @@
|
|||
<label class="control-label muted" for=""><%= t(:type)%></label>
|
||||
<div class="controls">
|
||||
<select class="dataType" data-type="select" name=<%= "#{@field_name}[seminar_signup_fields][#{@af_counter}][markup]"%>>
|
||||
<%LIST[:markups].each do |key,val|%>
|
||||
<%$seminar_list[:markups].each do |key,val|%>
|
||||
<% next if val["display_only"] && val["display_only"] != "seminar_signup_field" %>
|
||||
<% if key != 'address' %>
|
||||
<option value="<%= key %>" <%= attribute_field.markup == key ? 'selected="selected"' : '' %> ref="<%=val["panel"]%>"><%=t("lists.markups."+key)%></option >
|
||||
<% end %>
|
||||
|
@ -51,7 +52,7 @@
|
|||
|
||||
<div class="field-type fade"></div>
|
||||
|
||||
<%= content_tag :div,:class=>"field-type default fade in #{show_type_panel(attribute_field,"typeA")}" do%>
|
||||
<%= content_tag :div,:class=>"field-type default fade in #{show_seminar_type_panel(attribute_field,"typeA")}" do%>
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t(:enabled_for)%></label>
|
||||
<div class="controls">
|
||||
|
@ -66,9 +67,9 @@
|
|||
</div>
|
||||
</div>
|
||||
<%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:values=>attribute_field["typeA"]["placeholder"],:field_name=>"#{@field_name}[seminar_signup_fields][#{@af_counter}][typeA][placeholder]"}%>
|
||||
<% end if show_type_panel(attribute_field,"typeA") != 'typeA hide' %>
|
||||
<% end if show_seminar_type_panel(attribute_field,"typeA") != 'typeA hide' %>
|
||||
|
||||
<%= content_tag :div,:class=>"field-type default fade in #{show_type_panel(attribute_field,"typeB")}" do %>
|
||||
<%= content_tag :div,:class=>"field-type default fade in #{show_seminar_type_panel(attribute_field,"typeB")}" do %>
|
||||
<%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:label_ext=>t(:initial),:values=>attribute_field["typeB"]["initial"],:field_name=>"#{@field_name}[seminar_signup_fields][#{@af_counter}][typeB][initial]"}%>
|
||||
|
||||
<% if attribute_field.self_defined_markup_options?%>
|
||||
|
@ -77,9 +78,9 @@
|
|||
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:values=>attribute_field["option_list"],:field_name=> "#{@field_name}[seminar_signup_fields][#{@af_counter}][typeB][option_list]"} %>
|
||||
<% end #of self_defined_markup_options?%>
|
||||
|
||||
<% end if show_type_panel(attribute_field,"typeB") != 'typeB hide' %>
|
||||
<% end if show_seminar_type_panel(attribute_field,"typeB") != 'typeB hide' %>
|
||||
|
||||
<%= content_tag :div,:class=>"field-type default fade in #{show_type_panel(attribute_field,"typeC")}" do %>
|
||||
<%= content_tag :div,:class=>"field-type default fade in #{show_seminar_type_panel(attribute_field,"typeC")}" do %>
|
||||
<div class="control-group">
|
||||
<label class="control-label"><%= t("date.format")%></label>
|
||||
<div class="controls">
|
||||
|
@ -108,9 +109,9 @@
|
|||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<% end if show_type_panel(attribute_field,"typeC") != 'typeC hide' %>
|
||||
<% end if show_seminar_type_panel(attribute_field,"typeC") != 'typeC hide' %>
|
||||
|
||||
<%= content_tag :div,:class=>"field-type default fade in #{show_type_panel(attribute_field,"typeD")}" do%>
|
||||
<%= content_tag :div,:class=>"field-type default fade in #{show_seminar_type_panel(attribute_field,"typeD")}" do%>
|
||||
<div class="control-group">
|
||||
<label class="control-label"><%= t(:enabled_for)%></label>
|
||||
<div class="controls">
|
||||
|
@ -121,11 +122,11 @@
|
|||
</div>
|
||||
</div>
|
||||
<%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:field_name=>"#{@field_name}[seminar_signup_fields][#{@af_counter}][typeD][placeholder]",:values=>attribute_field["typeD"]["placeholder"]} %>
|
||||
<% end if show_type_panel(attribute_field,"typeD") != 'typeD hide' %>
|
||||
<% end if show_seminar_type_panel(attribute_field,"typeD") != 'typeD hide' %>
|
||||
|
||||
<%= content_tag :div,:class=>"field-type default fade in #{show_type_panel(attribute_field,"typeE")}" do%>
|
||||
<%= content_tag :div,:class=>"field-type default fade in #{show_seminar_type_panel(attribute_field,"typeE")}" do%>
|
||||
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:field_name=>"#{@field_name}[seminar_signup_fields][#{@af_counter}][typeE][option_list]",:values=>attribute_field["typeE"]["option_list"]}%>
|
||||
<% end if show_type_panel(attribute_field,"typeE") != 'typeE hide' %>
|
||||
<% end if show_seminar_type_panel(attribute_field,"typeE") != 'typeE hide' %>
|
||||
|
||||
<%= hidden_field "#{@field_name}[seminar_signup_fields][#{@af_counter}]","id",:value=>attribute_field.id%>
|
||||
|
||||
|
|
|
@ -39,7 +39,8 @@
|
|||
<label class="control-label muted" for=""><%= t(:type)%></label>
|
||||
<div class="controls">
|
||||
<select class="dataType" data-type="select" name=<%= "#{@field_name}[seminar_submission_fields][#{@af_counter}][markup]"%>>
|
||||
<%LIST[:markups].each do |key,val|%>
|
||||
<%$seminar_list[:markups].each do |key,val|%>
|
||||
<% next if val["display_only"] && val["display_only"] != "seminar_submission_field" %>
|
||||
<% if key != 'address' %>
|
||||
<option value="<%= key %>" <%= attribute_submission_field.markup == key ? 'selected="selected"' : '' %> ref="<%=val["panel"]%>"><%=t("lists.markups."+key)%></option >
|
||||
<% end %>
|
||||
|
@ -51,7 +52,7 @@
|
|||
|
||||
<div class="field-type fade"></div>
|
||||
|
||||
<%= content_tag :div,:class=>"field-type default fade in #{show_type_panel(attribute_submission_field,"typeA")}" do%>
|
||||
<%= content_tag :div,:class=>"field-type default fade in #{show_seminar_type_panel(attribute_submission_field,"typeA")}" do%>
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t(:enabled_for)%></label>
|
||||
<div class="controls">
|
||||
|
@ -66,9 +67,9 @@
|
|||
</div>
|
||||
</div>
|
||||
<%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:values=>attribute_submission_field["typeA"]["placeholder"],:field_name=>"#{@field_name}[seminar_submission_fields][#{@af_counter}][typeA][placeholder]"}%>
|
||||
<% end if show_type_panel(attribute_submission_field,"typeA") != 'typeA hide' %>
|
||||
<% end if show_seminar_type_panel(attribute_submission_field,"typeA") != 'typeA hide' %>
|
||||
|
||||
<%= content_tag :div,:class=>"field-type default fade in #{show_type_panel(attribute_submission_field,"typeB")}" do %>
|
||||
<%= content_tag :div,:class=>"field-type default fade in #{show_seminar_type_panel(attribute_submission_field,"typeB")}" do %>
|
||||
<%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:label_ext=>t(:initial),:values=>attribute_submission_field["typeB"]["initial"],:field_name=>"#{@field_name}[seminar_submission_fields][#{@af_counter}][typeB][initial]"}%>
|
||||
|
||||
<% if attribute_submission_field.self_defined_markup_options?%>
|
||||
|
@ -77,9 +78,9 @@
|
|||
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:values=>attribute_submission_field["option_list"],:field_name=> "#{@field_name}[seminar_submission_fields][#{@af_counter}][typeB][option_list]"} %>
|
||||
<% end #of self_defined_markup_options?%>
|
||||
|
||||
<% end if show_type_panel(attribute_submission_field,"typeB") != 'typeB hide' %>
|
||||
<% end if show_seminar_type_panel(attribute_submission_field,"typeB") != 'typeB hide' %>
|
||||
|
||||
<%= content_tag :div,:class=>"field-type default fade in #{show_type_panel(attribute_submission_field,"typeC")}" do %>
|
||||
<%= content_tag :div,:class=>"field-type default fade in #{show_seminar_type_panel(attribute_submission_field,"typeC")}" do %>
|
||||
<div class="control-group">
|
||||
<label class="control-label"><%= t("date.format")%></label>
|
||||
<div class="controls">
|
||||
|
@ -108,9 +109,9 @@
|
|||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<% end if show_type_panel(attribute_submission_field,"typeC") != 'typeC hide' %>
|
||||
<% end if show_seminar_type_panel(attribute_submission_field,"typeC") != 'typeC hide' %>
|
||||
|
||||
<%= content_tag :div,:class=>"field-type default fade in #{show_type_panel(attribute_submission_field,"typeD")}" do%>
|
||||
<%= content_tag :div,:class=>"field-type default fade in #{show_seminar_type_panel(attribute_submission_field,"typeD")}" do%>
|
||||
<div class="control-group">
|
||||
<label class="control-label"><%= t(:enabled_for)%></label>
|
||||
<div class="controls">
|
||||
|
@ -121,12 +122,23 @@
|
|||
</div>
|
||||
</div>
|
||||
<%= render :partial=>"shared/attribute_field/placeholder_block",:locals=>{:field_name=>"#{@field_name}[seminar_submission_fields][#{@af_counter}][typeD][placeholder]",:values=>attribute_submission_field["typeD"]["placeholder"]} %>
|
||||
<% end if show_type_panel(attribute_submission_field,"typeD") != 'typeD hide' %>
|
||||
<% end if show_seminar_type_panel(attribute_submission_field,"typeD") != 'typeD hide' %>
|
||||
|
||||
<%= content_tag :div,:class=>"field-type default fade in #{show_type_panel(attribute_submission_field,"typeE")}" do%>
|
||||
<%= content_tag :div,:class=>"field-type default fade in #{show_seminar_type_panel(attribute_submission_field,"typeE")}" do%>
|
||||
<%= render :partial=>"shared/attribute_field/list_block",:locals=>{:field_name=>"#{@field_name}[seminar_submission_fields][#{@af_counter}][typeE][option_list]",:values=>attribute_submission_field["typeE"]["option_list"]}%>
|
||||
<% end if show_type_panel(attribute_submission_field,"typeE") != 'typeE hide' %>
|
||||
|
||||
<% end if show_seminar_type_panel(attribute_submission_field,"typeE") != 'typeE hide' %>
|
||||
<%= content_tag :div,:class=>"field-type default fade in #{show_seminar_type_panel(attribute_submission_field,"typeF")}" do%>
|
||||
<div class="control-group">
|
||||
<label class="control-label muted" for=""><%= t(:options)%></label>
|
||||
<div class="controls add-input">
|
||||
<% if @attribute.enable_summary_choice %>
|
||||
<% @attribute.summary_chioices.each do |v| %>
|
||||
<div><%=v%></div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% end if show_seminar_type_panel(attribute_submission_field,"typeF") != 'typeF hide' %>
|
||||
<%= hidden_field "#{@field_name}[seminar_submission_fields][#{@af_counter}]","id",:value=>attribute_submission_field.id%>
|
||||
|
||||
</div>
|
|
@ -61,12 +61,29 @@
|
|||
<% @field_name_translations << t('seminar_signup.description') %>
|
||||
<% @seminar.seminar_submission_fields.each do |s| %>
|
||||
<% @field_names << "seminar_submission_fields.#{s.key}" %>
|
||||
<% @field_name_translations << s.title %>
|
||||
<% if s.markup != "seminar_preferred_session"
|
||||
@field_name_translations << s.title
|
||||
else
|
||||
@field_name_translations << t("seminar.assigned_session")
|
||||
end %>
|
||||
<% end %>
|
||||
<% @display_field = @seminar_signup_admin_setting.display_field %>
|
||||
<% @display_field = @seminar_signup_admin_setting.display_field rescue [] %>
|
||||
<% if @display_field.blank?
|
||||
@display_field = @field_names - default_hidden
|
||||
end %>
|
||||
<% if @enable_review_result
|
||||
@field_names.insert(1,"seminar_review_result.review")
|
||||
@field_name_translations.insert(1,t("seminar.review"))
|
||||
@display_field.insert(1,"seminar_review_result.review")
|
||||
|
||||
@field_names << "seminar_review_result.abstract_number"
|
||||
@field_name_translations << t("helpers.label.seminar_review_result.abstract_number")
|
||||
@display_field << "seminar_review_result.abstract_number"
|
||||
|
||||
@field_names << "seminar_review_result.presentation_type"
|
||||
@field_name_translations << t("helpers.label.seminar_review_result.presentation_type")
|
||||
@display_field << "seminar_review_result.presentation_type"
|
||||
end%>
|
||||
<% else %>
|
||||
<% @field_names = [] %>
|
||||
<% @field_name_translations = [] %>
|
||||
|
|
|
@ -20,7 +20,10 @@
|
|||
<% @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(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} %>
|
||||
<% org_seminar_signups = org_seminar_signups.where(:id.nin=>@seminar_signups.map{|ss| ss.id})%>
|
||||
<% @append_contribute_ids = seminar_review.seminar_signup_contribute_ids %>
|
||||
<% @remove_contribute_ids = seminar_review.remove_seminar_signup_contribute_ids %>
|
||||
<%= render :partial => "seminar_signup_render_table",:locals=>{:@seminar_signups=>@seminar_signups,:@drag => true,:@include_blank=>true,:@reviewer_id=>seminar_review.id.to_s,:@preferred_sessions=>seminar_review.session_ids} %>
|
||||
<%
|
||||
pagination_html = content_tag :div, class: "bottomnav clearfix", style: "position: static;" do
|
||||
content_tag :div, paginate(@seminar_signups), class: "pagination pagination-centered"
|
||||
|
@ -40,6 +43,9 @@
|
|||
<% @seminar_signups = org_seminar_signups
|
||||
@include_blank = false
|
||||
@reviewer_id = nil
|
||||
@append_contribute_ids = nil
|
||||
@remove_contribute_ids = nil
|
||||
@preferred_sessions = nil
|
||||
%>
|
||||
<div style="float: right;width: 50%;" data-count="<%=count+=1%>">
|
||||
<div id="main-table" style="overflow: scroll;">
|
||||
|
@ -227,16 +233,29 @@
|
|||
var mode = "";
|
||||
var id = target.data("id");
|
||||
var signup_id = ui.item.data("id");
|
||||
if(target.find("tr[data-id=\""+signup_id+"\"]").length != 0){
|
||||
var contribute_id = ui.item.data("contribute_id");
|
||||
var target_filter = "tr[data-id=\""+signup_id+"\"]";
|
||||
if(contribute_id){
|
||||
target_filter += "[data-contribute_id=\""+contribute_id+"\"]";
|
||||
}else if(contribute_id == undefined){
|
||||
contribute_id = "";
|
||||
}
|
||||
if(target.find(target_filter).length != 0){
|
||||
mode = "append";
|
||||
if(target.find("tr[data-id=\""+signup_id+"\"]").length > 1){
|
||||
var target_signups= target.find("tr[data-id=\""+signup_id+"\"]");
|
||||
if(target.find(target_filter).length > 1){
|
||||
var target_signups= target.find(target_filter);
|
||||
for(var i=1;i<target_signups.length;i++){
|
||||
target_signups.eq(i).remove();
|
||||
}
|
||||
}
|
||||
}else{
|
||||
ui.item.find(".repeated").css("visibility","visible");
|
||||
}else if(target.find("tr[data-id=\""+signup_id+"\"]").length != 0){
|
||||
mode = "remove_contribute";
|
||||
target.find("tr[data-id=\""+signup_id+"\"]").find(".repeated").css("visibility","");
|
||||
}
|
||||
else{
|
||||
mode = "remove";
|
||||
ui.item.find(".repeated").css("visibility","");
|
||||
}
|
||||
if(target.find("tr").not(".blank_tr").length == 0){
|
||||
target.find(".blank_tr").css("display","");
|
||||
|
@ -244,7 +263,7 @@
|
|||
target.find(".blank_tr").css("display","none");
|
||||
}
|
||||
if(id != undefined){
|
||||
$.post("<%=admin_seminar_update_seminar_review_path%>",{id: id,mode: mode,signup_id: signup_id}).done(function(data){
|
||||
$.post("<%=admin_seminar_update_seminar_review_path%>",{id: id,mode: mode,signup_id: signup_id,contribute_id: contribute_id}).done(function(data){
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<table class="table main-list">
|
||||
<table class="table main-list" style="background: #ffffff;">
|
||||
<thead>
|
||||
<tr>
|
||||
<% render :partial => "get_display_fields" %>
|
||||
|
@ -18,12 +18,27 @@
|
|||
<% display_title = @seminar.nil? %>
|
||||
<% @seminar_signups.each do |seminar_signup| %>
|
||||
<% @seminar = seminar_signup.seminar_main if display_title %>
|
||||
<% len = seminar_signup.seminar_signup_contributes.count %>
|
||||
<% rowspan = "rowspan=#{len==0? 1 : len}" %>
|
||||
<% vals = [] %>
|
||||
<tr data-id="<%=seminar_signup.id.to_s%>">
|
||||
<% edit_urls = {} %>
|
||||
<% contribute_ids = seminar_signup.seminar_signup_contribute_ids.map{|id| id.to_s} %>
|
||||
<% @append_contribute_ids = @append_contribute_ids.to_a
|
||||
@remove_contribute_ids = @remove_contribute_ids.to_a
|
||||
%>
|
||||
<% intersection_contribute_ids = @append_contribute_ids & contribute_ids rescue [] %>
|
||||
<% if intersection_contribute_ids.count != 0
|
||||
contribute_ids = intersection_contribute_ids
|
||||
else
|
||||
if @preferred_sessions
|
||||
contribute_ids = seminar_signup.seminar_signup_contributes.any_of({:preferred_session.in=>@preferred_sessions,:final_session=>nil},{:final_session.in=>@preferred_sessions}).pluck(:id).map{|id| id.to_s}
|
||||
end
|
||||
end %>
|
||||
<% contribute_ids = contribute_ids - @remove_contribute_ids
|
||||
seminar_signup_contributes = seminar_signup.seminar_signup_contributes.where(:id.in=>contribute_ids).sort_ordered.to_a
|
||||
contribute_ids = seminar_signup_contributes.map{|s| s.id}
|
||||
%>
|
||||
<tr data-id="<%=seminar_signup.id.to_s%>" data-contribute_id="<%=contribute_ids[0].to_s%>">
|
||||
<% if @drag%>
|
||||
<td <%=rowspan%>><span class="brand"><i class="icons-list-2"></i></span></td>
|
||||
<td><span class="brand"><i class="icons-list-2"></i></span></td>
|
||||
<% end %>
|
||||
<% vals << seminar_signup.seminar_main.title if display_title %>
|
||||
<% @display_field.each_with_index do |fn,i|%>
|
||||
|
@ -34,7 +49,7 @@
|
|||
<% val = seminar_signup.name
|
||||
val += "<div class=\"quick-edit\">
|
||||
<ul class=\"nav nav-pills\">"
|
||||
if can_edit_or_delete?(seminar_signup)
|
||||
if @can_edit
|
||||
val += "<li><a href=\"/admin/seminar_signups/#{seminar_signup.id}/edit\">#{t(:edit)}</a></li>
|
||||
<li><a href=\"#{admin_seminar_signup_path(seminar_signup.id)}\" class=\"delete text-error\" rel=\"nofollow\" data-method=\"delete\" data-confirm=\"Are you sure?\">#{t(:delete_)}</a></li>"
|
||||
end
|
||||
|
@ -51,7 +66,7 @@
|
|||
<% val = seminar_signup.name
|
||||
val += "<div class=\"quick-edit\">
|
||||
<ul class=\"nav nav-pills\">"
|
||||
if can_edit_or_delete?(seminar_signup)
|
||||
if @can_edit
|
||||
val += "<li><a href=\"/admin/seminar_signups/#{seminar_signup.id}/edit\">#{t(:edit)}</a></li>
|
||||
<li><a href=\"#{admin_seminar_signup_path(seminar_signup.id)}\" class=\"delete text-error\" rel=\"nofollow\" data-method=\"delete\" data-confirm=\"Are you sure?\">#{t(:delete_)}</a></li>"
|
||||
end
|
||||
|
@ -67,10 +82,10 @@
|
|||
<% val = seminar_signup.seminar_signup_values.where(:key=>names[1]).first.get_value_by_locale(I18n.locale) rescue "" %>
|
||||
<% elsif names[0] == "seminar_signup_contributes" %>
|
||||
<% if names[1] == "file" %>
|
||||
<% val = seminar_signup.seminar_signup_contributes.to_a %>
|
||||
<% val = seminar_signup_contributes %>
|
||||
<% else %>
|
||||
<% if names[1] == "description" %>
|
||||
<% descriptions = seminar_signup.seminar_signup_contributes.collect{|s| s.send(names[1])} %>
|
||||
<% descriptions = seminar_signup_contributes.collect{|s| s.send(names[1])} %>
|
||||
<% if @seminar.enable_summary_choice
|
||||
descriptions = descriptions.map do |description|
|
||||
if (description.to_s.to_i.to_s == description)
|
||||
|
@ -82,13 +97,30 @@
|
|||
end %>
|
||||
<% val = descriptions %>
|
||||
<% else %>
|
||||
<% val = seminar_signup.seminar_signup_contributes.collect{|s| s.send(names[1]).to_s} %>
|
||||
<% val = seminar_signup_contributes.collect{|s| s.send(names[1]).to_s} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% elsif names[0] == "seminar_submission_fields" %>
|
||||
<% val = seminar_signup.seminar_signup_contributes.collect{|s| (s.seminar_submission_values.where(:key=>names[1]).first.get_value_by_locale(I18n.locale) rescue "")} %>
|
||||
<% val = seminar_signup_contributes.collect{|s| (s.seminar_submission_values.where(:key=>names[1]).first.get_value_by_locale(I18n.locale) rescue "")} %>
|
||||
<% seminar_submission_field = seminar_signup.seminar_main.seminar_submission_fields.where(:key=>names[1]).first %>
|
||||
<% if seminar_submission_field && seminar_submission_field.markup == "seminar_preferred_session"
|
||||
val = seminar_signup_contributes.collect{|s|
|
||||
seminar_submission_value = s.seminar_submission_values.where(:key=>names[1]).first
|
||||
"<span data-id=\"#{seminar_submission_value.id rescue ''}\">#{(seminar_submission_value.get_value_by_locale(I18n.locale) rescue "")}</span>"}
|
||||
edit_urls[i] = []
|
||||
seminar_submission_values = seminar_signup_contributes.collect{|s| s.seminar_submission_values.where(:key=>names[1]).first }
|
||||
edit_urls[i] = seminar_submission_values.map{|seminar_submission_value| edit_admin_seminar_submission_value_path(seminar_submission_value.id) rescue "#"}
|
||||
end %>
|
||||
<% elsif names[0] == "seminar_signup" %>
|
||||
<% val = (seminar_signup.send("display_"+names[1]) rescue seminar_signup.send(names[1])) rescue nil %>
|
||||
<% elsif names[0] == "seminar_review_result" %>
|
||||
<% if names[1] == "review" %>
|
||||
<% val = contribute_ids.map{|contribute_id| "<a href=\"#{edit_admin_seminar_review_result_path(contribute_id)}\" class=\"btn\">#{t("seminar.review")}</a>"} %>
|
||||
<% elsif names[1] == "presentation_type" %>
|
||||
<% val = seminar_signup_contributes.map{|seminar_signup_contribute| seminar_signup_contribute.presentation_type} %>
|
||||
<% elsif names[1] == "abstract_number" %>
|
||||
<% val = seminar_signup_contributes.map{|seminar_signup_contribute| seminar_signup_contribute.abstract_number} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% vals << val %>
|
||||
<% end %>
|
||||
|
@ -113,17 +145,38 @@
|
|||
<% else %>
|
||||
<%= val[0].html_safe.to_s rescue "" %>
|
||||
<% end %>
|
||||
<% if edit_urls[i].present? %>
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills">
|
||||
<% if @can_edit %>
|
||||
<li>
|
||||
<a class="btn jquery_edit" data-href="<%=edit_urls[i][0]%>"><%= t(:edit) %></a>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
</td>
|
||||
<% else %>
|
||||
<td <%= rowspan %>><%= val.to_s.html_safe %></td>
|
||||
<td><%= val.to_s.html_safe %></td>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% (1...count+1).each do |i|%>
|
||||
<tr>
|
||||
<% indices.each do |index| %>
|
||||
<td>
|
||||
<% if vals[index][i].class == SeminarSignupContribute #File %>
|
||||
<% seminar_signup_contribute = vals[index][i] %>
|
||||
<tr data-id="<%=seminar_signup.id.to_s%>" data-contribute_id="<%=contribute_ids[i].to_s%>">
|
||||
<% if @drag%>
|
||||
<td><span class="brand"><i class="icons-list-2"></i></span></td>
|
||||
<% end %>
|
||||
<% (0...vals.count).each do |index| %>
|
||||
<% if indices.include?(index)
|
||||
extra_class= ""
|
||||
val = vals[index][i]
|
||||
else
|
||||
extra_class = "repeated"
|
||||
val = vals[index]
|
||||
end %>
|
||||
<td class="<%= extra_class %>">
|
||||
<% if (val.class == SeminarSignupContribute rescue false) #File %>
|
||||
<% seminar_signup_contribute = val %>
|
||||
<% description = seminar_signup_contribute.description.to_s %>
|
||||
<% if @seminar.enable_summary_choice
|
||||
if (seminar_signup_contribute.description.to_s.to_i.to_s == seminar_signup_contribute.description)
|
||||
|
@ -134,7 +187,18 @@
|
|||
end %>
|
||||
<%= link_to (seminar_signup_contribute.title.blank? ? File.basename(seminar_signup_contribute.file.path) : seminar_signup_contribute.title) , seminar_signup_contribute.file.url, {:target => '_blank', :title => Nokogiri::HTML(description.gsub("<br>"," , ")).text} if seminar_signup_contribute.file.file %>
|
||||
<% else %>
|
||||
<%= vals[index][i].html_safe.to_s rescue "" %>
|
||||
<%= val.html_safe.to_s rescue "" %>
|
||||
<% end %>
|
||||
<% if (edit_urls[index][i].present? rescue false) %>
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills">
|
||||
<% if @can_edit %>
|
||||
<li>
|
||||
<a class="btn jquery_edit" data-href="<%=edit_urls[index][i]%>"><%= t(:edit) %></a>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
</td>
|
||||
<% end %>
|
||||
|
@ -154,3 +218,8 @@
|
|||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<style type="text/css">
|
||||
.repeated{
|
||||
visibility: hidden;
|
||||
}
|
||||
</style>
|
|
@ -21,7 +21,7 @@
|
|||
<% @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} %>
|
||||
<%= render :partial => "seminar_signup_render_table",:locals=>{:@seminar_signups=>@seminar_signups,:@drag => true,:@include_blank=>true,:@reviewer_id=>session_id,:@preferred_sessions=>[session_id.to_i]} %>
|
||||
<%
|
||||
pagination_html = content_tag :div, class: "bottomnav clearfix", style: "position: static;" do
|
||||
content_tag :div, paginate(@seminar_signups), class: "pagination pagination-centered"
|
||||
|
@ -38,9 +38,10 @@
|
|||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% @seminar_signups = org_seminar_signups
|
||||
<% @seminar_signups = org_seminar_signups.where(:preferred_sessions.in=>[[],nil])
|
||||
@include_blank = false
|
||||
@reviewer_id = nil
|
||||
@preferred_sessions = nil
|
||||
%>
|
||||
<div style="float: right;width: 50%;" data-count="<%=count+=1%>">
|
||||
<div id="main-table" style="overflow: scroll;">
|
||||
|
@ -212,26 +213,39 @@
|
|||
stop: function(event, ui){
|
||||
$(".session_block").css("overflow","");
|
||||
ui.item.css("background","");
|
||||
console.log("stop")
|
||||
},
|
||||
update: function(event, ui) {
|
||||
var target = $(event.target);
|
||||
var mode = "";
|
||||
var session_id = target.data("id");
|
||||
var signup_id = ui.item.data("id");
|
||||
var contribute_id = ui.item.data("contribute_id");
|
||||
if(ui.item.parent().data("id") == session_id){
|
||||
mode = "append";
|
||||
}else{
|
||||
mode = "remove";
|
||||
ui.item.find(".repeated").css("visibility","visible");
|
||||
}else if(target.find("tr[data-id=\""+signup_id+"\"]").length != 0){
|
||||
mode = "remove_contribute";
|
||||
target.find("tr[data-id=\""+signup_id+"\"]").find(".repeated").css("visibility","");
|
||||
}
|
||||
else{
|
||||
mode = "remove";
|
||||
ui.item.find(".repeated").css("visibility","");
|
||||
}
|
||||
if(contribute_id == undefined){
|
||||
contribute_id = "";
|
||||
}
|
||||
console.log(mode);
|
||||
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){
|
||||
$.post("<%=update_seminar_session_admin_seminar_path(params[:id])%>",{session_id: session_id,mode: mode,signup_id: signup_id, contribute_id: contribute_id}).done(function(data){
|
||||
console.log(data);
|
||||
if(data["edit"]){
|
||||
$(data["edit"]["target"]).text(data["edit"]["text"]);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,22 +1,30 @@
|
|||
<form id="module-search-form">
|
||||
<div class="sc-field">
|
||||
<input name="type" value="<%=params[:type]%>" type="hidden">
|
||||
<input id="filter-input" class="search-query input-medium" type="text" name="search" value="<%= params[:search] %>" placeholder="搜尋">
|
||||
</div>
|
||||
</form>
|
||||
<% if request.xhr? %>
|
||||
<div id="index_table">
|
||||
<%= render :partial => "seminar_signup_render_table" %>
|
||||
</div>
|
||||
<% else %>
|
||||
<form id="module-search-form">
|
||||
<div class="sc-field">
|
||||
<input name="type" value="<%=params[:type]%>" type="hidden">
|
||||
<input id="filter-input" class="search-query input-medium" type="text" name="search" value="<%= params[:search] %>" placeholder="搜尋">
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<%= render :partial => "sessions_filter", :locals =>{:fields => @filter_fields.to_h, :search_dom_id=>"index_table", :quick_new=>false} %>
|
||||
|
||||
<h4><%= @seminar.title %></h4>
|
||||
<h4><%= @seminar.title %></h4>
|
||||
<div id="index_table">
|
||||
<%= render :partial => "seminar_signup_render_table" %>
|
||||
</div>
|
||||
|
||||
<%= render :partial => "seminar_signup_render_table" %>
|
||||
|
||||
<div class="bottomnav clearfix">
|
||||
<div class="bottomnav clearfix">
|
||||
<div class="pagination pagination-centered"><%= (paginate(@seminar_signups) rescue nil) %></div>
|
||||
<% if @can_edit %>
|
||||
<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=table", :class => 'btn btn-primary' %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render 'layouts/delete_modal', delete_options: @delete_options %>
|
||||
<%= render 'layouts/delete_modal', delete_options: @delete_options %>
|
||||
<% end %>
|
|
@ -0,0 +1,185 @@
|
|||
<% content_for :right_nav do %>
|
||||
<ul class="nav nav-pills filter-nav pull-right">
|
||||
<% fields.keys.each do |field| %>
|
||||
<% org_field = field %>
|
||||
<% field = field.to_s.split(".").last %>
|
||||
<li class="accordion-group">
|
||||
<div class="accordion-heading">
|
||||
<a href="#collapse-<%= field %>" data-toggle="collapse" data-parent="#filter" class="accordion-toggle"><%= t(org_field) %></a>
|
||||
</div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<div class="filter-group accordion-group">
|
||||
<% fields.keys.each do |field| %>
|
||||
<% org_field = field %>
|
||||
<% field = field.to_s.split(".").last %>
|
||||
<div class="accordion-body collapse" id="collapse-<%= field %>">
|
||||
<div class="accordion-inner pagination-right" >
|
||||
<% if fields[org_field].class == String %>
|
||||
<%= fields[org_field].html_safe %>
|
||||
<% else %>
|
||||
<% fields[org_field].each do |val| %>
|
||||
<%= link_to (val[:title].blank? ? "" : val[:title]), "#", :onclick => "filter.addFilter('filters[#{field}][]=#{val[:id]}');$(this).toggleClass('active');return false;", :class => "btn btn-small #{is_filter_active?(field, val[:id])}", :id => "filter_#{val[:id]}" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="filter-clear">
|
||||
<a href="#" onclick="filter.clearFilter();" class="btn btn-link btn-small"><i class="icons-cycle"></i> <%= t(:clear) %></a>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<script type="text/javascript">
|
||||
<% if !search_dom_id.nil?%>
|
||||
var interval = 0;
|
||||
var keyword;
|
||||
var searchLock=false;
|
||||
|
||||
$("#filter-input").bind("input", function() {queueSearch();});
|
||||
$("#module-search-form").submit(function(){queueSearch(); return false; });
|
||||
|
||||
var params = function(key){
|
||||
var result = {};
|
||||
var datas = window.location.search ? window.location.search.replace('?','').split('&') : []
|
||||
datas.map(function(data){
|
||||
tmp = data.split("=");
|
||||
tmp[1] = decodeURIComponent(tmp[1]);
|
||||
if(key){
|
||||
if(tmp[0]==key){
|
||||
if(tmp[0].indexOf('[]')>=0){
|
||||
if(!Array.isArray(result)) result = [];
|
||||
result.push(tmp[1]);
|
||||
}else{
|
||||
result = tmp[1];
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(tmp[0].indexOf('[]')>=0){
|
||||
if(typeof(result[tmp[0]]) == "undefined") result[tmp[0]] = [];
|
||||
result[tmp[0]].push(tmp[1]);
|
||||
}else{
|
||||
result[tmp[0]] = tmp[1];
|
||||
}
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
var queueSearch = function(){
|
||||
if($("#filter-input").val()!=keyword){
|
||||
keyword = $("#filter-input").val();
|
||||
interval=500;
|
||||
if(!searchLock) moduleSearch();
|
||||
}
|
||||
}
|
||||
|
||||
var moduleSearch = function(){
|
||||
$("#search-preloader").fadeIn();
|
||||
searchLock = true;
|
||||
if(interval==0){
|
||||
url = document.URL;
|
||||
url = url.replace('#','');
|
||||
if(url.indexOf("keywords=")>=0){
|
||||
url = url.replace("keywords="+encodeURIComponent(params("keywords")),"keywords="+keyword)
|
||||
}else{
|
||||
url = (url.indexOf("?")>=0) ? url+"&keywords="+keyword : url+"?keywords="+keyword
|
||||
}
|
||||
url = url.replace("page="+params("page"),"page=1");
|
||||
|
||||
history.pushState(null, null, url);
|
||||
$.get(url,function(data){
|
||||
searchLock = false;
|
||||
$("#<%= search_dom_id %>").html(data);
|
||||
bindPagination();
|
||||
$("#search-preloader").fadeOut();
|
||||
});
|
||||
}else{
|
||||
interval -= 100;
|
||||
setTimeout(moduleSearch,100);
|
||||
}
|
||||
}
|
||||
<% end %>
|
||||
|
||||
var bindPagination = function(){
|
||||
$(".pagination a").click(function(){
|
||||
filter.updateTable($(this).attr('href'),false,true);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
var Filter = function(dom){
|
||||
var self = this;
|
||||
var makeFilters = function(){
|
||||
return (window.location.search ? window.location.search.replace('?','').split('&') : []);
|
||||
}
|
||||
var filters = makeFilters(),
|
||||
dom = $(dom),
|
||||
mainUrl = window.location.pathname;
|
||||
this.updateTable = function(url, goback, is_pagination){
|
||||
update = true;
|
||||
xurl = (url == null ? ( filters.length ? mainUrl + "?" + filters.join('&') : mainUrl ) : url);
|
||||
$.ajax({
|
||||
url : xurl,
|
||||
type : "get",
|
||||
dataType : "html"
|
||||
}).done(function(data){
|
||||
if(is_pagination){
|
||||
history.pushState(null, null, decodeURIComponent(xurl));
|
||||
}else{
|
||||
if(!goback) history.replaceState(null, null, decodeURIComponent(xurl));
|
||||
}
|
||||
filters = makeFilters();
|
||||
dom.html(data);
|
||||
bindPagination();
|
||||
update = false;
|
||||
})
|
||||
}
|
||||
this.addFilter = function(filter){
|
||||
filters = makeFilters();
|
||||
$.each(filters,function(idx,data){
|
||||
if(typeof(data)=="undefined") return true;
|
||||
if(data.indexOf("page=")>-1) filters.splice(idx,1);
|
||||
});
|
||||
|
||||
if( (index = filters.indexOf(filter) ) > -1){
|
||||
mainUrl = mainUrl.replace(filter,'');
|
||||
filters.splice(index,1);
|
||||
}else{
|
||||
filters.push(filter);
|
||||
}
|
||||
|
||||
self.updateTable();
|
||||
return false;
|
||||
};
|
||||
|
||||
this.clearFilter = function(){
|
||||
$(".filter-group a.active").removeClass("active");
|
||||
filters = [];
|
||||
self.updateTable();
|
||||
return false;
|
||||
}
|
||||
|
||||
window.onpopstate = function(event){
|
||||
if(!update){
|
||||
$("#filter-input").val( $.isEmptyObject(params('keywords')) ? "" : params('keywords') );
|
||||
self.updateTable(document.location, true);
|
||||
$(".filter-group .btn-small").removeClass('active');
|
||||
$.each(document.location.search.split('&'),function(key,filter){
|
||||
if(filter.split('=')[0].indexOf("keywords")>=0) return true;
|
||||
$('#filter_'+filter.split('=')[1]).addClass('active');
|
||||
});
|
||||
}
|
||||
update = false;
|
||||
}
|
||||
}
|
||||
|
||||
var update = false;
|
||||
var filter;
|
||||
$(document).ready(function(){
|
||||
filter = new Filter("#<%= search_dom_id %>");
|
||||
bindPagination();
|
||||
});
|
||||
</script>
|
|
@ -52,7 +52,8 @@
|
|||
<label class="control-label muted" for=""><%= t(:type)%></label>
|
||||
<div class="controls">
|
||||
<select class="dataType" data-type="select" name="${_markup}">
|
||||
<%LIST[:markups].each do |key,val|%>
|
||||
<%$seminar_list[:markups].each do |key,val|%>
|
||||
<% next if val["display_only"] && val["display_only"] != params["action"] %>
|
||||
<% if key != 'address' %>
|
||||
<option value="<%= key %>" ref="<%=val["panel"]%>"><%=t("lists.markups."+key)%></option >
|
||||
<% end %>
|
||||
|
@ -186,7 +187,7 @@
|
|||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{if templateType == 'typeB' || templateType == 'typeE' || templateType == 'typeF'}}
|
||||
{{if templateType == 'typeB' || templateType == 'typeE'}}
|
||||
<div class="control-group">
|
||||
<label class="control-label muted" for=""><%= t(:options)%></label>
|
||||
<div class="controls add-input">
|
||||
|
@ -243,6 +244,18 @@
|
|||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{if templateType == 'typeF'}}
|
||||
<div class="control-group">
|
||||
<label class="control-label muted" for=""><%= t(:options)%></label>
|
||||
<div class="controls add-input">
|
||||
<% if @attribute.enable_summary_choice %>
|
||||
<% @attribute.summary_chioices.each do |v| %>
|
||||
<div><%=v%></div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
</script>
|
||||
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<% 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>
|
||||
<div class="session-name"><%=session%><span class="badge badge-info"><%= seminar_session.seminar_signups.count %></span></div>
|
||||
</label>
|
||||
<input name="session_ids[]" type="hidden" value="<%=i%>">
|
||||
</li>
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
<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 %>
|
||||
<% @seminar_signups = @seminar_session.seminar_signups.sort_ordered %>
|
||||
<% @preferred_sessions = [@session_id] %>
|
||||
<%= 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
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
<span id="index_table" style="display: inline-block;">
|
||||
<script>
|
||||
<script>
|
||||
if(document.querySelectorAll("#orbit-bar").length==0) location.reload();
|
||||
</script>
|
||||
<div id="jquery_form_dialog">
|
||||
<div style="clear:both;"></div>
|
||||
<div id="jquery_form_content">
|
||||
</div>
|
||||
</div>
|
||||
<% if @can_edit %>
|
||||
<% if params[:type].blank?%>
|
||||
<label><input id="copy_mode_on" type="checkbox"><%=t("seminar.copy_mode_on")%></label>
|
||||
|
@ -30,3 +34,46 @@
|
|||
list-style: none;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
$(document).on("submit","#jquery_form",function(e) {
|
||||
var form = $(this);
|
||||
var url = form.attr('action');
|
||||
var method = form.attr('method');
|
||||
method = method || "POST";
|
||||
$.ajax({
|
||||
type: method,
|
||||
url: url,
|
||||
data: form.serialize(), // serializes the form's elements.
|
||||
success: function(data)
|
||||
{
|
||||
if(data["success"]){
|
||||
window.open_target_td.html(data["val"]+Array.from(window.open_target_td.find(">*").map(function(i,v){
|
||||
return $(v).prop("outerHTML");
|
||||
})).join(""));
|
||||
}else{
|
||||
console.log(data);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
e.preventDefault(); // avoid to execute the actual submit of the form.
|
||||
});
|
||||
$(document).on('click', '.jquery_edit', function(){
|
||||
var href = $(this).data("href");
|
||||
window.open_target_td = $(this).parents("td");
|
||||
$.get(href).done(function(html){
|
||||
$("#jquery_form_content").html(html);
|
||||
$("#jquery_form_dialog").dialog({
|
||||
resizable: true,
|
||||
minHeight: 300,
|
||||
maxHeight: 400,
|
||||
modal: true,
|
||||
width: '80%',
|
||||
close: function(){$( this ).dialog( "close" )},
|
||||
buttons: {
|
||||
"<%= t('submit') %>": function(){$( this ).dialog( "close" );$("#jquery_form").submit()}
|
||||
}
|
||||
});
|
||||
})
|
||||
})
|
||||
</script>
|
|
@ -15,6 +15,7 @@
|
|||
name1 = data1['name'][I18n.locale]
|
||||
name2 = data2['name'][I18n.locale]
|
||||
name3 = data3['name'][I18n.locale]
|
||||
seminar_submission_field = @seminar.seminar_submission_fields.where(:markup=>"seminar_preferred_session").first
|
||||
%>
|
||||
<% if @seminar.contribute_start_date <= @time_now and ( @seminar.contribute_end_date.nil? or @seminar.contribute_end_date+1 >= @time_now ) %>
|
||||
<% begin %>
|
||||
|
@ -37,6 +38,9 @@
|
|||
<% if show3 %>
|
||||
<th class="col-md-2"><%= name3 %></th>
|
||||
<% end %>
|
||||
<% if seminar_submission_field %>
|
||||
<th class="col-md-2"><%= seminar_submission_field.title %></th>
|
||||
<% end %>
|
||||
<th class="col-md-2"><%= t(:action) %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -56,6 +60,9 @@
|
|||
end %>
|
||||
<td><%= description.html_safe %></td>
|
||||
<td><%= link_to File.basename(seminar_signup_contribute.file.path), seminar_signup_contribute.file.url, {:target => '_blank', :title => Nokogiri::HTML(description.gsub("<br>"," , ")).text} if seminar_signup_contribute.file.file %></td>
|
||||
<% if seminar_submission_field %>
|
||||
<td><%= seminar_signup_contribute.seminar_submission_values.where(:seminar_submission_field=>seminar_submission_field).first.get_value_by_locale(I18n.locale) %></td>
|
||||
<% end %>
|
||||
<td>
|
||||
<%= link_to t(:edit), OrbitHelper.url_to_show(@seminar.to_param) + '?method=edit_file&con_no=' + seminar_signup_contribute.id, :class => 'btn btn-primary' %>
|
||||
<form method="post" action="<%= del_file_seminars_path %>">
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
forbidden_item_names:
|
||||
- admin
|
||||
- panel
|
||||
- appfront
|
||||
|
||||
#NO_MULTI_TAG = ["select","date","radio_button","checkbox","date_durnation"]
|
||||
|
||||
markups:
|
||||
text_field:
|
||||
muti_lang_input_supprt: true
|
||||
ext_support: true
|
||||
panel: typeA
|
||||
select:
|
||||
muti_lang_input_supprt: false
|
||||
ext_support: false
|
||||
panel: typeB
|
||||
date:
|
||||
muti_lang_input_supprt: false
|
||||
ext_support: false
|
||||
panel: typeC
|
||||
text_area:
|
||||
muti_lang_input_supprt: true
|
||||
ext_support: false
|
||||
panel: typeD
|
||||
radio_button:
|
||||
muti_lang_input_supprt: false
|
||||
ext_support: false
|
||||
panel: typeE
|
||||
checkbox:
|
||||
muti_lang_input_supprt: false
|
||||
ext_support: false
|
||||
panel: typeE
|
||||
address:
|
||||
muti_lang_input_supprt: true
|
||||
ext_support: true
|
||||
member_relationship:
|
||||
muti_lang_input_supprt: false
|
||||
ext_support: false
|
||||
panel: member_relations
|
||||
seminar_preferred_session:
|
||||
muti_lang_input_supprt: false
|
||||
ext_support: false
|
||||
panel: typeF
|
||||
display_only: seminar_submission_field
|
|
@ -3,8 +3,11 @@ en:
|
|||
simple_captcha:
|
||||
placeholder: ""
|
||||
label: ""
|
||||
|
||||
lists:
|
||||
markups:
|
||||
seminar_preferred_session: Preferred Session
|
||||
restful_actions:
|
||||
edit_seminar_review: Review
|
||||
copy: Copy
|
||||
act_signup: Sign Up Info #報名資料
|
||||
seminar_submission_field: Seminar Submission Field
|
||||
|
@ -18,8 +21,16 @@ en:
|
|||
recaptcha:
|
||||
errors:
|
||||
verification_failed: Verification Failed #驗證碼錯誤
|
||||
|
||||
helpers:
|
||||
label:
|
||||
seminar_review_result:
|
||||
abstract_number: Abstract number
|
||||
presentation_type: Presentation
|
||||
seminar:
|
||||
view_original_image: View original image
|
||||
assigned_session: Assigned Session
|
||||
abstract_number: Abstract number
|
||||
review: Review
|
||||
copy_mode_on: Copy mode on
|
||||
clone_signups: Clone Signups
|
||||
copy: Copy
|
||||
|
|
|
@ -3,8 +3,12 @@ zh_tw:
|
|||
simple_captcha:
|
||||
placeholder: ""
|
||||
label: ""
|
||||
lists:
|
||||
markups:
|
||||
seminar_preferred_session: Preferred Session
|
||||
|
||||
restful_actions:
|
||||
edit_seminar_review: 審查
|
||||
copy: 複製
|
||||
act_signup: 報名資料
|
||||
seminar_submission_field: 上傳介面欄位
|
||||
|
@ -18,8 +22,16 @@ zh_tw:
|
|||
recaptcha:
|
||||
errors:
|
||||
verification_failed: 驗證碼錯誤
|
||||
|
||||
helpers:
|
||||
label:
|
||||
seminar_review_result:
|
||||
abstract_number: 摘要編號
|
||||
presentation_type: 發表方式
|
||||
seminar:
|
||||
view_original_image: 查看原圖
|
||||
assigned_session: Assigned Session
|
||||
abstract_number: 摘要編號
|
||||
review: 審查
|
||||
copy_mode_on: 啟用複製模式
|
||||
clone_signups: 複製報名人
|
||||
copy: 複製
|
||||
|
|
|
@ -35,6 +35,8 @@ Rails.application.routes.draw do
|
|||
end
|
||||
resources :seminar_agreements
|
||||
resources :seminar_signups
|
||||
resources :seminar_submission_values
|
||||
resources :seminar_review_results
|
||||
resources :seminar_item_contents
|
||||
end
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# stub: seminar 0.0.1 ruby lib
|
||||
|
||||
data = File.open(File.join(File.dirname(__FILE__), 'config', 'list.yml')).read
|
||||
$seminar_list = YAML::load(ERB.new(data).result(binding)).symbolize_keys
|
||||
Gem::Specification.new do |s|
|
||||
s.name = "seminar"
|
||||
s.version = "0.0.1"
|
||||
|
|
Loading…
Reference in New Issue