2010-10-05 15:42:17 -07:00
|
|
|
|
using JetBrains.Annotations;
|
2010-10-11 10:15:15 -07:00
|
|
|
|
using Orchard.ContentManagement;
|
2010-10-05 15:42:17 -07:00
|
|
|
|
using Orchard.ContentManagement.Drivers;
|
2010-10-11 10:15:15 -07:00
|
|
|
|
using Orchard.Core.ContentsLocation.Models;
|
2010-10-05 15:42:17 -07:00
|
|
|
|
using Orchard.Widgets.Models;
|
2010-10-11 10:15:15 -07:00
|
|
|
|
using Orchard.Widgets.Services;
|
2010-10-05 15:42:17 -07:00
|
|
|
|
|
|
|
|
|
namespace Orchard.Widgets.Drivers {
|
2010-10-11 10:15:15 -07:00
|
|
|
|
|
2010-10-05 15:42:17 -07:00
|
|
|
|
[UsedImplicitly]
|
|
|
|
|
public class WidgetPartDriver : ContentPartDriver<WidgetPart> {
|
2010-10-11 10:15:15 -07:00
|
|
|
|
private readonly IWidgetsService _widgetsService;
|
|
|
|
|
|
|
|
|
|
public WidgetPartDriver(IWidgetsService widgetsService) {
|
|
|
|
|
_widgetsService = widgetsService;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override DriverResult Editor(WidgetPart widgetPart, dynamic shapeHelper) {
|
|
|
|
|
widgetPart.AvailableZones = _widgetsService.GetZones();
|
|
|
|
|
|
|
|
|
|
ContentLocation location = widgetPart.GetLocation("Editor");
|
2010-10-11 10:26:23 -07:00
|
|
|
|
return ContentPartTemplate(widgetPart, "Parts/Widgets.WidgetPart").Location(location);
|
2010-10-11 10:15:15 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override DriverResult Editor(WidgetPart widgetPart, IUpdateModel updater, dynamic shapeHelper) {
|
|
|
|
|
updater.TryUpdateModel(widgetPart, Prefix, null, null);
|
|
|
|
|
return Editor(widgetPart, shapeHelper);
|
|
|
|
|
}
|
2010-10-05 15:42:17 -07:00
|
|
|
|
}
|
|
|
|
|
}
|