{% extends "master.html" %}

{% block body %}

<div class="page-header">
  <h1>Project: {{ project.name }} - Delete version</h1>
</div>

<div class="row">

    <form method="POST" action="{{
        url_for('anitya_ui.delete_project_version',
                project_id=project.id,
                version=version) }}" >
      {{ form.csrf_token }}
      <table id="input_table">
        <tr>
          <th>Project</th>
          <td>
            {{ project.name }}
          </td>
        </tr>
        <tr>
          <th>Version</th>
          <td>
            {{ version }}
          </td>
        </tr>
      </table>

      <button type="submit" name="confirm" value="Yes" class="btn btn-warning">
        <span class="glyphicon glyphicon-remove"></span>
        Delete version
      </button>

      <a href="{{ url_for('anitya_ui.project', project_id=project.id) }}">
        <button type="button" class="btn btn-danger">
          <span class="glyphicon glyphicon-ban-circle"></span>
          Cancel
        </button>
      </a>

    </form>

</div>

{% endblock %}

{% block jscript %}
<script>
    function add_row(tableID) {
        var table = document.getElementById(tableID);
        var rowCount = table.rows.length;
        var row = table.insertRow(rowCount);

        var colCount = table.rows[0].cells.length;
        for (var i = 0; i < colCount; i++) {
            var newcell = row.insertCell(i);
            newcell.innerHTML = table.rows[1].cells[i].innerHTML;
            switch (newcell.childNodes[1].type) {
                case "text":
                    newcell.childNodes[1].value = "";
                    break;
                case "checkbox":
                    newcell.childNodes[1].checked = false;
                    break;
                case "select-one":
                    newcell.childNodes[1].selectedIndex = 0;
                    break;
            }
        }
        return false;
    };
</script>
{% endblock %}
