about summary refs log tree commit diff
diff options
context:
space:
mode:
authorhakangunturkun2020-03-02 10:37:34 -0600
committerhakangunturkun2020-03-02 10:37:34 -0600
commitafc0a2a9b4a05c3bd0e46e9156d023f8f1ed7474 (patch)
tree0230bce7aabb19050e59d29a9ea112004455eebf
parent883b446bccb4c17ca0b98e6b557fe489f66dc174 (diff)
downloadgenecup-afc0a2a9b4a05c3bd0e46e9156d023f8f1ed7474.tar.gz
redesigned for user login/signup
-rw-r--r--templates/layout.html67
1 files changed, 58 insertions, 9 deletions
diff --git a/templates/layout.html b/templates/layout.html
index 6a85473..6bbfc95 100644
--- a/templates/layout.html
+++ b/templates/layout.html
@@ -3,14 +3,16 @@
 <!-- Required meta tags -->
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
-	<meta http-equiv="X-UA-Compatible" content="ie=edge">
-		 
+    <meta http-equiv="X-UA-Compatible" content="ie=edge">
+	 
     <!-- Bootstrap CSS -->
     <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
-	<link rel=stylesheet type=text/css href="{{ url_for('static', filename='style.css') }}">
-
-	<title>RatsPub: Relationship with Addiction Through Searches of PubMed</title>
+    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
+    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
+    <link rel=stylesheet type=text/css href="{{ url_for('static', filename='style.css') }}">
+    <title>RatsPub: Relationship with Addiction Through Searches of PubMed</title>
 </head>
+
 <body>
 
 <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
@@ -30,16 +32,63 @@
       <li class="nav-item">
         <a class="nav-link" href="/about">About</a>
       </li>
- 
     </ul>
+
+    {% if session['email'] == email %}
+    <ul class="navbar-nav ml-auto">
+      <li class="nav-item dropdown">
+        <a class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
+          Login<span class="sr-only">(current)</span>
+        </a>
+      <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
+        <form class="p-2" action="/login" method="POST">
+          <div class="form-group">
+            <input type="email" class="form-control" name="email" id="email" aria-describedby="emailHelp" placeholder="Email address", value="{{email if email}}">
+          </div>
+          <div class="form-group">
+            <input type="password" class="form-control" name="password" id="password" placeholder="Password">
+            <div class="dropdown-divider"></div>
+            <button type="submit" class="btn btn-primary btn-block">Sign in</button>
+          </div>
+        </form>
+      </div>
+      </li>
+      <a class="nav-link" href="/signup">Sign Up</a>
+    </ul>
+    {%else%}
+    <ul class="navbar-nav ml-auto">
+      <li class="nav-item active">
+      {%if session['name'] != "" %}
+        <a class="nav-link" href="/userarchive">{{session['name']}}'s search history</a> <span class="sr-only">(current)</span></a>
+      </li>
+      {%endif%}
+      <li class="nav-item">
+        <a class="nav-link active" href="/logout">Logout</a>
+      </li>
+    </ul>
+    {%endif%}
   </div>
 </nav>
 
+<div align="right">
+  {% with messages = get_flashed_messages()%}
+  {% if messages %}
+    <ul class=flashes>
+    {% for message in messages %}
+      <div class="loginout">{{ message }}</div>
+    {% endfor %}
+    </ul>
+  {% endif %}
+  {% endwith %}
+</div>
 <br>
-
-	<div class="container">
+<div class="container">
 	{% block content %}{% endblock %}
-	</div>
+</div>
+
+<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
+<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
+<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
 
 </body>