Disable analytics in dev env, redirect to edit page after event update

- Skip loading /stats/script.js and /assets/perf.js when data-env=dev
- Add data-env="{{ app.environment }}" to body tag
- Redirect to edit event page instead of events list after saving

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Serreau Jovann
2026-03-20 22:39:38 +01:00
parent 57ea5c33ac
commit 847fc437de
3 changed files with 6 additions and 2 deletions

View File

@@ -18,6 +18,10 @@ function loadAnalytics() {
return
}
if (document.body.dataset.env === 'dev') {
return
}
const script = document.createElement('script')
script.defer = true
script.src = '/stats/script.js'

View File

@@ -362,7 +362,7 @@ class AccountController extends AbstractController
$this->addFlash('success', 'Evenement modifie avec succes.');
return $this->redirectToRoute('app_account', ['tab' => 'events']);
return $this->redirectToRoute('app_account_edit_event', ['id' => $event->getId()]);
}
return $this->render('account/edit_event.html.twig', [

View File

@@ -79,7 +79,7 @@
{{ vite_asset('app.js') }}
{% endblock %}
</head>
<body class="min-h-screen flex flex-col bg-[#fbfbfb] text-[#111827]">
<body class="min-h-screen flex flex-col bg-[#fbfbfb] text-[#111827]" data-env="{{ app.environment }}">
<header class="sticky top-0 z-50 bg-white border-b-4 border-gray-900">
<nav class="mx-auto px-4 lg:px-8" role="navigation" aria-label="Navigation principale" itemscope itemtype="https://schema.org/SiteNavigationElement">
<div class="flex justify-between items-center h-20">