From 65d23111877e184974fe52f7a68d5d5547adf59d Mon Sep 17 00:00:00 2001
From: Alex ORLUC <alex.orluc@maarch.org>
Date: Mon, 10 Apr 2017 16:39:52 +0200
Subject: [PATCH] update css new header maarch + fix prototype conflict

---
 .../js/angular/app/Views/profile.html         | 35 +++++++++++++------
 .../js/angular/app/profile.component.js       | 16 +++++++++
 .../js/angular/app/profile.component.ts       | 18 ++++++++++
 3 files changed, 59 insertions(+), 10 deletions(-)

diff --git a/apps/maarch_entreprise/js/angular/app/Views/profile.html b/apps/maarch_entreprise/js/angular/app/Views/profile.html
index 2acd6a3d93d..32262ede76b 100644
--- a/apps/maarch_entreprise/js/angular/app/Views/profile.html
+++ b/apps/maarch_entreprise/js/angular/app/Views/profile.html
@@ -64,9 +64,15 @@ h2{
     color: #222;
     border-color: #222;
 }
+.open .dropdown-toggle{
+    color: #009dc5 !important;
+    background-color:#f2f2f2 !important;
+    border-top-left-radius: 3px;
+    border-top-right-radius: 3px;
+}
 </style>
 <!-- TEST HEADER WITH BOOTSTRAP-->
-<!--<nav class="navbar navbar-default" style="height:74px;border-radius:0px;margin-left: -10px;margin-top: -10px;margin-right: -10px;border: solid 2px #009DC5;background: #009DC5;color:white;">
+<nav class="navbar navbar-default" style="height:74px;border-radius:0px;margin-left: -10px;margin-top: -10px;margin-right: -10px;border: solid 2px #009DC5;background: #009DC5;color:white;">
         <div class="container-fluid" style="height: 100%;">
             <ol class="breadcrumb" style="margin-bottom:0px;background:none;position:absolute;">
                 <li><a href="#" style="color:white;">Maarch Courrier 1.7</a></li>
@@ -76,20 +82,29 @@ h2{
                 
                  <ul class="nav navbar-nav">
                      
-        <li class="dropdown" style="font-size:20px;margin-top:10px;">
-          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false" style="color:white;font-weight:bold;"><i class="fa fa-dropbox" aria-hidden="true"></i>
+        <li class="dropdown" style="font-size:20px;margin-top: 14px;height: 40px;">
+          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false" style="padding-bottom: 8px;color:white;font-weight:bold;"><i class="fa fa-dropbox" aria-hidden="true"></i>
  Menu <span class="caret"></span></a>
           <ul class="dropdown-menu">
-            <li><a href="#">Action</a></li>
-            <li><a href="#">Another action</a></li>
-            <li><a href="#">Something else here</a></li>
+            <li><a href="#">Administration</a></li>
+            <li role="separator" class="divider"></li>
+            <li><a href="#">Consulter un dossier</a></li>
+            <li><a href="#">Rechercher un dossier</a></li>
+            <li role="separator" class="divider"></li>
+            <li><a href="#">Enregistrer un document</a></li>
             <li role="separator" class="divider"></li>
-            <li><a href="#">Separated link</a></li>
+            <li><a href="#">Statistiques</a></li>
             <li role="separator" class="divider"></li>
-            <li><a href="#">One more separated link</a></li>
+            <li><a href="#">Mes contacts</a></li>
+            <li role="separator" class="divider"></li>
+            <li><a href="#">Rechercher un document</a></li>
+            <li><a href="#">Rechercher un contact</a></li>
+            <li role="separator" class="divider"></li>
+            <li><a href="#">Mon profile</a></li>
+            <li><a href="#">Déconnexion</a></li>
           </ul>
         </li>
-        <p class="navbar-text" style="position: absolute;margin: 0px;padding: 15px;background: #f2f2f2;width: 80%;height: 40px;top: 30px;border-top-left-radius: 3px;left: 262px;color: #009dc5;font-weight: bold;font-size: 1.3em;">Mon profile</p>
+        <p class="navbar-text" style="position: absolute;margin: 0px;padding: 15px;padding-top: 5px;background: #f2f2f2;width: 80%;height: 40px;top: 30px;border-top-left-radius: 3px;left: 262px;color: #009dc5;font-weight: bold;font-size: 1.3em;"><i class="fa fa-user fa-2x" title=""></i> Mon profile</p>
       </ul>
       
             </div>
@@ -100,7 +115,7 @@ h2{
                     </div>
             </div>
         </div>
-    </nav>-->
+    </nav>
 <div *ngIf="loading">
     <i class="fa fa-spinner fa-spin fa-5x" style="margin-left: 50%;margin-top: 16%;font-size: 8em"></i>
 </div>
diff --git a/apps/maarch_entreprise/js/angular/app/profile.component.js b/apps/maarch_entreprise/js/angular/app/profile.component.js
index 509e18578d1..88970f6cd07 100644
--- a/apps/maarch_entreprise/js/angular/app/profile.component.js
+++ b/apps/maarch_entreprise/js/angular/app/profile.component.js
@@ -26,6 +26,22 @@ var ProfileComponent = (function () {
     ProfileComponent.prototype.ngOnInit = function () {
         var _this = this;
         this.prepareProfile();
+        //FIX PROTOTYPE CONFLICT
+        if (Prototype.BrowserFeatures.ElementExtensions) {
+            var disablePrototypeJS = function (method, pluginsToDisable) {
+                var handler = function (event) {
+                    event.target[method] = undefined;
+                    setTimeout(function () {
+                        delete event.target[method];
+                    }, 0);
+                };
+                pluginsToDisable.each(function (plugin) {
+                    jQuery(window).on(method + '.bs.' + plugin, handler);
+                });
+            }, pluginsToDisable = ['collapse', 'dropdown', 'modal', 'tooltip', 'popover'];
+            disablePrototypeJS('show', pluginsToDisable);
+            disablePrototypeJS('hide', pluginsToDisable);
+        }
         this.loading = true;
         this.http.get('index.php?display=true&page=initializeJsGlobalConfig')
             .map(function (res) { return res.json(); })
diff --git a/apps/maarch_entreprise/js/angular/app/profile.component.ts b/apps/maarch_entreprise/js/angular/app/profile.component.ts
index 76c17f93740..1125527d3dd 100644
--- a/apps/maarch_entreprise/js/angular/app/profile.component.ts
+++ b/apps/maarch_entreprise/js/angular/app/profile.component.ts
@@ -27,6 +27,24 @@ export class ProfileComponent implements OnInit {
 
     ngOnInit(): void {
         this.prepareProfile();
+        //FIX PROTOTYPE CONFLICT
+        if (Prototype.BrowserFeatures.ElementExtensions) {
+            var disablePrototypeJS = function (method, pluginsToDisable) {
+                    var handler = function (event) {
+                        event.target[method] = undefined;
+                        setTimeout(function () {
+                            delete event.target[method];
+                        }, 0);
+                    };
+                    pluginsToDisable.each(function (plugin) { 
+                        jQuery(window).on(method + '.bs.' + plugin, handler);
+                    });
+                },
+                pluginsToDisable = ['collapse', 'dropdown', 'modal', 'tooltip', 'popover'];
+            disablePrototypeJS('show', pluginsToDisable);
+            disablePrototypeJS('hide', pluginsToDisable);
+        }
+        
         this.loading = true;
 
         this.http.get('index.php?display=true&page=initializeJsGlobalConfig')
-- 
GitLab