Shape Tracing on a Container page.

Topics: Customizing Orchard
May 3, 2011 at 2:10 PM

Hi,

Has anyone else experienced issues with the shape tracing feature when the page rendered is a container?

I have a "product list" and "product" content types as follows and I add products to the list. When I then try to view shape tracing on the list page, it's just empty and doesn't present any info. 

// Tell the content def manager that we have two new types
ContentDefinitionManager.AlterTypeDefinition("ProductList",
	cfg => cfg
	.WithPart("BodyPart")
	.WithPart("CommonPart")
	.WithPart("RoutePart")
	.WithPart("MenuPart")
	.WithPart("ContainerPart")
	.Creatable());

ContentDefinitionManager.AlterTypeDefinition("Product",
	cfg => cfg
	.WithPart("BodyPart")
	.WithPart("CommonPart")
	.WithPart("RoutePart")
	.WithPart("ContainablePart")
	.WithPart("ReviewsPart")
	.WithPart("ImageGalleryPart")
	.Creatable());

Anyone any suggestions what I may have done wrong?

Cheers

Tony

Coordinator
May 3, 2011 at 6:52 PM

What do the driver, placement and template files look like?

May 4, 2011 at 8:36 AM

I've not created any driver, placement or template files, just the above migration to define this content type, which in turn is rendering the parts that make the type up as normal. However, I've just created a Content-Product-Summary.cshtml in my theme and manually rendered the summary view of the type and the tracing feature came to life.

 

Coordinator
May 4, 2011 at 5:27 PM

Cool. This being said, I'm not sure how far you'll be able to go without a driver.

May 5, 2011 at 10:25 AM

Apologies for being confused but, how do you create a driver for a content type? All the parts making up the type have drivers....

Thanks

May 5, 2011 at 11:00 AM

You can't - not sure what bertrand was getting at there! :)

I've noticed a problem with shape tracing where if a template contains no markup, i.e. only a Display or DisplayChildContent method, shape tracing "collapses" that node and the results get really confusing. If there are a few nested templates like that then you just can't traverse to any child shapes. Wrapping each template in at least a div makes it work properly. Not sure if this is part of some intended behaviour that's going awry.

May 5, 2011 at 11:38 AM

Ah yes, I've just noticed the same behaviour on the detail page for a product, which in turn is listing the reviews and images from the gallery.

Any advice on how I can fix?

May 5, 2011 at 12:54 PM

Wrapping the template in a div seems to solve it, i.e.:

<div>
    @Display(Model.Content)
</div>

May 5, 2011 at 1:16 PM
Edited May 5, 2011 at 2:24 PM

Thanks, apologies for being dumb but - which template? The templates for the theme all have div's around the display calls so I'm not sure which template I should be looking at.....

( I have found out it's something to do with the Contrib.Reviews module - if I remove that part from the content type, shape tracing works again)

May 5, 2011 at 3:09 PM

I've narrowed it down to this line;

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>

in ConfirmRatingDelete.cshtml in the Contrib.Reviews module.

Anyone any thoughts?

May 5, 2011 at 4:07 PM

Ok, what's happening is that version of jQuery UI is conflicting with the version Orchard already includes for shape tracing and other features.

That script should be placed with @Script.Require("jQueryUI") from memory, as Orchard now has standard includes for all bits of jQuery.

If Contrib.Reviews is using any other components from UI they'll need including individually, you can see the complete resource manifest in Orchard.jQuery module.

You should probably submit that back as a patch to the Reviews module...

May 6, 2011 at 8:46 AM

Great, thanks very much, all sorted. I've also submitted the patch back to Contrib.Reviews.

Much appreciated.