<a class="btn" href="{{ request.path }}/edit"><i class="icon-edit"></i>{{ _("Edit") }}</a>
{%- if view.options.allow_delete is defined and view.options.allow_delete() %}
<a class="btn btn-danger" id="delete-button"><i class="icon-trash icon-white"></i>{{ _("Delete") }}</a>

<script type="text/javascript">
  $(function () {
    $("#delete-button").click(function () {
      bootbox.dialog("Do you really want to delete this entity?", [{
        "label" : "Delete",
        "class" : "btn-danger",   // or btn-primary, or btn-danger, or nothing at all
        "callback": function() {
          // Hack to provoke a POST instead of a GET.
          var path = "{{ request.path }}/delete";
          var form = document.createElement("form");
          form.setAttribute("method", "POST");
          form.setAttribute("action", path);
          document.body.appendChild(form);
          form.submit();
        }
      }, {
        "label" : "Cancel",
        "class" : ""   // or btn-primary, or btn-danger, or nothing at all
      }], {
        'keyboard': true
      });
    });
  });
</script>
{%- endif %}

{%- for panel, data in panels %}
<div class="panel" style="margin-top: 10px;">
  <h2>{{ panel.label }}</h2>

  <table class="table table-striped table-condensed" style="margin: 10px 0 15px 0;">
    <tbody>
    {%- for row in panel %}
    {%- if row.cols[0] in data %}
      {%- set label, value = data[row.cols[0]] %}
      <tr class="row">
        <th class="span4">{{ label }}</th>
        <td class="span8" colspan="3">{{ value }}</td>
      </tr>
    {%- endif %}
    {%- endfor %}
    </tbody>
  </table>
</div>
{% endfor %}
