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.
You can, of course, still get the theme_generator from RubyForge. But I think the plugin will be the approach I will recommend moving forward.
Try it out and let me know what you think!
svn link requires a password....
ReplyDeleteAh, the repos isn't setup to be accessible anonymously yet...
ReplyDeleteYou can download a zip of the plugin at the development site homepage.
Great work! Already using it 'live' on here and here. One set of code and two themes - great, thanks!
ReplyDeleteI much prefer it *not* being a plugin. Less intrusive, more trustworthy that way....
ReplyDeleteThe above problems have gone in Rails 0.14.4.
ReplyDeleteregading the 'NoMethodError undefined method `current_theme'' error.
ReplyDeleteI'm also getting this with the pure plugin version if I try and send mail from the app. The gem version seems to work fine though.
I'm guessing that the pure plugin tries to patch actionview in a way that mailer does not like?!
I'm working on a project that needs both theme support and translations. I know that the rails community is working on several approaches to translations, but I have another thought...
ReplyDeleteWhen it comes to caching, themes and translations need some interweaving so that various translations can be cached. It's almost like a translation is a sub-theme, or variation on a theme.
I'd like to help work on a method to provide translations built into the the theme framework... Contact me at: mortonda @ dgrmm.net if you are interested in this approach...
Hi,
ReplyDeleteI have the same error with ActionMailer::Base.
NoMethodError: undefined method `current_theme' for #
----
MailContactRequest is a model :
class MailContactRequest
Hi,
ReplyDeleteI have the same error with ActionMailer::Base.
NoMethodError: undefined method `current_theme' for #
MailContactRequest is a model :
class MailContactRequest
Hi (sorry for other comment, probleme with special char),
ReplyDeleteI have the same error with ActionMailer::Base.
NoMethodError: undefined method `current_theme' for #
MailContactRequest is a model extend ActionMailer::Base.
MailContactRequest.create_new() send a mail, and use template to format this.
The error raise in actionview_ex.rb at line 16 (controller.current_theme), controller is a MailContactRequest object, and not a ActionController.
This error is resolved if extend ActionMailer::Base to support themes.
There seems to be a problem with using liquid templates if you have the newest version of liquid installed. There is no longer a register_block method. Any ideas on how to fix this?
ReplyDeleteassert_existance_of_template_file in actionController needs to be updated to look for theme files. Otherwise if the original file is missing, it doesn't work. This limits themes to only using existing files...
ReplyDeleteWe noticed that your blog have some Ruby On Rails related content and that
ReplyDeleteis why we would like to invite you to register yourself and your
blog at RubyCorner, a directory of Ruby related blogs:
http://www.rubycorner.com/
We like to think about RubyCorner as a "meeting place" for the
community, also as a "focal point" where the people new to this
technology can quickly tune into the pulse of the community.
Registering your blog will help build a valuable resource for
this growing community.
Thanks.
Hi, i have the same error with ActionMailer::Base.
ReplyDeleteHow can i "extend ActionMailer::Base to support themes"? (I'm a newbie to RoR)
I had a problem with sub-dirs like /images/buttons/btn_enter.gif
ReplyDeleteSo I changed :filename to *filename on lines 26, 27, 28 of routeset_ex.rb and put params[:filename] = File.join(params[:filename]) one line after "def stylesheets", "def javascript" and "def images".
I'm using Rails 1.1.2
Add empty current_theme and force_liquid_template in UserNotify class, that should fix it
ReplyDeleteThanks for this. *It just works*. Being a newbie, I was hacking apart typo. Cheers.
ReplyDeleteJust a comment on some things I needed:
ReplyDelete- restart the server to register the plugin
- ensure that the views/layouts/[default].rhtml exists so that it can be overriden
Tired of finding the file through enormous amount of searchers? 1 center- 1 enter. http://megaupload.name/
ReplyDelete