Browse Source

status + toggle + dashboard style

develop
Charly 3 years ago
parent
commit
8100de5589
6 changed files with 18 additions and 9 deletions
  1. +1
    -1
      Controller/Newsletter/NewsletterAdminController.php
  2. +2
    -1
      Field/BooleanField.php
  3. +0
    -3
      Field/StatusField.php
  4. +14
    -2
      Resources/assets/app/adminlte/main/scss/_common.scss
  5. +0
    -1
      Resources/views/adminlte/crud/field/status.html.twig
  6. +1
    -1
      Resources/views/adminlte/crud/field/toggle.html.twig

+ 1
- 1
Controller/Newsletter/NewsletterAdminController.php View File

use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\SovBundle\Controller\AbstractAdminController; use Lc\SovBundle\Controller\AbstractAdminController;
use Lc\SovBundle\Factory\Newsletter\NewsletterFactory; use Lc\SovBundle\Factory\Newsletter\NewsletterFactory;
use Lc\SovBundle\Field\ToggleField;
use Lc\SovBundle\Field\BooleanField;
use Lc\SovBundle\Field\CKEditorField; use Lc\SovBundle\Field\CKEditorField;
use Lc\SovBundle\Field\StatusField; use Lc\SovBundle\Field\StatusField;



+ 2
- 1
Field/BooleanField.php View File



use EasyCorp\Bundle\EasyAdminBundle\Contracts\Field\FieldInterface; use EasyCorp\Bundle\EasyAdminBundle\Contracts\Field\FieldInterface;
use EasyCorp\Bundle\EasyAdminBundle\Field\FieldTrait; use EasyCorp\Bundle\EasyAdminBundle\Field\FieldTrait;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\TextType;


/** /**
->setProperty($propertyName) ->setProperty($propertyName)
->setLabel($label) ->setLabel($label)
->setTemplatePath('@LcSov/adminlte/crud/field/boolean.html.twig') ->setTemplatePath('@LcSov/adminlte/crud/field/boolean.html.twig')
->setFormType(TextType::class);
->setFormType(CheckboxType::class);
} }


} }

+ 0
- 3
Field/StatusField.php View File



use EasyCorp\Bundle\EasyAdminBundle\Contracts\Field\FieldInterface; use EasyCorp\Bundle\EasyAdminBundle\Contracts\Field\FieldInterface;
use EasyCorp\Bundle\EasyAdminBundle\Field\FieldTrait; 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\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\TextType;


/** /**
* @author La clic ! <contact@laclic.fr> * @author La clic ! <contact@laclic.fr>
if (!$templateToggle) { if (!$templateToggle) {
$template = 'status.html.twig'; $template = 'status.html.twig';
} }

$field->setTemplatePath('@LcSov/adminlte/crud/field/' . $template); $field->setTemplatePath('@LcSov/adminlte/crud/field/' . $template);


return $field; return $field;

+ 14
- 2
Resources/assets/app/adminlte/main/scss/_common.scss View File

ul.navbar-nav { ul.navbar-nav {
li.nav-item-user-menu { li.nav-item-user-menu {
.dropdown-menu { .dropdown-menu {
position: absolute ;
z-index: 1000 ;
position: absolute;
z-index: 1000;
} }
} }


} }
} }
} }
}

.main-sidebar p {
font-size: 0.8rem;
}

.nav-link {
padding: 0.5rem 0.5rem;
}

.nav-treeview .nav-link {
padding: 0.2rem 0.5rem 0.2rem 1.2rem;
} }

+ 0
- 1
Resources/views/adminlte/crud/field/status.html.twig View File


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

+ 1
- 1
Resources/views/adminlte/crud/field/toggle.html.twig View File

{% set item = entity.instance %} {% set item = entity.instance %}
{% set property_name = field.getProperty() %} {% set property_name = field.getProperty() %}
{% set id_toggle = 'toogle-'~item.id~'-'~property_name %}
{% set id_toggle = 'toggle-'~item.id~'-'~property_name %}


<div class="custom-control custom-switch custom-switch-on-success custom-switch-off-default" <div class="custom-control custom-switch custom-switch-on-success custom-switch-off-default"
data-url="{{ ea_url({crudAction: 'edit', entityId: item.id, fieldName: property_name }) }}"> data-url="{{ ea_url({crudAction: 'edit', entityId: item.id, fieldName: property_name }) }}">

Loading…
Cancel
Save