aboutsummaryrefslogtreecommitdiff
path: root/overview
diff options
context:
space:
mode:
authorLars Krönner2020-10-10 18:39:46 +0200
committerGitHub2020-10-10 18:39:46 +0200
commit1f45ede8253421439e07790375b72a31ceef33ed (patch)
treea9285cef4e2dc3451ed609be2a34bbf21580c35e /overview
parent930ecde7e84e723061cba4780459887c329e50a3 (diff)
parent16ebbb932c0b780c11d3e574bc24a515eb095f5f (diff)
Merge branch 'master' into profile
Diffstat (limited to 'overview')
-rw-r--r--overview/public/index.html7
-rw-r--r--overview/public/script.js22
-rw-r--r--overview/public/style.css4
3 files changed, 29 insertions, 4 deletions
diff --git a/overview/public/index.html b/overview/public/index.html
index c97b83f..f9bc2d8 100644
--- a/overview/public/index.html
+++ b/overview/public/index.html
@@ -15,8 +15,9 @@
</head>
<body>
<div class="pure-menu pure-menu-horizontal">
- <a href="/auth/change.html" class="pure-menu-item pure-menu-link">Passwort ändern</a>
- <a href="/auth/api/logout" class="pure-menu-item pure-menu-link">Logout</a>
+ <a href="" class="pure-menu-item pure-menu-link"></a>
+ <a href="" class="pure-menu-item pure-menu-link"></a>
+ <a href="" class="pure-menu-item pure-menu-link"></a>
</div>
<div class="card">
<h2>Hallo, liebe RBS-Schüler*innen!</h2>
@@ -45,5 +46,7 @@
<li><a href="https://github.com/marvinborner/Abizeugs/">Öffentlicher Source-Code</a></li>
</ul>
</div>
+
+ <script src="script.js"></script>
</body>
</html>
diff --git a/overview/public/script.js b/overview/public/script.js
new file mode 100644
index 0000000..be058b7
--- /dev/null
+++ b/overview/public/script.js
@@ -0,0 +1,22 @@
+fetch("/auth/api/status").then(response => response.json()).then(response => {
+ console.log(response);
+ const first = document.querySelectorAll("a")[0];
+ const second = document.querySelectorAll("a")[1];
+ const third = document.querySelectorAll("a")[2];
+
+ if (!response.admin)
+ third.style.display = "none";
+
+ if (response.loggedIn) {
+ first.href = "/auth/change.html";
+ first.innerText = "Passwort ändern";
+ second.href = "/auth/api/logout";
+ second.innerText = "Logout";
+ if (response.admin) {
+ third.href = "/admin";
+ third.innerText = "Administration";
+ }
+ } else {
+ document.querySelectorAll("div.pure-menu")[0].style.display = "none";
+ }
+});
diff --git a/overview/public/style.css b/overview/public/style.css
index 77853bf..16cd26f 100644
--- a/overview/public/style.css
+++ b/overview/public/style.css
@@ -12,7 +12,7 @@ body {
position: absolute;
max-height: 80%;
overflow: auto;
- width: 30%;
+ width: 40%;
left: 50%;
top: 50%;
-webkit-transform: translate(-50%, -50%);
@@ -26,7 +26,7 @@ div {
background: white;
}
-@media only screen and (max-width: 600px) {
+@media only screen and (max-width: 700px) {
.card {
width: calc(100% - 50px);
}