Setup: Automatically check the respective admin account type selection
resolves #8603
This commit is contained in:
parent
c0deeefe00
commit
cddcde9494
|
@ -20,12 +20,12 @@ $showRadioBoxes = strpos(strtolower(get_class($radioElem)), 'radio') !== false;
|
|||
<?php if (($byNameElem = $form->getElement('by_name')) !== null): ?>
|
||||
<div>
|
||||
<div class="instructions">
|
||||
<?= $byNameElem; ?>
|
||||
<?= $showRadioBoxes ? $byNameElem->setAttrib('data-related-radiobtn', 'by_name') : $byNameElem; ?>
|
||||
</div>
|
||||
<?php if ($showRadioBoxes): ?>
|
||||
<div class="radiobox">
|
||||
<label>
|
||||
<input type="radio" name="user_type" value="by_name"<?= $radioElem->getValue() === 'by_name' ? ' checked' : ''; ?> class="autosubmit" aria-required="true" required>
|
||||
<input type="radio" id="by_name" name="user_type" value="by_name"<?= $radioElem->getValue() === 'by_name' ? ' checked' : ''; ?> class="autosubmit" aria-required="true" required>
|
||||
<?= $radioElem->getMultiOption('by_name'); ?>
|
||||
</label>
|
||||
</div>
|
||||
|
@ -35,12 +35,12 @@ $showRadioBoxes = strpos(strtolower(get_class($radioElem)), 'radio') !== false;
|
|||
<?php if (($existingUserElem = $form->getElement('existing_user')) !== null): ?>
|
||||
<div>
|
||||
<div class="instructions">
|
||||
<?= $existingUserElem; ?>
|
||||
<?= $showRadioBoxes ? $byNameElem->setAttrib('data-related-radiobtn', 'existing_user') : $existingUserElem; ?>
|
||||
</div>
|
||||
<?php if ($showRadioBoxes): ?>
|
||||
<div class="radiobox">
|
||||
<label>
|
||||
<input type="radio" name="user_type" value="existing_user"<?= $radioElem->getValue() === 'existing_user' ? ' checked' : ''; ?> class="autosubmit" aria-required="true" required>
|
||||
<input type="radio" id="existing_user" name="user_type" value="existing_user"<?= $radioElem->getValue() === 'existing_user' ? ' checked' : ''; ?> class="autosubmit" aria-required="true" required>
|
||||
<?= $radioElem->getMultiOption('existing_user'); ?>
|
||||
</label>
|
||||
</div>
|
||||
|
@ -50,14 +50,14 @@ $showRadioBoxes = strpos(strtolower(get_class($radioElem)), 'radio') !== false;
|
|||
<?php if (($newUserElem = $form->getElement('new_user')) !== null): ?>
|
||||
<div>
|
||||
<div class="instructions">
|
||||
<?= $newUserElem; ?>
|
||||
<?= $showRadioBoxes ? $newUserElem->setAttrib('data-related-radiobtn', 'new_user') : $newUserElem; ?>
|
||||
<?= $form->getElement('new_user_password'); ?>
|
||||
<?= $form->getElement('new_user_2ndpass'); ?>
|
||||
</div>
|
||||
<?php if ($showRadioBoxes): ?>
|
||||
<div class="radiobox">
|
||||
<label>
|
||||
<input type="radio" name="user_type" value="new_user"<?= $radioElem->getValue() === 'new_user' ? ' checked' : ''; ?> class="autosubmit" aria-required="true" required>
|
||||
<input type="radio" id="new_user" name="user_type" value="new_user"<?= $radioElem->getValue() === 'new_user' ? ' checked' : ''; ?> class="autosubmit" aria-required="true" required>
|
||||
<?= $radioElem->getMultiOption('new_user'); ?>
|
||||
</label>
|
||||
</div>
|
||||
|
|
|
@ -125,6 +125,10 @@
|
|||
$(document).on('change', 'form select.autosubmit', { self: this }, this.autoSubmitForm);
|
||||
$(document).on('change', 'form input.autosubmit', { self: this }, this.autoSubmitForm);
|
||||
|
||||
// Automatically check a radio button once a specific input is focused
|
||||
$(document).on('focus', 'form select[data-related-radiobtn]', { self: this }, this.autoCheckRadioButton);
|
||||
$(document).on('focus', 'form input[data-related-radiobtn]', { self: this }, this.autoCheckRadioButton);
|
||||
|
||||
$(document).on('keyup', '#menu input.search', {self: this}, this.autoSubmitSearch);
|
||||
|
||||
$(document).on('click', '.tree .handle', { self: this }, this.treeNodeToggle);
|
||||
|
@ -163,6 +167,15 @@
|
|||
icinga.ui.fixControls();
|
||||
},
|
||||
|
||||
autoCheckRadioButton: function (event) {
|
||||
var $input = $(event.currentTarget);
|
||||
var $radio = $('#' + $input.attr('data-related-radiobtn'));
|
||||
if ($radio.length) {
|
||||
$radio.prop('checked', true);
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
autoSubmitSearch: function(event) {
|
||||
var self = event.data.self;
|
||||
if ($('#menu input.search').val() === self.searchValue) {
|
||||
|
@ -560,6 +573,8 @@
|
|||
$(document).off('submit', 'form', this.submitForm);
|
||||
$(document).off('change', 'form select.autosubmit', this.submitForm);
|
||||
$(document).off('change', 'form input.autosubmit', this.submitForm);
|
||||
$(document).off('focus', 'form select[data-related-radiobtn]', this.autoCheckRadioButton);
|
||||
$(document).off('focus', 'form input[data-related-radiobtn]', this.autoCheckRadioButton);
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
|
|
Loading…
Reference in New Issue