Closes #4421: Retain user's preference for config context format

This commit is contained in:
Jeremy Stretch
2020-04-24 12:01:41 -04:00
parent f019c8d2ce
commit bdbf21b3e2
7 changed files with 26 additions and 32 deletions

View File

@@ -215,13 +215,9 @@
{% include 'extras/inc/configcontext_format.html' %}
</div>
<div class="panel-body">
{% include 'extras/inc/configcontext_data.html' with data=configcontext.data %}
{% include 'extras/inc/configcontext_data.html' with data=configcontext.data format=format %}
</div>
</div>
</div>
</div>
{% endblock %}
{% block javascript %}
<script src="{% static 'js/configcontext.js' %}?v{{ settings.VERSION }}"></script>
{% endblock %}

View File

@@ -1,8 +1,5 @@
{% load helpers %}
<div class="rendered-context-data" data-format="json">
<pre>{{ data|render_json }}</pre>
</div>
<div class="rendered-context-data" data-format="yaml" style="display: none;">
<pre>{{ data|render_yaml }}</pre>
<div class="rendered-context-data">
<pre>{% if format == 'json' %}{{ data|render_json }}{% elif format == 'yaml' %}{{ data|render_yaml }}{% else %}{{ data }}{% endif %}</pre>
</div>

View File

@@ -1,6 +1,6 @@
<div class="pull-right">
<div class="btn-group btn-group-xs" role="group">
<span class="btn btn-default rendered-context-format active" data-format="json">JSON</span>
<span class="btn btn-default rendered-context-format" data-format="yaml">YAML</span>
<a href="?format=json" class="btn btn-default{% if format == 'json' %} active{% endif %}">JSON</a>
<a href="?format=yaml" class="btn btn-default{% if format == 'yaml' %} active{% endif %}">YAML</a>
</div>
</div>

View File

@@ -13,7 +13,7 @@
{% include 'extras/inc/configcontext_format.html' %}
</div>
<div class="panel-body">
{% include 'extras/inc/configcontext_data.html' with data=rendered_context %}
{% include 'extras/inc/configcontext_data.html' with data=rendered_context format=format %}
</div>
</div>
</div>
@@ -24,7 +24,7 @@
</div>
<div class="panel-body">
{% if obj.local_context_data %}
{% include 'extras/inc/configcontext_data.html' with data=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 %}
@@ -49,7 +49,7 @@
{% if context.description %}
<br /><small>{{ context.description }}</small>
{% endif %}
{% include 'extras/inc/configcontext_data.html' with data=context.data %}
{% include 'extras/inc/configcontext_data.html' with data=context.data format=format %}
</div>
{% empty %}
<div class="panel-body">
@@ -60,7 +60,3 @@
</div>
</div>
{% endblock %}
{% block javascript %}
<script src="{% static 'js/configcontext.js' %}?v{{ settings.VERSION }}"></script>
{% endblock %}