diff --git a/src/Umbraco.Web.UI/Views/Partials/Grid/Bootstrap2-Fluid.cshtml b/src/Umbraco.Web.UI/Views/Partials/Grid/Bootstrap2-Fluid.cshtml new file mode 100644 index 0000000000..f3241071a6 --- /dev/null +++ b/src/Umbraco.Web.UI/Views/Partials/Grid/Bootstrap2-Fluid.cshtml @@ -0,0 +1,80 @@ +@inherits UmbracoViewPage +@using Umbraco.Web.Templates +@using Newtonsoft.Json.Linq + +@if (Model != null && Model.sections != null) +{ + var oneColumn = ((System.Collections.ICollection)Model.sections).Count == 1; + +
+ @if (oneColumn) + { + foreach (var section in Model.sections) { +
+ @foreach (var row in section.rows) { + @renderRow(row, true); + } +
+ } + }else { +
+
+ @foreach (var s in Model.sections) { +
+
+ @foreach (var row in s.rows) { + @renderRow(row, false); + } +
+
+ } +
+
+ } +
+} + +@helper renderRow(dynamic row, bool singleColumn){ +
+ @Umbraco.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) + } + } +
+
} +
+ @Umbraco.If(singleColumn, "
") +
+} + +@functions { + public static MvcHtmlString RenderElementAttributes(dynamic contentItem) + { + var attrs = new List(); + JObject cfg = contentItem.config; + + if(cfg != null) + foreach (JProperty property in cfg.Properties()) { + attrs.Add(property.Name + "='" + property.Value.ToString() + "'"); + } + + JObject style = contentItem.styles; + + if (style != null) { + var cssVals = new List(); + foreach (JProperty property in style.Properties()) + cssVals.Add(property.Name + ":" + property.Value.ToString() + ";"); + + if (cssVals.Any()) + attrs.Add("style='" + string.Join(" ", cssVals) + "'"); + } + + return new MvcHtmlString(string.Join(" ", attrs)); + } +} \ No newline at end of file diff --git a/src/Umbraco.Web.UI/Views/Partials/Grid/Bootstrap2.cshtml b/src/Umbraco.Web.UI/Views/Partials/Grid/Bootstrap2.cshtml index f3241071a6..8b189ae1a0 100644 --- a/src/Umbraco.Web.UI/Views/Partials/Grid/Bootstrap2.cshtml +++ b/src/Umbraco.Web.UI/Views/Partials/Grid/Bootstrap2.cshtml @@ -17,8 +17,8 @@ } }else { -
-
+
+
@foreach (var s in Model.sections) {
@@ -36,8 +36,8 @@ @helper renderRow(dynamic row, bool singleColumn){
- @Umbraco.If(singleColumn, "
") -
+ @Umbraco.If(singleColumn, "
") +
@foreach ( var area in row.areas ) {
diff --git a/src/Umbraco.Web.UI/Views/Partials/Grid/Bootstrap3-Fluid.cshtml b/src/Umbraco.Web.UI/Views/Partials/Grid/Bootstrap3-Fluid.cshtml new file mode 100644 index 0000000000..ca196661e2 --- /dev/null +++ b/src/Umbraco.Web.UI/Views/Partials/Grid/Bootstrap3-Fluid.cshtml @@ -0,0 +1,76 @@ +@inherits UmbracoViewPage +@using Umbraco.Web.Templates +@using Newtonsoft.Json.Linq + +@if (Model != null && Model.sections != null) +{ + var oneColumn = ((System.Collections.ICollection)Model.sections).Count == 1; + +
+ @if (oneColumn) + { + foreach (var section in Model.sections) { +
+ @foreach (var row in section.rows) { + @renderRow(row); + } +
+ } + }else { +
+ @foreach (var s in Model.sections) { +
+
+ @foreach (var row in s.rows) { + @renderRow(row); + } +
+
+ } +
+ } +
+} + +@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 { + public static MvcHtmlString RenderElementAttributes(dynamic contentItem) + { + var attrs = new List(); + JObject cfg = contentItem.config; + + if(cfg != null) + foreach (JProperty property in cfg.Properties()) { + attrs.Add(property.Name + "='" + property.Value.ToString() + "'"); + } + + JObject style = contentItem.styles; + + if (style != null) { + var cssVals = new List(); + foreach (JProperty property in style.Properties()) + cssVals.Add(property.Name + ":" + property.Value.ToString() + ";"); + + if (cssVals.Any()) + attrs.Add("style='" + string.Join(" ", cssVals) + "'"); + } + + return new MvcHtmlString(string.Join(" ", attrs)); + } +} \ No newline at end of file