xlsx export for registrations list
This commit is contained in:
parent
b9cd54a256
commit
9af4393928
6 changed files with 47 additions and 13 deletions
|
|
@ -3,14 +3,14 @@
|
|||
.pull-right{:style=>"margin-top:20px; margin-bottom:20px;"}
|
||||
= link_to "New", admin_users_new_path(@conference.short_title), :class => "btn btn-primary"
|
||||
= link_to "Export PDF", admin_conference_registrations_path(@conference.short_title, :format => :pdf), :class => "btn btn-success"
|
||||
= link_to "Export xlsx", {:format => :xlsx}, :class => "btn btn-success"
|
||||
.row-fluid
|
||||
.span12
|
||||
%h2
|
||||
Registrations
|
||||
- if @registrations
|
||||
= "(#{@registrations.length})"
|
||||
- if @attended
|
||||
= " - Attended (#{@attended.length})"
|
||||
= " - Attended (#{@attended})"
|
||||
%table.table.table-striped.table-bordered.table-hover#registrations
|
||||
%thead
|
||||
%th
|
||||
|
|
@ -49,4 +49,4 @@
|
|||
"bPaginate": false,
|
||||
"bLengthChange": false
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
|
|
|
|||
25
app/views/admin/registrations/show.xlsx.axlsx
Normal file
25
app/views/admin/registrations/show.xlsx.axlsx
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
wb = xlsx_package.workbook
|
||||
wb.add_worksheet(:name => "registrations") do |sheet|
|
||||
bold_style = wb.styles.add_style(:b => true)
|
||||
row = ["Attended", "Name", "Nickname", "Affilation", "Email", "Social events",
|
||||
"With partner", "Needs access", "Other needs", "Arrival", "Departure"]
|
||||
sheet.add_row row, :style => bold_style
|
||||
|
||||
@registrations.each do |reg|
|
||||
row = []
|
||||
row << reg.attended
|
||||
row << "#{reg.last_name} #{reg.first_name} (#{reg.public_name})"
|
||||
row << reg.irc_nickname
|
||||
row << reg.company
|
||||
row << reg.email
|
||||
row << reg.attending_social_events
|
||||
row << reg.attending_with_partner
|
||||
row << reg.need_access
|
||||
row << reg.other_needs
|
||||
row << reg.arrival
|
||||
row << reg.departure
|
||||
sheet.add_row row
|
||||
end
|
||||
sheet.column_info[8].width = [sheet.column_info[8].width, 30].min
|
||||
end
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue