Bläddra i källkod

Adminlte : ajout fields

tags/0.1
Guillaume 3 år sedan
förälder
incheckning
754a880f57
4 ändrade filer med 34 tillägg och 2 borttagningar
  1. +1
    -1
      Field/FileManagerField.php
  2. +30
    -0
      Field/StatusField.php
  3. +2
    -0
      Resources/views/adminlte/crud/field/image.html.twig
  4. +1
    -1
      Resources/views/adminlte/crud/field/status.html.twig

+ 1
- 1
Field/FileManagerField.php Visa fil

@@ -22,7 +22,7 @@ final class FileManagerField implements FieldInterface
return (new self())
->setProperty($propertyName)
->setLabel($label)
->setTemplatePath('@LcSov/tabler/crud/field/image.html.twig')
->setTemplatePath('@LcSov/adminlte/crud/field/image.html.twig')
->addWebpackEncoreEntries('field-filemanager')
->setFormType(FileManagerType::class)
->addCssClass('field-text')

+ 30
- 0
Field/StatusField.php Visa fil

@@ -0,0 +1,30 @@
<?php

namespace Lc\SovBundle\Field;

use EasyCorp\Bundle\EasyAdminBundle\Contracts\Field\FieldInterface;
use EasyCorp\Bundle\EasyAdminBundle\Field\FieldTrait;
use Lc\SovBundle\Form\Type\FileManagerType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\TextType;

/**
* @author La clic ! <contact@laclic.fr>
*/
final class StatusField implements FieldInterface
{
use FieldTrait;

public static function new(string $propertyName, ?string $label = null): self
{
return (new self())
->setProperty($propertyName)
->setLabel($label)
->setTemplatePath('@LcSov/adminlte/crud/field/status.html.twig')
->setFormType(ChoiceType::class)
->setFormTypeOption('expanded', false)
->setFormTypeOption('multiple', false)
->setFormTypeOption('choices', ['En ligne' => 1, 'Hors ligne' => 0]);
}

}

+ 2
- 0
Resources/views/adminlte/crud/field/image.html.twig Visa fil

@@ -10,4 +10,6 @@
<div id="{{ html_id }}" class="ea-lightbox">
<img src="{{ asset(field.value.path) }}">
</div>
{% else %}
<div class="badge badge-secondary">Aucun(e)</div>
{% endif %}

+ 1
- 1
Resources/views/adminlte/crud/field/status.html.twig Visa fil

@@ -1,5 +1,5 @@

{% if field.value %}
{% if field.value == 1 %}
<div class="badge badge-success">En ligne</div>
{% else %}
<div class="badge badge-danger">Hors ligne</div>

Laddar…
Avbryt
Spara