PaperParser/app/blueprints/frontend/routes.py

29 lines
994 B
Python
Raw Normal View History

2024-01-31 19:37:01 +10:00
from flask import Blueprint, render_template
from app.blueprints.api.sessions.routes import get_sessions
from app.blueprints.api.tasks.routes import get_tasks
2024-03-07 02:22:53 +10:00
from app.models.collection import Collection
2024-01-31 19:37:01 +10:00
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):
2024-03-08 16:39:04 +10:00
collections = Collection.query.all()
return render_template("parse.j2", session_id=id, collections=collections)
2024-03-07 02:22:53 +10:00
@frontend.route("/collections")
def collections():
collections = Collection.query.all()
return render_template("collections.j2", collections=collections)