Browse Source

Adding style

clement 1 year ago
parent
commit
bc2c6c8c52
4 changed files with 90 additions and 95 deletions
  1. 26 0
      templates/base.html
  2. 32 39
      templates/formpassword.html
  3. 2 16
      templates/home.html
  4. 30 40
      templates/sshhomepage.html

+ 26 - 0
templates/base.html

@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        {% block head %}
+        <title>BIM</title>
+        <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css">
+        {% endblock head %}
+    </head>
+    <body>
+        <div>
+        {% block content %}
+            <h1 class="title">Hello {{ username }}</h1>
+            <div class="tabs is-centered is-boxed">
+                <ul>
+                    <li {% if home %}class="is-active"{% endif %}><a href="home">Home</a></li>
+                    <li {% if changepassword %}class="is-active"{% endif %}><a href="changepassword">Change password</a></li>
+                    {% if user_is_ssh %}
+                    <li {% if ssh %}class="is-active"{% endif %}><a href="ssh">Manage SSH Keys</a></li>
+                    {% endif %}
+                    <li><a href="signout">Sign out</a></li>
+                </ul>
+            </div>
+        {% endblock content %}
+        </div>
+    </body>
+</html>

+ 32 - 39
templates/formpassword.html

@@ -1,42 +1,35 @@
-<!DOCTYPE html>
-<html>
-    <head>
-        <title>BIM</title>
-        <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css">
-    </head>
-    <body class="layout-default">
-       <div class="section">
-            <div class="columns is-centered">
-                <form method="post" accept-charset="UTF-8" action="changepassword" class="box">
-                    <div class="field">
-                        <label for="current_password" class="label">Current password</label>
-                        <div class="control">
-                            <input id="current_password" type="password" name="current_password" class="input is-rounded is-primary">
-                        </div>
-                    </div>
+{% set changepassword = true %}
+{% include "base.html" %}
+<div class="section">
+    <div class="columns is-centered">
+        <form method="post" accept-charset="UTF-8" action="changepassword" class="box">
+            <div class="field">
+                <label for="current_password" class="label">Current password</label>
+                <div class="control">
+                    <input id="current_password" type="password" name="current_password" class="input is-rounded is-primary">
+                </div>
+            </div>
 
-                    <div class="field">
-                        <label for="new_password" class="label">New password</label>
-                        <div class="control">
-                            <input id="new_password" type="password" name="new_password" class="input is-rounded is-primary">
-                        </div>
-                    </div>
+            <div class="field">
+                <label for="new_password" class="label">New password</label>
+                <div class="control">
+                    <input id="new_password" type="password" name="new_password" class="input is-rounded is-primary">
+                </div>
+            </div>
 
-                    <div class="field">
-                        <label for="new_password_conf" class="label">Confirm new password</label>
-                        <div class="control">
-                            <input id="new_password_conf" type="password" name="new_password_conf" class="input is-rounded is-primary">
-                        </div>
-                    </div>
-                
-                    <button class="button is-primary">Confirm</button>
-                </form>
+            <div class="field">
+                <label for="new_password_conf" class="label">Confirm new password</label>
+                <div class="control">
+                    <input id="new_password_conf" type="password" name="new_password_conf" class="input is-rounded is-primary">
+                </div>
             </div>
-        </div>
-        {% if error_message %}
-        <div class="container">
-            <div class="box notification is-warning">{{ error_message }}</div>
-        </div>
-        {% endif %}
-    </body>
-</html>
+        
+            <button class="button is-primary">Confirm</button>
+        </form>
+    </div>
+</div>
+{% if error_message %}
+<div class="container">
+<div class="box notification is-warning">{{ error_message }}</div>
+</div>
+{% endif %}

+ 2 - 16
templates/home.html

@@ -1,16 +1,2 @@
-<!DOCTYPE html>
-<html>
-    <head>
-        <title>BIM</title>
-    </head>
-    <body>
-        <h1>Hello {{ username }}</h1>
-        <ul>
-            <li><a href="changepassword">Change password</a></li>
-            {% if user_is_ssh %}
-            <li><a href="ssh">Manage SSH Keys</a></li>
-            {% endif %}
-            <li><a href="signout">Sign out</a></li>
-        </ul>
-    </body>
-</html>
+{% set home = true %}
+{% include "base.html" %}

+ 30 - 40
templates/sshhomepage.html

@@ -1,44 +1,34 @@
-<!DOCTYPE html>
-<html>
-    <head>
-        <title>BIM</title>
-        <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css">
-    </head>
-    <style>
-        body {word-break: break-all;}
-    </style>
-    <body class="layout-default">
-        <div class="section">
-            {% for key_name, key_value in ssh_keys %}
-                <article class="message is-primary">
-                    <div class="message-header">
-                        <div>{{ key_name }}</div>
-                    </div>
-                    <div class="message-body is-family-monospace">
-                        {{ key_value }} </br></br>
-                        <form method="post" accept-charset="UTF-8" action="delsshkey">
-                        <button type="submit" name="key_to_delete" value="{{ key_value }}" class="button is-danger">Delete</button>
-                        </form>
-                    </div>
-                </article>
-            {% endfor %}
+{% set ssh = true %}
+{% include "base.html" %}
+<div class="section">
+    {% for key_name, key_value in ssh_keys %}
+    <article class="message is-primary">
+        <div class="message-header">
+            <div>{{ key_name }}</div>
         </div>
-        <div class="section">
-            <form method="post" accept-charset="UTF-8" action="addsshkey" class="box">
-                <div class="field">
-                    <label for="new_ssh_key" class="label">New SSH key</label>
-                    <div class="control">
-                        <input id="new_ssh_key" type="text" name="new_ssh_key" class="input is-rounded is-primary">
-                    </div>
-                </div>
-
-                <button class="button is-primary">Add</button>
+        <div class="message-body is-family-monospace">
+            {{ key_value }} </br></br>
+            <form method="post" accept-charset="UTF-8" action="delsshkey">
+            <button type="submit" name="key_to_delete" value="{{ key_value }}" class="button is-danger">Delete</button>
             </form>
         </div>
-        {% if error_message %}
-            <div class="container">
-                <div class="box notification is-warning">{{ error_message }}</div>
+    </article>
+    {% endfor %}
+</div>
+<div class="section">
+    <form method="post" accept-charset="UTF-8" action="addsshkey" class="box">
+        <div class="field">
+            <label for="new_ssh_key" class="label">New SSH key</label>
+            <div class="control">
+            <input id="new_ssh_key" type="text" name="new_ssh_key" class="input is-rounded is-primary">
             </div>
-        {% endif %}
-    </body>
-</html>
+        </div>
+
+        <button class="button is-primary">Add</button>
+    </form>
+</div>
+{% if error_message %}
+    <div class="container">
+        <div class="box notification is-warning">{{ error_message }}</div>
+    </div>
+{% endif %}