{% extends "base.html" %} {% load i18n plmapp_tags %} {% block css %} {% endblock %} {% block content %} {# lifecycle : display all states #}
{% for status, is_current_state, links in object_lifecycle %}
{{status}}
{% if not forloop.last %}
>
{% for link in links %} {{link.user.username}} {% if can_edit_signer %} {% if links|length > 1 %}
{% csrf_token %}
{% endif %} {% else %} {% if is_current_state and link.user_id in approvers %} {% trans "Approved" %} {% endif %} {% endif %}

{% endfor %} {% if can_edit_signer %} {% trans "Add" %} {% endif %}
{% endif %} {% endfor %}
{% if is_owner %} {% trans 'You have the rights of owner on this object' %} {% endif %}
{# first put error messages, then put buttons #} {% spaceless %}
{# demote #} {% if not obj.is_draft %} {% if is_signer_dm %} {% if not obj.is_proposed %}

{% trans "You can not demote this object since its state is official or more advanced." %}

{% endif %} {% else %}

{% trans "You do not have the permission to demote this object." %}

{% endif %} {% endif %} {# promote #} {% if is_signer %} {% if not is_promotable %}

{% trans "You can not promote this object:" %}

{{ obj.promotion_errors.as_ul }} {% if promote_assembly %}

{% trans "But you can try to promote the whole assembly." %}

{% endif %} {% elif not can_approve %} {% trans "You already have approved this promotion." %} {% endif %} {% else %}

{% trans "You do not have the permission to promote this object." %}

{% endif %} {# cancel #} {% if obj.is_draft and is_owner %} {% if not can_cancel %} {% with obj.get_all_revisions|length as nb_revision %} {% if nb_revision > 1 %}

{% trans "You can not cancel this object since it has more than one revision." %}

{% endif %} {% endwith %} {% if obj.has_links %}

{% trans "You can not cancel this object since it is related to another object (part, document)." %}

{% endif %} {% endif %} {% elif not is_owner %}

{% trans "You do not have the permission to cancel this object." %}

{% else %}

{% trans "You can not cancel this object since its state is more advanced than draft." %}

{% endif %}
{% endspaceless %} {% with obj.plmobject_url|add:"lifecycle/apply/" as action_url %} {# demote #} {% if is_signer_dm and obj.is_proposed %} {% confirm "demote" _("DEMOTE") _("Are you sure you want to demote this object.") %} {% endif %} {# promotion form #} {% if is_signer and can_approve and is_promotable or promote_assembly %} {% with action_name=promote_assembly|yesno:"promote_assembly,promote" %}
{% csrf_token %}

{% trans "If you promote this object, you may not be allowed to undo this action." %}

{# show the list of previous revisions that will be cancelled/deprecated #}
{% if cancelled_revisions %}

{% trans "The following revisions will be cancelled:" %}

    {% for rev in cancelled_revisions %}
  • {% blocktrans with rev.revision as revision and rev.name as name %} Revision {{ revision }} : {{ name }} {% endblocktrans %}
  • {% endfor %}
{% endif %} {% if deprecated_revisions %}

{% trans "The following revisions will be deprecated:" %}

    {% for rev in deprecated_revisions %}
  • {% blocktrans with rev.revision as revision and rev.name as name %} Revision {{ revision }} : {{ name }} {% endblocktrans %}
  • {% endfor %}
{% endif %} {% if previous_alternates %}

{% trans "The following alternate links will switch from the previous revision to the current one:" %}

    {% for part in previous_alternates %}
  • {{ part.type }} // {{part.reference }} // {{ part.revision }} // {{ part.name }}
  • {% endfor %}
{% endif %} {% if alternates and obj.is_official %}

{% trans "Current alternate links will be dropped:" %}

    {% for part in alternates %}
  • {{ part.type }} // {{part.reference }} // {{ part.revision }} // {{ part.name }}
  • {% endfor %}
{% endif %} {# TODO promote assembly #}
{{ password_form.as_p }}
{# buttons #}
{% endwith %} {% endif %} {# discard approvals #} {% if is_signer and approvers %} {% confirm "discard" _("Discard approvals") _("Warning, all signers will have to approve again the promotion.") %} {% endif %} {# cancel #} {% if can_cancel %} {% confirm "cancel" _("CANCEL") _("Warning, if you cancel this object, it won't be anymore accessible to everyone.") btn_classes="tb-btn-danger" %} {% endif %} {# publish #} {% if obj.can_publish %} {% confirm "publish" _("PUBLISH") _("Warning, if you publish this object, it will be accessible to everyone, including anonymous users.") %} {% endif %} {% if obj.published %} {# unpublish #} {% if obj.can_unpublish %} {% confirm "unpublish" _("UNPUBLISH") _("Warning, if you unpublish this object, it won't be anymore accessible to everyone.") %} {% endif %}

{% trans "This object has been published:" %} {% trans "Public link" %}

{% endif %} {% if is_owner %} {% trans "Notify" %} {% elif is_notified %}
{% csrf_token %}
{% elif can_notify %}
{% csrf_token %} {{ notify_self_form.as_p }}
{% endif %} {% endwith %} {# owner and notified users #}
{% if obj.is_official and in_group %} {% trans "Give access to a restricted account" %} {% endif %} {% include "snippets/management_block.html" with links=reader_list can_delete=in_group %} {% include "snippets/management_block.html" with links=notified_list can_delete=is_owner %} {% include "snippets/management_block.html" with links=owner_list can_delete=is_owner %}
{% endblock %}