Hi,
I have also problems to highlight my current menu item and I don't
know how to solve.
I tried also with sub-menu (red/green/blue) but without highlightning.
Is there more documentation for this available?
My navigation:
<def tag="main-nav">
<navigation class="main-nav">
<nav-item href="#{base_url}/">Home</nav-item>
....
<navigation with="¤t_user.contacts">
<repeat>
<% if this.state=="ready" -%>
<nav-item/>
<% end -%>
</repeat>
</navigation>
....
</navigation>
Thx,
Karsten
On 27 Apr., 23:50, Matt Jones <[email protected]> wrote:
> This is a case where the source is much more useful than the docs.
> Here's the relevant part of the <page> tag from rapid_pages.dryml:
>
> <header class="page-header" param>
> <account-nav if="&login_url(Hobo::User.default_user_model)"
> param/>
> <h1 param="app-name"><a href="#{base_url}/"><app-name/></
> a></h1>
> <live-search param if="&defined_route? :site_search"/>
> <main-nav current="&title" param/>
> </header>
>
> The last bit is the important part - the default value of the
> 'current' attribute is set to the 'title' attribute passed to the
> <page> tag.
>
> The <navigation> tag (in rapid_navigation.dryml) sets a scoped
> variable to this value and generates the <nav-item> tags.
>
> Each <nav-item> tag (in rapid_navigation.dryml) matches the
> 'current_navigation' variable against either the de-HTMLized string it
> contains or the value explicitly passed via the name attribute. You'll
> probably want to set that in your code to get repeatable behavior.
> Example:
>
> <nav-item href="/some_url" name="Some Title">Some Other Title</nav-item>
>
> Some notes:
>
> - if you redeclare a tag like main-nav, I *think* (Tom? Bryan?) you
> have to include the attrs you want it to have; in this case, you'll
> need to include 'attrs="current"' in your definition.
>
> - for subnav, as in your second example, you'll need to set the
> current value someplace.
>
> --Matt Jones
>
> On Apr 27, 2010, at 5:32 PM, kevinpfromnm wrote:
>
>
>
> > on the navigation taglib page, it shows an attribute current which it
> > uses to apply styling to the nav-item that is currently applicable.
> >http://cookbook.hobocentral.net/api_tag_defs/navigation
>
> > I believe, the default main-nav does this based off the controller but
> > you have to replicate it if you override main-nav. I haven't bothered
> > with this personally though so I can't say for sure this is your
> > issue.
>
> > On Apr 27, 8:11 am, Jonathan Hogue <[email protected]> wrote:
> >> Any takers? I don't think the answer is out there already. I've spent
> >> hours searching. I don't think it's that difficult either.
>
> >> On Sun, Apr 25, 2010 at 12:31 PM, jonhogue <[email protected]>
> >> wrote:
> >>> Newb alert.
>
> >>> I have a class called Work Orders.
>
> >>> In my controller, I have functions like this to give a me a subset
> >>> of
> >>> work orders.
>
> >>> def needs_bid
> >>> �...@work_orders = WorkOrder.needs_bid()
> >>> hobo_index @work_orders
> >>> render :index
> >>> end
>
> >>> In my application.dryml, I have this.
>
> >>> <def tag="main-nav">
> >>> <navigation class="main-nav" merge-attrs param="default">
> >>> <nav-item href="#{base_url}/">Home</nav-item>
> >>> <if test="¤t_user.administrator?">
> >>> <nav-item with="&WorkOrder"><ht
> >>> key="work_orders.nav_item">Work Orders</ht></nav-item>
> >>> <nav-item href="#{base_url}/">Billing</nav-item>
> >>> </if>
> >>> </navigation>
> >>> </def>
>
> >>> In my Work Orders link, when I change the label to something like
> >>> "Open Work", it no longer marks that menu item as the current menu
> >>> item.
>
> >>> Question #1, How do I change the label for that link and still have
> >>> the current functionality work.
>
> >>> I wanted to add a sub-menu for my specific categorizations of Work
> >>> Orders, so I added this to my view/work_orders/index.dryml
>
> >>> <top-page-nav: replace>
> >>> <navigation class="top-page-nav">
> >>> <nav-item action="new" to="&model">*New*</nav-item>
> >>> <nav-item action="index" to="&model">All Unfinished</nav-
> >>> item>
> >>> <nav-item href="/work_orders/index/needs_bid">Needs Bid</
> >>> nav-
> >>> item>
> >>> <nav-item href="/work_orders/index/needs_work">Needs Work</
> >>> nav-item>
> >>> <nav-item href="/work_orders/index/needs_paper_work">Needs
> >>> Paper Work</nav-item>
> >>> </navigation>
> >>> </top-page-nav:>
>
> >>> This works great, but again, current doesn't work.
>
> >>> Question #2
> >>> What is a clean way to make current work for sub menus?
>
> >>> --
> >>> You received this message because you are subscribed to the Google
> >>> Groups "Hobo Users" group.
> >>> To post to this group, send email to [email protected].
> >>> To unsubscribe from this group, send email to
> >>> [email protected]
> >>> .
> >>> For more options, visit this group
> >>> athttp://groups.google.com/group/hobousers?hl=en
> >>> .
>
> >> --
> >> You received this message because you are subscribed to the Google
> >> Groups "Hobo Users" group.
> >> To post to this group, send email to [email protected].
> >> To unsubscribe from this group, send email to
> >> [email protected]
> >> .
> >> For more options, visit this group
> >> athttp://groups.google.com/group/hobousers?hl=en
> >> .
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Hobo Users" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]
> > .
> > For more options, visit this group
> > athttp://groups.google.com/group/hobousers?hl=en
> > .
>
> --
> You received this message because you are subscribed to the Google Groups
> "Hobo Users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group
> athttp://groups.google.com/group/hobousers?hl=en.
--
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/hobousers?hl=en.