Skip to content

Instantly share code, notes, and snippets.

@hartviglarsen
Last active March 9, 2018 21:48
Show Gist options
  • Select an option

  • Save hartviglarsen/ef7c8288bec40421872f443511c261ae to your computer and use it in GitHub Desktop.

Select an option

Save hartviglarsen/ef7c8288bec40421872f443511c261ae to your computer and use it in GitHub Desktop.
Simple Bulma grid for Umbraco
@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