Store default location for BodyAspect part in initial settings

--HG--
branch : dev
This commit is contained in:
Renaud Paquay 2010-07-21 21:19:04 -07:00
parent a444c093a9
commit bd54496d57
5 changed files with 19 additions and 6 deletions

View File

@ -1,4 +1,9 @@
using System;
using System.Collections.Generic;
using Orchard.ContentManagement.Drivers;
using Orchard.ContentManagement.MetaData;
using Orchard.ContentManagement.MetaData.Builders;
using Orchard.Core.Common.Models;
using Orchard.Data.Migration;
namespace Orchard.Core.Common.DataMigrations {
@ -31,5 +36,13 @@ namespace Orchard.Core.Common.DataMigrations {
return 1;
}
public int UpdateFrom1() {
ContentDefinitionManager.AlterPartDefinition(typeof(BodyAspect).Name, cfg => cfg
.WithLocation(new Dictionary<string, ContentLocation> {
{"Default", new ContentLocation { Zone = "primary", Position = "5" }},
}));
return 2;
}
}
}

View File

@ -28,7 +28,7 @@ namespace Orchard.Core.Common.Drivers {
// \/\/ Hackalicious on many accounts - don't copy what has been done here for the wrapper \/\/
protected override DriverResult Display(BodyAspect part, string displayType) {
var model = new BodyDisplayViewModel { BodyAspect = part, Text = BbcodeReplace(part.Text) };
var location = part.GetLocation(displayType, "primary", "5");
var location = part.GetLocation(displayType);
return Combined(
Services.Authorizer.Authorize(Permissions.ChangeOwner) ? ContentPartTemplate(model, "Parts/Common.Body.ManageWrapperPre").LongestMatch(displayType, "SummaryAdmin").Location(location) : null,
@ -39,7 +39,7 @@ namespace Orchard.Core.Common.Drivers {
protected override DriverResult Editor(BodyAspect part) {
var model = BuildEditorViewModel(part);
var location = part.GetLocation("Editor", "primary", "5");
var location = part.GetLocation("Editor");
return ContentPartTemplate(model, TemplateName, Prefix).Location(location);
}
@ -51,7 +51,7 @@ namespace Orchard.Core.Common.Drivers {
if (string.IsNullOrWhiteSpace(model.Format))
model.Format = GetFlavor(part);
var location = part.GetLocation("Editor", "primary", "5");
var location = part.GetLocation("Editor");
return ContentPartTemplate(model, TemplateName, Prefix).Location(location);
}

View File

@ -8,5 +8,5 @@ description: The common module introduces content parts that are going to be use
features:
Common:
Description: Core content parts.
Dependencies: ContentsLocation
Dependencies: Settings
Category: Core

View File

@ -9,4 +9,4 @@ features:
PublishLater:
Description: Draft creation and scheduled publishing.
Category: Content
Dependencies: Common
Dependencies: Common, Settings

View File

@ -8,5 +8,5 @@ description: The routable module enables content items to be accessed through a
features:
Routable:
Description: Routable content part.
Dependencies: ContentsLocation
Dependencies: Settings
Category: Core