Added excel sheet to housing page

This commit is contained in:
Godwin
2016-08-15 20:19:03 -07:00
parent 2c976d40a4
commit 9356aa2d31
8 changed files with 202 additions and 112 deletions
@@ -5,3 +5,6 @@
= form_tag administration_update_path(@this_conference.slug, :housing), class: 'guest-dlg', id: 'guest-list-table' do
%h3 Select a Guest
#table
.actions
= link_to (_'links.download.Excel'), administration_step_path(@this_conference.slug, :housing, :format => :xlsx), class: [:button, :download]
+5 -5
View File
@@ -4,15 +4,15 @@
= data_set(:h4, 'articles.admin.stats.headings.incomplete_registrations') do
= ((@registration_count - @completed_registrations) || 0).to_s
= data_set(:h4, 'articles.admin.stats.headings.bikes') do
= (@completed_registrations || 0) > 0 ? "#{@bikes} (#{(@bikes / @completed_registrations.to_f).round(4) * 100.0}%)" : "0"
= (@completed_registrations || 0) > 0 ? "#{@bikes} (#{number_to_percentage(@bikes / @completed_registrations.to_f * 100.0)})" : "0"
= data_set(:h4, 'articles.admin.stats.headings.food.meat') do
= (@food[:all] || 0) > 0 ? "#{@food[:meat]} (#{(@food[:meat] / @food[:all].to_f).round(4) * 100.0}%)" : "0"
= (@food[:all] || 0) > 0 ? "#{@food[:meat]} (#{number_to_percentage(@food[:meat] / @food[:all].to_f * 100.0)})" : "0"
= data_set(:h4, 'articles.admin.stats.headings.food.vegetarian') do
= (@food[:all] || 0) > 0 ? "#{@food[:vegetarian]} (#{(@food[:vegetarian] / @food[:all].to_f).round(4) * 100.0}%)" : "0"
= (@food[:all] || 0) > 0 ? "#{@food[:vegetarian]} (#{number_to_percentage(@food[:vegetarian] / @food[:all].to_f * 100.0)})" : "0"
= data_set(:h4, 'articles.admin.stats.headings.food.vegan') do
= (@food[:all] || 0) > 0 ? "#{@food[:vegan]} (#{(@food[:vegan] / @food[:all].to_f).round(4) * 100.0}%)" : "0"
= (@food[:all] || 0) > 0 ? "#{@food[:vegan]} (#{number_to_percentage(@food[:vegan] / @food[:all].to_f * 100.0)})" : "0"
= data_set(:h4, 'articles.admin.stats.headings.donation_count') do
= (@completed_registrations || 0) > 0 ? "#{@donation_count} (#{(@donation_count / @completed_registrations.to_f).round(4) * 100.0}%)" : "0"
= (@completed_registrations || 0) > 0 ? "#{@donation_count} (#{number_to_percentage(@donation_count / @completed_registrations.to_f * 100.0)})" : "0"
= data_set(:h4, 'articles.admin.stats.headings.donation_total') do
= "$#{@donations || 0.00}"
.actions
+1 -21
View File
@@ -1,21 +1 @@
- key = @excel_data[:key] || 'excel.columns'
%table
%thead
%tr
- @excel_data[:columns].each do |column|
%th=_(@excel_data[:keys][column].present? ? @excel_data[:keys][column] : "#{key}.#{column.to_s}")
%tbody
- @excel_data[:data].each do |row|
%tr
- @excel_data[:columns].each do |column|
%td{class: (@excel_data[:column_types].present? && @excel_data[:column_types][column].present?) ? @excel_data[:column_types][column] : nil}=(row[column].present? ? (_!row[column]) : '')
- format_xls 'table' do
- workbook use_autowidth: true
- format bg_color: '333333'
- format 'td', font_name: 'Calibri', fg_color: '333333'
- format 'th', font_name: 'Calibri', b: true, bg_color: '333333', fg_color: 'ffffff'
- format 'td.datetime', num_fmt: 22, font_name: 'Courier New', sz: 10, fg_color: '333333'
- format 'td.date.day', num_fmt: 14, font_name: 'Courier New', sz: 10, fg_color: '333333'
- format 'td.money', num_fmt: 2, font_name: 'Courier New', sz: 10, fg_color: '333333'
- format 'td.bold', font_name: 'Calibri', fg_color: '333333', b: true
= excel_table(@excel_data)