Compare commits

...

3 Commits

13 changed files with 80 additions and 38 deletions

0
TODO Normal file
View File

4
app.py
View File

@ -146,4 +146,8 @@ def game_answer():
return render_template("game/new.html")
@app.route("/about")
def about():
return render_template("about/index.html")
migrate = Migrate(app, db)

2
sync.sh Normal file
View File

@ -0,0 +1,2 @@
#!/bin/bash
rsync -avz ./ root@birdquizz.1ib.re:/var/www/birdquizz

View File

@ -0,0 +1,6 @@
{% extends "base.html" %}
{% block content %}
<main>
<h2>{{ _('About BirdQuizz') }}</h2>
</main>
{% endblock %}

View File

@ -9,11 +9,15 @@
{% endif %}
<form action="/login" method="POST">
<label for="username">{{ _('Username') }}</label>
<input type="text" name="username" id="username">
<label for="password">{{ _('Password') }}</label>
<input type="password" name="password" id="password">
<input type="submit" value="{{ _('Login') }}">
<div class="form-group">
<label class="control-label col-sm-2" for="username">{{ _('Username') }}</label>
<div class="col-sm-10"><input type="text" name="username" id="username"></div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="password">{{ _('Password') }}</label>
<div class="col-sm-10"><input type="password" name="password" id="password"></div>
</div>
<input class="btn btn-primary" type="submit" value="{{ _('Login') }}">
</form>
<a href="/signup">{{ _('Sign up') }}</a>

View File

@ -8,14 +8,20 @@
</p>
{% endif %}
<form action="/signup" method="POST">
<label for="username">{{ _('Username') }}</label>
<input type="text" name="username" id="username">
<label for="email">{{ _('Email') }}</label>
<input type="email" name="email" id="email">
<label for="password">{{ _('Password') }}</label>
<input type="password" name="password" id="password">
<input type="submit" value="{{ _('Sign up') }}">
<form class="form-horizontal" action="/signup" method="POST">
<div class="form-group">
<label class="control-label col-sm-2" for="username">{{ _('Username') }}</label>
<div class="col-sm-10"><input type="text" name="username" id="username"></div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="email">{{ _('Email') }}</label>
<div class="col-sm-10"><input type="email" name="email" id="email"></div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="password">{{ _('Password') }}</label>
<div class="col-sm-10"><input type="password" name="password" id="password"></div>
</div>
<input class="btn btn-primary" type="submit" value="{{ _('Sign up') }}">
</form>
{% endblock %}

View File

@ -1,25 +1,36 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block title %}BirdQuizz{% endblock %}</title>
<link rel="stylesheet" href="{{ url_for('static', filename='styles/style.css') }}">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<header>
{% include 'menu.html' %}
<h1>BirdQuizz</h1>
{% if username is defined %}
<p>{{ _('Welcome') }} <span class="username">{{ username }}</span></p>
<p>{{ _('Welcome') }} <span class="username">{{ username }}</span></p>
{% endif %}
</header>
<main>
{% block content %}{% endblock %}
</main>
<footer>
© 2022 - Samuel ORTION
{% include "language.html"%}
<footer class="bg-dark text-lg-start">
<div class="text-light text-center" style="background-color: rgba(0, 0, 0, 0.2);">
© 2022 - Samuel ORTION
<a class="text-light" href="//samuel.ortion.fr"></a>
</div>
</footer>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"
integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"></script>
<script src="{{ url_for('static', filename='scripts/app.js') }}"></script>
</body>
</html>

View File

@ -1,6 +1,8 @@
{% extends "base.html" %}
{% block content %}
<h2>{{ _('Let\'s see how you performed') }}</h2>
<p>{{ message }}</p>
<p>{{ _('It was ') + question["species"] + '!' }}</p>
<p>
<a href="/game/new">{{ _('New Question') }}</a>
</p>

View File

@ -1,5 +1,5 @@
{% extends "base.html" %}
<h2>{{ _('Ready for the adventure ?')</h2>
<a href="/game/new" class="button">
{{ _('New Game') }}
</a>

View File

@ -1,5 +1,6 @@
{% extends "base.html" %}
{% block content %}
<h2>Will you find this singer ?</h2>
<audio src="/static/data/src_audio/{{ question['species_folder'] }}/{{ question['audio_path'] }}" controls autoplay></audio>
<form action="/game/answer" method="POST">
<select name="answer" id="answer">

View File

@ -1,11 +0,0 @@
{% extends "base.html" %}
{% block content %}
<h2>{{ _('Select your language !') }}</h2>
<form action="/lang" method="POST">
<select name="lang" id="lang">
<option value="fr">Français</option>
<option value="en">English</option>
</select>
<input type="submit" value="{{ _('Translate') }}">
</form>
{% endblock %}

10
templates/language.html Normal file
View File

@ -0,0 +1,10 @@
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="dropdown-language" role="button"
data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{ get_locale() }}
</a>
<ul class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdown-language">
<li><a class="dropdown-item" href="/lang/en">English</a></li>
<li><a class="dropdown-item" href="/lang/fr">Français</a></li>
</ul>
</li>

View File

@ -1,11 +1,18 @@
<nav>
<ul>
<li><a href="/">{{ _('Home') }}</a></li>
<li><a href="/game">{{ _('Game') }}</a></li>
{% if username is defined %}
<li><a href="/logout">{{ _('Logout') }}</a></li>
{% else %}
<li><a href="/login">{{ _('Login') }}</a></li>
{% endif %}
<nav class="navbar navbar-dark bg-dark" role="navigation" >
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand nav-item nav-link" href="#">BirdQuizz</a>
</div>
<ul class="nav navrow-nav">
<li class="active"><a class="nav-item nav-link""" href="/">{{ _('Home') }}</a></li>
<li><a class="nav-item nav-link" href="/game">{{ _('Game') }}</a></li>
<li><a class="nav-item nav-link" href="/about">{{ _('About') }}</a></li>
{% if username is defined %}
<li><a class="nav-item nav-link" href="/logout">{{ _('Logout') }}</a></li>
{% else %}
<a class="nav-item nav-link" href="/login">{{ _('Login') }}</a>
{% endif %}
<p class="navbar-text">{{ _('Identify bird song') }}</p>
</ul>
</div>
</nav>