diff --git a/src/Orchard.Web/Modules/Orchard.Widgets/Drivers/LayerHintHandlerDriver.cs b/src/Orchard.Web/Modules/Orchard.Widgets/Drivers/LayerHintHandlerDriver.cs new file mode 100644 index 000000000..928428d51 --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Widgets/Drivers/LayerHintHandlerDriver.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web.Mvc; +using System.Web.Routing; +using Orchard.ContentManagement; +using Orchard.ContentManagement.Aspects; +using Orchard.ContentManagement.Drivers; +using Orchard.ContentManagement.Handlers; +using Orchard.Core.Routable.Models; +using Orchard.Localization; +using Orchard.UI.Notify; + +namespace Orchard.Widgets.Drivers { + public class LayerHintHandlerDriver : ContentHandler { + public LayerHintHandlerDriver(IOrchardServices services, RequestContext requestContext) { + T = NullLocalizer.Instance; + + OnPublished((context, part) => { + if (string.IsNullOrWhiteSpace(part.Path)) // only going to help in creating a layer if the content has a path + return; + var urlHelper = new UrlHelper(requestContext); + services.Notifier.Information(T("Would you like to add a widget layer for this page?", urlHelper.Action("AddLayer", "Admin", new { area = "Orchard.Widgets", rule = "url ~/" + part.Path }))); + }); + } + + public Localizer T { get; set; } + } +} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Widgets/Orchard.Widgets.csproj b/src/Orchard.Web/Modules/Orchard.Widgets/Orchard.Widgets.csproj index c9068600b..12aff51af 100644 --- a/src/Orchard.Web/Modules/Orchard.Widgets/Orchard.Widgets.csproj +++ b/src/Orchard.Web/Modules/Orchard.Widgets/Orchard.Widgets.csproj @@ -51,6 +51,7 @@ +