diff --git a/src/Umbraco.Web.UI.NetCore/Views/Partials/grid/bootstrap3-fluid.cshtml b/src/Umbraco.Web.UI.NetCore/Views/Partials/grid/bootstrap3-fluid.cshtml index 7e349bd7f3..84004929bd 100644 --- a/src/Umbraco.Web.UI.NetCore/Views/Partials/grid/bootstrap3-fluid.cshtml +++ b/src/Umbraco.Web.UI.NetCore/Views/Partials/grid/bootstrap3-fluid.cshtml @@ -14,7 +14,8 @@
@if (oneColumn) { - foreach (var section in Model.sections) { + foreach (var section in Model.sections) + {
@foreach (var row in section.rows) { @@ -22,12 +23,15 @@ }
} - }else { + } + else + {
- @foreach (var s in Model.sections) { + @foreach (var sec in Model.sections) + {
-
- @foreach (var row in s.rows) +
+ @foreach (var row in sec.rows) { renderRow(row); } @@ -39,38 +43,46 @@
} -@functions { - private void renderRow(dynamic row) +@functions{ + + private async Task renderRow(dynamic row) {
- @foreach ( var area in row.areas ) { + @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) + @foreach (var control in area.controls) + { + if (control != null && control.editor != null && control.editor.view != null) + { + @await Html.PartialAsync("grid/editors/base", (object)control) } }
-
} +
+ }
} } -@functions { +@functions{ + public static HtmlString RenderElementAttributes(dynamic contentItem) { var attrs = new List(); JObject cfg = contentItem.config; - if(cfg != null) + if (cfg != null) + { foreach (JProperty property in cfg.Properties()) { var propertyValue = HttpUtility.HtmlAttributeEncode(property.Value.ToString()); attrs.Add(property.Name + "=\"" + propertyValue + "\""); } + } JObject style = contentItem.styles; diff --git a/src/Umbraco.Web.UI.NetCore/Views/Partials/grid/bootstrap3.cshtml b/src/Umbraco.Web.UI.NetCore/Views/Partials/grid/bootstrap3.cshtml index cf35714692..ebe1cf725f 100644 --- a/src/Umbraco.Web.UI.NetCore/Views/Partials/grid/bootstrap3.cshtml +++ b/src/Umbraco.Web.UI.NetCore/Views/Partials/grid/bootstrap3.cshtml @@ -10,7 +10,8 @@
@if (oneColumn) { - foreach (var section in Model.sections) { + foreach (var section in Model.sections) + {
@foreach (var row in section.rows) { @@ -18,13 +19,16 @@ }
} - }else { + } + else + {
- @foreach (var s in Model.sections) { + @foreach (var sec in Model.sections) + {
-
- @foreach (var row in s.rows) +
+ @foreach (var row in sec.rows) { renderRow(row, false); } @@ -37,25 +41,29 @@
} -@functions { +@functions{ - private void renderRow(dynamic row, bool singleColumn) + private async Task renderRow(dynamic row, bool singleColumn) {
@if (singleColumn) { @:
}
- @foreach ( var area in row.areas ) { + @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) + @foreach (var control in area.controls) + { + if (control != null && control.editor != null && control.editor.view != null) + { + @await Html.PartialAsync("grid/editors/base", (object)control) } }
-
} +
+ }
@if (singleColumn) { @:
@@ -65,23 +73,26 @@ } +@functions{ -@functions { public static HtmlString RenderElementAttributes(dynamic contentItem) { var attrs = new List(); JObject cfg = contentItem.config; - if(cfg != null) + if (cfg != null) + { foreach (JProperty property in cfg.Properties()) { var propertyValue = HttpUtility.HtmlAttributeEncode(property.Value.ToString()); attrs.Add(property.Name + "=\"" + propertyValue + "\""); } + } JObject style = contentItem.styles; - if (style != null) { + if (style != null) + { var cssVals = new List(); foreach (JProperty property in style.Properties()) { diff --git a/src/Umbraco.Web.UI.NetCore/Views/Partials/grid/editors/base.cshtml b/src/Umbraco.Web.UI.NetCore/Views/Partials/grid/editors/base.cshtml index d3cdf80f06..eca6381fd0 100644 --- a/src/Umbraco.Web.UI.NetCore/Views/Partials/grid/editors/base.cshtml +++ b/src/Umbraco.Web.UI.NetCore/Views/Partials/grid/editors/base.cshtml @@ -1,23 +1,27 @@ -@model dynamic +@model dynamic + +@try +{ + string editor = EditorView(Model); + @await Html.PartialAsync(editor, (object)Model) +} +catch (Exception ex) +{ +
@ex.ToString()
+} + +@functions{ -@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("/")) { + if (!view.Contains("/")) + { view = "grid/editors/" + view; } return view; } } -@try -{ - string editor = EditorView(Model); - @Html.Partial(editor, (object)Model) -} -catch (Exception ex) { -
@ex.ToString()
-} diff --git a/src/Umbraco.Web.UI.NetCore/Views/Partials/grid/editors/media.cshtml b/src/Umbraco.Web.UI.NetCore/Views/Partials/grid/editors/media.cshtml index 7e2d20fdbf..4cc31d0754 100644 --- a/src/Umbraco.Web.UI.NetCore/Views/Partials/grid/editors/media.cshtml +++ b/src/Umbraco.Web.UI.NetCore/Views/Partials/grid/editors/media.cshtml @@ -1,11 +1,13 @@ -@model dynamic +@model dynamic @using Umbraco.Cms.Core.Media @using Umbraco.Cms.Core.PropertyEditors.ValueConverters @inject IImageUrlGenerator ImageUrlGenerator @if (Model.value != null) { var url = Model.value.image; - if(Model.editor.config != null && Model.editor.config.size != null){ + + if (Model.editor.config != null && Model.editor.config.size != null) + { if (Model.value.coordinates != null) { url = ImageCropperTemplateCoreExtensions.GetCropUrl( 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 index 696b058212..e14c6e1a97 100644 --- a/src/Umbraco.Web.UI.NetCore/Views/Partials/grid/editors/rte.cshtml +++ b/src/Umbraco.Web.UI.NetCore/Views/Partials/grid/editors/rte.cshtml @@ -1,13 +1,13 @@ -@using Umbraco.Cms.Core.Templates +@using Umbraco.Cms.Core.Templates @model dynamic @inject HtmlLocalLinkParser HtmlLocalLinkParser; @inject HtmlUrlParser HtmlUrlParser; @inject HtmlImageSourceParser HtmlImageSourceParser; @{ - var value = HtmlLocalLinkParser.EnsureInternalLinks(Model.value.ToString()); value = HtmlUrlParser.EnsureUrls(value); value = HtmlImageSourceParser.EnsureImageSources(value); } + @Html.Raw(value)