public
Description: Theming for your Ruby on Rails Application
Homepage:
Clone URL: git://github.com/jbasdf/disguise.git
name age message
file .document Sat May 30 09:27:03 -0700 2009 Initial commit to disguise. [jbasdf]
file .gitignore Sat May 30 09:27:03 -0700 2009 Initial commit to disguise. [jbasdf]
file LICENSE Tue Oct 27 15:19:31 -0700 2009 updated readme [jbasdf]
file README.rdoc Tue Oct 27 15:19:31 -0700 2009 updated readme [jbasdf]
file Rakefile Tue Oct 27 15:14:19 -0700 2009 updates to rakefile [jbasdf]
file VERSION Tue Oct 27 17:45:32 -0700 2009 Version bump to 0.3.11 [jbasdf]
directory app/ Wed Jul 22 09:03:31 -0700 2009 added ids to partials [jbasdf]
directory config/ Sat Jun 06 22:48:31 -0700 2009 added ability to determine theme based on reque... [jbasdf]
directory db/ Sat Jun 06 22:48:31 -0700 2009 added ability to determine theme based on reque... [jbasdf]
file disguise.gemspec Tue Oct 27 17:49:55 -0700 2009 Released new gem [jbasdf]
directory generators/ Tue Jul 14 16:53:40 -0700 2009 fixed theme generator problem [jbasdf]
directory lib/ Tue Jul 14 17:06:23 -0700 2009 initialization variable cleanup [jbasdf]
directory locales/ Tue Oct 27 17:49:55 -0700 2009 Released new gem [jbasdf]
directory rails/ Tue Jun 02 14:51:13 -0700 2009 added tests [jbasdf]
directory tasks/ Sat May 30 20:56:37 -0700 2009 initial commit [jbasdf]
directory test/ Wed Jul 22 09:03:31 -0700 2009 added ids to partials [jbasdf]
README.rdoc

disguise

A simple theme system for your Rails application.

Installation

sudo gem install disguise

Setup

Disguise comes with a couple of admin controllers to make changing your theme simple. By default they are not protected. In order to prevent unauthorized users from changing your theme you can override the admin controller like this:

  class Admin::ThemesController < Admin::Disguise::ThemesController
    before_filter :login_required
    layout('admin')
  end

  class Admin::DomainThemesController < Admin::Disguise::DomainThemesController
    before_filter :login_required
    layout('admin')
  end

Also be sure to add a route to the new controller in routes.rb:

  # admin
  map.namespace :admin do |a|
    a.resource :theme
    a.resources :domain_themes
  end

Rake tasks

Add disguise rake tasks to your rails project. Include the following line at the end of your Rakefile:

  require 'disguise/tasks'

Then run the following to add the required files and database migration:

  rake disguise:setup
  rake db:migrate

Usage

Generate a new theme for your Rails application using the built in theme generator:

  ./script/generate theme theme_name

Disguise can run in two modes. The first is the default which let’s an administrator set the current theme via the built in admin interface. The second looks at the url of the incoming request and matches it to a theme. To enable this second mode create an initializer in /config/initializers/disguise.rb and enter the following contents:

  Disguise::USE_DOMAIN_FOR_THEMES = true

Copyright

Copyright © 2009 Tatemae.com. See LICENSE for details.