Runique Admin
Documentation / Runique Admin / Admin template system

Admin template system

Hierarchy

admin/admin_template.html   ← contract: <head>, CSRF meta, csrf.js, modal
        ↓ extends
admin_base.html             ← layout: stylesheets, sidebar, top bar
        ↓ extends
admin/list.html, admin/create.html …   ← the pages, made of blocks

admin/admin_template.html: the HTML skeleton and what must always be there. Not replaceable.

admin_base.html: the layout. It isn't replaced in one go: its sidebar and top bar change through their blocks (GlobalBlock::Sidebar, GlobalBlock::Topbar), its stylesheets through the CSS overrides.

The pages: each is made of replaceable blocks ({% dev_block "name" %}). You replace a block, or the whole page, for every model or for one. See Template override.


Tera blocks of the skeleton

A page extending admin_base.html (or admin/admin_template.html) can redefine:

BlockRole
{% block lang %}The <html lang> tag
{% block title %}Page title (<title>)
{% block extra_css %}Stylesheets in <head>: admin_base.html writes the page's there, keep {{ super() }}
{% block layout %}The whole layout (sidebar + main area)
{% block sidebar %}Sidebar
{% block topbar %}Top bar (holds breadcrumb)
{% block breadcrumb %}Breadcrumb
{% block messages %}Flash messages, holds {% messages %}
{% block content %}Page content
{% block extra_js %}Scripts before </body>: admin_base.html puts the admin's there, keep {{ super() }}
{% block footer %}Footer

Outside blocks (always present)

Written directly in admin/admin_template.html, no override removes them (except a page extending nothing):

  • <meta name="csrf-token" content="{{ csrf_token }}"> and <meta name="robots" content="noindex, nofollow"> in <head>
  • <script src="{% runique_static "js/csrf.js" %}" defer></script> before </body>
  • the confirmation modal

Sub-sections

SectionDescription
Context keysVariables injected by the backend into each template
OverrideReplace a block (HTML, CSS or both) or a whole page

Back to menu