Compare commits
3 Commits
9d7c361132
...
6c190bfecb
Author | SHA1 | Date |
---|---|---|
|
6c190bfecb | |
|
61fa9d03f8 | |
|
8768186242 |
|
@ -1,6 +1,6 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
class Admin::ApplicationFormsController < OrbitAdminController
|
class Admin::ApplicationFormsController < OrbitAdminController
|
||||||
|
Is_Rails5 = (Rails::VERSION::MAJOR >= 5)
|
||||||
require 'axlsx'
|
require 'axlsx'
|
||||||
include Admin::ApplicationFormsHelper
|
include Admin::ApplicationFormsHelper
|
||||||
helper Admin::ApplicationFormsFieldHelper
|
helper Admin::ApplicationFormsFieldHelper
|
||||||
|
@ -501,7 +501,20 @@ class Admin::ApplicationFormsController < OrbitAdminController
|
||||||
application_form.application_form_email_sets.create(value)
|
application_form.application_form_email_sets.create(value)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
redirect_to params['referer_url']
|
if params['referer_url'].blank?
|
||||||
|
fallback_location = admin_application_forms_path
|
||||||
|
if Is_Rails5
|
||||||
|
redirect_back(fallback_location: fallback_location) and return
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
redirect_to :back and return
|
||||||
|
rescue
|
||||||
|
redirect_to fallback_location and return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
redirect_to params['referer_url'] and return
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -603,7 +616,20 @@ class Admin::ApplicationFormsController < OrbitAdminController
|
||||||
@application_form.update_user_id = current_user.id
|
@application_form.update_user_id = current_user.id
|
||||||
if @application_form.update_attributes(@application_form_params)
|
if @application_form.update_attributes(@application_form_params)
|
||||||
@application_form.application_form_signup_fields.each{|t| t.destroy if t["to_delete"] == true}
|
@application_form.application_form_signup_fields.each{|t| t.destroy if t["to_delete"] == true}
|
||||||
|
if params['referer_url'].blank?
|
||||||
|
fallback_location = admin_application_forms_path
|
||||||
|
if Is_Rails5
|
||||||
|
redirect_back(fallback_location: fallback_location) and return
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
redirect_to :back and return
|
||||||
|
rescue
|
||||||
|
redirect_to fallback_location and return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
redirect_to params['referer_url'] and return
|
redirect_to params['referer_url'] and return
|
||||||
|
end
|
||||||
else
|
else
|
||||||
flash.now[:error] = t('update.error.category')
|
flash.now[:error] = t('update.error.category')
|
||||||
render action: :edit and return
|
render action: :edit and return
|
||||||
|
@ -916,7 +942,31 @@ class Admin::ApplicationFormsController < OrbitAdminController
|
||||||
(ApplicationFormSignup.attribute_names + ['recaptcha']).each do |attr_signup|
|
(ApplicationFormSignup.attribute_names + ['recaptcha']).each do |attr_signup|
|
||||||
next if except_attributes.include?(attr_signup)
|
next if except_attributes.include?(attr_signup)
|
||||||
signup_set = @application_form.application_form_signup_field_sets.select{|v| v.field_name==attr_signup }
|
signup_set = @application_form.application_form_signup_field_sets.select{|v| v.field_name==attr_signup }
|
||||||
if signup_set.length==0
|
fix_trans = false
|
||||||
|
if signup_set.length > 0 && signup_set[0].name[I18n.locale.to_s].include?("Translation missing")
|
||||||
|
fix_trans = true
|
||||||
|
end
|
||||||
|
if signup_set.length==0 || fix_trans
|
||||||
|
name1 = Hash.new
|
||||||
|
now_locale = I18n.locale
|
||||||
|
I18n.available_locales.each do |locale|
|
||||||
|
I18n.with_locale(locale) do
|
||||||
|
tmp = t("application_form_signup.#{attr_signup}", :default=>nil)
|
||||||
|
if tmp.nil?
|
||||||
|
tmp = t("application_form.#{attr_signup}", :default=>nil)
|
||||||
|
end
|
||||||
|
if tmp
|
||||||
|
name1[locale] = tmp
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
I18n.locale = now_locale
|
||||||
|
if fix_trans
|
||||||
|
signup_set.each do |s|
|
||||||
|
s.update(name:name1,placeholder:name1)
|
||||||
|
end
|
||||||
|
next
|
||||||
|
end
|
||||||
if ApplicationFormSignup::DefaultEnableFields.include? attr_signup
|
if ApplicationFormSignup::DefaultEnableFields.include? attr_signup
|
||||||
disabled = false
|
disabled = false
|
||||||
else
|
else
|
||||||
|
@ -927,13 +977,6 @@ class Admin::ApplicationFormsController < OrbitAdminController
|
||||||
else
|
else
|
||||||
hidden = true
|
hidden = true
|
||||||
end
|
end
|
||||||
name1 = Hash.new
|
|
||||||
now_locale = I18n.locale
|
|
||||||
I18n.available_locales.each do |locale|
|
|
||||||
I18n.locale = locale
|
|
||||||
name1[locale] = t("application_form_signup.#{attr_signup}")
|
|
||||||
end
|
|
||||||
I18n.locale = now_locale
|
|
||||||
if save_flag
|
if save_flag
|
||||||
@application_form.application_form_signup_field_sets.create(field_name:attr_signup,disabled:disabled,hidden:hidden,name:name1,placeholder:name1)
|
@application_form.application_form_signup_field_sets.create(field_name:attr_signup,disabled:disabled,hidden:hidden,name:name1,placeholder:name1)
|
||||||
else
|
else
|
||||||
|
@ -945,14 +988,31 @@ class Admin::ApplicationFormsController < OrbitAdminController
|
||||||
ApplicationFormSignupContribute.attribute_names.each do |attr_submission|
|
ApplicationFormSignupContribute.attribute_names.each do |attr_submission|
|
||||||
next if except_attributes.include?(attr_submission)
|
next if except_attributes.include?(attr_submission)
|
||||||
signup_set = @application_form.application_form_submission_field_sets.select{|v| v.field_name==attr_submission }
|
signup_set = @application_form.application_form_submission_field_sets.select{|v| v.field_name==attr_submission }
|
||||||
if signup_set.length==0
|
fix_trans = false
|
||||||
|
if signup_set.length > 0 && signup_set[0].name[I18n.locale.to_s].include?("Translation missing")
|
||||||
|
fix_trans = true
|
||||||
|
end
|
||||||
|
if signup_set.length==0 || fix_trans
|
||||||
name1 = Hash.new
|
name1 = Hash.new
|
||||||
now_locale = I18n.locale
|
now_locale = I18n.locale
|
||||||
I18n.available_locales.each do |locale|
|
I18n.available_locales.each do |locale|
|
||||||
I18n.locale = locale
|
I18n.with_locale(locale) do
|
||||||
name1[locale] = t("application_form_signup.#{attr_submission}")
|
tmp = t("application_form_signup.#{attr_submission}", :default=>nil)
|
||||||
|
if tmp.nil?
|
||||||
|
tmp = t("application_form.#{attr_submission}", :default=>nil)
|
||||||
|
end
|
||||||
|
if tmp
|
||||||
|
name1[locale] = tmp
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
I18n.locale = now_locale
|
I18n.locale = now_locale
|
||||||
|
if fix_trans
|
||||||
|
signup_set.each do |s|
|
||||||
|
s.update(name:name1,placeholder:name1)
|
||||||
|
end
|
||||||
|
next
|
||||||
|
end
|
||||||
if save_flag
|
if save_flag
|
||||||
@application_form.application_form_submission_field_sets.create(field_name:attr_submission,name:name1,placeholder:name1)
|
@application_form.application_form_submission_field_sets.create(field_name:attr_submission,name:name1,placeholder:name1)
|
||||||
else
|
else
|
||||||
|
|
|
@ -4,7 +4,7 @@ class ApplicationFormSignup
|
||||||
include Mongoid::Document
|
include Mongoid::Document
|
||||||
include Mongoid::Timestamps
|
include Mongoid::Timestamps
|
||||||
HiddenFields = ['ip', 'application_form_signup_id', 'password', 'status', 'reviewer_ids_list','_id', 'created_at', 'updated_at','application_form_main_id',"serial_number","final_session","final_sessions","preferred_sessions",'application_form_session_id',"application_form_session_ids","preferred_session","sort_number","abstract_number","presentation_type", "cipher_stage_num", "process_stage", "review_status", "agree_reviewer_ids", "agree_reviewer_times"]
|
HiddenFields = ['ip', 'application_form_signup_id', 'password', 'status', 'reviewer_ids_list','_id', 'created_at', 'updated_at','application_form_main_id',"serial_number","final_session","final_sessions","preferred_sessions",'application_form_session_id',"application_form_session_ids","preferred_session","sort_number","abstract_number","presentation_type", "cipher_stage_num", "process_stage", "review_status", "agree_reviewer_ids", "agree_reviewer_times"]
|
||||||
DefaultEnableFields = ['name','tel','phone','email', 'recaptcha']
|
DefaultEnableFields = ['name','tel','phone','email', 'recaptcha', 'agree']
|
||||||
field :ip, type: String
|
field :ip, type: String
|
||||||
field :sort_number , type: Integer, default: 10000
|
field :sort_number , type: Integer, default: 10000
|
||||||
field :process_stage, type: Integer, default: 1
|
field :process_stage, type: Integer, default: 1
|
||||||
|
|
|
@ -377,7 +377,6 @@
|
||||||
|
|
||||||
<!-- Form Actions -->
|
<!-- Form Actions -->
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
<%= get_referer_url[:application_formion] rescue "" %>
|
|
||||||
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
||||||
<input type="hidden" name="referer_url" value="<%= get_referer_url %>">
|
<input type="hidden" name="referer_url" value="<%= get_referer_url %>">
|
||||||
<%= link_to t('cancel'), admin_application_forms_path, :class=>"btn" %>
|
<%= link_to t('cancel'), admin_application_forms_path, :class=>"btn" %>
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
<button type="button" class="btn btn-success add-attributes"><%= t(:add_attribute_field) %></button>
|
<button type="button" class="btn btn-success add-attributes"><%= t(:add_attribute_field) %></button>
|
||||||
<%= hidden_field_tag 'id', params[:id] if !params[:id].blank? %>
|
<%= hidden_field_tag 'id', params[:id] if !params[:id].blank? %>
|
||||||
<%= f.submit t(:submit),:class=>"btn btn-primary"%>
|
<%= f.submit t(:submit),:class=>"btn btn-primary"%>
|
||||||
|
<input type="hidden" name="referer_url" value="<%= get_referer_url %>">
|
||||||
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
|
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
<button type="button" class="btn btn-success add-attributes"><%= t(:add_attribute_field) %></button>
|
<button type="button" class="btn btn-success add-attributes"><%= t(:add_attribute_field) %></button>
|
||||||
<%= hidden_field_tag 'id', params[:id] if !params[:id].blank? %>
|
<%= hidden_field_tag 'id', params[:id] if !params[:id].blank? %>
|
||||||
<%= f.submit t(:submit),:class=>"btn btn-primary"%>
|
<%= f.submit t(:submit),:class=>"btn btn-primary"%>
|
||||||
|
<input type="hidden" name="referer_url" value="<%= get_referer_url %>">
|
||||||
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
|
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
prefix_url = OrbitHelper.url_to_show(@application_form.to_param)
|
prefix_url = OrbitHelper.url_to_show(@application_form.to_param)
|
||||||
end
|
end
|
||||||
%>
|
%>
|
||||||
<% if @application_form.application_form_start_date < @time_now and ( @application_form.application_form_end_date.nil? or @application_form.application_form_end_date+1.days > @time_now ) %>
|
<% if @application_form.application_form_start_date && @application_form.application_form_start_date < @time_now && ( @application_form.application_form_end_date.nil? || @application_form.application_form_end_date+1.days > @time_now ) %>
|
||||||
|
|
||||||
<%#= stylesheet_link_tag "lib/main-forms" %>
|
<%#= stylesheet_link_tag "lib/main-forms" %>
|
||||||
<% notice = flash["notice"] || params[:notice] %>
|
<% notice = flash["notice"] || params[:notice] %>
|
||||||
|
@ -54,7 +54,7 @@
|
||||||
</div>
|
</div>
|
||||||
<% if @application_form.application_form_signup_field_sets.count != 0 %>
|
<% if @application_form.application_form_signup_field_sets.count != 0 %>
|
||||||
<% @application_form.application_form_signup_field_sets.each do |signup_field| %>
|
<% @application_form.application_form_signup_field_sets.each do |signup_field| %>
|
||||||
<% if !(signup_field.disabled) && signup_field.field_name != 'recaptcha' %>
|
<% if !(signup_field.disabled) && !(['recaptcha', 'agree'].include?(signup_field.field_name)) %>
|
||||||
<div class="form-group<%= (@application_form.registration_status[0] == 'G' && signup_field.field_name == 'password') ? ' hide' : '' %>" id="<%= signup_field.field_name == 'password' ? 'registration_status' : '' %>">
|
<div class="form-group<%= (@application_form.registration_status[0] == 'G' && signup_field.field_name == 'password') ? ' hide' : '' %>" id="<%= signup_field.field_name == 'password' ? 'registration_status' : '' %>">
|
||||||
<label for="<%= signup_field['name'][I18n.locale] %>" class="col-sm-2 control-label">
|
<label for="<%= signup_field['name'][I18n.locale] %>" class="col-sm-2 control-label">
|
||||||
<% if !(['address','note'].include? signup_field.field_name) %>
|
<% if !(['address','note'].include? signup_field.field_name) %>
|
||||||
|
@ -288,14 +288,23 @@
|
||||||
</div>
|
</div>
|
||||||
</div> -->
|
</div> -->
|
||||||
|
|
||||||
|
<% agree_set = @application_form.application_form_signup_field_sets.select{|v| v.field_name=='agree'}[0]
|
||||||
|
if agree_set.nil?
|
||||||
|
agree_trans = t("application_form_signup.agree")
|
||||||
|
else
|
||||||
|
agree_trans = agree_set.name[I18n.locale.to_s]
|
||||||
|
end
|
||||||
|
%>
|
||||||
|
<% if agree_set.nil? || !agree_set.disabled %>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-sm-offset-2 col-sm-10">
|
<div class="col-sm-offset-2 col-sm-10">
|
||||||
<label>
|
<label>
|
||||||
<input id="agree" name="agree" value="1" type="checkbox" required="required">
|
<input id="agree" name="agree" value="1" type="checkbox" required="required">
|
||||||
<a href="<%= prefix_url %>?method=show_privacy" target="_blank"><%= t("application_form_signup.agree")%></a>
|
<a href="<%= prefix_url %>?method=show_privacy" target="_blank"><%= agree_trans %></a>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-sm-offset-2 col-sm-10">
|
<div class="col-sm-offset-2 col-sm-10">
|
||||||
|
@ -389,7 +398,7 @@
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<% elsif @application_form.application_form_start_date > @time_now %>
|
<% elsif @application_form.application_form_start_date && @application_form.application_form_start_date > @time_now %>
|
||||||
|
|
||||||
<%= t('application_form.sign_up_not_yet') %>
|
<%= t('application_form.sign_up_not_yet') %>
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ en:
|
||||||
abstract_number: Abstract number
|
abstract_number: Abstract number
|
||||||
presentation_type: Presentation
|
presentation_type: Presentation
|
||||||
application_form:
|
application_form:
|
||||||
|
save_success: "Save Successfully!"
|
||||||
mail_exist: "mail exist!"
|
mail_exist: "mail exist!"
|
||||||
select: Select
|
select: Select
|
||||||
go_back: "Go back"
|
go_back: "Go back"
|
||||||
|
|
|
@ -28,6 +28,7 @@ zh_tw:
|
||||||
abstract_number: 摘要編號
|
abstract_number: 摘要編號
|
||||||
presentation_type: 發表方式
|
presentation_type: 發表方式
|
||||||
application_form:
|
application_form:
|
||||||
|
save_success: "儲存成功!"
|
||||||
mail_exist: "mail已存在!"
|
mail_exist: "mail已存在!"
|
||||||
select: 選擇
|
select: 選擇
|
||||||
go_back: "回上一頁"
|
go_back: "回上一頁"
|
||||||
|
|
Loading…
Reference in New Issue