Add frontend tests and other stuff
This commit is contained in:
parent
d28e765e39
commit
642dd8a80c
26 changed files with 730 additions and 85 deletions
|
|
@ -8,6 +8,14 @@
|
|||
</head>
|
||||
|
||||
<body>
|
||||
<script type="module">
|
||||
import init from '/static/frontend.js';
|
||||
async function run() {
|
||||
await init();
|
||||
}
|
||||
run();
|
||||
</script>
|
||||
|
||||
{% block body_container %}{% endblock %}
|
||||
<div class="footer-container">gburri - 2022</div>
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -2,13 +2,17 @@
|
|||
|
||||
{% block body_container %}
|
||||
<div class="header-container">
|
||||
<h1><a href="/">~~ Recettes de cuisine ~~</a></h1>
|
||||
<a class="title" href="/">~~ Recettes de cuisine ~~</a>
|
||||
|
||||
<span class="create-recipe">Create a new recipe</span>
|
||||
|
||||
{% match user %}
|
||||
{% when Some with (user) %}
|
||||
<div>{{ user.email }} / <a href="/signout" />Sign out</a></div>
|
||||
<span>{{ user.email }} / <a href="/signout" />Sign out</a></span>
|
||||
{% when None %}
|
||||
<div><a href="/signin" >Sign in</a> / <a href="/signup">Sign up</a></div>
|
||||
<span><a href="/signin" >Sign in</a> / <a href="/signup">Sign up</a></span>
|
||||
{% endmatch %}
|
||||
|
||||
</div>
|
||||
<div class="main-container">
|
||||
{% block main_container %}{% endblock %}
|
||||
|
|
|
|||
|
|
@ -1,22 +1,25 @@
|
|||
{% extends "base_with_header.html" %}
|
||||
|
||||
{% macro recipe_item(id, title, class) %}
|
||||
<a href="/recipe/view/{{ id }}" class="{{ class }}">{{ title }}</a>
|
||||
{% endmacro %}
|
||||
|
||||
{% block main_container %}
|
||||
<div class="list">
|
||||
<ul>
|
||||
{% for (id, title) in recipes %}
|
||||
<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") }}]
|
||||
{% call recipe_item(id, title, "recipe-item-current") %}
|
||||
{% else %}
|
||||
{{ item_html|escape("none") }}
|
||||
{% call recipe_item(id, title, "recipe-item") %}
|
||||
{% endif %}
|
||||
{% when None %}
|
||||
{{ item_html|escape("none") }}
|
||||
{% call recipe_item(id, title, "recipe-item") %}
|
||||
{% endmatch %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue