diff --git a/src/Umbraco.Web.UI/Views/Partials/BlockList/Default.cshtml b/src/Umbraco.Web.UI.NetCore/Views/Partials/BlockList/Default.cshtml similarity index 77% rename from src/Umbraco.Web.UI/Views/Partials/BlockList/Default.cshtml rename to src/Umbraco.Web.UI.NetCore/Views/Partials/BlockList/Default.cshtml index c94a51f6d9..6da7e63ac6 100644 --- a/src/Umbraco.Web.UI/Views/Partials/BlockList/Default.cshtml +++ b/src/Umbraco.Web.UI.NetCore/Views/Partials/BlockList/Default.cshtml @@ -1,13 +1,13 @@ -@inherits UmbracoViewPage -@using Umbraco.Core.Models.Blocks -@{ - if (!Model.Any()) { return; } -} -
- @foreach (var block in Model) - { - if (block?.ContentUdi == null) { continue; } - var data = block.Content; - @Html.Partial("BlockList/Components/" + data.ContentType.Alias, block) - } -
+@inherits Umbraco.Web.Common.AspNetCore.UmbracoViewPage +@using Umbraco.Core.Models.Blocks +@{ + if (!Model.Any()) { return; } +} +
+ @foreach (var block in Model) + { + if (block?.ContentUdi == null) { continue; } + var data = block.Content; + @Html.Partial("BlockList/Components/" + data.ContentType.Alias, block) + } +
diff --git a/src/Umbraco.Web.UI/Views/Partials/Grid/Bootstrap3-Fluid.cshtml b/src/Umbraco.Web.UI.NetCore/Views/Partials/Grid/Bootstrap3-Fluid.cshtml similarity index 66% rename from src/Umbraco.Web.UI/Views/Partials/Grid/Bootstrap3-Fluid.cshtml rename to src/Umbraco.Web.UI.NetCore/Views/Partials/Grid/Bootstrap3-Fluid.cshtml index 131b0515ae..b8bb0b521e 100644 --- a/src/Umbraco.Web.UI/Views/Partials/Grid/Bootstrap3-Fluid.cshtml +++ b/src/Umbraco.Web.UI.NetCore/Views/Partials/Grid/Bootstrap3-Fluid.cshtml @@ -1,5 +1,6 @@ -@inherits UmbracoViewPage -@using Umbraco.Web.Templates +@inherits Umbraco.Web.Common.AspNetCore.UmbracoViewPage +@using System.Web +@using Microsoft.AspNetCore.Html @using Newtonsoft.Json.Linq @* @@ -36,25 +37,28 @@ } -@helper renderRow(dynamic row){ -
-
- @foreach ( var area in row.areas ) { -
-
- @foreach (var control in area.controls) { - if (control !=null && control.editor != null && control.editor.view != null ) { - @Html.Partial("grid/editors/base", (object)control) - } - } -
-
} +@functions { + private void renderRow(dynamic row) + { +
+
+ @foreach ( var area in row.areas ) { +
+
+ @foreach (var control in area.controls) { + if (control !=null && control.editor != null && control.editor.view != null ) { + @Html.Partial("grid/editors/base", (object)control) + } + } +
+
} +
-
+ } } @functions { - public static MvcHtmlString RenderElementAttributes(dynamic contentItem) + public static HtmlString RenderElementAttributes(dynamic contentItem) { var attrs = new List(); JObject cfg = contentItem.config; @@ -83,6 +87,6 @@ attrs.Add("style='" + HttpUtility.HtmlAttributeEncode(string.Join(" ", cssVals)) + "'"); } - return new MvcHtmlString(string.Join(" ", attrs)); + return new HtmlString(string.Join(" ", attrs)); } } diff --git a/src/Umbraco.Web.UI/Views/Partials/Grid/Bootstrap3.cshtml b/src/Umbraco.Web.UI.NetCore/Views/Partials/Grid/Bootstrap3.cshtml similarity index 63% rename from src/Umbraco.Web.UI/Views/Partials/Grid/Bootstrap3.cshtml rename to src/Umbraco.Web.UI.NetCore/Views/Partials/Grid/Bootstrap3.cshtml index c30feb2165..5453a7aac5 100644 --- a/src/Umbraco.Web.UI/Views/Partials/Grid/Bootstrap3.cshtml +++ b/src/Umbraco.Web.UI.NetCore/Views/Partials/Grid/Bootstrap3.cshtml @@ -1,5 +1,6 @@ -@inherits UmbracoViewPage -@using Umbraco.Web.Templates +@inherits Umbraco.Web.Common.AspNetCore.UmbracoViewPage +@using System.Web +@using Microsoft.AspNetCore.Html @using Newtonsoft.Json.Linq @if (Model != null && Model.sections != null) @@ -34,31 +35,37 @@
} -@helper renderRow(dynamic row, bool singleColumn){ -
- @if (singleColumn) { - @:
- } -
- @foreach ( var area in row.areas ) { -
-
- @foreach (var control in area.controls) { - if (control !=null && control.editor != null && control.editor.view != null ) { - @Html.Partial("grid/editors/base", (object)control) - } - } -
-
} +@functions { + + private void renderRow(dynamic row, bool singleColumn) + { +
+ @if (singleColumn) { + @:
+ } +
+ @foreach ( var area in row.areas ) { +
+
+ @foreach (var control in area.controls) { + if (control !=null && control.editor != null && control.editor.view != null ) { + @Html.Partial("grid/editors/base", (object)control) + } + } +
+
} +
+ @if (singleColumn) { + @:
+ }
- @if (singleColumn) { - @:
- } -
+ } + } + @functions { - public static MvcHtmlString RenderElementAttributes(dynamic contentItem) + public static HtmlString RenderElementAttributes(dynamic contentItem) { var attrs = new List(); JObject cfg = contentItem.config; @@ -87,6 +94,6 @@ attrs.Add("style=\"" + HttpUtility.HtmlAttributeEncode(string.Join(" ", cssVals)) + "\""); } - return new MvcHtmlString(string.Join(" ", attrs)); + return new HtmlString(string.Join(" ", attrs)); } } diff --git a/src/Umbraco.Web.UI/Views/Partials/Grid/Editors/Base.cshtml b/src/Umbraco.Web.UI.NetCore/Views/Partials/Grid/Editors/Base.cshtml similarity index 75% rename from src/Umbraco.Web.UI/Views/Partials/Grid/Editors/Base.cshtml rename to src/Umbraco.Web.UI.NetCore/Views/Partials/Grid/Editors/Base.cshtml index a86c04819a..d3cdf80f06 100644 --- a/src/Umbraco.Web.UI/Views/Partials/Grid/Editors/Base.cshtml +++ b/src/Umbraco.Web.UI.NetCore/Views/Partials/Grid/Editors/Base.cshtml @@ -1,12 +1,11 @@ @model dynamic -@using Umbraco.Web.Templates @functions { public static string EditorView(dynamic contentItem) { string view = contentItem.editor.render != null ? contentItem.editor.render.ToString() : contentItem.editor.view.ToString(); view = view.ToLower().Replace(".html", ".cshtml"); - + if (!view.Contains("/")) { view = "grid/editors/" + view; } @@ -16,9 +15,9 @@ } @try { - string editor = EditorView(Model); + string editor = EditorView(Model); @Html.Partial(editor, (object)Model) } -catch (Exception ex) { +catch (Exception ex) {
@ex.ToString()
-} \ No newline at end of file +} diff --git a/src/Umbraco.Web.UI/Views/Partials/Grid/Editors/Embed.cshtml b/src/Umbraco.Web.UI.NetCore/Views/Partials/Grid/Editors/Embed.cshtml similarity index 80% rename from src/Umbraco.Web.UI/Views/Partials/Grid/Editors/Embed.cshtml rename to src/Umbraco.Web.UI.NetCore/Views/Partials/Grid/Editors/Embed.cshtml index 4a915a444b..250310217c 100644 --- a/src/Umbraco.Web.UI/Views/Partials/Grid/Editors/Embed.cshtml +++ b/src/Umbraco.Web.UI.NetCore/Views/Partials/Grid/Editors/Embed.cshtml @@ -1,5 +1,6 @@ -@model dynamic -@using Umbraco.Web.Templates +@using Umbraco.Core +@model dynamic + @{ string embedValue = Convert.ToString(Model.value); embedValue = embedValue.DetectIsJson() ? Model.value.preview : Model.value; diff --git a/src/Umbraco.Web.UI.NetCore/Views/Partials/Grid/Editors/Macro.cshtml b/src/Umbraco.Web.UI.NetCore/Views/Partials/Grid/Editors/Macro.cshtml new file mode 100644 index 0000000000..26c6e8a09c --- /dev/null +++ b/src/Umbraco.Web.UI.NetCore/Views/Partials/Grid/Editors/Macro.cshtml @@ -0,0 +1,17 @@ +@inherits Umbraco.Web.Common.AspNetCore.UmbracoViewPage +@using Umbraco.Web.Website +@inject UmbracoHelper Umbraco; + +@if (Model.value != null) +{ + string macroAlias = Model.value.macroAlias.ToString(); + var parameters = new Dictionary(); + foreach (var mpd in Model.value.macroParamsDictionary) + { + parameters.Add(mpd.Name, mpd.Value); + } + + + @Umbraco.RenderMacro(macroAlias, parameters) + +} diff --git a/src/Umbraco.Web.UI.NetCore/Views/Partials/Grid/Editors/Rte.cshtml b/src/Umbraco.Web.UI.NetCore/Views/Partials/Grid/Editors/Rte.cshtml new file mode 100644 index 0000000000..b7bac31bd1 --- /dev/null +++ b/src/Umbraco.Web.UI.NetCore/Views/Partials/Grid/Editors/Rte.cshtml @@ -0,0 +1,13 @@ +@model dynamic +@using Umbraco.Web.Templates +@inject HtmlLocalLinkParser HtmlLocalLinkParser; +@inject HtmlUrlParser HtmlUrlParser; +@inject HtmlImageSourceParser HtmlImageSourceParser; + +@{ + + var value = HtmlUrlParser.EnsureUrls(Model.value.ToString()); + value = HtmlImageSourceParser.EnsureImageSources(value); + value = HtmlLocalLinkParser.EnsureInternalLinks(value); +} +@Html.Raw(value) diff --git a/src/Umbraco.Web.UI/Views/Partials/Grid/Editors/TextString.cshtml b/src/Umbraco.Web.UI.NetCore/Views/Partials/Grid/Editors/TextString.cshtml similarity index 87% rename from src/Umbraco.Web.UI/Views/Partials/Grid/Editors/TextString.cshtml rename to src/Umbraco.Web.UI.NetCore/Views/Partials/Grid/Editors/TextString.cshtml index 0e47b5bd78..2ceac54e26 100644 --- a/src/Umbraco.Web.UI/Views/Partials/Grid/Editors/TextString.cshtml +++ b/src/Umbraco.Web.UI.NetCore/Views/Partials/Grid/Editors/TextString.cshtml @@ -1,6 +1,6 @@ -@model dynamic -@using Umbraco.Web.Composing -@using Umbraco.Web.Templates +@using System.Web +@using Umbraco.Extensions +@model dynamic @if (Model.editor.config.markup != null) { diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 93f13e73e0..0e07e0af50 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -200,14 +200,6 @@ Designer - - - - - - - - Web.Template.config Designer diff --git a/src/Umbraco.Web.UI/Views/Partials/Grid/Editors/Macro.cshtml b/src/Umbraco.Web.UI/Views/Partials/Grid/Editors/Macro.cshtml deleted file mode 100644 index e0822808d8..0000000000 --- a/src/Umbraco.Web.UI/Views/Partials/Grid/Editors/Macro.cshtml +++ /dev/null @@ -1,17 +0,0 @@ -@inherits UmbracoViewPage -@using Umbraco.Web.Templates - - -@if (Model.value != null) -{ - string macroAlias = Model.value.macroAlias.ToString(); - ViewDataDictionary parameters = new ViewDataDictionary(); - foreach (dynamic mpd in Model.value.macroParamsDictionary) - { - parameters.Add(mpd.Name, mpd.Value); - } - - - @Umbraco.RenderMacro(macroAlias, parameters) - -} diff --git a/src/Umbraco.Web.UI/Views/Partials/Grid/Editors/Rte.cshtml b/src/Umbraco.Web.UI/Views/Partials/Grid/Editors/Rte.cshtml deleted file mode 100644 index 715aad12d6..0000000000 --- a/src/Umbraco.Web.UI/Views/Partials/Grid/Editors/Rte.cshtml +++ /dev/null @@ -1,20 +0,0 @@ -@model dynamic -@using Umbraco.Web.Composing -@using Umbraco.Web.Templates - -@* - TODO: When this project is asp.net core we can @inject HtmlLocalLinkParser etc (or come up with something even better) -*@ - -@using Microsoft.Extensions.DependencyInjection - -@{ - var htmlLocalLinkParser = Current.Factory.GetRequiredService(); - var htmlUrlParser = Current.Factory.GetRequiredService(); - var htmlImageSourceParser = Current.Factory.GetRequiredService(); - - var value = htmlUrlParser.EnsureUrls(Model.value.ToString()); - value = htmlImageSourceParser.EnsureImageSources(value); - value = htmlLocalLinkParser.EnsureInternalLinks(value); -} -@Html.Raw(value) diff --git a/src/Umbraco.Web.Website/Extensions/HtmlHelperRenderExtensions.cs b/src/Umbraco.Web.Website/Extensions/HtmlHelperRenderExtensions.cs index a48ed435bf..a367dc71ea 100644 --- a/src/Umbraco.Web.Website/Extensions/HtmlHelperRenderExtensions.cs +++ b/src/Umbraco.Web.Website/Extensions/HtmlHelperRenderExtensions.cs @@ -893,7 +893,7 @@ namespace Umbraco.Extensions /// /// The HTML encoded text with text line breaks replaced with HTML line breaks (<br />). /// - public static IHtmlContent ReplaceLineBreaks(this HtmlHelper helper, string text) + public static IHtmlContent ReplaceLineBreaks(this IHtmlHelper helper, string text) { return StringUtilities.ReplaceLineBreaks(text); } @@ -905,7 +905,7 @@ namespace Umbraco.Extensions /// /// The text to create a hash from /// Hash of the text string - public static string CreateHash(this HtmlHelper helper, string text) + public static string CreateHash(this IHtmlHelper helper, string text) { return text.GenerateHash(); }