Fix issue with widget positions

Widget position are in a somewhat usable state now.

--HG--
branch : dev
This commit is contained in:
Renaud Paquay
2010-10-19 23:56:49 -07:00
parent a11dfbf9e0
commit c1af4ca217
3 changed files with 5 additions and 2 deletions

View File

@@ -111,6 +111,9 @@ namespace Orchard.Widgets.Controllers {
if (widgetPart == null)
return HttpNotFound();
int widgetPosition = _widgetsService.GetWidgets(layerId).Count() + 1;
widgetPart.Position = widgetPosition.ToString();
widgetPart.LayerPart = _widgetsService.GetLayer(layerId);
dynamic model = Services.ContentManager.BuildEditor(widgetPart);
return View(model);

View File

@@ -28,7 +28,7 @@ namespace Orchard.Widgets.Models {
/// <summary>
/// The widget's position within the zone.
/// </summary>
[HiddenInput(DisplayValue = false)]
[Required]
public string Position
{
get { return Record.Position; }

View File

@@ -172,7 +172,7 @@ namespace Orchard.Widgets.Services {
private static void SwitchWidgetPositions(WidgetPart sourceWidget, WidgetPart targetWidget) {
string tempPosition = sourceWidget.Record.Position;
sourceWidget.Record.Position = targetWidget.ToString();
sourceWidget.Record.Position = targetWidget.Record.Position;
targetWidget.Record.Position = tempPosition;
}
}