Skip to content

Commit

Permalink
Clean up pdf generation.
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmarcia committed Oct 23, 2019
1 parent e75d05c commit f409b99
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 56 deletions.
8 changes: 5 additions & 3 deletions app/controllers/pickup_sheets_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ def show
respond_to do |format|
format.html
format.pdf do
render pdf: "Your_filename",
template: "pickup_sheets/pdf_show.html.erb",
layout: "pdf.html"
render pdf: "pickup_sheets",
page_size: 'A3',
template: "pickup_sheets/pdf_show.html.erb",
layout: "pdf.html",
lowquality: true
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/pdf.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<%= wicked_pdf_stylesheet_link_tag "application" -%>
</head>
<body>
<div style="font-size: 1.25rem" class='container'>
<div style="font-size: 0.75rem">
<%= yield %>
</div>
</body>
Expand Down
94 changes: 42 additions & 52 deletions app/views/pickup_sheets/pdf_show.html.erb
Original file line number Diff line number Diff line change
@@ -1,62 +1,52 @@
<div class="app-title">
<div>
<h1 style="font-size: 4rem;text-align: center;"> Pickup Sheet</h1>
<h1 style="font-size: 2rem;text-align: center;"><%= Date.today.strftime("%B") %> Pickup Sheet</h1>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="row">
<div class="col-12">
<div class="card mb-12">
<table class="table table-striped">
<thead>
<tr>
<th scope="col">Child's name</th>
<th scope="col">Picked Up By</th>
<th scope="col">Quantity Ordered</th>
<th scope="col">Quantity Picked Up</th>
<th scope="col">Item Ordered</th>
<th scope="col">Item Picked Up</th>
<th scope="col">Picked up</th>
</tr>
</thead>
<tbody>
<% child_item_requests.each do |child_item_request| %>
<% child = child_item_request.child %>
<tr>
<td colspan="7" id="flash-message-container-nested-<%= child_item_request.id%>">
</td>
</tr>
<tr>
<td><%= child.display_name %></td>
<td>
<% child.family.authorized_family_members.each do |authed| %>
<div>
<input type="checkbox">
<label><%= authed.display_name %></label>
</div>
<% end %>
</td>
<td><%= child_item_request.quantity %></td>
<td>
<input type="text">
<div class="col-12">
<table class="table table-striped">
<thead>
<tr>
<th scope="col">Child's name</th>
<th scope="col">Picked Up By</th>
<th scope="col">Quantity Ordered</th>
<th scope="col">Quantity Picked Up</th>
<th scope="col">Item Ordered</th>
<th scope="col">Item Picked Up</th>
<th scope="col">Picked up</th>
</tr>
</thead>
<tbody>
<% child_item_requests.each do |child_item_request| %>
<% child = child_item_request.child %>
<tr>
<td><%= child.display_name %></td>
<td>
<% child.family.authorized_family_members.each do |authed| %>
<div>
<input type="checkbox">
<label><%= authed.display_name %></label>
</div>
<% end %>
</td>
<td><%= child_item_request.quantity %></td>
<td>
<input type="text">

</td>
<td><%= item_id_to_display_string_map[child_item_request.child.item_needed_diaperid] %></td>
<td>
<input type="text">
</td>
<td>
</td>
<td><%= item_id_to_display_string_map[child_item_request.child.item_needed_diaperid] %></td>
<td>
<input type="text">
</td>
<td>

<input type="checkbox">
<input type="checkbox">

</td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
</div>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
7 changes: 7 additions & 0 deletions config/wicked_pdf.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
WickedPdf.config = {
#cross enviroment configs
}

if Rails.env.development?
WickedPdf.config[:lowquality] = true
end

0 comments on commit f409b99

Please sign in to comment.