techiferous / tabulous

Easy tabbed navigation for Rails
Other
322 stars 35 forks source link

Add a hash of options to the tabs #38

Closed apux closed 11 years ago

apux commented 11 years ago

I'm using my custom renderer and I need to show an icon in my tabs. Is that possible? I was looking for a hash of options where I can specify the icon, an additional css class, etc.

techiferous commented 11 years ago

Yes, this is straightforward if the icon is always the same. Just put the appropriate HTML in the string that the renderer is producing.

If you mean that the icon should change depending on the circumstances, this is less straightforward. I did not anticipate this use case. However, if you look at the Tabulous::BaseRenderer class, you'll see that all renderers have a @view. This represents the context in which the view is rendered, and so you can call helpers and whatnot on this variable. That might work for what you're wanting to do.

apux commented 11 years ago

Yes, the second scenario is what I have. I can do what you suggest, even I can use an option hash directly from the renderer, but I was looking for a more integrated way. I'll fork the project and try to add it in case you want to add it later. Thanks.