xlsx fixed for new fields

This commit is contained in:
Harry Bomrah 2017-08-09 15:21:39 +08:00
parent b07152d872
commit d880c019c0
5 changed files with 85 additions and 64 deletions

View File

@ -154,20 +154,6 @@
</div>
</div>
<% end %>
<!-- Note -->
<% if @act.enabled_note %>
<div class="form-group">
<label for="note" class="col-sm-2 control-label"><%= @act.has_note ? "*" : "" %><%= t('act_signup.note') %></label>
<div class="col-sm-10">
<% 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 %>
</div>
</div>
<% end %>
<!-- Organization -->
<% if @act.enabled_organization %>
@ -257,6 +243,20 @@
</div>
</div>
<% end %>
<!-- Note -->
<% if @act.enabled_note %>
<div class="form-group">
<label for="note" class="col-sm-2 control-label"><%= @act.has_note ? "*" : "" %><%= t('act_signup.note') %></label>
<div class="col-sm-10">
<% 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 %>
</div>
</div>
<% end %>
<!-- 驗證碼 -->
<div class="form-group">

View File

@ -86,7 +86,7 @@
</label>
</div>
<div class="controls required">
<label class="radio inline">Required</label>
<label class="radio inline"><%= t("act.required") %></label>
<label class="radio inline"><%= f.radio_button :has_name, "yes", checked: @act.has_name == true ? true : false %><%= t(:yes_) %></label>
<label class="radio inline"><%= f.radio_button :has_name, "no", checked: @act.has_name == false ? true : false %><%= t(:no_) %></label>
</div>
@ -102,7 +102,7 @@
</label>
</div>
<div class="controls required" <%= !@act.enabled_tel ? "style=display:none;" : "" %>>
<label class="radio inline">Required</label>
<label class="radio inline"><%= t("act.required") %></label>
<label class="radio inline"><%= f.radio_button :has_tel, "yes", checked: @act.has_tel == true ? true : false %><%= t(:yes_) %></label>
<label class="radio inline"><%= f.radio_button :has_tel, "no", checked: @act.has_tel == false ? true : false %><%= t(:no_) %></label>
</div>
@ -118,7 +118,7 @@
</label>
</div>
<div class="controls required" <%= !@act.enabled_phone ? "style=display:none;" : "" %>>
<label class="radio inline">Required</label>
<label class="radio inline"><%= t("act.required") %></label>
<label class="radio inline"><%= f.radio_button :has_phone, "yes", checked: @act.has_phone == true ? true : false %><%= t(:yes_) %></label>
<label class="radio inline"><%= f.radio_button :has_phone, "no", checked: @act.has_phone == false ? true : false %><%= t(:no_) %></label>
</div>
@ -134,7 +134,7 @@
</label>
</div>
<div class="controls required" <%= !@act.enabled_fax ? "style=display:none;" : "" %>>
<label class="radio inline">Required</label>
<label class="radio inline"><%= t("act.required") %></label>
<label class="radio inline"><%= f.radio_button :has_fax, "yes", checked: @act.has_fax == true ? true : false %><%= t(:yes_) %></label>
<label class="radio inline"><%= f.radio_button :has_fax, "no", checked: @act.has_fax == false ? true : false %><%= t(:no_) %></label>
</div>
@ -150,7 +150,7 @@
</label>
</div>
<div class="controls required" <%= !@act.enabled_email ? "style=display:none;" : "" %>>
<label class="radio inline">Required</label>
<label class="radio inline"><%= t("act.required") %></label>
<label class="radio inline"><%= f.radio_button :has_email, "yes", checked: @act.has_email == true ? true : false %><%= t(:yes_) %></label>
<label class="radio inline"><%= f.radio_button :has_email, "no", checked: @act.has_email == false ? true : false %><%= t(:no_) %></label>
</div>
@ -166,7 +166,7 @@
</label>
</div>
<div class="controls required" <%= !@act.enabled_idno ? "style=display:none;" : "" %>>
<label class="radio inline">Required</label>
<label class="radio inline"><%= t("act.required") %></label>
<label class="radio inline"><%= f.radio_button :has_idno, "yes", checked: @act.has_idno == true ? true : false %><%= t(:yes_) %></label>
<label class="radio inline"><%= f.radio_button :has_idno, "no", checked: @act.has_idno == false ? true : false %><%= t(:no_) %></label>
</div>
@ -182,7 +182,7 @@
</label>
</div>
<div class="controls required" <%= !@act.enabled_sex ? "style=display:none;" : "" %>>
<label class="radio inline">Required</label>
<label class="radio inline"><%= t("act.required") %></label>
<label class="radio inline"><%= f.radio_button :has_sex, "yes", checked: @act.has_sex == true ? true : false %><%= t(:yes_) %></label>
<label class="radio inline"><%= f.radio_button :has_sex, "no", checked: @act.has_sex == false ? true : false %><%= t(:no_) %></label>
</div>
@ -199,28 +199,13 @@
</label>
</div>
<div class="controls required" <%= !@act.enabled_birthday ? "style=display:none;" : "" %>>
<label class="radio inline">Required</label>
<label class="radio inline"><%= t("act.required") %></label>
<label class="radio inline"><%= f.radio_button :has_birthday, "yes", checked: @act.has_birthday == true ? true : false %><%= t(:yes_) %></label>
<label class="radio inline"><%= f.radio_button :has_birthday, "no", checked: @act.has_birthday == false ? true : false %><%= t(:no_) %></label>
</div>
</div>
<!-- Note -->
<div class="control-group">
<label class="control-label muted"><%= t('act.has_note') %></label>
<div class="controls">
<label for="act_enabled_note" class="checkbox inline">
<%= f.check_box :enabled_note, :class => "enabler" %>
Enable
</label>
</div>
<div class="controls required" <%= !@act.enabled_note ? "style=display:none;" : "" %>>
<label class="radio inline">Required</label>
<label class="radio inline"><%= f.radio_button :has_note, "yes", checked: @act.has_note == true ? true : false %><%= t(:yes_) %></label>
<label class="radio inline"><%= f.radio_button :has_note, "no", checked: @act.has_note == false ? true : false %><%= t(:no_) %></label>
</div>
</div>
<!-- Organization -->
<div class="control-group">
<label class="control-label muted"><%= t('act.has_organization') %></label>
@ -231,7 +216,7 @@
</label>
</div>
<div class="controls required" <%= !@act.enabled_organization ? "style=display:none;" : "" %>>
<label class="radio inline">Required</label>
<label class="radio inline"><%= t("act.required") %></label>
<label class="radio inline"><%= f.radio_button :has_organization, "yes", checked: @act.has_organization == true ? true : false %><%= t(:yes_) %></label>
<label class="radio inline"><%= f.radio_button :has_organization, "no", checked: @act.has_organization == false ? true : false %><%= t(:no_) %></label>
</div>
@ -247,7 +232,7 @@
</label>
</div>
<div class="controls required" <%= !@act.enabled_title ? "style=display:none;" : "" %>>
<label class="radio inline">Required</label>
<label class="radio inline"><%= t("act.required") %></label>
<label class="radio inline"><%= f.radio_button :has_title, "yes", checked: @act.has_title == true ? true : false %><%= t(:yes_) %></label>
<label class="radio inline"><%= f.radio_button :has_title, "no", checked: @act.has_title == false ? true : false %><%= t(:no_) %></label>
</div>
@ -263,7 +248,7 @@
</label>
</div>
<div class="controls required" <%= !@act.enabled_address ? "style=display:none;" : "" %>>
<label class="radio inline">Required</label>
<label class="radio inline"><%= t("act.required") %></label>
<label class="radio inline"><%= f.radio_button :has_address, "yes", checked: @act.has_address == true ? true : false %><%= t(:yes_) %></label>
<label class="radio inline"><%= f.radio_button :has_address, "no", checked: @act.has_address == false ? true : false %><%= t(:no_) %></label>
</div>
@ -279,7 +264,7 @@
</label>
</div>
<div class="controls required" <%= !@act.enabled_emergency_contact_number ? "style=display:none;" : "" %>>
<label class="radio inline">Required</label>
<label class="radio inline"><%= t("act.required") %></label>
<label class="radio inline"><%= f.radio_button :has_emergency_contact_number, "yes", checked: @act.has_emergency_contact_number == true ? true : false %><%= t(:yes_) %></label>
<label class="radio inline"><%= f.radio_button :has_emergency_contact_number, "no", checked: @act.has_emergency_contact_number == false ? true : false %><%= t(:no_) %></label>
</div>
@ -295,7 +280,7 @@
</label>
</div>
<div class="controls required" <%= !@act.enabled_emergency_contact_person ? "style=display:none;" : "" %>>
<label class="radio inline">Required</label>
<label class="radio inline"><%= t("act.required") %></label>
<label class="radio inline"><%= f.radio_button :has_emergency_contact_person, "yes", checked: @act.has_emergency_contact_person == true ? true : false %><%= t(:yes_) %></label>
<label class="radio inline"><%= f.radio_button :has_emergency_contact_person, "no", checked: @act.has_emergency_contact_person == false ? true : false %><%= t(:no_) %></label>
</div>
@ -311,11 +296,27 @@
</label>
</div>
<div class="controls required" <%= !@act.enabled_vegetarian ? "style=display:none;" : "" %>>
<label class="radio inline">Required</label>
<label class="radio inline"><%= t("act.required") %></label>
<label class="radio inline"><%= f.radio_button :has_vegetarian, "yes", checked: @act.has_vegetarian == true ? true : false %><%= t(:yes_) %></label>
<label class="radio inline"><%= f.radio_button :has_vegetarian, "no", checked: @act.has_vegetarian == false ? true : false %><%= t(:no_) %></label>
</div>
</div>
<!-- Note -->
<div class="control-group">
<label class="control-label muted"><%= t('act.has_note') %></label>
<div class="controls">
<label for="act_enabled_note" class="checkbox inline">
<%= f.check_box :enabled_note, :class => "enabler" %>
Enable
</label>
</div>
<div class="controls required" <%= !@act.enabled_note ? "style=display:none;" : "" %>>
<label class="radio inline"><%= t("act.required") %></label>
<label class="radio inline"><%= f.radio_button :has_note, "yes", checked: @act.has_note == true ? true : false %><%= t(:yes_) %></label>
<label class="radio inline"><%= f.radio_button :has_note, "no", checked: @act.has_note == false ? true : false %><%= t(:no_) %></label>
</div>
</div>
</div>
</div>

View File

@ -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

View File

@ -50,6 +50,7 @@ en:
has_fax: Fax
has_email: Email
has_note: Note
required: Required
default_widget:
title: Title

View File

@ -50,6 +50,7 @@ zh_tw:
has_fax: 傳真
has_email: 電子郵件
has_note: 備註
required: 必填
default_widget:
title: 活動標題