Converting widgets to new shape API.

--HG--
branch : dev
This commit is contained in:
Andre Rodrigues
2010-10-18 14:15:39 -07:00
parent 04121484f3
commit ef380832d1
6 changed files with 14 additions and 33 deletions

View File

@@ -9,10 +9,8 @@ namespace Orchard.Widgets.Drivers {
public class LayerPartDriver : ContentPartDriver<LayerPart> { public class LayerPartDriver : ContentPartDriver<LayerPart> {
protected override DriverResult Editor(LayerPart layerPart, dynamic shapeHelper) { protected override DriverResult Editor(LayerPart layerPart, dynamic shapeHelper) {
return ContentShape("Parts_Widgets_LayerPart",
// TODO: andrerod convert to new shape API. Location code kept for reference. () => shapeHelper.EditorTemplate(TemplateName: "Parts/Widgets.LayerPart", Model: layerPart));
// ContentLocation location = layerPart.GetLocation("Editor");
return ContentPartTemplate(layerPart, "Parts/Widgets.LayerPart"); //.Location(location);
} }
protected override DriverResult Editor(LayerPart layerPart, IUpdateModel updater, dynamic shapeHelper) { protected override DriverResult Editor(LayerPart layerPart, IUpdateModel updater, dynamic shapeHelper) {

View File

@@ -5,12 +5,9 @@ using Orchard.Widgets.Models;
namespace Orchard.Widgets.Drivers { namespace Orchard.Widgets.Drivers {
[UsedImplicitly] [UsedImplicitly]
public class WidgetBagPartDriver : ContentPartDriver<WidgetBagPart> { public class WidgetBagPartDriver : ContentPartDriver<WidgetBagPart> {
private const string TemplateName = "Parts/Widgets.WidgetBagPart";
protected override DriverResult Editor(WidgetBagPart part, dynamic shapeHelper) { protected override DriverResult Editor(WidgetBagPart part, dynamic shapeHelper) {
//var location = part.GetLocation("Editor"); return ContentShape("Parts_Widgets_WidegetBagPart",
// TODO: andrerod convert to new shape API. Location code kept for reference. () => shapeHelper.EditorTemplate(TemplateName: "Parts/Widgets.WidgetBagPart", Model: part));
return ContentPartTemplate("", TemplateName, Prefix); //.Location(location);
} }
} }
} }

View File

@@ -17,9 +17,8 @@ namespace Orchard.Widgets.Drivers {
protected override DriverResult Editor(WidgetPart widgetPart, dynamic shapeHelper) { protected override DriverResult Editor(WidgetPart widgetPart, dynamic shapeHelper) {
widgetPart.AvailableZones = _widgetsService.GetZones(); widgetPart.AvailableZones = _widgetsService.GetZones();
// TODO: andrerod convert to new shape API. Location code kept for reference. return ContentShape("Parts_Widgets_WidgetPart",
//ContentLocation location = widgetPart.GetLocation("Editor"); () => shapeHelper.EditorTemplate(TemplateName: "Parts/Widgets.WidgetPart", Model: widgetPart));
return ContentPartTemplate(widgetPart, "Parts/Widgets.WidgetPart"); //.Location(location);
} }
protected override DriverResult Editor(WidgetPart widgetPart, IUpdateModel updater, dynamic shapeHelper) { protected override DriverResult Editor(WidgetPart widgetPart, IUpdateModel updater, dynamic shapeHelper) {

View File

@@ -64,26 +64,6 @@ namespace Orchard.Widgets {
} }
public int UpdateFrom1() { public int UpdateFrom1() {
ContentDefinitionManager.AlterPartDefinition(typeof(LayerPart).Name,
cfg => cfg
.WithLocation(new Dictionary<string, ContentLocation> {
{"Editor", new ContentLocation { Zone = "Primary", Position = "1" }}
})
);
ContentDefinitionManager.AlterPartDefinition(typeof(WidgetPart).Name,
cfg => cfg
.WithLocation(new Dictionary<string, ContentLocation> {
{"Editor", new ContentLocation { Zone = "Primary", Position = "1" }}
})
);
ContentDefinitionManager.AlterPartDefinition(typeof(WidgetBagPart).Name,
cfg => cfg
.WithLocation(new Dictionary<string, ContentLocation> {
{"Editor", new ContentLocation {Zone = "Primary", Position = "5"}}
})
);
ContentDefinitionManager.AlterTypeDefinition("WidgetPage", ContentDefinitionManager.AlterTypeDefinition("WidgetPage",
cfg => cfg cfg => cfg
.WithPart("CommonPart") .WithPart("CommonPart")

View File

@@ -97,7 +97,9 @@
<Content Include="Web.config" /> <Content Include="Web.config" />
<Content Include="Views\Web.config" /> <Content Include="Views\Web.config" />
</ItemGroup> </ItemGroup>
<ItemGroup /> <ItemGroup>
<None Include="Placement.info" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\Core\Orchard.Core.csproj"> <ProjectReference Include="..\..\Core\Orchard.Core.csproj">
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project> <Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>

View File

@@ -0,0 +1,5 @@
<Placement>
<Place Parts_Widgets_LayerPart="Primary:1"/>
<Place Parts_Widgets_WidgetPart="Primary:1"/>
<Place Parts_Widgets_WidegetBagPart="Primary:5"/>
</Placement>