mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
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:
@@ -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",
|
||||
|
@@ -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 => {
|
||||
|
@@ -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; }
|
||||
|
@@ -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; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@@ -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) { }
|
||||
}
|
||||
|
||||
}
|
@@ -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" />
|
||||
|
Reference in New Issue
Block a user