open-law/app/templates/book/components/section_context_menu.html

51 lines
1.9 KiB
HTML

<!-- prettier-ignore -->
{% if current_user.is_authenticated %}
{% set access_to_create_sections = has_permission(section, Access.C) %}
{% set access_to_update_sections = has_permission(section, Access.U) %}
{% set access_to_delete_sections = has_permission(section, Access.D) %}
{% if access_to_update_sections or access_to_delete_sections %}
<ul class="py-2 text-sm text-gray-700 dark:text-gray-200">
{% if access_to_update_sections %}
<li>
<button
type="button"
id="rename-section-button-{{section.id}}"
class="w-full block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white">
Rename Section
</button>
</li>
{% endif %}
<!-- prettier-ignore -->
{% if access_to_delete_sections %}
<li>
<!-- prettier-ignore -->
<button type="button" data-modal-target="delete-section-modal" data-modal-toggle="delete-section-modal" id="callDeleteSectionModal" data-collection-id="{{collection.id}}" {% if sub_collection %} data-sub-collection-id="{{sub_collection.id}}" {% endif %} data-section-id="{{section.id}}" class="w-full block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white"> Delete Section </button>
</li>
{% endif %}
</ul>
{% endif %}
<!-- prettier-ignore -->
{% if not access_to_create_sections and not access_to_update_sections and not access_to_delete_sections %}
<ul class="py-2 text-sm text-gray-700 dark:text-gray-200">
<li>
<button
type="button"
class="w-full block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white">
You have no permissions for this section
</button>
</li>
</ul>
{% endif %}
<!-- prettier-ignore -->
{% else %}
<ul class="py-2 text-sm text-gray-700 dark:text-gray-200">
<li>
<button
type="button"
class="w-full block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white">
Connect your wallet to do this
</button>
</li>
</ul>
{% endif %}