Newer
Older
dmpopidor / app / views / branded / paginable / orgs / _index.html.erb
<% is_super_admin = current_user.can_super_admin? %>
<div class="table-responsive">
  <table class="table table-hover" id="guidance-groups">
    <thead>
      <tr>
        <th scope="col"><%= _('Organisation') %>&nbsp;<%= paginable_sort_link('orgs.name') %></th>
        <th scope="col"><%= _('Administrator Email') %>&nbsp;<%= paginable_sort_link('orgs.contact_email') %></th>
        <th scope="col"><%= _('Organisation Type(s)') %>&nbsp;<%= paginable_sort_link('orgs.org_type') %></th>
        <th scope="col"><%= _('Templates') %></th>
        <th scope="col"><%= _('Users') %></th>
        <th scope="col" class="text-center"><%= _('Active') %></th>
        <th scope="col" class="sorter-false"><span aria-hidden="false" class="sr-only"><%= _('Actions') %></span></th>
      </tr>
    </thead>
    <tbody>
      <% scope.each do |org| %>
        <tr>
          <td><%= org.name %></td>
          <td><%= org.contact_email %></td>
          <td><%= org.org_type_to_s %></td>
          <td><%= org.template_count %></td>
          <td><%= org.users.uniq.length %></td>
          <td class="text-center org-status">
              <%= org.active? ? _('Yes') : _('No') %>
          </td>
          <td>
            <div class="dropdown">
              <button
                class="btn btn-link dropdown-toggle"
                type="button"
                id="org-<%= org.id %>-actions"
                data-toggle="dropdown"
                aria-haspopup="true"
                aria-expanded="true">
                <%= _('Actions') %><span class="caret"></span>
              </button>
              <ul class="dropdown-menu" aria-labelledby="org-<%= org.id %>-actions">
                <li><%= link_to _('Edit'), admin_edit_org_path(org) %></li>
                <% unless org.user_count > 0 || org.template_count > 0 %>
                  <li><%= link_to _('Remove'), super_admin_org_path(org), data: {confirm: _("You are about to delete '%{org_name}'. Are you sure?") % { org_name: org.name}}, method: :delete %></li>
                <% end %>
              </ul>
            </div>
          </td>
        </tr>
      <% end %>
    </tbody>
  </table>
</div>