Merge branch 'master' into 'master'

Fix bug. Add participant_list page.

See merge request spen/seminar!31
This commit is contained in:
chiu 2021-11-30 02:00:00 +00:00
commit 261bafa815
14 changed files with 93 additions and 25 deletions

View File

@ -8,7 +8,7 @@ body{
.layout-footer-content, .layout-footer-inner,.layout-footer-content, .footer-counter{
color: #727272;
}
.layout-footer-inner a: hover{
.layout-footer-inner a:hover{
color: #000000;
}
.layout-content{

View File

@ -11,7 +11,7 @@ body{
.layout-footer-content, .layout-footer-inner,.layout-footer-content, .footer-counter{
color: #727272;
}
.layout-footer-inner a: hover{
.layout-footer-inner a:hover{
color: #000000;
}
.layout-content{

View File

@ -11,7 +11,7 @@ body{
.layout-footer-content, .layout-footer-inner,.layout-footer-content, .footer-counter{
color: #96a1ca;
}
.layout-footer-inner a: hover{
.layout-footer-inner a:hover{
color: #ffffff;
}
.layout-content{

View File

@ -8,7 +8,7 @@ body{
.layout-footer-content, .layout-footer-inner,.layout-footer-content, .footer-counter{
color: #606060;
}
.layout-footer-inner a: hover{
.layout-footer-inner a:hover{
color: #000000;
}
.layout-content{

View File

@ -7,7 +7,7 @@ body{
.layout-footer-content, .layout-footer-inner,.layout-footer-content, .footer-counter{
color: #606060;
}
.layout-footer-inner a: hover{
.layout-footer-inner a:hover{
color: #000000;
}
.layout-content{

View File

@ -16,7 +16,7 @@ body{
.layout-footer-content, .layout-footer-inner,.layout-footer-content, .footer-counter{
color: #6f6f70;
}
.layout-footer-inner a: hover{
.layout-footer-inner a:hover{
color: #000000;
}
.layout-content{

View File

@ -81,11 +81,7 @@ class Admin::SeminarsController < OrbitAdminController
else
@seminar_page_root.update(:name_translations=>@seminar.title_translations,:module=>"seminars_home",:url=>"/home",:page_id=>"home",:enabled_for=>available_locales,:bind_uid=>@seminar.uid,:bind_module_app=>"seminar",:bind_model=>"SeminarMain",:menu_enabled_for=>available_locales)
end
pages_info = {"introduction" => "seminars_page",
"news" => "custom_announcement",
"registration" => "seminar_registration",
"submission" => "seminar_submission",
"album" => "custom_gallery"}
pages_info = SeminarTemplateSetting::PagesInfo
relation_model = {"news" => "CustomBulletin","album"=>"CustomAlbum"}
pages_info.each do |page_id , page_module|
seminar_page = @seminar_page_root.child_page.where(:page_id=>page_id).first

View File

@ -75,6 +75,7 @@ class SeminarsController < ApplicationController
@seminar = seminar
@site_in_use_locales = Site.first.in_use_locales rescue I18n.available_locales
seminar_template_setting = seminar.seminar_template_setting
@seminar_template_setting = seminar_template_setting
home_page = Page.where(:parent_page_id=>seminar.id).first
prefix_url = OrbitHelper.request.path.split("-").first + "-#{params[:uid]}"
@prefix_url = prefix_url
@ -200,12 +201,8 @@ class SeminarsController < ApplicationController
main_content = render_to_string("seminars/show_data",:locals=>{:action_data=>data,
:request=>OrbitHelper.request,:flash=>OrbitHelper.request.flash,
:params=>params,:session=>OrbitHelper.request.session},:layout=>false)
elsif params[:current_page_module] == "seminar_registration"
main_content = render_seminar_registration
elsif params[:current_page_module] == "seminar_submission"
main_content = render_seminar_submission
else
main_content = nil
main_content = render_other_method("render_"+params[:current_page_module]) rescue nil
end
custom_datapp_data = {}
if custom_banner
@ -236,8 +233,19 @@ class SeminarsController < ApplicationController
:request=>OrbitHelper.request,:flash=>OrbitHelper.request.flash,
:params=>params,:session=>OrbitHelper.request.session},:layout=>false)
end
def render_seminar_registered_participants
action_data = {"seminar"=>@seminar, "seminar_template_setting"=>@seminar_template_setting}
@_request = OrbitHelper.request
action_data["prefix_url"] = @prefix_url
render_to_string("seminars/registered_participants",:locals=>{:action_data=>action_data,
:request=>OrbitHelper.request,:flash=>OrbitHelper.request.flash,
:params=>params,:session=>OrbitHelper.request.session},:layout=>false)
end
def render_other_method(render_method=nil,render_template=nil)
params = OrbitHelper.params
if render_method && render_template.nil?
return eval(render_method)
end
render_method = render_method || params[:method]
render_template = render_template || render_method
params = OrbitHelper.params

View File

@ -1,7 +1,13 @@
class SeminarTemplateSetting
include Mongoid::Document
include Mongoid::Timestamps
DefaultMenu = ["introduction","news","registration","submission","album"]
DefaultMenu = ["introduction","news","registration","registered_participants","submission","album"]
PagesInfo = {"introduction" => "seminars_page",
"news" => "custom_announcement",
"registration" => "seminar_registration",
"registered_participants" => "seminar_registered_participants",
"submission" => "seminar_submission",
"album" => "custom_gallery"}
belongs_to :seminar_main
field :enable_custom_template, type: Boolean, default: false
field :display_menu, type: Array, default: ["introduction","news","registration","submission","album"]
@ -56,16 +62,23 @@ class SeminarTemplateSetting
display_menu = self.display_menu
available_locales = Site.first.in_use_locales rescue I18n.available_locales
available_locales = available_locales.map{|l| l.to_s}
pages_info = self.class::PagesInfo
if @seminar_page_root
default_display_menu = self.class::DefaultMenu
default_display_menu.each do |page_id|
page = @seminar_page_root.child_page.where(:page_id=>page_id).first
if page
if display_menu.include?(page_id)
page.update(:enabled_for=>available_locales,:menu_enabled_for=>available_locales)
else
page.update(:enabled_for=>[],:menu_enabled_for=>[])
end
if display_menu.include?(page_id)
page.update(:enabled_for=>available_locales,:menu_enabled_for=>available_locales)
else
page.update(:enabled_for=>[],:menu_enabled_for=>[])
end
else
page_module = pages_info[page_id]
seminar_page = @seminar_page_root.child_page.where(:page_id=>page_id).first
page_trans = available_locales.map{|l| [l,I18n.with_locale(l){I18n.t("seminar.menu.#{page_id}")}]}.to_h
available_locales_tmp = available_locales.clone
@seminar_page_root.child_page.create(:name_translations=>page_trans,:page_id=>page_id,:url=>"/home/#{page_id}",:enabled_for=>available_locales_tmp,:module=>page_module,:menu_enabled_for=>available_locales_tmp)
end
end
end

View File

@ -11,6 +11,7 @@
<% if @seminar.present? %>
<% if @seminar.seminar_signup_field_sets.count != 0 %>
<% @seminar.seminar_signup_field_sets.each do |field_set| %>
<% next if field_set.field_name == "password" %>
<% default_hidden << "seminar_signup_field_set.#{field_set.field_name}" if (field_set.hidden) %>
<% @field_names << "seminar_signup_field_set.#{field_set.field_name}" %>
<% @field_name_translations << field_set.name[I18n.locale] %>
@ -91,6 +92,7 @@
<% seminar_signup_field_sets = SeminarSignupFieldSet.all.uniq{|s| s.field_name} %>
<% if seminar_signup_field_sets.count != 0 %>
<% seminar_signup_field_sets.each do |field_set| %>
<% next if field_set.field_name == "password" %>
<% default_show << "seminar_signup_field_set.#{field_set.field_name}" if !(field_set.hidden) %>
<% @field_names << "seminar_signup_field_set.#{field_set.field_name}" %>
<% @field_name_translations << field_set.name[I18n.locale] %>
@ -137,6 +139,7 @@
<% @field_name_translations << s.title %>
<% end %>
<% @display_field = @seminar_signup_admin_setting.display_field %>
<% @display_field.delete("seminar_signup_field_set.password") %>
<% if @display_field.blank?
@display_field = default_show
end %>

View File

@ -76,7 +76,7 @@
</span>
<div class="col-sm-10">
<label style="float: left;border-color: #666666" class="btn">
<%= f.file_field :file, :required => f.object.new_record?, :style=>"position: absolute;width: 0.00000001em;" %>
<%= f.file_field :file, :required => f.object.new_record?, :style=>"position: absolute;width: 0.00000001em;border: 0;margin: 0;padding: 0;" %>
<%= t('seminar_signup.load_file') %>
</label>
<div class="filename" style="float: left;margin-left: 0.3em; "><%= f.object["file"] if f.object.file.present? %></div>

View File

@ -0,0 +1,44 @@
<%
data = action_data
seminar = data["seminar"]
seminar_template_setting = data["seminar_template_setting"]
display_unit = (!seminar.seminar_signup_field_sets.select{|v| v.field_name=='unit'}[0].disabled rescue false)
%>
<style type="text/css">
#seminar_participants th {
vertical-align: top;
color: #fff;
text-align: left;
background: #f17655;
}
#seminar_participants tr:nth-child(2n) {
background: #f8f9e6;
}
</style>
<h3><%= I18n.t("seminar.participant_list") %></h3>
<table cellspacing="0" class="table" width="100%" id="seminar_participants">
<thead>
<tr>
<th><%= I18n.t("seminar_signup.name") %></th>
<% if display_unit %>
<th><%= I18n.t("seminar_signup.unit") %></th>
<% end %>
</tr>
</thead>
<tbody>
<% if display_unit %>
<% seminar.seminar_signups.each do |ss| %>
<tr>
<td><%= ss.name %></td>
<td><%= ss.unit %></td>
</tr>
<% end %>
<% else %>
<% seminar.seminar_signups.each do |ss| %>
<tr>
<td><%= ss.name %></td>
</tr>
<% end %>
<% end %>
</tbody>
</table>

View File

@ -27,6 +27,7 @@ en:
abstract_number: Abstract number
presentation_type: Presentation
seminar:
participant_list: Participant list
back: Back
please_login_first: "Please login first!"
out_of_date: Out of date
@ -47,6 +48,7 @@ en:
introduction: Introduction
news: News
registration: Registration
registered_participants: Registered Participants
submission: Submission
album: Album
introduction: Introduction
@ -173,7 +175,7 @@ en:
file: Files
signup_time: Sign Up Time #報名時間
name: Name
unit: Unit #單位
unit: Institute #單位
tel: Tel
phone: Mobile telephone
fax: Fax

View File

@ -28,6 +28,7 @@ zh_tw:
abstract_number: 摘要編號
presentation_type: 發表方式
seminar:
participant_list: 參加者名單
back: 回上一頁
please_login_first: "請先登入!"
out_of_date: 已截止
@ -48,6 +49,7 @@ zh_tw:
introduction: 介紹
news: 公告
registration: 註冊
registered_participants: 註冊參與者
submission: 投稿
album: 相簿
introduction: 介紹
@ -144,7 +146,7 @@ zh_tw:
export: 匯出
set_seminar_items: 項目
set_seminar_submission_field: 上傳介面欄位設定
set_seminar_signup_field: 圈選設定
set_seminar_signup_field: 報名欄位設定
set_seminar_item_content: 項目設定
set_seminar_agreements: 個資宣告設定
seminar_agreements_content: 個資宣告內容