-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updating nuget package versions to v2 (RTM)
- Loading branch information
Chris Smith
committed
Apr 25, 2017
1 parent
fb46799
commit 2a1d365
Showing
25 changed files
with
149 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
-776 Bytes
(96%)
src/Extras/Jabberwocky.Extras.Polly.Sc/Packages/Jabberwocky Extras Polly Sc.zip
Binary file not shown.
26 changes: 15 additions & 11 deletions
26
src/Extras/Jabberwocky.Extras.Polly.Sc/Pipelines/Mvc/GetRenderer/AddPageEditorWrapper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,23 @@ | ||
using Jabberwocky.Extras.Polly.Sc.Renderer; | ||
using Sitecore; | ||
using Sitecore.Mvc.Pipelines.Response.GetRenderer; | ||
|
||
namespace Jabberwocky.Extras.Polly.Sc.Pipelines.Mvc.GetRenderer | ||
{ | ||
public class AddPageEditorWrapper : GetRendererProcessor | ||
{ | ||
public override void Process(GetRendererArgs args) | ||
{ | ||
if (args.Result == null) return; | ||
public class AddPageEditorWrapper : GetRendererProcessor | ||
{ | ||
public override void Process(GetRendererArgs args) | ||
{ | ||
if (args.Result == null) return; | ||
|
||
var renderer = args.Result; | ||
var rendering = args.Rendering; | ||
if (rendering == null) return; | ||
var renderer = args.Result; | ||
var rendering = args.Rendering; | ||
if (rendering == null) return; | ||
|
||
args.Result = new PageEditorRendererDecorator(renderer, rendering.RenderingItem); | ||
} | ||
} | ||
// Only apply this decorator when in Experience Editor | ||
if (!Context.PageMode.IsExperienceEditor) return; | ||
|
||
args.Result = new PageEditorRendererDecorator(renderer, rendering.RenderingItem); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/Extras/Jabberwocky.Extras.Polly.Sc/Renderer/BaseRendererDecorator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System; | ||
|
||
namespace Jabberwocky.Extras.Polly.Sc.Renderer | ||
{ | ||
public abstract class BaseRendererDecorator : Sitecore.Mvc.Presentation.Renderer | ||
{ | ||
private readonly Sitecore.Mvc.Presentation.Renderer _innerRenderer; | ||
|
||
protected BaseRendererDecorator(Sitecore.Mvc.Presentation.Renderer innerRenderer) | ||
{ | ||
_innerRenderer = innerRenderer ?? throw new ArgumentNullException(nameof(innerRenderer)); | ||
} | ||
|
||
public override string CacheKey => _innerRenderer.CacheKey; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 25 additions & 36 deletions
61
src/Extras/Jabberwocky.Extras.Polly.Sc/Renderer/PageEditorRendererDecorator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,36 @@ | ||
using System; | ||
using System.IO; | ||
using System.Web; | ||
using Sitecore; | ||
using Sitecore.Data.Items; | ||
using Sitecore.Diagnostics; | ||
|
||
namespace Jabberwocky.Extras.Polly.Sc.Renderer | ||
{ | ||
public class PageEditorRendererDecorator : Sitecore.Mvc.Presentation.Renderer | ||
{ | ||
private readonly Sitecore.Mvc.Presentation.Renderer _innerRenderer; | ||
private readonly RenderingItem _renderingItem; | ||
public class PageEditorRendererDecorator : BaseRendererDecorator | ||
{ | ||
private readonly Sitecore.Mvc.Presentation.Renderer _innerRenderer; | ||
private readonly RenderingItem _renderingItem; | ||
|
||
public PageEditorRendererDecorator(Sitecore.Mvc.Presentation.Renderer innerRenderer, RenderingItem renderingItem) | ||
{ | ||
if (innerRenderer == null) throw new ArgumentNullException(nameof(innerRenderer)); | ||
if (renderingItem == null) throw new ArgumentNullException(nameof(renderingItem)); | ||
_innerRenderer = innerRenderer; | ||
_renderingItem = renderingItem; | ||
} | ||
public PageEditorRendererDecorator(Sitecore.Mvc.Presentation.Renderer innerRenderer, RenderingItem renderingItem) | ||
: base(innerRenderer) | ||
{ | ||
_innerRenderer = innerRenderer ?? throw new ArgumentNullException(nameof(innerRenderer)); | ||
_renderingItem = renderingItem ?? throw new ArgumentNullException(nameof(renderingItem)); | ||
} | ||
|
||
public override void Render(TextWriter writer) | ||
{ | ||
// Only bother with capturing exceptions if we're in Experience Editor mode | ||
// No point in catching and immediately rethrowing when not in 'happy path' | ||
if (Context.PageMode.IsExperienceEditor) | ||
{ | ||
try | ||
{ | ||
_innerRenderer.Render(writer); | ||
} | ||
catch (Exception ex) | ||
{ | ||
writer.Write("<p class='page-editor-component-error rendering-name'>Error rendering the following component: {0}</p><p class='page-editor-component-error exception-message'>{1}</p>", | ||
HttpUtility.HtmlEncode(_renderingItem.Name), | ||
HttpUtility.HtmlEncode(ex)); | ||
Log.Error(ex.Message, ex, typeof(PageEditorRendererDecorator)); | ||
} | ||
} | ||
else | ||
{ | ||
_innerRenderer.Render(writer); | ||
} | ||
} | ||
} | ||
public override void Render(TextWriter writer) | ||
{ | ||
try | ||
{ | ||
_innerRenderer.Render(writer); | ||
} | ||
catch (Exception ex) | ||
{ | ||
writer.Write("<p class='page-editor-component-error rendering-name'>Error rendering the following component: {0}</p><p class='page-editor-component-error exception-message'>{1}</p>", | ||
HttpUtility.HtmlEncode(_renderingItem.Name), | ||
HttpUtility.HtmlEncode(ex)); | ||
Log.Error(ex.Message, ex, typeof(PageEditorRendererDecorator)); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.