mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Fix API JS to read response.results for new API
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
// "Toggle all" checkbox (table header)
|
// "Toggle all" checkbox (table header)
|
||||||
$('#toggle_all').click(function (event) {
|
$('#toggle_all').click(function() {
|
||||||
$('td input:checkbox[name=pk]').prop('checked', $(this).prop('checked'));
|
$('td input:checkbox[name=pk]').prop('checked', $(this).prop('checked'));
|
||||||
if ($(this).is(':checked')) {
|
if ($(this).is(':checked')) {
|
||||||
$('#select_all_box').removeClass('hidden');
|
$('#select_all_box').removeClass('hidden');
|
||||||
@ -10,7 +10,7 @@ $(document).ready(function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
// Enable hidden buttons when "select all" is checked
|
// Enable hidden buttons when "select all" is checked
|
||||||
$('#select_all').click(function (event) {
|
$('#select_all').click(function() {
|
||||||
if ($(this).is(':checked')) {
|
if ($(this).is(':checked')) {
|
||||||
$('#select_all_box').find('button').prop('disabled', '');
|
$('#select_all_box').find('button').prop('disabled', '');
|
||||||
} else {
|
} else {
|
||||||
@ -25,7 +25,7 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Simple "Toggle all" button (panel)
|
// Simple "Toggle all" button (panel)
|
||||||
$('button.toggle').click(function (event) {
|
$('button.toggle').click(function() {
|
||||||
var selected = $(this).attr('selected');
|
var selected = $(this).attr('selected');
|
||||||
$(this).closest('form').find('input:checkbox[name=pk]').prop('checked', !selected);
|
$(this).closest('form').find('input:checkbox[name=pk]').prop('checked', !selected);
|
||||||
$(this).attr('selected', !selected);
|
$(this).attr('selected', !selected);
|
||||||
@ -55,7 +55,7 @@ $(document).ready(function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Bulk edit nullification
|
// Bulk edit nullification
|
||||||
$('input:checkbox[name=_nullify]').click(function (event) {
|
$('input:checkbox[name=_nullify]').click(function() {
|
||||||
$('#id_' + this.value).toggle('disabled');
|
$('#id_' + this.value).toggle('disabled');
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ $(document).ready(function() {
|
|||||||
url: api_url,
|
url: api_url,
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function(response, status) {
|
success: function(response, status) {
|
||||||
$.each(response, function (index, choice) {
|
$.each(response.results, function(index, choice) {
|
||||||
var option = $("<option></option>").attr("value", choice.id).text(choice[display_field]);
|
var option = $("<option></option>").attr("value", choice.id).text(choice[display_field]);
|
||||||
if (disabled_indicator && choice[disabled_indicator] && choice.id != initial_value) {
|
if (disabled_indicator && choice[disabled_indicator] && choice.id != initial_value) {
|
||||||
option.attr("disabled", "disabled");
|
option.attr("disabled", "disabled");
|
||||||
|
Reference in New Issue
Block a user