London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!

Preview drag and drop

Vote:
 

In alloy example when i'm on-page edditing mode i can drag and drop items in content area and there are options for blocks that are available in all-properties mode.
How can i enable this for content areas in new project without alloy downloaded.

Thx

#149423
May 31, 2016 17:53
Vote:
 

Hi,

Alloy does, as far as I recall, use the [AllowedTypes(..)] attribute to restrict the types allowed in Content Areas. It is really simple to add. Episerver's UI will automatically change according to your configuration.

[AllowedTypes(AllowedTypes = new [] { typeof(MyBlockType) })]
public virtual ContentArea ContentArea { get; set; }

More information is available here:

http://world.episerver.com/documentation/Items/Developers-Guide/Episerver-CMS/9/Content/Properties/Property-types/Restricting-content-types-in-properties/

Hope that was the answer you were looking for. :-)

Casper Aagaard Rasmussen

#149426
Edited, May 31, 2016 18:53
Vote:
 

Sorry my question was not well worded.

So in alloy project when im in "on-page editing" i can also drag and drop stuff into a content area, around content area and change block settings:

Image 1

also i have this options in "all properties" mode:
Image 2

But locally on my empty project i only get block options in "all properties", and in "on-page editing" i can only preview html without changing layout.

Hope i better explained what i whant to have.

Thx

#149437
Jun 01, 2016 7:16
Vote:
 

Hi, Nemanja,

Which version are you on? And how do you render the ContentArea on the view, can you share it?

BR,

Marija

#149471
Jun 01, 2016 13:47
Vote:
 

Hi,

ContentAreas should always be rendered via the @Html.PropertyFor(mo..) helper. That ensures that the necessary markup and scripting is applied when you are working in Edit mode.

<div>
    @Html.PropertyFor(model => model.ContentArea)
</div>

It sounds to me like that is what you've left out. Joel Abrahamsson has written a detailed blog post covering the magic behind PropertyFor.

http://joelabrahamsson.com/how-episervers-html-helper-propertyfor-works/

You are highlighting a option called 'Display as: Full' in your screenshot. You can get all the information needed from the Developer Guide covering that exact topic. 

http://world.episerver.com/documentation/Items/Developers-Guide/Episerver-CMS/8/Rendering/Display-options/Display-options/

Hope that helped.

Casper Aagaard Rasmussen

 

#149475
Jun 01, 2016 13:53
Vote:
 

Hi Marija And Casper,

Caspers aswer worked, i was using displayFor instead of PropertyFor. When i changed it started giving me same options on on-edit as on view all properties !

Thx

#149479
Jun 01, 2016 14:20
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.