Etat des checkbox liés à l'édition d'une page et aux modules dans l'édition et l'ajout

This commit is contained in:
Fred Tempez 2023-06-05 18:31:16 +02:00
parent cca7530631
commit 48de07f997
3 changed files with 146 additions and 107 deletions

View File

@ -13,35 +13,41 @@
$(document).ready(function () {
// Désactive tous les éléments de la classe "filemanager" si le checkbox avec l'id "profilEditFileManager" est décoché au chargement de la page
if (!$("#profilAddFileManager").prop("checked")) {
$(".filemanager").prop("disabled", true);
}
// À chaque inversion de l'état du checkbox avec l'id "profilEditFileManager", désactive ou active tous les éléments de la classe "filemanager" en fonction de l'état
// À chaque inversion de l'état du checkbox avec l'id "profilAddFileManager", désactive ou active tous les éléments de la classe "filemanager" en fonction de l'état
$("#profilAddFileManager").change(function () {
if (!$(this).prop("checked")) {
if (!$(this).is(':checked')) {
$(".filemanager").prop("disabled", true);
} else {
$(".filemanager").prop("disabled", false);
}
});
// Désactive la gestion des pages pour les membres
$('#profilAddGroup').change(function() {;
if ($(this).val() === '1') {
$('.containerPage, .containerModule').slideUp();
// Gérer l'évènement affichage des
$("#profilAddPageModule").change(function () {
if (!$(this).is(':checked')) {
$(".containerModule").slideUp();
// Décocher les checkboxes dans la classe .containerModule
$('.containerModule input[type="checkbox"]').removeAttr('checked');
} else {
$('.containerPage, .containerModule').slideDown();
$(".containerModule").slideDown();
}
});
$("#profilAddPageEdit").change(function () {
if (!$(this).prop("checked")) {
$(".containerModule").prop("disabled", true);
// Gérer lévènement de modification de la checkbox #profilAddPageEdit
$('#profilAddPageEdit').change(function () {
if ($(this).is(':checked')) {
// Activer les autres checkboxes
$('#profilAddPageModule, #profilAddPagecssEditor, #profilAddPagejsEditor').prop('disabled', false);
} else {
$(".containerModule").prop("disabled", false);
// Désactiver les autres checkboxes
$('#profilAddPageModule, #profilAddPagecssEditor, #profilAddPagejsEditor').prop('checked', false).prop('disabled', true);
// Désactiver les modules et tout décocher
$(".containerModule").slideUp();
$('.containerModule input[type="checkbox"]').removeAttr('checked');
}
});
});

View File

@ -17,21 +17,52 @@ $(document).ready(function () {
if (!$("#profilEditFileManager").prop("checked")) {
$(".filemanager").prop("disabled", true);
}
// Vérifier l'état initial de la checkbox #profilEditPageEdit
if ($('#profilEditPageEdit').is(':checked')) {
// Activer les autres checkboxes
$('#profilEditPageModule, #profilEditPagecssEditor, #profilEditPagejsEditor').prop('disabled', false);
} else {
// Désactiver les autres checkboxes
$('#profilEditPageModule, #profilEditPagecssEditor, #profilEditPagejsEditor').prop('checked', false).prop('disabled', true);
}
if (!$("#profilEditPageModule").is(':checked')) {
$(".containerModule").slideUp();
} else {
$(".containerModule").slideDown();
}
// À chaque inversion de l'état du checkbox avec l'id "profilEditFileManager", désactive ou active tous les éléments de la classe "filemanager" en fonction de l'état
$("#profilEditFileManager").change(function () {
if (!$(this).prop("checked")) {
if (!$(this).is(':checked')) {
$(".filemanager").prop("disabled", true);
} else {
$(".filemanager").prop("disabled", false);
}
});
$("#profilEditPageEdit").change(function () {
if (!$(this).prop("checked")) {
$(".containerModule").prop("disabled", true);
// Gérer l'évènement affichage des
$("#profilEditPageModule").change(function () {
if (!$(this).is(':checked')) {
$(".containerModule").slideUp();
// Décocher les checkboxes dans la classe .containerModule
$('.containerModule input[type="checkbox"]').removeAttr('checked');
} else {
$(".containerModule").prop("disabled", false);
$(".containerModule").slideDown();
}
});
// Gérer lévènement de modification de la checkbox #profilEditPageEdit
$('#profilEditPageEdit').change(function () {
if ($(this).is(':checked')) {
// Activer les autres checkboxes
$('#profilEditPageModule, #profilEditPagecssEditor, #profilEditPagejsEditor').prop('disabled', false);
} else {
// Désactiver les autres checkboxes
$('#profilEditPageModule, #profilEditPagecssEditor, #profilEditPagejsEditor').prop('checked', false).prop('disabled', true);
// Désactiver les modules et tout décocher
$(".containerModule").slideUp();
$('.containerModule input[type="checkbox"]').removeAttr('checked');
}
});
});

View File

@ -100,101 +100,103 @@
</div>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">
<h4>
<?php echo helper::translate('Blog'); ?>
</h4>
<div class="row">
<div class="col3">
<?php echo template::checkbox('profilEditBlogAdd', false, 'Ajouter', [
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'blog', 'add'])
]); ?>
<div class="containerModule">
<div class="row">
<div class="col12">
<div class="block">
<h4>
<?php echo helper::translate('Blog'); ?>
</h4>
<div class="row">
<div class="col3">
<?php echo template::checkbox('profilEditBlogAdd', false, 'Ajouter', [
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'blog', 'add'])
]); ?>
</div>
<div class="col3">
<?php echo template::checkbox('profilEditBlogEdit', false, 'Edit', [
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'blog', 'edit'])
]); ?>
</div>
<div class="col3">
<?php echo template::checkbox('profilEditBlogDelete', false, 'Supprimer', [
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'blog', 'delete'])
]); ?>
</div>
<div class="col3">
<?php echo template::checkbox('profilEditBlogConfig', false, 'Configuration', [
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'blog', 'config'])
]); ?>
</div>
</div>
<div class="col3">
<?php echo template::checkbox('profilEditBlogEdit', false, 'Edit', [
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'blog', 'edit'])
]); ?>
<div class="row">
<div class="col4">
<?php echo template::checkbox('profilEditBlogOption', false, 'Option', [
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'blog', 'option'])
]); ?>
</div>
<div class="col4">
<?php echo template::checkbox('profilEditBlogComment', false, 'Commentaire', [
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'blog', 'comment'])
]); ?>
</div>
<div class="col4">
<?php echo template::checkbox('profilEditBlogCommentApprouve', false, 'Approuver commentaire', [
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'blog', 'commentApprove'])
]); ?>
</div>
</div>
<div class="col3">
<?php echo template::checkbox('profilEditBlogDelete', false, 'Supprimer', [
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'blog', 'delete'])
]); ?>
</div>
<div class="col3">
<?php echo template::checkbox('profilEditBlogConfig', false, 'Configuration', [
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'blog', 'config'])
]); ?>
</div>
</div>
<div class="row">
<div class="col4">
<?php echo template::checkbox('profilEditBlogOption', false, 'Option', [
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'blog', 'option'])
]); ?>
</div>
<div class="col4">
<?php echo template::checkbox('profilEditBlogComment', false, 'Commentaire', [
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'blog', 'comment'])
]); ?>
</div>
<div class="col4">
<?php echo template::checkbox('profilEditBlogCommentApprouve', false, 'Approuver commentaire', [
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'blog', 'commentApprove'])
]); ?>
</div>
</div>
<div class="row">
<div class="col6">
<?php echo template::checkbox('profilEditBlogCommentDelete', false, 'Supprimer commentaire', [
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'blog', 'commentDelete'])
]); ?>
</div>
<div class="col6">
<?php echo template::checkbox('profilEditBlogCommentDeleteAll', false, 'Nettoyer commentaires', [
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'blog', 'commentDeleteAll'])
]); ?>
<div class="row">
<div class="col6">
<?php echo template::checkbox('profilEditBlogCommentDelete', false, 'Supprimer commentaire', [
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'blog', 'commentDelete'])
]); ?>
</div>
<div class="col6">
<?php echo template::checkbox('profilEditBlogCommentDeleteAll', false, 'Nettoyer commentaires', [
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'blog', 'commentDeleteAll'])
]); ?>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">
<h4>
<?php echo helper::translate('News'); ?>
</h4>
<div class="row">
<div class="col4">
<?php echo template::checkbox('profilEditNewsAdd', false, 'Ajouter', [
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'news', 'add'])
]); ?>
</div>
<div class="col4">
<?php echo template::checkbox('profilEditNewsEdit', false, 'Edit', [
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'news', 'edit'])
]); ?>
</div>
<div class="col4">
<?php echo template::checkbox('profilEditNewsDelete', false, 'Supprimer', [
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'news', 'delete'])
]); ?>
</div>
</div>
<div class="row">
<div class="col6">
<?php echo template::checkbox('profilEditNewsConfig', false, 'Configuration', [
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'news', 'config'])
]); ?>
</div>
<div class="col6">
<?php echo template::checkbox('profilEditNewsOption', false, 'Option', [
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'news', 'option'])
]); ?>
<div class="row">
<div class="col12">
<div class="block">
<h4>
<?php echo helper::translate('News'); ?>
</h4>
<div class="row">
<div class="col4">
<?php echo template::checkbox('profilEditNewsAdd', false, 'Ajouter', [
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'news', 'add'])
]); ?>
</div>
<div class="col4">
<?php echo template::checkbox('profilEditNewsEdit', false, 'Edit', [
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'news', 'edit'])
]); ?>
</div>
<div class="col4">
<?php echo template::checkbox('profilEditNewsDelete', false, 'Supprimer', [
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'news', 'delete'])
]); ?>
</div>
</div>
<div class="row">
<div class="col6">
<?php echo template::checkbox('profilEditNewsConfig', false, 'Configuration', [
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'news', 'config'])
]); ?>
</div>
<div class="col6">
<?php echo template::checkbox('profilEditNewsOption', false, 'Option', [
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'news', 'option'])
]); ?>
</div>
</div>
</div>
</div>
</div>