Store default location for the "Common" part in initial settings

--HG--
branch : dev
This commit is contained in:
Renaud Paquay
2010-07-21 21:32:13 -07:00
parent 95e1fd7114
commit 12c17cdccb
2 changed files with 12 additions and 6 deletions

View File

@@ -44,5 +44,14 @@ namespace Orchard.Core.Common.DataMigrations {
})); }));
return 2; return 2;
} }
public int UpdateFrom2() {
ContentDefinitionManager.AlterPartDefinition(typeof(CommonAspect).Name, cfg => cfg
.WithLocation(new Dictionary<string, ContentLocation> {
{"Default", new ContentLocation { Zone = "metadata", Position = "5" }},
{"Editor", new ContentLocation { Zone = "primary", Position = "20" }},
}));
return 3;
}
} }
} }

View File

@@ -36,10 +36,9 @@ namespace Orchard.Core.Common.Drivers {
public IOrchardServices Services { get; set; } public IOrchardServices Services { get; set; }
protected override DriverResult Display(CommonAspect part, string displayType) { protected override DriverResult Display(CommonAspect part, string displayType) {
var location = part.GetLocation(displayType, "metadata", "5");
return ContentPartTemplate(new CommonMetadataViewModel(part), "Parts/Common.Metadata") return ContentPartTemplate(new CommonMetadataViewModel(part), "Parts/Common.Metadata")
.LongestMatch(displayType, "Summary", "SummaryAdmin") .LongestMatch(displayType, "Summary", "SummaryAdmin")
.Location(location); .Location(part.GetLocation(displayType));
} }
protected override DriverResult Editor(CommonAspect part) { protected override DriverResult Editor(CommonAspect part) {
@@ -83,8 +82,7 @@ namespace Orchard.Core.Common.Drivers {
} }
} }
var location = part.GetLocation("Editor", "primary", "20"); return ContentPartTemplate(model, "Parts/Common.Owner", TemplatePrefix).Location(part.GetLocation("Editor"));
return ContentPartTemplate(model, "Parts/Common.Owner", TemplatePrefix).Location(location);
} }
DriverResult ContainerEditor(CommonAspect part, IUpdateModel updater) { DriverResult ContainerEditor(CommonAspect part, IUpdateModel updater) {
@@ -112,8 +110,7 @@ namespace Orchard.Core.Common.Drivers {
} }
} }
var location = part.GetLocation("Editor", "primary", "20.1"); return ContentPartTemplate(model, "Parts/Common.Container", TemplatePrefix).Location(part.GetLocation("Editor"));
return ContentPartTemplate(model, "Parts/Common.Container", TemplatePrefix).Location(location);
} }
} }
} }