Fixes #4306: Fix toggling of device images for all racks in elevations view

This commit is contained in:
Jeremy Stretch 2020-03-03 10:04:35 -05:00
parent 7b6bd75c22
commit 78a1aad6c0
3 changed files with 6 additions and 8 deletions

View File

@ -16,6 +16,7 @@
* [#4295](https://github.com/netbox-community/netbox/issues/4295) - Fix assignment of parent LAG during interface bulk edit * [#4295](https://github.com/netbox-community/netbox/issues/4295) - Fix assignment of parent LAG during interface bulk edit
* [#4300](https://github.com/netbox-community/netbox/issues/4300) - Pass "commit" argument when executing scripts via REST API * [#4300](https://github.com/netbox-community/netbox/issues/4300) - Pass "commit" argument when executing scripts via REST API
* [#4301](https://github.com/netbox-community/netbox/issues/4301) - Fix exception when deleting device type with components * [#4301](https://github.com/netbox-community/netbox/issues/4301) - Fix exception when deleting device type with components
* [#4306](https://github.com/netbox-community/netbox/issues/4306) - Fix toggling of device images for all racks in elevations view
--- ---

View File

@ -1,14 +1,11 @@
// Toggle the display of device images within an SVG rack elevation // Toggle the display of device images within an SVG rack elevation
$('button.toggle-images').click(function() { $('button.toggle-images').click(function() {
var selected = $(this).attr('selected'); var selected = $(this).attr('selected');
var rack_front = $("#rack_front"); var rack_elevation = $(".rack_elevation");
var rack_rear = $("#rack_rear");
if (selected) { if (selected) {
$('.device-image', rack_front.contents()).addClass('hidden'); $('.device-image', rack_elevation.contents()).addClass('hidden');
$('.device-image', rack_rear.contents()).addClass('hidden');
} else { } else {
$('.device-image', rack_front.contents()).removeClass('hidden'); $('.device-image', rack_elevation.contents()).removeClass('hidden');
$('.device-image', rack_rear.contents()).removeClass('hidden');
} }
$(this).attr('selected', !selected); $(this).attr('selected', !selected);
$(this).children('span').toggleClass('glyphicon-check glyphicon-unchecked'); $(this).children('span').toggleClass('glyphicon-check glyphicon-unchecked');

View File

@ -1,6 +1,6 @@
<object data="{% url 'dcim-api:rack-elevation' pk=rack.pk %}?face={{face}}&render=svg" id="rack_{{ face }}"></object> <object data="{% url 'dcim-api:rack-elevation' pk=rack.pk %}?face={{face}}&render=svg" class="rack_elevation"></object>
<div class="text-center text-small"> <div class="text-center text-small">
<a href="{% url 'dcim-api:rack-elevation' pk=rack.pk %}?face={{face}}&render=svg" id="rack_{{ face }}"> <a href="{% url 'dcim-api:rack-elevation' pk=rack.pk %}?face={{face}}&render=svg">
<i class="fa fa-download"></i> Save SVG <i class="fa fa-download"></i> Save SVG
</a> </a>
</div> </div>