DrillRoutePart Issue

Jun 15, 2011 at 3:35 AM

 

  Hi Pete, I'm trying to familiarize myself with the DrillRoutePart by playing around in a test project.  I'm running into issues.  The error is as follows:

'Downplay.Mechanics.Plumbing.Models.DrillRoutePart' does not contain a definition for 'Slug' and no extension method 'Slug' accepting a first argument of type 'Downplay.Mechanics.Plumbing.Models.DrillRoutePart' could be found

This is thrown when the view Downplay.Mechanics\Views\EditorTemplates\Parts.DrillRoute.Edit.cshtml is being rendered.  The latest version of DrillRoutePart does not have any properties and it is the model type that the view is expecting.  Should the DrillRoutePart and its record class be updated?  Thanks!

Coordinator
Jun 15, 2011 at 9:14 AM

Hi, I'll have a look - I think the edit template needs updating. DrillRoute doesn't need any properties at this time - it's PipeRoute that does that work.

Quick explanation of the parts:

- TitlePart is there so any content type can have a title defined, independent of the routing mechanism. I didn't like the way the title is firmly bolted onto RoutePart in Orchard; sometimes I want non-routed items to have titles, and I wanted a consistent title mechanism that I could use for my own routing bits.

- PipeRoutePart  can be added to a content type in conjunction with TitlePart, and this will completely replace Orchard's RoutePart. PipeRoutePart then has various settings like Base Route which lets you do /content-type-name/item-slug. It also has Root Route which prevents the item having a top-level URL at all. If Root Route is set to true, then the item can only be available through DrillRoutes. Unfortunately if you want to replace RoutePart on an existing site, I don't yet have a mechanism for that - you'd have to copy the existing titles over to the new field. But I'll be implementing something for this by v1.0.

- DrillRoutePart is to be added to connectors only. It's how you define sub-URLs across connections. So as an example you could replace the Blog module using this system. You define Blog and BlogPost content types - and then a BlogToBlogPost content type which will act as the connector, so it needs ConnectorPart. Blog and BlogPost both need SocketsPart to handle the two ends of the relationship, and PipeRoutePart because DrillRoutePart needs it to interact with. You can then add DrillRoutePart to the BlogToBlogPost content type, and that will make routes like /blog-title/blog-post-title. Since you've got PipeRoutes you can specify further options to make, e.g. /blogs/blog-title/posts/blog-post-title, and a variety of other combinations. There are some other functions that DrillRoute performs, it's basically acting as a filter on the child items, so you can do things like still having the parent item displayed, with the child item in detail view.

I hope that makes sense; the Plumbing feature is quite hard to explain; it's a bit experimental and abstract, and certain combinations are still slightly buggy; once I've applied some fixes I'll be able to write up some docs which should clarify things somewhat.