mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-29 19:13:49 +00:00
Updated the breadcrumb macro's parameters to accept `entity_workflow` directly instead of a context object. This change affects the index, list, and macro_breadcrumb templates, ensuring consistent parameter usage and improving readability. This avoid exploiting a bug which was solved in twig 3.15.0
85 lines
4.3 KiB
Twig
85 lines
4.3 KiB
Twig
{% macro popoverContent(step) %}
|
|
<ul class="small_in_title">
|
|
{% if step.previous is not null %}
|
|
<li>
|
|
<span class="item-key">{{ 'By'|trans ~ ' : ' }}</span>
|
|
<b>{% if step.previous.transitionBy is not null %}{{ step.previous.transitionBy|chill_entity_render_box({'at_date': step.previous.transitionAt }) }}{% else %}<span class="chill-no-data-statement">{{ 'workflow.Automated transition'|trans }}</span>{% endif %}</b>
|
|
</li>
|
|
<li>
|
|
<span class="item-key">{{ 'Le'|trans ~ ' : ' }}</span>
|
|
<b>{{ step.previous.transitionAt|format_datetime('short', 'short') }}</b>
|
|
</li>
|
|
{% if step.destUser|length > 0 or step.destUserGroups|length > 0 %}
|
|
<li>
|
|
<span class="item-key">{{ 'workflow.For'|trans ~ ' : ' }}</span>
|
|
<b>
|
|
{% for d in step.destUser %}<span class="badge-user">{{ d|chill_entity_render_string({'at_date': step.previous.transitionAt}) }}</span>{% if not loop.last %}, {% endif -%}{% endfor -%}
|
|
{%- if step.destUser|length > 0 and step.destUserGroups|length > 0 %}, {% endif -%}
|
|
{%- for d in step.destUserGroups %}{{ d|chill_entity_render_box }}{% if not loop.last %}, {% endif %}{% endfor -%}
|
|
</b>
|
|
</li>
|
|
{% endif %}
|
|
{% if step.ccUser|length > 0 %}
|
|
<li>
|
|
<span class="item-key">{{ 'workflow.Cc'|trans ~ ' : ' }}</span>
|
|
<b>
|
|
{% for u in step.ccUser %}{{ u|chill_entity_render_string({'at_date': step.previous.transitionAt }) }}{% if not loop.last %}, {% endif %}{% endfor %}
|
|
</b>
|
|
</li>
|
|
{% endif %}
|
|
{% else %}
|
|
<li>
|
|
<span class="item-key">{{ 'workflow.Created by'|trans ~ ' : ' }}</span>
|
|
<b>{{ step.entityWorkflow.createdBy|chill_entity_render_box({'at_date': step.entityWorkflow.createdAt }) }}</b>
|
|
</li>
|
|
<li>
|
|
<span class="item-key">{{ 'Le'|trans ~ ' : ' }}</span>
|
|
<b>{{ step.entityWorkflow.createdAt|format_datetime('short', 'short') }}</b>
|
|
</li>
|
|
{% endif %}
|
|
</ul>
|
|
{% endmacro %}
|
|
|
|
{% macro popoverTitle(step) %}
|
|
{% if step.previous is not null and step.previous.freezeAfter == true %}
|
|
<i class="fa fa-snowflake-o fa-sm me-1" title="{{ 'workflow.Freezed'|trans }}"></i>
|
|
{% endif %}
|
|
{% if step.previous is not null %}
|
|
{% set transition = chill_workflow_transition_by_string(step.entityWorkflow, step.previous.transitionAfter) %}
|
|
{% set labels = workflow_metadata(step.entityWorkflow, 'label', transition, step.entityWorkflow.workflowName) %}
|
|
{% set label = labels is null ? step.previous.transitionAfter : labels|localize_translatable_string %}
|
|
{{ label }}
|
|
{% endif %}
|
|
{% endmacro %}
|
|
|
|
{% macro breadcrumb(entity_workflow) %}
|
|
<div class="breadcrumb">
|
|
{% for step in entity_workflow.stepsChained %}
|
|
{% set labels = workflow_metadata(entity_workflow, 'label', step.currentStep, entity_workflow.workflowName) %}
|
|
{% set label = labels is null ? step.currentStep : labels|localize_translatable_string %}
|
|
{% set popTitle = _self.popoverTitle(step) %}
|
|
{% set popContent = _self.popoverContent(step) %}
|
|
<span class="mx-2"
|
|
tabindex="0"
|
|
data-bs-trigger="focus hover"
|
|
data-bs-toggle="popover"
|
|
data-bs-placement="bottom"
|
|
data-bs-custom-class="workflow-transition"
|
|
title="{{ popTitle|e('html_attr') }}"
|
|
data-bs-content="{{ popContent|e('html_attr') }}"
|
|
>
|
|
{% if step.currentStep == 'initial' %}
|
|
<i class="fa fa-circle me-1 text-chill-yellow"></i>
|
|
{% endif %}
|
|
{% if step.previous is not null and step.previous.freezeAfter == true %}
|
|
<i class="fa fa-snowflake-o fa-sm me-1" title="{{ 'workflow.Freezed'|trans }}"></i>
|
|
{% endif %}
|
|
{{ label }}
|
|
</span>
|
|
{% if not loop.last %}
|
|
→
|
|
{% endif %}
|
|
{% endfor %}
|
|
</div>
|
|
{% endmacro %}
|