From a1751621861c09cc81255460b0618ac794229461 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Fri, 7 Jan 2022 21:08:56 +0000 Subject: [PATCH] Remove flask-menu, make navbar translatable --- app/__init__.py | 3 - app/blueprints/homepage/__init__.py | 2 - app/blueprints/packages/packages.py | 5 - app/blueprints/threads/__init__.py | 2 - app/templates/base.html | 47 +++---- requirements.lock.txt | 1 - requirements.txt | 1 - translations/es/LC_MESSAGES/messages.po | 151 ++++++++++++--------- translations/fr/LC_MESSAGES/messages.po | 91 ++++++++----- translations/messages.pot | 151 ++++++++++++--------- translations/ms/LC_MESSAGES/messages.po | 151 ++++++++++++--------- translations/nb_NO/LC_MESSAGES/messages.po | 151 ++++++++++++--------- 12 files changed, 423 insertions(+), 333 deletions(-) diff --git a/app/__init__.py b/app/__init__.py index fff88d07..0d05b2a3 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -17,7 +17,6 @@ from flask import * from flask_gravatar import Gravatar -import flask_menu as menu from flask_mail import Mail from flask_github import GitHub from flask_wtf.csrf import CSRFProtect @@ -43,7 +42,6 @@ app.config.from_pyfile(os.environ["FLASK_CONFIG"]) r = redis.Redis.from_url(app.config["REDIS_URL"]) -menu.Menu(app=app) github = GitHub(app) csrf = CSRFProtect(app) mail = Mail(app) @@ -88,7 +86,6 @@ create_blueprints(app) def send_upload(path): return send_from_directory(app.config["UPLOAD_DIR"], path) -@menu.register_menu(app, ".help", "Help", order=19, endpoint_arguments_constructor=lambda: { "path": "help" }) @app.route("//") def flatpage(path): page = pages.get_or_404(path) diff --git a/app/blueprints/homepage/__init__.py b/app/blueprints/homepage/__init__.py index 269575df..a541e1d7 100644 --- a/app/blueprints/homepage/__init__.py +++ b/app/blueprints/homepage/__init__.py @@ -3,13 +3,11 @@ from flask import Blueprint, render_template, redirect bp = Blueprint("homepage", __name__) from app.models import * -import flask_menu as menu from sqlalchemy.orm import joinedload from sqlalchemy.sql.expression import func @bp.route("/") -@menu.register_menu(bp, ".", "Home") def home(): def join(query): return query.options( diff --git a/app/blueprints/packages/packages.py b/app/blueprints/packages/packages.py index be5ebc3b..12ec32cc 100644 --- a/app/blueprints/packages/packages.py +++ b/app/blueprints/packages/packages.py @@ -17,7 +17,6 @@ from urllib.parse import quote as urlescape -import flask_menu as menu from flask import render_template from flask_wtf import FlaskForm from flask_login import login_required @@ -38,10 +37,6 @@ from app.models.packages import PackageProvides from app.tasks.webhooktasks import post_discord_webhook -@menu.register_menu(bp, ".mods", "Mods", order=11, endpoint_arguments_constructor=lambda: { 'type': 'mod' }) -@menu.register_menu(bp, ".games", "Games", order=12, endpoint_arguments_constructor=lambda: { 'type': 'game' }) -@menu.register_menu(bp, ".txp", "Texture Packs", order=13, endpoint_arguments_constructor=lambda: { 'type': 'txp' }) -@menu.register_menu(bp, ".random", "Random", order=14, endpoint_arguments_constructor=lambda: { 'random': '1', 'lucky': '1' }) @bp.route("/packages/") def list_all(): qb = QueryBuilder(request.args) diff --git a/app/blueprints/threads/__init__.py b/app/blueprints/threads/__init__.py index 88e1c8be..bd8b7608 100644 --- a/app/blueprints/threads/__init__.py +++ b/app/blueprints/threads/__init__.py @@ -20,7 +20,6 @@ from app.tasks.webhooktasks import post_discord_webhook bp = Blueprint("threads", __name__) from flask_login import current_user, login_required -from app import menu from app.models import * from app.utils import addNotification, isYes, addAuditLog, get_system_user from flask_wtf import FlaskForm @@ -29,7 +28,6 @@ from wtforms.validators import * from app.utils import get_int_or_abort -@menu.register_menu(bp, ".threads", "Threads", order=20) @bp.route("/threads/") def list_all(): query = Thread.query diff --git a/app/templates/base.html b/app/templates/base.html index beb26ec6..dc65848c 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -23,34 +23,31 @@