Chronicling my experiences with ruby on rails, web application development/management.

Tuesday, December 9, 2008

Finally. Theme_Support fully Working in Rails 2.2.2

I feel like singing. That is how happy i am.


Theme_support plugin for rails is fully working in Rails 2.2.2


I'll work with jystewart from github to get the fix onto his version, as that is what i got to work. Here is the link to Theme_support on github. Alegria!

9 comments:

  1. In my project the layouts (eg. application.html.erb) does NOT get rendered for the correct theme. It renders the normal view from /app/views/layouts instead of the one in /themes/mytheme/layouts..

    Any ideas?

    ReplyDelete
  2. yes. the maintainer of the project i forked, jystewart, changed the functionality of the genreate script to mimic rails. so it now uses theme/view/layouts.
    Your themes/mytheme/layout is a hold over from the old version. just move your layout folder to the theme/views directory and it should work.

    you MAY have to delete the old view... but i doubt it, just in case, you may need to delete it. let me know if that works.

    ReplyDelete
  3. this.... does not seem to work at all for me.

    just renders the usual layout...doesn't throw an error...doesn't call anything else according to webrick. I tried moving the layouts folder into the views subfolder in themes/[theme_name]/views/layouts ... tried removing/renaming old layout references.. nada... calling with
    layout 'application'
    theme 'default'

    in the application controller. any help is appreciated!

    ReplyDelete
  4. is your theme named default? if not, change your code to reflect the name that you gave it. Also, you have to have an application.html.erb file in your theme's views/layouts.

    If you put the layout/theme code (as you wrote above) in application.html.erb, try removing the file from app/views/layouts/ and only run your app with themes/name/views/layouts/application.html.erb

    ReplyDelete
  5. Also i've updated theme_support to make the generator reflect the correct layouts directory.

    ReplyDelete
  6. Hey,

    I greatly appreciate the update. For some reason the images do not render on my design until I first place direct link in the layout.html.erb. I have to then take away the direct (img src) link and place the url in the css. Only then does the css place the images on the website.

    any one else have this problem?

    ReplyDelete
  7. Hi Hassan, thanks for the words.

    If i understand you correctly, you probably need to "rake theme_create_cache" (without quotes) your images, and then your css files will find them.

    Now if you are in layout.html.erb and want to include picture.jpg without it being in css, then you have to use this tag: < % = theme_image_path(theme_name, source)% >

    Now if you theme is called "default" and it's in the images/picture.jpg path, that is what you put. (you may need /images/picture.jpg i always get that confused lol).

    if it don't work come back and we'll see. I use CSS for images anyways, as they are themes, not stand alone pages. well for the most part.

    ReplyDelete