43 lines
1.3 KiB
Text
43 lines
1.3 KiB
Text
<table class="ledger">
|
|
<caption>Purchase history</caption>
|
|
|
|
<thead>
|
|
<tr>
|
|
<th><%= t("views.credits.ledger.category") %></th>
|
|
<th><%= t("views.credits.ledger.item") %></th>
|
|
<th><%= t("views.credits.ledger.cost") %></th>
|
|
<th><%= t("views.credits.ledger.date") %></th>
|
|
</tr>
|
|
</thead>
|
|
|
|
<tbody>
|
|
<% if items.present? %>
|
|
<% for item in items %>
|
|
<% if item.purchase %>
|
|
<tr>
|
|
<% else %>
|
|
<tr class="misc">
|
|
<% end %>
|
|
<td>
|
|
<% if item.purchase %>
|
|
<%= item.purchase.instance_of?(Listing) ? t("views.credits.ledger.class.listing") : item.purchase.class.name.titleize %>
|
|
<% end %>
|
|
</td>
|
|
<td>
|
|
<% if item.purchase %>
|
|
<%= render "ledger_#{item.purchase.class.name.underscore}", purchase: item.purchase %>
|
|
<% else %>
|
|
<span><%= t("views.credits.ledger.misc") %></span>
|
|
<% end %>
|
|
</td>
|
|
<td class="cost"><%= item.cost %></td>
|
|
<td>
|
|
<% if item.purchased_at %>
|
|
<time datetime="<%= item.purchased_at.iso8601 %>"><%= item.purchased_at.iso8601 %></time>
|
|
<% end %>
|
|
</td>
|
|
</tr>
|
|
<% end %>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|