diff --git a/src/Umbraco.Web.UI/Views/Partials/Grid/Bootstrap2.cshtml b/src/Umbraco.Web.UI/Views/Partials/Grid/Bootstrap2.cshtml
index fee047243b..f3241071a6 100644
--- a/src/Umbraco.Web.UI/Views/Partials/Grid/Bootstrap2.cshtml
+++ b/src/Umbraco.Web.UI/Views/Partials/Grid/Bootstrap2.cshtml
@@ -2,6 +2,57 @@
@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)
{
@@ -9,9 +60,10 @@
JObject cfg = contentItem.config;
if(cfg != null)
- foreach (JProperty property in cfg.Properties())
+ foreach (JProperty property in cfg.Properties()) {
attrs.Add(property.Name + "='" + property.Value.ToString() + "'");
-
+ }
+
JObject style = contentItem.styles;
if (style != null) {
@@ -25,53 +77,4 @@
return new MvcHtmlString(string.Join(" ", attrs));
}
-}
-
-
-@if (Model != null && !string.IsNullOrEmpty(Model.ToString()))
-{
- var onlyOneColumn = Model.sections != null ? ((System.Collections.ICollection)Model.sections).Count : 0;
-
-
-
-
- @foreach (var s in Model.sections){
-
-
-
-
-
-
- @foreach (var row in s.rows){
-
-
-
- @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)
- }
- }
-
-
-
-
- }
-
-
-
- }
-
-
-
-
-
- }
-
-
-
}
\ No newline at end of file
diff --git a/src/Umbraco.Web.UI/Views/Partials/Grid/Bootstrap3.cshtml b/src/Umbraco.Web.UI/Views/Partials/Grid/Bootstrap3.cshtml
index 36762a76f8..e672aa2a11 100644
--- a/src/Umbraco.Web.UI/Views/Partials/Grid/Bootstrap3.cshtml
+++ b/src/Umbraco.Web.UI/Views/Partials/Grid/Bootstrap3.cshtml
@@ -2,6 +2,57 @@
@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)
{
@@ -9,9 +60,10 @@
JObject cfg = contentItem.config;
if(cfg != null)
- foreach (JProperty property in cfg.Properties())
+ foreach (JProperty property in cfg.Properties()) {
attrs.Add(property.Name + "='" + property.Value.ToString() + "'");
-
+ }
+
JObject style = contentItem.styles;
if (style != null) {
@@ -25,53 +77,4 @@
return new MvcHtmlString(string.Join(" ", attrs));
}
-}
-
-
-@if (Model != null && !string.IsNullOrEmpty(Model.ToString()))
-{
- var onlyOneColumn = Model.sections != null ? ((System.Collections.ICollection)Model.sections).Count : 0;
-
-
-
-
- @foreach (var s in Model.sections){
-
-
-
-
-
-
- @foreach (var row in s.rows){
-
-
-
- @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)
- }
- }
-
-
-
-
- }
-
-
-
- }
-
-
-
-
-
- }
-
-
-
}
\ No newline at end of file