{% extends 'creme_core/bricks/base/paginated-table.html' %} {% load i18n creme_widgets creme_bricks creme_ctype %} {% load and_op has_perm_to url from creme_core_tags %} {% block brick_extra_class %}{{block.super}} documents-linked-brick{% endblock %} {% block brick_header_title %} {% brick_header_title title=_('{count} Linked document') plural=_('{count} Linked documents') empty=verbose_name icon='document' %} {% endblock %} {% block brick_header_actions %} {% if relation_type.enabled %} {% ctype_for_swappable 'DOCUMENTS_DOCUMENT_MODEL' as ct_doc %} {% has_perm_to create ct_doc as creation_perm %} {% has_perm_to link object as link_perm %} {% has_perm_to link ct_doc.model_class as doc_link_perm %} {% brick_header_action id='add' url='documents__create_related_document'|url:object.id label=_('Create a document') enabled=creation_perm|and_op:link_perm|and_op:doc_link_perm %} {% brick_header_action id='add-relationships' label=_('Link to an existing document') icon='link' enabled=link_perm|and_op:doc_link_perm __subject_id=object.id __rtype_id=relation_type.id __ctype_id=ct_doc.id __multiple=True %} {% endif %} {% endblock %} {% block brick_before_content %} {% if not relation_type.enabled %}