Some code cleanup

Adding a back-reference from ShapeBinding to ShapeDescriptor
Changing HomePage display type to default ("_HomePage" will be indicated in a different way)
Moving IShapeFactoryEvents into its own file

--HG--
branch : theming
This commit is contained in:
Louis DeJardin
2010-09-14 12:29:48 -07:00
parent d7c663c90c
commit 458be54ca4
6 changed files with 36 additions and 25 deletions

View File

@@ -37,7 +37,7 @@ namespace Orchard.Core.Routable.Services {
if (contentItem == null || !contentItem.Is<RoutePart>())
return new NotFoundResult();
var model = _contentManager.BuildDisplayModel(contentItem, "_HomePage");
var model = _contentManager.BuildDisplayModel(contentItem);
return new ViewResult {
ViewName = "Display",

View File

@@ -42,6 +42,7 @@ namespace Orchard.DisplayManagement.Descriptors {
Func<DisplayContext, IHtmlString> target = null;
var binding = new ShapeBinding {
ShapeDescriptor = descriptor,
BindingName = _bindingName,
BindingSource = bindingSource,
Binding = displayContext => {

View File

@@ -40,6 +40,7 @@ namespace Orchard.DisplayManagement.Descriptors {
}
public class ShapeBinding {
public ShapeDescriptor ShapeDescriptor { get; set; }
public string BindingName { get; set; }
public string BindingSource { get; set; }
public Func<DisplayContext, IHtmlString> Binding { get; set; }

View File

@@ -6,31 +6,7 @@ using Orchard.DisplayManagement.Descriptors;
using Orchard.DisplayManagement.Shapes;
namespace Orchard.DisplayManagement.Implementation {
public interface IShapeFactoryEvents : IDependency {
void Creating(ShapeCreatingContext context);
void Created(ShapeCreatedContext context);
}
public abstract class ShapeFactoryEvents : IShapeFactoryEvents{
public virtual void Creating(ShapeCreatingContext context) {}
public virtual void Created(ShapeCreatedContext context) {}
}
public class ShapeCreatingContext {
public IShapeFactory ShapeFactory { get; set; }
public dynamic New { get; set; }
public string ShapeType { get; set; }
public Type BaseType { get; set; }
public IList<IClayBehavior> Behaviors { get; set; }
public IList<Action<ShapeCreatedContext>> OnCreated { get; set; }
}
public class ShapeCreatedContext {
public IShapeFactory ShapeFactory { get; set; }
public dynamic New { get; set; }
public string ShapeType { get; set; }
public dynamic Shape { get; set; }
}

View File

@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using ClaySharp;
namespace Orchard.DisplayManagement.Implementation {
public interface IShapeFactoryEvents : IDependency {
void Creating(ShapeCreatingContext context);
void Created(ShapeCreatedContext context);
}
public class ShapeCreatingContext {
public IShapeFactory ShapeFactory { get; set; }
public dynamic New { get; set; }
public string ShapeType { get; set; }
public Type BaseType { get; set; }
public IList<IClayBehavior> Behaviors { get; set; }
public IList<Action<ShapeCreatedContext>> OnCreated { get; set; }
}
public class ShapeCreatedContext {
public IShapeFactory ShapeFactory { get; set; }
public dynamic New { get; set; }
public string ShapeType { get; set; }
public dynamic Shape { get; set; }
}
public abstract class ShapeFactoryEvents : IShapeFactoryEvents {
public virtual void Creating(ShapeCreatingContext context) { }
public virtual void Created(ShapeCreatedContext context) { }
}
}

View File

@@ -145,6 +145,7 @@
<Compile Include="DisplayManagement\Descriptors\ShapeAlterationBuilder.cs" />
<Compile Include="DisplayManagement\Descriptors\ShapeTable.cs" />
<Compile Include="DisplayManagement\Descriptors\ShapeTableBuilder.cs" />
<Compile Include="DisplayManagement\Implementation\IShapeFactoryEvents.cs" />
<Compile Include="DisplayManagement\Shapes\ITagBuilderFactory.cs" />
<Compile Include="Mvc\IOrchardViewPage.cs" />
<Compile Include="Mvc\Spooling\HtmlStringWriter.cs" />