<table id="data-table" class="table table-striped table-bordered" width="100%" cellspacing="0">
  <thead>
    <tr>
      <th class="nd_center-cell">Role Name</th>
      <th class="nd_center-cell">Device and Port ACLs</th>
      <th class="nd_center-cell">Action</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td class="nd_center-cell">
      <input data-form="add" name="role_name" type="text">
      </td>
      <td></td>
      <td class="nd_center-cell">
        <button class="btn btn-small nd_adminbutton" name="add" type="submit"><i class="icon-plus-sign"></i> Add</button>
      </td>
    </tr>

    [% SET count = 0 %]
    [% FOREACH role_name IN results %]
    [% SET count = count + 1 %]
    <tr>
      <td class="nd_center-cell">
        <input data-form="update" name="role_name" type="text" value="[% role_name | html_entity %]">
      </td>

      <td class="nd_center-cell"><a class="btn"
        href="[% uri_for('/admin/rolepermissionseditor') | none %]?role_name=[% role_name | uri %]"><i class="icon-list-ul icon-large icon-border"></i> Edit Rules</a></td>

      <td class="nd_center-cell">
        <input data-form="update" name="old-role_name" type="hidden" value="[% role_name | html_entity %]">
        <button class="btn nd_adminbutton" name="update" type="submit"><i class="icon-save text-warning"></i></button>

        <button class="btn" data-toggle="modal"
          data-target="#nd_devdel-[% count | html_entity %]" type="button"><i class="icon-trash text-error"></i></button>

        <div id="nd_devdel-[% count | html_entity %]" class="nd_modal nd_deep-horizon modal hide fade" tabindex="-1"
          role="dialog" aria-labelledby="nd_devdel-label-[% count | html_entity %]" aria-hidden="true">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
            <h3 id="nd_devdel-label-[% count | html_entity %]">Are you sure?</h3>
          </div>
          <div class="modal-body">
            <blockquote>
              <p class="text-info">
                The role &quot;[% role_name | html_entity %]&quot; will be deleted.</p>
            </blockquote>
            <input data-form="delete" name="role_name" type="hidden" value="[% role_name | html_entity %]">
          </div>

          <div class="modal-footer">
            <button class="btn btn-success" data-dismiss="modal" aria-hidden="true">Cancel</button>
            <button class="btn btn-danger nd_adminbutton" name="delete" data-dismiss="modal">Confirm</button>
          </div>
        </div>
      </td>
    </tr>
    [% END %]
  </tbody>
</table>

<script>
  $(document).ready(function() {
    $('#data-table').dataTable({
    "columnDefs": [ {
        "targets": [ 1, 2 ],
        "orderable": false,
        "searchable": false
      } ],
      [% INCLUDE 'ajax/datatabledefaults.tt' -%]
    } );
  } );
</script>


