digitalfabrik/integreat-cms

View on GitHub
integreat_cms/cms/templates/pois/poi_list_archived.html

Summary

Maintainability
Test Coverage
{% extends "_base.html" %}
{% load i18n %}
{% load rules %}
{% load static %}
{% load content_filters %}
{% block content %}
    {% get_current_language as LANGUAGE_CODE %}
    {% get_language LANGUAGE_CODE as backend_language %}
    <div class="table-header">
        <div class="flex flex-wrap justify-between">
            <h1 class="heading">
                {% translate "Archived locations" %}
            </h1>
            <a href="{% url 'pois' region_slug=request.region.slug language_slug=language.slug %}"
               class="font-bold text-sm text-gray-800 flex items-center gap-1 pb-2 hover:underline">
                <span>
                    <i icon-name="map-pin" class="align-top h-5"></i>
                    {% translate "Back to locations" %}
                </span>
            </a>
        </div>
        <div class="flex flex-wrap justify-between gap-4">
            <div class="flex flex-wrap gap-4">
                {% include "generic_language_switcher.html" with target="archived_pois" %}
                {% include "search_input_form.html" with object_type="poi" object_archived=True %}
            </div>
        </div>
    </div>
    <div class="table-listing">
        <form id="bulk-action-form" method="post">
            {% csrf_token %}
        </form>
        <table class="w-full mt-4 rounded border border-gray-200 shadow bg-white">
            <thead>
                <tr class="border-b border-gray-200">
                    <th class="py-3 pl-4 pr-2 min">
                        <input form="bulk-action-form" type="checkbox" id="bulk-select-all" />
                    </th>
                    <th class="text-sm text-left uppercase py-3 pr-2">
                        {% translate "Title in" %} {{ language.translated_name }}
                    </th>
                    {% if backend_language and backend_language != language %}
                        <th class="text-sm text-left uppercase py-3 pr-2">
                            {% translate "Title in" %} {{ backend_language.translated_name }}
                        </th>
                    {% endif %}
                    <th class="text-sm text-left uppercase py-3 pr-2">
                        {% translate "Status" %}
                    </th>
                    <th class="text-sm text-left uppercase py-3 pr-2">
                        {% translate "Street" %}
                    </th>
                    <th class="text-sm text-left uppercase py-3 pr-2">
                        {% translate "Postal Code" %}
                    </th>
                    <th class="text-sm text-left uppercase py-3 pr-2">
                        {% translate "City" %}
                    </th>
                    <th class="text-sm text-left uppercase py-3 pr-2">
                        {% translate "Country" %}
                    </th>
                    <th class="text-sm text-left uppercase py-3 pr-2">
                        {% translate "Category" %}
                    </th>
                    <th class="text-sm text-right uppercase py-3 pr-4 min">
                        {% translate "Options" %}
                    </th>
                </tr>
            </thead>
            <tbody>
                {% for poi in pois %}
                    {% get_translation poi language.slug as poi_translation %}
                    {% include "pois/poi_list_archived_row.html" %}
                {% empty %}
                    <tr>
                        <td colspan="7" class="px-4 py-3">
                            {% translate "No locations archived yet." %}
                        </td>
                    </tr>
                {% endfor %}
            </tbody>
        </table>
    </div>
    {% if perms.cms.change_poi %}
        <div class="flex flex-wrap gap-2 mt-4">
            <select id="bulk-action" class="w-auto max-w-full">
                <option>
                    {% translate "Select bulk action" %}
                </option>
                <option data-bulk-action="{% url 'bulk_restore_pois' region_slug=request.region.slug language_slug=language.slug %}">
                    {% translate "Restore locations" %}
                </option>
            </select>
            <button form="bulk-action-form" id="bulk-action-execute" class="btn" disabled>
                {% translate "Execute" %}
            </button>
        </div>
    {% endif %}
    {% include "../generic_confirmation_dialog.html" %}
    {% url "pois" as url %}
    {% include "pagination.html" with chunk=pois %}
{% endblock content %}