-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsample.py
47 lines (36 loc) · 1.18 KB
/
sample.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# stubs
def html(s: str):
return s
def _(s: str):
return s
def e(s: str):
return s
class SafeStr(str):
pass
def Dialog(*, post_url: str, title: str, body: SafeStr, ok_text: str | None = None):
ok_text = ok_text or _("Ok")
return html(
f"""
<div class="modal fade" tabindex="-1">
<div class="modal-dialog modal-md modal-dialog-centered">
<form class="form modal-content"
autocomplete="off"
hx-post="{ post_url }"
hx-select=".modal-content"
hx-swap="outerHTML">
<div class="modal-header">
<h5 class="modal-title">{ e(title) }</h5>
</div>
<div class="modal-body">
{ body }
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary">
{ e(ok_text) }
</button>
</div>
</form>
</div>
</div>
"""
)