<% title _("Smart Proxies") %>

<% title_actions display_link_if_authorized(_("New Smart Proxy"), hash_for_new_smart_proxy_path),
                 documentation_button('4.3SmartProxies') %>

<table class="table table-bordered table-striped table-two-pane table-fixed">
  <thead>
    <tr>
      <th class="col-md-2"><%= s_("SmartProxy|Name") %></th>
      <% unless SETTINGS[:locations_enabled] && SETTINGS[:organizations_enabled] %>
        <th class="hidden-sm hidden-xs nbsp"><%= s_("SmartProxy|Url") %></th>
      <% end %>
      <% if SETTINGS[:locations_enabled] %>
        <th class="col-md-2 hidden-sm hidden-xs nbsp"><%= _('Locations') %></th>
      <% end %>
      <% if SETTINGS[:organizations_enabled] %>
        <th class="col-md-2 hidden-sm hidden-xs nbsp"><%= _('Organizations') %></th>
      <% end %>
      <th class="col-md-3"><%= _('Features') %></th>
      <th class="col-md-1"><%= _('Status') %></th>
      <th class="col-md-1"><%= _('Actions') %></th>
    </tr>
  </thead>
  <tbody>
    <% for proxy in @smart_proxies %>
      <tr class="proxy-show" data-url="<%= ping_smart_proxy_path(proxy) %>">
        <td class="nbsp ellipsis"><%= link_to_if_authorized proxy.name, {:action => :show, :id => proxy}, :title => proxy.url %></td>
        <% unless SETTINGS[:locations_enabled] && SETTINGS[:organizations_enabled] %>
          <td class="hidden-sm hidden-xs nbsp ellipsis"><%= proxy.url %></td>
        <% end %>
        <% if SETTINGS[:locations_enabled] %>
          <td class="hidden-sm hidden-xs nbsp ellipsis"><%= generate_links_for(proxy.locations).html_safe %></td>
        <% end %>
        <% if SETTINGS[:organizations_enabled] %>
          <td class="hidden-sm hidden-xs nbsp ellipsis"><%= generate_links_for(proxy.organizations).html_safe %></td>
        <% end %>
        <td class="ellipsis"><%= proxy.features.to_sentence %></td>
        <td>
          <span class="proxy-show-status"><%= spinner %></span>
        </td>
        <td><%= action_buttons(*proxy_actions(proxy, authorizer)) %></td>
      </tr>
    <% end %>
  </tbody>
</table>

<%= will_paginate_with_info @smart_proxies %>
