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> {
protected override DriverResult Editor(LayerPart layerPart, dynamic shapeHelper) {
// TODO: andrerod convert to new shape API. Location code kept for reference.
// ContentLocation location = layerPart.GetLocation("Editor");
return ContentPartTemplate(layerPart, "Parts/Widgets.LayerPart"); //.Location(location);
return ContentShape("Parts_Widgets_LayerPart",
() => shapeHelper.EditorTemplate(TemplateName: "Parts/Widgets.LayerPart", Model: layerPart));
}
protected override DriverResult Editor(LayerPart layerPart, IUpdateModel updater, dynamic shapeHelper) {

View File

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

View File

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

View File

@@ -64,26 +64,6 @@ namespace Orchard.Widgets {
}
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",
cfg => cfg
.WithPart("CommonPart")

View File

@@ -97,7 +97,9 @@
<Content Include="Web.config" />
<Content Include="Views\Web.config" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<None Include="Placement.info" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Core\Orchard.Core.csproj">
<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>