From ede910ffb296725af3155f09380569dcc013d1c2 Mon Sep 17 00:00:00 2001
From: Liam Driscoll <driscolll4@cardiff.ac.uk>
Date: Tue, 6 Dec 2022 10:10:18 +0000
Subject: [PATCH] Moving Manage Coworking Spaces page to template form.

---
 project_server.py                      |  4 ++
 static/Manage_Coworking_Spaces.html    | 94 --------------------------
 templates/Manage_Coworking_Spaces.html | 38 +++++++++++
 templates/base_template.html           |  4 +-
 4 files changed, 44 insertions(+), 96 deletions(-)
 delete mode 100644 static/Manage_Coworking_Spaces.html
 create mode 100644 templates/Manage_Coworking_Spaces.html

diff --git a/project_server.py b/project_server.py
index d5abe52..12c271f 100644
--- a/project_server.py
+++ b/project_server.py
@@ -12,6 +12,10 @@ ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif'])
 def returnTemplate():
     return render_template("test.html")
 
+@app.route("/Manage_Coworking_Spaces", methods=['GET'])
+def returnManageCoworkingSpaces():
+    return render_template("Manage_Coworking_Spaces.html")
+
 @app.route("/SearchRecord", methods=['POST'])
 def searchRecord():
 
diff --git a/static/Manage_Coworking_Spaces.html b/static/Manage_Coworking_Spaces.html
deleted file mode 100644
index 26908ef..0000000
--- a/static/Manage_Coworking_Spaces.html
+++ /dev/null
@@ -1,94 +0,0 @@
-<!DOCTYPE html>
-<html lang="EN" dir="ltr">
-  <head>
-    <meta charSet="UTF-8">
-    <title> Manage Coworking Spaces </title>
-    <link rel="stylesheet" href="CSS/Manage_Coworking_Spaces.css">
-
-  </head>
-  <body onLoad="pageLoad()">
-
-    <header id="pageHeader" class="pageHeader">
-      <div id="headerDiv">
-        <a href="Manage_Coworking_Spaces.html">
-          <img id="headerImg" class="headerImg"
-          src="Media/Tramshed-Logo-Main-Black.png"></img></a>
-        <a id="headerText" class="headerText"
-        href="Manage_Coworking_Spaces.html">
-          Manage Coworking Spaces</a>
-      </div>
-      <nav id="headerNav" class="navBar">
-        <ul class="Left">
-          <li><a href="Manage_Coworking_Spaces.html">
-            <img id="navImg" class="navImg"
-            src="Media/Tramshed-Logo-Main-White.png"></img></a></li>
-          <li><a href="Manage_Coworking_Spaces.html">Home</a></li>
-          <li><a href="Manage_Coworking_Spaces.html">Locations</a></li>
-        </ul>
-        <ul class="Right">
-          <li><a href="Manage_Coworking_Spaces.html">Manage</a></li>
-          <li><a href="Manage_Coworking_Spaces.html">Login</a></li>
-          <li><div class="navHamburger">
-              <span></span>
-              <span></span>
-              <span></span>
-          </div></li>
-        </ul>
-      </nav>
-    </header>
-
-    <main id="pageMain">
-      <form id="recordForm" title="Record Form">
-        <label>Name: <input id="recordName" class="formTextInput"
-          name="record_name" type="text"></label><br>
-        <label>Address: <input id="recordAddress" class="formTextInput"
-          name="record_address" type="text"></label><br>
-        <label>Main Photograph: <input id="recordMainPhotos" class="formTextInput"
-          name="record_MP" type="text"></label><br>
-        <label>Additional Photographs: <input id="recordAdditionalPhotos" class="formTextInput"
-          name="record_AP" type="text"></label><br>
-        <label>Description: <input id="recordDescription" class="formTextInput"
-          name="record_description" type="text"></label><br>
-        <label>Website: <input id="recordWebsite" class="formTextInput"
-          name="record_website" type="text"></label><br>
-          <label>Email: <input id="recordEmail" class="formTextInput"
-          name="record_email" type="text"></label><br>
-        <label>Phone Number: <input id="recordPhoneNumber" class="formTextInput"
-          name="record_PN" type="text"></label><br>
-        <label>Opening Hours: <input id="recordOpeningHours" class="formTextInput"
-          name="record_OH" type="text"></label><br>
-        <label>Checkin Instructions: <input id="recordCheckinInstructions" class="formTextInput"
-          name="record_CI" type="text"></label>
-
-        <br><br>
-        <button id="searchButton" type="submit">Search</button>
-        <button id="addButton" type="submit">Add</button>
-        <button id="editButton" type="submit">Edit</button>
-        <button id="deleteButton" type="submit">Delete</button>
-      </form>
-      <br>
-      <span id="DEBUGserverMessage"> </span>
-
-      <br><br><br><br><br><br><br><br><br><br><br><br>
-      <br><br><br><br><br><br><br><br><br><br><br><br>
-      <br><br><br><br><br><br><br><br><br><br><br><br>
-      <br><br><br><br><br><br><br><br><br><br><br><br>
-    </main>
-
-    <footer id="pageFooter">
-      <nav id="footerNav" class="navBar">
-        <ul class="Center">
-          <li><a href="Manage_Coworking_Spaces.html">Left</a></li>
-        </ul>
-        <ul class="Center">
-          <li><a href="Manage_Coworking_Spaces.html">Center</a></li>
-        </ul>
-        <ul class="Center">
-          <li><a href="Manage_Coworking_Spaces.html">Right</a></li>
-        </ul>
-      </nav>
-    </footer>
-
-    <script src="JS/Manage_Coworking_Spaces.js"></script>
-  </body>
-</html>
diff --git a/templates/Manage_Coworking_Spaces.html b/templates/Manage_Coworking_Spaces.html
new file mode 100644
index 0000000..608655a
--- /dev/null
+++ b/templates/Manage_Coworking_Spaces.html
@@ -0,0 +1,38 @@
+{%extends "base_template.html"%}
+{%block mainblock%}
+<form id="recordForm" title="Record Form">
+  <label>Name: <input id="recordName" class="formTextInput"
+    name="record_name" type="text"></label><br>
+  <label>Address: <input id="recordAddress" class="formTextInput"
+    name="record_address" type="text"></label><br>
+  <label>Main Photograph: <input id="recordMainPhotos" class="formTextInput"
+    name="record_MP" type="text"></label><br>
+  <label>Additional Photographs: <input id="recordAdditionalPhotos" class="formTextInput"
+    name="record_AP" type="text"></label><br>
+  <label>Description: <input id="recordDescription" class="formTextInput"
+    name="record_description" type="text"></label><br>
+  <label>Website: <input id="recordWebsite" class="formTextInput"
+    name="record_website" type="text"></label><br>
+    <label>Email: <input id="recordEmail" class="formTextInput"
+    name="record_email" type="text"></label><br>
+  <label>Phone Number: <input id="recordPhoneNumber" class="formTextInput"
+    name="record_PN" type="text"></label><br>
+  <label>Opening Hours: <input id="recordOpeningHours" class="formTextInput"
+    name="record_OH" type="text"></label><br>
+  <label>Checkin Instructions: <input id="recordCheckinInstructions" class="formTextInput"
+    name="record_CI" type="text"></label>
+
+  <br><br>
+  <button id="searchButton" type="submit">Search</button>
+  <button id="addButton" type="submit">Add</button>
+  <button id="editButton" type="submit">Edit</button>
+  <button id="deleteButton" type="submit">Delete</button>
+</form>
+<br>
+<span id="DEBUGserverMessage"> </span>
+
+<br><br><br><br><br><br><br><br><br><br><br><br>
+<br><br><br><br><br><br><br><br><br><br><br><br>
+<br><br><br><br><br><br><br><br><br><br><br><br>
+<br><br><br><br><br><br><br><br><br><br><br><br>
+{%endblock%}
diff --git a/templates/base_template.html b/templates/base_template.html
index 0b285b1..845295b 100644
--- a/templates/base_template.html
+++ b/templates/base_template.html
@@ -12,7 +12,7 @@
       <div id="headerDiv">
         <a href="Manage_Coworking_Spaces.html">
           <img id="headerImg" class="headerImg"
-          src="Media/Tramshed-Logo-Main-Black.png"></img></a>
+          src="/static/Media/Tramshed-Logo-Main-Black.png"></img></a>
         <a id="headerText" class="headerText"
         href="Manage_Coworking_Spaces.html">
           Manage Coworking Spaces</a>
@@ -21,7 +21,7 @@
         <ul class="Left">
           <li><a href="Manage_Coworking_Spaces.html">
             <img id="navImg" class="navImg"
-            src="Media/Tramshed-Logo-Main-White.png"></img></a></li>
+            src="/static/Media/Tramshed-Logo-Main-White.png"></img></a></li>
           <li><a href="Manage_Coworking_Spaces.html">Home</a></li>
           <li><a href="Manage_Coworking_Spaces.html">Locations</a></li>
         </ul>
-- 
GitLab