Created
December 13, 2020 17:42
-
-
Save sotirisf/074c1513d4dd4234d17d6cd4d539faad to your computer and use it in GitHub Desktop.
uMazel 2.0 Block Elements Handling 2
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
@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