From 43e2cff7fa35620ced5758b01a1b4ff39eb83704 Mon Sep 17 00:00:00 2001
From: Emanuele Laface <ema@morla.esss.lu.se>
Date: Fri, 7 Feb 2020 11:43:06 +0100
Subject: [PATCH] Menu moved on a single file

---
 README.md                            |  2 +-
 WebSites/dev/index.html              |  9 ++-------
 WebSites/instruments/index.html      |  9 ++-------
 WebSites/interlocks/index.html       |  9 ++-------
 WebSites/menu/available-screens.html |  5 +++++
 WebSites/pos/index.html              | 15 +++------------
 WebSites/pvs/index.html              |  9 ++-------
 WebSites/ts2/index.html              |  9 ++-------
 default.conf                         |  2 +-
 9 files changed, 20 insertions(+), 49 deletions(-)
 create mode 100644 WebSites/menu/available-screens.html

diff --git a/README.md b/README.md
index cc17998..9e42685 100644
--- a/README.md
+++ b/README.md
@@ -35,7 +35,7 @@ Then on the website you have the editor mode where you can create your interface
 Once you think that you have a good page try to resize your browser window to different sizes and rearrange the cells according to the order that you want to have on different screens (mobile, desktop, etc.).
 Finally save the dashboard json file and replace the one that you have in the folder of your local server. Edit the dashboard file and change the allow_edit from true to false.
 
-Finally, if you want to have the page into the main menu, you have to edit all the index.html files of all the screens and add your menu in the <ul id="menu"> section.
+Finally, if you want to have the page into the main menu, you have to edit the file under WebSites/menu/available-screens.html adding the correct link to the new page.
 
 When these steps are complete run again the docker-compose up and verify that everything works according to what you expected. If you think that the 
 
diff --git a/WebSites/dev/index.html b/WebSites/dev/index.html
index bf9fc47..b64a5da 100644
--- a/WebSites/dev/index.html
+++ b/WebSites/dev/index.html
@@ -55,6 +55,7 @@
                     { //DOM Ready
 			freeboard.setAssetRoot("/freeboard-ui/");
                         freeboard.initialize(true);
+                      $('#menu').load("/menu/available-screens.html");
             	        $('#menu').slicknav({
 			    duplicate: false,
                             label: 'Available Screens',
@@ -73,13 +74,7 @@
 <link rel="icon" sizes="192x192" href="/img/icons/pos_v01_dark@192.png">
 </head>
 <body>
-<ul id="menu">
-    <li><a href="/">Public Operations Screen</a></li>
-    <li><a href="/interlocks/">High Voltage Interlocks</a></li>
-    <li><a href="/instruments/">Beam Instruments</a></li>
-    <li><a href="/ts2/">Test Stand 2</a></li>
-    <li><a href="/pvs/">PV Search Engine</a></li>
-</ul>
+<ul id="menu"></ul>
 <div id="board-content">
     <img id="dash-logo" data-bind="attr:{src: header_image}, visible:header_image()">
     <div class="gridster responsive-column-width">
diff --git a/WebSites/instruments/index.html b/WebSites/instruments/index.html
index a1a0137..fe25d50 100644
--- a/WebSites/instruments/index.html
+++ b/WebSites/instruments/index.html
@@ -47,6 +47,7 @@
                     { //DOM Ready
 			freeboard.setAssetRoot("/freeboard-ui/");
                         freeboard.initialize(true);
+                      $('#menu').load("/menu/available-screens.html");
             	        $('#menu').slicknav({
 			    duplicate: false,
                             label: 'Available Screens',
@@ -65,13 +66,7 @@
 <link rel="icon" sizes="192x192" href="/img/icons/pos_v01_dark@192.png">
 </head>
 <body>
-<ul id="menu">
-    <li><a href="/">Public Operations Screen</a></li>
-    <li><a href="/interlocks/">High Voltage Interlocks</a></li>
-    <li><a href="/instruments/">Beam Instruments</a></li>
-    <li><a href="/ts2/">Test Stand 2</a></li>
-    <li><a href="/pvs/">PV Search Engine</a></li>
-</ul>
+<ul id="menu"> </ul>
 <div id="board-content">
     <img id="dash-logo" data-bind="attr:{src: header_image}, visible:header_image()">
     <div class="gridster responsive-column-width">
diff --git a/WebSites/interlocks/index.html b/WebSites/interlocks/index.html
index c5409f4..9fa973b 100644
--- a/WebSites/interlocks/index.html
+++ b/WebSites/interlocks/index.html
@@ -47,6 +47,7 @@
                     { //DOM Ready
 			freeboard.setAssetRoot("/freeboard-ui/");
                         freeboard.initialize(true);
+                      $('#menu').load("/menu/available-screens.html");
             	        $('#menu').slicknav({
 			    duplicate: false,
                             label: 'Available Screens',
@@ -65,13 +66,7 @@
 <link rel="icon" sizes="192x192" href="/img/icons/pos_v01_dark@192.png">
 </head>
 <body>
-<ul id="menu">
-    <li><a href="/">Public Operations Screen</a></li>
-    <li><a href="/interlocks/">High Voltage Interlocks</a></li>
-    <li><a href="/instruments/">Beam Instruments</a></li>
-    <li><a href="/ts2/">Test Stand 2</a></li>
-    <li><a href="/pvs/">PV Search Engine</a></li>
-</ul>
+<ul id="menu"></ul>
 <div id="board-content">
     <img id="dash-logo" data-bind="attr:{src: header_image}, visible:header_image()">
     <div class="gridster responsive-column-width">
diff --git a/WebSites/menu/available-screens.html b/WebSites/menu/available-screens.html
new file mode 100644
index 0000000..59dc84a
--- /dev/null
+++ b/WebSites/menu/available-screens.html
@@ -0,0 +1,5 @@
+<li><a href="/">Public Operations Screen</a></li>
+<li><a href="/interlocks/">High Voltage Interlocks</a></li>
+<li><a href="/instruments/">Beam Instruments</a></li>
+<li><a href="/ts2/">Test Stand 2</a></li>
+<li><a href="/pvs/">PV Search Engine</a></li>
diff --git a/WebSites/pos/index.html b/WebSites/pos/index.html
index bf9fc47..155fc3a 100644
--- a/WebSites/pos/index.html
+++ b/WebSites/pos/index.html
@@ -55,11 +55,8 @@
                     { //DOM Ready
 			freeboard.setAssetRoot("/freeboard-ui/");
                         freeboard.initialize(true);
-            	        $('#menu').slicknav({
-			    duplicate: false,
-                            label: 'Available Screens',
-			    removeIds: false,
-			});
+            	        $('#menu').load("/menu/available-screens.html");
+            	        $('#menu').slicknav({ duplicate: false, label: 'Available Screens', removeIds: false, });
                     });
                 });
     </script>
@@ -73,13 +70,7 @@
 <link rel="icon" sizes="192x192" href="/img/icons/pos_v01_dark@192.png">
 </head>
 <body>
-<ul id="menu">
-    <li><a href="/">Public Operations Screen</a></li>
-    <li><a href="/interlocks/">High Voltage Interlocks</a></li>
-    <li><a href="/instruments/">Beam Instruments</a></li>
-    <li><a href="/ts2/">Test Stand 2</a></li>
-    <li><a href="/pvs/">PV Search Engine</a></li>
-</ul>
+<ul id="menu"></ul>
 <div id="board-content">
     <img id="dash-logo" data-bind="attr:{src: header_image}, visible:header_image()">
     <div class="gridster responsive-column-width">
diff --git a/WebSites/pvs/index.html b/WebSites/pvs/index.html
index 19ed59f..f98dc9e 100644
--- a/WebSites/pvs/index.html
+++ b/WebSites/pvs/index.html
@@ -47,6 +47,7 @@
                     { //DOM Ready
 			freeboard.setAssetRoot("/freeboard-ui/");
                         freeboard.initialize(true);
+                      $('#menu').load("/menu/available-screens.html");
             	        $('#menu').slicknav({
 			    duplicate: false,
                             label: 'Available Screens',
@@ -65,13 +66,7 @@
 <link rel="icon" sizes="192x192" href="/img/icons/pos_v01_dark@192.png">
 </head>
 <body>
-<ul id="menu">
-    <li><a href="/">Public Operations Screen</a></li>
-    <li><a href="/interlocks/">High Voltage Interlocks</a></li>
-    <li><a href="/instruments/">Beam Instruments</a></li>
-    <li><a href="/ts2/">Test Stand 2</a></li>
-    <li><a href="/pvs/">PV Search Engine</a></li>
-</ul>
+<ul id="menu"></ul>
 <div id="board-content">
     <img id="dash-logo" data-bind="attr:{src: header_image}, visible:header_image()">
     <div class="gridster responsive-column-width">
diff --git a/WebSites/ts2/index.html b/WebSites/ts2/index.html
index bf9fc47..b64a5da 100644
--- a/WebSites/ts2/index.html
+++ b/WebSites/ts2/index.html
@@ -55,6 +55,7 @@
                     { //DOM Ready
 			freeboard.setAssetRoot("/freeboard-ui/");
                         freeboard.initialize(true);
+                      $('#menu').load("/menu/available-screens.html");
             	        $('#menu').slicknav({
 			    duplicate: false,
                             label: 'Available Screens',
@@ -73,13 +74,7 @@
 <link rel="icon" sizes="192x192" href="/img/icons/pos_v01_dark@192.png">
 </head>
 <body>
-<ul id="menu">
-    <li><a href="/">Public Operations Screen</a></li>
-    <li><a href="/interlocks/">High Voltage Interlocks</a></li>
-    <li><a href="/instruments/">Beam Instruments</a></li>
-    <li><a href="/ts2/">Test Stand 2</a></li>
-    <li><a href="/pvs/">PV Search Engine</a></li>
-</ul>
+<ul id="menu"></ul>
 <div id="board-content">
     <img id="dash-logo" data-bind="attr:{src: header_image}, visible:header_image()">
     <div class="gridster responsive-column-width">
diff --git a/default.conf b/default.conf
index d5f2617..e697b69 100644
--- a/default.conf
+++ b/default.conf
@@ -5,7 +5,7 @@ server {
         root   /usr/share/nginx/web/pos;
     }
 
-    location ~ ^/(pvs|interlocks|instruments|ts2|dev) {
+    location ~ ^/(menu|pvs|interlocks|instruments|ts2|dev) {
         root   /usr/share/nginx/web;
     }
 
-- 
GitLab