Skip to content
Snippets Groups Projects
Commit 12523cf5 authored by Alex ORLUC's avatar Alex ORLUC
Browse files

FIX angular loading

parent 318794cd
No related branches found
No related tags found
No related merge requests found
...@@ -211,7 +211,6 @@ if ($_REQUEST['page'] && empty($_REQUEST['triggerAngular'])) { ...@@ -211,7 +211,6 @@ if ($_REQUEST['page'] && empty($_REQUEST['triggerAngular'])) {
$core->load_lang(); $core->load_lang();
$core->load_html(); $core->load_html();
$core->load_header(); $core->load_header();
echo '<my-app style="display: block;height: 100%;"></my-app>';
$time = $core->get_session_time_expire(); $time = $core->get_session_time_expire();
/** /**
...@@ -351,8 +350,7 @@ if ($_REQUEST['page'] && empty($_REQUEST['triggerAngular'])) { ...@@ -351,8 +350,7 @@ if ($_REQUEST['page'] && empty($_REQUEST['triggerAngular'])) {
$user = \User\models\UserModel::getByUserId(['userId' => $cookie['userId'], 'select' => ['password_modification_date', 'change_password', 'status']]); $user = \User\models\UserModel::getByUserId(['userId' => $cookie['userId'], 'select' => ['password_modification_date', 'change_password', 'status']]);
//HTML CONTENT OF ANGULAR //HTML CONTENT OF ANGULAR
echo '<div id="loadingAngularContent" style="color: #666;height: 100%;padding: 0;margin: 0;display: flex;align-items: center;justify-content: center;"></div>'; echo '<body></body>';
echo '<my-app style="display: block;height: 100%;"></my-app>';
if ($user['status'] == 'ABS') { if ($user['status'] == 'ABS') {
$_REQUEST['triggerAngular'] = 'activateUser'; $_REQUEST['triggerAngular'] = 'activateUser';
......
...@@ -2,6 +2,8 @@ var $j = jQuery.noConflict(); ...@@ -2,6 +2,8 @@ var $j = jQuery.noConflict();
var angularGlobals = {}; var angularGlobals = {};
var alreadyLoaded = false; var alreadyLoaded = false;
function triggerAngular(locationToGo) { function triggerAngular(locationToGo) {
var myApp = $j('<my-app style="height: 100%;display:none;"></my-app>');
myApp.appendTo('body');
$j.ajax({ $j.ajax({
url : '../../rest/initialize', url : '../../rest/initialize',
type : 'GET', type : 'GET',
...@@ -11,11 +13,10 @@ function triggerAngular(locationToGo) { ...@@ -11,11 +13,10 @@ function triggerAngular(locationToGo) {
if (!alreadyLoaded) { if (!alreadyLoaded) {
var head = document.getElementsByTagName('head')[0]; var head = document.getElementsByTagName('head')[0];
if ($j('#maarch_content').length > 0) { $j('#maarch_content').remove();
$j('#maarch_content').html('<div style="color: #666;height: 100%;padding: 0;margin: 0;display: flex;align-items: center;justify-content: center;"><div style="opacity:0.5;display: flex;justify-content: center;padding: 5px;height: 20px;margin: 10px;line-height: 20px;font-weight: bold;font-size: 2em;text-align: center;"><div class="lds-ring"><div></div><div></div><div></div><div></div></div><div style=\'font-family: Roboto,"Helvetica Neue",sans-serif;\'>Chargement en cours ...</div></div></div>'); var loading = $j('<div id="loadingAngularContent" style="color: #666;height: 100%;padding: 0;margin: 0;display: flex;align-items: center;justify-content: center;"><div style="opacity:0.5;display: flex;justify-content: center;padding: 5px;height: 20px;margin: 10px;line-height: 20px;font-weight: bold;font-size: 2em;text-align: center;"><div class="lds-ring"><div></div><div></div><div></div><div></div></div><div style=\'font-family: Roboto,"Helvetica Neue",sans-serif;\'>Chargement en cours ...</div></div></div>');
} else { loading.appendTo('body');
$j('#loadingAngularContent').html('<div style="opacity:0.5;display: flex;justify-content: center;padding: 5px;height: 20px;margin: 10px;line-height: 20px;font-weight: bold;font-size: 2em;text-align: center;"><div class="lds-ring"><div></div><div></div><div></div><div></div></div><div style=\'font-family: Roboto,"Helvetica Neue",sans-serif;\'>Chargement en cours ...</div></div>');
}
answer['scriptsToinject'].forEach(function(element, i) { answer['scriptsToinject'].forEach(function(element, i) {
var script = document.createElement('script'); var script = document.createElement('script');
script.type = 'text/javascript'; script.type = 'text/javascript';
......
...@@ -41,6 +41,7 @@ export class AppComponent { ...@@ -41,6 +41,7 @@ export class AppComponent {
} }
/*REMOVE AFTER FULL MAARCH V2*/ /*REMOVE AFTER FULL MAARCH V2*/
$j('my-app').css({"display":"block"});
$j('#maarch_content').remove(); $j('#maarch_content').remove();
$j('#loadingAngularContent').remove(); $j('#loadingAngularContent').remove();
$j('#header').remove(); $j('#header').remove();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment