New on arc-wiki.git - lib/repage.arc Often you find yourself designing a web page where the most common actions are immediately displayed, but further actions (more rarely used) are accessed by clicking on a link. Alternatively, an action may require confirmation - for example, to verify if a blog post is to be deleted. Most of the time, you want to display almost exactly the same page, but with the options expanded, or with a confirmation box. By using (repage ...), you can. To use, just capture the page you want to display in a (repage ...) form. Then, set the parts you want to replace with (repage-point) forms. For example, if you want to create some actions: (repage
(generate-content)
(tag b (prn "Actions: "))
(w/bars
(link "commonaction1")
(link "commonaction2")
; generate the "more >>" link
(repage-point
(repage-link "more >>"
; gets expanded iff the link is pressed
(w/bars
(link "rareaction1")
(link "rareaction2")
(repage-back-link "less <<"))))))
The current version does not work as expected when doing (repage-point (repage-link "foo" (repage-point (repage-link "bar" (prn "bar"))))). I'm attempting to explain why currently in the source although my explanation could be wrong. |