Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Another Wicked PDF - Ruby ERB Template. This one directly calls a hash and breaks a few into arrays
<!DOCTYPE html>
<html>
<style>
div.alwaysbreak { page-break-before: always; }
body {
font-family: TimesNewRoman, "Times New Roman", Times, Baskerville, Georgia, serif;
line-height:20px; margin: 0 .50in;
font-size: 12pt;
}
td, th {
page-break-inside: avoid;
padding: 10px 0;
}
table, figure {
margin: 0px 0;
border: none;
border-collapse: collapse;
table-layout: fixed;
width: 100%; /* must have this set */
}
div.alwaysbreak {
page-break-before: always;
}
.header{
font-weight: bold;
font-size: 20pt;
text-align: left;
}
.prop{
font-weight: bold;
}
.value{
}
</style>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;" charset="UTF-8">
</head>
<body>
<table>
<tr>
<td width="125px">
<img width="105px" src=<%= @data.site_info.logo.url %> alt="Meeting logo">
</td>
<td>
<div style="font-size:16pt;font-weight:bold;">
<%= @data.meeting_body if @data.meeting_body %> Agenda Item Report
</div>
<br>
<div class"header">
Submitted by: <%= @data.prepared_by_name if @data.prepared_by_name %><br>
Submitting Department: <%= @data.submitting_department %><br>
Meeting Date:
<% if @data.date && !@data.date.empty? %>
<%= Date.parse(@data.date).strftime("%-m/%d/%Y") %>
<% end %>
</div>
</td>
</tr>
</table>
<br>
<br>
<div class="prop">Subject:</div>
<div><%= @data.title if @data.title %></div>
<br><br>
<div class="prop">Presenter:</div>
<div><%= !@data.custom_fields.is_a?(Array) ? @data.custom_fields[:Presenter] : nil %></div>
<br>
<div class="prop">Recommendation:</div>
<div><%= @data.suggested_action if @data.suggested_action %></div>
<br>
<div class="prop">Background:</div>
<div>
<% if !@data.custom_fields.is_a?(Array) && @data.custom_fields[:"Background or Explanation"] %>
<% @data.custom_fields[:"Background or Explanation"].split("\n").each do |background| %>
<%= background %><br>
<% end %>
<% end %>
</div>
<br>
<div class="prop">Council Direction:</div>
<div>
<% if !@data.custom_fields.is_a?(Array) && @data.custom_fields[:"Council Direction"] %>
<% @data.custom_fields[:"Council Direction"].split("\n").each do |direction| %>
<%= direction %><br>
<% end %>
<% end %>
</div>
<br>
<div class="prop">Fiscal Impacts:</div>
<div><%= !@data.custom_fields.is_a?(Array) ? @data.custom_fields[:"Fiscal Impacts"] : nil %></div>
<br>
<div class="prop">ATTACHMENTS</div>
<% if @data.attachments.length > 0 %>
<ul>
<% @data.attachments.each do |attachment| %>
<li><a href=<%= attachment.url %> target="_blank"><%= attachment.name %></a></li>
<% end %>
</ul>
<% end %>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment