Last active
March 9, 2018 21:48
-
-
Save hartviglarsen/ef7c8288bec40421872f443511c261ae to your computer and use it in GitHub Desktop.
Simple Bulma grid for Umbraco
This file contains hidden or 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
| @inherits UmbracoViewPage<dynamic> | |
| @if (Model != null && Model.sections != null) | |
| { | |
| bool oneColumn = ((System.Collections.ICollection)Model.sections).Count == 1; | |
| <div class="umb-grid"> | |
| @if (oneColumn) | |
| { | |
| foreach (var section in Model.sections) | |
| { | |
| foreach (var row in section.rows) | |
| { | |
| @renderRow(row); | |
| } | |
| } | |
| } | |
| else | |
| { | |
| <div class="columns"> | |
| @foreach (var s in Model.sections) | |
| { | |
| <div class="column is-@s.grid"> | |
| @foreach (var row in s.rows) | |
| { | |
| @renderRow(row); | |
| } | |
| </div> | |
| } | |
| </div> | |
| } | |
| </div> | |
| } | |
| @helper renderRow(dynamic row) | |
| { | |
| <div class="columns"> | |
| @foreach (var area in row.areas) | |
| { | |
| <div class="column is-@area.grid"> | |
| @foreach (var control in area.controls) | |
| { | |
| if (control != null && control.editor != null && control.editor.view != null ) | |
| { | |
| <text>@Html.Partial("grid/editors/base", (object)control)</text> | |
| } | |
| } | |
| </div> | |
| } | |
| </div> | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment