Bladeren bron

Merge branch 'develop'

develop
Fabien Normand 3 jaren geleden
bovenliggende
commit
f69e8575b3
13 gewijzigde bestanden met toevoegingen van 97 en 83 verwijderingen
  1. +3
    -2
      Controller/Dashboard/DashboardAdminController.php
  2. +1
    -1
      Controller/ErrorController.php
  3. +4
    -4
      Controller/Security/SecurityAdminController.php
  4. +0
    -1
      Repository/Site/NewsStore.php
  5. +1
    -0
      Resources/assets/app/adminlte/index/index.scss
  6. +3
    -0
      Resources/assets/app/adminlte/main/init.js
  7. +0
    -8
      Resources/assets/app/adminlte/main/scss/_common.scss
  8. +2
    -0
      Resources/assets/functions/widgets.js
  9. +4
    -1
      Resources/config/services.yaml
  10. +10
    -1
      Resources/views/adminlte/crud/index.html.twig
  11. +1
    -2
      Resources/views/adminlte/layout.html.twig
  12. +17
    -22
      Resources/views/exception/error.html.twig
  13. +51
    -41
      Twig/TwigExtension.php

+ 3
- 2
Controller/Dashboard/DashboardAdminController.php Bestand weergeven

@@ -19,6 +19,9 @@ class DashboardAdminController extends AbstractDashboardController

use ControllerTrait;

/**
* @Route("/admin", name="app_admin_dashboard")
*/
public function index(): Response
{
return $this->render('@LcSov/adminlte/dashboard.html.twig');
@@ -29,8 +32,6 @@ class DashboardAdminController extends AbstractDashboardController
return Dashboard::new()
// the name visible to end users
->setTitle('LA CLIC !')
// you can include HTML contents too (e.g. to link to an image)
->setTitle('<img src="assets/img/'.$this->get('parameter_bag')->get('app.admin.logo').'" width="100px">')
// the path defined in this method is passed to the Twig asset() function
->setFaviconPath('assets/img/frontend/favicon-pdl.png')
// the domain used by default is 'messages'

+ 1
- 1
Controller/ErrorController.php Bestand weergeven

@@ -10,7 +10,7 @@ class ErrorController extends AbstractController

public function show(Throwable $exception, DebugLoggerInterface $logger = null)
{
if ($this->getRequestStack()->getCurrentRequest()->getPathInfo() == "/admin") {
if (str_contains($this->getRequestStack()->getCurrentRequest(), "/admin")) {
return $this->render('@LcSov/exception/error.html.twig', [
"code" => $exception->getCode(),
"message" => $exception->getMessage()

+ 4
- 4
Controller/Security/SecurityAdminController.php Bestand weergeven

@@ -40,7 +40,7 @@ class SecurityAdminController extends AbstractController
// the title visible above the login form (define this option only if you are
// rendering the login template in a regular Symfony controller; when rendering
// it from an EasyAdmin Dashboard this is automatically set as the Dashboard title)
'page_title' => '<img src="assets/img/' . $this->get('parameter_bag')->get('app.admin.logo') . '" >',
'page_title' => '<img class="logo-admin" src="assets/img/' . $this->getParameter('app.admin.logo') . '" >',

// the string used to generate the CSRF token. If you don't define
// this parameter, the login form won't include a CSRF token
@@ -50,13 +50,13 @@ class SecurityAdminController extends AbstractController
'target_path' => $this->generateUrl('app_admin_dashboard'),

// the label displayed for the username form field (the |trans filter is applied to it)
'username_label' => 'Your username',
'username_label' => 'Email',

// the label displayed for the password form field (the |trans filter is applied to it)
'password_label' => 'Your password',
'password_label' => 'Mot de passe',

// the label displayed for the Sign In form button (the |trans filter is applied to it)
'sign_in_label' => 'Log in',
'sign_in_label' => 'Connexion',

// the 'name' HTML attribute of the <input> used for the username field (default: '_username')
'username_parameter' => 'email',

+ 0
- 1
Repository/Site/NewsStore.php Bestand weergeven

@@ -18,7 +18,6 @@ class NewsStore extends AbstractStore implements NewsStoreInterface

public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
{
$query->orderBy('id');
return $query;
}


+ 1
- 0
Resources/assets/app/adminlte/index/index.scss Bestand weergeven

@@ -40,3 +40,4 @@ table th.filtered{border-top:2px solid var(--primary);}
.card-body table th.sorted, table th.sorting_asc, table th.sorting_desc{border-top:2px solid var(--success);}
.card-body table th.sorted.filtered{border-top:0px; position: relative;}
.card-body table th.sorted.filtered:after{ content: ''; height: 2px; position: absolute; left: 0; width: 100%; right: 0; top: -1px; background: linear-gradient(to right, var(--success) 0%, var(--success) 50%, var(--primary) 50%, var(--primary) 100%);}
.link-as-text{color: #212529; }

+ 3
- 0
Resources/assets/app/adminlte/main/init.js Bestand weergeven

@@ -1,5 +1,8 @@
window.addEventListener('load', (event) => {

$(document).on('select2:open', () => {
document.querySelector('.select2-search__field').focus();
});

SovNotification.init();


+ 0
- 8
Resources/assets/app/adminlte/main/scss/_common.scss Bestand weergeven

@@ -1,11 +1,3 @@
#page-error {
text-align: center;

img {
margin-top: 100px;
}
}

nav.main-header {
ul.navbar-nav {
li.nav-item-user-menu {

+ 2
- 0
Resources/assets/functions/widgets.js Bestand weergeven

@@ -34,6 +34,8 @@ export class SovWidgets {
});
SovTools.log(myselect);

myselect.off('select2:open')

return myselect;
}
}

+ 4
- 1
Resources/config/services.yaml Bestand weergeven

@@ -38,4 +38,7 @@ services:

Lc\SovBundle\EventListener\ExceptionListener:
tags:
- { name: kernel.event_listener, event: kernel.exception }
- { name: kernel.event_listener, event: kernel.exception }

parameters:
app.admin.logo: 'laclic.png'

+ 10
- 1
Resources/views/adminlte/crud/index.html.twig Bestand weergeven

@@ -141,7 +141,16 @@
{% for field in entity.fields %}
<td class="{{ field.property == sort_field_name ? 'sorted' }} text-{{ field.textAlign }} {{ field.cssClass }}"
dir="{{ ea.i18n.textDirection }}">
{{ include(field.templatePath, { field: field, entity: entity }, with_context = false) }}
{# {% if (field.property == 'id' or field.property == 'title') %}#}
{# #}{# {% if (field == 'title' or field== 'id') and (metadata.dataType=="string" or metadata.dataType=="integer") and _entity_config.name != 'ProductFamilyAdvancedEditing' %} #}
{# <a class="link-as-text"#}
{# href="{{ ea_url_short(null, 'edit', entity.instance.id) }}">#}
{# {{ include(field.templatePath, { field: field, entity: entity }, with_context = false) }}#}

{# </a>#}
{# {% else %}#}
{{ include(field.templatePath, { field: field, entity: entity }, with_context = false) }}
{# {% endif %}#}
</td>
{% endfor %}


+ 1
- 2
Resources/views/adminlte/layout.html.twig Bestand weergeven

@@ -89,8 +89,7 @@
<a class="brand-link text-center"
title="{{ ea.dashboardTitle|striptags }}"
href="{{ path(ea.dashboardRouteName) }}">
{{ ea.dashboardTitle|raw }}
<!--<span class="brand-text font-weight-light">Texte logo</span>-->
{{ logo_admin()|raw }}
</a>
{% endblock header_logo %}


+ 17
- 22
Resources/views/exception/error.html.twig Bestand weergeven

@@ -1,24 +1,19 @@
{% extends '@LcSov/adminlte/layout.html.twig' %}

{% block wrapper %}
{% block navbar_header %}{% endblock %}
{% block sidebar %}{% endblock %}
{% block content %}
<div id="page-error">
<html>
<div id="page-error">
<a href="{{ path('app_admin_dashboard') }}" title="Retourner sur l'admin">Retourner sur l'admin</a>
<div>
<a href="{{ path('app_admin_dashboard') }}" title="Retourner sur l'admin">
<img src="{{ asset('bundles/lcsov/img/erreur-500.png') }}" alt="ERROR">
</div>
{% endblock %}
{% endblock %}
{# {% extends 'layout.html' %} #}

{# {% set title = 'Erreur' %} #}
{# {% block page_title %}{% endblock %} #}
{# {% block title %}{{ title }}{% endblock %} #}
</a>
</div>
</div>
<style>
#page-error {
text-align: center;
}

{# {% block content %} #}
{# {% embed 'bundles/TwigBundle/Exception/_content.html.twig' %} #}
{# {% block content_error %} #}
{# <p>Une erreur est survenue.TEST</p> #}
{# {% endblock %} #}
{# {% endembed %} #}
{# {% endblock %} #}
img {
margin-top: 100px;
}
</style>
</html>

+ 51
- 41
Twig/TwigExtension.php Bestand weergeven

@@ -47,22 +47,22 @@ class TwigExtension extends AbstractExtension
protected AdminUrlGenerator $adminUrlGenerator;

public function __construct(
KernelInterface $kernel,
ParameterBagInterface $parameterBag,
CacheManager $cacheManager,
EntityManagerInterface $entityManager,
RequestStack $requestStack,
UrlGeneratorInterface $router,
TranslatorInterface $translator,
TranslatorAdmin $translatorAdmin,
ReminderStore $reminderStore,
Security $security,
FormFactoryInterface $formFactory,
StringComponent $stringComponent,
MetaComponent $metaComponent,
DateComponent $dateComponent,
FileComponent $fileComponent,
AdminUrlGenerator $adminUrlGenerator
KernelInterface $kernel,
ParameterBagInterface $parameterBag,
CacheManager $cacheManager,
EntityManagerInterface $entityManager,
RequestStack $requestStack,
UrlGeneratorInterface $router,
TranslatorInterface $translator,
TranslatorAdmin $translatorAdmin,
ReminderStore $reminderStore,
Security $security,
FormFactoryInterface $formFactory,
StringComponent $stringComponent,
MetaComponent $metaComponent,
DateComponent $dateComponent,
FileComponent $fileComponent,
AdminUrlGenerator $adminUrlGenerator
) {
$this->kernel = $kernel;
$this->parameterBag = $parameterBag;
@@ -85,19 +85,20 @@ class TwigExtension extends AbstractExtension
public function getFunctions()
{
return [
new TwigFunction('sov_liip', [$this, 'liip']),
new TwigFunction('liip', [$this, 'liip']),
new TwigFunction('sov_get_by_devalias', [$this, 'getByDevAlias']),
new TwigFunction('sov_parameter', [$this, 'getParameter']),
new TwigFunction('sov_homepage_route', [$this, 'getHomepageRoute']),
new TwigFunction('lc_format_price', [$this, 'formatPrice']),
new TwigFunction('die', [$this, 'die']),
new TwigFunction('get_form_newsletter', [$this, 'getFormNewsletter']),
new TwigFunction('sov_limit_text', [$this, 'limitText']),
new TwigFunction('day_by_number', [$this, 'getDayByNumber']),
new TwigFunction('user_current', [$this, 'getUserCurrent']),
new TwigFunction('ea_url_short', [$this, 'generateEaUrl']),
new TwigFunction('is_instance_of', [$this, 'isInstanceOf']),
new TwigFunction('sov_liip', [$this, 'liip']),
new TwigFunction('liip', [$this, 'liip']),
new TwigFunction('sov_get_by_devalias', [$this, 'getByDevAlias']),
new TwigFunction('sov_parameter', [$this, 'getParameter']),
new TwigFunction('sov_homepage_route', [$this, 'getHomepageRoute']),
new TwigFunction('lc_format_price', [$this, 'formatPrice']),
new TwigFunction('die', [$this, 'die']),
new TwigFunction('get_form_newsletter', [$this, 'getFormNewsletter']),
new TwigFunction('sov_limit_text', [$this, 'limitText']),
new TwigFunction('day_by_number', [$this, 'getDayByNumber']),
new TwigFunction('user_current', [$this, 'getUserCurrent']),
new TwigFunction('ea_url_short', [$this, 'generateEaUrl']),
new TwigFunction('is_instance_of', [$this, 'isInstanceOf']),
new TwigFunction('logo_admin', [$this, 'getLogoAdmin']),
];
}

@@ -109,12 +110,12 @@ class TwigExtension extends AbstractExtension
public function getFilters()
{
return [
new TwigFilter('uc_first', [$this, 'ucFirst']),
new TwigFilter('format_price', [$this, 'formatPrice']),
new TwigFilter('sov_cache', [$this, 'sovCache']),
new TwigFilter('slugify', [$this, 'slugify']),
new TwigFilter('md5', [$this, 'md5']),
new TwigFilter('rot13', [$this, 'rot13']),
new TwigFilter('uc_first', [$this, 'ucFirst']),
new TwigFilter('format_price', [$this, 'formatPrice']),
new TwigFilter('sov_cache', [$this, 'sovCache']),
new TwigFilter('slugify', [$this, 'slugify']),
new TwigFilter('md5', [$this, 'md5']),
new TwigFilter('rot13', [$this, 'rot13']),
];
}

@@ -128,8 +129,8 @@ class TwigExtension extends AbstractExtension
$reflection = new \ReflectionClass($entity);
$interfaceNameArray = $reflection->getInterfaceNames();

foreach($interfaceNameArray as $interfaceNameEntity) {
if(strpos($interfaceNameEntity, $interfaceName) !== false) {
foreach ($interfaceNameArray as $interfaceNameEntity) {
if (strpos($interfaceNameEntity, $interfaceName) !== false) {
return true;
}
}
@@ -207,8 +208,12 @@ class TwigExtension extends AbstractExtension
return $this->security->getUser();
}

public function generateEaUrl(string $controller =null, string $action=null, int $entityId=null, array $extraParam = array()): string
{
public function generateEaUrl(
string $controller = null,
string $action = null,
int $entityId = null,
array $extraParam = array()
): string {
$adminUrlGenerator = $this->adminUrlGenerator;

if ($controller) {
@@ -220,8 +225,8 @@ class TwigExtension extends AbstractExtension

$adminUrlGenerator->setEntityId($entityId);

if($extraParam){
foreach ($extraParam as $key=>$value) {
if ($extraParam) {
foreach ($extraParam as $key => $value) {
$adminUrlGenerator->set($key, $value);
}
}
@@ -232,4 +237,9 @@ class TwigExtension extends AbstractExtension
{
return md5($text);
}

public function getLogoAdmin(): string
{
return '<img class="logo-admin" src="assets/img/' . $this->getParameter('app.admin.logo') . '" >';
}
}

Laden…
Annuleren
Opslaan