Using Editor parts on Frontend

Topics: Core
Aug 13, 2013 at 1:33 PM
This is mostly followup to an issue i filed:
http://orchard.codeplex.com/workitem/20014

i tried to create a profile editor on the frontent and why not use the builtin support for creating them?
_contentManager.BuildEditor(_orchardServices.WorkContext.CurrentUser.ContentItem) 
but you don't want the users to mess with their system roles, so in the site theme:
__placement.info:__ 
<Place Parts_Roles_UserRoles_Edit="-"/> 
then on POST
_contentManager.UpdateEditor(_orchardServices.WorkContext.CurrentUser, this); 
BUT the driver tries to update the roles results in removing the user from ALL roles he was in before..

My question is: Is there ANY way to utilize some of the Editor form generation, or can it be achieved only manually (custom viewmodel, ...)?

Could you do this with the editor parts? I tried it and couldn't make it work...

Can you enumerate the content item parts on POST and update only ones you need?
Aug 13, 2013 at 4:07 PM
You should write your own controllers for that, it´s easyer and you have better control.
Or creating a new driver... well i had a situation where i had to replace an existing driver from a core module in my own module, I can show you the discussion, but in your case i believe you´d be better with just creating your own controller, here goes:

https://orchard.codeplex.com/discussions/452356

Nuno.
Aug 14, 2013 at 9:25 AM
Thank you Nuno, it's a good reading. Frankly, (re)writing the editor for taxonomies feels like the biggest overhead.
Aug 14, 2013 at 1:30 PM
Edited Aug 14, 2013 at 1:34 PM
I don´t understand what you mean by "feels like the biggest overhead".
I just had to write about 20 lines of code in order to acomplish my clients requirements, and for that i didn´t have to touch in the source code, i just had to write my own module and do the extensions there.
Orchard has a lot of extensibility points, and you also have examples everywhere just by browsing the source code and also the code of the contributed modules.
In your case (like in mine was) you want to acomplish something that orchard doesn´t give you out of the box, so in order to do that, you have all the api´s, services allready available, you just need to write very little.

Hope it helps.

Nuno.
Aug 16, 2013 at 8:44 AM
By overhead I meant having to write the same code again for building taxonomy editors on frontend, just because i can't hide some of the content item editor parts.

Apparently it is the only solution, but i believe that in most scenarios you could use the backend editors on frontend as well and it would be quite useful to facilitate the existing Editor building in driver...