<h1 class="page-title">PyGitWeb settings</h1>
<div class="card">
  <div class="card-body">
    <form action="/settings/pygitweb/submit" method="post" class="needs-validation" novalidate>
      {{ form_body | safe }}
      <div class="form-footer">
        <button type="submit" class="btn btn-primary">Save</button>
        <a href="/" class="btn btn-ghost-secondary">Cancel</a>
      </div>
    </form>
  </div>
</div>
<div class="card mt-3">
  <div class="card-body">
    <h2 class="card-title">Plugins</h2>
    <p class="text-secondary">Installed plugins are off by default. Enable only those you want active; changes apply immediately.</p>
    <form action="/settings/pygitweb/plugins" method="post">
      {% if plugin_rows %}
        {% for row in plugin_rows %}
        <div class="mb-3">
          <div class="form-check">
            <input type="checkbox" class="form-check-input" id="plugin_{{ row.name }}" name="plugin" value="{{ row.name }}"{% if row.checked %} checked{% endif %}>
            <label class="form-check-label" for="plugin_{{ row.name }}">{{ row.name }}</label>
          </div>
        </div>
        {% endfor %}
      {% else %}
        <p class="text-muted">No installed plugins with pygitweb entry points were found.</p>
      {% endif %}
      <div class="form-footer">
        <button type="submit" class="btn btn-primary"{% if not plugin_rows %} disabled{% endif %}>Save plugins</button>
      </div>
    </form>
  </div>
</div>
<div class="card mt-3">
  <div class="card-body">
    <h2 class="card-title">Server</h2>
    <p class="text-secondary">Stop the PyGitWeb process gracefully. Long-poll connections are released, then the server exits.</p>
    <form action="/settings/pygitweb/shutdown" method="post" onsubmit="return confirm('Shut down PyGitWeb now?');">
      <button type="submit" class="btn btn-danger">Shut down PyGitWeb</button>
    </form>
  </div>
</div>