I've just checked in version 1.4 of the theme_support plugin. It contains quite a few bugfixes and updates. This version also integrates a couple of patches from akg and D.J. Vogel. Thanks guys!
Version 1.4 adds:
- Bugfixes, of course
- Better Rails 1.1 support
- ActionMailer theme support (experimental)
- Updates to the themeitem liquid tag
- Support for theme sub-directories
- Fleshed out the Theme object to make is easy to list all of the installed Themes
As a little background, the plugin is based on the theme system developed by the Typo guys and adds support for:
- Multiple concurrent themes
- A rails generator for creating a theme folder structure
- Rake tasks for pre-caching all of the themes for increased security and performance
- Overriding views with theme-specific rhtml or liquid templates (based on early Typo code)
- Forcing theme views to only allow liquid templates
- Made supporting themes as easy as using layouts
To install the plugin, go to your rails application root folder and run:
./script/plugin install http://mattmccray.com/svn/rails/plugins/theme_support
or, for you Windows folks:
ruby script\\plugin install http://mattmccray.com/svn/rails/plugins/theme_support
Look at the README in $/vendor/plugins/theme_support for more on implementing themes in your application.
Nice one Matt, been looking forward to this - Kudos on making it work a bit better with 1.1 - I'll be sure to write a Turorial for this, maybe for the Wiki - might help a few newbies here and there.
ReplyDeleteKeep up the good work!
I've got a small addition that I'd like to add. Can you email me so I can send you a patch? The plugin's great, by the way!
ReplyDeleteThanks for making this plugin available.
ReplyDeleteIt seems that it does not work when using ActionMailer templates for content typing.
For example, if the mailer viewa are named order.text.html.rhtml and order.text.plain.rhtml to automatically generate multi-pert/alternative emails the plugin either generates this error...
No rhtml, rxml, or delegate template found for order_mailer/sent.text.html.rhtml
If it does not generate the error, it appears to put itself into an endless loop.
Can you confirm that this is the case? Any ideas on a fix?
Thanks, Nigel
Hmm
ReplyDeleteI haven't seen this... But I didn't test for that specifically, either. I'll have a look and get back to you.
Very nice!
ReplyDeleteBut, there's one thing. If I generated my controller with script/generate admin/pages, theme_stylesheet_link_tag will try to include /stylesheets/stylesheetname.css, instead of /themes/admin/stylesheets/stylesheetname.css .
Do you have any idea on how to solve this?
Oops. Sorry, that was my own fault.
ReplyDeleteI had put: layout 'admin/admin' in my admin/pages-controller. :)
Now, there's only one thing to say: This plugin rocks!
I prefer plugins over generators so this is very handy for me. Thanks!
ReplyDeleteI noticed one error in the README. It talks about the 'javascripts' directory but your plugin uses 'javascript' (plural vs. singular).
This plugin is super useful and easy to use.
ReplyDeleteHello,
ReplyDeleteseems to be an error in line 35 of file:
http://mattmccray.com/svn/rails/plugins/theme_support/lib/theme_controller.rb
STERR.puts must be STDERR.puts
;-)
(I had some performance issue with caching in production...)
Regards.
I'm trying to use your plugin w/ edge rails... looks like it breaks due to some of the routing changes. I'm just manually including the routes in my routes.rb file for now. Have you looked into how include those theme routes automatically w/ edge rails?
ReplyDeleteThis plugin is awesome. Very useful resource. Thank you for the contribution!
ReplyDeleteIt did however break my REST webservices that make calls like:
render :action => "list.rxml", :layout => false
I haven't plunged into the code a great deal, but i know basically actionview_ex.rb doesn't catch the original template using pick_template_extension(theme_path) and it throws the error after the loop:
ActionView::ActionViewError (No rhtml, rxml, or delegate template found for trades/list.rxml).
I got rid of the raising of this error and let the processing fall into just calling the original render file:
return __render_file(template_path, use_full_path, local_assigns)
This gave the original the chance to render the XML template and lo and behold it was able to.
Can anyone else confirm this problem?
Chris: I had some problems with the routing as well. I've rewritten routeset_ex.rb to make it work. Does it solve your problems as well?
ReplyDeletehttp://jira.openqa.org/browse/SOR-1#action_13502
Jonas,
ReplyDeleteHere's what I'm using right now for Edge Rails:
http://pastie.caboo.se/9651
This works fine, but I also recognized that this solution can only be used once, and therefore not as scalable as I'd like.
I've been looking to investigate less-destructive methods. I'll have to try your way when I get a chance.
I am not sure if this is normal, but my themes directory is placed right in RAILS_ROOT, and not RAILS_ROOT/public
ReplyDeleteNot sure if this is related, but the loading of images from /themes/[theme]/images is very very very slow when using webrick -- much slower than without using this theme plugin
ReplyDeleteWhat can I do for this? Do I need to run some kind of rakes to precache the images?
[jomyoot:14] Yes, RAILS_ROOT/themes is correct. In production mode, Rails will cache the theme files for you in the public/ folder.
ReplyDelete[Nate:11] Nate: Yes, I can confirm this behaviour. The theme plugin does not find .rjs templates, either if you use respond_to for a RESTful interface. Your quickfix helped me a lot, thank you.
ReplyDelete@Matt: It would be awesome if you could fix that. Go on, this plugin is great!
Yeah, I need to show this plugin some love -- it's been a while since I've updated it. I've received quite a few patches I need to apply (thanks for sending those in!)\n\nLook for a new release in the next week or so.
ReplyDeleteHi!
ReplyDeleteAwsome plugin! It works like a charm!
There's just one thing not working - integration tests! Whenever I run an integration test, I end up with this error:
ActionView::ActionViewError (No rhtml, rxml, or delegate template found for layouts/site)
What am I missing? Should I require something from within my integration test?
And just forget all about that bug report - I was the bug :-)
ReplyDeleteJust didn't read my own code for setting the current theme very well ...
Vincent the solution is given in the comments above:
ReplyDeleteSee Jonas Bengtsson's link or Chris Abad's for answer.
Note: Jonas has the solution in the comments.
Cheers,
if you are running themes using imaspy's patch and working on a working copy of a project, you might want to check my blurb on using the patch with subversion..
ReplyDeleteit is here:
http://www.village-buzz.com/2007/04/30/theme-support-rails-12x-and-subversion/
[Adam Salter:23] [sergio:24]
ReplyDeleteImaspy site is down. :(
I have rails 1.2.3 and I can't running this plugin
[loppr:25]
ReplyDeleteI've written an article on how to install this plugin in rails 1.2.6
You'll find it "on my blog(How to Install Theme support plugin on Rails 1.2)":http://www.webdrivenblog.com/2007/11/27/installing-the-theme-support-plugin-with-rails-1-2
You'll find an article on how to use this plugin with rails 2.0 "on my blog(Installing the Theme support plugin with Rails 2.0)":http://www.webdrivenblog.com/2008/1/9/installing-the-theme-support-plugin-for-rails-2-0
ReplyDelete