Created
December 13, 2020 17:14
-
-
Save sotirisf/9920e28bc3b1ac934d387e901b5b229a to your computer and use it in GitHub Desktop.
uMazel 2.0 block elements handling
This file contains 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
@using Umbraco.Web.PublishedModels; | |
@inherits Umbraco.Web.Mvc.UmbracoViewPage | |
@{ | |
if (!(Model is IAbstractPageSections)) { return; } | |
var introBlock = (Model as IAbstractPageSections).IntroSection; | |
if (introBlock.Any(x => (x.Content as IAbstractSectionBlock).Disabled == false)) | |
{ | |
@Html.Partial(MVC.Shared.Views.Common._RenderBlock, introBlock.Where(x => !(x.Content as IAbstractSectionBlock).Disabled).FirstOrDefault()) | |
} | |
var blocks = (Model as IAbstractPageSections).Sections; | |
if (!blocks.Any()) { return; } | |
foreach (var block in blocks.Where(x => (x.Content as IAbstractSectionBlock).Disabled == false)) | |
{ | |
@Html.Partial(MVC.Shared.Views.Common._RenderBlock, block) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment