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 */ 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 * Grille
*/ */

View File

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

View File

@ -79,7 +79,9 @@ if(inputs) {
* Afficher/cacher les options supplémentaires * Afficher/cacher les options supplémentaires
*/ */
$(document).on("click", ".formConfigMoreToggle", function() { $(document).on("click", ".formConfigMoreToggle", function() {
$(this).parents(".formConfigInput").find(".formConfigMore").slideToggle(); $(this).parents(".formConfigInput").find(".formConfigMore").slideToggle();
$(this).parents(".formConfigInput").find(".formConfigMoreLabel").slideToggle();
}); });
/** /**
@ -123,6 +125,9 @@ $("#formConfigInputs")
var _this = $(this); var _this = $(this);
if(_this.val() === "select") { 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 { else {
_this.parents(".formConfigInput").find(".formConfigValuesWrapper").slideUp(); _this.parents(".formConfigInput").find(".formConfigValuesWrapper").slideUp();

View File

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

View File

@ -36,6 +36,11 @@
<?php elseif($input['type'] === $module::TYPE_CHECKBOX): ?> <?php elseif($input['type'] === $module::TYPE_CHECKBOX): ?>
<?php echo template::checkbox('formInput[' . $index . ']', true, $input['name'] <?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 endif; ?>
<?php endforeach; ?> <?php endforeach; ?>
<?php if($this->getData(['module', $this->getUrl(0), 'config', 'capcha'])): ?> <?php if($this->getData(['module', $this->getUrl(0), 'config', 'capcha'])): ?>