- Adding the RoutableAspect editor template's permalink slug prefix display based on container slugs

- Got the rest of the hard coded prefix usage out of the RoutableAspect's editor template

--HG--
extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4045731
This commit is contained in:
skewed
2010-01-20 09:26:33 +00:00
parent 1ae1770b0d
commit 5285b24733
11 changed files with 54 additions and 13 deletions

View File

@@ -0,0 +1,26 @@
using System.Text;
using JetBrains.Annotations;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Aspects;
using Orchard.ContentManagement.Handlers;
namespace Orchard.Core.Common.Models {
[UsedImplicitly]
public class RoutableAspectHandler : ContentHandler
{
public RoutableAspectHandler() {
OnGetEditorViewModel<RoutableAspect>((context, routable) => {
var containerPathBuilder = new StringBuilder();
var container = context.ContentItem.As<ICommonAspect>().Container;
while (container != null) {
if (container.Is<RoutableAspect>())
containerPathBuilder.Insert(0, string.Format("{0}/", container.As<RoutableAspect>().Slug));
container = container.ContentItem.As<ICommonAspect>().Container;
}
routable.ContainerPath = containerPathBuilder.ToString();
});
}
}
}