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
def new
@member = nil
@seminar = SeminarMain.new
@seminar_items = SeminarItem.all
@review = @seminar.seminar_reviews.new()
end
def create
@ -85,9 +84,14 @@ class Admin::SeminarsController < OrbitAdminController
end
def edit
@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
def update
@ -190,5 +194,4 @@ class Admin::SeminarsController < OrbitAdminController
params.require(:seminar_main).permit!
end
end

View File

@ -1,6 +1,7 @@
class SeminarsController < ApplicationController
helper MemberHelper
include ActionView::Context #vary important (only add this can access @@session from view)
include Admin::SeminarsHelper
# include SimpleCaptcha::ControllerHelpers
def index
@ -36,13 +37,11 @@ class SeminarsController < ApplicationController
time_now = Time.now
session = OrbitHelper.get_session
params = OrbitHelper.params
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
elsif seminar.registration_status.blank?
sign_up = t('seminar.sign_up_not_open')
@ -52,9 +51,9 @@ class SeminarsController < ApplicationController
sign_up = t('seminar.sign_up_overdue')
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 !session[:seminar_signup_id].blank?
if session[:seminar_main_id] == seminar.id
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_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
else
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
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
@ -246,13 +243,11 @@ class SeminarsController < ApplicationController
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

View File

@ -35,13 +35,14 @@ class SeminarMain
has_many :seminar_item_contents, :autosave => true, :dependent => :destroy
has_many :seminar_signups, :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_files, :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_signup_fields, :allow_destroy => true
accepts_nested_attributes_for :seminar_reviews, :allow_destroy => true
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>
<ul class="nav nav-pills module-nav">
<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>
<!-- Module -->
@ -102,12 +103,38 @@
<label class="control-label muted"><%= t('seminar.contribute_file_count') %></label>
<div class="controls">
<%= f.text_field :contribute_file_count %>
(空白無限制)
(<%= t('seminar.blank_no_limit') %>)
</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>
<!-- Language Tabs -->

View File

@ -19,6 +19,7 @@
<tr class="sort-header">
<th class='span2'><%= t('seminar_signup.name')%></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>
</tr>
</thead>
@ -36,15 +37,21 @@
</ul>
</div>
</td>
<td><%= t("seminar.registration_status_#{seminar_signup.status}") if !seminar_signup.status.blank? %></td>
<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><%= t("seminar.registration_status_#{seminar_signup.status}") if !seminar_signup.status.blank? %>
</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>
<% end %>
</tbody>

View File

@ -1,4 +1,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
@con = data["con"]
@ -22,7 +26,7 @@
<div class="form-group">
<label for="note" class="col-sm-2 control-label"><%= t('seminar_signup.file_note') %></label>
<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>

View File

@ -1,4 +1,6 @@
<% # encoding: utf-8 %>
<% @@session = session %>
<%= yield %>
<%
data = action_data
@seminar = data["seminar"]
@ -29,8 +31,8 @@
%>
<tr>
<td><%= seminar_signup_contribute.title %></td>
<td><%= seminar_signup_contribute.description %></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><%= seminar_signup_contribute.description.to_s.html_safe %></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>
<%= 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 %>">

View File

@ -1,4 +1,6 @@
<% # encoding: utf-8 %>
<%= stylesheet_link_tag "lib/jquery-ui-1.12.1/jquery-ui.min.css" %>
<%= javascript_include_tag 'basic.js' %>
<%
data = action_data
@con = data["con"]
@ -18,7 +20,7 @@
<div class="form-group">
<label for="note" class="col-sm-2 control-label"><%= t('seminar_signup.file_note') %></label>
<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>

View File

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

View File

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

View File

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

View File

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

View File

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