mirror of
https://github.com/pi-hole/web.git
synced 2024-12-06 19:36:21 +01:00
Use toggle for Enabled/Disabled switch
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
@@ -63,11 +63,10 @@ $(document).ready(function() {
|
||||
"rowCallback": function( row, data ) {
|
||||
$('td:eq(0)', row).html( '<code>'+data["address"]+'</code>' );
|
||||
|
||||
|
||||
const disabled = data["enabled"] === 0;
|
||||
$('td:eq(1)', row).html( '<select id="status" class="form-control">'+
|
||||
'<option value="0"'+(disabled?' selected':'')+'>Disabled</option>'+
|
||||
'<option value="1"'+(disabled?'':' selected')+'>Enabled</option>'+
|
||||
'</select>' );
|
||||
$('td:eq(1)', row).html( '<input type="checkbox" id="status"'+(disabled?'':' checked')+'>');
|
||||
$('#status', row).bootstrapToggle({ on: 'Enabled', off: 'Disabled', size: 'small', onstyle: "success", width: "80px" });
|
||||
|
||||
$('td:eq(2)', row).html( '<input id="comment" class="form-control"><input id="id" type="hidden" value="'+data["id"]+'">' );
|
||||
$('#comment', row).val(data["comment"]);
|
||||
|
||||
@@ -157,7 +157,7 @@ function addClient()
|
||||
function editClient()
|
||||
{
|
||||
var tr = $(this).closest("tr");
|
||||
var id = tr.find("td:eq(0)").html();
|
||||
var id = tr.find("#id").val();
|
||||
var groups = tr.find("#multiselect").val();
|
||||
|
||||
showAlert('info');
|
||||
|
||||
@@ -72,10 +72,8 @@ $(document).ready(function() {
|
||||
'</select>' );
|
||||
|
||||
const disabled = data["enabled"] === 0;
|
||||
$('td:eq(2)', row).html( '<select id="status" class="form-control">'+
|
||||
'<option value="0"'+(disabled?' selected':'')+'>Disabled</option>'+
|
||||
'<option value="1"'+(disabled?'':' selected')+'>Enabled</option>'+
|
||||
'</select>' );
|
||||
$('td:eq(2)', row).html( '<input type="checkbox" id="status"'+(disabled?'':' checked')+'>');
|
||||
$('#status', row).bootstrapToggle({ on: 'Enabled', off: 'Disabled', size: 'small', onstyle: "success", width: "80px" });
|
||||
|
||||
$('td:eq(3)', row).html( '<input id="comment" class="form-control"><input id="id" type="hidden" value="'+data["id"]+'">' );
|
||||
$('#comment', row).val(data["comment"]);
|
||||
|
||||
@@ -41,10 +41,8 @@ $(document).ready(function() {
|
||||
},
|
||||
"rowCallback": function( row, data ) {
|
||||
const disabled = data["enabled"] === 0;
|
||||
$('td:eq(1)', row).html( '<select id="status" class="form-control">'+
|
||||
'<option value="0"'+(disabled?' selected':'')+'>Disabled</option>'+
|
||||
'<option value="1"'+(disabled?'':' selected')+'>Enabled</option>'+
|
||||
'</select>' );
|
||||
$('td:eq(1)', row).html( '<input type="checkbox" id="status"'+(disabled?'':' checked')+'>');
|
||||
$('#status', row).bootstrapToggle({ on: 'Enabled', off: 'Disabled', size: 'small', onstyle: "success", width: "80px" });
|
||||
|
||||
$('td:eq(2)', row).html( '<input id="name" class="form-control">' );
|
||||
$('#name', row).val( data["name"] );
|
||||
|
||||
@@ -219,9 +219,11 @@
|
||||
<script src="style/vendor/bootstrap/js/bootstrap.min.js"></script>
|
||||
<script src="scripts/vendor/app.min.js"></script>
|
||||
|
||||
<?php if(in_array($scriptname, array("groups-clients.php", "groups-domains.php", "groups-adlists.php"))){ ?>
|
||||
<?php if(in_array($scriptname, array("groups.php", "groups-clients.php", "groups-domains.php", "groups-adlists.php"))){ ?>
|
||||
<script src="style/vendor/bootstrap/js/bootstrap-multiselect.js"></script>
|
||||
<link rel="stylesheet" href="style/vendor/bootstrap/css/bootstrap-multiselect.css">
|
||||
<script src="style/vendor/bootstrap/js/bootstrap-toggle.min.js"></script>
|
||||
<link rel="stylesheet" href="style/vendor/bootstrap/css/bootstrap-toggle.min.css">
|
||||
<?php } ?>
|
||||
|
||||
<script src="scripts/vendor/jquery.dataTables.min.js"></script>
|
||||
|
||||
Reference in New Issue
Block a user