kitchen-site icon indicating copy to clipboard operation
kitchen-site copied to clipboard

Customizing Navbar Menu

Open rgstephens opened this issue 9 years ago • 3 comments

I need to customize a Navbar menu item to pass a custom id as part of a menu item and I'm not sure that I can do this with Kitchen.

Let's say I'm an Author, logged in as User and have an associated list of Books. My User profile includes my Author id and I want one of my Navbar menu items to list all of my Books. The route needs to get my author id from my user profile and pass the author id to a page that uses the books_by_author query.

A menu item with this html is one approach

    {{#with user}}
    <li id="menu-item-simple" class="{{menuItemClass 'book'}}">
        <a href="{{pathFor 'book' authorId=user.profile.authorId}}">
            <span class="item-title">
                Books {{user.profile.authorId}}
            </span>
        </a>
    </li>
    {{/with}}

I don't see a way to wrap the menu item using the #with user. I tried creating an html file and copy_files to add this to the menu but I get the error There are multiple templates named 'PrivateLayoutLeftMenu. Maybe I should be taking a different approach?

rgstephens avatar Jun 02 '16 16:06 rgstephens

Creating a custom component and remove the actual navbar ?

Fr33maan avatar Jun 03 '16 09:06 Fr33maan

@rgstephens

  • subscribe to your query which returns user document with authorId
  • in "book" menu item's route_params add param { "name": "authorId", "value": this.user.profile.authorId }

perak avatar Jun 03 '16 09:06 perak

this.user.profile.authorId is null when referenced in the route_params.

rgstephens avatar Jun 03 '16 14:06 rgstephens