Putting the widget layer hinting notification into it's own feature...

...so it can be disabled when it becomes annoying.

It's enabled by default in the blog and default recipies.

--HG--
branch : dev
This commit is contained in:
Nathan Heskew
2011-03-23 14:47:35 -07:00
parent 2d3ac42836
commit f51dc24032
4 changed files with 13 additions and 2 deletions
@@ -12,7 +12,7 @@
<Feature enable="Orchard.Blogs,Orchard.Comments,Orchard.Tags,
XmlRpc,Orchard.Blogs.RemotePublishing,
TinyMce,Orchard.Media,Orchard.MediaPicker,Orchard.PublishLater,
Orchard.jQuery,Orchard.Widgets,
Orchard.jQuery,Orchard.Widgets,Orchard.Widgets.PageLayerHinting,
Orchard.Scripting,Orchard.Scripting.Lightweight,
PackagingServices,Orchard.Packaging,Gallery.Updates,
TheThemeMachine" />
@@ -11,7 +11,7 @@
<Feature enable="Orchard.Blogs,Orchard.Comments,Orchard.Tags,
Orchard.Lists,TinyMce,Orchard.Media,Orchard.MediaPicker,Orchard.PublishLater,
Orchard.jQuery,Orchard.Widgets,Orchard.ContentTypes,
Orchard.jQuery,Orchard.Widgets,Orchard.Widgets.PageLayerHinting,Orchard.ContentTypes,
Orchard.Scripting,Orchard.Scripting.Lightweight,
PackagingServices,Orchard.Packaging,Gallery.Updates,
TheThemeMachine" />
@@ -8,10 +8,12 @@ using Orchard.ContentManagement.Aspects;
using Orchard.ContentManagement.Drivers;
using Orchard.ContentManagement.Handlers;
using Orchard.Core.Routable.Models;
using Orchard.Environment.Extensions;
using Orchard.Localization;
using Orchard.UI.Notify;
namespace Orchard.Widgets.Drivers {
[OrchardFeature("Orchard.Widgets.PageLayerHinting")]
public class LayerHintHandler : ContentHandler {
public LayerHintHandler(IOrchardServices services, RequestContext requestContext) {
T = NullLocalizer.Instance;
@@ -19,6 +21,9 @@ namespace Orchard.Widgets.Drivers {
OnPublished<RoutePart>((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);
var pathForLayer = "~/" + part.Path;
services.Notifier.Information(T("Would you like to <a href=\"{0}\">add a widget layer</a> for \"{1}\"?",
@@ -8,3 +8,9 @@ Description: An implementation of widgets for Orchard.
FeatureDescription: An implementation of widgets.
Category: Widget
Dependencies: Orchard.Scripting, Orchard.Themes
Features:
Orchard.Widgets.PageLayerHinting:
Name: Page Layer Hinting
Description: Adds a notification after creating a new Page with a direct link to create a Widget Layer for that specific page by URL.
Dependencies: Orchard.Widgets
Category: Widget