switch workspace routes and templates to Flask and Jinja

This commit is contained in:
dandds
2018-08-01 13:15:07 -04:00
committed by richard-dds
parent 0976aed778
commit 3a53fc122d
8 changed files with 86 additions and 35 deletions

View File

@@ -10,6 +10,7 @@ from atst.sessions import RedisSessions
from atst.database import db
from atst.assets import assets
from atst.routes import bp
from atst.routes.workspaces import bp as workspace_routes
ENV = os.getenv("TORNADO_ENV", "dev")
@@ -31,6 +32,7 @@ def make_app(config):
assets.init_app(app)
app.register_blueprint(bp)
app.register_blueprint(workspace_routes)
return app

31
atst/routes/workspaces.py Normal file
View File

@@ -0,0 +1,31 @@
from flask import Blueprint, render_template
from atst.domain.workspaces import Projects, Members
from atst.database import db
bp = Blueprint("workspaces", __name__)
mock_workspaces = [
{
"name": "Unclassified IaaS and PaaS for Defense Digital Service (DDS)",
"id": "5966187a-eff9-44c3-aa15-4de7a65ac7ff",
"task_order": {"number": 123456},
"user_count": 23,
}
]
@bp.route("/workspaces")
def workspaces():
return render_template("workspaces.html", page=5, workspaces=mock_workspaces)
@bp.route("/workspaces/<workspace_id>/projects")
def workspace_projects(workspace_id):
projects_repo = Projects()
projects = projects_repo.get_many(workspace_id)
return render_template("workspace_projects.html", workspace_id=workspace_id, projects=projects)
@bp.route("/workspaces/<workspace_id>/members")
def workspace_members(workspace_id):
members_repo = Members()
members = members_repo.get_many(workspace_id)
return render_template("workspace_members.html", workspace_id=workspace_id, members=members)