Theming » History » Revision 2
Revision 1 (Ward Vandewege, 01/28/2014 08:54 PM) → Revision 2/4 (Ward Vandewege, 01/28/2014 08:55 PM)
h1. Theming
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.
These layouts are defined in the
config/config.defaults.yml
file as
<pre>
# Layouts
application_layout: 'tapestry_default'
application_layout_exam: 'tapestry_default_exam'
application_layout_gmaps: 'tapestry_default_gmaps'
application_layout_mobile: 'tapestry_default_mobile'
</pre>
The values of these fields mean that these layout files are used in the default Tapestry installation:
<pre>
app/views/layouts/tapestry_default.html.erb
app/views/layouts/tapestry_default_exam.html.erb
app/views/layouts/tapestry_default_gmails.html.erb
app/views/layouts/tapestry_default_mobile.html.erb
</pre>
To start creating a custom theme, add the layout fields to your
config/config.yml
file and give them new values, for instance:
<pre>
# Layouts
application_layout: 'my_site'
application_layout_exam: 'my_site_exam'
application_layout_gmaps: 'my_site_gmaps'
application_layout_mobile: 'my_site_mobile'
</pre>
Then copy the default layout files to
<pre>
app/views/layouts/my_site.html.erb
app/views/layouts/my_site_exam.html.erb
app/views/layouts/my_site_gmails.html.erb
app/views/layouts/my_site_mobile.html.erb
</pre>
and edit them as you see fit.