helpdocs route takes a doc path and renders sub template

list of helpdocs generated by files in `help/docs`
This commit is contained in:
Andrew Croce 2018-10-03 13:57:39 -04:00
parent edddfd9a30
commit 612a4a4f95

View File

@ -3,6 +3,7 @@ from flask import Blueprint, render_template, g, redirect, session, url_for, req
from flask import current_app as app from flask import current_app as app
import pendulum import pendulum
import os
from atst.domain.requests import Requests from atst.domain.requests import Requests
from atst.domain.users import Users from atst.domain.users import Users
@ -30,8 +31,13 @@ def root():
@bp.route("/help") @bp.route("/help")
def helpdocs(): @bp.route("/help/<path:doc>")
return render_template("help/index.html") def helpdocs(doc=None):
docs = [os.path.splitext(file)[0] for file in os.listdir("templates/help/docs")]
if doc:
return render_template("help/docs/{}.html".format(doc), docs=docs, doc=doc)
else:
return render_template("help/index.html", docs=docs, doc=doc)
@bp.route("/home") @bp.route("/home")