{% comment %} FSM Status Badge with Actions Partial Template Displays current status badge alongside available transition buttons. Combines status display with action capabilities for a cohesive UX. Required context: - object: The FSM-enabled model instance - user: The current user (usually request.user) Optional context: - target_id: The ID of the element to swap after transition - show_badge: Whether to show the status badge (defaults to true) - badge_only: Only show the badge, no actions (defaults to false) - dropdown_actions: Show actions in a dropdown menu (defaults to false) - compact: Use compact layout (defaults to false) {% endcomment %} {% load fsm_tags %} {% get_available_transitions object user as transitions %}
{% if show_badge|default:True %} {% with choice=object|get_state_choice %} {% if choice and choice.metadata.icon %} {% else %} {% with status=object|get_state_value %} {% endwith %} {% endif %} {% endwith %} {{ object|get_state_display }} {% endif %} {% if not badge_only %} {% if transitions %} {% if dropdown_actions %}
{% for transition in transitions %} {% endfor %}
{% else %}
{% for transition in transitions %} {% endfor %}
{% endif %} {% endif %} {% endif %}