add user-aware header

This commit is contained in:
Joe Ardent 2023-06-13 14:33:31 -07:00
parent 4026bf16b7
commit ec2b60098e
7 changed files with 46 additions and 15 deletions

View File

@ -1,18 +1,20 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<title>{% block title %}{{ title }} - Witch Watch{% endblock %}</title> <meta charset="utf-8">
{% block head %}{% endblock %} <meta name="viewport" content="width=device-width, initial-scale=1">
</head> <title>{% block title %}{{ title }} - Witch Watch{% endblock %}</title>
<body> {% block head %}{% endblock %}
<div id="header"> </head>
{% block header %}{% endblock %} <body>
</div> <div id="header">
<div id="content"> {% block header %}{% include "header_with_user.html" %}{% endblock %}
{% block content %}{% endblock %} </div>
</div> <div id="content">
<div id="footer"> {% block content %}{% endblock %}
{% block footer %}{% endblock %} </div>
</div> <div id="footer">
</body> {% block footer %}{% endblock %}
</div>
</body>
</html> </html>

View File

@ -0,0 +1,20 @@
{% match user %}
{% when Some with (usr) %}
<div class="header_logged_in">
Hello, {{ usr.username }}!
</div>
<div class="header_signout">
<input type="submit" value="sign out?">
</form>
</div>
{% else %}
<div class="header_logged_out">
Heya, why don't you <a href="/login">log in</a> or <a href="/signup">sign up</a>?
</div>
{% endmatch %}
<hr/>

View File

@ -2,6 +2,8 @@
{% block title %}Login to Witch Watch, Bish{% endblock %} {% block title %}Login to Witch Watch, Bish{% endblock %}
{% block header %}{% endblock %}
{% block content %} {% block content %}
<p> <p>

View File

@ -2,6 +2,8 @@
{% block title %}Logout of Witch Watch, Bish{% endblock %} {% block title %}Logout of Witch Watch, Bish{% endblock %}
{% block header %}{% endblock %}
{% block content %} {% block content %}
<p> <p>

View File

@ -2,6 +2,8 @@
{% block title %}Thanks for Signing Up for Witch Watch, Bish{% endblock %} {% block title %}Thanks for Signing Up for Witch Watch, Bish{% endblock %}
{% block header %}{% endblock %}
{% block content %} {% block content %}
<h1>Goodbye</h1> <h1>Goodbye</h1>

View File

@ -2,6 +2,8 @@
{% block title %}Sign Up for Witch Watch, Bish{% endblock %} {% block title %}Sign Up for Witch Watch, Bish{% endblock %}
{% block header %} {% endblock %}
{% block content %} {% block content %}
<p> <p>

View File

@ -3,6 +3,7 @@
{% block title %}Thanks for Signing Up for Witch Watch, Bish{% endblock %} {% block title %}Thanks for Signing Up for Witch Watch, Bish{% endblock %}
{% block content %} {% block content %}
{% block header %}{% endblock %}
<h1>You did it!</h1> <h1>You did it!</h1>