Commit 06450d7d authored by Sylvain's avatar Sylvain

Ajout des tests unitaires

parent ed393a54
<?php
namespace Goldenscarab\Modulus\Service\Field\Compose;
use \Illuminate\Support\HtmlString;
class Option extends FieldBt4 {
private $is_dynamic;
private $source;
private $label_param;
private $value_param;
private $datas;
private $template;
private $attributes;
private $class;
private $callback;
public function __construct()
{
}
public function setSource($source)
{
$this->source = $source;
}
public function setLabelParam($value)
{
$this->label_param = $value;
}
public function setValueParam($value)
{
$this->value_param = $value;
}
public function setDatas($value)
{
$this->datas = $value;
}
public function setTemplate($value)
{
$this->template = $value;
}
public function setAttributes($value)
{
$this->attributes = $value;
}
public function setClass($value)
{
$this->class = $value;
}
public function setCallback($value)
{
$this->callback = $value;
}
public function getOptionValue()
{
if (is_null($this->value_param)) {
return collect($this->source)->keys()->first();
} else {
return $this->objectToString(
null,
$this->value_param,
$this->callback,
$this->source
);
}
}
public function getOptionLabel()
{
if (is_null($this->label_param)) {
return collect($this->source)->first();
} else {
return $this->objectToString(
$this->template,
$this->label_param,
$this->callback,
$this->source
);
}
}
public function getDatasRender()
{
$render = '';
if (!is_null($this->datas)) {
$render = ' ';
foreach ($this->datas as $attr => $value) {
$render .= $this->renderDatas([$attr => data_get($this->source, $value)]);
}
}
return $render;
}
}
<?php
namespace Tests\Unit;
use Tests\TestCase;
use Illuminate\Support\Facades\File;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Goldenscarab\Modulus\Service\Field\Facades\Field;
/**
* ./vendor/bin/phpunit ./vendor/goldenscarab/modulus-service-field/tests/FieldsTest.php
*/
class FieldsTest extends TestCase
{
private $data_source = [
'type' => [
'id' => 'mon-id',
'label' => 'mon-label',
'code' => 'mon-code'
]
];
private $options = [
1 => 'Option 1',
2 => 'Option 2',
3 => 'Option 3',
4 => 'Option 4',
5 => 'Option 5'
];
private $collection = [
['id' => 1, 'title' => 'Titre 1', 'value' => 'value-1', 'data' => ['data1' => 'data-value1.1', 'data2' => 'data-value1.2']],
['id' => 2, 'title' => 'Titre 2', 'value' => 'value-2', 'data' => ['data1' => 'data-value2.1', 'data2' => 'data-value2.2']],
['id' => 3, 'title' => 'Titre 3', 'value' => 'value-3', 'data' => ['data1' => 'data-value3.1', 'data2' => 'data-value3.2']],
['id' => 4, 'title' => 'Titre 4', 'value' => 'value-4', 'data' => ['data1' => 'data-value4.1', 'data2' => 'data-value4.2']]
];
private $lorem = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Laboriosam, rem esse itaque inventore provident reiciendis quo, asperiores dolorem voluptate nostrum quisquam similique commodi quam consequatur ad eligendi iusto aperiam quos?';
/**
* Test du fonctionnement de la classe en mode test unitaire
* @return void
*/
public function testTest()
{
$this->assertTrue(true);
}
public function testInputField()
{
$generated_string = Field::input([
'type' => 'text',
'label' => 'Total',
'name' => 'total',
'value' => 23.4,
]);
$desired_string = File::get(__DIR__ . '/html/fields/input.html');
$this->assertEquals($desired_string, $generated_string);
}
public function testInputAdvancedField()
{
$generated_string = Field::input([
'id' => 'total-final',
'type' => 'text',
'label' => 'Total',
'name' => 'total',
'value' => 23.4,
'class' => 'text-danger',
'prefix' => '<i class="fa fa-money"></i>',
'suffix' => '€',
'placeholder' => "123,30",
'help' => 'Taxe comprise',
'indice' => 1,
'style' => 'background-color: #c3c3c3;',
'attributes' => [
'onchange' => 'console.log("change")',
'title' => [
'source' => $this->data_source,
'template' => '%s ~ %s',
'attributes' => ['type.id', 'type.label'],
'callback' => 'ucfirst'
]
],
'datas' => [
'type' => 'column',
'reference' => [
'source' => $this->data_source,
'template' => '%s|%s',
'attributes' => ['type.id', 'type.code'],
'callback' => 'ucfirst'
]
],
'is_inline' => true,
'is_disabled' => true,
'is_readonly' => true,
'is_required' => true,
'is_autocomplete' => true,
'is_autofocus' => true,
'popover' => [
'placement' => 'right',
'title' => 'Information',
'content' => "Le montant est calculé selon les éléments communiqué. Il peux néanmoins variée suivant d'autre facteurs non pris en compte"
],
]);
$desired_string = File::get(__DIR__ . '/html/fields/input_advanced.html');
$this->assertEquals($desired_string, $generated_string);
}
public function testSelectSimpleField()
{
$generated_string = Field::select([
'label' => 'Collection',
'name' => 'collection',
'value' => 4,
'class' => 'select2',
'prefix' => '<i class="fa fa-list"></i>',
'suffix' => '<i class="fa fa-hand-paper-o"></i>',
'size' => 'sm',
'indice' => 34,
'is_required' => true,
'options' => $this->options
]);
$desired_string = File::get(__DIR__ . '/html/fields/select_simple.html');
$this->assertEquals($desired_string, $generated_string);
}
public function testSelectGroupField()
{
$generated_string = Field::select([
'label' => 'Menu déroulant',
'name' => 'my_field_name',
'value' => 23,
'placeholder' => 'Choisir ...',
'size' => 'sm',
'is_required' => true,
'options' => [
'Groupe 1' => [
23 => 'Élement 23',
24 => 'Élement 24',
25 => 'Élement 25',
],
'Groupe 2' => [
26 => 'Élement 26',
27 => 'Élement 27',
28 => 'Élement 28',
]
]
]);
$desired_string = File::get(__DIR__ . '/html/fields/select_group.html');
$this->assertEquals($desired_string, $generated_string);
}
public function testSelectMultipleField()
{
$generated_string = Field::select([
'label' => 'Collection',
'name' => 'collection',
'values' => [2, 4],
'class' => 'select2',
'prefix' => '<i class="fa fa-list"></i>',
'suffix' => '<i class="fa fa-hand-paper-o"></i>',
'indice' => 34,
'is_required' => true,
'is_multiple' => true,
'options' => [
'collect' => $this->collection,
'value' => 'id',
'template' => '%s - %s',
'callback' => 'strtoupper',
'text' => ['title', 'value'],
]
]);
$desired_string = File::get(__DIR__ . '/html/fields/select_multiple.html');
$this->assertEquals($desired_string, $generated_string);
}
public function testSelectDataField()
{
$generated_string = Field::select([
'label' => 'Ville',
'name' => 'city_id',
'value' => 2,
'placeholder' => "Choisir...",
'options' => [
'collect' => $this->collection,
'value' => 'id',
'text' => ['title', 'value'],
'template' => '%s - %s',
'datas' => [
'data1' => 'data.data1',
'data2' => 'data.data2',
]
]
]);
$desired_string = File::get(__DIR__ . '/html/fields/select_data.html');
$this->assertEquals($desired_string, $generated_string);
}
public function testTextareaField()
{
$generated_string = Field::textarea([
'label' => 'Contenu',
'name' => 'content',
'value' => $this->lorem,
'class' => 'text-editor',
'rows' => 15,
'popover' => [
'placement' => 'right',
'title' => 'Le contenu',
'content' => "Le contenu est le coeur de l'article. Grâce à l'éditeur vous pouvez formater le rendu selon votre goût."
]
]);
$desired_string = File::get(__DIR__ . '/html/fields/textarea.html');
$this->assertEquals($desired_string, $generated_string);
}
public function testFileField()
{
$generated_string = Field::file([
'label' => 'Uploader',
'name' => 'csv',
'prefix' => 'Fichier',
'placeholder' => 'Aucun fichier choisi'
]);
$desired_string = File::get(__DIR__ . '/html/fields/file.html');
$this->assertEquals($desired_string, $generated_string);
}
public function testPdfField()
{
$generated_string = Field::pdf([
'label' => 'Champs pdf',
'name' => 'my_field_pdf',
'value' => 'test.pdf',
'placeholder' => 'ex: /upload/folder/file.pdf',
'suffix' => '<i class="fa fa-file-pdf-o mr-2"></i> Choisir un PDF',
'is_required' => true,
]);
$desired_string = File::get(__DIR__ . '/html/fields/pdf.html');
$this->assertEquals($desired_string, $generated_string);
}
public function testVideoField()
{
$generated_string = Field::pdf([
'label' => 'Champs video',
'name' => 'my_field_video',
'value' => 'my-video.mp4',
'placeholder' => 'ex: /upload/folder/video.mp4',
'suffix' => '<i class="fa fa-file-video-o mr-2"></i> Choisir une vidéo',
'is_required' => true,
]);
$desired_string = File::get(__DIR__ . '/html/fields/video.html');
$this->assertEquals($desired_string, $generated_string);
}
public function testImageField()
{
$generated_string = Field::pdf([
'label' => 'Champs image',
'name' => 'my_field_image',
'value' => 'image.png',
'placeholder' => 'ex: /upload/folder/image.png',
'suffix' => '<i class="fa fa-file-image-o mr-2"></i> Choisir une image',
'is_required' => true,
]);
$desired_string = File::get(__DIR__ . '/html/fields/image.html');
$this->assertEquals($desired_string, $generated_string);
}
public function testToogleField()
{
$generated_string = Field::toggle([
'label' => 'Toggle',
'name' => 'toggle',
'value' => 1,
'datas' => [
'on' => 'Actif',
'off' => 'Inactif',
'onstyle' => 'success',
'offstyle' => 'danger',
'toggle' => 'toggle',
'width' => '75',
'size' => 'xs'
]
]);
$desired_string = File::get(__DIR__ . '/html/fields/toggle.html');
$this->assertEquals($desired_string, $generated_string);
}
public function testRangeField()
{
$generated_string = Field::range([
'label' => 'Zoom',
'name' => 'zoom',
'min' => 0,
'max' => 20,
'value' => 7
]);
$desired_string = File::get(__DIR__ . '/html/fields/range.html');
$this->assertEquals($desired_string, $generated_string);
}
public function testCodeField()
{
$generated_string = Field::code([
'label' => 'Contenu',
'name' => 'content',
'value' => 'function foo(items) {
var x = "All this is syntax highlighted";
return x;
}',
'style' => 'min-height: 400px;',
'is_required' => true,
'datas' => array(
'language' => 'javascript',
'readonly' => 'false',
'beautiful' => 'false',
)
]);
$desired_string = File::get(__DIR__ . '/html/fields/code.html');
$this->assertEquals($desired_string, $generated_string);
}
public function testRadioField()
{
$generated_string = Field::radio([
'label' => 'Choix unique',
'name' => 'my_field_name',
'value' => 2,
'is_inline' => true,
'options' => $this->options
]);
$desired_string = File::get(__DIR__ . '/html/fields/radio.html');
$this->assertEquals($desired_string, $generated_string);
}
public function testRadioIndiceTrueField()
{
$generated_string = Field::radio([
'label' => 'Choix unique',
'name' => 'my_field_name',
'value' => 2,
'indice' => true,
'is_inline' => true,
'options' => $this->options
]);
$desired_string = File::get(__DIR__ . '/html/fields/radio_indice_true.html');
$this->assertEquals($desired_string, $generated_string);
}
public function testRadioCollectField()
{
$generated_string = Field::radio([
'label' => 'Mon Champs',
'name' => 'mon-champs',
'value' => 'value-2',
'is_inline' => false,
'options' => [
'collect' => $this->collection,
'value' => 'value',
'template' => '%s - %s',
'text' => ['id', 'title'],
'callback' => 'strtoupper',
'datas' => [
'one' => 'data.data1',
'tow' => 'data.data2',
]
]
]);
$desired_string = File::get(__DIR__ . '/html/fields/radio_collect.html');
$this->assertEquals($desired_string, $generated_string);
}
public function testCheckboxField()
{
$generated_string = Field::checkbox([
'label' => 'Choix multiple',
'name' => 'my_field_name',
'values' => [2, 3],
'is_inline' => true,
'options' => $this->options
]);
$desired_string = File::get(__DIR__ . '/html/fields/checkbox.html');
$this->assertEquals($desired_string, $generated_string);
}
public function testCheckboxIndiceField()
{
$generated_string = Field::checkbox([
'label' => 'Choix multiple',
'name' => 'my_field_name',
'indice' => 12,
'values' => [2, 3],
'is_inline' => true,
'options' => $this->options
]);
$desired_string = File::get(__DIR__ . '/html/fields/checkbox_indice.html');
$this->assertEquals($desired_string, $generated_string);
}
public function testCheckboxCollectField()
{
$generated_string = Field::checkbox([
'label' => 'Mon Champs',
'name' => 'mon-champs',
'values' => ['value-2', 'value-3'],
'is_inline' => false,
'options' => [
'collect' => $this->collection,
'value' => 'value',
'template' => '%s - %s',
'text' => ['id', 'title'],
'callback' => 'strtoupper',
'datas' => [
'one' => 'data.data1',
'tow' => 'data.data2',
]
]
]);
$desired_string = File::get(__DIR__ . '/html/fields/checkbox_collect.html');
$this->assertEquals($desired_string, $generated_string);
}
}
<div class="form-group row">
<label for="my-field-name-5" class="col-sm-2">Choix multiple</label>
<div class="col-sm-10">
<div class="form-check form-check-inline">
<input type="checkbox" id="my-field-name-1" class="form-check-input" name="my_field_name[]" value="1"/>
<label class="form-check-label" for="my-field-name-1">Option 1</label>
</div>
<div class="form-check form-check-inline">
<input type="checkbox" id="my-field-name-2" class="form-check-input" name="my_field_name[]" value="2" checked/>
<label class="form-check-label" for="my-field-name-2">Option 2</label>
</div>
<div class="form-check form-check-inline">
<input type="checkbox" id="my-field-name-3" class="form-check-input" name="my_field_name[]" value="3" checked/>
<label class="form-check-label" for="my-field-name-3">Option 3</label>
</div>
<div class="form-check form-check-inline">
<input type="checkbox" id="my-field-name-4" class="form-check-input" name="my_field_name[]" value="4"/>
<label class="form-check-label" for="my-field-name-4">Option 4</label>
</div>
<div class="form-check form-check-inline">
<input type="checkbox" id="my-field-name-5" class="form-check-input" name="my_field_name[]" value="5"/>
<label class="form-check-label" for="my-field-name-5">Option 5</label>
</div>
</div>
</div>
<div class="form-group">
<label for="mon-champs-value-4">Mon Champs</label>
<div class="form-check">
<input type="checkbox" id="mon-champs-value-1" class="form-check-input" name="mon-champs[]" value="VALUE-1" data-one="data-value1.1" data-tow="data-value1.2" />
<label class="form-check-label" for="mon-champs-value-1">1 - TITRE 1</label>
</div>
<div class="form-check">
<input type="checkbox" id="mon-champs-value-2" class="form-check-input" name="mon-champs[]" value="VALUE-2" data-one="data-value2.1" data-tow="data-value2.2" />
<label class="form-check-label" for="mon-champs-value-2">2 - TITRE 2</label>
</div>
<div class="form-check">
<input type="checkbox" id="mon-champs-value-3" class="form-check-input" name="mon-champs[]" value="VALUE-3" data-one="data-value3.1" data-tow="data-value3.2" />
<label class="form-check-label" for="mon-champs-value-3">3 - TITRE 3</label>
</div>
<div class="form-check">
<input type="checkbox" id="mon-champs-value-4" class="form-check-input" name="mon-champs[]" value="VALUE-4" data-one="data-value4.1" data-tow="data-value4.2" />
<label class="form-check-label" for="mon-champs-value-4">4 - TITRE 4</label>
</div>
</div>
<div class="form-group row">
<label for="my-field-name-12-5" class="col-sm-2">Choix multiple</label>
<div class="col-sm-10">
<div class="form-check form-check-inline">
<input type="checkbox" id="my-field-name-12-1" class="form-check-input" name="my_field_name[12][]" value="1"/>
<label class="form-check-label" for="my-field-name-12-1">Option 1</label>
</div>
<div class="form-check form-check-inline">
<input type="checkbox" id="my-field-name-12-2" class="form-check-input" name="my_field_name[12][]" value="2" checked/>
<label class="form-check-label" for="my-field-name-12-2">Option 2</label>
</div>
<div class="form-check form-check-inline">
<input type="checkbox" id="my-field-name-12-3" class="form-check-input" name="my_field_name[12][]" value="3" checked/>
<label class="form-check-label" for="my-field-name-12-3">Option 3</label>
</div>
<div class="form-check form-check-inline">
<input type="checkbox" id="my-field-name-12-4" class="form-check-input" name="my_field_name[12][]" value="4"/>
<label class="form-check-label" for="my-field-name-12-4">Option 4</label>
</div>
<div class="form-check form-check-inline">
<input type="checkbox" id="my-field-name-12-5" class="form-check-input" name="my_field_name[12][]" value="5"/>
<label class="form-check-label" for="my-field-name-12-5">Option 5</label>
</div>
</div>
</div>
<div class="form-group">
<label for="field-content" class="required">Contenu</label>
<div id="editor-field-content" class="code-editor"style="min-height: 400px;" data-language="javascript" data-readonly="false" data-beautiful="false" data-target="#field-content">function foo(items) {
var x = &quot;All this is syntax highlighted&quot;;
return x;
}</div>
<textarea id="field-content" name="content" style="display: none;">function foo(items) {
var x = &quot;All this is syntax highlighted&quot;;
return x;
}</textarea>
</div>
<div class="form-group">
<label for="field-csv">Uploader</label>
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">Fichier</div>
</div>
<div class="custom-file">
<input type="file" id="field-csv" class="custom-file-input" name="csv" value="" placeholder="Aucun fichier choisi" />
<label class="custom-file-label" for="field-csv">Aucun fichier choisi</label>
<script type="text/javascript">
document.getElementById('field-csv').addEventListener('change', function(e) {
if (e.target.files[0]) {
var fileName = e.target.files[0].name;
var nextSibling = e.target.nextElementSibling;
nextSibling.innerText = fileName
}
});
</script>
</div>
</div>
</div>
<div class="form-group">
<label for="field-my-field-image" class="required">Champs image</label>
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text text-danger">
<i class="fa fa-file-pdf-o" aria-hidden="true"></i>
</div>
</div>
<input type="text" id="field-my-field-image" class="form-control" name="my_field_image" value="image.png" placeholder="ex: /upload/folder/image.png" required="required" />
<div class="input-group-append">
<button class="btn btn-outline-secondary popupfinder" type="button" id="btn-field-my-field-image" data-field="#field-my-field-image" data-mimes="application/pdf">
<i class="fa fa-file-image-o mr-2"></i> Choisir une image
</button>
</div>
</div>
</div>
<div class="form-group">
<label for="field-total">Total</label>
<input type="text" id="field-total" class="form-control" name="total" value="23,4" />
</div>
<div class="form-group row">
<label for="total-final-1" class="requiredcol-sm-2">Total</label>
<span class="text-info popup-help" data-toggle="popover" data-placement="right" title="Information" data-content="Le montant est calculé selon les éléments communiqué. Il peux néanmoins variée suivant d'autre facteurs non pris en compte">
<i class="fa fa-info-circle"></i>
</span>
<div class="col-sm-10">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text"><i class="fa fa-money"></i></div>
</div>
<input type="text" id="total-final-1" class="form-control text-danger" name="total[1]" value="23,4" placeholder="123,30" style="background-color: #c3c3c3;" autocomplete="autocomplete" autofocus="autofocus" disabled="disabled" required="required" readonly="readonly" onchange="console.log("change")" title="Mon-id ~ mon-label" data-type="column" data-reference="Mon-id|mon-code" />
<div class="input-group-append">
<div class="input-group-text"></div>
</div>
</div>
<small class="form-text text-muted text-right mt-0">Taxe comprise</small>
</div>
</div>
<div class="form-group">
<label for="field-my-field-pdf" class="required">Champs pdf</label>
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text text-danger">
<i class="fa fa-file-pdf-o" aria-hidden="true"></i>
</div>
</div>
<input type="text" id="field-my-field-pdf" class="form-control" name="my_field_pdf" value="test.pdf" placeholder="ex: /upload/folder/file.pdf" required="required" />
<div class="input-group-append">
<button class="btn btn-outline-secondary popupfinder" type="button" id="btn-field-my-field-pdf" data-field="#field-my-field-pdf" data-mimes="application/pdf">
<i class="fa fa-file-pdf-o mr-2"></i> Choisir un PDF
</button>
</div>
</div>
</div>
<div class="form-group row">
<label for="my-field-name-5" class="col-sm-2">Choix unique</label>
<div class="col-sm-10">
<div class="form-check form-check-inline">
<input type="radio" id="my-field-name-1" class="form-check-input" name="my_field_name" value="1"/>
<label class="form-check-label" for="my-field-name-1">Option 1</label>
</div>
<div class="form-check form-check-inline">
<input type="radio" id="my-field-name-2" class="form-check-input" name="my_field_name" value="2" checked/>
<label class="form-check-label" for="my-field-name-2">Option 2</label>
</div>
<div class="form-check form-check-inline">
<input type="radio" id="my-field-name-3" class="form-check-input" name="my_field_name" value="3"/>
<label class="form-check-label" for="my-field-name-3">Option 3</label>
</div>
<div class="form-check form-check-inline">
<input type="radio" id="my-field-name-4" class="form-check-input" name="my_field_name" value="4"/>
<label class="form-check-label" for="my-field-name-4">Option 4</label>
</div>
<div class="form-check form-check-inline">
<input type="radio" id="my-field-name-5" class="form-check-input" name="my_field_name" value="5"/>
<label class="form-check-label" for="my-field-name-5">Option 5</label>
</div>
</div>
</div>
<div class="form-group">
<label for="mon-champs-value-4">Mon Champs</label>
<div class="form-check">
<input type="radio" id="mon-champs-value-1" class="form-check-input" name="mon-champs" value="VALUE-1" data-one="data-value1.1" data-tow="data-value1.2" />
<label class="form-check-label" for="mon-champs-value-1">1 - TITRE 1</label>
</div>
<div class="form-check">
<input type="radio" id="mon-champs-value-2" class="form-check-input" name="mon-champs" value="VALUE-2" data-one="data-value2.1" data-tow="data-value2.2" />
<label class="form-check-label" for="mon-champs-value-2">2 - TITRE 2</label>
</div>
<div class="form-check">
<input type="radio" id="mon-champs-value-3" class="form-check-input" name="mon-champs" value="VALUE-3" data-one="data-value3.1" data-tow="data-value3.2" />
<label class="form-check-label" for="mon-champs-value-3">3 - TITRE 3</label>
</div>
<div class="form-check">
<input type="radio" id="mon-champs-value-4" class="form-check-input" name="mon-champs" value="VALUE-4" data-one="data-value4.1" data-tow="data-value4.2" />
<label class="form-check-label" for="mon-champs-value-4">4 - TITRE 4</label>
</div>
</div>
<div class="form-group row">
<label for="my-field-name-5" class="col-sm-2">Choix unique</label>
<div class="col-sm-10">
<div class="form-check form-check-inline">
<input type="radio" id="my-field-name-1" class="form-check-input" name="my_field_name[]" value="1"/>
<label class="form-check-label" for="my-field-name-1">Option 1</label>
</div>
<div class="form-check form-check-inline">
<input type="radio" id="my-field-name-2" class="form-check-input" name="my_field_name[]" value="2" checked/>
<label class="form-check-label" for="my-field-name-2">Option 2</label>
</div>
<div class="form-check form-check-inline">
<input type="radio" id="my-field-name-3" class="form-check-input" name="my_field_name[]" value="3"/>
<label class="form-check-label" for="my-field-name-3">Option 3</label>
</div>
<div class="form-check form-check-inline">
<input type="radio" id="my-field-name-4" class="form-check-input" name="my_field_name[]" value="4"/>
<label class="form-check-label" for="my-field-name-4">Option 4</label>
</div>
<div class="form-check form-check-inline">
<input type="radio" id="my-field-name-5" class="form-check-input" name="my_field_name[]" value="5"/>
<label class="form-check-label" for="my-field-name-5">Option 5</label>
</div>
</div>
</div>
<div class="form-group">
<label for="field-zoom">Zoom</label>
<input type="range" id="field-zoom" class="form-control" name="zoom" value="7" max="20" oninput="zoomShowValue(this.value)" />
<span id="field-zoom-value">7&nbsp;</span>
<script type="text/javascript">
function zoomShowValue(newValue) {
document.getElementById("field-zoom-value").innerHTML=newValue;
}
</script>
</div>
<div class="form-group">
<label for="field-city-id">Ville</label>
<select id="field-city-id" class="form-control" name="city_id">
<option value="" selected >Choisir...</option>
<option value="1" data-data1="data-value1.1" data-data2="data-value1.2">Titre 1 - value-1</option>
<option value="2" data-data1="data-value2.1" data-data2="data-value2.2" selected>Titre 2 - value-2</option>
<option value="3" data-data1="data-value3.1" data-data2="data-value3.2">Titre 3 - value-3</option>
<option value="4" data-data1="data-value4.1" data-data2="data-value4.2">Titre 4 - value-4</option>
</select>
</div>
<div class="form-group">
<label for="field-my-field-name" class="required">Menu déroulant</label>
<select id="field-my-field-name" class="form-control form-control-sm" name="my_field_name" required="required">
<option value="" disabled hidden selected >Choisir ...</option>
<optgroup label="Groupe 1"><option value="23" selected>Élement 23</option>
<option value="24">Élement 24</option>
<option value="25">Élement 25</option>
</optgroup>
<optgroup label="Groupe 2"><option value="26">Élement 26</option>
<option value="27">Élement 27</option>
<option value="28">Élement 28</option>
</optgroup>
</select>
</div>
<div class="form-group">
<label for="field-collection-34" class="required">Collection</label>
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text"><i class="fa fa-list"></i></div>
</div>
<select id="field-collection-34" class="form-control select2" name="collection[34][]" multiple="multiple" required="required">
<option value="1">TITRE 1 - VALUE-1</option>
<option value="2" selected>TITRE 2 - VALUE-2</option>
<option value="3">TITRE 3 - VALUE-3</option>
<option value="4" selected>TITRE 4 - VALUE-4</option>
</select>
<div class="input-group-append">
<div class="input-group-text"><i class="fa fa-hand-paper-o"></i></div>
</div>
</div>
</div>
<div class="form-group">
<label for="field-collection-34" class="required">Collection</label>
<div class="input-group input-group-sm">
<div class="input-group-prepend">
<div class="input-group-text"><i class="fa fa-list"></i></div>
</div>
<select id="field-collection-34" class="form-control select2" name="collection[34]" required="required">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
<option value="4" selected>Option 4</option>
<option value="5">Option 5</option>
</select>
<div class="input-group-append">
<div class="input-group-text"><i class="fa fa-hand-paper-o"></i></div>
</div>
</div>
</div>
<div class="form-group">
<label for="field-content">Contenu</label>
<span class="text-info popup-help" data-toggle="popover" data-placement="right" title="Le contenu" data-content="Le contenu est le coeur de l'article. Grâce à l'éditeur vous pouvez formater le rendu selon votre goût.">
<i class="fa fa-info-circle"></i>
</span>
<textarea id="field-content" class="form-control text-editor" name="content" rows="15">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Laboriosam, rem esse itaque inventore provident reiciendis quo, asperiores dolorem voluptate nostrum quisquam similique commodi quam consequatur ad eligendi iusto aperiam quos?</textarea>
</div>
<div class="form-group">
<label for="field-toggle">Toggle</label>
<div class="toogle">
<input type="checkbox" value="1" id="field-toggle" class="form-control" name="toggle" data-on="Actif" data-off="Inactif" data-onstyle="success" data-offstyle="danger" data-toggle="toggle" data-width="75" data-size="xs" checked />
</div>
</div>
<div class="form-group">
<label for="field-my-field-video" class="required">Champs video</label>
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text text-danger">
<i class="fa fa-file-pdf-o" aria-hidden="true"></i>
</div>
</div>
<input type="text" id="field-my-field-video" class="form-control" name="my_field_video" value="my-video.mp4" placeholder="ex: /upload/folder/video.mp4" required="required" />
<div class="input-group-append">
<button class="btn btn-outline-secondary popupfinder" type="button" id="btn-field-my-field-video" data-field="#field-my-field-video" data-mimes="application/pdf">
<i class="fa fa-file-video-o mr-2"></i> Choisir une vidéo
</button>
</div>
</div>
</div>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment