Tabs on rails, active tab clickable


admin

For the ruby on rails plugin / gem, tabs_on_rails, the active tab is usually i span, but i needed it to be a clickable link, and for that i needed a class to show the user that this tab is open.

without further ado, and since there don’t seem to be updates on tabs_on_rails, i installed the plugin (instead of the gem, which wasn’t working anyways) and wrenched tabs_builder.rb to look like this:

      def tab_for(tab, name, options)
        linkclass = current_tab?(tab) ? "currenttab" : nil
        @context.content_tag(:li, @context.link_to(name, options), :class => linkclass)
 
        #content = @context.link_to_unless(current_tab?(tab), name, options) do
        #  @context.content_tag(:span, name)
        #end
        #@context.content_tag(:li, content)
      end

works like a charm :-P

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.