{% extends 'creme_core/bricks/base/paginated-table.html' %} {% load i18n creme_widgets creme_bricks %} {% load has_perm_to uca_sort url from creme_core_tags %} {% block brick_extra_class %}{{block.super}} creme_config-relation-types-brick{% endblock %} {% block brick_header_title %} {% if custom %} {% brick_header_title title=_('{count} Custom type of relation') plural=_('{count} Custom types of relation') empty=verbose_name icon='relations' %} {% else %} {% brick_header_title title=_('{count} Standard type of relation') plural=_('{count} Standard types of relation') empty=verbose_name icon='relations' %} {% endif %} {% endblock %} {% block brick_header_actions %} {% if custom %} {% has_perm_to admin 'creme_core' as admin_perm %} {% brick_header_action id='add' url='creme_config__create_rtype'|url label=_('New custom type') enabled=admin_perm %} {% endif %} {% endblock %} {% block brick_table_columns %} {% brick_table_column title=_('Subject(s)') class='relation-subject' colspan=4 %} {% brick_table_column title=_('Predicate') class='relation-predicate' status='nowrap' %} {% brick_table_column title=_('Object(s)') class='relation-object' colspan=4 %} {% if custom %} {% brick_table_column title=_('Actions') status='action' colspan=3 %} {% else %} {% brick_table_column title=_('Actions') status='action' colspan=1 %} {% endif %} {% endblock %} {% block brick_table_rows %} {% has_perm_to admin 'creme_core' as admin_perm %}{% url 'creme_config__delete_rtype' as delete_url %} {% for relation_type in page.object_list %} {% with sym_type=relation_type.symmetric_type %} {% widget_enumerator relation_type.subject_ctypes.all|uca_sort threshold=5 empty=_('No type') summary=_('{count} types of resource') %} {% include 'creme_config/bricks/frags/rtype_property_contraints.html' with mandatory=relation_type.subject_properties.all forbidden=relation_type.subject_forbidden_properties.all %} {% if not relation_type.is_copiable %}{% translate 'No copy' %}{% endif %} {% if relation_type.minimal_display %}{% translate 'Display once' %}{% endif %} {{relation_type.predicate}} — {{sym_type.predicate}} {% widget_enumerator relation_type.object_ctypes.all|uca_sort threshold=5 empty=_('No type') summary=_('{count} types of resource') %} {% include 'creme_config/bricks/frags/rtype_property_contraints.html' with mandatory=relation_type.object_properties.all forbidden=relation_type.object_forbidden_properties.all %} {% if not sym_type.is_copiable %}{% translate 'No copy' %}{% endif %} {% if sym_type.minimal_display %}{% translate 'Display once' %}{% endif %} {% if relation_type.is_internal %} {% brick_table_action id='update' label=_('Disable') display='text' help_text=_('You cannot disable an internal type') enabled=False %} {% elif relation_type.enabled %} {% brick_table_action id='update' url='creme_config__disable_rtype'|url:relation_type.id label=_('Disable') display='text' enabled=admin_perm %} {% else %} {% brick_table_action id='update' url='creme_config__enable_rtype'|url:relation_type.id label=_('Enable') display='text' enabled=admin_perm %} {% endif %} {% if custom %} {% if relation_type.enabled %} {% brick_table_action id='edit' url='creme_config__edit_rtype'|url:relation_type.id label=_('Edit this relation type') enabled=admin_perm %} {% else %} {% brick_table_action id='edit' label=_('You cannot edit a disabled relation type') enabled=False %} {% endif %} {% brick_table_action id='delete' url=delete_url __id=relation_type.id label=_('Delete this relation type') enabled=admin_perm %} {% endif %} {% endwith %} {% endfor %} {% endblock %} {% block brick_table_empty %} {% if custom %}{% translate 'No custom type of relation for the moment' %}{% endif %} {% endblock %}