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 %}
{% with comments=p.replies %} diff --git a/files/templates/submission_banned.html b/files/templates/submission_banned.html index 7ac5a374f..f127761e6 100644 --- a/files/templates/submission_banned.html +++ b/files/templates/submission_banned.html @@ -68,6 +68,8 @@
+ {% include "volunteer_teaser.html" %} +
{% with comments=p.replies %} {% include "comments.html" %} diff --git a/files/templates/volunteer.html b/files/templates/volunteer.html new file mode 100644 index 000000000..f18251b69 --- /dev/null +++ b/files/templates/volunteer.html @@ -0,0 +1,11 @@ +{% extends "default.html" %} + +{% block pagetitle %}Volunteer{% endblock %} + +{% block content %} + +
+hello! welcome to the volunteering +
+ +{% endblock %} \ No newline at end of file diff --git a/files/templates/volunteer_teaser.html b/files/templates/volunteer_teaser.html new file mode 100644 index 000000000..b5b0ce5bc --- /dev/null +++ b/files/templates/volunteer_teaser.html @@ -0,0 +1,5 @@ +{% if volunteer_available_for(v) %} +
+hello come the voluntter! +
+{% endif %}