Merge branch 'master' into 'master'

Master

fix error

See merge request !1
This commit is contained in:
wmcheng 2019-11-13 12:19:06 +08:00
commit 6cef729150
14 changed files with 171 additions and 103 deletions

View File

@ -58,11 +58,10 @@ class Admin::SeminarsController < OrbitAdminController
end end
def new def new
@member = nil
@seminar = SeminarMain.new @seminar = SeminarMain.new
@seminar_items = SeminarItem.all @seminar_items = SeminarItem.all
@review = @seminar.seminar_reviews.new()
end end
def create def create
@ -85,9 +84,14 @@ class Admin::SeminarsController < OrbitAdminController
end end
def edit def edit
@seminar_items = SeminarItem.all @seminar_items = SeminarItem.all
attribute = SeminarMain.where(id: params[:id])
if attribute.first.seminar_reviews.first.nil?
@review = attribute.first.seminar_reviews.new()
else
@review = attribute.first.seminar_reviews.first
end
@member = MemberProfile.find(@review.reviewer_id) rescue nil
end end
def update def update
@ -190,5 +194,4 @@ class Admin::SeminarsController < OrbitAdminController
params.require(:seminar_main).permit! params.require(:seminar_main).permit!
end end
end end

View File

@ -1,6 +1,7 @@
class SeminarsController < ApplicationController class SeminarsController < ApplicationController
helper MemberHelper helper MemberHelper
include ActionView::Context #vary important (only add this can access @@session from view)
include Admin::SeminarsHelper include Admin::SeminarsHelper
# include SimpleCaptcha::ControllerHelpers # include SimpleCaptcha::ControllerHelpers
def index def index
@ -36,13 +37,11 @@ class SeminarsController < ApplicationController
time_now = Time.now time_now = Time.now
session = OrbitHelper.get_session
params = OrbitHelper.params params = OrbitHelper.params
seminar = SeminarMain.find_by(uid: params[:uid]) seminar = SeminarMain.find_by(uid: params[:uid])
if !seminar.registration_status.blank? and seminar.signup_start_date <= time_now and ( seminar.signup_end_date.nil? or seminar.signup_end_date+1 >= time_now ) if !seminar.registration_status.blank? && seminar.signup_start_date <= time_now && ( seminar.signup_end_date.nil? || seminar.signup_end_date+1 >= time_now )
sign_up = ('<a href="'+ OrbitHelper.url_to_show(seminar.to_param) + '" target="_blank">' + t('seminar.signup') + '</a>').html_safe sign_up = ('<a href="'+ OrbitHelper.url_to_show(seminar.to_param) + '" target="_blank">' + t('seminar.signup') + '</a>').html_safe
elsif seminar.registration_status.blank? elsif seminar.registration_status.blank?
sign_up = t('seminar.sign_up_not_open') sign_up = t('seminar.sign_up_not_open')
@ -52,9 +51,9 @@ class SeminarsController < ApplicationController
sign_up = t('seminar.sign_up_overdue') sign_up = t('seminar.sign_up_overdue')
end end
if !seminar.registration_status.blank? and seminar.registration_status.include?('C') and seminar.contribute_start_date <= time_now and ( seminar.contribute_end_date.nil? or seminar.contribute_end_date+1 >= time_now ) if !seminar.registration_status.blank? && seminar.registration_status.include?('C') && seminar.contribute_start_date <= time_now && ( seminar.contribute_end_date.nil? || seminar.contribute_end_date+1 >= time_now )
if !session[:seminar_signup_id].blank? if !@@session[:seminar_signup_id].blank?
if session[:seminar_main_id] == seminar.id if @@session[:seminar_main_id] == seminar.id
contribute_action = ('<a href="'+ OrbitHelper.url_to_show(seminar.to_param) + '?method=con_upload">' + t('seminar_signup.uploads') + '</a>').html_safe contribute_action = ('<a href="'+ OrbitHelper.url_to_show(seminar.to_param) + '?method=con_upload">' + t('seminar_signup.uploads') + '</a>').html_safe
else else
contribute_action = ('<a href="'+ OrbitHelper.url_to_show(seminar.to_param) + '?method=con_login">' + t('seminar_signup.con_login') + '</a>').html_safe contribute_action = ('<a href="'+ OrbitHelper.url_to_show(seminar.to_param) + '?method=con_login">' + t('seminar_signup.con_login') + '</a>').html_safe
@ -205,13 +204,11 @@ class SeminarsController < ApplicationController
def add_file def add_file
session = OrbitHelper.get_session if !@@session[:seminar_main_id].blank?
if !session[:seminar_main_id].blank? seminar = SeminarMain.find_by(id: @@session[:seminar_main_id])
seminar = SeminarMain.find_by(id: session[:seminar_main_id]) seminar_signup = SeminarSignup.find_by(_id: @@session[:seminar_signup_id], seminar_main_id: @@session[:seminar_main_id] )
seminar_signup = SeminarSignup.find_by(_id: session[:seminar_signup_id], seminar_main_id: session[:seminar_main_id] )
else else
@ -246,13 +243,11 @@ class SeminarsController < ApplicationController
time_now = Time.now time_now = Time.now
session = OrbitHelper.get_session if !@@session[:seminar_main_id].blank?
if !session[:seminar_main_id].blank? seminar = SeminarMain.find_by(id: @@session[:seminar_main_id])
seminar = SeminarMain.find_by(id: session[:seminar_main_id]) seminar_signup = SeminarSignup.find_by(_id: @@session[:seminar_signup_id], seminar_main_id: @@session[:seminar_main_id] )
seminar_signup = SeminarSignup.find_by(_id: session[:seminar_signup_id], seminar_main_id: session[:seminar_main_id] )
else else

View File

@ -35,13 +35,14 @@ class SeminarMain
has_many :seminar_item_contents, :autosave => true, :dependent => :destroy has_many :seminar_item_contents, :autosave => true, :dependent => :destroy
has_many :seminar_signups, :autosave => true, :dependent => :destroy has_many :seminar_signups, :autosave => true, :dependent => :destroy
has_many :seminar_signup_fields, :autosave => true, :dependent => :destroy has_many :seminar_signup_fields, :autosave => true, :dependent => :destroy
has_many :seminar_reviews, :autosave => true, :dependent => :destroy
accepts_nested_attributes_for :seminar_links, :allow_destroy => true accepts_nested_attributes_for :seminar_links, :allow_destroy => true
accepts_nested_attributes_for :seminar_files, :allow_destroy => true accepts_nested_attributes_for :seminar_files, :allow_destroy => true
accepts_nested_attributes_for :seminar_item_contents, :allow_destroy => true accepts_nested_attributes_for :seminar_item_contents, :allow_destroy => true
accepts_nested_attributes_for :seminar_signups, :allow_destroy => true accepts_nested_attributes_for :seminar_signups, :allow_destroy => true
accepts_nested_attributes_for :seminar_signup_fields, :allow_destroy => true accepts_nested_attributes_for :seminar_signup_fields, :allow_destroy => true
accepts_nested_attributes_for :seminar_reviews, :allow_destroy => true
def self.time_range(date1 = null, date2 = null) def self.time_range(date1 = null, date2 = null)

View File

@ -0,0 +1,12 @@
# encoding: utf-8
require "orbit_form_helper"
class SeminarReview
include Mongoid::Document
include Mongoid::Timestamps
field :review_start_date, :type => Date, :default => Time.now
field :review_end_date, :type => Date, :default => Time.now
field :reviewer_id
belongs_to :seminar_main
end

View File

@ -18,7 +18,8 @@
<div class="nav-name"><strong><%= t(:module) %></strong></div> <div class="nav-name"><strong><%= t(:module) %></strong></div>
<ul class="nav nav-pills module-nav"> <ul class="nav nav-pills module-nav">
<li class="active"><a href="#basic" data-toggle="tab"><%= t(:basic) %></a></li> <li class="active"><a href="#basic" data-toggle="tab"><%= t(:basic) %></a></li>
<li><a href="#signup" data-toggle="tab"><%= t('seminar.signup') %></a></li> <li><a href="#signup" data-toggle="tab"><%= t('seminar.signup') %></a></li>
<li><a href="#review" data-toggle="tab"><%= t('seminar.review') %></a></li>
</ul> </ul>
<!-- Module --> <!-- Module -->
@ -102,12 +103,38 @@
<label class="control-label muted"><%= t('seminar.contribute_file_count') %></label> <label class="control-label muted"><%= t('seminar.contribute_file_count') %></label>
<div class="controls"> <div class="controls">
<%= f.text_field :contribute_file_count %> <%= f.text_field :contribute_file_count %>
(空白無限制) (<%= t('seminar.blank_no_limit') %>)
</div> </div>
</div> </div>
</div> </div>
<!-- Review Module -->
<div class="tab-pane fade in " id="review">
<%= f.fields_for :seminar_reviews,@review do |seminar_reviews_form| %>
<div class="control-group big-group">
<label class="control-label muted"><%= t("seminar.reviewer") %></label>
<div class="controls">
<% if !@member.nil? %>
<%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'seminar_main[seminar_reviews_attributes][0][reviewer_id][]', email_members:@member} %>
<% else %>
<%= render partial: 'admin/member_selects/email_selection_box', locals: {field: 'seminar_main[seminar_reviews_attributes][0][reviewer_id][]', email_members:[]} %>
<% end %>
</div>
</div>
<div class="control-group">
<label class="control-label muted"><%= t('seminar.review_start_date') %></label>
<div class="controls">
<%= seminar_reviews_form.datetime_picker :review_start_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => @seminar.new_record? %>
</div>
</div>
<div class="control-group">
<label class="control-label muted"><%= t('seminar.review_end_date') %></label>
<div class="controls">
<%= seminar_reviews_form.datetime_picker :review_end_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => @seminar.new_record? %>
</div>
</div>
<% end %>
</div>
</div> </div>
<!-- Language Tabs --> <!-- Language Tabs -->

View File

@ -19,6 +19,7 @@
<tr class="sort-header"> <tr class="sort-header">
<th class='span2'><%= t('seminar_signup.name')%></th> <th class='span2'><%= t('seminar_signup.name')%></th>
<th class='span2'><%= t('seminar.registration_status')%></th> <th class='span2'><%= t('seminar.registration_status')%></th>
<th class='span2'><%= t('seminar_signup.file_note')%></th>
<th class='span2'><%= t('seminar_signup.uploads')%></th> <th class='span2'><%= t('seminar_signup.uploads')%></th>
</tr> </tr>
</thead> </thead>
@ -36,15 +37,21 @@
</ul> </ul>
</div> </div>
</td> </td>
<td><%= t("seminar.registration_status_#{seminar_signup.status}") if !seminar_signup.status.blank? %></td> <td><%= t("seminar.registration_status_#{seminar_signup.status}") if !seminar_signup.status.blank? %>
<td>
<ul>
<% seminar_signup.seminar_signup_contributes.collect do |seminar_signup_contribute| %>
<li><%= link_to (seminar_signup_contribute.title.blank? ? File.basename(seminar_signup_contribute.file.path) : seminar_signup_contribute.title) , seminar_signup_contribute.file.url, {:target => '_blank', :title => seminar_signup_contribute.description} if seminar_signup_contribute.file.file
%></li>
<% end %>
</ul>
</td> </td>
<ul>
<td>
<% seminar_signup.seminar_signup_contributes.collect do |seminar_signup_contribute| %>
<li><%= seminar_signup_contribute.description.to_s.html_safe %></li>
<% end %>
</td>
<td>
<% seminar_signup.seminar_signup_contributes.collect do |seminar_signup_contribute| %>
<li><%= link_to (seminar_signup_contribute.title.blank? ? File.basename(seminar_signup_contribute.file.path) : seminar_signup_contribute.title) , seminar_signup_contribute.file.url, {:target => '_blank', :title => Nokogiri::HTML(seminar_signup_contribute.description).text} if seminar_signup_contribute.file.file %>
</li>
<% end %>
</td>
</ul>
</tr> </tr>
<% end %> <% end %>
</tbody> </tbody>

View File

@ -1,4 +1,8 @@
<% # encoding: utf-8 %> <% # encoding: utf-8 %>
<%= stylesheet_link_tag "lib/jquery-ui-1.12.1/jquery-ui.min.css" %>
<%= javascript_include_tag 'basic.js' %>
<% @@session = session %>
<%= yield %>
<% <%
data = action_data data = action_data
@con = data["con"] @con = data["con"]
@ -22,7 +26,7 @@
<div class="form-group"> <div class="form-group">
<label for="note" class="col-sm-2 control-label"><%= t('seminar_signup.file_note') %></label> <label for="note" class="col-sm-2 control-label"><%= t('seminar_signup.file_note') %></label>
<div class="col-sm-10"> <div class="col-sm-10">
<%= f.text_area :description, rows: 5, :class=>"input-medium form-control", :placeholder=> t('seminar_signup.file_note') %> <%= f.text_area :description, rows: 5, :class=>"ckeditor input-medium form-control", :placeholder=> t('seminar_signup.file_note') %>
</div> </div>
</div> </div>

View File

@ -1,4 +1,6 @@
<% # encoding: utf-8 %> <% # encoding: utf-8 %>
<% @@session = session %>
<%= yield %>
<% <%
data = action_data data = action_data
@seminar = data["seminar"] @seminar = data["seminar"]
@ -29,8 +31,8 @@
%> %>
<tr> <tr>
<td><%= seminar_signup_contribute.title %></td> <td><%= seminar_signup_contribute.title %></td>
<td><%= seminar_signup_contribute.description %></td> <td><%= seminar_signup_contribute.description.to_s.html_safe %></td>
<td><%= link_to (seminar_signup_contribute.title.blank? ? File.basename(seminar_signup_contribute.file.path) : seminar_signup_contribute.title) , seminar_signup_contribute.file.url, {:target => '_blank', :title => seminar_signup_contribute.description} if seminar_signup_contribute.file.file %></td> <td><%= link_to File.basename(seminar_signup_contribute.file.path), seminar_signup_contribute.file.url, {:target => '_blank', :title => Nokogiri::HTML(seminar_signup_contribute.description).text} if seminar_signup_contribute.file.file %></td>
<td> <td>
<%= link_to t(:edit), OrbitHelper.url_to_show(@seminar.to_param) + '?method=edit_file&con_no=' + seminar_signup_contribute.id, :class => 'btn btn-primary' %> <%= link_to t(:edit), OrbitHelper.url_to_show(@seminar.to_param) + '?method=edit_file&con_no=' + seminar_signup_contribute.id, :class => 'btn btn-primary' %>
<form method="post" action="<%= del_file_seminars_path %>"> <form method="post" action="<%= del_file_seminars_path %>">

View File

@ -1,4 +1,6 @@
<% # encoding: utf-8 %> <% # encoding: utf-8 %>
<%= stylesheet_link_tag "lib/jquery-ui-1.12.1/jquery-ui.min.css" %>
<%= javascript_include_tag 'basic.js' %>
<% <%
data = action_data data = action_data
@con = data["con"] @con = data["con"]
@ -18,7 +20,7 @@
<div class="form-group"> <div class="form-group">
<label for="note" class="col-sm-2 control-label"><%= t('seminar_signup.file_note') %></label> <label for="note" class="col-sm-2 control-label"><%= t('seminar_signup.file_note') %></label>
<div class="col-sm-10"> <div class="col-sm-10">
<%= f.text_area :description, rows: 5, :class=>"input-medium form-control", :placeholder=> t('seminar_signup.file_note') %> <%= f.text_area :description, rows: 5, :class=>"ckeditor input-medium form-control", :placeholder=> t('seminar_signup.file_note') %>
</div> </div>
</div> </div>

View File

@ -135,7 +135,7 @@
<label for="password" class="col-sm-2 control-label">*<%= t('seminar_signup.password') %></label> <label for="password" class="col-sm-2 control-label">*<%= t('seminar_signup.password') %></label>
<div class="col-sm-10"> <div class="col-sm-10">
<%= f.text_field :password, :class=>"input-medium form-control", :placeholder=> t('seminar_signup.password') %> <%= f.text_field :password, :class=>"input-medium form-control", :placeholder=> t('seminar_signup.password') %>
( 此密碼為下次投稿上傳檔案時必須輸入的密碼。 ) <%= t('seminar_signup.password_message') %>
</div> </div>
</div> </div>

View File

@ -1,5 +1,6 @@
<% # encoding: utf-8 %> <% # encoding: utf-8 %>
<% @@session = session %>
<%= yield %>
<% <%
data = action_data data = action_data
@seminar = data["seminar"] @seminar = data["seminar"]

View File

@ -1,6 +1,6 @@
<% # encoding: utf-8 %> <% # encoding: utf-8 %>
<% <%
data = action_data data = action_data
%> %>
您的報名已成功,感謝您的參與。 <%= t('seminar_signup.success_message') %>

View File

@ -5,82 +5,89 @@ en:
label: "" label: ""
restful_actions: restful_actions:
act_signup: 報名資料 act_signup: Sign Up Info #報名資料
module_name: module_name:
seminar: 研討會 seminar: Seminar #研討會
recaptcha: recaptcha:
errors: errors:
verification_failed: 驗證碼錯誤 verification_failed: Verification Failed #驗證碼錯誤
seminar: seminar:
export_csv: 匯出CSV reviewer: Reviewer #審查委員
recaptcha: 驗證碼 review_end_date: Review End Date #審查結束日期
yes_: review_start_date: Review Start Date #審查開始日期
no_: review: Reveiw #審稿
seminar: 研討會 blank_no_limit: Allow Blank Value #空白無限制
title: 研討會名稱 export_csv: Export CSV #匯出CSV
speaker: 主講者 recaptcha: Recaptcha #驗證碼
content: 內容說明 yes_: Yes #是
act_place: 活動地點 no_: No #否
registration_status: 報名身分 seminar: Seminar #研討會
registration_status_C: 投稿者 title: Conference Name #研討會名稱
registration_status_G: 一般報名 speaker: Speaker #主講者
seminar_start_date: 活動開始時間 content: Content #內容說明
seminar_end_date: 活動結束時間 act_place: Seminar Location #活動地點
signup_start_date: 報名開始時間 registration_status: Attendee Role #報名身分
signup_end_date: 報名結束時間 registration_status_C: Contributor #投稿者
contribute_start_date: 投稿開始時間 registration_status_G: Normal sign up #一般報名
contribute_end_date: 投稿結束時間 seminar_start_date: Seminar Start Date #活動開始時間
event_during: 活動期間 seminar_end_date: Seminar End Date #活動結束時間
contribute_during: 投稿期間 signup_start_date: Sign Up Start Date #報名開始時間
signup_during: 報名期間 signup_end_date: Sign Up End Date #報名結束時間
signup_count: 報名人數 contribute_start_date: Contribute Start Date #投稿開始時間
signup: 報名 contribute_end_date: Contirbute End Date #投稿結束時間
export: 匯出 event_during: Event During #活動期間
set_seminar_items: 項目 contribute_during: Contribute During #投稿期間
set_seminar_signup_field: 圈選設定 signup_during: Sign Up During #報名期間
set_seminar_item_content: 項目設定 signup_count: Sign Up Count #報名人數
set_seminar_agreements: 個資宣告設定 signup: Sign Up #報名
seminar_agreements_content: 個資宣告內容 export: Export #匯出
to_require: 是否必填 set_seminar_items: Items #項目
sign_up_not_yet: 報名時間未開始 set_seminar_signup_field: Set Sign Up Field #圈選設定
sign_up_not_open: 未開放報名 set_seminar_item_content: Set Item Content #項目設定
sign_up_overdue: 報名時間已過 set_seminar_agreements: Personal Data Usage Agreements #個資宣告設定
contribute_file_count: 投稿檔案數 seminar_agreements_content: Content of Personal Data Usage Agreements #個資宣告內容
to_require: Should Be Filled? #是否必填
sign_up_not_yet: Does Not Yet Allow Sign Up #報名時間未開始
sign_up_not_open: Does Not Open Sign Up #未開放報名
sign_up_overdue: Sign Up Overdue #報名時間已過
contribute_file_count: Count of Contribute Files #投稿檔案數
frontend: frontend:
seminar: 研討會前台 seminar: Semianr #研討會前台
seminar_item: seminar_item:
new_item: 新增項目 new_item: New Item #新增項目
edit_item: 編輯項目 edit_item: Edit Item #編輯項目
set_item: 設定項目 set_item: Set Item #設定項目
del_item: 刪除項目 del_item: Delete Item #刪除項目
seminar_item_content: seminar_item_content:
content: 內容 content: Content #內容
seminar_signup: seminar_signup:
signup_time: 報名時間 signup_time: Sign Up Time #報名時間
name: Name name: Name
unit: 單位 unit: Unit #單位
tel: TEL tel: TEL
phone: Mobile telephone phone: Mobile telephone
fax: Fax fax: Fax
address: 地址 address: Address #地址
email: e-mail信箱 email: Email #e-mail信箱
password: 密碼 password: Password #密碼
note: 註解 password_message: '( This password is for uploading file when contributing. )'
time: (開始/結束)時間 note: Note #註解
place: 地點 time: 'Start / End Time' #(開始/結束)時間
place: Place #地點
agree: "Accept Privacy and Personal Information Protection Policy of the Site" agree: "Accept Privacy and Personal Information Protection Policy of the Site"
signup_field: 圈選項目 signup_field: Sign Up Field #圈選項目
uploads: 上傳檔案 uploads: Uploads #上傳檔案
con_login: 投稿者登入 con_login: Contributor Login #投稿者登入
file_name: 稿件名稱 file_name: File Name #稿件名稱
file_note: 摘要 file_note: Summary #摘要
files: 檔案 files: Files #檔案
logout: 登出 logout: Log Out #登出
logouting: 登出中 logouting: Logging Out #登出中
success_message: 'Registration successful, thank you.'

View File

@ -15,6 +15,11 @@ zh_tw:
verification_failed: 驗證碼錯誤 verification_failed: 驗證碼錯誤
seminar: seminar:
reviewer: 審查委員
review_end_date: 審查結束日期
review_start_date: 審查開始日期
review: 審稿
blank_no_limit: 空白無限制
export_csv: 匯出CSV export_csv: 匯出CSV
recaptcha: 驗證碼 recaptcha: 驗證碼
yes_: yes_:
@ -72,6 +77,7 @@ zh_tw:
address: 地址 address: 地址
email: e-mail信箱 email: e-mail信箱
password: 密碼 password: 密碼
password_message: '( 此密碼為下次投稿上傳檔案時必須輸入的密碼。 )'
note: 註解 note: 註解
time: (開始/結束)時間 time: (開始/結束)時間
place: 地點 place: 地點
@ -85,3 +91,4 @@ zh_tw:
files: 檔案 files: 檔案
logout: 登出 logout: 登出
logouting: 登出中 logouting: 登出中
success_message: '您的報名已成功,感謝您的參與。'