Overloading ContentPart to optionally have new shape passed in

If lambda takes an argument, it is dynamic, and is an uninitialized shape of the named type
ShapeHelper and IShapeHelperFactory are obsolete - IShapeFactory itself is now dynamic

--HG--
branch : dev
This commit is contained in:
Louis DeJardin
2010-10-15 17:24:30 -07:00
parent cd6e1fb7c9
commit 70426a89b9
60 changed files with 203 additions and 321 deletions

View File

@@ -26,8 +26,7 @@ namespace Orchard.Themes.Controllers {
IThemeService themeService,
IPreviewTheme previewTheme,
IAuthorizer authorizer,
INotifier notifier,
IShapeHelperFactory shapeHelperFactory) {
INotifier notifier) {
Services = services;
_dataMigrationManager = dataMigraitonManager;
_reportsCoordinator = reportsCoordinator;
@@ -36,7 +35,6 @@ namespace Orchard.Themes.Controllers {
T = NullLocalizer.Instance;
}
dynamic Shape { get; set; }
public IOrchardServices Services{ get; set; }
public Localizer T { get; set; }

View File

@@ -9,13 +9,17 @@ namespace Orchard.Themes.Preview {
private readonly IThemeService _themeService;
private readonly IPreviewTheme _previewTheme;
private readonly IWorkContextAccessor _workContextAccessor;
private readonly IShapeHelperFactory _shapeHelperFactory;
private readonly dynamic _shapeFactory;
public PreviewThemeFilter(IThemeService themeService, IPreviewTheme previewTheme, IWorkContextAccessor workContextAccessor, IShapeHelperFactory shapeHelperFactory) {
public PreviewThemeFilter(
IThemeService themeService,
IPreviewTheme previewTheme,
IWorkContextAccessor workContextAccessor,
IShapeFactory shapeFactory) {
_themeService = themeService;
_previewTheme = previewTheme;
_workContextAccessor = workContextAccessor;
_shapeHelperFactory = shapeHelperFactory;
_shapeFactory = shapeFactory;
}
public void OnResultExecuting(ResultExecutingContext filterContext) {
@@ -33,8 +37,8 @@ namespace Orchard.Themes.Preview {
.ToList();
var shape = _shapeHelperFactory.CreateHelper();
_workContextAccessor.GetContext(filterContext).Layout.Zones["Body"].Add(shape.ThemePreview(Themes: themeListItems), ":before");
_workContextAccessor.GetContext(filterContext).Layout.Zones["Body"].Add(_shapeFactory.ThemePreview(Themes: themeListItems), ":before");
}
public void OnResultExecuted(ResultExecutedContext filterContext) { }