{% load i18n %}

<div class="table_title">
  <h3>Floating IPs</h3>
  <div class="table_actions">
    {% include "nova/access_and_security/floating_ips/_allocate.html" with form=allocate_form %}
    <div class="floating_ips table_search">
      <form action="#">
        <input class="span3" type="text">
      </form>
    </div>
    <a class="inspect" href="#">{% trans "inspect" %}</a>
  </div>
</div>

<table id="floating_ips" class="zebra-striped sortable">
  <thead>
    <tr>
      <th></th>
      <th>IP</th>
      <th>Instance</th>
      <th colspan="2">Actions</th>
    </tr>
  </thead>
  {% for ip in floating_ips %}
  <tr class="{% cycle 'odd' 'even' %}">
    <td class="select">
      <input type="checkbox" name="ip_{{ ip.id }}" value="ip_{{ ip.id }}" id="ip_select_{{ ip.id }}" />
    </td>
    <td>{{ip.ip }}</td>
    <td>
      {% if ip.fixed_ip %}
        <ul>
          <li><span>{% trans "Instance ID:" %}</span> {{ ip.instance_id }}</li>
          <li><span>{% trans "Fixed IP:" %}</span> {{ ip.fixed_ip }}</li>
        </ul>
      {% else %}
        None
      {% endif %}
    </td>
    <td>
      {% if ip.fixed_ip %}
        {% include "nova/access_and_security/floating_ips/_disassociate.html" with form=disassociate_form %}
      {% else %}
        <a class="btn primary small ajax-modal" href="{% url horizon:nova:access_and_security:floating_ips:associate ip.id %}">{% trans "Associate to instance" %}</a>
      {% endif %}
    </td>
    <td id="name_{{ ip.name }}" class="actions">
      <a class="more-actions" href="#">More</a>
      <ul>
        <li class="form">{% include "nova/access_and_security/floating_ips/_release.html" with form=release_form %}</li>
      </ul>
    </td>
  </tr>
  {% endfor %}
</table>
