PaperParser/app/blueprints/frontend/routes.py

29 lines
1012 B
Python

from flask import Blueprint, render_template
from app.blueprints.api.sessions.routes import get_sessions
from app.blueprints.api.users.routes import get_users
from app.blueprints.api.tasks.routes import get_tasks
from app.models.collection import Collection
frontend = Blueprint("frontend", __name__, url_prefix="/", template_folder="templates", static_folder="static", static_url_path="/static/frontend")
@frontend.route("/")
def index():
sessions = get_sessions()
return render_template("index.j2", sessions=sessions)
@frontend.route("/add")
def add():
return render_template("add.j2")
@frontend.route("/tasks")
def tasks():
return render_template("tasks.j2", tasks_template=get_tasks())
@frontend.route("/parse/<int:id>")
def parse(id: int):
return render_template("parse.j2", session_id=id, users_template=get_users(id))
@frontend.route("/collections")
def collections():
collections = Collection.query.all()
return render_template("collections.j2", collections=collections)