Add asynchronous call to database.
See file 'asynchronous.ts'.
This commit is contained in:
parent
8a3fef096d
commit
d28e765e39
20 changed files with 1323 additions and 1049 deletions
|
|
@ -8,18 +8,7 @@
|
|||
</head>
|
||||
|
||||
<body>
|
||||
<div class="header-container">
|
||||
<h1><a href="/">~~ Recettes de cuisine ~~</a></h1>
|
||||
{% match user %}
|
||||
{% when Some with (user) %}
|
||||
<div>{{ user.email }} / <a href="/signout" />Sign out</a></div>
|
||||
{% when None %}
|
||||
<div><a href="/signin" >Sign in</a> / <a href="/signup">Sign up</a></div>
|
||||
{% endmatch %}
|
||||
</div>
|
||||
<div class="main-container">
|
||||
{% block main_container %}{% endblock %}
|
||||
</div>
|
||||
{% block body_container %}{% endblock %}
|
||||
<div class="footer-container">gburri - 2022</div>
|
||||
</body>
|
||||
</html>
|
||||
16
backend/templates/base_with_header.html
Normal file
16
backend/templates/base_with_header.html
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block body_container %}
|
||||
<div class="header-container">
|
||||
<h1><a href="/">~~ Recettes de cuisine ~~</a></h1>
|
||||
{% match user %}
|
||||
{% when Some with (user) %}
|
||||
<div>{{ user.email }} / <a href="/signout" />Sign out</a></div>
|
||||
{% when None %}
|
||||
<div><a href="/signin" >Sign in</a> / <a href="/signup">Sign up</a></div>
|
||||
{% endmatch %}
|
||||
</div>
|
||||
<div class="main-container">
|
||||
{% block main_container %}{% endblock %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
@ -1,10 +1,24 @@
|
|||
{% extends "base.html" %}
|
||||
{% extends "base_with_header.html" %}
|
||||
|
||||
{% block main_container %}
|
||||
<div class="list">
|
||||
<ul>
|
||||
{% for (id, title) in recipes %}
|
||||
<li><a href="/recipe/view/{{ id }}">{{ title }}</a></li>
|
||||
<li>
|
||||
{% let item_html = "<a href=\"/recipe/view/{}\">{}</a>"|format(id, title) %}
|
||||
{% match current_recipe_id %}
|
||||
{# Don't know how to avoid repetition: comparing (using '==' or .eq()) current_recipe_id.unwrap() and id doesn't work. Guards for match don't exist.
|
||||
See: https://github.com/djc/askama/issues/752 #}
|
||||
{% when Some (current_id) %}
|
||||
{% if current_id == id %}
|
||||
[{{ item_html|escape("none") }}]
|
||||
{% else %}
|
||||
{{ item_html|escape("none") }}
|
||||
{% endif %}
|
||||
{% when None %}
|
||||
{{ item_html|escape("none") }}
|
||||
{% endmatch %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{% extends "base_with_list.html" %}
|
||||
{% extends "base_with_header.html" %}
|
||||
|
||||
{% block content %}
|
||||
{% block main_container %}
|
||||
|
||||
{{ message }}
|
||||
{{ message|markdown }}
|
||||
|
||||
{% endblock %}
|
||||
6
backend/templates/message_base.html
Normal file
6
backend/templates/message_base.html
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block body_container %}
|
||||
{% include "title.html" %}
|
||||
{{ message|markdown }}
|
||||
{% endblock %}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
{% extends "base.html" %}
|
||||
{% extends "base_with_header.html" %}
|
||||
|
||||
{% block main_container %}
|
||||
<div class="content">
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
{% extends "base.html" %}
|
||||
{% extends "base_with_header.html" %}
|
||||
|
||||
{% block main_container %}
|
||||
<div class="content">
|
||||
|
|
|
|||
1
backend/templates/title.html
Normal file
1
backend/templates/title.html
Normal file
|
|
@ -0,0 +1 @@
|
|||
<h1><a href="/">~~ Recettes de cuisine ~~</a></h1>
|
||||
Loading…
Add table
Add a link
Reference in a new issue