digitalfabrik/integreat-cms

View on GitHub
integreat_cms/cms/templates/languages/language_list_row.html

Summary

Maintainability
Test Coverage
{% load i18n %}
<tr class="border-t border-solid border-gray-200 hover:bg-gray-100">
    <td>
        <a href="{% url 'edit_language' slug=language.slug %}"
           class="block py-3 pl-4 pr-2 text-gray-800">
            {{ language.translated_name }}
        </a>
    </td>
    <td class="pr-2">
        {{ language.native_name }}
    </td>
    <td class="pr-2">
        {{ language.slug }}
    </td>
    <td class="pr-2">
        {{ language.bcp47_tag }}
    </td>
    <td class="pr-2">
        <span class="fp fp-{{ language.primary_country_code }} fp-rounded "
              title="{{ language.get_primary_country_code_display }}"></span>
        <span class="fp fp-{{ language.secondary_country_code }} fp-rounded "
              title="{{ language.get_secondary_country_code_display }}"></span>
    </td>
    <td class="pr-2">
        <span class="fp fp-{{ language.language_color }} w-5 h-5 rounded-full "
              title="{{ language.get_language_color_display }}"
              style="background-color: {{ language.language_color }}"></span>
    </td>
    <td class="pr-2">
        {{ language.get_text_direction_display }}
    </td>
    <td class="pr-2">
        {{ language.created_date|date:"SHORT_DATE_FORMAT" }}
    </td>
    <td class="pr-2">
        {{ language.last_updated|date:"SHORT_DATE_FORMAT" }}
    </td>
    <td class="pr-2 text-right">
        {{ language.language_tree_nodes.count }}
    </td>
    <td class="pl-2 pr-4 text-right">
        {% if perms.cms.delete_language %}
            {% if language.language_tree_nodes.exists %}
                <button title="{% translate "You cannot delete a language that is used in at least one region." %}"
                        class="btn-icon"
                        disabled>
                    <i icon-name="trash-2"></i>
                </button>
            {% else %}
                <button title="{% translate "Delete language" %}"
                        class="confirmation-button btn-icon"
                        data-confirmation-title="{{ delete_dialog_title }}"
                        data-confirmation-text="{{ delete_dialog_text }}"
                        data-confirmation-subject="{{ language.translated_name }}"
                        data-action="{% url 'delete_language' slug=language.slug %}">
                    <i icon-name="trash-2"></i>
                </button>
            {% endif %}
        {% endif %}
    </td>
</tr>