{% load i18n %}


<div id="security_group_rule_modal" class="{% block modal_class %}modal{% if hide %} hide {% else %} static_page{% endif %}{% endblock %}">
    <div class="modal-header">
      {% if hide %}<a href="#" class="close">&times;</a>{% endif %}
      <h3>Edit Security Group Rules</h3>
    </div>
    <div class="modal-body clearfix">
      <div class="right">
          <h3> {% trans "Rules for Security Group" %} '{{security_group.name}}'</h3>
          <table id="security_groups" class="zebra-striped">
            <tr>
              <th>{% trans "IP Protocol" %}</th>
              <th>{% trans "From Port" %}</th>
              <th>{% trans "To Port" %}</th>
              <th>{% trans "CIDR" %}</th>
              <th>{% trans "Actions" %}</th>
            </tr>
            {% for rule in security_group.rules %}
              <tr class="{% cycle 'odd' 'even' %}">
                <td>{{ rule.ip_protocol }}</td>
                <td>{{ rule.from_port }}</td>
                <td>{{ rule.to_port }}</td>
                <td>{{ rule.ip_range.cidr }}</td>
                <td id="actions">
                  <ul>
                    <li class="form">{% include "nova/access_and_security/security_groups/_delete_rule.html" with form=delete_form %}</li>
                  </ul>
                </td>
              </tr>
            {% empty %}
            <tr>
              <td colspan="100%">
                {% trans "No rules for this security group" %}
              </td>
            </tr>
            {% endfor %}
          </table>
      </div>
      <form id="edit_security_group_rule_form" action="{% url horizon:nova:access_and_security:security_groups:edit_rules security_group.id %}" method="post">
        {% csrf_token %}
        <fieldset>
        {% include "horizon/common/_form_fields.html" %}
        </fieldset>
    </div>
    <div class="modal-footer">
      <input class="btn primary pull-right" type="submit" value="{% trans "Add Rule" %}" />
      <a href="{% url horizon:nova:access_and_security:index %}" class="btn secondary cancel close">Cancel</a>
    </div>
  </form>
</div>

{% block modal-footer %}
{% endblock %}
