export feature for tracks and booths are done
This commit is contained in:
parent
be1992a03a
commit
e99287d18a
22 changed files with 418 additions and 3 deletions
19
app/views/admin/booths/_all_booths.csv.haml
Normal file
19
app/views/admin/booths/_all_booths.csv.haml
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
- headers = ['Booth ID',
|
||||
'Title',
|
||||
'Description',
|
||||
'Reasoning',
|
||||
'Submitter Name',
|
||||
'Submitter Relationship',
|
||||
'Website Url',
|
||||
'State']
|
||||
= CSV.generate_line ['All booths']
|
||||
= CSV.generate_line headers
|
||||
- @booths.each do |booth|
|
||||
= CSV.generate_line([booth.id,
|
||||
booth.title,
|
||||
booth.description,
|
||||
booth.reasoning,
|
||||
booth.submitter.name,
|
||||
booth.submitter_relationship,
|
||||
booth.website_url,
|
||||
booth.state]).html_safe
|
||||
26
app/views/admin/booths/_all_booths.pdf.prawn
Normal file
26
app/views/admin/booths/_all_booths.pdf.prawn
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
prawn_document(force_download: true, filename: "#{@file_name}.pdf", page_layout: :landscape) do |pdf|
|
||||
booths_array = []
|
||||
header_array = ['Booth ID',
|
||||
'Title',
|
||||
'Description',
|
||||
'Reasoning',
|
||||
'Submitter Name',
|
||||
'Submitter Relationship',
|
||||
'Website Url',
|
||||
'State']
|
||||
booths_array << header_array
|
||||
@booths.each do |booth|
|
||||
row = []
|
||||
row << booth.id
|
||||
row << booth.title
|
||||
row << booth.description
|
||||
row << booth.reasoning
|
||||
row << booth.submitter.name
|
||||
row << booth.submitter_relationship
|
||||
row << booth.website_url
|
||||
row << booth.state
|
||||
booths_array << row
|
||||
end
|
||||
pdf.text "#{@conference.short_title} booths", font_size: 25, align: :center
|
||||
pdf.table booths_array, header: true, cell_style: {size: 8, border_width: 1},column_widths: [45,70,153,152,70,80,105,45]
|
||||
end
|
||||
27
app/views/admin/booths/_all_booths.xlsx.axlsx
Normal file
27
app/views/admin/booths/_all_booths.xlsx.axlsx
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
wb.add_worksheet(name: 'all booths') do |sheet|
|
||||
bold_style = wb.styles.add_style(b: true)
|
||||
wrap_text = wb.styles.add_style alignment: {wrap_text: true}
|
||||
row = ['Booth ID',
|
||||
'Title',
|
||||
'Description',
|
||||
'Reasoning',
|
||||
'Submitter Name',
|
||||
'Submitter Relationship',
|
||||
'Website Url',
|
||||
'State']
|
||||
|
||||
sheet.add_row row, style: bold_style
|
||||
@booths.each do |booth|
|
||||
row = []
|
||||
row << booth.id
|
||||
row << booth.title
|
||||
row << booth.description
|
||||
row << booth.reasoning
|
||||
row << booth.submitter.name
|
||||
row << booth.submitter_relationship
|
||||
row << booth.website_url
|
||||
row << booth.state
|
||||
sheet.add_row row , style: wrap_text
|
||||
sheet.column_widths 10,20,35,35,20,30,35,10
|
||||
end
|
||||
end
|
||||
19
app/views/admin/booths/_confirmed_booths.csv.haml
Normal file
19
app/views/admin/booths/_confirmed_booths.csv.haml
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
- headers = ['Booth ID',
|
||||
'Title',
|
||||
'Description',
|
||||
'Reasoning',
|
||||
'Submitter Name',
|
||||
'Submitter Relationship',
|
||||
'Website Url',
|
||||
'State']
|
||||
= CSV.generate_line ['All booths']
|
||||
= CSV.generate_line headers
|
||||
- @booths.confirmed.each do |booth|
|
||||
= CSV.generate_line([booth.id,
|
||||
booth.title,
|
||||
booth.description,
|
||||
booth.reasoning,
|
||||
booth.submitter.name,
|
||||
booth.submitter_relationship,
|
||||
booth.website_url,
|
||||
booth.state]).html_safe
|
||||
26
app/views/admin/booths/_confirmed_booths.pdf.prawn
Normal file
26
app/views/admin/booths/_confirmed_booths.pdf.prawn
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
prawn_document(force_download: true, filename: "#{@file_name}.pdf", page_layout: :landscape) do |pdf|
|
||||
booths_array = []
|
||||
header_array = ['Booth ID',
|
||||
'Title',
|
||||
'Description',
|
||||
'Reasoning',
|
||||
'Submitter Name',
|
||||
'Submitter Relationship',
|
||||
'Website Url',
|
||||
'State']
|
||||
booths_array << header_array
|
||||
@booths.confirmed.each do |booth|
|
||||
row = []
|
||||
row << booth.id
|
||||
row << booth.title
|
||||
row << booth.description
|
||||
row << booth.reasoning
|
||||
row << booth.submitter.name
|
||||
row << booth.submitter_relationship
|
||||
row << booth.website_url
|
||||
row << booth.state
|
||||
booths_array << row
|
||||
end
|
||||
pdf.text "#{@conference.short_title} booths", font_size: 25, align: :center
|
||||
pdf.table booths_array, header: true, cell_style: {size: 8, border_width: 1},column_widths: [45,70,153,152,70,80,105,45]
|
||||
end
|
||||
27
app/views/admin/booths/_confirmed_booths.xlsx.axlsx
Normal file
27
app/views/admin/booths/_confirmed_booths.xlsx.axlsx
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
wb.add_worksheet(name: 'all booths') do |sheet|
|
||||
bold_style = wb.styles.add_style(b: true)
|
||||
wrap_text = wb.styles.add_style alignment: {wrap_text: true}
|
||||
row = ['Booth ID',
|
||||
'Title',
|
||||
'Description',
|
||||
'Reasoning',
|
||||
'Submitter Name',
|
||||
'Submitter Relationship',
|
||||
'Website Url',
|
||||
'State']
|
||||
sheet.add_row row, style: bold_style
|
||||
|
||||
@booths.confirmed.each do |booth|
|
||||
row = []
|
||||
row << booth.id
|
||||
row << booth.title
|
||||
row << booth.description
|
||||
row << booth.reasoning
|
||||
row << booth.submitter.name
|
||||
row << booth.submitter_relationship
|
||||
row << booth.website_url
|
||||
row << booth.state
|
||||
sheet.add_row row , style: wrap_text
|
||||
sheet.column_widths 10,20,35,35,20,30,35,10
|
||||
end
|
||||
end
|
||||
4
app/views/admin/booths/booths.csv.haml
Normal file
4
app/views/admin/booths/booths.csv.haml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
- if @booth_export_option == 'confirmed'
|
||||
= render 'confirmed_booths'
|
||||
- elsif @booth_export_option == 'all'
|
||||
= render 'all_booths'
|
||||
5
app/views/admin/booths/booths.pdf.prawn
Normal file
5
app/views/admin/booths/booths.pdf.prawn
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
if @booth_export_option == 'confirmed'
|
||||
render 'confirmed_booths'
|
||||
elsif @booth_export_option == 'all'
|
||||
render 'all_booths'
|
||||
end
|
||||
7
app/views/admin/booths/booths.xlsx.axlsx
Normal file
7
app/views/admin/booths/booths.xlsx.axlsx
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
wb = xlsx_package.workbook
|
||||
xlsx_package.use_autowidth = true
|
||||
if @booth_export_option == 'confirmed'
|
||||
render partial: 'confirmed_booths', locals: { wb: wb }
|
||||
elsif @booth_export_option == 'all'
|
||||
render partial: 'all_booths', locals: { wb: wb }
|
||||
end
|
||||
|
|
@ -3,6 +3,30 @@
|
|||
.page-header
|
||||
%h1
|
||||
Booths
|
||||
.pull-right
|
||||
- if can? :read, Booth
|
||||
.btn-group
|
||||
.btn-group
|
||||
%button.btn.btn-default.dropdown-toggle{ 'data-toggle' => 'dropdown', type: 'button', class: 'btn btn-success' }
|
||||
Export PDF
|
||||
%span.caret
|
||||
%ul.dropdown-menu{ role: 'menu' }
|
||||
%li= link_to 'All Booths', admin_conference_booths_path(@conference.short_title, format: :pdf, booth_export_option: 'all')
|
||||
%li= link_to 'Confirmed Booths', admin_conference_booths_path(@conference.short_title, format: :pdf, booth_export_option: 'confirmed')
|
||||
.btn-group
|
||||
%button.btn.btn-default.dropdown-toggle{ 'data-toggle' => 'dropdown', type: 'button', class: 'btn btn-success' }
|
||||
Export CSV
|
||||
%span.caret
|
||||
%ul.dropdown-menu{ role: 'menu' }
|
||||
%li= link_to 'All', admin_conference_booths_path(@conference.short_title, format: :csv, booth_export_option: 'all')
|
||||
%li= link_to 'Confirmed', admin_conference_booths_path(@conference.short_title, format: :csv, booth_export_option: 'confirmed')
|
||||
.btn-group
|
||||
%button.btn.btn-default.dropdown-toggle{ 'data-toggle' => 'dropdown', type: 'button', class: 'btn btn-success' }
|
||||
Export XLS
|
||||
%span.caret
|
||||
%ul.dropdown-menu{ role: 'menu' }
|
||||
%li= link_to 'All', admin_conference_booths_path(@conference.short_title, format: :xlsx, booth_export_option: 'all')
|
||||
%li= link_to 'Confirmed', admin_conference_booths_path(@conference.short_title, format: :xlsx, booth_export_option: 'confirmed')
|
||||
= "(#{@booths.length})" if @booths.any?
|
||||
%p.text-muted
|
||||
All the booth requests
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue