{% 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/json_format.html' %}
                </div>
                <div class="panel-body">
                    {% include 'extras/inc/json_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 Config Context</strong>
                </div>
                <div class="panel-body">
                    {% if object.local_config_context_data %}
                        {% if object.local_config_context_schema %}
                            <span>Schema {{ object.local_config_context_schema|hyperlinked_object }}</span>
                        {% endif %}
                        {% if object.local_config_context_data_owner %}
                            Owned by <strong>{{ object.local_config_context_data_owner|hyperlinked_object }}</strong>
                        {% endif %}
                        {% include 'extras/inc/json_data.html' with data=object.local_config_context_data format=format %}
                    {% else %}
                        <span class="text-muted">None</span>
                    {% endif %}
                </div>
                <div class="panel-footer">
                    <span class="help-block">
                        <i class="mdi mdi-information-outline"></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>
                        {{ context|hyperlinked_object }}
                        {% if context.description %}
                            <br /><small>{{ context.description }}</small>
                        {% endif %}
                        {% include 'extras/inc/json_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 %}
