kgiszewski / LearnUmbraco7

A book for developers
208 stars 59 forks source link

Clarify Surface Controller Routing Mechanisms #39

Closed Nicholas-Westby closed 8 years ago

Nicholas-Westby commented 8 years ago

You have a page on surface controllers here: https://github.com/kgiszewski/LearnUmbraco7/blob/master/Chapter%2006%20-%20Surface,%20WebAPI%20and%20RenderMVC%20Controllers/02%20-%20Surface%20Controllers.md

Something that can confuse people who know MVC is that surface controllers can use a hidden input field with a name of "ufprt" to perform some routing (rather than use the URL). You can see that in action here: https://github.com/umbraco/Umbraco-CMS/blob/release-7.3.4/src/Umbraco.Web/Mvc/RenderRouteHandler.cs#L138

Basically, that value contains the controller/action (and some other route info) and Umbraco routes using that data rather than the URL (though, it seems a particular URL also does work).

Since this may trip up many people, including those already familiar with MVC (it tripped me up for a while), it seems like it would definitely be worth clarifying in your GitHub repo.

I think the "ufprt" value may also contain the current page ID, but I need to research that a bit more to confirm.

If I can find some time, I'll submit a pull request eventually for this. However, if you want to write this documentation in the meantime, feel free :-)

kgiszewski commented 8 years ago

@Nicholas-Westby,

Thanks for this. If you want to tackle this, please do as I'd have very little context to give the write up :)

Nicholas-Westby commented 8 years ago

@kgiszewski Do you mind assigning this to me?

Note to self: "ufprt" seems to stand for "Umbraco Form Post RouTe".

kgiszewski commented 8 years ago

Seems I can't since this is a personal account without giving you full admin access.

Nicholas-Westby commented 8 years ago

Gotcha. Thanks for trying.

Nicholas-Westby commented 8 years ago

Just a friendly reminder that this is done and merged into the develop branch, but hasn't been merged into the master branch yet. It's been a few months, so thought I'd poke you :-)

commits

kgiszewski commented 8 years ago

Oh wow I didn't notice. Totally my fault. I assumed they came in on Master :grimacing:

All merged now :+1:

Nicholas-Westby commented 8 years ago

Sweetness! :+1: