Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

menu system - creating a menu-item with a route that requires ID (e.g. movies/44/edit) #46

Closed
VickG opened this issue Jul 14, 2016 · 5 comments
Labels

Comments

@VickG
Copy link

VickG commented Jul 14, 2016

In my case, I want to have a menu node that is using a route that takes an ID.

e.g.
movies/44/edit

Is there currently a way to manage this? Depending on the logged in user, the ID will be different. Or else I would have used the "URL" field of the menu item.

@sroutier
Copy link
Collaborator

Hello VickG,

I am not entirely sure what you mean by "menu node that is using a route
that takes an ID" and "Depending on the user the ID will be different".

What would this menu look like? Can you give me a use case to help picture
it?

Would you have a parent menu node called "Users Favorite Movies" and under
list a few menu entries to a movie?
Some things like this:

Menu Route
Users Favorite Movies users/{userID}/fav_movies
\ Star Trek users/{userID}/fav_movies/{movieID}
+ Star Wars users/{userID}/fav_movies/{movieID}

Is a menu like that what you have in mind?
Do you have an idea about how would you build such a variable menu in the
first place?

/s

On Wed, Jul 13, 2016 at 8:09 PM, VickG notifications@github.com wrote:

In my case, I want to have a menu node that is using a route that takes an
ID.

e.g.
movies/44/edit

Is there currently a way to manage this? Depending on the logged in user,
the ID will be different. Or else I would have used the "URL" field of the
menu item.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#46,
or mute the thread
https://github.com/notifications/unsubscribe/AC30Ft8tavbLBxlZ-77SMx-pOBONUSq8ks5qVX5VgaJpZM4JL-Ah
.

@VickG
Copy link
Author

VickG commented Jul 14, 2016

Yes that is exactly what I have in mind as you mentioned.

How do I create a menu-element using your menu system that uses a route like:
users/{userID}/fav_movies

I picked the correct route from the Routes dropdown and I put this in the "URL" field
users/{id}/fav_movies
but no luck..

Any advice?

On Jul 13, 2016, at 7:47 PM, Sebastien Routier notifications@github.com wrote:

Hello VickG,

I am not entirely sure what you mean by "menu node that is using a route
that takes an ID" and "Depending on the user the ID will be different".

What would this menu look like? Can you give me a use case to help picture
it?

Would you have a parent menu node called "Users Favorite Movies" and under
list a few menu entries to a movie?
Some things like this:

Menu Route
Users Favorite Movies users/{userID}/fav_movies
\ Star Trek users/{userID}/fav_movies/{movieID}
+ Star Wars users/{userID}/fav_movies/{movieID}

Is a menu like that what you have in mind?
Do you have an idea about how would you build such a variable menu in the
first place?

/s

On Wed, Jul 13, 2016 at 8:09 PM, VickG notifications@github.com wrote:

In my case, I want to have a menu node that is using a route that takes an
ID.

e.g.
movies/44/edit

Is there currently a way to manage this? Depending on the logged in user,
the ID will be different. Or else I would have used the "URL" field of the
menu item.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#46,
or mute the thread
https://github.com/notifications/unsubscribe/AC30Ft8tavbLBxlZ-77SMx-pOBONUSq8ks5qVX5VgaJpZM4JL-Ah
.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.

@VickG
Copy link
Author

VickG commented Jul 18, 2016

I will take it that this is not currently supported?

@sroutier
Copy link
Collaborator

Sorry, busy week-end and I did not get a chance to reply to your question.
The issue is that when the URL is resolved to create the HTML menu entry, all variables ({userID} in your case) must be known to the rendering function in the MenuHandler.

I think that you have 2 options:

  1. Build a menu to your own controller with the URL/Route "users/fav_movies" that will resolve all required variables and either:
    A. Directly render the favorite movies view for the desired user or
    B. Redirect to the route that you want (i.e. "users/{userID}/fav_movies").
  2. Create your own MenuHandler that knows what variables will be needed, resolves them and replace them in the route URL before rendering the menu entry. Look at the "generateUrl()" function of the MenuHandler that you are currently using for example the "L51ESKSecuredMenuHandler" first tries to get the URL from the route if configured if that fails it gets it from the URL, right before the function returns if where I would replace any variable in the URL with resolved values.

Hope that helps a little. Let me know what you think.
/s

@VickG
Copy link
Author

VickG commented Jul 19, 2016

ok, thank you.. I will close this.

@VickG VickG closed this as completed Jul 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants