Skip to content

Instantly share code, notes, and snippets.

@psyomn
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save psyomn/790fd35f78d30d9d3604 to your computer and use it in GitHub Desktop.
Save psyomn/790fd35f78d30d9d3604 to your computer and use it in GitHub Desktop.
[wlog v1.2.0] Template example for wlog
<%
begin
require 'rinku'
rescue
class Rinku
def self.auto_link(str)
str + "[Rinku not working]"
end
end
end
%>
<html>
<head>
<style type="text/css">
#issue {
border:1px #000000 solid;
margin:10px;
padding:10px;
border-radius:0 10px 0 10px;
}
#issue #title {
background-color:#A7CDF1;
padding:5px;
border-radius:5px;
}
#issue #description {
background-color:rgb(221, 221, 255);
padding:10px;
margin-top:5px;
margin-left:15px;
margin-right:0;
margin-bottom:0;
border-radius:5px;
}
#issue .status {
font-size:13px;
}
.soft {
color:#9B9B9B;
}
.rowodd {
background-color:rgb(221, 221, 255);
}
.commit {
color:rgb(28, 28, 139);
}
</style>
</head>
<body>
<div style="width:900px; margin-left:auto; margin-right:auto;">
<h1> Report #<%= @invoice.id %></h1>
<h2> Empirical Aspects </h2>
<p> From the dates: <%= @invoice.from.strftime("%d %B") %> to <%= @invoice.to.strftime("%d %B") %> </p>
<h3> Summary of Work </h2>
<p> <%= Rinku.auto_link(@invoice.description.gsub("\n", '<br/>')) %> <p>
<h3> Breakdown </h3>
<% @issues.each do |iss| %>
<div id="issue">
<div id="title"> [<%= iss.id %>] <%= iss.description %>
<span class="status"><i> [<%= iss.status_s %>] </i> </span>
</div>
<div id="description">
<%= Rinku.auto_link(iss.long_description) %> <br/>
<% if iss.attachments.count > 0 %>
<div class="attachments">Attachments:</div>
<% iss.attachments.each do |att| %>
<%= att.filename %>
<% end %>
<% end %>
</div>
<ul>
<% iss.log_entries.each do |le| %>
<li> <%= Rinku.auto_link(le.description) %>
<span class="soft">
<sub> [<%= le.created_at.strftime("%b %d %Y") %>] </sub>
<sub> [<a href="#<%= le.id %>"><%= le.id %></a>] </sub>
</span>
</li>
<% end %>
</ul>
</div>
<% end %>
<h3> Commits </h3>
<table>
<tr>
<th> hash </th>
<th> author </th>
<th> shortlog </th>
<th> message </th>
</tr>
<% @commits.each_with_index do |commit,ix| %>
<tr class="<%= ix % 2 == 0 ? 'rowodd' : '' %>">
<td class="commit"> <%= commit.commit[0..7] %></td>
<td> <%= commit.author %></td>
<td> <%= Rinku.auto_link(commit.shortlog) %></td>
<td> <%= Rinku.auto_link(commit.message) %></td>
</tr>
<% end %>
</table>
</body>
</div>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment