For a change of pace, here's a picture riddle for you:
The first one to post with the right answer gets -- Well, nothing actually. Respect maybe? Uh, sure, why not.
Update: I changed the svn URL to point to it's new home!
Currently, to add support for themes into your rails application, you have to install the theme_generator. The generator will then create the folder structure for themes, and it also creates the plugin files for theme support in rails.
The more I've thought about it, the less I like this approach. I'd rather have a fully encapsulated plugin that would add support for themes into rails and define a simple generator that would merely create the boilerplate theme structure.
To that end, I present the Rail Theme Support plugin. To install the plugin execute the following in the root of your application (requires rails 0.14.3+):
./script/plugin install http://mattmccray.com/svn/rails/plugins/theme_support
In the next couple of days I'll have a trac installation up and running for it too.
Try it out and let me know what you think!
I've released theme_generator version 1.3.0. It's shaping up rather nicely, if I say so myself.
It also supports using liquid templates (if you have the liquid plugin installed). You can also lock down the themes to only allow the rendering of liquid templates.
And it's dead simple to use. Once you have the theme_generator installed, here are the steps to make your application support themes...
Step One: Generate a theme named 'default'
In your command terminal,
cd into your Rails (0.14.3+) application folder and execute:
./script/generate theme default
It spits out the folder structure for a theme named 'default' (it doesn't actually have to be called 'default', call it what you like).
Since it's the first time we've used it for this application, it'll also create the theme_support plugin files for us.
Step Two: Update your ApplicationController
Now we update the
application.rb) to tell Rails to use our new theme.
classApplicationController< ActionController::Base layout 'default'# You may need to modify this, the generator will # create a layout named 'default' by, uh, default theme 'default'# Tell Rails to use the theme named default end
Step Three: There is no step three
Credit where credit is due...
Want it? Just gem it:
sudo gem install theme_generator
Or, if you already have it:
sudo gem update theme_generator
If you are on Windows, you can leave out the
In the near future I'll be posting a tutorial explaining how to implement user and/or application level themes... In the meantime, if you have any suggestions or questions, feel free to send 'em my way.