{% extends 'creme_core/bricks/base/base.html' %} {% load i18n creme_bricks creme_ctype creme_perms creme_widgets %} {% load get_cloning_info get_deletion_info has_max_pins is_pinned url from creme_core_tags %} {% block brick_extra_class %}brick-hat brick-hat-bar{% endblock %} {% block brick_header %}{% endblock %} {% block brick_content %} {% with edit_perm=user|has_perm_to_change:object delete_perm=user|has_perm_to_delete:object %}
{% block icon %}{% widget_icon instance=object size='brick-hat-bar' %}{% endblock %}

{% block title %}{{object|ctype_for_instance|capfirst}} : {{object|capfirst}}{% endblock %}

{% if object.is_deleted %} {% translate 'Entity in the trash' %} {% elif object.sandbox %} {{object.sandbox.type.verbose_name}} {% endif %} {% if object|is_pinned:user %} {% translate 'Pinned' %} {% endif %}
{% block buttons %} {% block edit_button %} {% with edit_url=object.get_edit_absolute_url %} {% if edit_url and not object.is_deleted %}
{% brick_bar_button action='redirect' icon='edit' label=_('Edit') url=edit_url enabled=edit_perm comeback=True %}
{% endif %} {% endwith %} {% endblock %} {% block pin_button %}
{% if object|is_pinned:user %} {% brick_bar_button action='update' icon='pin' url='creme_core__unpin_entity'|url:object.id label=_('Unpin') %} {% else %} {% if user|has_max_pins %} {% brick_bar_button action='update' icon='pin' url='' label=_('Pin') help_text=_('You already have the maximum of pinned entities') enabled=False %} {% else %} {% brick_bar_button action='update' icon='pin' url='creme_core__pin_entity'|url:object.id label=_('Pin') help_text=_('Pin this entity to put it in the menu entry «Quick access»') %} {% endif %} {% endif %}
{% endblock %} {% block clone_button %} {% get_cloning_info entity=object user=user as cloning %} {% if cloning.enabled %}
{% if cloning.error %} {% blocktranslate asvar clone_button_label with error=cloning.error %}Cloning is forbidden ({{error}}){% endblocktranslate %} {% brick_bar_button action='' label=clone_button_label url='#' icon='clone' enabled=False %} {% else %} {% brick_bar_button action='creme_core-detailview-clone' label=cloning.label url=cloning.url __id=object.id icon='clone' confirm=_('Do you really want to clone this entity?') enabled=True %} {% endif %}
{% endif %} {% endblock %} {% block merge_button %} {% if object.entity_type|ctype_can_be_merged and not object.is_deleted %}
{% brick_bar_button action='creme_core-detailview-merge' label=_('Merge') url='creme_core__merge_entities'|url icon='merge' __id=object.id __selection_url='creme_core__select_entity_for_merge'|url enabled=edit_perm %}
{% endif %} {% endblock %} {% block restore_button %} {% if object.is_deleted %}
{% brick_bar_button action='creme_core-detailview-restore' label=_('Restore') url='creme_core__restore_entity'|url:object.id icon='restore' confirm=_('Do you really want to restore this entity?') enabled=delete_perm %}
{% endif %} {% endblock %} {% block delete_button %} {% get_deletion_info entity=object user=user as deletion %} {% if deletion.enabled %}
{% if deletion.error %} {% blocktranslate asvar del_button_label with error=deletion.error %}Deletion is forbidden ({{error}}){% endblocktranslate %} {% brick_bar_button action='creme_core-detailview-delete' label=del_button_label url='#' icon='delete' enabled=False %} {% else %} {% brick_bar_button action='creme_core-detailview-delete' label=deletion.label url=deletion.url icon='delete' confirm=deletion.confirmation enabled=True %} {% endif %}
{% endif %} {% endblock %} {% endblock buttons %}
{% endwith %} {% endblock %}