This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Sat Dec 06 07:20:08 -0800 2008 | |
| |
MIT-LICENSE | Mon Dec 01 06:20:01 -0800 2008 | |
| |
README | Sat Apr 04 10:10:28 -0700 2009 | |
| |
init.rb | Mon Dec 01 06:20:01 -0800 2008 | |
| |
install.rb | Mon Dec 01 06:20:01 -0800 2008 | |
| |
lib/ | Sun Apr 05 03:28:26 -0700 2009 | |
| |
spec/ | Sat Apr 04 11:10:02 -0700 2009 | |
| |
tasks/ | Mon Dec 01 06:20:01 -0800 2008 | |
| |
uninstall.rb | Mon Dec 01 06:20:01 -0800 2008 |
README
CheapThemes
===========
This plugin provides easy view themes support and customizable controller actions for Rails applications.
Installation
------------
First, grab a copy of plugin from repository:
./script/plugin install git://github.com/hubertlepicki/cheap-themes.git
Usage
-----
### Theming views
To allow theming of views, include following line in your controller:
class ExampleController
has_themable_views :find_view_theme
....
end
and define "find_view_theme" method in the same controller or any of parent ones that returns a String which is a theme
name:
class ExampleController
has_themable_views :find_view_theme
....
private
def find_view_theme
"green"
end
end
Of course, instead of "find_view_theme" you can use your own name.
Now, if you want to customize index.html.erb view file, create file
"RAILS_ROOT/themes/green/views/example/index.html.erb". It's content will be used instead of standard
"RAILS_ROOT/app/views/example/index.html.erb".
This also works with layouts, so if you want to customize "default.html.erb" layout, just create file
"RAILS_ROOT/themes/green/views/layouts/default.html.erb".
### Customizing actions
If you want to customize ExampleController::index action, create file
"RAILS_ROOT"/themes/green/controllers/example/index.rb" with customized code, for example:
render :text => "This is customized action"
And add in your controller:
class ExampleController
has_customizable_actions :find_action_theme
....
private
def find_action_theme
"green"
end
end
General notes
-------------
Of course you can have multiple multiple themes.
In development mode, customized controller actions are reloaded on every request. In production mode, customized
controller actions are loaded only once (at first request) and then cached methods are used.
Bugs and requests
=================
Please use Github to fork and submit merge requests or email me and patches.
Please also feel free to send me a message over Github or email at hubert.lepicki at gmail.com with questions, comments
or criticism ;).
Copyright (c) 2008 Hubert Lepicki, released under the MIT license







