Add edit button & server deselection on add

This commit is contained in:
gsemaj 2021-09-18 12:31:40 -04:00
parent 54f083c22d
commit 65c2914ef9
2 changed files with 15 additions and 1 deletions

View File

@ -8,6 +8,8 @@ var serverarray
function enableServerListButtons() { function enableServerListButtons() {
$('#of-connect-button').removeClass('disabled'); $('#of-connect-button').removeClass('disabled');
$('#of-connect-button').prop('disabled', false); $('#of-connect-button').prop('disabled', false);
$('#of-editserver-button').removeClass('disabled');
$('#of-editserver-button').prop('disabled', false);
$('#of-deleteserver-button').removeClass('disabled'); $('#of-deleteserver-button').removeClass('disabled');
$('#of-deleteserver-button').prop('disabled', false); $('#of-deleteserver-button').prop('disabled', false);
} }
@ -15,6 +17,8 @@ function enableServerListButtons() {
function disableServerListButtons() { function disableServerListButtons() {
$('#of-connect-button').addClass('disabled'); $('#of-connect-button').addClass('disabled');
$('#of-connect-button').prop('disabled', true); $('#of-connect-button').prop('disabled', true);
$('#of-editserver-button').addClass('disabled');
$('#of-editserver-button').prop('disabled', true);
$('#of-deleteserver-button').addClass('disabled'); $('#of-deleteserver-button').addClass('disabled');
$('#of-deleteserver-button').prop('disabled', true); $('#of-deleteserver-button').prop('disabled', true);
} }
@ -168,6 +172,12 @@ function connectToServer() {
}); });
} }
// If applicable, deselect currently selected server.
function deselectServer() {
disableServerListButtons();
$(".server-listing-entry").removeClass('bg-primary');
}
$('#server-table').on('click', '.server-listing-entry', function(event) { $('#server-table').on('click', '.server-listing-entry', function(event) {
enableServerListButtons(); enableServerListButtons();
$(this).addClass('bg-primary').siblings().removeClass('bg-primary'); $(this).addClass('bg-primary').siblings().removeClass('bg-primary');

View File

@ -39,7 +39,11 @@
</div> </div>
</div> </div>
<div class="row row-cols-2 d-xl-flex justify-content-center justify-content-xl-center" id="of-serverbuttons" style="padding-bottom: 16px;"> <div class="row row-cols-2 d-xl-flex justify-content-center justify-content-xl-center" id="of-serverbuttons" style="padding-bottom: 16px;">
<div class="col-4 text-left d-inline-flex justify-content-xl-start"><button class="btn btn-success mr-1" data-toggle="modal" data-bs-tooltip="" data-placement="bottom" id="of-addserver-button" type="button" title="Add Server" data-target="#of-addservermodal"><i class="fas fa-plus"></i></button><button class="btn btn-danger disabled" data-toggle="modal" data-bs-tooltip="" data-placement="bottom" id="of-deleteserver-button" type="button" title="Delete Server" data-target="#of-deleteservermodal" disabled=""><i class="fas fa-trash-alt"></i></button></div> <div class="col-4 text-left d-inline-flex justify-content-xl-start">
<button class="btn btn-success mr-1" data-toggle="modal" data-bs-tooltip="" data-placement="bottom" id="of-addserver-button" type="button" title="Add Server" data-target="#of-addservermodal" onclick="deselectServer()"><i class="fas fa-plus"></i></button>
<button class="btn btn-primary mr-1 disabled" data-toggle="modal" data-bs-tooltip="" data-placement="bottom" id="of-editserver-button" type="button" title="Edit Server" data-target="#of-addservermodal" disabled=""><i class="fas fa-edit"></i></button>
<button class="btn btn-danger disabled" data-toggle="modal" data-bs-tooltip="" data-placement="bottom" id="of-deleteserver-button" type="button" title="Delete Server" data-target="#of-deleteservermodal" disabled=""><i class="fas fa-trash-alt"></i></button>
</div>
<div class="col-4 d-inline-flex justify-content-end"><button class="btn btn-primary disabled" id="of-connect-button" type="button" onclick="connectToServer()" disabled="">Connect&nbsp;<i class="fas fa-angle-double-right"></i></button></div> <div class="col-4 d-inline-flex justify-content-end"><button class="btn btn-primary disabled" id="of-connect-button" type="button" onclick="connectToServer()" disabled="">Connect&nbsp;<i class="fas fa-angle-double-right"></i></button></div>
</div> </div>
</div> </div>