Beginner's question: dynamic menu panel


#1

Hi there,

I’m trying to learn Ember by rebuilding a product guide app I’ve built in Backbone/Marionette. So far this is quite straight forward but for the menu. I’ve got a deeply nested product structure (and some 7k products):

  • Main categories
  • Sub categories
    • Sub sub categories
      • Products

But the categories only ever show up in the menu where you drill down from main to the sub sub category, select it, and it then lists all products found. This means I won’t have a route like “/categories/3/” or “/categories/3/subcategories/4/” and so on. But this all happens dynamically within the menu, which is a big panel you can just bring up on any given page.

In my Marionette app I started with a layout which had a menu region and a content region. Within the menu region you can navigate from one CollectionView (for the categories) to the next until you select a sub sub category which will then populate the content region with the respective product listing.

Is this something where I would use an Ember Component? Or how would I approach it?

I hope I described the problem detailed enough, thanks!

Cheers, Christian


#2

To answer my own question here :wink: I solved this problem by using a view for my menu (that sits in the application template). I pass the category data to it and use computed values for the sub and sub sub category lists, depending on what item the user has clicked in the parent category. When the user clicks on the final category it triggers a route transition (and closes the menu overlay).