my eye

author Angelo Gladding

category Micropub

name Bookshelf

published 2025-08-06T13:13:49.485821-07:00

type entry

updated 2025-08-13T15:40:39.753895-07:00

url /books, /2025/08/06/mw

visibility public

Content

$if web.tx.request.method == "POST":
    $ form = web.form("name")
    $if mp_resp := mp_post(h="book", name=form.name):
        <p>$mp_resp.text</p>
        <p>Book posted.</p>
    <p>Added</p>

<form method=post>
<label>Name: <input name=name></label>
<button>Add</button>
</form>

$if books := mp_get(h="book"):
    <ul>
    $for book in books:
        $ name = book["name"][0]
        $ permalink = book["url"][0]
        <li><a href=$permalink>$name</a> <small>\
        $for read in mp_get(read_of=permalink):
            $read["progress"][0]
        </small></li>
    </ul>