{% extends base_template %}
{% load helpers %}
{% load static %}
{% load i18n %}

{% block content %}
    <div class="row">
        <div class="col col-md-6">
            <div class="card">
                <h5 class="card-header d-flex justify-content-between">
                    {% trans "Rendered Context" %}
                    {% include 'extras/inc/configcontext_format.html' %}
                </h5>
                <div class="card-body">
                    {% include 'extras/inc/configcontext_data.html' with data=rendered_context format=format %}
                </div>
            </div>
        </div>
        <div class="col col-md-6">
            <div class="card">
                <h5 class="card-header">
                    {% trans "Local Context" %}
                </h5>
                <div class="card-body">
                    {% if object.local_context_data %}
                        {% include 'extras/inc/configcontext_data.html' with data=object.local_context_data format=format %}
                    {% else %}
                        <span class="text-muted">{% trans "None" %}</span>
                    {% endif %}
                </div>
                <div class="card-footer">
                    <span class="help-block">
                        <i class="mdi mdi-information-outline"></i>
                        {% trans "The local config context overwrites all source contexts" %}.
                    </span>
                </div>
            </div>
            <div class="card">
                <h5 class="card-header">
                    {% trans "Source Contexts" %}
                </h5>
                {% for context in source_contexts %}
                    <div class="card-body">
                        <div class="float-end">
                            <span class="text-muted">{{ context.weight }}</span>
                        </div>
                        <strong>{{ context|linkify:"name" }}</strong>
                        {% if context.description %}
                            <br /><small>{{ context.description }}</small>
                        {% endif %}
                        {% include 'extras/inc/configcontext_data.html' with data=context.data format=format %}
                    </div>
                {% empty %}
                    <div class="card-body">
                        <span class="text-muted">{% trans "None found" %}</span>
                    </div>
                {% endfor %}
            </div>
        </div>
    </div>
{% endblock %}
