Module Form v2.1

This commit is contained in:
fredtempez 2019-11-26 19:22:30 +01:00
parent 633d5879fa
commit fbdfcbfcb2
5 changed files with 37 additions and 8 deletions

View File

@ -1036,6 +1036,17 @@ input[type='checkbox']:disabled + label:before{
padding: 0; /* À cause du padding ajouté aux selects */
}
/* Paramètres de l'étiquette dans form */
.formLabel {
margin-top: 20px;
}
.formLabel hr {
border: 1px solid;
margin: 5px 0 5px;
}
/**
* Grille
*/

View File

@ -32,14 +32,16 @@ class form extends common {
public static $pagination;
const FORM_VERSION = '2.0';
const FORM_VERSION = '2.1';
// Objets
const TYPE_MAIL = 'mail';
const TYPE_SELECT = 'select';
const TYPE_TEXT = 'text';
const TYPE_TEXTAREA = 'textarea';
const TYPE_DATETIME = "date";
const TYPE_CHECKBOX = "checkbox";
const TYPE_DATETIME = 'date';
const TYPE_CHECKBOX = 'checkbox';
const TYPE_LABEL = 'label';
public static $types = [
@ -48,7 +50,8 @@ class form extends common {
self::TYPE_MAIL => 'Champ mail',
self::TYPE_SELECT => 'Sélection',
self::TYPE_DATETIME => 'Date',
self::TYPE_CHECKBOX => 'Case à cocher'
self::TYPE_CHECKBOX => 'Case à cocher',
self::TYPE_LABEL => 'Etiquette',
];
public static $listUsers = [

View File

@ -79,7 +79,9 @@ if(inputs) {
* Afficher/cacher les options supplémentaires
*/
$(document).on("click", ".formConfigMoreToggle", function() {
$(this).parents(".formConfigInput").find(".formConfigMore").slideToggle();
$(this).parents(".formConfigInput").find(".formConfigMoreLabel").slideToggle();
});
/**
@ -122,7 +124,10 @@ $("#formConfigInputs")
.on("change", ".formConfigType", function() {
var _this = $(this);
if(_this.val() === "select") {
_this.parents(".formConfigInput").find(".formConfigValuesWrapper").slideDown();
_this.parents(".formConfigInput").find(".formConfigValuesWrapper").slideDown();
} else if ( _this.val() === "label") {
_this.parents(".formConfigInput").find("label[for*=formConfigRequired]").hide();
_this.parents(".formConfigInput").find(".formConfigLabelWrapper").slideDown();
}
else {
_this.parents(".formConfigInput").find(".formConfigValuesWrapper").slideUp();

View File

@ -33,12 +33,17 @@
]); ?>
</div>
</div>
<div class="formConfigMoreLabel displayNone">
<?php echo template::label('formConfigLabel', 'Aucune option pour une étiquette', [
'class' => 'displayNone formConfigLabelWrapper'
]); ?>
</div>
<div class="formConfigMore displayNone">
<?php echo template::text('formConfigValues[]', [
'placeholder' => 'Liste des valeurs séparées par des virgules (valeur1,valeur2,...)',
'class' => 'formConfigValues',
'classWrapper' => 'displayNone formConfigValuesWrapper'
]); ?>
]); ?>
<?php echo template::checkbox('formConfigRequired[]', true, 'Champ obligatoire'); ?>
</div>
</div>
@ -150,6 +155,6 @@
</div>
</div>
<?php echo template::formClose(); ?>
<div class="moduleVersion">Module version
<div class="moduleVersion">Version
<?php echo $module::FORM_VERSION; ?>
</div>

View File

@ -35,7 +35,12 @@
]); ?>
<?php elseif($input['type'] === $module::TYPE_CHECKBOX): ?>
<?php echo template::checkbox('formInput[' . $index . ']', true, $input['name']
); ?>
); ?>
<?php elseif($input['type'] === $module::TYPE_LABEL): ?>
<h3 class='formLabel'>
<?php echo $input['name']; ?>
<hr class="formLabel">
</h3>
<?php endif; ?>
<?php endforeach; ?>
<?php if($this->getData(['module', $this->getUrl(0), 'config', 'capcha'])): ?>