Expand description
The items a resource module names most: use tablo::prelude::*;.
Macros§
- lens
- Build a
Lensfrom a model and a field, or a chain of embedded fields. - relation
- Build a
RelationLensfrom a model and one of its relation fields. - t
- A message spelled in the request’s locale:
t!(cx, "id", name = value, ..)istext!("id", name = value, ..).localize(cx), for what takes aString, such as aNotification’s title. - text
- A
Textmessage with its arguments:text!("id", name = value, ..)isText::message("id").arg("name", value)...
Structs§
- Abilities
- A policy that answers each
Abilityfrom the check declared for it, and denies every ability it declares none for. - Action
Def - What an
Actiondeclares besides its name, input and body: where its button renders, how it reads on each record, and which records it runs on. Every setting has a default, soActionDef::newalone is a button on each row, page header and the bulk bar, labelled after the action’sNAME, that runs on every record the policy allows. - Allow
- Allows every ability.
- Area
- A part of a panel under
{prefix}/{slug}with a sidebar of its own: a settings area, an account area. Registered withPanel::area. - Auth
- The panel’s authentication configuration (ADR-0013).
- Boolean
Column - A column of a
boolfield rendered as an icon. - Brand
- Branding for the panel’s shell: the sidebar header, the login card, and the
topbar below
md, where the sidebar folds into a sheet. - Chart
- A chart for a
Widget’s body: a heading, labels along the bottom, such as months, and oneSeriesof values per thing it measures.chartdraws it. - Choice
Field - A choice field:
Field::choice, or a record form’s choice control (Fis the form). - Color
Column - A column of a
Stringfield holding a CSS color, rendered as a swatch beside the value. - Computed
Column - A display-only column rendering any text from the row, with no query predicate.
- Count
Column - A column counting the records of a
Deferredhas_manyfield that a sourceSshows, a many-to-many#[has_many(via = ..)]one included. - Currency
- How a money column spells its amounts: the symbol, where it goes, the decimals, and whether the field stores minor units.
- Custom
Field - A field an app’s
Controlrenders:Field::customandField::toggle, or a record form’s toggle (Fis the form). - Date
Column - A column of a date field, rendered as a calendar day.
- Date
Filter - Date filter matching a date or time field by calendar day, or by a range of days; see
FilterDatefor the types. - Deny
- Allows nothing: the default policy.
- Detail
- The declaration of a detail page:
Columns, the same ones aTablelists, arranged inSection,Group,GridandTabsblocks. - Embedded
Column - A column of an
EmbeddedFormvalue. - Environment
- The deployment a panel runs in, such as staging: every page of the panel, its sign-in pages included, carries a stripe and a badge in its color, and its browser tab title starts with its name.
- Field
- One form field binding a lens to the control editing it, offering only that control’s modifiers so a modifier on the wrong control does not compile.
- Field
Access - Who may view one field of a model’s records, and who may change it, which
ResourceDef::field_accessdeclares: every resource the panel mounts over the model obeys the rule. - Field
Errors - A refused submission, keyed by the form whose fields it names.
- File
Column - A column of a
Stringfield holding an uploaded file’s path, rendered as a link to the file. - File
Field - A file field:
Field::file, or a record form’s file control (Fis the form). - Form
Values - What a form holds, one
FormValueper key: a submission its schema read, or a stored record as its record form spells it. - Global
Search - How a resource’s records show in its panel’s global search, as
ResourceDef::global_searchdeclares it: the details listed under each result’s title. - Grid
- A block of
colscolumns, clamped to 1..12, laying out a form’s fields or a detail page’s columns. - Group
- An unlabelled block grouping a form’s fields or a detail page’s columns.
- Header
Action Def - What a
HeaderActiondeclares besides its name, input and body: how its button reads, whether it asks first, and who it runs for beyond the policy or the page’s access. Every setting has a default, soHeaderActionDef::newalone is a gray button labelled after the action’sNAME. - Header
Actions - The
HeaderActions a page or a resource declares, in button order. - Icon
Column - A column of one field shown as an icon in its color, its label read to a screen reader and shown when the pointer rests on it.
- Image
Column - A column of a
Stringfield holding an uploaded image’s path, rendered as a thumbnail. - Lens
- A model field’s typed path, which queries filter and sort on, paired with the function that reads the field off a loaded record.
- ListTab
- One tab a table offers above its rows: a preset predicate the reader picks with
?tab=<key>, beside the search and the filters it combines with. - Look
- The theme and the sidebar frame one request wears over its
Brand’s, which the function passed toBrand::lookanswers for every page the panel renders, sign-in included: a visitor’s own pick, read from a cookie the app writes. - Navigation
Item - A sidebar entry: a resource’s, from its
ResourceDef, or aPage’s. - NoForm
- The record form of a resource with no create or edit page.
- Number
Filter - Number filter matching a number field exactly, or between two bounds; see
FilterNumberfor the types. - Outcome
- What an
Actionor aHeaderActionasks of the response once its write commits: which notification it flashes and where it lands. - PageDef
- What a
Pagedeclares: its slug, sidebar entry, title, access, header actions and widgets. - Page
Filter - A value a page offers above its widgets and keeps in its query string, which its widgets read
through
page_filters: the period a dashboard’s figures cover, or the store they count. - Page
Filters - The values the request holds for its page’s filters, which a widget reads:
page_filtersreturns it. - Panel
- An admin panel: resources and pages under one prefix, framed by one shell
and gated by one
Auth. Its pages carry arobotstag that asks search engines to neither index them nor follow their links. - Places
- Where an
Action’s button renders:ActionDef::places. - Posted
- An edit submission: the parsed form, and the fields the submission named.
- Presence
Filter - Presence filter matching an
Optionfield by whether it holds a value:f.<name>=setorf.<name>=empty. - Public
Link - A record’s public page, linked from its detail and edit pages.
- Query
Filter - A filter offering named predicates, such as an embedded-enum variant or any query the app
names. Several values match a record any of their predicates selects, which
multiplelets the control choose. A filter whose predicates read a fieldfield_accesshides from the user does not show to them: the panel reads the fields off the predicates. - Read
Only - Allows listing and viewing, and nothing else: no export, and no create, update, delete or custom action.
- Reads
- The fields of
MaColumnor aFilterreads, by the root field each path starts at: whatfield_accesshides it by. - Record
Page Def - What a
RecordPagedeclares: its slug, label, icon and access. Every setting has a default. - Record
Table - A few of a resource’s records as a table for a
Widget’s body, under the resource’s own columns: the newest posts, the orders awaiting review.record_tableloads and renders it. - Relation
- One relation of a parent resource’s records.
- Relation
Column - A column showing the record of a
Deferredbelongs_toorhas_onefield as text, or the records of ahas_manyone (list), which declares the field’s include so every page that renders it loads them. - Repeater
Column - A column of a list of
FormInputitems. - Resource
Def - What a
Resourcedeclares, from its names, policy and tenancy to its pages and actions. - Rich
Text Column - A column of a
Stringfield holding a rich text field’s HTML. A detail page shows the formatted HTML; a table cell shows its text, cut toexcerptcharacters; an export holds the text. - Rich
Text Field - A rich text field:
Field::rich_text, or a record form’s text control made one withTextField::rich_text(Fis the form). - RowLink
- A link among a row’s actions, such as a product’s storefront page: unlike an
Action, it posts nothing and runs no policy check, so it suits only a page the user may already open. - Schema
- Composes fields and layout blocks and resolves every field once into one list.
- Section
- A titled block holding a form’s fields (
schema) or a detail page’s columns (columns, whichdetaildeclares). - Select
Column - A column of an
Optionsfield rendered as a select that saves the record when it changes. - Select
Filter - Select filter matching a field exactly: a
String, anyFormScalarsuch as anOptionsenum, or a foreign key to arelationship’s rows. Several values match a record holding any of them, whichmultiplelets the control choose. - Series
- One thing a
Chartmeasures: a label for its legend and a value per label of the chart. - Sort
- A column and a direction to sort a table by: parsed from
?sort=<column>&dir=asc|desc, or declared as the table’s default. - Stat
- One figure of a
statsrow: what it counts, the value, and optionally a line under it, an icon, a link, a trend and a sparkline. - Step
- One step of a
Wizardblock: a titled trigger and the fields it shows. - Submits
- The buttons of an action’s input dialog and input page beside the action’s own, each running the same action with one checkbox of the input checked.
- Summary
- A figure a list shows under its rows: how many records it selects under the reader’s tab, search and filters, across every page, or how many of those a predicate selects.
- Tab
- One tab of a
Tabsblock: a titled trigger and the fields or columns it shows. - Table
- Table description of a
Resource’s list view declaring columns and how they map to queries. - Tabs
- A block showing one
Tabat a time, each holding a form’s fields (Tab::schema) or a detail page’s columns (Tab::columns). - Tenancy
- How a resource’s rows belong to a tenant.
- Tenant
Id - One tenant’s id, and the field type of a resource’s tenant column.
- Ternary
Filter - Ternary filter matching a
boolfield. - Text
- A word a panel renders: plain text, or a message the request’s
Localespells. - Text
Column - A column of one field, rendered as text and bound through a
Lensfor sorting and search. - Text
Field - A text field:
Field::text, or a record form’s text control (Fis the form). - Text
Filter - Text filter matching a
StringorOption<String>field by a term the user types, the way aTextMatchnames. - Text
Input Column - A column of one field rendered as a text input that saves the record on Enter.
- Toggle
- Renders a
boolfield as a checkbox preceded by a hiddenfalse. - Toggle
Column - A column of a
boolfield rendered as a switch that saves the record when it flips. - Widget
Def - What a
Widgetdeclares: how many columns of the grid it spans, and who sees it. - Wizard
- A block walking a form’s fields one
Stepat a time, with a button to the next step and one back.
Enums§
- Ability
- One thing a policy is asked to allow; record abilities are asked once per loaded row, and a record that cannot be viewed cannot be written by guessing its key.
- Action
Layout - Where a table puts a row’s actions: its custom actions, View, Edit and Delete.
- Alignment
- Where a column’s header and cells align their content.
- Change
- What one write of a resource changed: the mutation and the rows it wrote.
- Color
- A semantic color for a badge, a status dot or a cell’s text.
- Column
Width - How a
Columntakes the table’s width. - Font
Weight - How heavy a column’s text renders.
- Pagination
- How a table pages through its rows.
- Radius
- How round a
Brand’s controls, cards and badges are, over its theme’s. - Resource
Page - A record page a resource serves beside its list, unless
without_pageturns it off. - Sidebar
Frame - How the sidebar sits beside the page, which a
Brandpicks withBrand::sidebarover itsTheme’s. - Text
Match - How a
TextFiltermatches its term, which thef.<name>.oppart names. - Theme
- One of the looks Tablo ships, which a
Brandpicks withBrand::theme: its palette in both color schemes, its type, corners and shadows, and theSidebarFrameit suggests. Every theme speaks the same grammar (captions over the sidebar’s groups and the tables’ columns, the current page notched in the primary color, the title ruled off from the page, ruled head bands), each in a voice of its own. - Tool
- One button of a rich text field’s toolbar. A tool is also a grant: the field keeps only the elements and attributes its tools produce, so a tool left off the toolbar cannot be typed, is dropped from a paste, and is removed from a forged post.
- Trend
- Which way a
Stat’s figure moved, shown as an arrow before its detail line. - Write
Error - Why a record fn or an action’s run wrote nothing: a refusal the page shows, or a failure.
Traits§
- Action
- A mutation beyond create, update and delete: “publish”, “archive”, “resend the invite”.
- Date
Value - The field types a
DateColumnspells as a calendar day:jiff::civil::Date,jiff::civil::DateTime,jiff::Timestamp(read in the request’stime_zone, as aDateFilterreads it) and anOptionof any of them. - Embedded
Form - Reads an embedded value from and writes it to
FormValues, one key per leaf; derive it to generate the value’s schema. - Form
Input - A typed value a form posts under its own keys, which no column binds: what an
Actionasks for before it runs, what a sign-up reads, one item of a repeater. - Header
Action - A mutation that acts on no record, run from a button in a page’s header: “import posts”, “clear the cache”, “recompute the totals”.
- Into
Options - A choice’s static options as
(value, label)pairs, in display order. A value listed alone is its own label; a label is aText, so a message translates it. - Options
- A closed set of values, each with its label.
- Page
- A panel page that is not a resource, mounted at
{prefix}/{slug}with a sidebar entry; the panel owns the route and entry while the page owns its markup. - Panel
Model - What a panel needs from a model a resource serves: its tenant columns, its version counter,
how to copy a record without its relations, and the table and detail page it reads as when its
resource declares none, which a
ResourceDefwithout atablelists and without adetailshows. - Policy
- Decides which
Abilitys the current user has over a resource’s records. - Record
Form - The typed value a resource’s form submission parses into.
- Record
Page - A page about one record of the resource
R, served at{list}/{key}/{slug}and linked from the record’s navigation: the tab bar its detail page, edit page, record pages and relation tabs share. The panel loads the record and checks the request may open the page; the page renders its body. - Resource
- Maps one Toasty
Modelto its admin UI. - Router
Builder Panel Ext - Mounts a
Panelon a router the app owns. - Widget
- One block of a page’s widget grid: a row of stats, a chart, a list of recent records.
Functions§
- can
- Whether the request may do
abilityonRas the context’s panel mounted it: what the ability’s button and route ask.falsewhen the panel does not mountR. Does not check sign-in or tenant scope. - can_
list - Whether the current request may open
R’s list: the request’s panel mountsR, and sign-in, tenant scope, andAbility::ViewAnyallow it. - can_
open - Whether the current request may open the page
P: the request’s panel mountsP, and sign-in andPageDef::accessallow it, the checks the page’sGETmakes. - can_
view_ field - Whether the current request may view
R’sfield: the request’s panel mountsR, and noResourceDef::field_accessrule over the model hides the field from it. The panel’s own pages mask a hidden field; aRecordPageshows one only after asking this. - filter_
keys - The predicate selecting each of
recordsby its primary key, so that an action writes the same change to all of them in one statement rather than one per record: - list_
query R’s records as its list shows them in this request: thescoped_querythe list reads, narrowed by its tab, search and filters, unordered. Alist_widgetreading it shows figures that follow the list, and reruns with it as the reader searches, filters or switches tabs.- page_
filters - The values the request holds for the filters of the page it renders: the registered
Pagewhose URL its path names. A widget reads them to narrow what it shows. Outside such a page, as in a resource list’s widgets, it holds none. - scoped_
query - The tenant-scoped base query.
- tenant_
id - The tenant the request acts for, if any.
- when
- Allows every ability while
predicateholds for the request.
Derive Macros§
- Embedded
Form - Derives
EmbeddedFormfor an embedded struct or enum. - Form
Input - Derives
FormInputfor a typed value a form posts under its own keys: what anActionasks for before it runs, what a sign-up reads, or one item of a repeater. - Model
Form - Derive a model’s
RecordFormstruct from the model: the fields a person fills, named and typed as the model declares them. - Options
- Derive
Optionsfor a unit-variant enum: the(value, label)list a choice field, a select filter and a column share, and theFormScalarthat posts a variant as its value and reads it as its label. - Panel
Model - Derive a model’s
PanelModel: its tenant columns, its version counter, its copy without relations, and the table a resource lists it in and the detail page it shows it on when the resource declares neither. - Record
Form - Derive
RecordFormfor the typed value a resource’s form writes.