From d4e1b05c2906865b6846dcd31fd0463656a7f02c Mon Sep 17 00:00:00 2001 From: Darks Date: Thu, 28 Nov 2019 14:14:35 +0100 Subject: [PATCH] =?UTF-8?q?Divers=20correctifs=20-=20Le=20menu=20est=20uti?= =?UTF-8?q?lisable=20sans=20Js=20(penser=20=C3=A0=20mettre=20=C3=A0=20jour?= =?UTF-8?q?=20les=20endpoints)=20-=20R=C3=A9organisation=20des=20templates?= =?UTF-8?q?=20-=20Ajout=20d'une=20page=20listant=20les=20outils?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/__init__.py | 2 +- app/routes/account/account.py | 8 ++++---- app/routes/account/login.py | 2 +- app/routes/tools.py | 8 ++++++++ app/routes/users.py | 2 +- app/static/scripts/trigger_menu.js | 2 ++ app/templates/{ => account}/account.html | 0 .../{ => account}/delete_account.html | 0 app/templates/{ => account}/login.html | 0 app/templates/{ => account}/register.html | 0 app/templates/{ => account}/user.html | 2 +- app/templates/{ => account}/validation.html | 0 app/templates/base/navbar.html | 10 +++++++--- app/templates/tools.html | 18 ++++++++++++++++++ 14 files changed, 43 insertions(+), 11 deletions(-) create mode 100644 app/routes/tools.py rename app/templates/{ => account}/account.html (100%) rename app/templates/{ => account}/delete_account.html (100%) rename app/templates/{ => account}/login.html (100%) rename app/templates/{ => account}/register.html (100%) rename app/templates/{ => account}/user.html (83%) rename app/templates/{ => account}/validation.html (100%) create mode 100644 app/templates/tools.html diff --git a/app/__init__.py b/app/__init__.py index 7cc7839..2f8ebdd 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -32,7 +32,7 @@ from app.models.forum import Forum from app.models.topic import Topic from app.models.notification import Notification -from app.routes import index, search, users # To load routes at initialization +from app.routes import index, search, users, tools # To load routes at initialization from app.routes.account import login, account, notification from app.routes.admin import index, groups, account, trophies, forums from app.routes.forum import index diff --git a/app/routes/account/account.py b/app/routes/account/account.py index f02f8fb..db5d3e9 100644 --- a/app/routes/account/account.py +++ b/app/routes/account/account.py @@ -32,7 +32,7 @@ def edit_account(): else: flash('Erreur lors de la modification', 'error') - return render('account.html', form=form) + return render('account/account.html', form=form) @app.route('/account/delete', methods=['GET', 'POST']) @@ -49,7 +49,7 @@ def delete_account(): else: flash('Erreur lors de la suppression du compte', 'error') del_form.delete.data = False # Force to tick to delete the account - return render('delete_account.html', del_form=del_form) + return render('account/delete_account.html', del_form=del_form) @app.route('/register', methods=['GET', 'POST']) @@ -68,7 +68,7 @@ def register(): ldap.set_password(member, form.password.data) flash('Inscription réussie', 'ok') return redirect(url_for('validation') + "?email=" + form.email.data) - return render('register.html', title='Register', form=form) + return render('account/register.html', title='Register', form=form) @app.route('/register/validation/', methods=['GET', 'POST']) @@ -76,4 +76,4 @@ def validation(): mail = request.args['email'] if current_user.is_authenticated: return redirect(url_for('index')) - return render('validation.html', mail=mail) + return render('account/validation.html', mail=mail) diff --git a/app/routes/account/login.py b/app/routes/account/login.py index 7ee375c..75fed09 100644 --- a/app/routes/account/login.py +++ b/app/routes/account/login.py @@ -54,7 +54,7 @@ def login(): return redirect(request.referrer) return redirect(url_for('index')) - return render('login.html', form=form) + return render('account/login.html', form=form) @app.route('/logout') diff --git a/app/routes/tools.py b/app/routes/tools.py new file mode 100644 index 0000000..3f24e64 --- /dev/null +++ b/app/routes/tools.py @@ -0,0 +1,8 @@ +from app import app + +from app.utils.render import render + + +@app.route('/tools') +def tools(): + return render('tools.html') diff --git a/app/routes/users.py b/app/routes/users.py index 92a5f6f..cb3d28c 100644 --- a/app/routes/users.py +++ b/app/routes/users.py @@ -9,7 +9,7 @@ from app.utils.render import render def user(username): norm = unicode_names.normalize(username) member = Member.query.filter_by(norm=norm).first_or_404() - return render('user.html', member=member) + return render('account/user.html', member=member) @app.route('/user/id/') diff --git a/app/static/scripts/trigger_menu.js b/app/static/scripts/trigger_menu.js index dad64bd..aa39620 100644 --- a/app/static/scripts/trigger_menu.js +++ b/app/static/scripts/trigger_menu.js @@ -5,6 +5,8 @@ var b = document.querySelectorAll('#light-menu a'); for(var i = 1; i < b.length; i++) { b[i].setAttribute('onfocus', "this.setAttribute('f', 'true');"); b[i].setAttribute('onblur', "this.setAttribute('f', 'false');"); + b[i].removeAttribute('href'); + console.log("Removed"); } var trigger_menu = function(active) { diff --git a/app/templates/account.html b/app/templates/account/account.html similarity index 100% rename from app/templates/account.html rename to app/templates/account/account.html diff --git a/app/templates/delete_account.html b/app/templates/account/delete_account.html similarity index 100% rename from app/templates/delete_account.html rename to app/templates/account/delete_account.html diff --git a/app/templates/login.html b/app/templates/account/login.html similarity index 100% rename from app/templates/login.html rename to app/templates/account/login.html diff --git a/app/templates/register.html b/app/templates/account/register.html similarity index 100% rename from app/templates/register.html rename to app/templates/account/register.html diff --git a/app/templates/user.html b/app/templates/account/user.html similarity index 83% rename from app/templates/user.html rename to app/templates/account/user.html index d276164..859c1d7 100644 --- a/app/templates/user.html +++ b/app/templates/account/user.html @@ -9,7 +9,7 @@
{{ widget_member.profile(member) }} - {% if current_user.is_authenticated and current_user.priv('access-admin-panel') %} + {% if current_user.is_authenticated and (current_user == member or current_user.priv('access-admin-panel')) %}
Modifier
{% endif %} diff --git a/app/templates/validation.html b/app/templates/account/validation.html similarity index 100% rename from app/templates/validation.html rename to app/templates/account/validation.html diff --git a/app/templates/base/navbar.html b/app/templates/base/navbar.html index 12f4445..07f13aa 100644 --- a/app/templates/base/navbar.html +++ b/app/templates/base/navbar.html @@ -5,7 +5,11 @@
  • - + {% if current_user.is_authenticated %} + + {% else %} + + {% endif %} @@ -23,7 +27,7 @@
  • - + @@ -59,7 +63,7 @@
  • - + diff --git a/app/templates/tools.html b/app/templates/tools.html new file mode 100644 index 0000000..2e0fc33 --- /dev/null +++ b/app/templates/tools.html @@ -0,0 +1,18 @@ +{% extends "base/base.html" %} + +{% block title %} +

    Outils

    +{% endblock %} + +{% block content %} +
    +

    Planète Casio met à votre disposition divers outils. Pour vous connecter, + utilisez votre identifiant unique et votre mot de passe habituel. +

      +
    • Gitea (forge Git)
    • +
    • Wiki (wiki répétoriant tout un tas de trucs)
    • +
    • Bible (la bible du programmeur Casio bas niveau)
    • +
    +

    +
    +{% endblock %}