Bläddra i källkod

Merge branch 'develop'

develop
Guillaume 3 år sedan
förälder
incheckning
83efb28cb1
10 ändrade filer med 71 tillägg och 37 borttagningar
  1. +2
    -1
      Component/EntityComponent.php
  2. +3
    -0
      Controller/Dashboard/DashboardAdminController.php
  3. +30
    -4
      Controller/ErrorController.php
  4. +1
    -0
      Resources/assets/app/adminlte/index/index.scss
  5. +3
    -0
      Resources/assets/app/adminlte/main/init.js
  6. +0
    -8
      Resources/assets/app/adminlte/main/scss/_common.scss
  7. +2
    -0
      Resources/assets/functions/widgets.js
  8. +3
    -1
      Resources/config/services.yaml
  9. +10
    -1
      Resources/views/adminlte/crud/index.html.twig
  10. +17
    -22
      Resources/views/exception/error.html.twig

+ 2
- 1
Component/EntityComponent.php Visa fil

@@ -68,8 +68,9 @@ class EntityComponent
$newEntity->setCreatedAt(new \DateTime());
}

$this->entityManager->create($newEntity);
$this->eventDispatcher->dispatch(new EntityComponentEvent($newEntity), EntityComponentEvent::DUPLICATE_EVENT);
//Ne pas utiliser create ici! Sinon pour certaine entité comme ProductFamily on réajoute un orginProduct
$this->entityManager->persist($newEntity);

return $newEntity;
}

+ 3
- 0
Controller/Dashboard/DashboardAdminController.php Visa fil

@@ -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');

+ 30
- 4
Controller/ErrorController.php Visa fil

@@ -2,22 +2,48 @@

namespace Lc\SovBundle\Controller;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Mailer\MailerInterface;
use Throwable;
use Symfony\Component\HttpKernel\Log\DebugLoggerInterface;
use Symfony\Component\Mime\Email;

class ErrorController extends AbstractController
{

public function show(Throwable $exception, DebugLoggerInterface $logger = null)
public function show($exception, DebugLoggerInterface $logger = null, MailerInterface $mailer)
{
if ($this->getRequestStack()->getCurrentRequest()->getPathInfo() == "/admin") {
//Si != de 404 on envoit un mail de debug
if ($exception->getStatusCode() != 404) {
$mailDebug = $this->getParameter('app.mail_debug');
if ($mailDebug) {
$message = "Code : " . $exception->getStatusCode() . "<br>";
$message .= "Message : " . $exception->getMessage() . "<br>";
$message .= "File : " . $exception->getFile() . "<br>";
$message .= "Line : " . $exception->getLine() . "<br><br>";
$message .= "Trace : <br>" . str_replace("\n", "<br>", $exception->getTraceAsString());
$siteName = $this->getParameter('app.site_name');
$email = (new Email())
->from('nepasrepondre@laclic.fr')
->to($mailDebug)
->subject(
'[' . $siteName . '] [ERREUR ' . $exception->getStatusCode() . '] ' . $exception->getMessage(
) . ''
)
->text(strip_tags($message))
->html($message);

$mailer->send($email);
}
}
if (str_contains($this->getRequestStack()->getCurrentRequest(), "/admin")) {
return $this->render('@LcSov/exception/error.html.twig', [
"code" => $exception->getCode(),
"code" => $exception->getStatusCode(),
"message" => $exception->getMessage()
]);
} else {
return $this->render('bundles/TwigBundle/Exception/error.html.twig', [
"code" => $exception->getCode(),
"code" => $exception->getStatusCode(),
"message" => $exception->getMessage()
]);
}

+ 1
- 0
Resources/assets/app/adminlte/index/index.scss Visa fil

@@ -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 Visa fil

@@ -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 Visa fil

@@ -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 Visa fil

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

myselect.off('select2:open')

return myselect;
}
}

+ 3
- 1
Resources/config/services.yaml Visa fil

@@ -41,4 +41,6 @@ services:
- { name: kernel.event_listener, event: kernel.exception }

parameters:
app.admin.logo: 'laclic.png'
app.admin.logo: 'laclic.png'
app.site_name: 'laclic-sov'
app.mail_debug: ''

+ 10
- 1
Resources/views/adminlte/crud/index.html.twig Visa fil

@@ -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 %}


+ 17
- 22
Resources/views/exception/error.html.twig Visa fil

@@ -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>

Laddar…
Avbryt
Spara