Runique Admin
Documentation / Runique Admin / Admin — Tera variables per page

Admin — Tera variables per page

The variables each admin page gets, and so does any block or page replacing it (see Template override). The source of truth is runique/src/admin/router/context.rs: each page has its struct there (ListContext, DetailContext…).

Shared by every page (but the login)

VariableContent
site_titleTitle declared with .site_title(…)
langCurrent language code (fr, en…)
admin_prefixThe admin's base address (mount prefix + path), no trailing /
stylesheetsThe page's stylesheets, each { href, integrity }; written by admin_base.html
resourcesModels the user may see, in menu order: { key, title, list_url }
current_resourceThe page's model key (a string), empty on the dashboard
current_page"dashboard", "list", "detail", "create", "edit", "delete", "history", "rights", "transfer"
current_userSigned-in account: id, username, rang, groupes, droits
nav.dashboardDashboard
nav.historyHistory, none when the account reads none
nav.logoutWhere the sign-out form posts (POST + CSRF)
nav.site"Back to the site" link
nav.toggle_templateDashboard switch, see below
csrf_tokenThe request's CSRF token
admin_base_*The layout's translations

Plus the variables of any Runique template ({% messages %}, {% csp %}, {% static %}…), see Templates.


Translations

Each page gets its section's translations, as admin.<section>.<key> → {{ admin_<section>_<key> }} (for instance admin.list.btn_create → {{ admin_list_btn_create }}). The key list is in runique/src/utils/constante/admin_key.rs (ADMIN_MESSAGE_KEYS), the texts in runique/src/utils/trad/<language>.json.

PageSections
loginlogin
dashboardbase, dashboard
listbase, list
detailbase, detail, list
createbase, create
editbase, edit
deletebase, delete
history, history entrybase, history
rightsbase, rights
group transferbase, transfer

Login

VariableContent
admin_prefixThe form posts to {{ admin_prefix }}/login
csrf_tokenTo send back in the hidden csrf_token field
errorFailure message (credentials, CSRF, locked account, session), absent otherwise
site_title, site_url, lang, stylesheets—

Fields the POST expects: username, password, csrf_token.


Dashboard

VariableContent
resource_countsRow count per model: resource_counts[resource.key]; empty when counting failed
my_groupsThe account's groups: { name, staff, rights: [{ table, rights }] }
admin_has_session_overridetrue when the switch brought back Runique's dashboard

When the dashboard is replaced (.with_dashboard), nav.toggle_template shows Runique's one and back; the choice is kept in the session.


List

Also rendered, without layout, for HTMX requests (admin/list_partial.html).

VariableContent
resource{ key, title, display: { list_filter: [(column, label)] } }
resource_links{ list, create, bulk, rights }; create, bulk, rights are none without the right
entriesThe page's rows: { id, values, links: { detail, edit, delete }, taken_by, account }
visible_columnsShown columns, in order (key left out)
sortable_columnsSortable columns (declared .sortable())
column_labelsEach column's header, by name
rich_fieldsColumns holding HTML, shown as plain text
group_actionsGrouped actions offered: { index, label }
bulk_deleteWhether the grouped actions' bar offers delete
return_qsCurrent query (search, sort, filters, page), to come back to the same place
filter_valuesEach filter's values, by column: value, active, qs (link turning it on or off)
filter_clearLink turning a whole filter off, for the filtered columns
active_filtersApplied filters, column → values
filter_qsApplied filters as a query string (&filter_col=value…)
searchCurrent search
sort_by, sort_dir, sort_dir_toggleCurrent sort (asc / desc) and the other direction
totalMatching rows, all pages
page, page_count, page_sizeCurrent page, page count, rows per page
list_pagerThe list's arrows and selector: page, page_count, prev_qs, next_qs (None with no page that way), size, size_options, size_param, keep
filter_pagersEach filter group's arrows, by column (same shape, page_count is None)
filter_size_pagerThe filter panel's selector (same shape), None without a filter
size_qs, filter_nav_qsThe list's size, and the panel's pages and size, as a query string to keep on a link
filter_navThe panel's pages and size, as pairs for a form's hidden inputs

entry.values[column] gives a shown column's value.


Detail

VariableContent
resource, resource_keyThe model (resource_key = resource.key)
object_idThe row's key
entryThe row: one entry per readable column
detail_columnsThe row's readable columns, in display order
rich_fieldsHTML columns, shown sanitized
list_urlBack to the list
links{ detail, edit, delete }
reset_password_urlOn an account, with the right to update it
rank_choices, current_rank, rank_urlOn an account whose rank may be changed: ranks offered (value, label), current rank, where to post
rights_urlAn admin's rights grid, when it may be set
memberships, memberships_urlOn an account: groups managed (field name, group name, ticked), where to post
transfer_receivers, transfer_urlOn a group, for a dirigeant: accounts it may be handed to (id, name), transfer page
taken_byGroup taken back after a departure: by whom
accountOn an account: { rank, rank_label, groups }, read-only

Create and edit

VariableContent
resource, resource_keyThe model
object_idThe row's key (edit only)
list_urlBack to the list
form_fieldsThe form: html (fields, CSRF and form name included), errors, form_errors, fields
form_actionWhere the form posts
cancel_url"Cancel": the row on edit, the list on create
cancel_label, submit_labelButton texts
no_fields_labelShown when the form has no field

Write {{ form_fields.html }}: at load, Runique rewrites it to {{ form_fields.html | safe }} (the form's HTML is produced by Runique, its values already escaped). The form_fields and form_actions blocks are included inside the <form> tag.


Delete

VariableContent
resource, resource_keyThe model
object_idThe row's key
list_urlBack to the list
form_actionWhere the confirmation posts
form_fieldsConfirmation form, with no field: html (CSRF token and name), errors, form_errors
cancel_urlBack to the row

History

VariableContent
history_urlWhole history: where the filters post, and their reset
entriesEntries, newest first (see below)
history_resourcesModels whose history the account reads: { key, title }
filter_resource, filter_object, filter_action, filter_userCurrent filters
page, total_pagesPagination

An entry: { id, created_at, username, resource_key, resource_title, object_pk, object_label, action, has_changes, links: { user, object, entry } }. action is create, update or delete; created_at is UTC (YYYY-MM-DD HH:MM:SS); links.entry is none without a readable change.

History entry

VariableContent
history_urlBack to the history
entryThe entry (same shape as above)
changesChanged, readable columns: { column, old, new }

Rights and transfer

These two pages can't be replaced; only the rights page's rights_table block can. Their context (RightsContext, TransferContext) is described in context.rs.


Sub-sections

SectionDescription
OverrideReplace a block (HTML, CSS or both) or a whole page