Skip to content

Commit cb38320

Browse files
add sports car
1 parent e2bd003 commit cb38320

5 files changed

Lines changed: 33 additions & 8 deletions

File tree

car/app.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,16 @@ def autolink_toggle():
283283
return redirect(request.args.get("return", "/"))
284284

285285

286+
@app.route("/sportscar_toggle/")
287+
def sportscar_toggle():
288+
if "sports_car" in session:
289+
del session["sports_car"]
290+
else:
291+
session["sports_car"] = 1
292+
293+
return redirect(request.args.get("return", "/"))
294+
295+
286296
@app.route("/turf/<int:id>/")
287297
def show_turf(id: ID):
288298
restrict_turfs(id)

car/templates/base.html

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
{% endmacro %}
2323

2424
{% macro note_link(typ, id, text="add new note") %}
25-
<a href="{{ url_for('note_obj', typ=typ, id=id) }}"><button>{{ text }}</button></a>
25+
<a href="{{ url_for('note_obj', typ=typ, id=id) }}" hx-boost="true" preload="preload:init"><button>{{ text }}</button></a>
2626
{% endmacro %}
2727

2828
{% macro turf_link(t) %}
@@ -35,7 +35,7 @@
3535

3636
{% macro door_link(d, turf=None) %}
3737
{% with door = db.get_door_by_id(d), disp = db.get_disposition_for_type_and_id("door", d, turf) %}
38-
<a href="{{ url_for('show_door', id=d) }}"{% if turf %} data-disposition="{{ disp }}"{% endif %}>
38+
<a {% if session.sports_car|default(false) %}preload="preload:init"{% endif %} href="{{ url_for('show_door', id=d) }}"{% if turf %} data-disposition="{{ disp }}"{% endif %}>
3939
{{ door.address }}{% if door.unit %} &ndash; {{ door.unit }}{% endif %}
4040

4141
{% if turf and disp %}<span class="disposition">({{ dispositions[disp] }})</span>{% endif %}
@@ -46,7 +46,7 @@
4646
{% macro voter_link(v, turf=None) %}
4747
{% with voter = db.get_voter_by_id(v) %}
4848
{% with d = db.get_disposition_for_type_and_id("voter", v, turf) %}
49-
<a href="{{ url_for('show_voter', id=v) }}" data-disposition="{{ d }}">
49+
<a preload="preload:init" href="{{ url_for('show_voter', id=v) }}" data-disposition="{{ d }}">
5050
{{ voter.firstname }} {{ voter.middlename }} {{ voter.lastname }}
5151
{{ render_disposition(d) }}
5252
</a>
@@ -74,6 +74,9 @@
7474
<meta name="viewport" content="width=device-width, initial-scale=1">
7575
<link rel="stylesheet" href="/static/mycoolstylesheet.css">
7676

77+
<script src="https://cdn.jsdelivr.net/npm/htmx.org@2.0.8/dist/htmx.min.js" integrity="sha384-/TgkGk7p307TH7EXJDuUlgG3Ce1UVolAOFopFekQkkXihi5u/6OCvVKyz1W+idaz" crossorigin="anonymous"></script>
78+
<script src="https://cdn.jsdelivr.net/npm/htmx-ext-preload@2.1.2" integrity="sha384-PRIcY6hH1Y5784C76/Y8SqLyTanY9rnI3B8F3+hKZFNED55hsEqMJyqWhp95lgfk" crossorigin="anonymous"></script>
79+
7780
<!-- cribbed from rose, thank u hunter <3 -->
7881
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"
7982
integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA=="
@@ -86,7 +89,7 @@
8689
<script src="https://cdn.jsdelivr.net/npm/leaflet.locatecontrol/dist/L.Control.Locate.min.js" charset="utf-8"></script>
8790
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">
8891
</head>
89-
<body>
92+
<body hx-ext="preload">
9093
<header>
9194
{% if session.canvasser %}
9295
Hi, {{ session.canvasser }}! &middot;
@@ -129,8 +132,11 @@
129132

130133
<a href="/autolink_toggle/?return={{ request.url|urlencode }}">
131134
{% if session.autolink|default(True) %}disable{% else %}enable{% endif %} door links to gmaps
132-
</a>
135+
</a> &middot;
133136

137+
<a href="/sportscar_toggle/?return={{ request.url|urlencode }}">
138+
{% if session.sports_car|default(False) %}switch to normal car{% else %}switch to sports car{% endif %}
139+
</a>
134140
<br />
135141
{% endif %}
136142
<a target="_blank" class="credits-link" href="/credits/">🚗 car by Tris and friends</a>

car/templates/credits.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{% extends "base.html" %}
2+
{% block title %}If I'm canvassing, and you're phonebanking, then who's driving the car???{% endblock %}
23
{% block content %}
34
<h1>🧑 Credits</h1>
45
<p><em>car</em>, the Canvassing Action Resource, is built by:</p>
@@ -9,6 +10,12 @@ <h1>🧑 Credits</h1>
910
<li>&hellip;and, by the time you're reading this, perhaps <a href="https://github.com/an-empty-string/car/graphs/contributors">other contributors</a>.</li>
1011
</ul>
1112

13+
<p>We cannot give thanks enough for and to the folks who made this possible, especially:</p>
14+
<ul>
15+
<li>Katherine Bartle</li>
16+
<li><a href="https://yourallyinmontgomery.org">Allison Montgomery</a></li>
17+
</ul>
18+
1219
<p>It is licensed under the <a href="https://github.com/an-empty-string/car/blob/main/LICENSE">Friends and Lovers License</a>.</p>
1320

1421
<p>If you have any questions, comments, suggestions, concerns, complaints, or compliments about the platform &mdash; or any platitudes, poems, pictures of rocks, or pizza, please send them via email to car@tris.fyi.</p>

car/templates/door.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ <h1>
2222
{% endwith %}
2323

2424
<h2>👨 Voters</h2>
25-
<ul class="secretly-a-table">
25+
<ul class="secretly-a-table" hx-boost="true">
2626
{% for id in door.voters %}
2727
{% with voter = db.get_voter_by_id(id) %}
2828
{% if not voter.should_hide() %}

car/templates/turf.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ <h2>🚪 Doors</h2>
3838
{% else %}
3939

4040
{% for order_key, doors in pretty_ordered_doors %}
41-
<ul class="secretly-a-table">
41+
<ul class="secretly-a-table" {% if session.sports_car|default(false) %}hx-boost="true"{% endif %}>
4242
<li>
4343
<strong>
4444
{% if order_key[2] != "" %}
@@ -50,7 +50,9 @@ <h2>🚪 Doors</h2>
5050
</li>
5151

5252
{% for door in doors %}
53-
<li{% if door.id == session.last_door %} class="last-door"{% endif %}>{{ door_link(door.id, turf) }}</li>
53+
<li{% if door.id == session.last_door %} class="last-door"{% endif %}>
54+
{{ door_link(door.id, turf) }}
55+
</li>
5456
{% endfor %}
5557
</ul>
5658
{% endfor %}

0 commit comments

Comments
 (0)