diff --git a/app/controllers/actives_controller.rb b/app/controllers/actives_controller.rb index a6995cf..63e9705 100644 --- a/app/controllers/actives_controller.rb +++ b/app/controllers/actives_controller.rb @@ -94,7 +94,6 @@ class ActivesController < ApplicationController end def show - params = OrbitHelper.params module_app = ModuleApp.where(:key => "active").first diff --git a/app/models/act.rb b/app/models/act.rb index 0c85ca2..e169120 100644 --- a/app/models/act.rb +++ b/app/models/act.rb @@ -18,9 +18,25 @@ class Act field :sign_start_date , :type => DateTime, :default => Time.now field :sign_end_date , :type => DateTime, :default => Time.now field :sign_up, :type => Boolean, :default => false - field :has_idno, :type => Boolean, :default => false field :note, localize: true + field :has_name, :type => Boolean, :default => true + field :has_tel, :type => Boolean, :default => true + field :has_phone, :type => Boolean, :default => true + field :has_fax, :type => Boolean, :default => true + field :has_email, :type => Boolean, :default => true + + field :has_idno, :type => Boolean, :default => false + field :has_sex, :type => Boolean, :default => false + field :has_birthday, :type => Boolean, :default => false + field :has_note, :type => Boolean, :default => false + field :has_organization, :type => Boolean, :default => false + field :has_title, :type => Boolean, :default => false + field :has_address, :type => Boolean, :default => false + field :has_emergency_contact_number, :type => Boolean, :default => false + field :has_emergency_contact_person, :type => Boolean, :default => false + field :has_vegetarian, :type => Boolean, :default => false + has_many :act_links, :autosave => true, :dependent => :destroy has_many :act_files, :autosave => true, :dependent => :destroy has_many :act_signups, :autosave => true, :dependent => :destroy diff --git a/app/models/act_signup.rb b/app/models/act_signup.rb index 856faef..62ec19b 100644 --- a/app/models/act_signup.rb +++ b/app/models/act_signup.rb @@ -14,6 +14,13 @@ class ActSignup field :fax, type: String field :email, type: String field :note + field :organization + field :title + field :address + field :emergency_contact_number + field :emergency_contact_person + field :vegetarian, type: Boolean + belongs_to :act diff --git a/app/views/actives/show.html.erb b/app/views/actives/show.html.erb index f8420d2..fee3055 100644 --- a/app/views/actives/show.html.erb +++ b/app/views/actives/show.html.erb @@ -14,7 +14,13 @@ <%= javascript_include_tag "lib/bootstrap-datetimepicker" %> <%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %> <%= javascript_include_tag "lib/module-area" %> + <%= javascript_include_tag "validator" %> + <% flash.each do |key, msg| %> <%= content_tag :p, msg, :class => [key, "alert alert-error in fade"] %> @@ -33,82 +39,192 @@
- +
- <%= f.text_field :name, :class=>"input-medium form-control", :id=>'name', :placeholder=> t('act_signup.name'), :required => true %> + <% if @act.has_name %> + <%= f.text_field :name, :class=>"input-medium form-control", :id=>'name', :placeholder=> t('act_signup.name'), :data => {"fv-validation" => "required;", "fv-messages" => "Cannot be empty.;"} %> + <% else %> + <%= f.text_field :name, :class=>"input-medium form-control", :id=>'name', :placeholder=> t('act_signup.name') %> + <% end %>
- - <% if @act.has_idno %>
- +
- <%= f.text_field :idno, :class=>"input-medium form-control", :placeholder=> t('act_signup.idno'), :required => true %> + <% if @act.has_idno %> + <%= f.text_field :idno, :class=>"input-medium form-control", :placeholder=> t('act_signup.idno'), :data => {"fv-validation" => "required;", "fv-messages" => "Cannot be empty.;"} %> + <% else %> + <%= f.text_field :idno, :class=>"input-medium form-control", :placeholder=> t('act_signup.idno') %> + <% end %>
- <% end %>
- +
+ <% if @act.has_birthday %> + <%= f.datetime_picker :birthday, :no_label => true, :format=>"yyyy/MM/dd", :data => {"fv-validation" => "required;", "fv-messages" => "Cannot be empty.;"} %> + <% else %> <%= f.datetime_picker :birthday, :no_label => true, :format=>"yyyy/MM/dd" %> + <% end %>
- +
- +
- <%= f.text_field :tel, :class=>"input-medium form-control", :placeholder=> t('act_signup.tel'), :required => true %> + <% if @act.has_tel %> + <%= f.text_field :tel, :class=>"input-medium form-control", :placeholder=> t('act_signup.tel'), :data => {"fv-validation" => "required;", "fv-messages" => "Cannot be empty.;"} %> + <% else %> + <%= f.text_field :tel, :class=>"input-medium form-control", :placeholder=> t('act_signup.tel') %> + <% end %>
- +
+ <% if @act.has_phone %> + <%= f.text_field :phone, :class=>"input-medium form-control", :placeholder=> t('act_signup.phone'), :data => {"fv-validation" => "required;", "fv-messages" => "Cannot be empty.;"} %> + <% else %> <%= f.text_field :phone, :class=>"input-medium form-control", :placeholder=> t('act_signup.phone') %> + <% end %>
- +
+ <% if @act.has_fax %> + <%= f.text_field :fax, :class=>"input-medium form-control", :placeholder=> t('act_signup.fax'), :data => {"fv-validation" => "required;", "fv-messages" => "Cannot be empty.;"} %> + <% else %> <%= f.text_field :fax, :class=>"input-medium form-control", :placeholder=> t('act_signup.fax') %> + <% end %>
- +
- <%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> t(:email), :required => true %> + <% if @act.has_email %> + <%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> t(:email), :data => {"fv-validation" => "required;", "fv-messages" => "Cannot be empty.;"} %> + <% else %> + <%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> t(:email) %> + <% end %>
- +
- <%= f.text_area :note, rows: 5, :class=>"input-medium form-control", :placeholder=> t('act.note') %> + <% if @act.has_note %> + <%= f.text_area :note, rows: 5, :class=>"input-medium form-control", :placeholder=> t('act_signup.note'), :data => {"fv-validation" => "required;", "fv-messages" => "Cannot be empty.;"} %> + <% else %> + <%= f.text_area :note, rows: 5, :class=>"input-medium form-control", :placeholder=> t('act_signup.note') %> + <% end %> +
+
+ + +
+ +
+ <% if @act.has_fax %> + <%= f.text_field :organization, :class=>"input-medium form-control", :placeholder=> t('act_signup.organization'), :data => {"fv-validation" => "required;", "fv-messages" => "Cannot be empty.;"} %> + <% else %> + <%= f.text_field :organization, :class=>"input-medium form-control", :placeholder=> t('act_signup.organization') %> + <% end %> +
+
+ + +
+ +
+ <% if @act.has_fax %> + <%= f.text_field :title, :class=>"input-medium form-control", :placeholder=> t('act_signup.title'), :data => {"fv-validation" => "required;", "fv-messages" => "Cannot be empty.;"} %> + <% else %> + <%= f.text_field :title, :class=>"input-medium form-control", :placeholder=> t('act_signup.title') %> + <% end %> +
+
+ + +
+ +
+ <% if @act.has_address %> + <%= f.text_area :address, rows: 5, :class=>"input-medium form-control", :placeholder=> t('act_signup.address'), :data => {"fv-validation" => "required;", "fv-messages" => "Cannot be empty.;"} %> + <% else %> + <%= f.text_area :address, rows: 5, :class=>"input-medium form-control", :placeholder=> t('act_signup.address') %> + <% end %> +
+
+ + +
+ +
+ <% if @act.has_fax %> + <%= f.text_field :emergency_contact_person, :class=>"input-medium form-control", :placeholder=> t('act_signup.emergency_contact_person'), :data => {"fv-validation" => "required;", "fv-messages" => "Cannot be empty.;"} %> + <% else %> + <%= f.text_field :emergency_contact_person, :class=>"input-medium form-control", :placeholder=> t('act_signup.emergency_contact_person') %> + <% end %> +
+
+ + +
+ +
+ <% if @act.has_fax %> + <%= f.text_field :emergency_contact_number, :class=>"input-medium form-control", :placeholder=> t('act_signup.emergency_contact_number'), :data => {"fv-validation" => "required;", "fv-messages" => "Cannot be empty.;"} %> + <% else %> + <%= f.text_field :emergency_contact_number, :class=>"input-medium form-control", :placeholder=> t('act_signup.emergency_contact_number') %> + <% end %> +
+
+ + +
+ +
+ +
@@ -124,7 +240,7 @@
@@ -144,22 +260,9 @@ <% elsif @act.sign_up.blank? %> diff --git a/app/views/admin/actives/_form.html.erb b/app/views/admin/actives/_form.html.erb index 476f743..a903a12 100644 --- a/app/views/admin/actives/_form.html.erb +++ b/app/views/admin/actives/_form.html.erb @@ -19,6 +19,7 @@ @@ -39,14 +40,14 @@
- <%= f.datetime_picker :act_start_date, :no_label => true %> + <%= f.datetime_picker :act_start_date, :no_label => true, :new_record => @act.new_record? %>
- <%= f.datetime_picker :act_end_date, :no_label => true %> + <%= f.datetime_picker :act_end_date, :no_label => true, :new_record => @act.new_record? %>
@@ -54,14 +55,14 @@
- <%= f.datetime_picker :sign_start_date, :no_label => true %> + <%= f.datetime_picker :sign_start_date, :no_label => true, :new_record => @act.new_record? %>
- <%= f.datetime_picker :sign_end_date, :no_label => true %> + <%= f.datetime_picker :sign_end_date, :no_label => true, :new_record => @act.new_record? %>
@@ -73,8 +74,54 @@
+ +
+ +
+ +
+ + +
+
- + +
+ +
+ + +
+
+ + +
+ +
+ + +
+
+ + +
+ +
+ + +
+
+ + +
+ +
+ + +
+
+ +
@@ -83,8 +130,88 @@
-
+ +
+ +
+ + +
+
+ + +
+ +
+ + +
+
+ + +
+ +
+ + +
+
+ + +
+ +
+ + +
+
+ + +
+ +
+ + +
+
+ + +
+ +
+ + +
+
+ + +
+ +
+ + +
+
+ + +
+ +
+ + +
+
+ + +
+ +
+ + +
+
+ diff --git a/config/locales/en.yml b/config/locales/en.yml index a1c3854..bb9b2d5 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -24,7 +24,6 @@ en: sign_start_date: Sign up start date sign_end_date: Sign up end date is_sign_up: Enable online registration - has_idno: ID number required set_active_agreements: Policy Content Setting active_agreements: Policy Content active_agreements_content: Content of Privacy and Personal Information Protection Policy @@ -35,6 +34,22 @@ en: sign_up_not_yet: Not Yet Started sign_up_not_open: Not Open sign_up_overdue: Overdue + settings: Activity Settings + has_idno: ID number required + has_birthday: Birthday + has_sex: Gender + has_organization: Organization + has_title: Title + has_address: Address + has_emergency_contact_person: Emergency Contact Person + has_emergency_contact_number: Emergency Contact Number + has_vegetarian: Vegetarian + has_name: Name + has_tel: Telephone + has_phone: Mobile Number + has_fax: Fax + has_email: Email + has_note: Note default_widget: title: Title @@ -51,4 +66,11 @@ en: tel: TEL phone: Mobile telephone fax: Fax - agree: "Accept Privacy and Personal Information Protection Policy of the Site" \ No newline at end of file + agree: "Accept Privacy and Personal Information Protection Policy of the Site" + organization: Organization + title: Title + address: Address + emergency_contact_person: Emergency Contact Person + emergency_contact_number: Emergency Contact Number + vegetarian: Vegetarian + note: Note \ No newline at end of file diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index 3943d86..5d5addd 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -24,7 +24,6 @@ zh_tw: sign_start_date: 報名開始日期 sign_end_date: 報名結束日期 is_sign_up: 是否線上報名 - has_idno: 報名是否需填寫身分證字號 set_active_agreements: 設定個資宣告 active_agreements: 個資宣告 active_agreements_content: 個資同意書內容 @@ -35,6 +34,22 @@ zh_tw: sign_up_not_yet: 報名時間未開始 sign_up_not_open: 未開放報名 sign_up_overdue: 報名時間已過 + settings: Activity Settings + has_idno: 報名是否需填寫身分證字號 + has_birthday: 出生年月日 + has_sex: 性別 + has_organization: 單位 + has_title: 職稱 + has_address: 地址 + has_emergency_contact_person: 緊急聯絡人 + has_emergency_contact_number: 緊急聯絡人電話 + has_vegetarian: 素食 + has_name: 姓名 + has_tel: 聯絡電話 + has_phone: 行動電話 + has_fax: 傳真 + has_email: 電子郵件 + has_note: 備註 default_widget: title: 活動標題 @@ -52,4 +67,11 @@ zh_tw: phone: 行動電話 fax: 傳真 agree: 同意接受本站個資及隱私權保護宣告 - recaptcha: 驗證碼 \ No newline at end of file + recaptcha: 驗證碼 + organization: 單位 + title: 職稱 + address: 地址 + emergency_contact_person: 緊急聯絡人 + emergency_contact_number: 緊急聯絡人電話 + vegetarian: 素食 + note: 備註 \ No newline at end of file