diff --git a/files/helpers/jinja2.py b/files/helpers/jinja2.py index b96f4f848..90702f09c 100644 --- a/files/helpers/jinja2.py +++ b/files/helpers/jinja2.py @@ -66,3 +66,7 @@ def inject_constants(): "COLORS":COLORS, "THEMES":THEMES, } + +def template_function(func): + assert(func.__name__ not in app.jinja_env.globals) + app.jinja_env.globals[func.__name__] = func diff --git a/files/routes/__init__.py b/files/routes/__init__.py index c704a199b..f6379d6bb 100644 --- a/files/routes/__init__.py +++ b/files/routes/__init__.py @@ -14,4 +14,5 @@ from .votes import * from .feeds import * from .awards import * from .giphy import * +from .volunteer import * # from .subs import * diff --git a/files/routes/volunteer.py b/files/routes/volunteer.py new file mode 100644 index 000000000..3ecd35199 --- /dev/null +++ b/files/routes/volunteer.py @@ -0,0 +1,16 @@ + +from files.__main__ import app +from files.classes.user import User +import files.helpers.jinja2 +from files.helpers.wrappers import auth_required +from flask import render_template + +@app.get("/volunteer") +@auth_required +def volunteer(v: User): + return render_template("volunteer.html", v=v) + + +@files.helpers.jinja2.template_function +def volunteer_available_for(u: User) -> bool: + return True diff --git a/files/templates/submission.html b/files/templates/submission.html index fdaec48a2..3c57d65e0 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -520,6 +520,8 @@ {% endif %} + {% include "volunteer_teaser.html" %} + {% if p.replies %}