Error executing template "Designs/Swift/Paragraph/Swift_ArticleHeader.cshtml" System.InvalidOperationException: A prior operation on this collection was interrupted by an exception. Collection's state is no longer trusted. at System.Runtime.CompilerServices.ConditionalWeakTable`2.Container.VerifyIntegrity() at System.Runtime.CompilerServices.ConditionalWeakTable`2.Container.CreateEntryNoResize(TKey key, TValue value) at System.Runtime.CompilerServices.ConditionalWeakTable`2.Add(TKey key, TValue value) at Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax.MarkupTextLiteralSyntax.SetAnnotations(SyntaxAnnotation[] annotations) at Microsoft.AspNetCore.Razor.Language.Legacy.TokenizerBackedParser`1.GetNodeWithSpanContext[TNode](TNode node) at Microsoft.AspNetCore.Razor.Language.Legacy.HtmlMarkupParser.OtherParserBlock(SyntaxListBuilder`1& builder) at Microsoft.AspNetCore.Razor.Language.Legacy.HtmlMarkupParser.ParseDocument() at Microsoft.AspNetCore.Razor.Language.Legacy.RazorParser.Parse(RazorSourceDocument source) at Microsoft.AspNetCore.Razor.Language.DefaultRazorEngine.Process(RazorCodeDocument document) at Microsoft.AspNetCore.Razor.Language.RazorTemplateEngine.GenerateCode(RazorCodeDocument codeDocument) at RazorEngine.Compilation.CompilerServiceBase.GenerateCodeFile(RazorTemplateEngine templateEngine, RazorCodeDocument document) at RazorEngine.Compilation.CompilerServiceBase.GetGeneratorResult(IEnumerable`1 namespaces, TypeContext context) at RazorEngine.Compilation.CompilerServiceBase.GetCodeCompileUnit(TypeContext context) at Dynamicweb.Rendering.Compatibility.RoslynCompilerServiceBase.CompileType(TypeContext context) at RazorEngine.Templating.RazorEngineCore.CreateTemplateType(ITemplateSource razorTemplate, Type modelType) at RazorEngine.Templating.RazorEngineCore.Compile(ITemplateKey key, Type modelType) at RazorEngine.Templating.RazorEngineService.CompileAndCacheInternal(ITemplateKey key, Type modelType) at RazorEngine.Templating.RazorEngineService.GetCompiledTemplate(ITemplateKey key, Type modelType, Boolean compileOnCacheMiss) at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag) at RazorEngine.Templating.DynamicWrapperService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag) at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String name, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag) at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer) at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter) at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag) at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String templateSource, String name, Type modelType, Object model, DynamicViewBag viewBag) at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template) at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) at Dynamicweb.Rendering.Template.RenderRazorTemplate()
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 3 @{ 4 var pageItem = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page).Item; 5 var parms = new Dictionary<string, object>(); 6 parms.Add("cssClass", "h-100 w-100"); 7 parms.Add("columns", Model.GridRowColumnCount); 8 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : string.Empty; 9 string layout = Model.Item.GetRawValueString("Layout", "CardCenterBottom"); 10 bool hideCoverImage = Model.Item?.GetBoolean("HideCoverImage") ?? false; 11 bool hideTitle = Model.Item?.GetBoolean("HideTitle") ?? false; 12 bool hideSummary = Model.Item?.GetBoolean("HideSummary") ?? false; 13 bool hidePublishedDate = Model.Item?.GetBoolean("HidePublishedDate") ?? false; 14 bool hideAuthor = Model.Item?.GetBoolean("HideAuthor") ?? false; 15 var pageTitle = !string.IsNullOrEmpty(pageItem.GetString("Title")) && !hideTitle ? pageItem.GetString("Title") : string.Empty; 16 var pageSummary = !string.IsNullOrEmpty(pageItem.GetString("Summary")) && !hideSummary ? pageItem.GetString("Summary") : string.Empty; 17 var pageCoverImage = pageItem.GetFile("CoverImage") is object && !hideCoverImage ? pageItem.GetFile("CoverImage") : null; 18 var pageAuthor = pageItem?.GetUsers("Author")?.FirstOrDefault() ?? null; 19 var pagePublishedDate = !string.IsNullOrEmpty(pageItem.GetString("PublishedDate")) && !hidePublishedDate ? pageItem.GetDateTime("PublishedDate").ToShortDateString() : string.Empty; 20 var pagePublishedDateDatetime = !string.IsNullOrEmpty(pagePublishedDate) ? pageItem.GetDateTime("PublishedDate").ToString("yyyy-MM-dd") : string.Empty; 21 string titleFontSize = Model.Item.GetRawValueString("TitleFontSize", "h3"); 22 string subtitleFontSize = Model.Item.GetRawValueString("SubtitleFontSize", "fs-5"); 23 string iconPath = "/Files/Templates/Designs/Swift/Assets/icons/"; 24 string authorImagePath = pageAuthor is object && pageAuthor?.Image is object ? $"/Admin/Public/GetImage.ashx?image={pageAuthor?.Image}&width=48&height=48&Crop=0&format=webp" : string.Empty; 25 string headingLevel = Model.Item.GetString("HeadingLevel", "h2"); 26 string headingLevelStart = $"<{headingLevel} class=\"{titleFontSize} m-0\" itemprop=\"headline\">"; 27 string headingLevelStop = $"</{headingLevel}>"; 28 string contentPadding = Model.Item.GetRawValueString("ContentPadding", string.Empty); 29 string order = layout == "InfoTopAlignedLeftImageBottom" || layout == "InfoTopAlignedCenterImageBottom" ? " order-first" : string.Empty; 30 string textAlignment = layout == "InfoTopAlignedCenterImageBottom" ? " text-center" : string.Empty; 31 string wrapperAlignment = layout == "InfoTopAlignedCenterImageBottom" || layout == "InfoCardAboveImageAlignedBottom" ? " justify-content-center" : string.Empty; 32 string infoCardBackground = string.IsNullOrEmpty(theme) ? "background-color:var(--swift-background-color); " : string.Empty; 33 34 switch (contentPadding){ 35 case "none": 36 contentPadding = string.Empty; 37 break; 38 case "small": 39 contentPadding = " p-3"; 40 break; 41 case "large": 42 contentPadding = " p-5"; 43 break; 44 } 45 } 46 47 @switch(layout){ 48 case "InfoAboveImageAlignedCenter": 49 if ((pageCoverImage != null || !string.IsNullOrEmpty(pageTitle) || !string.IsNullOrEmpty(pageSummary)) || (pageAuthor != null && !hideAuthor || !string.IsNullOrEmpty(pagePublishedDate))) 50 { 51 <div class="item_@(Model.Item.SystemName.ToLower())"> 52 @{ 53 if (pageCoverImage != null || !string.IsNullOrEmpty(pageTitle) || !string.IsNullOrEmpty(pageSummary)){ 54 <div class="position-relative@(theme)" style="aspect-ratio: 32/9"> 55 @if (pageCoverImage != null){ 56 <div style="aspect-ratio: 32/9"> 57 @RenderPartial("Components/Image.cshtml", pageCoverImage ?? new Dynamicweb.Frontend.FileViewModel(), parms) 58 </div> 59 } 60 @if (!string.IsNullOrEmpty(pageTitle) || !string.IsNullOrEmpty(pageSummary)) 61 { 62 <div class="container-xl d-flex flex-column gap-3 align-items-center justify-content-center text-center position-absolute top-0 bottom-0 end-0 start-0@(contentPadding)"> 63 @if (!string.IsNullOrEmpty(pageTitle)) 64 { 65 @headingLevelStart 66 @pageTitle 67 @headingLevelStop 68 } 69 @if (!string.IsNullOrEmpty(pageSummary)) 70 { 71 <h5 class="@subtitleFontSize m-0">@pageSummary</h5> 72 } 73 </div> 74 } 75 </div> 76 } 77 if (pageAuthor != null && !hideAuthor || !string.IsNullOrEmpty(pagePublishedDate)){ 78 <div class="d-flex align-items-center justify-content-center gap-3@(theme)@(contentPadding)"> 79 @if (pageAuthor != null && !hideAuthor) 80 { 81 <div class="d-flex align-items-center gap-3"> 82 @if (pageAuthor != null && !hideAuthor) 83 { 84 <div class="d-flex align-items-center gap-2"> 85 @if (!string.IsNullOrEmpty(pageAuthor.Image)) 86 { 87 <img class="img-fluid rounded-circle" src="@authorImagePath" loading="lazy" width="32" height="32"> 88 } 89 else 90 { 91 <div class="rounded-circle icon-1 p-2" style="background-color: var(--swift-foreground-color);color:var(--swift-background-color)"> 92 @ReadFile(iconPath + "user.svg") 93 </div> 94 } 95 @if (!string.IsNullOrEmpty(pageAuthor.Name)) 96 { 97 <div class="fs-7 opacity-85" itemprop="author">@pageAuthor.Name</div> 98 } 99 </div> 100 } 101 @if (!string.IsNullOrEmpty(pagePublishedDate)) 102 { 103 <time class="fs-7 opacity-85" datetime="@pagePublishedDateDatetime" itemprop="datePublished">@pagePublishedDate</time> 104 } 105 </div> 106 } 107 </div> 108 } 109 } 110 </div> 111 } 112 break; 113 case "InfoCardAboveImageAlignedBottom": 114 if (pageCoverImage != null || (!string.IsNullOrEmpty(pageTitle) || !string.IsNullOrEmpty(pageSummary) || pageAuthor != null && !hideAuthor || !string.IsNullOrEmpty(pagePublishedDate))) 115 { 116 <div class="item_@(Model.Item.SystemName.ToLower())"> 117 @{ 118 if (pageCoverImage != null) 119 { 120 <div class="mb-n5" style="aspect-ratio: 32/9"> 121 @{ @RenderPartial("Components/Image.cshtml", pageCoverImage ?? new Dynamicweb.Frontend.FileViewModel(), parms) } 122 </div> 123 } 124 if (!string.IsNullOrEmpty(pageTitle) || !string.IsNullOrEmpty(pageSummary) || pageAuthor != null && !hideAuthor || !string.IsNullOrEmpty(pagePublishedDate)){ 125 <div class="position-relative d-flex flex-column align-items-center mx-3"> 126 <div class="d-flex flex-column gap-3 shadow text-center w-100@(theme)" style="@(infoCardBackground)max-width:40rem;"> 127 @if (!string.IsNullOrEmpty(pageTitle) || !string.IsNullOrEmpty(pageSummary) || pageAuthor != null && !hideAuthor || !string.IsNullOrEmpty(pagePublishedDate)) 128 { 129 <div class="grid grid-1@(textAlignment)@(contentPadding)"> 130 @if (!string.IsNullOrEmpty(pageTitle)) 131 { 132 @headingLevelStart 133 @pageTitle 134 @headingLevelStop 135 } 136 @if (!string.IsNullOrEmpty(pageSummary)) 137 { 138 <h5 class="@subtitleFontSize m-0">@pageSummary</h5> 139 } 140 @if (pageAuthor != null && !hideAuthor || !string.IsNullOrEmpty(pagePublishedDate)) 141 { 142 <div class="d-flex align-items-center gap-3@(wrapperAlignment)"> 143 @if (pageAuthor != null && !hideAuthor) 144 { 145 <div class="d-flex align-items-center gap-2"> 146 @if (!string.IsNullOrEmpty(pageAuthor.Image)) 147 { 148 <img class="img-fluid rounded-circle" src="@authorImagePath" loading="lazy" width="32" height="32"> 149 } 150 else 151 { 152 <div class="rounded-circle icon-1 p-2" style="background-color: var(--swift-foreground-color);color:var(--swift-background-color)"> 153 @ReadFile(iconPath + "user.svg") 154 </div> 155 } 156 @if (!string.IsNullOrEmpty(pageAuthor.Name)) 157 { 158 <div class="fs-7 opacity-85" itemprop="author">@pageAuthor.Name</div> 159 } 160 </div> 161 } 162 @if (!string.IsNullOrEmpty(pagePublishedDate)) 163 { 164 <time class="fs-7 opacity-85" datetime="@pagePublishedDateDatetime" itemprop="datePublished">@pagePublishedDate</time> 165 } 166 </div> 167 } 168 </div> 169 } 170 </div> 171 </div> 172 } 173 } 174 </div> 175 } 176 break; 177 case "InfoBottomAlignedLeftImageTop": 178 case "InfoTopAlignedLeftImageBottom": 179 case "InfoTopAlignedCenterImageBottom": 180 if (pageCoverImage != null && !hideCoverImage || !string.IsNullOrEmpty(pageTitle) || !string.IsNullOrEmpty(pageSummary) || pageAuthor != null && !hideAuthor || !string.IsNullOrEmpty(pagePublishedDate)){ 181 <div class="grid grid-1 gap-0@(theme) item_@(Model.Item.SystemName.ToLower())"> 182 @if (pageCoverImage != null) 183 { 184 <div style="aspect-ratio: 32/9"> 185 @{ @RenderPartial("Components/Image.cshtml", pageCoverImage ?? new Dynamicweb.Frontend.FileViewModel(), parms) } 186 </div> 187 } 188 @if (!string.IsNullOrEmpty(pageTitle) || !string.IsNullOrEmpty(pageSummary) || pageAuthor != null && !hideAuthor || !string.IsNullOrEmpty(pagePublishedDate)) 189 { 190 <div class="grid grid-1@(order)@(textAlignment)@(contentPadding)"> 191 @if (!string.IsNullOrEmpty(pageTitle)) 192 { 193 @headingLevelStart 194 @pageTitle 195 @headingLevelStop 196 } 197 @if (!string.IsNullOrEmpty(pageSummary)) 198 { 199 <h5 class="@subtitleFontSize m-0">@pageSummary</h5> 200 } 201 @if (pageAuthor != null && !hideAuthor || !string.IsNullOrEmpty(pagePublishedDate)) 202 { 203 <div class="d-flex align-items-center gap-3@(wrapperAlignment)"> 204 @if (pageAuthor != null && !hideAuthor) 205 { 206 <div class="d-flex align-items-center gap-2"> 207 @if (!string.IsNullOrEmpty(pageAuthor.Image)) 208 { 209 <img class="img-fluid rounded-circle" src="@authorImagePath" loading="lazy" width="32" height="32"> 210 } 211 else 212 { 213 <div class="rounded-circle icon-1 p-2" style="background-color: var(--swift-foreground-color);color:var(--swift-background-color)"> 214 @ReadFile(iconPath + "user.svg") 215 </div> 216 } 217 @if (!string.IsNullOrEmpty(pageAuthor.Name)) 218 { 219 <div class="fs-7 opacity-85" itemprop="author">@pageAuthor.Name</div> 220 } 221 </div> 222 } 223 @if (!string.IsNullOrEmpty(pagePublishedDate)) 224 { 225 <time class="fs-7 opacity-85" datetime="@pagePublishedDateDatetime" itemprop="datePublished">@pagePublishedDate</time> 226 } 227 </div> 228 } 229 </div> 230 } 231 </div> 232 } 233 break; 234 } 235 236 237 @if (Pageview.IsVisualEditorMode && hideCoverImage && hideTitle && hideSummary && hideAuthor && hidePublishedDate) { 238 <div class="alert alert-info mt-3" role="alert"> 239 <span>@Translate("Article header: Edit this column to configure")</span> 240 </div> 241 } 242
Long pedal up form town but best when shuttled to the top. Fast, fun descent. Freeze-thaw cycle isn't awful, but does make this trail rather slick.
Flow trail is a bit tight at the top, but gets really fast as you transition to the lower Rush. Chewed up, lots of braking bumps, but still fun. This line is my preferred line coming down. Awesome with a couple really dry spots in corners. Pretty dry and fast.
Error executing template "Designs/Swift/Paragraph/Swift_Text.cshtml" System.InvalidOperationException: A prior operation on this collection was interrupted by an exception. Collection's state is no longer trusted. at System.Runtime.CompilerServices.ConditionalWeakTable`2.Container.VerifyIntegrity() at System.Runtime.CompilerServices.ConditionalWeakTable`2.Container.CreateEntryNoResize(TKey key, TValue value) at System.Runtime.CompilerServices.ConditionalWeakTable`2.Add(TKey key, TValue value) at Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax.MarkupTextLiteralSyntax.SetAnnotations(SyntaxAnnotation[] annotations) at Microsoft.AspNetCore.Razor.Language.Legacy.TokenizerBackedParser`1.GetNodeWithSpanContext[TNode](TNode node) at Microsoft.AspNetCore.Razor.Language.Legacy.HtmlMarkupParser.OtherParserBlock(SyntaxListBuilder`1& builder) at Microsoft.AspNetCore.Razor.Language.Legacy.HtmlMarkupParser.ParseDocument() at Microsoft.AspNetCore.Razor.Language.Legacy.RazorParser.Parse(RazorSourceDocument source) at Microsoft.AspNetCore.Razor.Language.DefaultRazorEngine.Process(RazorCodeDocument document) at Microsoft.AspNetCore.Razor.Language.RazorTemplateEngine.GenerateCode(RazorCodeDocument codeDocument) at RazorEngine.Compilation.CompilerServiceBase.GenerateCodeFile(RazorTemplateEngine templateEngine, RazorCodeDocument document) at RazorEngine.Compilation.CompilerServiceBase.GetGeneratorResult(IEnumerable`1 namespaces, TypeContext context) at RazorEngine.Compilation.CompilerServiceBase.GetCodeCompileUnit(TypeContext context) at Dynamicweb.Rendering.Compatibility.RoslynCompilerServiceBase.CompileType(TypeContext context) at RazorEngine.Templating.RazorEngineCore.CreateTemplateType(ITemplateSource razorTemplate, Type modelType) at RazorEngine.Templating.RazorEngineCore.Compile(ITemplateKey key, Type modelType) at RazorEngine.Templating.RazorEngineService.CompileAndCacheInternal(ITemplateKey key, Type modelType) at RazorEngine.Templating.RazorEngineService.GetCompiledTemplate(ITemplateKey key, Type modelType, Boolean compileOnCacheMiss) at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag) at RazorEngine.Templating.DynamicWrapperService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag) at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String name, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag) at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer) at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter) at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag) at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String templateSource, String name, Type modelType, Object model, DynamicViewBag viewBag) at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template) at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) at Dynamicweb.Rendering.Template.RenderRazorTemplate()
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog 3 @functions 4 { 5 private string RenderCustomCSS(IEnumerable<string> decorations) 6 { 7 var cssClasses = new List<string>(); 8 9 foreach (var itemId in decorations) 10 { 11 var item = Dynamicweb.Content.Services.Items.GetItem("Swift_Css", itemId); 12 item.TryGetValue("Class", out object classes); 13 14 if (classes is null) 15 { 16 continue; 17 } 18 19 var cssString = (string)classes; 20 21 if (cssString.StartsWith("[")) 22 { 23 var cssArray = Dynamicweb.Core.Converter.Deserialize<string[]>(cssString); 24 cssClasses.AddRange(cssArray); 25 } 26 else 27 { 28 cssClasses.Add(cssString.Replace(",", " ")); 29 } 30 } 31 32 return string.Join(" ", cssClasses).Trim(); 33 } 34 } 35 36 @{ 37 string layout = Model.Item.GetRawValueString("Layout", "text-start"); 38 layout = layout == "alignLeft" ? "align-items-start text-start" : layout; 39 layout = layout == "alignCenter" ? "align-items-center text-center" : layout; 40 layout = layout == "alignRight" ? "align-items-end text-end" : layout; 41 layout = layout == "alignLeftMiddle" ? "align-items-start text-start justify-content-center" : layout; 42 43 string contentPadding = Model.Item.GetRawValueString("ContentPadding", string.Empty); 44 contentPadding = contentPadding == "none" ? "p-0" : contentPadding; 45 contentPadding = contentPadding == "small" ? "p-3 p-md-3" : contentPadding; 46 contentPadding = contentPadding == "large" ? "p-5 p-md-5" : contentPadding; 47 48 //Backward compatibility (Vertical align) 49 string verticalAlign = string.Empty; 50 if (!string.IsNullOrEmpty(Model.Item.GetString("verticalAlign"))) 51 { 52 verticalAlign = verticalAlign == "vertical-align-top" ? "justify-content-start" : verticalAlign; 53 verticalAlign = verticalAlign == "vertical-align-center" ? "justify-content-center" : verticalAlign; 54 verticalAlign = verticalAlign == "vertical-align-bottom" ? "justify-content-end" : verticalAlign; 55 } 56 57 string maxWidth = Model.Item.GetRawValueString("TextReadability", "max-width-on"); 58 maxWidth = maxWidth == "max-width-on" ? " mw-75ch" : maxWidth; 59 maxWidth = maxWidth == "max-width-off" ? string.Empty : maxWidth; 60 61 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : string.Empty; 62 var decorations = Model.Item?.GetList("CssDecorations")?.GetRawValue().OfType<string>() ?? Enumerable.Empty<string>(); 63 string css = RenderCustomCSS(decorations); 64 65 Dynamicweb.Frontend.LinkViewModel link1 = new Dynamicweb.Frontend.LinkViewModel(); 66 Dynamicweb.Frontend.LinkViewModel link2 = new Dynamicweb.Frontend.LinkViewModel(); 67 68 string linkType1 = Model.Item.GetRawValueString("LinkType", "page"); 69 string linkType2 = Model.Item.GetRawValueString("LinkType2", "page2"); 70 71 if (linkType1 == "page" && Model.Item.GetLink("ButtonLink") != null) 72 { 73 link1 = Model.Item.GetLink("ButtonLink"); 74 } 75 76 if (linkType2 == "page2" && Model.Item.GetLink("ButtonLink2") != null) 77 { 78 link2 = Model.Item.GetLink("ButtonLink2"); 79 } 80 81 if (linkType1 == "product-group") 82 { 83 IList<ProductGroupViewModel> selectedGroups = Model.Item.GetValue<IList<ProductGroupViewModel>>("ProductGroupLink"); 84 IList<string> groupIds = new List<string> { }; 85 86 if (selectedGroups != null) 87 { 88 foreach (var fromGroup in selectedGroups) 89 { 90 groupIds.Add(fromGroup.Id); 91 } 92 } 93 94 link1 = new Dynamicweb.Frontend.LinkViewModel() 95 { 96 Url = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Shop") + "&GroupID=" + string.Join(",", groupIds) 97 }; 98 } 99 100 if (linkType2 == "product-group2") 101 { 102 IList<ProductGroupViewModel> selectedGroups = Model.Item.GetValue<IList<ProductGroupViewModel>>("ProductGroupLink2"); 103 IList<string> groupIds = new List<string> { }; 104 105 if (selectedGroups != null) 106 { 107 foreach (var fromGroup in selectedGroups) 108 { 109 groupIds.Add(fromGroup.Id); 110 } 111 } 112 113 link2 = new Dynamicweb.Frontend.LinkViewModel() 114 { 115 Url = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Shop") + "&GroupID=" + string.Join(",", groupIds).Trim(), 116 IsExternal = false 117 }; 118 } 119 120 if (linkType1 == "product") 121 { 122 ProductListViewModel products = Model.Item.GetValue<ProductListViewModel>("ProductLink"); 123 IList<string> productIds = new List<string> { }; 124 125 if (products != null && products.Products.Any()) 126 { 127 foreach (var product in products.Products) 128 { 129 productIds.Add(product.Id); 130 } 131 132 string productParameter = productIds.Count == 1 ? "ProductID" : "MainProductId"; 133 string productLink = products.Products?.FirstOrDefault()?.GetProductLink(GetPageIdByNavigationTag("Shop"), false); 134 productLink = productIds.Count != 1 ? "/Default.aspx?ID=" + GetPageIdByNavigationTag("Shop") + "&" + productParameter + "=" + string.Join(",", productIds).Trim() : productLink; 135 136 link1 = new Dynamicweb.Frontend.LinkViewModel() 137 { 138 Url = productLink 139 }; 140 } 141 } 142 143 if (linkType2 == "product2") 144 { 145 ProductListViewModel products = Model.Item.GetValue<ProductListViewModel>("ProductLink2"); 146 IList<string> productIds = new List<string> { }; 147 148 if (products != null && products.Products.Any()) 149 { 150 foreach (var product in products.Products) 151 { 152 productIds.Add(product.Id); 153 } 154 155 string productParameter = productIds.Count == 1 ? "ProductID" : "MainProductId"; 156 string productLink = products.Products?.FirstOrDefault()?.GetProductLink(GetPageIdByNavigationTag("Shop"), false); 157 productLink = productIds.Count != 1 ? "/Default.aspx?ID=" + GetPageIdByNavigationTag("Shop") + "&" + productParameter + "=" + string.Join(",", productIds).Trim() : productLink; 158 159 link2 = new Dynamicweb.Frontend.LinkViewModel() 160 { 161 Url = productLink, 162 IsExternal = false 163 }; 164 } 165 } 166 } 167 168 <div class="h-100 position-relative d-flex flex-column mb-0-last-child @contentPadding @verticalAlign @(layout)@(theme) @(css) item_@Model.Item.SystemName.ToLower()"> 169 <div id="@Model.ID" class="user-select-none position-absolute top-0" style="scroll-margin-top:var(--header-height,150px)"></div> 170 171 @if (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle")) 172 { 173 string titleColor = Model.Item.GetString("TitleColor", "text-inherit"); 174 string titleOpacity = Model.Item.GetString("TitleOpacity", "opacity-100"); 175 string titleFontSize = Model.Item.GetRawValueString("TitleFontSize", "h3"); 176 string headingLevel = Model.Item.GetString("HeadingLevel", "h2"); 177 string headingLevelStart = $"<{headingLevel} class=\"{titleFontSize} {titleColor} {titleOpacity}{maxWidth} mb-3\">"; 178 string headingLevelStop = $"</{headingLevel}>"; 179 180 @headingLevelStart 181 @Model.Item.GetString("Title") 182 @headingLevelStop 183 } 184 185 @if (!string.IsNullOrEmpty(Model.Item.GetString("Lead"))) 186 { 187 string subtitleColor = Model.Item.GetString("SubtitleColor", "text-inherit"); 188 string subtitleOpacity = Model.Item.GetString("SubtitleOpacity", "opacity-100"); 189 string subtitleFontSize = Model.Item.GetRawValueString("SubtitleFontSize", "fs-5"); 190 191 <p class="@subtitleFontSize @subtitleColor @subtitleOpacity lead mb-3@(maxWidth)"> 192 @Model.Item.GetString("Lead") 193 </p> 194 } 195 196 @if (!string.IsNullOrEmpty(Model.Item.GetString("Text"))) 197 { 198 string textColor = Model.Item.GetString("TextColor", "text-inherit"); 199 string textOpacity = Model.Item.GetString("TextOpacity", "opacity-100"); 200 201 <div class="mb-0-last-child @textColor @(textOpacity)@(maxWidth)"> 202 @Model.Item.GetString("Text") 203 </div> 204 } 205 206 @if (link1 is object && !string.IsNullOrEmpty(link1.Url) || link2 is object && !string.IsNullOrEmpty(link2.Url)) 207 { 208 string target1 = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && link1.IsExternal ? "target=\"_blank\"" : string.Empty; 209 string target2 = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && link2.IsExternal ? "target=\"_blank\"" : string.Empty; 210 string rel1 = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && link1.IsExternal ? "rel=\"noopener\"" : string.Empty; 211 string rel2 = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && link2.IsExternal ? "rel=\"noopener\"" : string.Empty; 212 string buttonLabel1 = Model.Item.GetString("ButtonLabel", string.Empty); 213 string buttonLabel2 = Model.Item.GetString("ButtonLabel2", string.Empty); 214 string buttonStyle1 = Model.Item.GetRawValueString("ButtonStyle", string.Empty); 215 buttonStyle1 = buttonStyle1 == "primary" ? "btn-primary " : buttonStyle1; 216 buttonStyle1 = buttonStyle1 == "secondary" ? "btn-secondary " : buttonStyle1; 217 buttonStyle1 = buttonStyle1 == "link" ? "btn-link" : buttonStyle1; 218 string buttonStyle2 = Model.Item.GetRawValueString("ButtonStyle2", string.Empty); 219 buttonStyle2 = buttonStyle2 == "primary" ? "btn-primary " : buttonStyle2; 220 buttonStyle2 = buttonStyle2 == "secondary" ? "btn-secondary " : buttonStyle2; 221 buttonStyle2 = buttonStyle2 == "link" ? "btn-link" : buttonStyle2; 222 string stretchedLink1 = Model.Item.GetRawValueString("StretchedLink", "column-not-clickable"); 223 string stretchedLink2 = Model.Item.GetRawValueString("StretchedLink2", "column-not-clickable"); 224 string stretchedLinkClass = stretchedLink1 == "column-clickable" && string.IsNullOrEmpty(link2.Url) && string.IsNullOrEmpty(buttonLabel2) ? "stretched-link" : string.Empty; 225 string stretchedLinkClass2 = stretchedLink2 == "column-clickable" && string.IsNullOrEmpty(link1.Url) && string.IsNullOrEmpty(buttonLabel1) ? "stretched-link" : string.Empty; 226 string alignmentClass = string.Empty; 227 228 if (Model.Item.GetString("Layout") == "alignCenter") 229 { 230 alignmentClass = " justify-content-center"; 231 } 232 233 <div class="d-flex flex-wrap gap-3 mt-3@(alignmentClass)"> 234 @if (link1 != null && !string.IsNullOrEmpty(link1.Url)) 235 { 236 if (!string.IsNullOrEmpty(buttonLabel1)) 237 { 238 <a href="@link1.Url" @target1 @rel1 class="text-nowrap btn @(buttonStyle1)@(stretchedLinkClass)">@buttonLabel1</a> 239 } 240 else 241 { 242 <a href="@link1.Url" @target1 @rel1 class="@(stretchedLinkClass)"> 243 <span class="visually-hidden">@Model.Item.GetString("Title")</span> 244 </a> 245 } 246 } 247 248 @if (link2 != null && !string.IsNullOrEmpty(link2.Url)) 249 { 250 if (!string.IsNullOrEmpty(buttonLabel2)) 251 { 252 <a href="@link2.Url" @target2 @rel2 class="text-nowrap btn @(buttonStyle2)@(stretchedLinkClass2)">@buttonLabel2</a> 253 } 254 else 255 { 256 <a href="@link2.Url" @target2 @rel2 class="@(stretchedLinkClass2)"> 257 <span class="visually-hidden">@Model.Item.GetString("Title")</span> 258 </a> 259 } 260 } 261 </div> 262 } 263 </div> 264 265
Error executing template "Designs/Swift/Paragraph/Swift_VideoPlayer.cshtml" System.InvalidOperationException: A prior operation on this collection was interrupted by an exception. Collection's state is no longer trusted. at System.Runtime.CompilerServices.ConditionalWeakTable`2.Container.VerifyIntegrity() at System.Runtime.CompilerServices.ConditionalWeakTable`2.Container.CreateEntryNoResize(TKey key, TValue value) at System.Runtime.CompilerServices.ConditionalWeakTable`2.Add(TKey key, TValue value) at Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax.MarkupTextLiteralSyntax.SetAnnotations(SyntaxAnnotation[] annotations) at Microsoft.AspNetCore.Razor.Language.Legacy.TokenizerBackedParser`1.GetNodeWithSpanContext[TNode](TNode node) at Microsoft.AspNetCore.Razor.Language.Legacy.HtmlMarkupParser.OtherParserBlock(SyntaxListBuilder`1& builder) at Microsoft.AspNetCore.Razor.Language.Legacy.HtmlMarkupParser.ParseDocument() at Microsoft.AspNetCore.Razor.Language.Legacy.RazorParser.Parse(RazorSourceDocument source) at Microsoft.AspNetCore.Razor.Language.DefaultRazorEngine.Process(RazorCodeDocument document) at Microsoft.AspNetCore.Razor.Language.RazorTemplateEngine.GenerateCode(RazorCodeDocument codeDocument) at RazorEngine.Compilation.CompilerServiceBase.GenerateCodeFile(RazorTemplateEngine templateEngine, RazorCodeDocument document) at RazorEngine.Compilation.CompilerServiceBase.GetGeneratorResult(IEnumerable`1 namespaces, TypeContext context) at RazorEngine.Compilation.CompilerServiceBase.GetCodeCompileUnit(TypeContext context) at Dynamicweb.Rendering.Compatibility.RoslynCompilerServiceBase.CompileType(TypeContext context) at RazorEngine.Templating.RazorEngineCore.CreateTemplateType(ITemplateSource razorTemplate, Type modelType) at RazorEngine.Templating.RazorEngineCore.Compile(ITemplateKey key, Type modelType) at RazorEngine.Templating.RazorEngineService.CompileAndCacheInternal(ITemplateKey key, Type modelType) at RazorEngine.Templating.RazorEngineService.GetCompiledTemplate(ITemplateKey key, Type modelType, Boolean compileOnCacheMiss) at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag) at RazorEngine.Templating.DynamicWrapperService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag) at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String name, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag) at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer) at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter) at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag) at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String templateSource, String name, Type modelType, Object model, DynamicViewBag viewBag) at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template) at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) at Dynamicweb.Rendering.Template.RenderRazorTemplate()
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 2 @using Dynamicweb.Ecommerce.ProductCatalog 3 4 @{ 5 string ratioCssClass = Model.Item.GetRawValueString("AspectRatio") != "0" && Model.Item.GetRawValueString("AspectRatio") != "" ? "ratio" : ""; 6 string ratioVariable = Model.Item.GetRawValueString("AspectRatio") != "0" && Model.Item.GetRawValueString("AspectRatio") != "" ? "style=\"--bs-aspect-ratio: " + Model.Item.GetRawValueString("AspectRatio") + "\"" : ""; 7 8 string visual = Model.Item.GetRawValueString("Visual", "inline"); 9 10 string provider = Model.Item.GetRawValueString("VideoSourceProvider", "none"); 11 string videoId = Model.Item.GetString("VideoSourceID"); 12 13 Dynamicweb.Frontend.FileViewModel video = Model.Item.GetFile("VideoPath"); 14 string videoPath = video?.Path ?? ""; 15 16 string iconPath = "/Files/Templates/Designs/Swift/Assets/icons/play.svg"; 17 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 18 string alignment = Model.Item.GetRawValueString("Alignment", "align-items-center"); 19 } 20 21 @switch (visual) 22 { 23 case "inline": 24 <div class="h-100 position-relative grid grid-1 @(alignment) item_@Model.Item.SystemName.ToLower()"> 25 <div id="@Model.ID" class="user-select-none position-absolute top-0" style="scroll-margin-top:var(--header-height,150px)"></div> 26 27 @switch (provider) 28 { 29 case "youtube": 30 case "vimeo": 31 32 <div id="player_@Pageview.CurrentParagraph.ID" 33 class="player plyr__video-embed @(theme) h-100 w-100" 34 data-plyr-provider="@provider" 35 data-plyr-embed-id="@videoId" 36 style="--plyr-color-main: var(--swift-foreground-color); "> 37 </div> 38 39 break; 40 41 case "self-hosted": 42 43 <video id="player_@Pageview.CurrentParagraph.ID" 44 class="player plyr__video-embed @(theme) h-100 w-100" 45 src="@videoPath" 46 style="--plyr-color-main: var(--swift-foreground-color);" 47 preload="metadata"> 48 </video> 49 50 break; 51 } 52 <script type="module" src="/Files/Templates/Designs/Swift/Assets/js/plyr.js"></script> 53 <script type="module"> 54 55 const player = new Plyr('#player_@Pageview.CurrentParagraph.ID', { 56 type: 'video', 57 youtube: { 58 noCookie: true, 59 showinfo: 0 60 }, 61 fullscreen: { 62 enabled: true, 63 iosNative: true, 64 } 65 }); 66 </script> 67 68 </div> 69 70 break; 71 72 case "poster-modal": 73 <div class="h-100 position-relative@(theme) grid grid-1 @(alignment) item_@Model.Item.SystemName.ToLower()"> 74 <div id="@Model.ID" class="user-select-none position-absolute top-0" style="scroll-margin-top:var(--header-height,150px)"></div> 75 <div class="player position-relative" data-player="player_@Pageview.CurrentParagraph.ID"> 76 77 @{ 78 string ratio = Model.Item.GetRawValueString("AspectRatio", ""); 79 ratio = ratio != "0" ? ratio : ""; 80 ratioCssClass = ratio != "" && ratio != "fill" ? " ratio" : ""; 81 ratioVariable = ratio != "" ? "style=\"--bs-aspect-ratio: " + ratio + "\"" : ""; 82 string fillClass = ratio == "fill" ? " h-100" : ""; 83 84 var parms = new Dictionary<string, object>(); 85 parms.Add("loading", "lazy"); 86 if (ratio == "fill") 87 { 88 parms.Add("cssClass", "w-100 h-100"); 89 } 90 else 91 { 92 parms.Add("cssClass", "mw-100 mh-100"); 93 } 94 parms.Add("style", ""); 95 parms.Add("alt", @Model.Item.GetString("ImageAltText")); 96 parms.Add("columns", Model.GridRowColumnCount); 97 98 <figure class="m-0@(ratioCssClass)@(fillClass)" @ratioVariable> 99 @if (string.IsNullOrEmpty(Model.Item.GetString("VideoPoster"))) 100 { 101 switch (provider) 102 { 103 case "youtube": 104 <script type="module"> 105 function setVideoThumbnail(source) { 106 var figure = document.querySelector("[data-player='player_@Pageview.CurrentParagraph.ID'] figure"); 107 var thumbnail = document.createElement("img"); 108 thumbnail.style = "object-fit: cover;"; 109 thumbnail.classList.add('mw-100','mh-100'); 110 thumbnail.src = source; 111 figure.appendChild(thumbnail); 112 }; 113 setVideoThumbnail('https://i.ytimg.com/vi/@(videoId)/hqdefault.jpg'); 114 </script> 115 break; 116 117 case "vimeo": 118 <script type="module"> 119 function setVideoThumbnail(source) { 120 let figure = document.querySelector("[data-player='player_@Pageview.CurrentParagraph.ID'] figure"); 121 let thumbnail = document.createElement("img"); 122 thumbnail.style = "object-fit: cover;"; 123 thumbnail.classList.add('mw-100','mh-100'); 124 thumbnail.src = source; 125 figure.appendChild(thumbnail); 126 }; 127 function getVimeoThumbnail() { 128 fetch('https://vimeo.com/api/v2/video/@(videoId).json') 129 .then(function(response) { 130 return response.text(); 131 }) 132 .then(function(data) { 133 let { thumbnail_large } = JSON.parse(data)[0]; 134 let thumbnail = `${thumbnail_large}`; 135 thumbnail = thumbnail.replace("_640", "_1920"); 136 setVideoThumbnail(thumbnail); 137 }) 138 .catch(error => { 139 console.log(error); 140 }); 141 } 142 143 getVimeoThumbnail(); 144 </script> 145 break; 146 } 147 } 148 else 149 { 150 @RenderPartial("Components/Image.cshtml", Model.Item.GetFile("VideoPoster") ?? new Dynamicweb.Frontend.FileViewModel(), parms) 151 } 152 153 </figure> 154 155 } 156 157 <div class="position-absolute top-0 bottom-0 end-0 start-0 h-100 d-flex align-items-center justify-content-center"> 158 <button type="button" class="btn btn-primary rounded-circle lh-1 p-3" data-bs-toggle="modal" data-bs-target="#modal_@Pageview.CurrentParagraph.ID"> 159 <span class="icon-3"> 160 @ReadFile(iconPath) 161 </span> 162 <span class="visually-hidden">@Translate("Play video")</span> 163 </button> 164 </div> 165 </div> 166 </div> 167 168 <div class="modal fade" id="modal_@Pageview.CurrentParagraph.ID" tabindex="-1" aria-hidden="true"> 169 <div class="modal-dialog modal-xl modal-dialog-centered"> 170 <div class="modal-content"> 171 <div class="modal-body p-0"> 172 173 @switch (provider) 174 { 175 case "youtube": 176 case "vimeo": 177 178 <div id="player_@Pageview.CurrentParagraph.ID" 179 class="player plyr__video-embed @(theme) h-100 w-100" 180 data-plyr-provider="@provider" 181 data-plyr-embed-id="@videoId" 182 style="--plyr-color-main: var(--swift-foreground-color); "> 183 </div> 184 185 break; 186 187 case "self-hosted": 188 189 <video id="player_@Pageview.CurrentParagraph.ID" 190 class="player plyr__video-embed @(theme) h-100 w-100" 191 src="@videoPath" 192 style="--plyr-color-main: var(--swift-foreground-color);" 193 preload="metadata"> 194 </video> 195 196 break; 197 } 198 <script type="module" src="/Files/Templates/Designs/Swift/Assets/js/plyr.js"></script> 199 <script type="module"> 200 201 var player = new Plyr('#player_@Pageview.CurrentParagraph.ID', { 202 youtube: { 203 noCookie: true, 204 showinfo: 0 205 }, 206 fullscreen: { 207 enabled: true, 208 iosNative: true, 209 } 210 }); 211 212 document.querySelector('#modal_@Pageview.CurrentParagraph.ID').addEventListener('show.bs.modal', function (event) { 213 player.togglePlay(); 214 215 player.on('ready', event => { 216 player.play(); 217 }); 218 }); 219 220 document.querySelector('#modal_@Pageview.CurrentParagraph.ID').addEventListener('hide.bs.modal', function (event) { 221 player.pause(); 222 }); 223 </script> 224 225 </div> 226 </div> 227 </div> 228 </div> 229 230 break; 231 } 232 233
An awesome multiple award-winning electric enduro bike
An awesome descent, with some high speed ripping at the top, some root drops in the middle, and some great bank turns at the bottom. Fun!
Trek refines the Rail for 2022
Long pedal up form town but best when shuttled to the top. Fast, fun descent. Freeze-thaw cycle isn't awful, but does make this trail rather slick.
Mongoose Ritual with all-new frame with 27.5in & 29in
From the young (or not so young) beginner, to the downhill pro, a flow trail delivers smiles for riders of all ages and skill level.
Scattante brings high pivot suspension & adjustable chainstays
Long pedal up form town but best when shuttled to the top. It's fire road the entire way, absolutely zero singletrack.