|
7 | 7 |
|
8 | 8 | db = database(':memory:')
|
9 | 9 |
|
10 |
| - |
11 |
| - |
12 | 10 | class User: name:str; pwd:str
|
13 | 11 |
|
14 | 12 | class Todo:
|
@@ -44,7 +42,13 @@ def user_auth_before(req, sess):
|
44 | 42 | user_auth_before,
|
45 | 43 | skip=[r'/favicon\.ico', r'/static/.*', r'.*\.css', r'.*\.js', '/login']
|
46 | 44 | )
|
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) |
48 | 52 |
|
49 | 53 | # Authentication
|
50 | 54 | login_redir = Redirect('/login')
|
@@ -80,7 +84,7 @@ def logout(sess):
|
80 | 84 | def index(auth):
|
81 | 85 | top = Grid(Div(A('logout', href=logout), style='text-align: right'))
|
82 | 86 | 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))), |
84 | 88 | hx_post=add_todo, target_id='todo-list', hx_swap="afterbegin")
|
85 | 89 | frm = Form(*db.todos(order_by='priority'),
|
86 | 90 | id='todo-list', cls='sortable', hx_post=reorder, hx_trigger="end")
|
|
0 commit comments