03 Dec, 2008

Published at 12:14PM

Tagged with helpers, navigation, plugin, programming, and rails

This post has 1 comment

Custom routes for navigation_helper

I have a couple of changes worthy of mention.

Update your stylesheet

This is nothing major at all, but could potentially cause people to flip out. The CSS class that gets thrown on the surrounding list has been changed from “nav_bar” to “navigation”. So you may (well, you will) need do a search and replace in your CSS file. Or by hand, if you’re that type of person.

Why change this? Well, there have been a couple of times when I’ve used the plugin with sidebar navigation, and a class of “nav_bar” makes no sense. And yes, I’m picky about that stuff.

Besides, who is it to say that you’re going to have a navigation bar? What is a navigation bar, anyway? Exactly.

Custom routes

I’ve been contacted several times about this feature. I, personally, have yet to need it, but I can see its value (I think?). Anyway, you can now specify a custom route that deviates from the RESTful consistencies. This is better explained with an example.

1
<%= navigation [{:home => some_other_path}, :about, :contact] %>

Just pass a Hash with the value as your custom route. It’ll know what to do from there.

The Big Rewrite (not really)

I could be mistaken, but I believe navigation_helper was my first real Rails plugin. And by real I mean one that was actually useful. I’m a better programmer now, compared to when I first wrote it, in my humble opinion. And while there have been a few refactorings since then, I’m getting anxious for a rewrite.

Piece by piece I keep adding things, which isn’t the problem, but I’m making those changes in the context of the current implementation. It’s not terrible or anything, but I think it could be better. So we’ll see.

I could “refactor” it all I suppose, but I won’t because I’m a true programmer. I like to start from scratch ;-)

Comments

Bharat Monday, 09 Mar, 2009 Posted at 07:37AM

Hello Ryan,
I am playing with your navigation_helper. One thing that would help immensely for UI challenged folks like me is to leverage existing designs. I found this wonderful open source project on github called “Web App Theme”, which literally saves me all kinds of work. Without a doubt, you know about it, but here is the URL just in case:

http://github.com/pilu/web-app-theme/tree/master

If you can somehow make it easier to leverage this integration, that would be ideal.

Thanks for doing such wonderful work.

Regards,

Bharat

Do you have something to say about this post?
Protected by Defensio Textile Formatting Tips

or

Ryan Heath | Site Management A Ruby on Rails production.

This site is a Formed Function. Formed Function LLC | @formedfunction | Get in Touch