Theming » History » Version 3
Ward Vandewege, 01/28/2014 08:59 PM
1 | 1 | Ward Vandewege | h1. Theming |
---|---|---|---|
2 | |||
3 | 2 | Ward Vandewege | Tapestry uses four layouts (i.e. themes) throughout the application. There is one main layout which is used almost everywhere, and there are three other layouts that have slight tweaks to the main layout and are used in a few specific places. |
4 | 1 | Ward Vandewege | |
5 | These layouts are defined in the |
||
6 | |||
7 | config/config.defaults.yml |
||
8 | |||
9 | file as |
||
10 | |||
11 | <pre> |
||
12 | # Layouts |
||
13 | application_layout: 'tapestry_default' |
||
14 | application_layout_exam: 'tapestry_default_exam' |
||
15 | application_layout_gmaps: 'tapestry_default_gmaps' |
||
16 | application_layout_mobile: 'tapestry_default_mobile' |
||
17 | </pre> |
||
18 | |||
19 | The values of these fields mean that these layout files are used in the default Tapestry installation: |
||
20 | |||
21 | <pre> |
||
22 | app/views/layouts/tapestry_default.html.erb |
||
23 | app/views/layouts/tapestry_default_exam.html.erb |
||
24 | 3 | Ward Vandewege | app/views/layouts/tapestry_default_gmaps.html.erb |
25 | 1 | Ward Vandewege | app/views/layouts/tapestry_default_mobile.html.erb |
26 | </pre> |
||
27 | |||
28 | To start creating a custom theme, add the layout fields to your |
||
29 | |||
30 | config/config.yml |
||
31 | |||
32 | file and give them new values, for instance: |
||
33 | |||
34 | <pre> |
||
35 | # Layouts |
||
36 | application_layout: 'my_site' |
||
37 | application_layout_exam: 'my_site_exam' |
||
38 | application_layout_gmaps: 'my_site_gmaps' |
||
39 | application_layout_mobile: 'my_site_mobile' |
||
40 | </pre> |
||
41 | |||
42 | Then copy the default layout files to |
||
43 | |||
44 | <pre> |
||
45 | app/views/layouts/my_site.html.erb |
||
46 | app/views/layouts/my_site_exam.html.erb |
||
47 | 3 | Ward Vandewege | app/views/layouts/my_site_gmaps.html.erb |
48 | 1 | Ward Vandewege | app/views/layouts/my_site_mobile.html.erb |
49 | </pre> |
||
50 | |||
51 | and edit them as you see fit. |