Skip to content

Instantly share code, notes, and snippets.

@sotirisf
Created December 13, 2020 17:42
Show Gist options
  • Save sotirisf/074c1513d4dd4234d17d6cd4d539faad to your computer and use it in GitHub Desktop.
Save sotirisf/074c1513d4dd4234d17d6cd4d539faad to your computer and use it in GitHub Desktop.
uMazel 2.0 Block Elements Handling 2
@inherits UmbracoViewPage<Umbraco.Core.Models.Blocks.BlockListItem>
@{
var isMulticol = (ViewData["isMultiCol"] ?? "0").ToString();
switch (Model.Content.ContentType.Alias)
{
default:
var controllerContext = Html.ViewContext.Controller.ControllerContext;
var cdfResult = ViewEngines.Engines.FindPartialView(controllerContext, "SectionCdf/" + Model.Content.ContentType.Alias + "Cdf");
if (cdfResult.View != null)
{
@Html.Partial("SectionCdf/" + Model.Content.ContentType.Alias + "Cdf", Model)
}
var sectionResult = ViewEngines.Engines.FindPartialView(controllerContext, "SectionBlocks/Cached/" + Model.Content.ContentType.Alias);
if (sectionResult.View != null)
{
@Html.CachedPartial("SectionBlocks/Cached/" + Model.Content.ContentType.Alias, Model, 600, false, false
, contextualKeyBuilder: (m, viewData) => Model.Content.Key.ToString() + System.Threading.Thread.CurrentThread.CurrentUICulture.NativeName.ToString()
, viewData: new ViewDataDictionary { { "isMultiCol", isMulticol }, { "multiColCss", ViewData["multiColCss"] ?? "" } })
}
else
{
@Html.Partial("SectionBlocks/Uncached/" + Model.Content.ContentType.Alias, Model
, viewData: new ViewDataDictionary { { "isMultiCol", isMulticol }, { "multiColCss", ViewData["multiColCss"] ?? "" } })
}
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment