From d880c019c04aed0c3d363b5b361dfdc6fd4e8710 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Wed, 9 Aug 2017 15:21:39 +0800 Subject: [PATCH] xlsx fixed for new fields --- app/views/actives/show.html.erb | 28 +++++------ app/views/admin/actives/_form.html.erb | 61 ++++++++++++----------- app/views/admin/actives/export.xlsx.axlsx | 58 +++++++++++++-------- config/locales/en.yml | 1 + config/locales/zh_tw.yml | 1 + 5 files changed, 85 insertions(+), 64 deletions(-) diff --git a/app/views/actives/show.html.erb b/app/views/actives/show.html.erb index 29ef690..5df9ee3 100644 --- a/app/views/actives/show.html.erb +++ b/app/views/actives/show.html.erb @@ -154,20 +154,6 @@ <% end %> - - - <% if @act.enabled_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 %> -
-
- <% end %> <% if @act.enabled_organization %> @@ -257,6 +243,20 @@ <% end %> + + + <% if @act.enabled_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 %> +
+
+ <% end %>
diff --git a/app/views/admin/actives/_form.html.erb b/app/views/admin/actives/_form.html.erb index f23272c..4e3d76e 100644 --- a/app/views/admin/actives/_form.html.erb +++ b/app/views/admin/actives/_form.html.erb @@ -86,7 +86,7 @@
- +
@@ -102,7 +102,7 @@
> - +
@@ -118,7 +118,7 @@
> - +
@@ -134,7 +134,7 @@
> - +
@@ -150,7 +150,7 @@
> - +
@@ -166,7 +166,7 @@
> - +
@@ -182,7 +182,7 @@
> - +
@@ -199,28 +199,13 @@
> - +
- -
- -
- -
-
> - - - -
-
- +
@@ -231,7 +216,7 @@
> - +
@@ -247,7 +232,7 @@
> - +
@@ -263,7 +248,7 @@
> - +
@@ -279,7 +264,7 @@
> - +
@@ -295,7 +280,7 @@
> - +
@@ -311,11 +296,27 @@
> - +
+ + +
+ +
+ +
+
> + + + +
+
diff --git a/app/views/admin/actives/export.xlsx.axlsx b/app/views/admin/actives/export.xlsx.axlsx index f73c99a..07da836 100644 --- a/app/views/admin/actives/export.xlsx.axlsx +++ b/app/views/admin/actives/export.xlsx.axlsx @@ -4,23 +4,37 @@ wb = xlsx_package.workbook wb.add_worksheet(name: @act.title) do |sheet| - row = [t('act_signup.name')] + row = [] - row << t('act_signup.idno') if !@act.has_idno.blank? + row << t('act_signup.name') if !@act.enabled_name.blank? - row << t('act_signup.sex') + row << t('act_signup.idno') if !@act.enabled_idno.blank? - row << t('act_signup.birthday') + row << t('act_signup.sex') if !@act.enabled_sex.blank? - row << t('act_signup.tel') + row << t('act_signup.birthday') if !@act.enabled_birthday.blank? - row << t('act_signup.phone') + row << t('act_signup.tel') if !@act.enabled_tel.blank? - row << t('act_signup.fax') + row << t('act_signup.phone') if !@act.enabled_phone.blank? - row << t(:email) + row << t('act_signup.fax') if !@act.enabled_fax.blank? - row << t('act.note') + row << t(:email) if !@act.enabled_email.blank? + + row << t("act_signup.organization") if !@act.enabled_organization.blank? + + row << t("act_signup.title") if !@act.enabled_title.blank? + + row << t("act_signup.address") if !@act.enabled_address.blank? + + row << t("act_signup.emergency_contact_number") if !@act.enabled_emergency_contact_number.blank? + + row << t("act_signup.emergency_contact_person") if !@act.enabled_emergency_contact_person.blank? + + row << t("act_signup.vegetarian") if !@act.enabled_vegetarian.blank? + + row << t('act.note') if !@act.enabled_note.blank? sheet.add_row row @@ -28,17 +42,21 @@ wb.add_worksheet(name: @act.title) do |sheet| row2 = [] - @birtbday = !signup[:birthday].blank? ? signup[:birthday].to_date.to_s : ' ' - - row2 << "#{signup[:name]} " - row2 << "#{signup[:idno]} " if !@act.has_idno.blank? - row2 << "#{signup[:sex]} " - row2 << "#{@birtbday} " - row2 << "#{signup[:tel]} " - row2 << "#{signup[:phone]} " - row2 << "#{signup[:fax]} " - row2 << "#{signup[:email]} " - row2 << "#{signup[:note]} " + row2 << signup.name if !@act.enabled_name.blank? + row2 << signup.idno if !@act.enabled_idno.blank? + row2 << signup.sex if !@act.enabled_sex.blank? + row2 << (signup.birthday.strftime("%Y-%m-%d") rescue "") if !@act.enabled_birthday.blank? + row2 << signup.tel if !@act.enabled_tel.blank? + row2 << signup.phone if !@act.enabled_phone.blank? + row2 << signup.fax if !@act.enabled_fax.blank? + row2 << signup.email if !@act.enabled_email.blank? + row2 << signup.note if !@act.enabled_note.blank? + row2 << signup.organization if !@act.enabled_organization.blank? + row2 << signup.title if !@act.enabled_title.blank? + row2 << signup.address if !@act.enabled_address.blank? + row2 << signup.emergency_contact_number if !@act.enabled_emergency_contact_number.blank? + row2 << signup.emergency_contact_person if !@act.enabled_emergency_contact_person.blank? + row2 << signup.vegetarian if !@act.enabled_vegetarian.blank? sheet.add_row row2 end diff --git a/config/locales/en.yml b/config/locales/en.yml index bb9b2d5..1c9be07 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -50,6 +50,7 @@ en: has_fax: Fax has_email: Email has_note: Note + required: Required default_widget: title: Title diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index 5d5addd..c343011 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -50,6 +50,7 @@ zh_tw: has_fax: 傳真 has_email: 電子郵件 has_note: 備註 + required: 必填 default_widget: title: 活動標題