forked from spen/seminar
new stuff
This commit is contained in:
parent
31112700c3
commit
4a0f4081ff
|
@ -24,12 +24,12 @@ class Admin::SeminarSignupsController < OrbitAdminController
|
|||
@seminar_signup = SeminarSignup.find(params[:id])
|
||||
@seminar = SeminarMain.find(@seminar_signup.seminar_main_id)
|
||||
|
||||
@form_index = 0
|
||||
@form_index = 0
|
||||
|
||||
end
|
||||
|
||||
def update
|
||||
|
||||
|
||||
@seminar_signup = SeminarSignup.find(params[:id])
|
||||
@seminar_signup.update_attributes(seminar_signup_params)
|
||||
|
||||
|
@ -63,6 +63,15 @@ class Admin::SeminarSignupsController < OrbitAdminController
|
|||
redirect_to "/admin/seminars/#{@seminar_main_id}/seminar_signup"
|
||||
end
|
||||
|
||||
def get_predefined_text
|
||||
seminar = SeminarMain.find(params[:seminar_id])
|
||||
text = seminar.seminar_email_sets.where(:field_name => params[:type]).first.content[I18n.locale]
|
||||
render :json => {
|
||||
"success" => true,
|
||||
"html" => text
|
||||
}
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def seminar_signup_params
|
||||
|
|
|
@ -90,7 +90,7 @@ class Admin::SeminarsController < OrbitAdminController
|
|||
# exceptions = ["personal_book","personal_conference","personal_diploma","personal_experience","personal_journal","personal_lab","personal_patent","personal_project","personal_research"]
|
||||
exceptions = []
|
||||
@modules = ModuleApp.where(:key.nin => exceptions).frontend_enabled.order_by(:key=>'asc')
|
||||
@searchfilter = @modules.collect{|m|[t('module_name.'+m.key),m.key]}
|
||||
@searchfilter = @modules.collect{|m|[t('module_name.'+m.key),m.key]}
|
||||
end
|
||||
def reviewer_setting
|
||||
@seminar_reviews = @seminar.seminar_reviews
|
||||
|
@ -296,7 +296,7 @@ class Admin::SeminarsController < OrbitAdminController
|
|||
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]
|
||||
seminar_main.session_show_ids = (0...seminar_main.summary_chioices.count).to_a[0..1]
|
||||
end
|
||||
seminar_main.session_show_ids.delete(session_id)
|
||||
elsif params[:mode] == "show"
|
||||
|
@ -356,13 +356,13 @@ class Admin::SeminarsController < OrbitAdminController
|
|||
@filter_fields = filter_fields(@categories)
|
||||
@table_fields = [:category, 'seminar.title', 'seminar.event_during', 'seminar.signup_during', 'seminar.signup_count', 'seminar.export']
|
||||
|
||||
if !params[:sort].blank?
|
||||
if !params[:sort].blank?
|
||||
if params[:sort] == 'event_during'
|
||||
sort = {:seminar_start_date.to_sym=>params[:order]}
|
||||
sort = {:seminar_start_date.to_sym=>params[:order]}
|
||||
elsif params[:sort] == 'signup_during'
|
||||
sort = {:signup_start_date.to_sym=>params[:order]}
|
||||
sort = {:signup_start_date.to_sym=>params[:order]}
|
||||
else
|
||||
sort = {params[:sort].to_sym=>params[:order]}
|
||||
sort = {params[:sort].to_sym=>params[:order]}
|
||||
end
|
||||
else
|
||||
sort = {:signup_start_date=>"desc",:created_at=>"desc"}
|
||||
|
@ -432,7 +432,7 @@ class Admin::SeminarsController < OrbitAdminController
|
|||
end
|
||||
|
||||
def create
|
||||
|
||||
|
||||
if !seminar_params['seminar_links_attributes'].nil?
|
||||
seminar_params['seminar_links_attributes'].each do |idx,link|
|
||||
seminar_params['seminar_links_attributes'].delete(idx.to_s) if link['url'].blank?
|
||||
|
@ -494,7 +494,7 @@ class Admin::SeminarsController < OrbitAdminController
|
|||
def update
|
||||
@seminar_params = seminar_params rescue {}
|
||||
if @seminar_params.count != 0
|
||||
@seminar_params[:registration_status] = (@seminar_params[:registration_status] ? @seminar_params[:registration_status] : [])
|
||||
@seminar_params[:registration_status] = (@seminar_params[:registration_status] ? @seminar_params[:registration_status] : [])
|
||||
uid = params[:id].split('-').last
|
||||
@seminar = SeminarMain.find_by(:uid=>uid)
|
||||
if @seminar_params.has_key?("title_translations")
|
||||
|
@ -545,7 +545,7 @@ class Admin::SeminarsController < OrbitAdminController
|
|||
seminar_params['seminar_links_attributes'].delete(idx.to_s) if link['url'].blank?
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@seminar.update_user_id = current_user.id
|
||||
if @seminar.update_attributes(seminar_params)
|
||||
@seminar.update_enable_recaptcha
|
||||
|
@ -559,7 +559,7 @@ class Admin::SeminarsController < OrbitAdminController
|
|||
end
|
||||
redirect_to admin_seminars_path
|
||||
end
|
||||
|
||||
|
||||
def set_write_off
|
||||
|
||||
@seminar.donation_write_off_status = true
|
||||
|
@ -578,14 +578,14 @@ class Admin::SeminarsController < OrbitAdminController
|
|||
|
||||
def seminar_signup_field
|
||||
@field_name = 'seminar_main'
|
||||
@attribute = SeminarMain.find(params[:id])
|
||||
@attribute = SeminarMain.find(params[:id])
|
||||
@attribute_type = 'seminar'
|
||||
@class = 'seminars'
|
||||
end
|
||||
|
||||
def seminar_submission_field
|
||||
@field_name = 'seminar_main'
|
||||
@attribute = SeminarMain.find(params[:id])
|
||||
@attribute = SeminarMain.find(params[:id])
|
||||
@attribute_type = 'seminar'
|
||||
@class = 'seminars'
|
||||
end
|
||||
|
@ -672,7 +672,7 @@ class Admin::SeminarsController < OrbitAdminController
|
|||
end
|
||||
|
||||
def delete_seminar_signup
|
||||
|
||||
|
||||
@seminar_signup = SeminarSignup.find(params[:id])
|
||||
|
||||
@seminar_id = @seminar_signup.seminar_main_id
|
||||
|
@ -682,6 +682,11 @@ class Admin::SeminarsController < OrbitAdminController
|
|||
redirect_to "/admin/seminars/@seminar_id.to_s/seminar_signup"
|
||||
end
|
||||
|
||||
def create_email_set
|
||||
SeminarEmailSet.create_new_fields(params[:id])
|
||||
redirect_to "/admin/seminars/#{params[:id]}/edit"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_seminar
|
||||
|
@ -758,7 +763,7 @@ class Admin::SeminarsController < OrbitAdminController
|
|||
end
|
||||
end
|
||||
@email_set = []
|
||||
['signup','submission','add_file','edit_file'].each do |field_name|
|
||||
['signup','submission','add_file','edit_file', 'reset_password', "special_reminder"].each do |field_name|
|
||||
email_set = @seminar.seminar_email_sets.select{|v| v.field_name==field_name}
|
||||
if email_set.length==0
|
||||
title = Hash.new
|
||||
|
|
|
@ -3,18 +3,18 @@ class SeminarsController < ApplicationController
|
|||
include MemberHelper
|
||||
include ActionView::Context #vary important (only add this can access @@session from view)
|
||||
include Admin::SeminarsHelper
|
||||
FrontendMethods = ["show_privacy", "show_data", "check_email", "check_availability", "signup_ok", "add_file", "edit_file", "con_login", "con_upload", "con_logout"]
|
||||
FrontendMethods = ["show_privacy", "show_data", "check_email", "check_availability", "signup_ok", "add_file", "edit_file", "con_login", "con_upload", "con_logout","confirm_email_page","reset_password_page"]
|
||||
# include SimpleCaptcha::ControllerHelpers
|
||||
def index
|
||||
|
||||
time_now = Time.now
|
||||
|
||||
|
||||
seminars = SeminarMain.all.desc(:seminar_start_date).filter_by_categories
|
||||
{
|
||||
"seminars" => seminars,
|
||||
'time_now' => time_now,
|
||||
"total_pages" => seminars.total_pages
|
||||
}
|
||||
}
|
||||
|
||||
end
|
||||
def widget
|
||||
|
@ -85,7 +85,7 @@ class SeminarsController < ApplicationController
|
|||
prefix_url = OrbitHelper.request.path.split("-").first + "-#{params[:uid]}"
|
||||
@prefix_url = prefix_url
|
||||
@registration_postfix = "/home/registration"
|
||||
header_data = "<a href=\"#{prefix_url}#{home_page.url}\">Home</a> | " +
|
||||
header_data = "<a href=\"#{prefix_url}#{home_page.url}\">Home</a> | " +
|
||||
"<a href=\"/\">Main Site</a>"
|
||||
content_style = seminar_template_setting.content_style
|
||||
background_style = seminar_template_setting.background_style
|
||||
|
@ -392,7 +392,7 @@ class SeminarsController < ApplicationController
|
|||
|
||||
params = OrbitHelper.params
|
||||
|
||||
if !params[:email].blank?
|
||||
if !params[:email].blank?
|
||||
count = SeminarSignup.where(:email => params[:email], :seminar_main_id => params[:no]).count
|
||||
|
||||
result = count > 0 ? t('seminar.already_used') : t('seminar.available')
|
||||
|
@ -490,6 +490,9 @@ class SeminarsController < ApplicationController
|
|||
:seminar_signup=>@seminar_signup},:layout=>false)
|
||||
if params['seminar_signup']['status']=='C'
|
||||
status_param = '&status='
|
||||
if(@seminar.seminar_email_sets.where(:field_name => "signup").first.is_confirmation)
|
||||
extra_text += "<br><div><a href='#{request.protocol + request.host_with_port + OrbitHelper.url_to_show(@seminar.to_param)}?method=confirm_email_page&token=#{@seminar_signup.token}&cid=#{@seminar_signup.id.to_s}'>" + t("seminar.click_here_to_confirm") + "</a></div>"
|
||||
end
|
||||
send_mail('submission',params[:seminar_signup][:email],params[:seminar_signup][:seminar_main_id],extra_text)
|
||||
else
|
||||
status_param = ''
|
||||
|
@ -733,6 +736,44 @@ class SeminarsController < ApplicationController
|
|||
|
||||
end
|
||||
|
||||
def reset_email
|
||||
end
|
||||
|
||||
def reset_password_page
|
||||
params = OrbitHelper.params
|
||||
seminar = SeminarMain.find_by(uid: params[:uid])
|
||||
seminar_signup = seminar.seminar_signups.where(:status=>'C', :id=> params[:cid], :token => params[:token]).first
|
||||
status = false
|
||||
if(!seminar_signup.nil?)
|
||||
status = true
|
||||
end
|
||||
{
|
||||
"status" => status,
|
||||
"seminar" => seminar,
|
||||
"cid" => params[:cid],
|
||||
"token" => params[:token]
|
||||
}
|
||||
end
|
||||
|
||||
def confirm_email_page
|
||||
confirm = false
|
||||
params = OrbitHelper.params
|
||||
seminar = SeminarMain.where(:uid => params[:uid]).first
|
||||
if(!seminar.nil?)
|
||||
signup = seminar.seminar_signups.where(:id => params[:cid], :token => params[:token], :is_confirmed => false).first
|
||||
if(!signup.nil?)
|
||||
signup.token = nil
|
||||
signup.is_confirmed = true
|
||||
signup.save
|
||||
confirm = true
|
||||
end
|
||||
end
|
||||
{
|
||||
"confirm" => confirm,
|
||||
"url" => OrbitHelper.url_to_show(seminar.to_param)
|
||||
}
|
||||
end
|
||||
|
||||
def con_login_proc
|
||||
|
||||
seminar = SeminarMain.find_by(id: params[:seminar_signup][:seminar_main_id])
|
||||
|
@ -751,6 +792,35 @@ class SeminarsController < ApplicationController
|
|||
|
||||
end
|
||||
|
||||
def reset_confirm_password_proc
|
||||
params = OrbitHelper.params
|
||||
seminar = SeminarMain.find(params[:seminar_id])
|
||||
redirect_to "#{params[:referer_url].to_s.chomp('/')}/?method=reset_password_page" if seminar.nil?
|
||||
|
||||
seminar_signup = seminar.seminar_signups.where(:status =>'C', :token => params[:reset_token], :id => params[:cid]).first
|
||||
if !seminar_signup.blank?
|
||||
seminar_signup.password = params[:password]
|
||||
seminar_signup.token = nil
|
||||
seminar_signup.save
|
||||
redirect_to "#{params[:referer_url].to_s.chomp('/')}/?method=con_login", :notice => t('seminar_signup.password_changed')
|
||||
else
|
||||
redirect_to "#{params[:referer_url].to_s.chomp('/')}/?method=con_login", :notice => t('seminar_signup.password_changed_not_ok')
|
||||
end
|
||||
end
|
||||
|
||||
def reset_password_proc
|
||||
@seminar = SeminarMain.find_by(id: params[:seminar_signup][:seminar_main_id])
|
||||
seminar_signup = SeminarSignup.where(:status=>'C', :email=> params[:user_name], :seminar_main_id => params[:seminar_signup][:seminar_main_id]).first
|
||||
if !seminar_signup.blank?
|
||||
token = seminar_signup.generate_token
|
||||
extra_text = "<br><a href='#{request.protocol + request.host_with_port + params[:referer_url].to_s.chomp('/')}/?method=reset_password_page&token=#{token}&cid=#{seminar_signup.id.to_s}'>#{t("seminar_signup.click_on_link")}</a>"
|
||||
send_mail('reset_password', seminar_signup.email, @seminar.id.to_s, extra_text)
|
||||
redirect_to "#{params[:referer_url].to_s.chomp('/')}/?method=reset_email", :notice => t('seminar_signup.reset_email_sent')
|
||||
else
|
||||
redirect_to "#{params[:referer_url].to_s.chomp('/')}/?method=reset_email", :notice => t('seminar_signup.email_not_found')
|
||||
end
|
||||
end
|
||||
|
||||
def seminar_signup_params
|
||||
params.require(:seminar_signup).permit!
|
||||
end
|
||||
|
@ -759,6 +829,22 @@ class SeminarsController < ApplicationController
|
|||
params.require(:seminar_signup_contribute).permit!
|
||||
end
|
||||
|
||||
def send_notifying_email
|
||||
@seminar = SeminarMain.find_by(:id => params[:seminar_id])
|
||||
seminar_signup = @seminar.seminar_signups.where(:email => params[:email]).first
|
||||
if !seminar_signup.blank?
|
||||
extra_text = "<p> #{params[:text]} </p>"
|
||||
if params[:type] == "reset_password"
|
||||
token = seminar_signup.generate_token
|
||||
extra_text += "<br><a href='#{request.protocol + request.host_with_port + "/" + I18n.locale.to_s + "/seminar/" + @seminar.to_param}/?method=reset_password_page&token=#{token}&cid=#{seminar_signup.id.to_s}'>#{t("seminar_signup.click_on_link")}</a>"
|
||||
end
|
||||
send_mail(params[:type], seminar_signup.email, @seminar.id.to_s, extra_text)
|
||||
end
|
||||
render :json => {
|
||||
"success" => true
|
||||
}.to_json
|
||||
end
|
||||
|
||||
def seminar_signup_values_params
|
||||
params.require(:seminar_signup_values).permit!
|
||||
end
|
||||
|
@ -778,6 +864,6 @@ class SeminarsController < ApplicationController
|
|||
mail_sentdate:Time.current,
|
||||
mail_subject: email_set[0].title[I18n.locale],
|
||||
template_data:{'seminar_id'=>seminar_id,'locale'=>I18n.locale,'extra_text'=> extra_text})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,5 +6,6 @@ class SeminarEmailSet
|
|||
field :title
|
||||
field :content
|
||||
field :disabled, type: Boolean, default: false
|
||||
field :is_confirmation, type: Boolean, default: false
|
||||
belongs_to :seminar_main
|
||||
end
|
||||
|
|
|
@ -3,11 +3,14 @@ class SeminarSignup
|
|||
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
HiddenFields = ['seminar_signup_id','_id', 'created_at', 'updated_at','seminar_main_id',"serial_number","final_session","final_sessions","preferred_sessions",'seminar_session_id',"seminar_session_ids","preferred_session","sort_number","abstract_number","presentation_type", "filename"]
|
||||
HiddenFields = ['seminar_signup_id','_id', 'created_at', 'updated_at','seminar_main_id',"serial_number","final_session","final_sessions","preferred_sessions",'seminar_session_id',"seminar_session_ids","preferred_session","sort_number","abstract_number","presentation_type", "filename", "token", "reset_token"]
|
||||
DefaultEnableFields = ['status','name','tel','phone','email','password','recaptcha']
|
||||
field :sort_number , type: Integer, default: 10000
|
||||
|
||||
field :status
|
||||
field :token
|
||||
field :is_confirmed, type: Boolean, default: false # for email confirmation
|
||||
field :signup_confirmed, type: Boolean, default: false
|
||||
field :name # become Last Name for TICC
|
||||
field :tel, type: String # become First Name for TICC
|
||||
field :unit, localize: true #Only localize for preserving old record
|
||||
|
@ -26,7 +29,7 @@ class SeminarSignup
|
|||
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(:sort_number=>1,:created_at=>1) }
|
||||
|
@ -55,6 +58,7 @@ class SeminarSignup
|
|||
self.serial_number = last_serial_number + 1
|
||||
SeminarMain.where(:id=>self.seminar_main_id).update_all({"$inc"=>{"last_serial_number"=>1}})
|
||||
end
|
||||
self.token = SecureRandom.hex(5)
|
||||
end
|
||||
after_destroy do
|
||||
seminar_main = self.seminar_main
|
||||
|
@ -69,7 +73,7 @@ class SeminarSignup
|
|||
sr.save
|
||||
end
|
||||
end
|
||||
seminar_main.seminar_signups.delete(self) #avoid resave
|
||||
seminar_main.seminar_signups.delete(self) #avoid resave
|
||||
if seminar_main.unassigned_seminar_signup_ids.delete(id)
|
||||
seminar_main.save
|
||||
end
|
||||
|
@ -80,6 +84,13 @@ class SeminarSignup
|
|||
seminar_session.save
|
||||
end
|
||||
end
|
||||
|
||||
def generate_token
|
||||
token = SecureRandom.hex(5)
|
||||
self.token = token
|
||||
self.save
|
||||
return token
|
||||
end
|
||||
def display_serial_number
|
||||
display_format_string(self.serial_number,4)
|
||||
end
|
||||
|
|
|
@ -5,6 +5,7 @@ class SeminarSignupFieldSet
|
|||
field :field_name, type: String
|
||||
field :placeholder
|
||||
field :name
|
||||
field :validator
|
||||
field :disabled, type: Boolean, default: false
|
||||
field :hidden, type: Boolean, default: false
|
||||
belongs_to :seminar_main
|
||||
|
|
|
@ -92,6 +92,37 @@
|
|||
<div class="controls">
|
||||
<%= f.email_field :email, :class=>"input-block-level", :placeholder=> signup_field.placeholder[I18n.locale], :required => true %>
|
||||
</div>
|
||||
<br />
|
||||
<div class="controls">
|
||||
<label for="send_email" class="control-label muted"><%= t("seminar_signup.send_email") %></label>
|
||||
<div class="controls">
|
||||
<select name="send_email" id="send_email">
|
||||
<option value=""><%= t("seminar.select_email_type") %></option>
|
||||
<option value="reset_password"><%= t("seminar.reset_password") %></option>
|
||||
<option value="special_reminder"><%= t("seminar.special_reminder") %></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<div class="controls">
|
||||
<label class="control-label muted"><%= t("seminar_signup.predefined_text") %></label>
|
||||
<div class="controls">
|
||||
<p id="predefined_text"> </p>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<div class="controls">
|
||||
<label for="send_email_text" class="control-label muted"><%= t("seminar_signup.send_email_text") %></label>
|
||||
<div class="controls">
|
||||
<textarea class="" name="send_email_text" id="send_email_text" row="20" col="30"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<div class="controls">
|
||||
<div class="controls">
|
||||
<a class="btn" id="send_email_button"><%= t("seminar.send_email_button") %></a>
|
||||
</div>
|
||||
</div>
|
||||
<% elsif signup_field.field_name == 'note' %>
|
||||
<div class="controls">
|
||||
<div class="input-append">
|
||||
|
@ -178,7 +209,12 @@
|
|||
|
||||
<% end %>
|
||||
|
||||
|
||||
<div class="controls">
|
||||
<label class="radio-inline">
|
||||
<%= f.check_box :signup_confirmed, :checked => (@seminar_signup.signup_confirmed)%>
|
||||
<%= t('seminar_signup.registration_complete') %>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
@ -193,4 +229,49 @@
|
|||
|
||||
|
||||
</fieldset>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$("#send_email").on("change", function(){
|
||||
if($(this).val() != ""){
|
||||
let type = $(this).val();
|
||||
$.ajax({
|
||||
url : "/admin/seminar_signups/get_predefined_text",
|
||||
data : {"type" : type, "seminar_id": "<%= @seminar.id %>"},
|
||||
dataType : "json",
|
||||
type : "get",
|
||||
success : function(data){
|
||||
if( data.success == true ){
|
||||
$("#predefined_text").html(data.html);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
$("#send_email_button").on("click",function(){
|
||||
if($("#seminar_signup_email").val() == ""){
|
||||
alert("No email");
|
||||
return false;
|
||||
}
|
||||
if($("#send_email").val() != ""){
|
||||
$.ajax({
|
||||
url : "/xhr/seminars/send_notifying_email",
|
||||
data : {
|
||||
"type" : $("#send_email").val(),
|
||||
"email" : $("#seminar_signup_email").val(),
|
||||
"text" : $("#send_email_text").val(),
|
||||
"seminar_id": "<%= @seminar.id %>"
|
||||
},
|
||||
dataType : "json",
|
||||
type : "post",
|
||||
success : function(data){
|
||||
if( data.success == true ){
|
||||
alert("Email Sent");
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
return false;
|
||||
})
|
||||
})
|
||||
</script>
|
|
@ -184,6 +184,7 @@
|
|||
<th><%= t('seminar.placeholder') %></th>
|
||||
<th><%= t('seminar.disable') %></th>
|
||||
<th><%= t('seminar.hidden') %></th>
|
||||
<th><%= t('seminar.validator') %> <br /> (Use regex pattern)</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @signup_sets.each_with_index do |attr_signup,signup_index| %>
|
||||
|
@ -208,6 +209,13 @@
|
|||
<%= check_box_tag("seminar_main[seminar_signup_field_sets_attributes][#{signup_index}][hidden]", true ,attr_signup.hidden) %>
|
||||
<% end %>
|
||||
</td>
|
||||
<% if attr_signup.field_name == "password" %>
|
||||
<td>
|
||||
<%= text_field_tag("seminar_main[seminar_signup_field_sets_attributes][#{signup_index}][validator]", attr_signup.validator) %>
|
||||
</td>
|
||||
<% else %>
|
||||
<td> </td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
|
@ -325,9 +333,19 @@
|
|||
<%= t('seminar.email_edit_file') %>
|
||||
</a>
|
||||
</li>
|
||||
<li class="">
|
||||
<a href="#email_set4" data-toggle="tab">
|
||||
<%= t('seminar.email_forgot_password') %>
|
||||
</a>
|
||||
</li>
|
||||
<li class="">
|
||||
<a href="#email_set5" data-toggle="tab">
|
||||
<%= t('seminar.email_special_reminder') %>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<% (0..3).each do |index1| %>
|
||||
<% (0..5).each do |index1| %>
|
||||
<% active_email_set = index1==0 ? ' active' : '' %>
|
||||
<div class="tab-pane<%= active_email_set %>" id="email_set<%= index1 %>" style="padding: 1.2em;">
|
||||
<table style="width:100%;">
|
||||
|
@ -341,6 +359,17 @@
|
|||
<%= check_box_tag("seminar_main[seminar_email_sets_attributes][#{index1}][disabled]", true ,@email_set[index1].disabled) %>
|
||||
</td>
|
||||
</tr>
|
||||
<% if index1 == 0 %>
|
||||
<tr>
|
||||
<td>
|
||||
<%= t('seminar.is_confirmation') %>
|
||||
</td>
|
||||
<td>
|
||||
<input type="hidden" class="field_set" name='<%= "seminar_main[seminar_email_sets_attributes][#{index1}][is_confirmation]" %>' value="false">
|
||||
<%= check_box_tag("seminar_main[seminar_email_sets_attributes][#{index1}][is_confirmation]", true ,@email_set[index1].is_confirmation) %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr>
|
||||
<td>
|
||||
<%= t('seminar.email_title') %>
|
||||
|
|
|
@ -60,6 +60,20 @@
|
|||
%>
|
||||
<% elsif names[1] == 'status' %>
|
||||
<% val = t("seminar.registration_status_#{seminar_signup.status}") if !seminar_signup.status.blank? %>
|
||||
<% elsif names[1] == 'is_confirmed' %>
|
||||
<% if seminar_signup.is_confirmed
|
||||
val = "<span class='label label-success'>#{t("seminar_signup.email_confirmed")}</span>"
|
||||
else
|
||||
val = "<span class='label label-danger'>#{t("seminar_signup.email_not_confirmed")}</span>"
|
||||
end
|
||||
%>
|
||||
<% elsif names[1] == 'signup_confirmed' %>
|
||||
<% if seminar_signup.signup_confirmed
|
||||
val = "<span class='label label-success'>#{t("seminar_signup.signup_confirmed")}</span>"
|
||||
else
|
||||
val = "<span class='label label-danger'>#{t("seminar_signup.signup_not_confirmed")}</span>"
|
||||
end
|
||||
%>
|
||||
<% elsif names[1] != 'recaptcha' %>
|
||||
<% val = seminar_signup.send("#{names[1]}") %>
|
||||
<% end %>
|
||||
|
@ -77,7 +91,7 @@
|
|||
%>
|
||||
<% elsif names[2] == "tel" %>
|
||||
<% val = seminar_signup.tel %>
|
||||
<% elsif names[2] == "registration_status" %>
|
||||
<% 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" %>
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<% email_set = SeminarMain.where(id:@data['seminar_id']).first.seminar_email_sets.select{|v| v.field_name == 'reset_password'} %>
|
||||
<% if email_set.length != 0 %>
|
||||
<% if !(email_set[0].content.nil?) %>
|
||||
<%= email_set[0].content[@data['locale']].html_safe %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= t('seminar.email_add_file_content') %>
|
||||
<% end %>
|
||||
<%= (@data['extra_text'] rescue "").to_s.html_safe %>
|
|
@ -0,0 +1,9 @@
|
|||
<% email_set = SeminarMain.where(id:@data['seminar_id']).first.seminar_email_sets.select{|v| v.field_name == 'special_reminder'} %>
|
||||
<% if email_set.length != 0 %>
|
||||
<% if !(email_set[0].content.nil?) %>
|
||||
<%= email_set[0].content[@data['locale']].html_safe %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= t('seminar.email_add_file_content') %>
|
||||
<% end %>
|
||||
<%= (@data['extra_text'] rescue "").to_s.html_safe %>
|
|
@ -39,6 +39,9 @@
|
|||
<%= password_field_tag :password, nil, :placeholder => t(:dots), :id=>"user_password" %>
|
||||
</div>
|
||||
<br/>
|
||||
<div class="control-group clear">
|
||||
<a href="<%= request.original_url.split(request.env["HTTP_HOST"]).last.split('?').first + "?method=reset_email" %>"><%= t('seminar_signup.forgot_password') %></a>
|
||||
</div>
|
||||
<input type="hidden" name="referer_url" value="<%= request.original_url.split(request.env["HTTP_HOST"]).last.split('?').first %>">
|
||||
<input type="hidden" name="seminar_signup[seminar_main_id]" value="<%= @seminar.id %>">
|
||||
<button class="btn btn-primary" name="button" type="submit"><%= t('seminar_signup.login') %></button>
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
<% # encoding: utf-8 %>
|
||||
<%
|
||||
data = action_data("confirm_email_page")
|
||||
if data["url"]
|
||||
url = data["url"]
|
||||
end
|
||||
%>
|
||||
<br>
|
||||
<% if (data['confirm'] == true) %>
|
||||
<%= t('seminar_signup.confirm_ok') %>
|
||||
<br>
|
||||
<a href="<%= url %>?method=con_login" class="btn btn-primary" style="display:inline;">
|
||||
<%= t('seminar.click_to_contribute') %>
|
||||
</a>
|
||||
<% else %>
|
||||
<%= t('seminar_signup.confirm_not_ok') %>
|
||||
<br>
|
||||
<a href="<%= url %>?method=show_data" class="btn btn-primary" style="display:inline;">
|
||||
<%= t('seminar.back') %>
|
||||
</a>
|
||||
<% end %>
|
|
@ -0,0 +1,50 @@
|
|||
<% # encoding: utf-8 %>
|
||||
<%
|
||||
data = action_data("con_login")
|
||||
@seminar = data["seminar"]
|
||||
@time_now = data["time_now"]
|
||||
%>
|
||||
<style type="text/css">
|
||||
.alert-error{
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
|
||||
<section id="main-wrap">
|
||||
<div class="sign-in have-other-sign-in">
|
||||
<% flash.each do |key, msg| %>
|
||||
<%= content_tag :p, msg, :class => [key, "alert alert-error in fade"] %>
|
||||
<% end %>
|
||||
<div class="form">
|
||||
<h2><%= @seminar.title %></h2>
|
||||
<h3 class="login-logo"><%= t('seminar_signup.forgot_password') %></h3>
|
||||
<div>
|
||||
<input name="utf8" type="hidden" value="" />
|
||||
<input name="authenticity_token" type="hidden" value="" />
|
||||
</div>
|
||||
<div class="form-block">
|
||||
<div class="form-list clearfix">
|
||||
<%= form_tag reset_password_proc_seminars_path, :class => 'content' do %>
|
||||
<div class="control-group clear">
|
||||
<label for="user_email">
|
||||
<i class="icon-user"></i><%=t('seminar_signup.email_address')%>
|
||||
</label>
|
||||
<%= text_field_tag :user_name, params[:user_name], :placeholder => t('seminar_signup.email_address'), :id=>"user_email" %>
|
||||
</div>
|
||||
<br/>
|
||||
<input type="hidden" name="referer_url" value="<%= request.original_url.split(request.env["HTTP_HOST"]).last.split('?').first %>">
|
||||
<input type="hidden" name="seminar_signup[seminar_main_id]" value="<%= @seminar.id %>">
|
||||
<button class="btn btn-primary" name="button" type="submit"><%= t('seminar_signup.reset') %></button>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<br/>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
var max_width = Math.max.apply(null, $(".form .control-group label").map(function(i,el){return $(el).width()}));
|
||||
$(".form .control-group label").width(max_width);
|
||||
})
|
||||
</script>
|
|
@ -0,0 +1,74 @@
|
|||
<% # encoding: utf-8 %>
|
||||
<%
|
||||
data = action_data
|
||||
@seminar = data["seminar"]
|
||||
%>
|
||||
<style type="text/css">
|
||||
.alert-error{
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
|
||||
<section id="main-wrap">
|
||||
<% if data["status"] %>
|
||||
<div class="sign-in have-other-sign-in">
|
||||
<% flash.each do |key, msg| %>
|
||||
<%= content_tag :p, msg, :class => [key, "alert alert-error in fade"] %>
|
||||
<% end %>
|
||||
<div class="form">
|
||||
<h2><%= @seminar.title %></h2>
|
||||
<h3 class="login-logo"><%= t('seminar_signup.forgot_password') %></h3>
|
||||
<div>
|
||||
<input name="utf8" type="hidden" value="" />
|
||||
<input name="authenticity_token" type="hidden" value="" />
|
||||
</div>
|
||||
<div class="form-block">
|
||||
<div class="form-list clearfix">
|
||||
<%= form_tag reset_confirm_password_proc_seminars_path, :class => 'content', :id =>"change-password-form" do %>
|
||||
<div class="control-group clear">
|
||||
<label for="user_password">
|
||||
<i class="icon-user"></i><%=t('seminar_signup.password')%>
|
||||
</label>
|
||||
<%= password_field_tag :password, nil, :placeholder => t(:dots), :id=>"user_password", :required=> true %>
|
||||
|
||||
</div>
|
||||
<div class="control-group clear">
|
||||
<label for="confirm_user_password">
|
||||
<i class="icon-user"></i><%=t('seminar_signup.confirm_password')%>
|
||||
</label>
|
||||
<%= password_field_tag :confirm_password, nil, :placeholder => t(:dots), :id=>"confirm_user_password", :required=> true %>
|
||||
</div>
|
||||
<p class="alert-error" id="confirm-error"></p>
|
||||
<br/>
|
||||
<input type="hidden" name="referer_url" value="<%= request.original_url.split(request.env["HTTP_HOST"]).last.split('?').first %>">
|
||||
<input type="hidden" name="seminar_id" value="<%= @seminar.id %>">
|
||||
<input type="hidden" name="cid" value="<%= params[:cid] %>">
|
||||
<input type="hidden" name="reset_token" value="<%= data['token'] %>" />
|
||||
<button class="btn btn-primary" name="button" type="submit"><%= t('seminar_signup.reset') %></button>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<br/>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<p>Invalid URL</p>
|
||||
<% end %>
|
||||
</section>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
var max_width = Math.max.apply(null, $(".form .control-group label").map(function(i,el){return $(el).width()}));
|
||||
$(".form .control-group label").width(max_width);
|
||||
})
|
||||
form = document.querySelector("#change-password-form");
|
||||
form.onsubmit = function () {
|
||||
var up = document.querySelector("#user_password").value,
|
||||
cup = document.querySelector("#confirm_user_password").value
|
||||
if(up != cup){
|
||||
document.querySelector("#confirm-error").textContent = "<%= t("seminar_signup.password_mismatch") %>"
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -124,7 +124,11 @@
|
|||
</div>
|
||||
<% elsif signup_field.field_name == 'email' %>
|
||||
<div class="col-sm-10">
|
||||
<%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> signup_field.placeholder[I18n.locale], :required => true %> <a href="#" onclick="window.open(' <%= prefix_url %>?method=check_email&no=<%=@seminar.id%>&layout=false&email='+ $('input[type=email]').val() , 'check mail', config='height=100,width=300');" class="btn btn-primary">check mail</a>
|
||||
<%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> signup_field.placeholder[I18n.locale], :required => true, :title => t("seminar_signup.email_check") %> <a href="#" onclick="window.open(' <%= prefix_url %>?method=check_email&no=<%=@seminar.id%>&layout=false&email='+ $('input[type=email]').val() , 'check mail', config='height=100,width=300');" class="btn btn-primary">check mail</a>
|
||||
</div>
|
||||
<% elsif signup_field.field_name == 'password' %>
|
||||
<div class="col-sm-10">
|
||||
<%= f.password_field :password, :class=>"input-medium form-control availibility", :id=>signup_field['field_name'], :placeholder=> signup_field.placeholder[I18n.locale], :pattern => signup_field.validator, :title => t("seminar_signup.password_check") %>
|
||||
</div>
|
||||
<% elsif signup_field.field_name == 'note' %>
|
||||
<div class="col-sm-10">
|
||||
|
@ -147,7 +151,7 @@
|
|||
</div>
|
||||
<% else %>
|
||||
<div class="col-sm-10">
|
||||
<%= f.text_field signup_field['field_name'], :class=>"input-medium form-control", :id=>signup_field['field_name'], :placeholder=> signup_field.placeholder[I18n.locale], :required => (signup_field.field_name=='password' ? false : true) %>
|
||||
<%= f.text_field signup_field['field_name'], :class=>"input-medium form-control", :id=>signup_field['field_name'], :placeholder=> signup_field.placeholder[I18n.locale], :required => true %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -102,6 +102,21 @@ en:
|
|||
email_edit_file: Edit file
|
||||
email_add_file: Add file
|
||||
auto_send_email_set: Auto send email setting
|
||||
email_forgot_password: Forgot Password
|
||||
email_special_reminder: Special Reminder
|
||||
email_reset_password_content: Forgot Password
|
||||
email_reset_password_success: Forgot Password
|
||||
email_special_reminder_content: Special Reminder
|
||||
email_special_reminder_success: Special Reminder
|
||||
is_confirmation: Confirmation Email
|
||||
select_email_type: Select Email Type
|
||||
send_email_text: Additional text to send
|
||||
send_email_button: Send email
|
||||
predefined_text: Predifined email text
|
||||
click_here_to_confirm: Click this link to confirm
|
||||
confirm_ok: Email confirmed
|
||||
confirm_not_ok: Email cannot be confirmed
|
||||
validator: Validator
|
||||
click_to_contribute: Click here to contribute
|
||||
required: Required
|
||||
already_used: Already Used
|
||||
|
@ -119,7 +134,6 @@ en:
|
|||
reviewer: Reviewer #審查委員
|
||||
review_end_date: Review End Date #審查結束日期
|
||||
review_start_date: Review Start Date #審查開始日期
|
||||
review: Reveiw #審稿
|
||||
blank_no_limit: Allow Blank Value #空白無限制
|
||||
export_csv: Export CSV #匯出CSV
|
||||
recaptcha: Recaptcha #驗證碼
|
||||
|
@ -212,4 +226,24 @@ en:
|
|||
select: Select box
|
||||
checkbox: Multiple choice
|
||||
radio: Single choice
|
||||
choices: Choices
|
||||
choices: Choices
|
||||
forgot_password: Forgot Password
|
||||
reset_email_sent: Reset Email Sent
|
||||
login_failed: Login Failed
|
||||
email_not_found: Email not found
|
||||
reset: Reset
|
||||
email_reset_password_success: Password reset
|
||||
click_on_link: Please click on the link below to reset your password
|
||||
confirm_password: Confirm Password
|
||||
password_mismatch: Password mismatch
|
||||
password_changed: Password changed successfully
|
||||
password_changed_not_ok: There was an error changing password
|
||||
password_check: Must contain at least one number and one uppercase and lowercase letter, and at least 8 or more characters
|
||||
email_check: Invalid email format
|
||||
is_confirmed: Email Confirmed
|
||||
signup_confirmed: Signup Confirmed
|
||||
registration_complete: Registration Complete
|
||||
email_confirmed: Email Confirmed
|
||||
email_not_confirmed: Email not confirmed
|
||||
signup_not_confirmed: Signup not confirmed
|
||||
send_email: Send Email
|
|
@ -103,6 +103,21 @@ zh_tw:
|
|||
email_edit_file: 編輯上傳
|
||||
email_add_file: 新增上傳
|
||||
auto_send_email_set: 自動發信設定
|
||||
email_forgot_password: Forgot Password
|
||||
email_special_reminder: Special Reminder
|
||||
email_reset_password_content: Forgot Password
|
||||
email_reset_password_success: Forgot Password
|
||||
email_special_reminder_content: Special Reminder
|
||||
email_special_reminder_success: Special Reminder
|
||||
is_confirmation: Confirmation Email
|
||||
click_here_to_confirm: Click this link to confirm
|
||||
confirm_ok: Email confirmed
|
||||
confirm_not_ok: Email cannot be confirmed
|
||||
select_email_type: Select Email Type
|
||||
send_email_text: Additional text to send
|
||||
predefined_text: Predifined email text
|
||||
send_email_button: Send email
|
||||
validator: Validator
|
||||
click_to_contribute: 按此登入投稿
|
||||
required: '必填, necessary'
|
||||
already_used: 已存在
|
||||
|
@ -120,7 +135,6 @@ zh_tw:
|
|||
reviewer: 審查委員
|
||||
review_end_date: 審查結束日期
|
||||
review_start_date: 審查開始日期
|
||||
review: 審稿
|
||||
blank_no_limit: 空白無限制
|
||||
export_csv: 匯出CSV
|
||||
recaptcha: 驗證碼
|
||||
|
@ -213,4 +227,23 @@ zh_tw:
|
|||
select: 下拉選單
|
||||
checkbox: 多選
|
||||
radio: 單選
|
||||
choices: 選項
|
||||
choices: 選項
|
||||
forgot_password: Forgot Password
|
||||
reset_email_sent: Reset Email Sent
|
||||
login_failed: 登入失敗
|
||||
email_not_found: Email not found
|
||||
reset: Reset
|
||||
click_on_link: 請點選下方連結後重設密碼。
|
||||
confirm_password: Confirm Password
|
||||
password_mismatch: Password missmatch
|
||||
password_changed: Password changed successfully
|
||||
password_changed_not_ok: There was an error changing password
|
||||
password_check: Must contain at least one number and one uppercase and lowercase letter, and at least 8 or more characters
|
||||
email_check: Invalid email format
|
||||
is_confirmed: Email Confirmed
|
||||
signup_confirmed: Signup Confirmed
|
||||
registration_complete: Registration Complete
|
||||
email_confirmed: Email Confirmed
|
||||
email_not_confirmed: Email not confirmed
|
||||
signup_not_confirmed: Signup not confirmed
|
||||
send_email: Send Email
|
|
@ -53,7 +53,7 @@ Rails.application.routes.draw do
|
|||
SeminarSubmissionField.create_indexes
|
||||
end
|
||||
locales = Site.first.in_use_locales rescue I18n.available_locales
|
||||
|
||||
|
||||
scope "(:locale)", locale: Regexp.new(locales.join("|")) do
|
||||
namespace :admin do
|
||||
resources :seminars do
|
||||
|
@ -89,6 +89,7 @@ Rails.application.routes.draw do
|
|||
post 'delete_items'
|
||||
end
|
||||
end
|
||||
get "seminar_signups/get_predefined_text" => "seminar_signups#get_predefined_text"
|
||||
resources :seminar_agreements
|
||||
resources :seminar_signups
|
||||
resources :seminar_submission_values
|
||||
|
@ -101,12 +102,14 @@ Rails.application.routes.draw do
|
|||
get ':slug_title-:uid', to: 'seminars#show'
|
||||
post 'con_login_proc', to: 'seminars#con_login_proc'
|
||||
post 'con_logout_proc', to: 'seminars#con_logout_proc'
|
||||
post 'reset_password_proc', to: 'seminars#reset_password_proc'
|
||||
post 'reset_confirm_password_proc', to: 'seminars#reset_confirm_password_proc'
|
||||
post 'add_file_proc', to: 'seminars#add_file_proc'
|
||||
post 'edit_file_proc', to: 'seminars#edit_file_proc'
|
||||
post 'del_file', to: 'seminars#del_file'
|
||||
end
|
||||
end
|
||||
|
||||
post "/xhr/seminars/send_notifying_email" => "seminars#send_notifying_email"
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue