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

{% 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>
                    {% include 'extras/inc/configcontext_format.html' %}
                </div>
                <div class="panel-body">
                    {% include 'extras/inc/configcontext_data.html' with data=rendered_context format=format %}
                </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 %}
                        {% include 'extras/inc/configcontext_data.html' with data=obj.local_context_data format=format %}
                    {% 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 %}
                        {% include 'extras/inc/configcontext_data.html' with data=context.data format=format %}
                    </div>
                {% empty %}
                    <div class="panel-body">
                        <span class="text-muted">None found</span>
                    </div>
                {% endfor %}
            </div>
        </div>
    </div>
{% endblock %}
