| 1 | = Templates = |
| 2 | [[TOC]] |
| 3 | |
| 4 | == Introduction == |
| 5 | Templates allow selecting alternate configuration sets. |
| 6 | |
| 7 | This allows a separation between Core Code & !Settings/Custom Code. |
| 8 | |
| 9 | This helps prevent merge conflicts between different deployment branches & hence reduces the risk of forking. |
| 10 | |
| 11 | == Design == |
| 12 | Configuration is done using these files: |
| 13 | * /private/templates/000_config.py |
| 14 | * /private/templates/default/config.py |
| 15 | * /private/templates/<template>/config.py |
| 16 | |
| 17 | During 1st_run, 000_config.py is copied to models/ |
| 18 | |
| 19 | 000_config.py includes: |
| 20 | * FINISHED_EDITING_CONFIG_FILE |
| 21 | * VERSION |
| 22 | * machine-specific configuration (Debug, Database, SMTP, API Keys, etc) |
| 23 | * a setting to define which template folder to run |
| 24 | * importing of settings from templates/<template>/config.py |
| 25 | * optional local overrides to the template's settings |
| 26 | |
| 27 | == Prepopulate Data == |
| 28 | Prepopulate options are defined in the template's config.py (ut can be overridden in the running 000_config.py): |
| 29 | * DeveloperGuidelines/PrePopulate |
| 30 | |
| 31 | == Theme == |
| 32 | By default these files are used: |
| 33 | * /private/templates/default/views/layout.html |
| 34 | * /private/templates/default/views/style.html (for non-Debug mode) |
| 35 | * /private/templates/default/style.cfg (for Debug mode) |
| 36 | |
| 37 | Optionally a template's config.py (or running 000_config.py) can specify a 'theme' folder (usually the same as the template folder), so that these are used instead: |
| 38 | * /private/templates/<theme>/views/layout.html |
| 39 | * /private/templates/<theme>/views/style.html (for non-Debug mode) |
| 40 | * /private/templates/<theme>/style.cfg (for Debug mode) |
| 41 | * static/styles/<template>/sahana.min.css |
| 42 | |
| 43 | By convention, suporting files specific to this theme should be placed in: |
| 44 | * static/styles/<template>/*.css |
| 45 | * static/img/<template>/*.png |
| 46 | |
| 47 | === !ToDo === |
| 48 | * controllers/default.py index() |
| 49 | * modules/eden/layouts.py & modules/eden/menus.py |
| 50 | |
| 51 | == References == |
| 52 | * BluePrint/Templates |
| 53 | * Prepopulate |
| 54 | * BluePrint/WebSetup |
| 55 | * [https://groups.google.com/d/topic/sahana-eden/Vy8xT4bA_pA/discussion Profile Layer] |
| 56 | * [https://groups.google.com/d/topic/sahana-eden/TadDloKhqkg/discussion Profile Templates Plan] |
| 57 | * [https://groups.google.com/d/topic/sahana-eden/YzgzXpTQjt8/discussion Splitting up CSS into separate files] |
| 58 | |
| 59 | ---- |
| 60 | DeveloeprGuidelines |