<h1>
<%= _('Template History') %>
</h1>
<p>
<%= _('Here you can view previously published versions of your template. These can no longer be modified.')%>
</p>
<div class="content">
<!-- List of own templates -->
<% if @templates.length > 0 then %>
<table class="dmp_table tablesorter">
<thead>
<tr>
<th class="col-large"><%= _('Title') %></th>
<th class="col-small"><%= _('Version') %></th> <!-- TODO: Add this entry into locale/app.pot and any .po file-->
<th class="col-small"><%= _('Published') %></th>
<th class="col-small"><%= _('Last updated') %></th>
<th class="col-medium"><%= _('Actions') %></th>
</tr>
</thead>
<tbody>
<% @templates.each do |org_template| %>
<tr class="table-data">
<td>
<%= org_template.title%>
<% if org_template == @current && !org_template.published%>
<i class="fa fa-pencil-square-o" aria-hidden="true"></i> <em><%=_('Draft')%></em>
<% end %>
</td>
<td>
<%= org_template.version %>
</td>
<td>
<%= (org_template.published? ? _('Yes') : _('No')) %>
</td>
<td>
<% last_temp_updated = org_template.updated_at %>
<% org_template.phases.each do |phase|%>
<% if org_template.updated_at.to_date < phase.updated_at.to_date %>
<% last_temp_updated = phase.updated_at %>
<% end %>
<% end %>
<%= l last_temp_updated.to_date, formats: :short %>
</td>
<td>
<%= link_to (org_template == @current ? _('Edit') : _('View')), admin_template_template_path(id: org_template), class: "dmp_table_link"%>
</td>
</tr>
<%end%>
</tbody>
</table>
<% else %>
<p><%= _('This template is new and does not yet have any publication history.') %></p>
<% end %>
<div>
<a href="<%= admin_index_template_path %>" class="link-as-button"><%= _('View all templates') %></a>
</div>
<br />
</div>