Volunteer Janitor: Initial hooks.
This commit is contained in:
parent
8a9e1bc54a
commit
e43db0535d
7 changed files with 41 additions and 0 deletions
|
@ -66,3 +66,7 @@ def inject_constants():
|
||||||
"COLORS":COLORS,
|
"COLORS":COLORS,
|
||||||
"THEMES":THEMES,
|
"THEMES":THEMES,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def template_function(func):
|
||||||
|
assert(func.__name__ not in app.jinja_env.globals)
|
||||||
|
app.jinja_env.globals[func.__name__] = func
|
||||||
|
|
|
@ -14,4 +14,5 @@ from .votes import *
|
||||||
from .feeds import *
|
from .feeds import *
|
||||||
from .awards import *
|
from .awards import *
|
||||||
from .giphy import *
|
from .giphy import *
|
||||||
|
from .volunteer import *
|
||||||
# from .subs import *
|
# from .subs import *
|
||||||
|
|
16
files/routes/volunteer.py
Normal file
16
files/routes/volunteer.py
Normal file
|
@ -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
|
|
@ -520,6 +520,8 @@
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% include "volunteer_teaser.html" %}
|
||||||
|
|
||||||
{% if p.replies %}
|
{% if p.replies %}
|
||||||
<div class="comment-section" id="replies-of-{{p.id}}">
|
<div class="comment-section" id="replies-of-{{p.id}}">
|
||||||
{% with comments=p.replies %}
|
{% with comments=p.replies %}
|
||||||
|
|
|
@ -68,6 +68,8 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% include "volunteer_teaser.html" %}
|
||||||
|
|
||||||
<div class="comment-section">
|
<div class="comment-section">
|
||||||
{% with comments=p.replies %}
|
{% with comments=p.replies %}
|
||||||
{% include "comments.html" %}
|
{% include "comments.html" %}
|
||||||
|
|
11
files/templates/volunteer.html
Normal file
11
files/templates/volunteer.html
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{% extends "default.html" %}
|
||||||
|
|
||||||
|
{% block pagetitle %}Volunteer{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<div>
|
||||||
|
hello! welcome to the volunteering
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock %}
|
5
files/templates/volunteer_teaser.html
Normal file
5
files/templates/volunteer_teaser.html
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{% if volunteer_available_for(v) %}
|
||||||
|
<div class="volunteer_teaser">
|
||||||
|
hello come <a href="/volunteer">the voluntter</a>!
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
Loading…
Add table
Add a link
Reference in a new issue