Переглянути джерело

Intégartion app order

develop
Fab 3 роки тому
джерело
коміт
13fa802fa6
6 змінених файлів з 53 додано та 27 видалено
  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 Переглянути файл

@@ -30,10 +30,13 @@ class FileComponent
// lcLiip
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) {
$fileManagerFolder = substr($this->getFileManagerFolder(), 1) ;

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

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

+ 0
- 3
Resources/views/adminlte/crud/detail.html.twig Переглянути файл

@@ -5,9 +5,6 @@

{% 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 %}
{{ 'detail'|sov_trans_admin_title(ea.getEntity().getFqcn()) }}
{% endblock %}

+ 1
- 1
Resources/views/adminlte/macro/infobox.html.twig Переглянути файл

@@ -3,7 +3,7 @@
{% block color %}{{ color }}{% endblock %}
{% block icon %}{{ icon }}{% endblock %}
{% block title %}{{ title }}{% endblock %}
{% block content %}{{ content }}{% endblock %}
{% block content %}{{ content|raw }}{% endblock %}
{% block button %}{{ button }}{% endblock %}
{% endembed %}
{% endmacro %}

+ 26
- 1
Translation/TranslatorAdmin.php Переглянути файл

@@ -73,6 +73,21 @@ class TranslatorAdmin
);
}

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
{
$entityName = $this->getEntityName($entityClass);
@@ -126,6 +141,16 @@ class TranslatorAdmin
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
{
if ($default) {
@@ -157,4 +182,4 @@ class TranslatorAdmin
}
}

?>
?>

+ 14
- 0
Twig/TranslatorTwigExtension.php Переглянути файл

@@ -44,6 +44,8 @@ class TranslatorTwigExtension extends AbstractExtension
new TwigFilter('sov_trans_admin_field', [$this, 'transAdminField']),
new TwigFilter('sov_trans_admin_help', [$this, 'transAdminHelp']),
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_title', [$this, 'transAdminTitle']),
new TwigFilter('sov_trans_admin_action', [$this, 'transAdminAction']),
@@ -82,6 +84,18 @@ class TranslatorTwigExtension extends AbstractExtension
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)
{
return $this->translatorAdmin->transMenu($menuName);;

+ 7
- 20
Twig/TwigExtension.php Переглянути файл

@@ -5,6 +5,7 @@ namespace Lc\SovBundle\Twig;
use App\Repository\ReminderRepository;
use Doctrine\ORM\EntityManagerInterface;
use Lc\SovBundle\Component\DateComponent;
use Lc\SovBundle\Component\FileComponent;
use Lc\SovBundle\Component\MetaComponent;
use Lc\SovBundle\Component\StringComponent;
use Lc\SovBundle\Form\Newsletter\NewsletterType;
@@ -39,6 +40,7 @@ class TwigExtension extends AbstractExtension
protected StringComponent $stringComponent;
protected MetaComponent $metaComponent;
protected DateComponent $dateComponent;
protected FileComponent $fileComponent;

public function __construct(
KernelInterface $kernel,
@@ -54,7 +56,8 @@ class TwigExtension extends AbstractExtension
FormFactoryInterface $formFactory,
StringComponent $stringComponent,
MetaComponent $metaComponent,
DateComponent $dateComponent
DateComponent $dateComponent,
FileComponent $fileComponent
) {
$this->kernel = $kernel;
$this->parameterBag = $parameterBag;
@@ -70,6 +73,7 @@ class TwigExtension extends AbstractExtension
$this->stringComponent = $stringComponent;
$this->metaComponent = $metaComponent;
$this->dateComponent = $dateComponent;
$this->fileComponent = $fileComponent;
}

public function getFunctions()
@@ -130,24 +134,7 @@ class TwigExtension extends AbstractExtension

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()
@@ -183,7 +170,7 @@ class TwigExtension extends AbstractExtension

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

public function getUserCurrent()

Завантаження…
Відмінити
Зберегти