<% # locals: templates %> <div class="table-responsive"> <table class="table table-hover table-bordered"> <thead> <tr> <th><%= _('Template Name') %> <%= paginable_sort_link('templates.title') %></th> <% if action == 'organisational' %> <th><%= _('Description') %> <%= paginable_sort_link('templates.description') %></th> <% else %> <th><%= (action == 'customizable' ? _('Funder') : _('Organisation')) %> <%= paginable_sort_link('orgs.name') %></th> <% end %> <th><%= _('Status') %></th> <th><%= _('Edited Date') %> <%= paginable_sort_link('templates.updated_at') %></th> <% if action != 'index' %> <th> </th> <% end %> </tr> </thead> <tbody> <% scope.each do |template| %> <tr> <td> <%= template.title %> </td> <td> <%= action == 'organisational' ? raw(template.description) : template.org.name %> </td> <td> <%# Leaving this line here as a placeholder for determining how to notify user of changes now that dirty flag is removed %> <%# if template.dirty? %> <%# _('Unpublished changes') %> <% if template.published? %> <%= _('Published') %> <% elsif template.draft? %> <% tooltip = _('You have unpublished changes! Select "Publish changes" in the Actions menu when you are ready to make them available to users.') %> <%= _('Published') %> <em class="sr-only"><%= tooltip %></em> <i class="fa fa-pencil-square-o red" aria-hidden="true" data-toggle="tooltip" title="<%= tooltip %>"></i> <% else %> <%= _('Unpublished') %> <% end %> </td> <td> <% last_temp_updated = template.updated_at %> <%= l last_temp_updated.to_date, formats: :short %> </td> <% if action != 'index' %> <td> <div class="dropdown"> <button class="btn btn-link dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"> <%= _('Actions') %><span class="caret"></span> </button> <ul class="dropdown-menu"> <li><%= link_to _('Edit'), edit_org_admin_template_path(template.id) %></li> <li><%= link_to _('History'), history_org_admin_template_path(template.id) %></li> <% if template.draft? || template.published? %> <li><%= link_to _('Unpublish'), unpublish_org_admin_template_path(template.id), 'data-method': 'patch' %></li> <% end %> <% if template.draft? %> <li><%= link_to _('Publish changes'), publish_org_admin_template_path(template), 'data-method': 'patch' %></li> <% elsif !template.published? %> <li><%= link_to _('Publish'), publish_org_admin_template_path(template.id), 'data-method': 'patch' %></li> <% end %> <li><%= link_to _('Copy'), copy_org_admin_template_path(template.id), 'data-method': 'post' %></li> <% if template.removable? %> <li> <%= link_to _('Remove'), org_admin_template_path(id: template.id), 'data-method': 'delete', rel: 'nofollow', 'data-confirm': _('Are you sure you want to remove "%{template_title}"? Any published versions will become unavailable to users.') % { template_title: template.title} %> </li> <% end %> </ul> </div> </td> <% end %> </tr> <% end %> </tbody> </table> </div>