mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
15148 add copy button to config context (#15954)
* 15148 add copy button to config context * Merge configcontext_format.html into configcontext_data.html --------- Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
This commit is contained in:
@@ -1,5 +1,17 @@
|
||||
{% load helpers %}
|
||||
{% load i18n %}
|
||||
|
||||
<div class="rendered-context-data mt-1">
|
||||
<pre class="block">{% if format == 'json' %}{{ data|json }}{% elif format == 'yaml' %}{{ data|yaml }}{% else %}{{ data }}{% endif %}</pre>
|
||||
{% if title %}
|
||||
<h5 class="card-header d-flex justify-content-between">
|
||||
{% trans title %}
|
||||
<div>
|
||||
{% if copyid %}{% copy_content copyid %}{% endif %}
|
||||
{% include 'extras/inc/format_toggle.html' %}
|
||||
</div>
|
||||
</h5>
|
||||
{% endif %}
|
||||
<div class="card-body">
|
||||
<div class="rendered-context-data mt-1">
|
||||
<pre class="block" {% if copyid %}id="{{ copyid }}{% endif %}">{% if format == 'json' %}{{ data|json }}{% elif format == 'yaml' %}{{ data|yaml }}{% else %}{{ data }}{% endif %}</pre>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -1,6 +0,0 @@
|
||||
<div>
|
||||
<div class="btn-group btn-group-sm" role="group">
|
||||
<a href="?format=json" type="button" class="btn btn-outline-dark{% if format == 'json' %} active{% endif %}">JSON</a>
|
||||
<a href="?format=yaml" type="button" class="btn btn-outline-dark{% if format == 'yaml' %} active{% endif %}">YAML</a>
|
||||
</div>
|
||||
</div>
|
4
netbox/templates/extras/inc/format_toggle.html
Normal file
4
netbox/templates/extras/inc/format_toggle.html
Normal file
@@ -0,0 +1,4 @@
|
||||
<div class="btn-group btn-group-sm" role="group">
|
||||
<a href="?format=json" type="button" class="btn btn-outline-dark{% if format == 'json' %} active{% endif %}">JSON</a>
|
||||
<a href="?format=yaml" type="button" class="btn btn-outline-dark{% if format == 'yaml' %} active{% endif %}">YAML</a>
|
||||
</div>
|
Reference in New Issue
Block a user