{% extends base_template %}
{% load helpers %}

{% block title %}{{ block.super }} - Config Context{% endblock %}

{% block content %}
    <div class="row">
        <div class="col-md-6">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <strong>Rendered Context</strong>
                </div>
                <div class="panel-body">
                    <pre>{{ rendered_context|render_json }}</pre>
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <strong>Local Context</strong>
                </div>
                <div class="panel-body">
                    {% if obj.local_context_data %}
                        <pre>{{ obj.local_context_data|render_json }}</pre>
                    {% else %}
                        <span class="text-muted">None</span>
                    {% endif %}
                </div>
                <div class="panel-footer">
                    <span class="help-block">
                        <i class="fa fa-info-circle"></i>
                        The local config context overwrites all source contexts.
                    </span>
                </div>
            </div>
            <div class="panel panel-default">
                <div class="panel-heading">
                    <strong>Source Contexts</strong>
                </div>
                {% for context in source_contexts %}
                    <div class="panel-body">
                        <div class="pull-right">
                            <span class="text-muted">{{ context.weight }}</span>
                        </div>
                        <a href="{{ context.get_absolute_url }}"><strong>{{ context.name }}</strong></a>
                        {% if context.description %}
                            <br /><small>{{ context.description }}</small>
                        {% endif %}
                        <pre>{{ context.data|render_json }}</pre>
                    </div>
                {% empty %}
                    <div class="panel-body">
                        <span class="text-muted">None found</span>
                    </div>
                {% endfor %}
            </div>
        </div>
    </div>
{% endblock %}
