Show related records beside a form
An aside puts one pane beside the content of a page. This guide uses it twice on the page of
one member: first for the member’s payments beside the form, then for the list of every member
beside the one being edited. It assumes a members table with a payments list(payments.member) column, and a payments table with a member ref(members) column, a
paid_on date and an amount.
Put the payments beside the form
Section titled “Put the payments beside the form”- Open the page that edits one member. It has a
datarow and aform. - After the form, write
asidewith a label. The label is the heading of the pane and the name a screen reader gives it. - Inside the aside, write a
listof the member’s payments.:member.paymentsreads the relation of the page’s row, so the list shows this member’s payments only. Give it alimit:, because a pane is narrow and stays on screen while the page scrolls. - Add a
notewhen the reader needs a sentence beside the numbers.
page member "{:member.name}" { route: /members/{id} new_route: /members/new access: board
data member of members
form of members { fields: name, status, fee_group }
aside "About this member" { list of :member.payments "Payments" { columns: paid_on, amount sort: paid_on desc limit: 5 } note { text: "Fees are billed per season." } }}The aside is the last item of the page, so the pane sits after the form: on the right in a left-to-right language. On a screen narrower than 48rem (768px) it sits below the form.
The list is the same region it would be outside the pane. Its access, its where: and its
export do not change. On the create page (/members/new) the list is left out, because it reads
the page’s row and there is no row yet. See
new_route.
List every member beside the one being edited
Section titled “List every member beside the one being edited”- Write the aside first, before the form. The pane then sits before the form: on the left in a left-to-right language.
- Inside it, write a
listofmemberswith arow ->link to this page. Each row opens the same page with that member.
page member "{:member.name}" { route: /members/{id} new_route: /members/new access: board
data member of members
aside "Members" { list of members "All members" { columns: name sort: name row -> member } }
form of members { fields: name, status, fee_group }}The row of the member being edited is marked as the current one in the list, with
aria-current="page" and a heavier weight. The engine marks a row in any list whose row ->
link leads to the page’s own address, so no extra declaration is needed.
What the compiler refuses
Section titled “What the compiler refuses”The page can have one aside, and it must be the first or the last item. An aside between two
regions, a second aside, an aside without a label, and an aside with no region are refused. A
report, a sheet and a matrix do not fit a pane; the message names the region. See
aside for the full list.