Browse Source

Intégartion app order

develop
Fab 3 years ago
parent
commit
13fa802fa6
6 changed files with 53 additions and 27 deletions
  1. +5
    -2
      Component/FileComponent.php
  2. +0
    -3
      Resources/views/adminlte/crud/detail.html.twig
  3. +1
    -1
      Resources/views/adminlte/macro/infobox.html.twig
  4. +26
    -1
      Translation/TranslatorAdmin.php
  5. +14
    -0
      Twig/TranslatorTwigExtension.php
  6. +7
    -20
      Twig/TwigExtension.php

+ 5
- 2
Component/FileComponent.php View File

// lcLiip // lcLiip
public function liip($path, $thumb = 'tile', $default = 'default.jpg') public function liip($path, $thumb = 'tile', $default = 'default.jpg')
{ {
if (substr($path, 0, 1) === '/') $path = substr($path, 1);
if (substr($path, 0, 1) === '/') {
$path = substr($path, 1);
}


if ($path) { if ($path) {
$fileManagerFolder = substr($this->getFileManagerFolder(), 1) ;

$fileManagerFolder = substr($this->getFileManagerFolder(), 1);


if (strpos($path, $fileManagerFolder) === false) { if (strpos($path, $fileManagerFolder) === false) {
$path = $fileManagerFolder . '/' . $path; $path = $fileManagerFolder . '/' . $path;

+ 0
- 3
Resources/views/adminlte/crud/detail.html.twig View File



{% trans_default_domain ea.i18n.translationDomain %} {% trans_default_domain ea.i18n.translationDomain %}


{% block body_id 'ea-detail-' ~ entity.name ~ '-' ~ entity.primaryKeyValue %}
{% block body_class 'ea-detail ea-detail-' ~ entity.name %}

{% block content_title %} {% block content_title %}
{{ 'detail'|sov_trans_admin_title(ea.getEntity().getFqcn()) }} {{ 'detail'|sov_trans_admin_title(ea.getEntity().getFqcn()) }}
{% endblock %} {% endblock %}

+ 1
- 1
Resources/views/adminlte/macro/infobox.html.twig View File

{% block color %}{{ color }}{% endblock %} {% block color %}{{ color }}{% endblock %}
{% block icon %}{{ icon }}{% endblock %} {% block icon %}{{ icon }}{% endblock %}
{% block title %}{{ title }}{% endblock %} {% block title %}{{ title }}{% endblock %}
{% block content %}{{ content }}{% endblock %}
{% block content %}{{ content|raw }}{% endblock %}
{% block button %}{{ button }}{% endblock %} {% block button %}{{ button }}{% endblock %}
{% endembed %} {% endembed %}
{% endmacro %} {% endmacro %}

+ 26
- 1
Translation/TranslatorAdmin.php View File

); );
} }


public function transCard($cardName, $entityClass): string
{
return $this->transEntityThenDefault(
$this->buildTransIdCard($cardName, $entityClass),
$this->buildTransIdCard($cardName, $entityClass, true)
);
}

public function transBox($cardName, $entityClass): string
{
return $this->transEntityThenDefault(
$this->buildTransIdBox($cardName, $entityClass),
$this->buildTransIdBox($cardName, $entityClass, true)
);
}
public function transTitle($pageName, $entityClass = null, $params = []): string public function transTitle($pageName, $entityClass = null, $params = []): string
{ {
$entityName = $this->getEntityName($entityClass); $entityName = $this->getEntityName($entityClass);
return $this->buildTransIdEntitySection($panelName, $entityClass, 'panels', $default); return $this->buildTransIdEntitySection($panelName, $entityClass, 'panels', $default);
} }


private function buildTransIdCard($cardName, $entityClass, $default = false): string
{
return $this->buildTransIdEntitySection($cardName, $entityClass, 'cards', $default);
}

private function buildTransIdBox($boxName, $entityClass, $default = false): string
{
return $this->buildTransIdEntitySection($boxName, $entityClass, 'boxes', $default);
}

private function buildTransIdEntitySection($name, $entityClass, $entitySection, $default): string private function buildTransIdEntitySection($name, $entityClass, $entitySection, $default): string
{ {
if ($default) { if ($default) {
} }
} }


?>
?>

+ 14
- 0
Twig/TranslatorTwigExtension.php View File

new TwigFilter('sov_trans_admin_field', [$this, 'transAdminField']), new TwigFilter('sov_trans_admin_field', [$this, 'transAdminField']),
new TwigFilter('sov_trans_admin_help', [$this, 'transAdminHelp']), new TwigFilter('sov_trans_admin_help', [$this, 'transAdminHelp']),
new TwigFilter('sov_trans_admin_panel', [$this, 'transAdminPanel']), new TwigFilter('sov_trans_admin_panel', [$this, 'transAdminPanel']),
new TwigFilter('sov_trans_admin_card', [$this, 'transAdminCard']),
new TwigFilter('sov_trans_admin_box', [$this, 'transAdminBox']),
new TwigFilter('sov_trans_admin_menu', [$this, 'transAdminMenu']), new TwigFilter('sov_trans_admin_menu', [$this, 'transAdminMenu']),
new TwigFilter('sov_trans_admin_title', [$this, 'transAdminTitle']), new TwigFilter('sov_trans_admin_title', [$this, 'transAdminTitle']),
new TwigFilter('sov_trans_admin_action', [$this, 'transAdminAction']), new TwigFilter('sov_trans_admin_action', [$this, 'transAdminAction']),
return $this->translatorAdmin->transPanel($panelName, $entityClass); return $this->translatorAdmin->transPanel($panelName, $entityClass);
} }



public function transAdminBox($boxName, $entityClass= 'default')
{
return $this->translatorAdmin->transBox($boxName, $entityClass);
}


public function transAdminCard($cardName, $entityClass)
{
return $this->translatorAdmin->transCard($cardName, $entityClass);
}

public function transAdminMenu($menuName) public function transAdminMenu($menuName)
{ {
return $this->translatorAdmin->transMenu($menuName);; return $this->translatorAdmin->transMenu($menuName);;

+ 7
- 20
Twig/TwigExtension.php View File

use App\Repository\ReminderRepository; use App\Repository\ReminderRepository;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Lc\SovBundle\Component\DateComponent; use Lc\SovBundle\Component\DateComponent;
use Lc\SovBundle\Component\FileComponent;
use Lc\SovBundle\Component\MetaComponent; use Lc\SovBundle\Component\MetaComponent;
use Lc\SovBundle\Component\StringComponent; use Lc\SovBundle\Component\StringComponent;
use Lc\SovBundle\Form\Newsletter\NewsletterType; use Lc\SovBundle\Form\Newsletter\NewsletterType;
protected StringComponent $stringComponent; protected StringComponent $stringComponent;
protected MetaComponent $metaComponent; protected MetaComponent $metaComponent;
protected DateComponent $dateComponent; protected DateComponent $dateComponent;
protected FileComponent $fileComponent;


public function __construct( public function __construct(
KernelInterface $kernel, KernelInterface $kernel,
FormFactoryInterface $formFactory, FormFactoryInterface $formFactory,
StringComponent $stringComponent, StringComponent $stringComponent,
MetaComponent $metaComponent, MetaComponent $metaComponent,
DateComponent $dateComponent
DateComponent $dateComponent,
FileComponent $fileComponent
) { ) {
$this->kernel = $kernel; $this->kernel = $kernel;
$this->parameterBag = $parameterBag; $this->parameterBag = $parameterBag;
$this->stringComponent = $stringComponent; $this->stringComponent = $stringComponent;
$this->metaComponent = $metaComponent; $this->metaComponent = $metaComponent;
$this->dateComponent = $dateComponent; $this->dateComponent = $dateComponent;
$this->fileComponent = $fileComponent;
} }


public function getFunctions() public function getFunctions()


public function liip($path, $thumb = 'tile', $default = 'default.jpg') public function liip($path, $thumb = 'tile', $default = 'default.jpg')
{ {
if (substr($path, 0, 1) === '/') {
$path = substr($path, 1);
}

if ($path) {

$fileManagerFolder = substr($this->getFileManagerFolder(), 1);

if (strpos($path, $fileManagerFolder) === false) {
$path = $fileManagerFolder . '/' . $path;
}

if (file_exists($path)) {
return $this->cacheManager->getBrowserPath($path, $thumb);
}
}

return $this->cacheManager->getBrowserPath($this->getFileManagerFolder() . '/' . $default, $thumb);
$this->fileComponent->liip($path, $thumb, $default);
} }


public function getFileManagerFolder() public function getFileManagerFolder()


public function slugify($string) public function slugify($string)
{ {
return $this->stringComponent->slugify($string) ;
return $this->stringComponent->slugify($string);
} }


public function getUserCurrent() public function getUserCurrent()

Loading…
Cancel
Save