<% # locals: templates, current_org %>
<div class="table-responsive">
<table class="table table-hover table-bordered">
<thead>
<% if scopes.present? %>
<tr><th colspan="4" class="sorter-false table-scope"><ul class="nav navbar-nav">
<% scopes.keys.each do |k| %>
<% unless k == :dmptemplate_ids %>
<li><%= link_to "#{k.capitalize} (#{scopes[k]})",
"#{all_paginable_templates_path(1)}?scope=#{k}",
class: 'template-scope', 'data-remote': true %></li>
<% end %>
<% end %>
</ul></th></tr>
<% end %>
<tr>
<th><%= _('Template Name') %> <%= paginable_sort_link('templates.title') %></th>
<th><%= _('Organisation') %> <%= paginable_sort_link('orgs.name') %></th>
<th><%= _('Status') %> <%= paginable_sort_link('templates.published') %></th>
<th><%= _('Edited Date') %> <%= paginable_sort_link('templates.updated_at') %></th>
</tr>
</thead>
<tbody>
<% scope.each do |template| %>
<tr>
<td>
<%= template.title %>
</td>
<td>
<%= template.org.name %>
</td>
<td>
<% if template.dirty? %>
<%= _('Unpublished changes') %>
<% elsif template.published? %>
<%= _('Published') %>
<% else %>
<%= _('Unpublished') %>
<% end %>
</td>
<td>
<% last_temp_updated = template.updated_at %>
<%= l last_temp_updated.to_date, formats: :short %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>