Re: [simple-navigation] Wrap Sub Nav in span tag

53 views
Skip to first unread message

Andi Schacke

unread,
Jan 30, 2013, 3:35:11 AM1/30/13
to simple-n...@googlegroups.com
I guess you have three options:

1) Write a custom renderer which generates exactly the html output
that you need (see SimpleNavigation::Renderer::List for a starting
point)
2) Change simple-navigation to accept a name generator for each item,
then send a pull request…
3) Change simple-navigation to take an option :apply_generator =>
false where you don't need it in the config file…

For 2) and 3): please fork, change and send a pull request :-)

Andi


On Tue, Jan 29, 2013 at 5:39 AM, April Barrett <apri...@gmail.com> wrote:
> How would I wrap the sub-navigation items in a <span> tag (groups)? Using
> this method wraps everything in <span> tags. I just need to wrap the sub nav
> items.
>
> Like such:
>
> <ul class="wrapper clearfix">
> <li>My Home</li>
> <li>Photos</li>
> <li>Projects</li>
>
> <!-- Need Nested Spans Here-->
> <li>Groups
> <span>My Groups</span>
> <span>Browse</span>
> </li>
> <li>Galleries</li>
> <li>Profile</li>
> <li>Inbox</li>
> </ul>
>
>
> This doesn't work:
>
> navigation.name_generator = Proc.new {|name| "<span>#{name}</span>"}
>
> navigation.items do |primary|
> primary.dom_class = 'wrapper clearfix'
> primary.item :myhome, 'My Home', '/my-home'
>
> if not current_user.level == 'free'
> primary.item:photos, 'Photos', photos_path(:mine => true)
> end
>
> if not current_user.level == 'free' || current_user.level == 'plus'
> primary.item :projects, 'Projects', projects_path
> end
>
> if not current_user.level == 'free'
> primary.item :groups, 'Groups', groups_path do |group|
> group.item :my_groups, 'My Groups', groups_path(:mine => true)
> group.item :browse, 'Browse', groups_path
> end
> end
>
> primary.item :galleries, 'Galleries', galleries_path(:mine => true)
> primary.item :profile, 'Profile', user_path_for(current_user)
> primary.item :inbox, 'Inbox', inbox_messages_path
> end
>
> --
> You received this message because you are subscribed to the Google Groups
> "simple-navigation" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to simple-navigat...@googlegroups.com.
> To post to this group, send email to simple-n...@googlegroups.com.
> Visit this group at http://groups.google.com/group/simple-navigation?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
Reply all
Reply to author
Forward
0 new messages