Skip to content

Commit f13c61a

Browse files
committed
15148 add copy button to config context
1 parent 88f2735 commit f13c61a

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{% load helpers %}
22

33
<div class="rendered-context-data">
4-
<pre class="block">{% if format == 'json' %}{{ data|json }}{% elif format == 'yaml' %}{{ data|yaml }}{% else %}{{ data }}{% endif %}</pre>
4+
<pre class="block" {% if copyid %}id="{{ copyid }}{% endif %}">{% if format == 'json' %}{{ data|json }}{% elif format == 'yaml' %}{{ data|yaml }}{% else %}{{ data }}{% endif %}</pre>
55
</div>

netbox/templates/extras/inc/configcontext_format.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
<div class="float-end">
2+
{% if copyid %}
3+
{% copy_content copyid %}
4+
{% endif %}
25
<div class="btn-group btn-group-sm" role="group">
36
<a href="?format=json" type="button" class="btn btn-outline-dark{% if format == 'json' %} active{% endif %}">JSON</a>
47
<a href="?format=yaml" type="button" class="btn btn-outline-dark{% if format == 'yaml' %} active{% endif %}">YAML</a>

netbox/templates/extras/object_configcontext.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
<div class="card">
1010
<h5 class="card-header">
1111
{% trans "Rendered Context" %}
12-
{% include 'extras/inc/configcontext_format.html' %}
12+
{% include 'extras/inc/configcontext_format.html' with copyid="rendered_context" %}
1313
</h5>
1414
<div class="card-body">
15-
{% include 'extras/inc/configcontext_data.html' with data=rendered_context format=format %}
15+
{% include 'extras/inc/configcontext_data.html' with data=rendered_context format=format copyid="rendered_context" %}
1616
</div>
1717
</div>
1818
</div>

0 commit comments

Comments
 (0)