Updating label of buttons

This commit is contained in:
Jeroen De Meerleer 2021-05-19 13:41:29 +02:00
parent d636160751
commit 3e5e46e7cb
Signed by: JeroenED
GPG Key ID: 28CCCB8F62BFADD6
2 changed files with 8 additions and 2 deletions

View File

@ -17,6 +17,7 @@ function initCronType()
{
$('.crontype-item').on('click', function() {
let type = $(this).data('type');
$('#crontypeButton').html($(this).html());
$('.crontype').val(type);
$('.crontype-inputs:not(.hidden)').addClass('hidden');
$('.crontype-' + type).removeClass('hidden');
@ -28,6 +29,9 @@ function initCronType()
$('.croncategory-group').addClass('btn-group');
$('.hosttype-group').removeClass('hidden');
} else {
let hosttypebtn = $('#hosttypeButton')
hosttypebtn.html(hosttypebtn.data('default-text'))
$('.croncategory-group').removeClass('btn-group');
$('.hosttype-group').addClass('hidden');
$('.hosttype-inputs').addClass('hidden');
@ -40,6 +44,8 @@ function initCronType()
function initHostType()
{
$('.hosttype-item').on('click', function() {
$('#hosttypeButton').html($(this).html());
let type = $(this).data('type');
$('.hosttype').val(type);
$('.hosttype-inputs:not(.hidden)').addClass('hidden');

View File

@ -39,7 +39,7 @@
<h3>Job details</h3>
<div class="mb-3 btn-group">
<div class="dropdown croncategory-group crontype-group">
<button class="btn btn-outline-primary dropdown-toggle" type="button" id="crontypeButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<button class="btn btn-outline-primary dropdown-toggle" data-default-text="Job type" type="button" id="crontypeButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Job type
</button>
<div class="dropdown-menu" aria-labelledby="crontypeButton">
@ -49,7 +49,7 @@
</div>
</div>
<div class="dropdown croncategory-group hidden hosttype-group">
<button class="btn btn-outline-primary dropdown-toggle" type="button" id="hosttypeButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<button class="btn btn-outline-primary dropdown-toggle" data-default-text="Host type" type="button" id="hosttypeButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Host type
</button>
<div class="dropdown-menu" aria-labelledby="hosttypeButton">