#325 Not validating existing templates... weird issues with the validator
This commit is contained in:
parent
448d7894ff
commit
c53ab310c0
@ -193,7 +193,7 @@ function createEditModal($template, $features, $categories)
|
|||||||
aria-labelledby="myLargeModalLabel" aria-hidden="true">
|
aria-labelledby="myLargeModalLabel" aria-hidden="true">
|
||||||
<div class="modal-dialog modal-lg">
|
<div class="modal-dialog modal-lg">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<form action="manage_permission_templates.php" role="form" method="post" id="form-<?php echo $template['id']; ?>">
|
<form action="manage_permission_templates.php" role="form" method="post" id="form<?php echo $template['id']; ?>">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
|
||||||
aria-hidden="true">×</span></button>
|
aria-hidden="true">×</span></button>
|
||||||
@ -235,8 +235,7 @@ function createEditModal($template, $features, $categories)
|
|||||||
if (in_array($category['id'], $enabledCategories) && !$showNotice) {
|
if (in_array($category['id'], $enabledCategories) && !$showNotice) {
|
||||||
$checked = 'checked';
|
$checked = 'checked';
|
||||||
} ?>
|
} ?>
|
||||||
<input type="checkbox" name="categories[]" data-modal="<?php echo $template['id']; ?>-categories"
|
<input type="checkbox" name="categories[]"
|
||||||
data-checkbox="categories"
|
|
||||||
value="<?php echo $category['id']; ?>" <?php echo $checked . $disabled; ?>>
|
value="<?php echo $category['id']; ?>" <?php echo $checked . $disabled; ?>>
|
||||||
<?php echo $category['name']; ?>
|
<?php echo $category['name']; ?>
|
||||||
</label>
|
</label>
|
||||||
@ -257,8 +256,7 @@ function createEditModal($template, $features, $categories)
|
|||||||
if (in_array($feature, $enabledFeatures) && !$showNotice) {
|
if (in_array($feature, $enabledFeatures) && !$showNotice) {
|
||||||
$checked = 'checked';
|
$checked = 'checked';
|
||||||
} ?>
|
} ?>
|
||||||
<input type="checkbox" name="features[]" data-modal="<?php echo $template['id']; ?>-features"
|
<input type="checkbox" name="features[]"
|
||||||
data-checkbox="features"
|
|
||||||
value="<?php echo $feature; ?>" <?php echo $checked . $disabled; ?>>
|
value="<?php echo $feature; ?>" <?php echo $checked . $disabled; ?>>
|
||||||
<?php echo $hesklang[$feature]; ?>
|
<?php echo $hesklang[$feature]; ?>
|
||||||
</label>
|
</label>
|
||||||
@ -283,11 +281,6 @@ function createEditModal($template, $features, $categories)
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<script>
|
|
||||||
buildValidatorForExistingPermissionTemplate('form-<?php echo $template['id']; ?>',
|
|
||||||
'<?php echo $hesklang['select_at_least_one_value']; ?>',
|
|
||||||
'<?php echo $template['id']; ?>')
|
|
||||||
</script>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -302,7 +295,7 @@ function buildCreateModal($features, $categories)
|
|||||||
aria-hidden="true">
|
aria-hidden="true">
|
||||||
<div class="modal-dialog modal-lg">
|
<div class="modal-dialog modal-lg">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<form action="manage_permission_templates.php" role="form" method="post" id="create-form">
|
<form action="manage_permission_templates.php" role="form" method="post" id="createForm">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
|
||||||
aria-hidden="true">×</span></button>
|
aria-hidden="true">×</span></button>
|
||||||
@ -375,7 +368,7 @@ function buildCreateModal($features, $categories)
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<script>
|
<script>
|
||||||
buildValidatorForPermissionTemplates('create-form', '<?php echo $hesklang['select_at_least_one_value']; ?>');
|
buildValidatorForPermissionTemplates('createForm', '<?php echo $hesklang['select_at_least_one_value']; ?>');
|
||||||
</script>
|
</script>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -37,26 +37,6 @@ function buildValidatorForTicketSubmission(formName, validationText) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildValidatorForExistingPermissionTemplate(formId, validationText, templateId) {
|
|
||||||
$('#' + formId).validator({
|
|
||||||
custom: {
|
|
||||||
checkbox: function($el) {
|
|
||||||
var checkboxes = $('input[data-modal="' + templateId + '-' + $el.attr('data-checkbox') + '"]');
|
|
||||||
|
|
||||||
for (var checkbox in checkboxes) {
|
|
||||||
if (checkboxes[checkbox].checked) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
errors: {
|
|
||||||
checkbox: validationText
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function buildValidatorForPermissionTemplates(formId, validationText) {
|
function buildValidatorForPermissionTemplates(formId, validationText) {
|
||||||
$('#' + formId).validator({
|
$('#' + formId).validator({
|
||||||
custom: {
|
custom: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user