{% extends "app.html" %}
{% comment %}
# SPDX-License-Identifier: AGPL-3.0-or-later
{% endcomment %}

{% load bootstrap %}
{% load i18n %}
{% load extras %}

{% block configuration %}
  {{ block.super }}

  <h3>{% trans "Manage Wikis" %}</h3>

  <div class="btn-toolbar">
    <a href="{% url 'tiddlywiki:create' %}" class="btn btn-default"
       role="button" title="{% trans 'Create Wiki' %}">
      {% icon 'plus' %}
      {% trans 'Create Wiki' %}
    </a>
    <a href="{% url 'tiddlywiki:upload' %}" class="btn btn-default"
       role="button" title="{% trans 'Upload Wiki' %}">
      {% icon 'upload' %}
      {% trans 'Upload Wiki' %}
    </a>
  </div>

  <div class="row">
    <div class="col-md-6">
      {% if not wikis %}
        <p>{% trans 'No wikis available.' %}</p>
      {% else %}
        <div id="tiddlywiki-wiki-list" class="list-group list-group-two-column">
          {% for wiki in wikis %}
            <div class="list-group-item">
              <a class="wiki-label" href="/tiddlywiki/{{ wiki }}" target="_blank"
                 title="{% blocktrans %}Go to wiki {{ wiki }}{% endblocktrans %}">
                {{ wiki }}
              </a>

              <a href="{% url 'tiddlywiki:rename' wiki %}"
                 class="wiki-edit btn btn-default btn-sm secondary"
                 role="button"
                 title="{% blocktrans %}Rename wiki {{ wiki }}{% endblocktrans %}">
                {% icon 'pencil-square-o' %}
              </a>

              <a href="{% url 'tiddlywiki:delete' wiki %}"
                 class="wiki-delete btn btn-default btn-sm secondary"
                 role="button"
                 title="{% blocktrans %}Delete wiki {{ wiki }}{% endblocktrans %}">
                {% icon 'trash-o' %}
              </a>
            </div>
          {% endfor %}
        </div>
      {% endif %}
    </div>
  </div>

{% endblock %}
