Sha256: ae3ebd744ddeb1781daba0cc67232464dfd7a7fe0ee8bbacb9776041f0ce4297

Contents?: true

Size: 1.71 KB

Versions: 1

Compression:

Stored size: 1.71 KB

Contents

== Usage

You can specify the current theme the same way you would a layout:

  class ApplicationController < ActionController::Base
    
    layout 'default'
    theme 'blue'
    
  end

If your application supports per-user themes, and the user's selected theme is 
stored in the user object, you could implement that like this:

  class ApplicationController < ActionController::Base
  
    layout 'default'
    theme :get_user_theme

    # If a user is logged in, use their theme choice, otherwise
    # use the theme named 'default'
    def get_user_theme
       return @session[:user].theme unless @session[:user].nil?
       'default'
    end
  
  end

In the views, there are theme specific helper tags available to you.

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

Before hosting, I would recommend running the rake task to pre-cache all of 
the theme files:

  rake create_theme_cache
  
There is also a handy rake task for removing all the cached theme files:

  rake remove_theme_cache


== Changelog

1.0.0 - Initial release
1.0.1 - Added 'themes' directory, theme definition file, and symlinks 
        to the appropriate directories on supported platforms.
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.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.
1.1.1 - Added rake tasks for pre-caching the themes, and removing the
        cached themes. 

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
theme_generator-1.1.1 templates/README