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

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>