wiki:DeveloperGuidelines/Themes

Version 3 (modified by Fran Boon, 12 years ago) ( diff )

--

Themes

Table of Contents

    1. Default Theme
    2. User Theme

Sahana Eden supports custom Themes as part of it's overall Templates system.

This allows customisation of:

  • Homepage
  • Layout
  • CSS

NOTE: This is still a work-in-progress: not everything here is ready yet & the details may change!

Default Theme

By default these files are used:

  • /private/templates/default/views/layout.html

in non-Debug mode:

  • /static/themes/default/sahana.min.css

in Debug mode:

  • /private/templates/default/css.cfg
  • /static/themes/default/layout.css
  • /static/styles/S3/sahana.css

User Theme

A new Theme should match the name of the controlling Template.

To create a new theme:

  1. Specify the Theme name in your template's /private/templates/<templatename>/config.py:
    • settings.base.theme = "themename"
  2. Create new folders to hold the theme elements:
    • /static/themes/<themename>/css which will usually contain these files: layout.css, theme.css (it is normally assumed that /static/styles/S3/sahana.css is also used)
    • /static/themes/<themename>/img
  3. If not already using a template create one: /private/templates/<templatename>
  4. Create these files in your templates folder:
    • /private/templates/<templatename>/__init__.py - this can be empty but must be present.
    • /private/templates/<templatename>/css.cfg - list of CSS files to use in Debug mode, or be compressed together for the normal non-debug mode by the Build script (static/scripts/tools/build.sahana.py) into:
      • /static/themes/<themename>/css/sahana.min.css
    • /private/templates/<templatename>/views/layout.html - overall layout of the HTML.

NB Production sites who wish to compile their code either need to hardcode the theme name in their views/layout.html or upgrade to Web2Py version: 2.00.0 (2012-06-17 23:36:32) or newer

Note: See TracWiki for help on using the wiki.