Skip to content

Commit e3551fe

Browse files
committed
Improved UI
1 parent f081595 commit e3551fe

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

examples/adv_app2.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
db = database(':memory:')
99

10-
11-
1210
class User: name:str; pwd:str
1311

1412
class Todo:
@@ -44,7 +42,13 @@ def user_auth_before(req, sess):
4442
user_auth_before,
4543
skip=[r'/favicon\.ico', r'/static/.*', r'.*\.css', r'.*\.js', '/login']
4644
)
47-
app, rt = fast_app(hdrs=Theme.blue.headers()+[SortableJS('.sortable'),],before=beforeware)
45+
46+
def _not_found(req, exc): return Titled('Oh no!', Div('We could not find that page :('))
47+
48+
49+
app, rt = fast_app(hdrs=Theme.blue.headers()+[SortableJS('.sortable'),],
50+
exception_handlers={404: _not_found},
51+
before=beforeware)
4852

4953
# Authentication
5054
login_redir = Redirect('/login')
@@ -80,7 +84,7 @@ def logout(sess):
8084
def index(auth):
8185
top = Grid(Div(A('logout', href=logout), style='text-align: right'))
8286
new_inp = Input(id="new-title", name="title", placeholder="New Todo")
83-
add = Form(Group(new_inp, Button("Add")),
87+
add = Form(Group(DivLAligned(new_inp, Button("Add", cls=ButtonT.primary))),
8488
hx_post=add_todo, target_id='todo-list', hx_swap="afterbegin")
8589
frm = Form(*db.todos(order_by='priority'),
8690
id='todo-list', cls='sortable', hx_post=reorder, hx_trigger="end")

0 commit comments

Comments
 (0)