diff --git a/app/controllers/admin/seminars_controller.rb b/app/controllers/admin/seminars_controller.rb index 800e67a..d95ad02 100644 --- a/app/controllers/admin/seminars_controller.rb +++ b/app/controllers/admin/seminars_controller.rb @@ -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 diff --git a/app/controllers/seminars_controller.rb b/app/controllers/seminars_controller.rb index d513de4..baf931f 100644 --- a/app/controllers/seminars_controller.rb +++ b/app/controllers/seminars_controller.rb @@ -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 = ('' + t('seminar.signup') + '').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 = ('' + t('seminar_signup.uploads') + '').html_safe else contribute_action = ('' + t('seminar_signup.con_login') + '').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 diff --git a/app/models/seminar_main.rb b/app/models/seminar_main.rb index 7b284ad..c9badcc 100644 --- a/app/models/seminar_main.rb +++ b/app/models/seminar_main.rb @@ -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) diff --git a/app/models/seminar_review.rb b/app/models/seminar_review.rb new file mode 100644 index 0000000..8ed7aee --- /dev/null +++ b/app/models/seminar_review.rb @@ -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 diff --git a/app/views/admin/seminars/_form.html.erb b/app/views/admin/seminars/_form.html.erb index f6e9605..e6c94fd 100644 --- a/app/views/admin/seminars/_form.html.erb +++ b/app/views/admin/seminars/_form.html.erb @@ -18,7 +18,8 @@ @@ -102,12 +103,38 @@
<%= f.text_field :contribute_file_count %> - (空白無限制) + (<%= t('seminar.blank_no_limit') %>)
- + +
+ <%= f.fields_for :seminar_reviews,@review do |seminar_reviews_form| %> +
+ +
+ <% 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 %> +
+
+
+ +
+ <%= seminar_reviews_form.datetime_picker :review_start_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => @seminar.new_record? %> +
+
+
+ +
+ <%= seminar_reviews_form.datetime_picker :review_end_date, :no_label => true, :format=>"yyyy/MM/dd", :new_record => @seminar.new_record? %> +
+
+ <% end %> +
diff --git a/app/views/admin/seminars/seminar_signup.html.erb b/app/views/admin/seminars/seminar_signup.html.erb index 4a3b18b..a1a0963 100644 --- a/app/views/admin/seminars/seminar_signup.html.erb +++ b/app/views/admin/seminars/seminar_signup.html.erb @@ -19,6 +19,7 @@ <%= t('seminar_signup.name')%> <%= t('seminar.registration_status')%> + <%= t('seminar_signup.file_note')%> <%= t('seminar_signup.uploads')%> @@ -36,15 +37,21 @@ - <%= t("seminar.registration_status_#{seminar_signup.status}") if !seminar_signup.status.blank? %> - - + <%= t("seminar.registration_status_#{seminar_signup.status}") if !seminar_signup.status.blank? %> + <% end %> diff --git a/app/views/seminars/add_file.html.erb b/app/views/seminars/add_file.html.erb index a916fd6..0fadf5f 100644 --- a/app/views/seminars/add_file.html.erb +++ b/app/views/seminars/add_file.html.erb @@ -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 @@
- <%= 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') %>
diff --git a/app/views/seminars/con_upload.html.erb b/app/views/seminars/con_upload.html.erb index 6144d9e..8c65512 100644 --- a/app/views/seminars/con_upload.html.erb +++ b/app/views/seminars/con_upload.html.erb @@ -1,4 +1,6 @@ <% # encoding: utf-8 %> +<% @@session = session %> +<%= yield %> <% data = action_data @seminar = data["seminar"] @@ -29,8 +31,8 @@ %> <%= seminar_signup_contribute.title %> - <%= seminar_signup_contribute.description %> - <%= 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 %> + <%= seminar_signup_contribute.description.to_s.html_safe %> + <%= 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 %> <%= link_to t(:edit), OrbitHelper.url_to_show(@seminar.to_param) + '?method=edit_file&con_no=' + seminar_signup_contribute.id, :class => 'btn btn-primary' %>
diff --git a/app/views/seminars/edit_file.html.erb b/app/views/seminars/edit_file.html.erb index 80074c7..0c3870e 100644 --- a/app/views/seminars/edit_file.html.erb +++ b/app/views/seminars/edit_file.html.erb @@ -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 @@
- <%= 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') %>
diff --git a/app/views/seminars/show.html.erb b/app/views/seminars/show.html.erb index b567742..767e2f7 100644 --- a/app/views/seminars/show.html.erb +++ b/app/views/seminars/show.html.erb @@ -135,7 +135,7 @@
<%= f.text_field :password, :class=>"input-medium form-control", :placeholder=> t('seminar_signup.password') %> - ( 此密碼為下次投稿上傳檔案時必須輸入的密碼。 ) + <%= t('seminar_signup.password_message') %>
diff --git a/app/views/seminars/show_data.html.erb b/app/views/seminars/show_data.html.erb index d0a0183..182799a 100644 --- a/app/views/seminars/show_data.html.erb +++ b/app/views/seminars/show_data.html.erb @@ -1,5 +1,6 @@ <% # encoding: utf-8 %> - +<% @@session = session %> +<%= yield %> <% data = action_data @seminar = data["seminar"] diff --git a/app/views/seminars/signup_ok.html.erb b/app/views/seminars/signup_ok.html.erb index 11ea5a4..3a1d454 100644 --- a/app/views/seminars/signup_ok.html.erb +++ b/app/views/seminars/signup_ok.html.erb @@ -1,6 +1,6 @@ <% # encoding: utf-8 %> -<% - data = action_data +<% + data = action_data %> -您的報名已成功,感謝您的參與。 \ No newline at end of file +<%= t('seminar_signup.success_message') %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 010de05..3a63fa3 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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.' diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index dcc1eac..a222052 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -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: '您的報名已成功,感謝您的參與。'