You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.2 KiB
Python
59 lines
1.2 KiB
Python
from flask import Blueprint, render_template, request
|
|
import json
|
|
from . import dump
|
|
|
|
index = [
|
|
"intro",
|
|
"what-is-a-loot-box",
|
|
"crosswords",
|
|
"one-sentence-game-ideas",
|
|
"nim",
|
|
"mimic",
|
|
"unfinished-thoughts",
|
|
"the-leader",
|
|
"connect-less",
|
|
"xquisite",
|
|
"katamari",
|
|
"life-hacks",
|
|
"karaoke",
|
|
"outro",
|
|
]
|
|
|
|
|
|
bp = Blueprint(
|
|
"generate",
|
|
__name__,
|
|
url_prefix="/generate",
|
|
)
|
|
|
|
|
|
@bp.route("/")
|
|
def blocks():
|
|
|
|
print = request.args.get('print')
|
|
|
|
color = request.cookies.get("color", "purple")
|
|
|
|
# temporary, eventually we will dump contents only when they are updated in git (git hooks + git pull ?)
|
|
dump.dump(index)
|
|
|
|
with open("postit/contents.json", "r") as f:
|
|
contributions = json.load(f)
|
|
|
|
return render_template("postit.html", contributions=contributions, color=color, print=print)
|
|
|
|
|
|
@bp.route("/<slug>")
|
|
def block(slug=None):
|
|
|
|
print = request.args.get('print', default=False)
|
|
|
|
|
|
color = request.cookies.get("color", "purple")
|
|
|
|
dump.dump([slug])
|
|
with open("postit/contents.json", "r") as f:
|
|
contributions = json.load(f)
|
|
|
|
return render_template("postit.html", contributions=contributions, color=color, print=print)
|