2023-06-02 12:13:32 +03:00
{% if current_user.is_authenticated %}
<!-- prettier - ignore -->
2023-06-06 13:58:34 +03:00
{% set access_to_create_collections_in_root = has_permission(collection.parent, Access.C) %}
{% set access_to_create_collections = has_permission(collection, Access.C) %}
{% set access_to_update_collections = has_permission(collection, Access.U) %}
{% set access_to_delete_collections = has_permission(collection, Access.D) %}
{% set access_to_create_section = has_permission(collection, Access.C, EntityType.SECTION) %}
2023-06-02 12:13:32 +03:00
{% if access_to_create_collections or access_to_update_collections %}
< ul class = "py-2 text-sm text-gray-700 dark:text-gray-200" >
2023-06-06 13:58:34 +03:00
{% if access_to_create_collections_in_root %}
2023-06-08 16:44:13 +03:00
< li >
< button
type="button"
data-modal-target="add-collection-modal"
data-modal-toggle="add-collection-modal"
class="w-full block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white">
New Collection
< / button >
< / li >
{% endif %} {% if collection.active_children or not
collection.active_sections%}
< li >
< button
type="button"
id="callAddSubCollectionModal"
data-modal-target="add-sub-collection-modal"
data-modal-toggle="add-sub-collection-modal"
data-collection-id="{{collection.id}}"
class="w-full block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white">
New Subcollection
< / button >
< / li >
2023-06-02 12:13:32 +03:00
<!-- prettier - ignore -->
2023-06-02 15:50:54 +03:00
{% endif %}
{% if access_to_create_section %}
2023-06-05 16:12:30 +03:00
{% if not collection.active_children or not collection.active_children and collection.active_sections %}
2023-06-02 12:13:32 +03:00
< li >
< button
type="button"
id="callAddSectionModal"
data-modal-target="add-section-modal"
data-modal-toggle="add-section-modal"
data-collection-id="{{collection.id}}"
data-sub-collection-id="_"
class="w-full block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white">
New Section
< / button >
< / li >
<!-- prettier - ignore -->
2023-06-05 16:12:30 +03:00
{% endif %}
2023-06-02 12:13:32 +03:00
{% endif %}
< / ul >
{% endif %}
<!-- prettier - ignore -->
{% if access_to_update_collections or access_to_delete_collections %}
< ul class = "py-2 text-sm text-gray-700 dark:text-gray-200" >
{% if access_to_update_collections %}
< li >
< button
type="button"
id="rename-collection-button-{{collection.id}}"
class="w-full block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white">
Rename Collection
< / button >
< / li >
{% endif %}
<!-- prettier - ignore -->
{% if access_to_delete_collections %}
< li >
< button
type="button"
id="callDeleteCollectionModal"
data-modal-target="delete-collection-modal"
data-modal-toggle="delete-collection-modal"
data-collection-id="{{collection.id}}"
class="w-full block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white">
Delete Collection
< / button >
< / li >
{% endif %}
< / ul >
{% endif %}
2023-06-08 16:44:13 +03:00
<!-- prettier - ignore -->
{% if not access_to_create_collections_in_root and not access_to_create_collections and not access_to_update_collections and not access_to_delete_collections and not access_to_create_section %}
2023-06-02 12:13:32 +03:00
< 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">
2023-06-08 16:44:13 +03:00
You have no permissions for this collection
2023-06-02 12:13:32 +03:00
< / button >
< / li >
< / ul >
2023-06-08 16:44:13 +03:00
{% endif %}
<!-- prettier - ignore -->
2023-06-02 12:13:32 +03:00
{% 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 you wallet to do this
< / button >
< / li >
< / ul >
{% endif %}