diff --git a/app/blueprints/api/collections/routes.py b/app/blueprints/api/collections/routes.py new file mode 100644 index 0000000..bb8253c --- /dev/null +++ b/app/blueprints/api/collections/routes.py @@ -0,0 +1,3 @@ +from flask import Blueprint, render_template, request + +collections = Blueprint("collections", __name__, url_prefix="/collections", template_folder="templates") diff --git a/app/blueprints/api/collections/templates/collections/card.j2 b/app/blueprints/api/collections/templates/collections/card.j2 new file mode 100644 index 0000000..da0f3a7 --- /dev/null +++ b/app/blueprints/api/collections/templates/collections/card.j2 @@ -0,0 +1,19 @@ +
+
{{ collection.name }}
+
+ +
+ + + +
\ No newline at end of file diff --git a/app/blueprints/api/collections/templates/collections/grid.j2 b/app/blueprints/api/collections/templates/collections/grid.j2 new file mode 100644 index 0000000..be01f3e --- /dev/null +++ b/app/blueprints/api/collections/templates/collections/grid.j2 @@ -0,0 +1,7 @@ +{% for collection in collections %} +
+ {% include "collections/card.j2" %} +
+{% else %} + Здесь ничего нет +{% endfor %} \ No newline at end of file diff --git a/app/blueprints/api/routes.py b/app/blueprints/api/routes.py index 0cd1db4..b4891e1 100644 --- a/app/blueprints/api/routes.py +++ b/app/blueprints/api/routes.py @@ -3,9 +3,11 @@ from flask import Blueprint from .tasks.routes import tasks from .sessions.routes import sessions from .users.routes import users +from .collections.routes import collections api = Blueprint("api", __name__, url_prefix="/api") api.register_blueprint(users) api.register_blueprint(tasks) -api.register_blueprint(sessions) \ No newline at end of file +api.register_blueprint(sessions) +api.register_blueprint(collections) \ No newline at end of file diff --git a/app/blueprints/frontend/routes.py b/app/blueprints/frontend/routes.py index b22e35b..f70ef78 100644 --- a/app/blueprints/frontend/routes.py +++ b/app/blueprints/frontend/routes.py @@ -2,6 +2,7 @@ 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") @@ -20,4 +21,9 @@ def tasks(): @frontend.route("/parse/") def parse(id: int): - return render_template("parse.j2", session_id=id, users_template=get_users(id)) \ No newline at end of file + 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) \ No newline at end of file diff --git a/app/blueprints/frontend/templates/collections.j2 b/app/blueprints/frontend/templates/collections.j2 new file mode 100644 index 0000000..6773916 --- /dev/null +++ b/app/blueprints/frontend/templates/collections.j2 @@ -0,0 +1,14 @@ +{% extends "base.j2" %} + +{% block title %} +Базы +{% endblock title %} + +{% block main %} +
+
+

Задачи

+
+
+ {% include "collections/grid.j2" %} +{% endblock main %} \ No newline at end of file