print mode web mode

master
km0 3 years ago
parent 409c28b1c9
commit 3d73c72f40

File diff suppressed because one or more lines are too long

@ -30,6 +30,8 @@ bp = Blueprint(
@bp.route("/") @bp.route("/")
def blocks(): def blocks():
print = request.args.get('print')
color = request.cookies.get("color", "purple") color = request.cookies.get("color", "purple")
# temporary, eventually we will dump contents only when they are updated in git (git hooks + git pull ?) # temporary, eventually we will dump contents only when they are updated in git (git hooks + git pull ?)
@ -38,16 +40,19 @@ def blocks():
with open("postit/contents.json", "r") as f: with open("postit/contents.json", "r") as f:
contributions = json.load(f) contributions = json.load(f)
return render_template("postit.html", contributions=contributions, color=color) return render_template("postit.html", contributions=contributions, color=color, print=print)
@bp.route("/<slug>") @bp.route("/<slug>")
def block(slug=None): def block(slug=None):
print = request.args.get('print', default=False)
color = request.cookies.get("color", "purple") color = request.cookies.get("color", "purple")
dump.dump([slug]) dump.dump([slug])
with open("postit/contents.json", "r") as f: with open("postit/contents.json", "r") as f:
contributions = json.load(f) contributions = json.load(f)
return render_template("postit.html", contributions=contributions, color=color) return render_template("postit.html", contributions=contributions, color=color, print=print)

@ -47,3 +47,11 @@ button#color:hover {
transform: scale(1.05); transform: scale(1.05);
cursor: pointer; cursor: pointer;
} }
.print{
opacity: 0;
}
li:hover .print{
opacity: 1;
}

@ -15,14 +15,14 @@
<body> <body>
<h1>🚩 85 000 post-it</h1> <h1>🚩 85 000 post-it</h1>
<h2><a class="generate all" href="{{url_for('generate.blocks')}}">Generate all</a></h2> <h2><a class="generate all" href="{{url_for('generate.blocks')}}">Generate all</a>, <a href="{{url_for('generate.blocks', print=true)}}">(print)</a></h2>
<button id="color"></button> <button id="color"></button>
<h3>Contribution</h3> <h3>Contribution</h3>
<ol> <ol>
{%for page in pages %} {%for page in pages %}
<li> <li>
<a class="generate" href="{{url_for('generate.block', slug=page)}}">{{page}}</a> <a class="generate" href="{{url_for('generate.block', slug=page)}}">{{page}}</a>, <a class="print" href="{{url_for('generate.blocks', slug=page, print=true)}}">🖨️</a>
</li> </li>
{%endfor%} {%endfor%}
</ol> </ol>

@ -10,8 +10,11 @@
<link rel="stylesheet" href="{{url_for('static', filename='css/postit.css')}}" /> <link rel="stylesheet" href="{{url_for('static', filename='css/postit.css')}}" />
<link rel="stylesheet" href="{{url_for('static', filename='css/contents.css')}}" /> <link rel="stylesheet" href="{{url_for('static', filename='css/contents.css')}}" />
{% if print %}
<script src="https://unpkg.com/pagedjs/dist/paged.polyfill.js"></script> <script src="https://unpkg.com/pagedjs/dist/paged.polyfill.js"></script>
<script src="{{url_for('static', filename='js/bleed.js')}}"></script> <script src="{{url_for('static', filename='js/bleed.js')}}"></script>
{% endif %}
</head> </head>
<style> <style>
:root { :root {

Loading…
Cancel
Save