Runique Admin
Documentation / Runique Admin / Block reference — admin

Block reference — admin

The keys to pass to .block(…), .block_stylesheet(…), .global_block(…) and .global_block_stylesheet(…). How they work is described in Template override.

The keys to pass to .block(…), .block_stylesheet(…), .global_block(…) and .global_block_stylesheet(…). How they work is described in Template override.

use runique::admin::template::{Block, GlobalBlock, Page};

Each block's Runique template is the best starting point: copy it into your templates and modify it. It lives in the crate's sources, under templates/ (for a crate installed from crates.io: ~/.cargo/registry/src/*/runique-<version>/templates/).


Blocks of a model's pages — `Block`

Replaceable for every model (AdminTemplate) or for one (ModelTemplates).

Rust keyName (dev_block)PageRunique's templateRunique's stylesheet
Block::ListTablelist_tablelistadmin/blocks/list/table.htmlcss/admin/blocks/list.css
Block::ListFilterslist_filterslistadmin/blocks/list/filters.html—
Block::ListSearchlist_searchlistadmin/blocks/list/search.html—
Block::ListPaginationlist_paginationlistadmin/blocks/list/pagination.html—
Block::ListBulklist_bulklistadmin/blocks/list/bulk.html—
Block::Kebabkebablist (each row's menu)admin/blocks/common/kebab.html—
Block::DetailFieldsdetail_fieldsdetailadmin/blocks/detail/fields.htmlcss/admin/blocks/detail.css
Block::DetailActionsdetail_actionsdetailadmin/blocks/detail/actions.html—
Block::DetailGroupsdetail_groupsdetailadmin/blocks/detail/groups.htmlcss/admin/blocks/rights.css
Block::DetailTransferdetail_transferdetailadmin/blocks/detail/transfer.html—
Block::FormFieldsform_fieldscreate, editadmin/blocks/form/fields.html—
Block::FormActionsform_actionscreate, editadmin/blocks/form/actions.html—
Block::DeleteWarningdelete_warningdeleteadmin/blocks/delete/warning.html—
Block::DeleteActionsdelete_actionsdeleteadmin/blocks/delete/actions.html—

FormFields and FormActions are shared by create and edit: replacing them changes both pages.

Blocks of the layout and of pages about no model — `GlobalBlock`

Replaceable for every model only (AdminTemplate).

Rust keyName (dev_block)PageRunique's templateRunique's stylesheet
GlobalBlock::Sidebarsidebarall but the loginadmin/blocks/layout/sidebar.html—
GlobalBlock::Topbartopbarall but the login (right of the top bar: theme, back to the site, sign out)admin/blocks/layout/topbar_actions.html—
GlobalBlock::DashboardTabledashboard_tabledashboardadmin/blocks/dashboard/table.htmlcss/admin/blocks/dashboard.css
GlobalBlock::DashboardGroupsdashboard_groupsdashboardadmin/blocks/dashboard/my_groups.html—
GlobalBlock::HistoryTablehistory_tablehistoryadmin/blocks/history/table.html—
GlobalBlock::HistoryFiltershistory_filtershistoryadmin/blocks/history/filters.html—
GlobalBlock::HistoryActionBadgehistory_action_badgehistory, history entryadmin/blocks/history/action_badge.html—
GlobalBlock::RightsTablerights_tablerightsadmin/blocks/rights/table.html—

Reminder: when a block has a stylesheet in Runique, block_stylesheet / global_block_stylesheet replaces it; otherwise yours is added.


Pages — `Page`

Used by ModelTemplates::page and page_stylesheet (global and per model).

Rust keyGlobal replacementPer model
Page::Login.with_loginno
Page::Dashboard.with_dashboardno
Page::List.with_listyes
Page::Create.with_createyes
Page::Edit.with_edityes
Page::Detail.with_detailyes
Page::Delete.with_deleteyes
Page::History.with_historyno
Page::HistoryDiff.with_history_diffno
Page::Rightsnono
Page::Transfernono

Tera blocks of Runique's templates

A page that extends one of Runique's templates can redefine its Tera {% block %}s (not to be confused with the dev_block blocks above). Use {{ super() }} to keep the original content and add around it.

TemplateTera blocks
admin/admin_template.htmllang, title, extra_css, layout, sidebar, topbar, messages, content, extra_js, footer
admin_base.htmlfills extra_css (stylesheets), sidebar, topbar (holds breadcrumb), extra_js
admin/list.htmltitle, breadcrumb, content, list_header, extra_css, extra_js
admin/list_partial.htmllist_search, list_group_action, list_table, list_pagination, list_filters
admin/create.htmltitle, breadcrumb, content, create_header, create_form, create_form_fields, create_form_actions, extra_js
admin/edit.htmltitle, breadcrumb, content, edit_header, edit_form, edit_form_fields, edit_form_actions, extra_js
admin/detail.htmltitle, breadcrumb, content, detail_header, detail_actions, detail_table, detail_groups, detail_transfer
admin/delete.htmltitle, breadcrumb, content, delete_header, delete_warning, delete_actions
admin/dashboard.htmltitle, breadcrumb, content, dashboard_header, dashboard_groups, dashboard_stats, dashboard_table
admin/history.htmltitle, breadcrumb, content, history_header, history_filters, history_table, history_pagination
admin/history_diff.htmltitle, breadcrumb, content, history_entry_header, history_entry_changes

To change a single block, prefer .block(…): it doesn't depend on the page's structure and can target one model.


CSS theme — variables

Every admin stylesheet reads the variables of css/admin/variables.css. The default theme is dark (:root); the light theme is defined under [data-theme="light"], set on <html> by the theme button. A stylesheet changing the theme must therefore redefine both.

This stylesheet is always loaded, even on a page replaced with page_stylesheet.

GroupVariables
Backgrounds--bg-main, --bg-card, --bg-sidebar, --bg-input, --bg-hover, --bg-active, --overlay
Text--text-main, --text-muted, --text-sidebar, --label, --on-accent
Accent--accent, --accent-hover, --accent-light, --accent-gradient, --focus-ring
States--success, --success-light, --danger, --danger-light, --danger-border, --danger-ring, --warning, --warning-light, --info, --info-light
Borders and shadows--border, --border-light, --radius-sm, --radius, --radius-lg, --shadow-sm, --shadow, --shadow-lg
Sizes--sidebar-width, --sidebar-collapsed, --topbar-height, --content-max, --control-height, --control-height-sm
Fonts--font-sans, --font-mono
Stacking--z-sticky, --z-dropdown, --z-bar, --z-sidebar, --z-drawer, --z-overlay, --z-modal
Other--transition

There is no dedicated method for a theme stylesheet. It loads on every page (but the login) when attached to a block shown everywhere that has no stylesheet in Runique:

.templates(|t| t.global_block_stylesheet(GlobalBlock::Topbar, "css/admin/theme.css"))
/* static/css/admin/theme.css */
:root {
  --accent: #e11d48;
  --accent-hover: #be123c;
}
[data-theme="light"] {
  --accent: #be123c;
  --accent-hover: #9f1239;
}

It loads after Runique's stylesheets: at equal specificity, its values win.

The CSS classes used by Runique's templates are listed in the CSS class reference.