= Theme Support for Rails Applications

This plugin provides support for themes to the rails application environment. 
It supports theme specific images, stylesheets, javascripts, and views. The 
views can be in ERb (rhtml) or liquid formats. Optionally, you can configure 
the theme system to ignore any templates except liquid ones.


== Usage

This plugin automatically makes any patches needed for theme support. You can
use the theme_generator to create the file structure needed, or create it 
yourself.

It expects the following theme folder structure.

  themes/
    [theme_name]
      layouts/         <- layout .rhtml or .liquid templates
      images/
      stylesheets/
      javascripts/
      views/           <- you can override application views
      about.markdown
      preview.png

When run in production mode, it will automatically cache the theme files so that
the web-server will deliver them in subsequent requests. You can pre-cache all of 
the theme files by using the included rake tasks:

  $ rake theme_create_cache

The theme file cache uses the following file structure:

  public/
    themes/
      [theme_name]/
        images/
        stylesheets/
        javascripts/

All of the included rake tasks:

* theme_create_cache
* theme_remove_cache
* theme_update_cache

You specify which theme to use in your controller by using the 'theme' helper.
It's used just like the 'layout' helper. In fact, you can use them both 
simultaneously. The following will render actions using the 'default' layout 
in the 'blue_bird' theme (theme/blue_bird/layouts/default.rhtml):

  class ApplicationController < ActionController::Base
    layout 'default'

    theme 'blue_bird'

    ...
  end

You can also defer the theme lookup to a controller method:

  class ApplicationController < ActionController::Base
    layout 'default'

	 theme :get_theme

    def get_theme

		# If you let the user choose their own theme, you might
		# add a User#theme field...

		current_user.theme
    end

    ...
  end


Note: By setting it in the ApplicationController you can set the theme for the 
whole application.

In your application views, there are theme specific helper tags 
available to you. For ERb templates they are:

 - theme_image_tag
 - theme_image_path
 - theme_javascript_include_tag
 - theme_javascript_path
 - theme_stylesheet_link_tag
 - theme_stylesheet_path

For liquid templates there is a single helper, themeitem,  that will determine 
the path base on the theme file extension. Here's how you'd use it:

  <link rel="StyleSheet" href="{% themeitem %} default.css {% endthemeitem %}" />
  ...
  <img src="{% themeitem %} logo.png {% endthemeitem %}" />

The output from those two calls are:

  <link rel="StyleSheet" href="/themes/[current_theme]/images/default.css" />
  ...
  <img src="/themes/[current_theme]/images/logo.png" />
 

== Changelog

1.3.0 - The theme_system component is no longer needed. All of the
        theme support is driven by a single plugin named, oddly enough, 
        'theme_support'. Also improved theme route support. Instead of
        overriding RouteSet#reload, RouteSet#draw is overridden, making
        the theme support entirely transparent -- hopefully ;-) 

1.2.2 - More Bug-fixes.

1.2.1 - Bug-fixes and documentation clean up.

1.2.0 - Updated actionview_ex with the new render_file additions from 
        Typo. Renamed the rake tasks so that they all start with 
				'theme' (theme_create_cache, theme_remove_cache, 
				theme_update_cache). You can update the system files by running:
				
				  $ ./script/generate theme _system_

        Full support for Liquid templates, as well as an option to only
        allow Liquid templates in a theme.

1.1.1 - Added rake tasks for pre-caching the themes, and removing the
        cached themes. 

1.1.0 - [Breaking] Abstraction of the Typo theme system. The themes are
        now the same as is used in Typo. The theme engine itself is a
        combination of plugins and a component. No more symlinks, thank
        goodness.

1.0.2 - The current_theme is now retrieved from the controller. Where
        symlinks are created on *nix systems, shortcuts are created 
        on Windows if Win32Utils is installed.

1.0.1 - Added 'themes' directory, theme definition file, and symlinks 
        to the appropriate directories on supported platforms.

1.0.0 - Initial release


---
Copyright (c) 2005 Matt McCray, based on code from Typo by Tobias Luetke 
released under the MIT license
