Lush Theme

January 14th, 2007

I’m trying out this Lush Theme from Marco Vlieg’s Typo Theme entry. I like all of the themes, but I really think he should have won. This theme is absolutely fantastic. Anyway, as he mentions, it only works in the trunk svn builds of the latest typo, and sure enough, it breaks on my plain-jane installation of typo 4.0. Amazingly, it only needs a few fixes. First, make sure that you are replacing the sidebar component rendering with the following.


      <%= render_sidebars %>

Also, non-edge Rails “url_for” helper needs valid (as in Routeable) parameters, so, the author’s tendency to do this…


url_for :controller=>"stylesheets",:action=>"theme",:id=>"lush.css"

doesn’t work! Just replace those tags with the intended strings, so the above example could just be replaced with ”/stylesheets/theme/lush.css”.

If you are feeling too lazy to replace all the strings manually (remember, lazy is good, its the inspiration for invention, or something like that), just do it with a sed script, or heck, do it in ruby! Try this, go to your lush theme directory, fire up IRB, and do this.

1
2
3
4
5
6
Dir.glob("**/**.rhtml").each do |entry|
    contents = File.read(entry)
    File.open(entry,"w+") do |f|
        f << contents.gsub(/url_for :controller => '([^']*)', :action => '([^']*)', :id => '([^']*)'/,"\"\\1/\\2/\\3\"")
    end
end

That’ll just recursively replace the url_for helper in all the views. There may be an outstanding..


 url_for :controller=>'',:only_path=>false

.. tag somewhere giving you headaches.That tag was a problem for my OS X Rails installation. It didn’t cause any issues on my production (FreeBSD) box, however, so you should be just fine at this point! Either way, just replace it with a sensible string, and you should be runnin’ the coolest blog theme around in no time!

 

Michael Cerna Chicago-based Rails Developer and Avid Musician. More ...

Search

Categories

  • Home (15)
  • Rails Plugins (5)
  • Pages (9)
  • Archives

    Tags

    BlogRoll