From 1b7af76d60e9821b21cae15422245a1770ede5b4 Mon Sep 17 00:00:00 2001
From: Laurent Giovannoni <laurent.giovannoni@maarch.org>
Date: Fri, 10 Mar 2017 17:26:39 +0100
Subject: [PATCH] fix perf angular

---
 apps/maarch_entreprise/index.php             | 2 +-
 apps/maarch_entreprise/merged_jsAbstract.php | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/apps/maarch_entreprise/index.php b/apps/maarch_entreprise/index.php
index f42311e95da..40f274d4d0b 100644
--- a/apps/maarch_entreprise/index.php
+++ b/apps/maarch_entreprise/index.php
@@ -387,7 +387,7 @@ if (file_exists($path)) {
 <?php
 if (PROD_MODE) {
 ?>
-<script src="js/angular/main.bundle.min.js"></script>
+<!--script src="js/angular/main.bundle.min.js"></script-->
 <?php
 } else {
     ?>
diff --git a/apps/maarch_entreprise/merged_jsAbstract.php b/apps/maarch_entreprise/merged_jsAbstract.php
index 76d5ea4db50..ef148f4f6b5 100644
--- a/apps/maarch_entreprise/merged_jsAbstract.php
+++ b/apps/maarch_entreprise/merged_jsAbstract.php
@@ -64,6 +64,14 @@ class MergedJsAbstract {
 		readfile('node_modules/systemjs/dist/system.src.js');
 		readfile('apps/maarch_entreprise/js/angular/systemjs.config.js');
 
+		if (!empty($_SESSION['user'])) {
+			if (PROD_MODE) {
+				readfile('apps/maarch_entreprise/js/angular/main.bundle.min.js');
+			} else {
+				readfile('apps/maarch_entreprise/js/angular/main.js');
+			}
+		}
+
         echo "\n";
 	}
 
-- 
GitLab