summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
Diffstat (limited to 'templates')
-rw-r--r--templates/base.rs.html10
-rw-r--r--templates/login.rs.html7
-rw-r--r--templates/signup.rs.html7
-rw-r--r--templates/users.rs.html2
4 files changed, 17 insertions, 9 deletions
diff --git a/templates/base.rs.html b/templates/base.rs.html
index 5b1a324..64a8d4e 100644
--- a/templates/base.rs.html
+++ b/templates/base.rs.html
@@ -1,6 +1,7 @@
@use super::statics::*;
+@use crate::Notification;
-@(authenticated: bool, body: Content)
+@(authenticated: bool, notification: Option<Notification>, body: Content)
<!DOCTYPE html>
<html>
@@ -15,11 +16,16 @@
<body>
<nav>
@if authenticated {
- logout
+ <form action="/logout" method="post">
+ <button type="submit">logout</button>
+ </form>
} else {
<a href="/login">log in</a>
}
</nav>
+ @if let Some(notification) = notification {
+ <div class="notification @notification.kind">@notification.message</div>
+ }
@:body()
</body>
diff --git a/templates/login.rs.html b/templates/login.rs.html
index 349263c..c87866c 100644
--- a/templates/login.rs.html
+++ b/templates/login.rs.html
@@ -1,8 +1,9 @@
@use super::base_html;
+@use crate::Notification;
-@()
+@(notification: Option<Notification>)
-@:base_html(false, {
+@:base_html(false, None, {
<form action="/login" method="post">
<label for="username">username:</label>
<input type="text" id="username" name="username" required="true" />
@@ -12,4 +13,4 @@
<input type="checkbox" id="rememberme" name="rememberme" />
<button type="submit">log in</button>
</form>
-}) \ No newline at end of file
+})
diff --git a/templates/signup.rs.html b/templates/signup.rs.html
index 354dae6..a482fc2 100644
--- a/templates/signup.rs.html
+++ b/templates/signup.rs.html
@@ -1,8 +1,9 @@
@use super::base_html;
+@use crate::Notification;
-@()
+@(notification: Option<Notification>)
-@:base_html(false, {
+@:base_html(false, notification, {
<form action="/signup" method="post">
<label for="username">username:</label>
<input type="text" id="username" name="username" required="true" />
@@ -10,4 +11,4 @@
<input type="text" id="password" name="password" required="true" />
<button type="submit">sign up</button>
</form>
-}) \ No newline at end of file
+})
diff --git a/templates/users.rs.html b/templates/users.rs.html
index 9b9be30..ab1ab0f 100644
--- a/templates/users.rs.html
+++ b/templates/users.rs.html
@@ -3,7 +3,7 @@
@(users: Vec<User>)
-@:base_html(false, {
+@:base_html(false, None, {
<ul>
@for user in users {
<li>@user.username</li>