new changes for forms and various other things
This commit is contained in:
parent
7b6aba492b
commit
64a8077e5b
|
@ -687,6 +687,18 @@ class Admin::SeminarsController < OrbitAdminController
|
|||
redirect_to "/admin/seminars/#{params[:id]}/edit"
|
||||
end
|
||||
|
||||
def seminar_signup_success
|
||||
@seminar = SeminarMain.find(params[:id])
|
||||
end
|
||||
|
||||
def seminar_signup_success_save
|
||||
@seminar = SeminarMain.find(params[:id])
|
||||
params.require(:seminar_main).permit!
|
||||
@seminar.update_attributes(params[:seminar_main])
|
||||
@seminar.save
|
||||
redirect_to admin_seminars_path
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_seminar
|
||||
|
|
|
@ -486,19 +486,21 @@ class SeminarsController < ApplicationController
|
|||
@seminar.save
|
||||
end
|
||||
extra_text = "<br>#{I18n.t('seminar_signup.serial_number')}: #{@seminar_signup.display_serial_number}"
|
||||
extra_text += render_to_string("seminars/signup_email_contents",:locals=>{:seminar=>@seminar,
|
||||
:seminar_signup=>@seminar_signup},:layout=>false)
|
||||
# extra_text += render_to_string("seminars/signup_email_contents",:locals=>{:seminar=>@seminar, :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)
|
||||
send_mail('signup',params[:seminar_signup][:email],params[:seminar_signup][:seminar_main_id],extra_text)
|
||||
else
|
||||
status_param = ''
|
||||
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('signup',params[:seminar_signup][:email],params[:seminar_signup][:seminar_main_id],extra_text)
|
||||
end
|
||||
redirect_to "#{params[:referer_url].to_s.chomp('/').gsub(/\/([^\/?#]+)(|[^\/]+)$/){|f| '/'+$1}}?method=signup_ok#{status_param}&serial_number=#{@seminar_signup.display_serial_number}"
|
||||
redirect_to "#{params[:referer_url].to_s.chomp('/').gsub(/\/([^\/?#]+)(|[^\/]+)$/){|f| '/'+$1}}?method=signup_ok#{status_param}&serial_number=#{@seminar_signup.display_serial_number}&seminar=#{@seminar.uid}"
|
||||
else
|
||||
if has_counter
|
||||
OrbitHelper::SharedMutex.synchronize do
|
||||
|
@ -520,7 +522,11 @@ class SeminarsController < ApplicationController
|
|||
|
||||
def signup_ok
|
||||
params = OrbitHelper.params
|
||||
{"serial_number"=> params[:serial_number]}
|
||||
msg = SeminarMain.where(:uid => params[:seminar]).first.signup_success
|
||||
{
|
||||
"serial_number"=> params[:serial_number],
|
||||
"message" => msg
|
||||
}
|
||||
end
|
||||
|
||||
def add_file_proc
|
||||
|
@ -813,7 +819,7 @@ class SeminarsController < ApplicationController
|
|||
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>"
|
||||
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.click_here_to_confirm")}</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
|
||||
|
@ -836,7 +842,7 @@ class SeminarsController < ApplicationController
|
|||
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>"
|
||||
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.click_here_to_confirm")}</a>"
|
||||
end
|
||||
send_mail(params[:type], seminar_signup.email, @seminar.id.to_s, extra_text)
|
||||
end
|
||||
|
|
|
@ -18,6 +18,7 @@ class SeminarMain
|
|||
field :title, as: :slug_title, type: String, localize: true
|
||||
field :speaker, localize: true
|
||||
field :content, localize: true
|
||||
field :signup_success, localize: true
|
||||
field :act_place, localize: true
|
||||
field :enable_summary_choice, :type => Boolean, :default => false
|
||||
field :summary_chioice_type, :type => String, :default => "checkbox"
|
||||
|
@ -34,7 +35,7 @@ class SeminarMain
|
|||
|
||||
field :contribute_start_date, :type => Date
|
||||
field :contribute_end_date, :type => Date
|
||||
|
||||
|
||||
field :contribute_file_count, type: String
|
||||
|
||||
field :registration_status , :type => Array #C: 投稿者 G:一般
|
||||
|
@ -311,7 +312,7 @@ class SeminarMain
|
|||
r = "#{date1.strftime('%Y-%m-%d')}"
|
||||
|
||||
if date2
|
||||
r += " - #{date2.strftime('%Y-%m-%d')}"
|
||||
r += " - #{date2.strftime('%Y-%m-%d')}"
|
||||
else
|
||||
r += " - #{I18n.t(:no_deadline)}"
|
||||
end
|
||||
|
@ -401,7 +402,7 @@ class SeminarMain
|
|||
def get_attribute_values(attribute_type=nil)
|
||||
@attribute_values = attribute_type.seminar_signup_values rescue nil
|
||||
end
|
||||
|
||||
|
||||
def get_value_from_field_id(field_id,attribute_type=nil)
|
||||
values = get_attribute_values(attribute_type)
|
||||
value = values.detect {|value| value.seminar_signup_field_id == field_id} rescue nil
|
||||
|
@ -436,7 +437,7 @@ class SeminarMain
|
|||
seminar_signup = need_change_seminar_signups[i]
|
||||
if seminar_signup.seminar_session_ids.present?
|
||||
seminar_signup.seminar_session_ids = seminar_signup.seminar_session_ids.map{|id| @records_all["seminar_session_ids"][id]} rescue []
|
||||
end
|
||||
end
|
||||
end
|
||||
count_array = (0...self.seminar_reviews.to_a.count).to_a
|
||||
change_fields = [:seminar_signup_ids, :remove_seminar_signup_ids, :default_seminar_signup_ids]
|
||||
|
@ -515,7 +516,7 @@ class SeminarMain
|
|||
tmp_relations_fields << k
|
||||
else
|
||||
org_k = k.to_s
|
||||
result = other_has_many_class.map do |k|
|
||||
result = other_has_many_class.map do |k|
|
||||
belongs_to_class = k.classify.constantize.relations.select{|kk,v| v.macro == :belongs_to}.keys
|
||||
has_many_class = k.classify.constantize.relations.select{|kk,v| v.macro.to_s.start_with?('has') }.keys
|
||||
if (belongs_to_class - tmp_singularize_relations_fields - [org_k]).count == 0
|
||||
|
@ -693,4 +694,4 @@ class SeminarMain
|
|||
def enable_review_result
|
||||
self.assign_mode == 2
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -201,7 +201,7 @@
|
|||
|
||||
<div class="control-group">
|
||||
|
||||
<%= rf.block_helper(@seminar,@form_index,false,"seminar_signup",@seminar_signup, rf.to_require) %>
|
||||
<%= rf.block_helper(@seminar,@form_index,false,"seminar_signup",@seminar_signup, rf.markup == "file_field" ? false : rf.to_require) %>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
<li><a href="<%= admin_seminar_item_contents_path(:seminar_main_id=>seminar.id.to_s) %>"><%= t('seminar.set_seminar_item_content') %></a></li>
|
||||
<li><a href="/admin/seminars/<%=seminar.id.to_s%>/seminar_signup_field"><%= t('seminar.set_seminar_signup_field') %></a></li>
|
||||
<li><a href="/admin/seminars/<%=seminar.id.to_s%>/seminar_submission_field"><%= t('seminar.set_seminar_submission_field') %></a></li>
|
||||
<li><a href="/admin/seminars/<%=seminar.id.to_s%>/seminar_signup_success"><%= t('seminar.seminar_signup_success') %></a></li>
|
||||
<li><a href="<%=reviewer_setting_admin_seminar_path(seminar.id)%>"><%= t('seminar.reviewer_setting') %></a></li>
|
||||
<li><a href="<%=template_setting_admin_seminar_path(seminar.id)%>"><%= t('seminar.template_setting') %></a></li>
|
||||
<li><a href="<%=sub_page_setting_admin_seminar_path(seminar.id)%>"><%= t('seminar.sub_page_setting') %></a></li>
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
<% content_for :page_specific_css do %>
|
||||
<%= stylesheet_link_tag "lib/main-forms" %>
|
||||
<%= stylesheet_link_tag "lib/main-list" %>
|
||||
<% end %>
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<%= javascript_include_tag "lib/module-area" %>
|
||||
<% end %>
|
||||
|
||||
<h2><%= t('seminar.seminar') %></h2>
|
||||
|
||||
<%= form_for @seminar, url: "/admin/seminars/#{@seminar.id.to_s}/seminar_signup_success_save", html: {class: "form-horizontal main-forms"} do |f| %>
|
||||
<fieldset>
|
||||
|
||||
<!-- Input Area -->
|
||||
<div class="input-area">
|
||||
|
||||
<!-- Language Tabs -->
|
||||
<div class="nav-name"><strong><%= t(:language) %></strong></div>
|
||||
<ul class="nav nav-pills language-nav">
|
||||
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
||||
<li class="<%= 'active' if i == 0 %>">
|
||||
<a data-toggle="tab" href=".<%= locale %>"><%= t(locale) %></a>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
<!-- Language -->
|
||||
<div class="tab-content language-area">
|
||||
|
||||
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
||||
|
||||
<div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
|
||||
|
||||
<div class="control-group input-content">
|
||||
<label class="control-label muted"><%= t('seminar.seminar_signup_success') %></label>
|
||||
<div class="controls">
|
||||
<div class="textarea">
|
||||
<%= f.fields_for :signup_success_translations do |f| %>
|
||||
<%= f.cktext_area locale, rows: 5, class: "input-block-level", :value => (@seminar.signup_success_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Form Actions -->
|
||||
<div class="form-actions">
|
||||
<%= get_referer_url[:action] rescue "" %>
|
||||
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
||||
<input type="hidden" name="referer_url" value="<%= get_referer_url %>">
|
||||
<%= link_to t('cancel'), admin_seminars_path, :class=>"btn" %>
|
||||
</div>
|
||||
|
||||
</fieldset>
|
||||
|
||||
<% end %>
|
|
@ -1,9 +1,9 @@
|
|||
<% email_set = SeminarMain.where(id:@data['seminar_id']).first.seminar_email_sets.select{|v| v.field_name == 'signup'} %>
|
||||
<%= (@data['extra_text'] rescue "").to_s.html_safe %>
|
||||
<% if email_set.length != 0 %>
|
||||
<% if !(email_set[0].content.nil?) %>
|
||||
<%= email_set[0].content[@data['locale']].html_safe %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= t('seminar.email_signup_content') %>
|
||||
<% end %>
|
||||
<%= (@data['extra_text'] rescue "").to_s.html_safe %>
|
||||
<% end %>
|
|
@ -9,13 +9,13 @@
|
|||
<% if (data['confirm'] == true) %>
|
||||
<%= t('seminar_signup.confirm_ok') %>
|
||||
<br>
|
||||
<a href="<%= url %>?method=con_login" class="btn btn-primary" style="display:inline;">
|
||||
<a href="<%= url %>?method=con_login" class="btn btn-primary">
|
||||
<%= 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;">
|
||||
<a href="<%= url %>?method=show_data" class="btn btn-primary">
|
||||
<%= t('seminar.back') %>
|
||||
</a>
|
||||
<% end %>
|
||||
|
|
|
@ -340,7 +340,11 @@ alert("1ssss2");
|
|||
|
||||
|
||||
})
|
||||
|
||||
$(".upload").on("change",function(){
|
||||
let filenamedom = $(this).parent().parent().find(".filename");
|
||||
let filenameA = $(this).val().split('\\');
|
||||
filenamedom.text(filenameA[filenameA.length - 1]);
|
||||
})
|
||||
|
||||
})();
|
||||
</script>
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
end
|
||||
%>
|
||||
|
||||
<%= t('seminar_signup.success_message') %>
|
||||
<%#= t('seminar_signup.success_message') %>
|
||||
<%= data["message"].html_safe %>
|
||||
<br>
|
||||
<%=t('seminar_signup.serial_number') %>: <%=data["serial_number"] rescue ""%>
|
||||
<% if !params['status'].nil? %>
|
||||
|
|
|
@ -113,7 +113,7 @@ en:
|
|||
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
|
||||
click_here_to_confirm: Please click this link / 請點選此連結
|
||||
confirm_ok: Email confirmed
|
||||
confirm_not_ok: Email cannot be confirmed
|
||||
validator: Validator
|
||||
|
@ -172,6 +172,7 @@ en:
|
|||
sign_up_is_full: "Sign up is FULL!"
|
||||
sign_up_failed: "Sign up failed!"
|
||||
contribute_file_count: Count of Contribute Files #投稿檔案數
|
||||
seminar_signup_success: Signup Success Message
|
||||
|
||||
frontend:
|
||||
seminar: Semianr #研討會前台
|
||||
|
|
|
@ -110,7 +110,7 @@ zh_tw:
|
|||
email_special_reminder_content: 特殊通知
|
||||
email_special_reminder_success: 特殊通知
|
||||
is_confirmation: 認證Email
|
||||
click_here_to_confirm: 點選此確認連結
|
||||
click_here_to_confirm: Please click this link / 請點選此連結
|
||||
confirm_ok: Email已認證
|
||||
confirm_not_ok: Email未認證
|
||||
select_email_type: 選擇Email種類
|
||||
|
@ -173,6 +173,7 @@ zh_tw:
|
|||
sign_up_is_full: "報名已額滿!"
|
||||
sign_up_failed: "報名失敗"
|
||||
contribute_file_count: 投稿檔案數
|
||||
seminar_signup_success: Signup Success Message
|
||||
|
||||
frontend:
|
||||
seminar: 研討會前台
|
||||
|
|
|
@ -64,6 +64,8 @@ Rails.application.routes.draw do
|
|||
get 'seminar_signup'
|
||||
get 'seminar_item_content'
|
||||
get 'seminar_signup_field'
|
||||
get 'seminar_signup_success'
|
||||
patch 'seminar_signup_success_save'
|
||||
get 'seminar_submission_field'
|
||||
get 'seminar_signup_admin_setting'
|
||||
post 'update_seminar_signup_admin_setting'
|
||||
|
|
Loading…
Reference in New Issue