mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-28 08:03:36 +00:00
52 lines
1.9 KiB
Markdown
52 lines
1.9 KiB
Markdown
# Themes and Templates
|
|
|
|
The visual look and feel of the front end is described in theme files
|
|
while <a
|
|
href="https://docs.djangoproject.com/en/1.7/topics/templates/">Django
|
|
templates</a> handle layout.
|
|
|
|
## Themes
|
|
|
|
Themes are stored in `/themes`. Themes consist entirely of static
|
|
files (e.g. css, images and javascript) and templates. The default or
|
|
active theme is linked from `/static/default` and `templates/default`.
|
|
If your theme needs to change anything other than these items, you'll
|
|
need a module (perhaps you'll need both).
|
|
|
|
There is not currently any support for dynamically choosing a theme at
|
|
runtime, but it is theoretically possible.
|
|
|
|
## Templates
|
|
|
|
Plinth uses the Django templating system. Templates are stored in
|
|
`/templates`. Template requirements are not specified.
|
|
|
|
TODO: formalize the template spec so template writers know what they
|
|
need to implement and where they can deviate.
|
|
|
|
In this section, I'll attempt to document some of the assumptions the
|
|
program has about templates. The goal is that if you write a tempate
|
|
that implements the spec, it should work just fine.
|
|
|
|
### The Template Stack
|
|
|
|
The template is a hierarchical stack, where some templates extend on
|
|
others. At the base of this stack is `base.tmpl`. It should specify
|
|
sections as blocks (rather than using the variables). This allows
|
|
other templates to easily override the base template.
|
|
|
|
`err.tmpl` builds on top of `page.tmpl` by adding some decoration to
|
|
the title field.
|
|
|
|
### Layout
|
|
|
|
Plinth expects a `content` block. This is where the meat of the
|
|
content goes. It is the center pane in the default layout. There
|
|
is a `title` block that the program will fill with text describing
|
|
the current page. There are two bars on the left side: `submenu`
|
|
for the menu and `sidebar` where short help texts go.
|
|
The lowest layer in the navigation is `subsubmenu`, displayed on top
|
|
of the content pane.
|
|
|
|
All these items are inside of blocks and can be overwritten.
|