Generalize content location settings

We have multiple types of "display" ("Detail", "Summary", "Editor", etc.).
The Location settings now exposes 4 pre-defined display types for location
settings for Field and for Parts:
* Detail
* Editor
* Summary
* SummaryAdmin

--HG--
branch : dev
This commit is contained in:
Renaud Paquay
2010-07-20 23:58:07 -07:00
parent 48bd5c977f
commit 75fef28ea3
14 changed files with 189 additions and 96 deletions

View File

@@ -1,4 +1,6 @@
using Orchard.ContentManagement.MetaData;
using System.Collections.Generic;
using Orchard.ContentManagement.Drivers;
using Orchard.ContentManagement.MetaData;
using Orchard.ContentManagement.MetaData.Builders;
using Orchard.Core.Routable.Models;
using Orchard.Data.Migration;
@@ -20,7 +22,9 @@ namespace Orchard.Core.Routable.DataMigrations {
public int UpdateFrom1() {
ContentDefinitionManager.AlterPartDefinition(typeof(IsRoutable).Name, cfg => cfg
.WithLocation("EditorLocation", "primary", "before.5"));
.WithLocation(new Dictionary<string, ContentLocation> {
{"Editor", new ContentLocation { Zone = "primary", Position = "before.5" }}
} ));
return 2;
}

View File

@@ -1,6 +1,7 @@
using Orchard.ContentManagement;
using Orchard.ContentManagement.Aspects;
using Orchard.ContentManagement.Drivers;
using Orchard.Core.Common.Models;
using Orchard.Core.Common.Settings;
using Orchard.Core.Routable.Models;
using Orchard.Core.Routable.Services;
@@ -67,8 +68,8 @@ namespace Orchard.Core.Routable.Drivers {
: "";
}
var locationSettings = part.PartDefinition.Settings.GetModel<LocationSettings>("EditorLocation");
return ContentPartTemplate(model, TemplateName, Prefix).Location(locationSettings.Zone, locationSettings.Position);
var location = part.PartDefinition.Settings.GetModel<LocationSettings>().Get("Editor");
return ContentPartTemplate(model, TemplateName, Prefix).Location(location.Zone, location.Position);
}
protected override DriverResult Editor(IsRoutable part, IUpdateModel updater) {