Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
wicked pdf erb report example
<!DOCTYPE html>
<html>
<style>
body {
font-family: Times New Roman, serif;
line-height:20px;
font-size: 9.5pt;
}
/* always break class will force a page break */
div.alwaysbreak { page-break-before: always; }
div, p{ /*page break inside avoids orpheans and other typography issues */
page-break-inside: avoid;
}
td, th {
page-break-inside: avoid;
padding: 5px 0;
}
table, figure {
margin: 0px 0;
border: none;
border-collapse: collapse;
table-layout: fixed;
width: 100%;
}
a{
color:black;
text-decoration: none;
}
h1{
font-size:11pt;
text-align:center;
font-weight:bold;
color:grey;
}
.header{
font-weight: bold;
font-weight: bold;
font-style: italic;
text-transform: uppercase;
}
.prop{
font-weight: bold;
width: 130px;
}
.value{
}
</style>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;" charset="UTF-8">
</head>
<body>
<h1>
CITY OF PEWAUKEE<br>
<%= @data.meeting_body.upcase %> AGENDA ITEM <%= @data.item_number if @data.item_number %>.
</h1>
<!-- below is how you directly target a custom field if needed
<%= @data.custom_fields[:"Additional Information"] %> -->
<table>
<tr>
<td class="prop">
DATE:
</td>
<td class="value">
<%= DateTime.parse(@data.date).strftime("%A, %B %e, %Y") %><br>
</td>
</tr>
<tr>
<td class="prop">
DEPARTMENT:
</td>
<td class="value">
<%= @data.submitting_department if @data.submitting_department %>
</td>
</tr>
<tr>
<td class="prop">
PROVIDED BY:
</td>
<td class="value">
<%= @data.prepared_by_name %>
</td>
</tr>
</table>
<br><br>
<div class="header">
Subject:
</div>
<p>
<%= @data.title if @data.title %>
</p>
<% used_fields = [:"Additional Information", :"Fiscal Impact", :"Extra info"] %>
<% custom_fields = @data.custom_fields.marshal_dump if @data.custom_fields && !@data.custom_fields.empty? %>
<% if !custom_fields.nil? || @data.custom_fields && !@data.custom_fields.empty? %>
<% custom_fields.each do |field, value| %>
<% next if used_fields.include?(field) %>
<div class="header">
<%= field %>:
</div>
<p>
<%= value %>
</p>
<% end %>
<% end %>
<div class="header">
RECOMMENDED MOTION:
</div>
<p>
<%= @data.suggested_action if @data.suggested_action %>
</p>
<div style="text-decoration:underline;font-weight:bold;">
ATTACHMENTS
</div>
<% if @data.attachments.length > 0 %>
Description<br>
<% @data.attachments.each do |attachment| %>
<a href=<%= attachment.url %> target="_blank"><%= attachment.name %></a>
<% end %>
<% end %>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.