forked from spen/seminar
new stuff
This commit is contained in:
parent
31112700c3
commit
4a0f4081ff
|
@ -63,6 +63,15 @@ class Admin::SeminarSignupsController < OrbitAdminController
|
||||||
redirect_to "/admin/seminars/#{@seminar_main_id}/seminar_signup"
|
redirect_to "/admin/seminars/#{@seminar_main_id}/seminar_signup"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_predefined_text
|
||||||
|
seminar = SeminarMain.find(params[:seminar_id])
|
||||||
|
text = seminar.seminar_email_sets.where(:field_name => params[:type]).first.content[I18n.locale]
|
||||||
|
render :json => {
|
||||||
|
"success" => true,
|
||||||
|
"html" => text
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def seminar_signup_params
|
def seminar_signup_params
|
||||||
|
|
|
@ -682,6 +682,11 @@ class Admin::SeminarsController < OrbitAdminController
|
||||||
redirect_to "/admin/seminars/@seminar_id.to_s/seminar_signup"
|
redirect_to "/admin/seminars/@seminar_id.to_s/seminar_signup"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def create_email_set
|
||||||
|
SeminarEmailSet.create_new_fields(params[:id])
|
||||||
|
redirect_to "/admin/seminars/#{params[:id]}/edit"
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def set_seminar
|
def set_seminar
|
||||||
|
@ -758,7 +763,7 @@ class Admin::SeminarsController < OrbitAdminController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@email_set = []
|
@email_set = []
|
||||||
['signup','submission','add_file','edit_file'].each do |field_name|
|
['signup','submission','add_file','edit_file', 'reset_password', "special_reminder"].each do |field_name|
|
||||||
email_set = @seminar.seminar_email_sets.select{|v| v.field_name==field_name}
|
email_set = @seminar.seminar_email_sets.select{|v| v.field_name==field_name}
|
||||||
if email_set.length==0
|
if email_set.length==0
|
||||||
title = Hash.new
|
title = Hash.new
|
||||||
|
|
|
@ -3,7 +3,7 @@ class SeminarsController < ApplicationController
|
||||||
include MemberHelper
|
include MemberHelper
|
||||||
include ActionView::Context #vary important (only add this can access @@session from view)
|
include ActionView::Context #vary important (only add this can access @@session from view)
|
||||||
include Admin::SeminarsHelper
|
include Admin::SeminarsHelper
|
||||||
FrontendMethods = ["show_privacy", "show_data", "check_email", "check_availability", "signup_ok", "add_file", "edit_file", "con_login", "con_upload", "con_logout"]
|
FrontendMethods = ["show_privacy", "show_data", "check_email", "check_availability", "signup_ok", "add_file", "edit_file", "con_login", "con_upload", "con_logout","confirm_email_page","reset_password_page"]
|
||||||
# include SimpleCaptcha::ControllerHelpers
|
# include SimpleCaptcha::ControllerHelpers
|
||||||
def index
|
def index
|
||||||
|
|
||||||
|
@ -490,6 +490,9 @@ class SeminarsController < ApplicationController
|
||||||
:seminar_signup=>@seminar_signup},:layout=>false)
|
:seminar_signup=>@seminar_signup},:layout=>false)
|
||||||
if params['seminar_signup']['status']=='C'
|
if params['seminar_signup']['status']=='C'
|
||||||
status_param = '&status='
|
status_param = '&status='
|
||||||
|
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)
|
send_mail('submission',params[:seminar_signup][:email],params[:seminar_signup][:seminar_main_id],extra_text)
|
||||||
else
|
else
|
||||||
status_param = ''
|
status_param = ''
|
||||||
|
@ -733,6 +736,44 @@ class SeminarsController < ApplicationController
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def reset_email
|
||||||
|
end
|
||||||
|
|
||||||
|
def reset_password_page
|
||||||
|
params = OrbitHelper.params
|
||||||
|
seminar = SeminarMain.find_by(uid: params[:uid])
|
||||||
|
seminar_signup = seminar.seminar_signups.where(:status=>'C', :id=> params[:cid], :token => params[:token]).first
|
||||||
|
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
|
def con_login_proc
|
||||||
|
|
||||||
seminar = SeminarMain.find_by(id: params[:seminar_signup][:seminar_main_id])
|
seminar = SeminarMain.find_by(id: params[:seminar_signup][:seminar_main_id])
|
||||||
|
@ -751,6 +792,35 @@ class SeminarsController < ApplicationController
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def reset_confirm_password_proc
|
||||||
|
params = OrbitHelper.params
|
||||||
|
seminar = SeminarMain.find(params[:seminar_id])
|
||||||
|
redirect_to "#{params[:referer_url].to_s.chomp('/')}/?method=reset_password_page" if seminar.nil?
|
||||||
|
|
||||||
|
seminar_signup = seminar.seminar_signups.where(:status =>'C', :token => params[:reset_token], :id => params[:cid]).first
|
||||||
|
if !seminar_signup.blank?
|
||||||
|
seminar_signup.password = params[:password]
|
||||||
|
seminar_signup.token = nil
|
||||||
|
seminar_signup.save
|
||||||
|
redirect_to "#{params[:referer_url].to_s.chomp('/')}/?method=con_login", :notice => t('seminar_signup.password_changed')
|
||||||
|
else
|
||||||
|
redirect_to "#{params[:referer_url].to_s.chomp('/')}/?method=con_login", :notice => t('seminar_signup.password_changed_not_ok')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def reset_password_proc
|
||||||
|
@seminar = SeminarMain.find_by(id: params[:seminar_signup][:seminar_main_id])
|
||||||
|
seminar_signup = SeminarSignup.where(:status=>'C', :email=> params[:user_name], :seminar_main_id => params[:seminar_signup][:seminar_main_id]).first
|
||||||
|
if !seminar_signup.blank?
|
||||||
|
token = seminar_signup.generate_token
|
||||||
|
extra_text = "<br><a href='#{request.protocol + request.host_with_port + params[:referer_url].to_s.chomp('/')}/?method=reset_password_page&token=#{token}&cid=#{seminar_signup.id.to_s}'>#{t("seminar_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
|
def seminar_signup_params
|
||||||
params.require(:seminar_signup).permit!
|
params.require(:seminar_signup).permit!
|
||||||
end
|
end
|
||||||
|
@ -759,6 +829,22 @@ class SeminarsController < ApplicationController
|
||||||
params.require(:seminar_signup_contribute).permit!
|
params.require(:seminar_signup_contribute).permit!
|
||||||
end
|
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
|
def seminar_signup_values_params
|
||||||
params.require(:seminar_signup_values).permit!
|
params.require(:seminar_signup_values).permit!
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,5 +6,6 @@ class SeminarEmailSet
|
||||||
field :title
|
field :title
|
||||||
field :content
|
field :content
|
||||||
field :disabled, type: Boolean, default: false
|
field :disabled, type: Boolean, default: false
|
||||||
|
field :is_confirmation, type: Boolean, default: false
|
||||||
belongs_to :seminar_main
|
belongs_to :seminar_main
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,11 +3,14 @@ class SeminarSignup
|
||||||
|
|
||||||
include Mongoid::Document
|
include Mongoid::Document
|
||||||
include Mongoid::Timestamps
|
include Mongoid::Timestamps
|
||||||
HiddenFields = ['seminar_signup_id','_id', 'created_at', 'updated_at','seminar_main_id',"serial_number","final_session","final_sessions","preferred_sessions",'seminar_session_id',"seminar_session_ids","preferred_session","sort_number","abstract_number","presentation_type", "filename"]
|
HiddenFields = ['seminar_signup_id','_id', 'created_at', 'updated_at','seminar_main_id',"serial_number","final_session","final_sessions","preferred_sessions",'seminar_session_id',"seminar_session_ids","preferred_session","sort_number","abstract_number","presentation_type", "filename", "token", "reset_token"]
|
||||||
DefaultEnableFields = ['status','name','tel','phone','email','password','recaptcha']
|
DefaultEnableFields = ['status','name','tel','phone','email','password','recaptcha']
|
||||||
field :sort_number , type: Integer, default: 10000
|
field :sort_number , type: Integer, default: 10000
|
||||||
|
|
||||||
field :status
|
field :status
|
||||||
|
field :token
|
||||||
|
field :is_confirmed, type: Boolean, default: false # for email confirmation
|
||||||
|
field :signup_confirmed, type: Boolean, default: false
|
||||||
field :name # become Last Name for TICC
|
field :name # become Last Name for TICC
|
||||||
field :tel, type: String # become First Name for TICC
|
field :tel, type: String # become First Name for TICC
|
||||||
field :unit, localize: true #Only localize for preserving old record
|
field :unit, localize: true #Only localize for preserving old record
|
||||||
|
@ -55,6 +58,7 @@ class SeminarSignup
|
||||||
self.serial_number = last_serial_number + 1
|
self.serial_number = last_serial_number + 1
|
||||||
SeminarMain.where(:id=>self.seminar_main_id).update_all({"$inc"=>{"last_serial_number"=>1}})
|
SeminarMain.where(:id=>self.seminar_main_id).update_all({"$inc"=>{"last_serial_number"=>1}})
|
||||||
end
|
end
|
||||||
|
self.token = SecureRandom.hex(5)
|
||||||
end
|
end
|
||||||
after_destroy do
|
after_destroy do
|
||||||
seminar_main = self.seminar_main
|
seminar_main = self.seminar_main
|
||||||
|
@ -80,6 +84,13 @@ class SeminarSignup
|
||||||
seminar_session.save
|
seminar_session.save
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def generate_token
|
||||||
|
token = SecureRandom.hex(5)
|
||||||
|
self.token = token
|
||||||
|
self.save
|
||||||
|
return token
|
||||||
|
end
|
||||||
def display_serial_number
|
def display_serial_number
|
||||||
display_format_string(self.serial_number,4)
|
display_format_string(self.serial_number,4)
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,6 +5,7 @@ class SeminarSignupFieldSet
|
||||||
field :field_name, type: String
|
field :field_name, type: String
|
||||||
field :placeholder
|
field :placeholder
|
||||||
field :name
|
field :name
|
||||||
|
field :validator
|
||||||
field :disabled, type: Boolean, default: false
|
field :disabled, type: Boolean, default: false
|
||||||
field :hidden, type: Boolean, default: false
|
field :hidden, type: Boolean, default: false
|
||||||
belongs_to :seminar_main
|
belongs_to :seminar_main
|
||||||
|
|
|
@ -92,6 +92,37 @@
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<%= f.email_field :email, :class=>"input-block-level", :placeholder=> signup_field.placeholder[I18n.locale], :required => true %>
|
<%= f.email_field :email, :class=>"input-block-level", :placeholder=> signup_field.placeholder[I18n.locale], :required => true %>
|
||||||
</div>
|
</div>
|
||||||
|
<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' %>
|
<% elsif signup_field.field_name == 'note' %>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<div class="input-append">
|
<div class="input-append">
|
||||||
|
@ -178,7 +209,12 @@
|
||||||
|
|
||||||
<% end %>
|
<% 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>
|
</div>
|
||||||
|
|
||||||
|
@ -194,3 +230,48 @@
|
||||||
|
|
||||||
</fieldset>
|
</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.placeholder') %></th>
|
||||||
<th><%= t('seminar.disable') %></th>
|
<th><%= t('seminar.disable') %></th>
|
||||||
<th><%= t('seminar.hidden') %></th>
|
<th><%= t('seminar.hidden') %></th>
|
||||||
|
<th><%= t('seminar.validator') %> <br /> (Use regex pattern)</th>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<% @signup_sets.each_with_index do |attr_signup,signup_index| %>
|
<% @signup_sets.each_with_index do |attr_signup,signup_index| %>
|
||||||
|
@ -208,6 +209,13 @@
|
||||||
<%= check_box_tag("seminar_main[seminar_signup_field_sets_attributes][#{signup_index}][hidden]", true ,attr_signup.hidden) %>
|
<%= check_box_tag("seminar_main[seminar_signup_field_sets_attributes][#{signup_index}][hidden]", true ,attr_signup.hidden) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
|
<% if attr_signup.field_name == "password" %>
|
||||||
|
<td>
|
||||||
|
<%= text_field_tag("seminar_main[seminar_signup_field_sets_attributes][#{signup_index}][validator]", attr_signup.validator) %>
|
||||||
|
</td>
|
||||||
|
<% else %>
|
||||||
|
<td> </td>
|
||||||
|
<% end %>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -325,9 +333,19 @@
|
||||||
<%= t('seminar.email_edit_file') %>
|
<%= t('seminar.email_edit_file') %>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="">
|
||||||
|
<a href="#email_set4" data-toggle="tab">
|
||||||
|
<%= t('seminar.email_forgot_password') %>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="">
|
||||||
|
<a href="#email_set5" data-toggle="tab">
|
||||||
|
<%= t('seminar.email_special_reminder') %>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
<% (0..3).each do |index1| %>
|
<% (0..5).each do |index1| %>
|
||||||
<% active_email_set = index1==0 ? ' active' : '' %>
|
<% active_email_set = index1==0 ? ' active' : '' %>
|
||||||
<div class="tab-pane<%= active_email_set %>" id="email_set<%= index1 %>" style="padding: 1.2em;">
|
<div class="tab-pane<%= active_email_set %>" id="email_set<%= index1 %>" style="padding: 1.2em;">
|
||||||
<table style="width:100%;">
|
<table style="width:100%;">
|
||||||
|
@ -341,6 +359,17 @@
|
||||||
<%= check_box_tag("seminar_main[seminar_email_sets_attributes][#{index1}][disabled]", true ,@email_set[index1].disabled) %>
|
<%= check_box_tag("seminar_main[seminar_email_sets_attributes][#{index1}][disabled]", true ,@email_set[index1].disabled) %>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<% if index1 == 0 %>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<%= t('seminar.is_confirmation') %>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="hidden" class="field_set" name='<%= "seminar_main[seminar_email_sets_attributes][#{index1}][is_confirmation]" %>' value="false">
|
||||||
|
<%= check_box_tag("seminar_main[seminar_email_sets_attributes][#{index1}][is_confirmation]", true ,@email_set[index1].is_confirmation) %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<%= t('seminar.email_title') %>
|
<%= t('seminar.email_title') %>
|
||||||
|
|
|
@ -60,6 +60,20 @@
|
||||||
%>
|
%>
|
||||||
<% elsif names[1] == 'status' %>
|
<% elsif names[1] == 'status' %>
|
||||||
<% val = t("seminar.registration_status_#{seminar_signup.status}") if !seminar_signup.status.blank? %>
|
<% val = t("seminar.registration_status_#{seminar_signup.status}") if !seminar_signup.status.blank? %>
|
||||||
|
<% elsif names[1] == 'is_confirmed' %>
|
||||||
|
<% if seminar_signup.is_confirmed
|
||||||
|
val = "<span class='label label-success'>#{t("seminar_signup.email_confirmed")}</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' %>
|
<% elsif names[1] != 'recaptcha' %>
|
||||||
<% val = seminar_signup.send("#{names[1]}") %>
|
<% val = seminar_signup.send("#{names[1]}") %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -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" %>
|
<%= password_field_tag :password, nil, :placeholder => t(:dots), :id=>"user_password" %>
|
||||||
</div>
|
</div>
|
||||||
<br/>
|
<br/>
|
||||||
|
<div class="control-group clear">
|
||||||
|
<a href="<%= request.original_url.split(request.env["HTTP_HOST"]).last.split('?').first + "?method=reset_email" %>"><%= t('seminar_signup.forgot_password') %></a>
|
||||||
|
</div>
|
||||||
<input type="hidden" name="referer_url" value="<%= request.original_url.split(request.env["HTTP_HOST"]).last.split('?').first %>">
|
<input type="hidden" name="referer_url" value="<%= request.original_url.split(request.env["HTTP_HOST"]).last.split('?').first %>">
|
||||||
<input type="hidden" name="seminar_signup[seminar_main_id]" value="<%= @seminar.id %>">
|
<input type="hidden" name="seminar_signup[seminar_main_id]" value="<%= @seminar.id %>">
|
||||||
<button class="btn btn-primary" name="button" type="submit"><%= t('seminar_signup.login') %></button>
|
<button class="btn btn-primary" name="button" type="submit"><%= t('seminar_signup.login') %></button>
|
||||||
|
|
|
@ -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>
|
</div>
|
||||||
<% elsif signup_field.field_name == 'email' %>
|
<% elsif signup_field.field_name == 'email' %>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> signup_field.placeholder[I18n.locale], :required => true %> <a href="#" onclick="window.open(' <%= prefix_url %>?method=check_email&no=<%=@seminar.id%>&layout=false&email='+ $('input[type=email]').val() , 'check mail', config='height=100,width=300');" class="btn btn-primary">check mail</a>
|
<%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> signup_field.placeholder[I18n.locale], :required => true, :title => t("seminar_signup.email_check") %> <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>
|
</div>
|
||||||
<% elsif signup_field.field_name == 'note' %>
|
<% elsif signup_field.field_name == 'note' %>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
|
@ -147,7 +151,7 @@
|
||||||
</div>
|
</div>
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<%= f.text_field signup_field['field_name'], :class=>"input-medium form-control", :id=>signup_field['field_name'], :placeholder=> signup_field.placeholder[I18n.locale], :required => (signup_field.field_name=='password' ? false : true) %>
|
<%= f.text_field signup_field['field_name'], :class=>"input-medium form-control", :id=>signup_field['field_name'], :placeholder=> signup_field.placeholder[I18n.locale], :required => true %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -102,6 +102,21 @@ en:
|
||||||
email_edit_file: Edit file
|
email_edit_file: Edit file
|
||||||
email_add_file: Add file
|
email_add_file: Add file
|
||||||
auto_send_email_set: Auto send email setting
|
auto_send_email_set: Auto send email setting
|
||||||
|
email_forgot_password: Forgot Password
|
||||||
|
email_special_reminder: Special Reminder
|
||||||
|
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
|
click_to_contribute: Click here to contribute
|
||||||
required: Required
|
required: Required
|
||||||
already_used: Already Used
|
already_used: Already Used
|
||||||
|
@ -119,7 +134,6 @@ en:
|
||||||
reviewer: Reviewer #審查委員
|
reviewer: Reviewer #審查委員
|
||||||
review_end_date: Review End Date #審查結束日期
|
review_end_date: Review End Date #審查結束日期
|
||||||
review_start_date: Review Start Date #審查開始日期
|
review_start_date: Review Start Date #審查開始日期
|
||||||
review: Reveiw #審稿
|
|
||||||
blank_no_limit: Allow Blank Value #空白無限制
|
blank_no_limit: Allow Blank Value #空白無限制
|
||||||
export_csv: Export CSV #匯出CSV
|
export_csv: Export CSV #匯出CSV
|
||||||
recaptcha: Recaptcha #驗證碼
|
recaptcha: Recaptcha #驗證碼
|
||||||
|
@ -213,3 +227,23 @@ en:
|
||||||
checkbox: Multiple choice
|
checkbox: Multiple choice
|
||||||
radio: Single choice
|
radio: Single choice
|
||||||
choices: Choices
|
choices: Choices
|
||||||
|
forgot_password: Forgot Password
|
||||||
|
reset_email_sent: Reset Email Sent
|
||||||
|
login_failed: Login Failed
|
||||||
|
email_not_found: Email not found
|
||||||
|
reset: Reset
|
||||||
|
email_reset_password_success: Password reset
|
||||||
|
click_on_link: Please click on the link below to reset your password
|
||||||
|
confirm_password: Confirm Password
|
||||||
|
password_mismatch: Password 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_edit_file: 編輯上傳
|
||||||
email_add_file: 新增上傳
|
email_add_file: 新增上傳
|
||||||
auto_send_email_set: 自動發信設定
|
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: 按此登入投稿
|
click_to_contribute: 按此登入投稿
|
||||||
required: '必填, necessary'
|
required: '必填, necessary'
|
||||||
already_used: 已存在
|
already_used: 已存在
|
||||||
|
@ -120,7 +135,6 @@ zh_tw:
|
||||||
reviewer: 審查委員
|
reviewer: 審查委員
|
||||||
review_end_date: 審查結束日期
|
review_end_date: 審查結束日期
|
||||||
review_start_date: 審查開始日期
|
review_start_date: 審查開始日期
|
||||||
review: 審稿
|
|
||||||
blank_no_limit: 空白無限制
|
blank_no_limit: 空白無限制
|
||||||
export_csv: 匯出CSV
|
export_csv: 匯出CSV
|
||||||
recaptcha: 驗證碼
|
recaptcha: 驗證碼
|
||||||
|
@ -214,3 +228,22 @@ zh_tw:
|
||||||
checkbox: 多選
|
checkbox: 多選
|
||||||
radio: 單選
|
radio: 單選
|
||||||
choices: 選項
|
choices: 選項
|
||||||
|
forgot_password: Forgot Password
|
||||||
|
reset_email_sent: Reset Email Sent
|
||||||
|
login_failed: 登入失敗
|
||||||
|
email_not_found: Email not found
|
||||||
|
reset: Reset
|
||||||
|
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
|
|
@ -89,6 +89,7 @@ Rails.application.routes.draw do
|
||||||
post 'delete_items'
|
post 'delete_items'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
get "seminar_signups/get_predefined_text" => "seminar_signups#get_predefined_text"
|
||||||
resources :seminar_agreements
|
resources :seminar_agreements
|
||||||
resources :seminar_signups
|
resources :seminar_signups
|
||||||
resources :seminar_submission_values
|
resources :seminar_submission_values
|
||||||
|
@ -101,12 +102,14 @@ Rails.application.routes.draw do
|
||||||
get ':slug_title-:uid', to: 'seminars#show'
|
get ':slug_title-:uid', to: 'seminars#show'
|
||||||
post 'con_login_proc', to: 'seminars#con_login_proc'
|
post 'con_login_proc', to: 'seminars#con_login_proc'
|
||||||
post 'con_logout_proc', to: 'seminars#con_logout_proc'
|
post 'con_logout_proc', to: 'seminars#con_logout_proc'
|
||||||
|
post 'reset_password_proc', to: 'seminars#reset_password_proc'
|
||||||
|
post 'reset_confirm_password_proc', to: 'seminars#reset_confirm_password_proc'
|
||||||
post 'add_file_proc', to: 'seminars#add_file_proc'
|
post 'add_file_proc', to: 'seminars#add_file_proc'
|
||||||
post 'edit_file_proc', to: 'seminars#edit_file_proc'
|
post 'edit_file_proc', to: 'seminars#edit_file_proc'
|
||||||
post 'del_file', to: 'seminars#del_file'
|
post 'del_file', to: 'seminars#del_file'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
post "/xhr/seminars/send_notifying_email" => "seminars#send_notifying_email"
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue