Our story

20 years experience selling bikes online.

Swift bikes

We have more than 20 years experience with selling professional bikes online. Swift bikes was founded two decades ago

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_Blockquote.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 @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 theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : string.Empty; 38 var decorations = Model.Item?.GetList("CssDecorations")?.GetRawValue().OfType<string>() ?? Enumerable.Empty<string>(); 39 string css = RenderCustomCSS(decorations); 40 string iconPath = "/Files/Templates/Designs/Swift/Assets/icons/"; 41 var image = Model.Item.GetFile("QuoteAuthorImage"); 42 int xPos = image?.FocalPositionFromLeft ?? 50; 43 int yPos = image?.FocalPositionFromTop ?? 50; 44 string imagePosition = $"{xPos}% {yPos}%"; 45 int imageWidth = 32; 46 int imageheight = 32; 47 string imageClass = "rounded-circle"; 48 string imageStyle = $"object-fit:cover;object-position:{imagePosition};"; 49 string quote = Model.Item.GetRawValueString("Quote", string.Empty); 50 string quoteAuthor = Model.Item.GetRawValueString("QuoteAuthor", string.Empty); 51 string layout = Model.Item.GetRawValueString("Layout", "QuoteOnly"); 52 string fontSize = Model.Item.GetRawValueString("FontSize", "Regular"); 53 string fontSizeClass = " fs-6"; 54 string contentPadding = Model.Item.GetRawValueString("ContentPadding", "None"); 55 string contentPaddingClass = string.Empty; 56 string quoteIconSize = "icon-3"; 57 string borderLeftLayoutColor = !string.IsNullOrEmpty(theme) ? "var(--swift-border-color)" : "var(--swift-foreground-color)"; 58 string borderLeftLayout = $"style=\"border-left:0.375rem solid {borderLeftLayoutColor};box-shadow:none;\""; 59 string quoteIcon = "<svg viewBox=\"0 0 32 28\"><path d= \"M40.333,28,38,0H52L49.667,28Zm-18,0L20,0H34L31.667,28Z\" transform=\"translate(-20)\" fill=\"currentColor\"/></svg>"; 60 bool openInNewTab = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab"); 61 string quoteSource = Model.Item.GetString("QuoteSource", string.Empty); 62 var link = Model.Item.GetLink("QuoteSourceLink"); 63 64 string target = link is object && (openInNewTab && link.IsExternal) ? "target=\"_blank\"" : string.Empty; 65 string rel = link is object && (openInNewTab && link.IsExternal) ? "rel=\"noopener\"" : string.Empty; 66 67 switch (contentPadding) 68 { 69 case "Small": 70 contentPaddingClass = " p-3"; 71 break; 72 case "Large": 73 contentPaddingClass = " p-5"; 74 break; 75 } 76 77 switch (fontSize) 78 { 79 case "Small": 80 fontSizeClass = " fs-7"; 81 quoteIconSize = "icon-2"; 82 break; 83 case "Large": 84 fontSizeClass = " fs-3"; 85 quoteIconSize = "icon-4"; 86 break; 87 } 88 } 89 90 <div id="@Model.ID" class="user-select-none" style="scroll-margin-top:var(--header-height,150px)"></div> 91 92 @if (layout == "QuoteOnly") 93 { 94 <figure class="position-relative d-flex flex-column gap-3 h-100 m-0@(contentPaddingClass)@(theme) @(css)" itemscope itemtype="https://schema.org/Quotation"> 95 <blockquote class="m-0 blockquote mb-0-last-child@(fontSizeClass)" itemprop="text"> 96 @quote 97 </blockquote> 98 @if (!string.IsNullOrEmpty(quoteAuthor)) 99 { 100 <figcaption class="d-flex gap-3 align-items-center m-0"> 101 @if (image is object) 102 { 103 <img src="/Admin/Public/GetImage.ashx?image=@(image.PathUrlEncoded)&width=@(imageWidth*2)&crop=0&format=webp&compression=75" width="@imageWidth" height="@imageheight" class="@imageClass" alt="@quoteAuthor" loading="lazy" decoding="async" style="@imageStyle"> 104 } 105 else 106 { 107 <div class="p-2 icon-2 rounded-circle" style="background-color:var(--swift-foreground-color);color:var(--swift-background-color);"> 108 @ReadFile(iconPath + "user.svg") 109 </div> 110 } 111 <div class="opacity-85 fs-7" itemprop="author"> 112 @quoteAuthor 113 114 @if (link is object) 115 { 116 @:<a class="stretched-link text-decoration-none text-decoration-underline-hover" style="color:currentColor" href="@link.Url" @target @rel> 117 } 118 <cite title="@quoteSource">@quoteSource</cite> 119 @if (link is object) 120 { 121 @:</a> 122 } 123 </div> 124 </figcaption> 125 } 126 </figure> 127 } 128 129 @if (layout == "QuoteLeftBorder") 130 { 131 <figure class="position-relative d-flex flex-column gap-3 h-100 m-0@(contentPaddingClass)@(theme) @(css)" @borderLeftLayout itemscope itemtype="https://schema.org/Quotation"> 132 <blockquote class="m-0 blockquote mb-0-last-child@(fontSizeClass)" itemprop="text"> 133 @quote 134 </blockquote> 135 @if (!string.IsNullOrEmpty(quoteAuthor)) 136 { 137 <figcaption class="d-flex gap-3 align-items-center m-0"> 138 @if (image is object) 139 { 140 <img src="/Admin/Public/GetImage.ashx?image=@(image.PathUrlEncoded)&width=@(imageWidth*2)&crop=0&format=webp&compression=75" width="@imageWidth" height="@imageheight" class="@imageClass" alt="@quoteAuthor" loading="lazy" decoding="async" style="@imageStyle"> 141 } 142 else 143 { 144 <div class="p-2 icon-2 rounded-circle" style="background-color:var(--swift-foreground-color);color:var(--swift-background-color);"> 145 @ReadFile(iconPath + "user.svg") 146 </div> 147 } 148 <div class="opacity-85 fs-7" itemprop="author"> 149 @quoteAuthor 150 151 @if (link is object) 152 { 153 @:<a class="stretched-link text-decoration-none text-decoration-underline-hover" style="color:currentColor" href="@link.Url" @target @rel> 154 } 155 <cite title="@quoteSource">@quoteSource</cite> 156 @if (link is object) 157 { 158 @:</a> 159 } 160 </div> 161 </figcaption> 162 } 163 </figure> 164 } 165 166 @if (layout == "QuoteLeftBorderIconTop") 167 { 168 <div class="position-relative d-flex flex-column gap-3 h-100@(contentPaddingClass)@(theme) @(css)" @borderLeftLayout itemscope itemtype="https://schema.org/Quotation"> 169 <div class="@quoteIconSize justify-content-start"> 170 @quoteIcon 171 </div> 172 <figure class="d-flex flex-column gap-3 m-0"> 173 <blockquote class="m-0 blockquote mb-0-last-child@(fontSizeClass)" itemprop="text"> 174 @quote 175 </blockquote> 176 @if (!string.IsNullOrEmpty(quoteAuthor)) 177 { 178 <figcaption class="d-flex gap-3 align-items-center m-0"> 179 @if (image is object) 180 { 181 <img src="/Admin/Public/GetImage.ashx?image=@(image.PathUrlEncoded)&width=@(imageWidth*2)&crop=0&format=webp&compression=75" width="@imageWidth" height="@imageheight" class="@imageClass" alt="@quoteAuthor" loading="lazy" decoding="async" style="@imageStyle"> 182 } 183 else 184 { 185 <div class="p-2 icon-2 rounded-circle" style="background-color:var(--swift-foreground-color);color:var(--swift-background-color);"> 186 @ReadFile(iconPath + "user.svg") 187 </div> 188 } 189 <div class="opacity-85 fs-7" itemprop="author"> 190 @quoteAuthor 191 @if (link is object) 192 { 193 @:<a class="stretched-link text-decoration-none text-decoration-underline-hover" style="color:currentColor" href="@link.Url" @target @rel> 194 } 195 <cite title="@quoteSource">@quoteSource</cite> 196 @if (link is object) 197 { 198 @:</a> 199 } 200 </div> 201 </figcaption> 202 } 203 </figure> 204 </div> 205 } 206 207 @if (layout == "QuoteLeftBorderIconLeft") 208 { 209 <div class="position-relative d-flex flex-row h-100 gap-3@(contentPaddingClass)@(theme) @(css)" @borderLeftLayout itemscope itemtype="https://schema.org/Quotation"> 210 <div class="@quoteIconSize align-items-baseline mt-1"> 211 @quoteIcon 212 </div> 213 <figure class="d-flex flex-column gap-3 m-0"> 214 <blockquote class="m-0 blockquote mb-0-last-child@(fontSizeClass)" itemprop="text"> 215 @quote 216 </blockquote> 217 @if (!string.IsNullOrEmpty(quoteAuthor)) 218 { 219 <figcaption class="d-flex gap-3 align-items-center m-0"> 220 @if (image is object) 221 { 222 <img src="/Admin/Public/GetImage.ashx?image=@(image.PathUrlEncoded)&width=@(imageWidth*2)&crop=0&format=webp&compression=75" width="@imageWidth" height="@imageheight" class="@imageClass" alt="@quoteAuthor" loading="lazy" decoding="async" style="@imageStyle"> 223 } 224 else 225 { 226 <div class="p-2 icon-2 rounded-circle" style="background-color:var(--swift-foreground-color);color:var(--swift-background-color);"> 227 @ReadFile(iconPath + "user.svg") 228 </div> 229 } 230 <div class="opacity-85 fs-7" itemprop="author"> 231 @quoteAuthor 232 @if (link is object) 233 { 234 @:<a class="stretched-link text-decoration-none text-decoration-underline-hover" style="color:currentColor" href="@link.Url" @target @rel> 235 } 236 <cite title="@quoteSource">@quoteSource</cite> 237 @if (link is object) 238 { 239 @:</a> 240 } 241 </div> 242 </figcaption> 243 } 244 </figure> 245 </div> 246 } 247 248 @if (layout == "QuoteTopImageCenter") 249 { 250 string blockquotePadding = " pb-5"; 251 string figcaptionPadding = " pt-4"; 252 253 switch (contentPadding) 254 { 255 case "Small": 256 blockquotePadding = " px-3 pt-3 pb-5"; 257 figcaptionPadding = " px-3 pt-4 pb-3"; 258 break; 259 case "Large": 260 blockquotePadding = " p-5"; 261 figcaptionPadding = " px-5 py-4"; 262 break; 263 } 264 imageWidth = 68; 265 imageheight = 68; 266 imageClass += " position-absolute top-0 start-50 translate-middle"; 267 268 <figure class="position-relative d-flex flex-column h-100 m-0" itemscope itemtype="https://schema.org/Quotation"> 269 <blockquote class="flex-grow-1 m-0 blockquote mb-0-last-child text-center@(fontSizeClass)@(blockquotePadding)@(theme) @(css)" itemprop="text"> 270 @quote 271 </blockquote> 272 @if (!string.IsNullOrEmpty(quoteAuthor)) 273 { 274 string quoteAuthorWrapperColor = theme != string.Empty ? "bg-white text-black " : string.Empty; 275 276 <figcaption class="d-flex gap-3 justify-content-center text-center position-relative m-0@(figcaptionPadding)@theme" style="background-color:var(--swift-foreground-color);color:var(--swift-background-color);"> 277 278 @if (image is object) 279 { 280 <img src="/Admin/Public/GetImage.ashx?image=@(image.PathUrlEncoded)&width=@(imageWidth*2)&crop=0&format=webp&compression=75" width="@imageWidth" height="@imageheight" class="@imageClass" alt="@quoteAuthor" loading="lazy" decoding="async" style="@imageStyle"> 281 } 282 else 283 { 284 <div class="p-3 icon-4 shadow-none @imageClass@(theme)" style="background-color:var(--swift-foreground-color);color:var(--swift-background-color);border:2px solid var(--swift-background-color)"> 285 @ReadFile(iconPath + "user.svg") 286 </div> 287 } 288 289 <div class="opacity-85 fs-7 pt-3" itemprop="author"> 290 @quoteAuthor 291 @if (link is object) 292 { 293 @:<a class="stretched-link text-decoration-none text-decoration-underline-hover" style="color:currentColor" href="@link.Url" @target @rel> 294 } 295 <cite title="@quoteSource">@quoteSource</cite> 296 @if (link is object) 297 { 298 @:</a> 299 } 300 </div> 301 </figcaption> 302 } 303 </figure> 304 } 305 306 @if (layout == "QuoteLeftImageRight") 307 { 308 imageWidth = 400; 309 imageheight = 225; 310 imageClass = "w-100 h-100"; 311 imageStyle += "aspect-ratio:16/9;"; 312 313 <figure class="position-relative grid grid-12 gap-0 h-100 m-0" itemscope itemtype="https://schema.org/Quotation"> 314 <div class="g-col-12 g-col-md-8 order-last order-md-first d-flex flex-column gap-3 h-100 align-items-start@(contentPaddingClass)@(theme) @(css)"> 315 <blockquote class="m-0 blockquote mb-0-last-child@(fontSizeClass)" itemprop="text"> 316 @quote 317 </blockquote> 318 @if (!string.IsNullOrEmpty(quoteAuthor)) 319 { 320 <figcaption class="opacity-85 fs-7" itemprop="author"> 321 @quoteAuthor 322 @if (link is object) 323 { 324 @:<a class="stretched-link text-decoration-none text-decoration-underline-hover" style="color:currentColor" href="@link.Url" @target @rel> 325 } 326 <cite title="@quoteSource">@quoteSource</cite> 327 @if (link is object) 328 { 329 @:</a> 330 } 331 </figcaption> 332 } 333 </div> 334 @if (image is object) 335 { 336 <div class="g-col-12 g-col-md-4 order-first order-md-last"> 337 <img src="/Admin/Public/GetImage.ashx?image=@(image.PathUrlEncoded)&width=@(imageWidth*2)&crop=0&format=webp&compression=75" width="@imageWidth" height="@imageheight" class="@imageClass" alt="@quoteAuthor" loading="lazy" decoding="async" style="@imageStyle"> 338 </div> 339 } 340 else 341 { 342 <div class="g-col-12 g-col-md-4 order-first order-md-last h-100 w-100@(theme)" style="aspect-ratio: 16/9;background-color:var(--swift-foreground-color);color:var(--swift-background-color);"> 343 <div class="d-flex align-items-center justify-content-center icon-5 h-100"> 344 @ReadFile(iconPath + "user.svg") 345 </div> 346 </div> 347 } 348 </figure> 349 } 350

Comfortable

Powerful Suitable

I begyndelsen

Det hele startede i vores lille hytte i udkanten af Aarhus.

Dette er en klassisk Black Mountain -sti og blev omtalt i Freehub Magasinets Pisgah Photo Book: Nummer 6. Starter flydende med nogle gode spring og kommer derefter ind i mere tekniske stenhaver.

Området kan tilgås fra enden af ​​Densmore's Lane, enden af ​​Old Petty Harbour Road og fra Huntingdale Drive. Efter 50 meters ridning får du en fantastisk udsigt over Castle Valley.

The continuing success

Ridgeline is a crown jewel of Dupont State

From Lake Imaging Road it is a steady but not steep climb to the high point just before the intersection with Hooker Creek Trail. It is not hard to get to and is very fun to ride.

Most climbs are of the paved/fireroad variety, most descents are a mix of loose rock, fixed rock, and good dirt. Technically you can go both directions but everyone typically starts from Guardsman.

 

Meet the board members

At Swift Bikes, we're a close team of cycling enthusiasts. Each of us brings a wealth of knowledge and a shared passion for biking.

Error executing template "/Designs/Swift/Grid/Page/RowTemplates/3Columns.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.GridRowViewModel> 2 @using Dynamicweb.Content.Items 3 4 @{ 5 string sectionClass = "py-3"; 6 string spaceBetweenRows = Model.Item.GetRawValueString("SpaceBetweenRows", "spacing"); 7 string spaceBetweenRowsMobile = Model.Item.GetRawValueString("SpaceBetweenRowsMobile", "auto"); 8 9 //Row spacing mobile auto 10 if (spaceBetweenRowsMobile == "auto") { 11 spaceBetweenRowsMobile = spaceBetweenRows; 12 } 13 14 //Row spacing mobile 15 switch (spaceBetweenRowsMobile) { 16 case "none": //No spacing 17 sectionClass = "py-0"; 18 break; 19 case "spacing": //Small spacing top and bottom 20 sectionClass = "py-3"; 21 break; 22 case "spacing-small-top": //Small spacing top 23 sectionClass = "pt-3"; 24 break; 25 case "spacing-small-bottom": //Small spacing bottom 26 sectionClass = "pb-3"; 27 break; 28 case "spacing-medium": //Medium spacing top and bottom 29 sectionClass = "py-4"; 30 break; 31 case "spacing-medium-top": //Medium spacing top 32 sectionClass = "pt-4"; 33 break; 34 case "spacing-medium-bottom": //Medium spacing bottom 35 sectionClass = "pb-4"; 36 break; 37 case "spacing-large": //Large spacing top and bottom 38 sectionClass = "py-5"; 39 break; 40 case "spacing-top": //Large spacing top 41 sectionClass = "pt-5"; 42 break; 43 case "spacing-bottom": //Large spacing bottom 44 sectionClass = "pb-5"; 45 break; 46 } 47 48 //Row spacing dekstop 49 switch (spaceBetweenRows) { 50 case "none": //No spacing 51 sectionClass += " py-lg-0"; 52 break; 53 case "spacing": //Small spacing top and bottom 54 sectionClass += " py-lg-3"; 55 break; 56 case "spacing-small-top": //Small spacing top 57 sectionClass += " pt-lg-3 pb-lg-0"; 58 break; 59 case "spacing-small-bottom": //Small spacing bottom 60 sectionClass += " pb-lg-3 pt-lg-0"; 61 break; 62 case "spacing-medium": //Medium spacing top and bottom 63 sectionClass += " py-lg-5"; 64 break; 65 case "spacing-medium-top": //Medium spacing top 66 sectionClass += " pt-lg-5 pb-lg-0"; 67 break; 68 case "spacing-medium-bottom": //Medium spacing bottom 69 sectionClass += " pb-lg-5 pt-lg-0"; 70 break; 71 case "spacing-large": //Large spacing top and bottom 72 sectionClass += " py-lg-6"; 73 break; 74 case "spacing-top": //Large spacing top 75 sectionClass += " pt-lg-6 pb-lg-0"; 76 break; 77 case "spacing-bottom": //Large spacing bottom 78 sectionClass += " pb-lg-6 pt-lg-0"; 79 break; 80 } 81 82 string width = Model.Item.GetRawValueString("Width", "").ToLower(); 83 string containerClass = "container-xl"; 84 if (width == "stretch") 85 { 86 containerClass = "container-fluid"; 87 } 88 if (width == "none") 89 { 90 containerClass = "container-fluid px-0"; 91 } 92 if (width == "compressed") 93 { 94 containerClass = " container-compressed"; 95 } 96 97 string rowClass = string.Empty; 98 string spaceBetweenColumns = Model.Item.GetRawValueString("SpaceBetweenColumns", string.Empty).ToLower(); 99 string spaceBetweenColumnsMobile = Model.Item.GetRawValueString("SpaceBetweenColumnsMobile", string.Empty).ToLower(); 100 //Mobile 101 if (spaceBetweenColumnsMobile == "auto") 102 { 103 spaceBetweenColumnsMobile = spaceBetweenColumns; 104 } 105 if (spaceBetweenColumnsMobile == "stick") { 106 rowClass = " gap-0"; 107 } 108 if (spaceBetweenColumnsMobile == "spacing-medium") 109 { 110 rowClass = " gap-4"; 111 } 112 if (spaceBetweenColumnsMobile == "spacing-large") { 113 rowClass = " gap-5"; 114 } 115 //Desktop 116 if (spaceBetweenColumns == "stick") { 117 rowClass += " gap-lg-0"; 118 } 119 if (spaceBetweenColumns == "spacing-medium") 120 { 121 rowClass += " gap-lg-4"; 122 } 123 if (spaceBetweenColumns == "spacing-large") { 124 rowClass += " gap-lg-5"; 125 } 126 127 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 128 129 string animationOnScrollCol1 = Model.Item.GetRawValueString("AnimationOnScrollCol1", "no-animation"); 130 animationOnScrollCol1 = animationOnScrollCol1 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol1 + "'" : ""; 131 string animationOnScrollCol2 = Model.Item.GetRawValueString("AnimationOnScrollCol2", "no-animation"); 132 animationOnScrollCol2 = animationOnScrollCol2 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol2 + "'" : ""; 133 string animationOnScrollCol3 = Model.Item.GetRawValueString("AnimationOnScrollCol3", "no-animation"); 134 animationOnScrollCol3 = animationOnScrollCol3 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol3 + "'" : ""; 135 136 string hideOverflow = " overflow-hidden"; 137 hideOverflow = 138 animationOnScrollCol1 != "" || 139 animationOnScrollCol2 != "" || 140 animationOnScrollCol3 != "" 141 ? hideOverflow : ""; 142 143 Dynamicweb.Frontend.FileViewModel backgroundImage = Model.Item.GetFile("BackgroundImage"); 144 string backgroundImagePath = backgroundImage?.Path ?? string.Empty; 145 backgroundImagePath = !string.IsNullOrEmpty(backgroundImagePath) ? $"/Admin/Public/GetImage.ashx?image={backgroundImagePath}&width=2600&format=webp&compression=75" : string.Empty; 146 backgroundImagePath = Dynamicweb.Core.Encoders.HtmlEncoder.UrlPathEncode(backgroundImagePath); 147 string backgroundRepeat = Model.Item.GetRawValueString("BackgroundImageRepeat", "no-repeat"); 148 string backgroundImageSize = Model.Item.GetRawValueString("BackgroundImageSize", "initial"); 149 int xPos = backgroundImage?.FocalPositionFromLeft ?? 50; 150 int yPos = backgroundImage?.FocalPositionFromTop ?? 50; 151 string cssPosition = $"{xPos}% {yPos}%"; 152 string gradient = Model.Item.GetRawValueString("Gradient", string.Empty); 153 string gradientOpacity = Model.Item.GetRawValueString("GradientOpacity", "0.00"); 154 string gradientString = "linear-gradient(" + gradient + "deg," + "rgba(var(--swift-foreground-color-rgb)," + gradientOpacity + "), rgba(var(--swift-background-color-rgb)," + gradientOpacity + "))"; 155 string backgroundImageString = "url(" + backgroundImagePath + ")"; 156 string backgroundImagePositionString = "background-position:" + cssPosition + ";"; 157 string backgroundRepeatString = "background-repeat:" + backgroundRepeat + ";"; 158 string backgroundImageSizeString = "background-size:" + backgroundImageSize + ";"; 159 string styleString = string.Empty; 160 161 var decorations = Model.Item?.GetList("CssDecorations")?.GetRawValue().OfType<string>() ?? Enumerable.Empty<string>(); 162 var css = string.Empty; 163 var cssClasses = new List<string> { }; 164 165 foreach (var itemId in decorations) 166 { 167 var item = Dynamicweb.Content.Services.Items.GetItem("Swift_Css", itemId); 168 item.TryGetValue("Class", out object classes); 169 if (classes is null) 170 { 171 continue; 172 } 173 174 var cssString = (string)classes; 175 if (cssString.StartsWith("[")) 176 { 177 var cssArray = Dynamicweb.Core.Converter.Deserialize<string[]>(cssString); 178 cssClasses.AddRange(cssArray); 179 } 180 else 181 { 182 cssClasses.Add(cssString.Replace(",", " ")); 183 } 184 } 185 css = string.Join(" ", cssClasses).Trim(); 186 187 @* Only gradient *@ 188 189 if (!string.IsNullOrEmpty(gradient) && string.IsNullOrEmpty(backgroundImagePath) && gradientOpacity != ("0.00")) 190 { 191 styleString += "style=\"background-image:" + gradientString + ";\""; 192 } 193 194 @* Only background image *@ 195 196 else if (string.IsNullOrEmpty(gradient) && !string.IsNullOrEmpty(backgroundImagePath)) 197 { 198 styleString += "style=\"background-image:" + backgroundImageString + "; " + backgroundImagePositionString + backgroundRepeatString + backgroundImageSizeString + "\""; 199 } 200 201 @* Gradient and background image *@ 202 203 else if (!string.IsNullOrEmpty(gradient) && !string.IsNullOrEmpty(backgroundImagePath)) 204 { 205 styleString += "style=\"background-image:" + gradientString + "," + backgroundImageString + ";" + backgroundImagePositionString + backgroundRepeatString + backgroundImageSizeString + "\""; 206 } 207 208 int mobileColumnSize = Dynamicweb.Core.Converter.ToInt32(Model.Item.GetRawValueString("MobileColumnBehaviour", "1")); 209 int mobileOrderFirst = Dynamicweb.Core.Converter.ToInt32(Model.Item.GetRawValueString("MobileOrderFirst", "1")); 210 211 if (Pageview.IsVisualEditorMode || !string.IsNullOrWhiteSpace(Model.Column(1).Output()) || !string.IsNullOrWhiteSpace(Model.Column(2).Output()) || !string.IsNullOrWhiteSpace(Model.Column(3).Output())) 212 { 213 <div class="@(sectionClass)@(theme) @(css) item_@Model.Item.SystemName.ToLower()" @styleString data-swift-gridrow> 214 <div class="@containerClass@(hideOverflow)"> 215 <div class="grid grid-@(mobileColumnSize) grid-lg-@Model.Columns.Count()@(rowClass)"> 216 <div class="g-col @(Model.Column(1).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="4" @animationOnScrollCol1 style="--bs-columns:12"> 217 @Model.Column(1).Output() 218 </div> 219 <div class="g-col @(Model.Column(2).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="4" @animationOnScrollCol2 style="--bs-columns:12"> 220 @Model.Column(2).Output() 221 </div> 222 <div class="g-col @(Model.Column(3).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="4" @animationOnScrollCol3 style="--bs-columns:12"> 223 @Model.Column(3).Output() 224 </div> 225 </div> 226 </div> 227 </div> 228 } 229 } 230
Error executing template "Designs/Swift/Paragraph/Swift_Employee.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 @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 name = Model.Item.GetRawValueString("Name", string.Empty); 38 string jobTitle = Model.Item.GetRawValueString("Title", string.Empty); 39 string description = Model.Item.GetRawValueString("Description", string.Empty); 40 string layout = Model.Item.GetRawValueString("Layout", string.Empty); 41 string layoutClass = string.Empty; 42 string imageGridSize = string.Empty; 43 string contentGridSize = string.Empty; 44 string informationItemsAlignment = Model.Item.GetRawValueString("IconItemsAlignment", "Column"); 45 string informationItemsAlignmentClass = "flex-column"; 46 int imageRatio = 100; 47 string imageShape = " overflow-hidden"; 48 string contentAlignmentClass = "d-flex flex-column gap-3"; 49 string imageAlignmentClass = string.Empty; 50 int imageWidth = 400; 51 int imageHeight = 400; 52 string contentPadding = Model.Item.GetRawValueString("ContentPadding", ""); 53 string contentPaddingClass = string.Empty; 54 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : string.Empty; 55 var decorations = Model.Item?.GetList("CssDecorations")?.GetRawValue().OfType<string>() ?? Enumerable.Empty<string>(); 56 string css = RenderCustomCSS(decorations); 57 var informationItems = Model.Item?.GetItems("InformationItems") ?? Enumerable.Empty<Dynamicweb.Frontend.ItemViewModel>().ToList(); 58 Dynamicweb.Frontend.FileViewModel image = Model.Item.GetFile("Image"); 59 string imagePath = image?.PathUrlEncoded ?? string.Empty; 60 int xPos = image?.FocalPositionFromLeft ?? 50; 61 int yPos = image?.FocalPositionFromTop ?? 50; 62 string imagePosition = $"{xPos}% {yPos}%"; 63 64 string headingLevel = Model.Item.GetString("HeadingLevel", "h2"); 65 string headingLevelStart = $"<{headingLevel} class=\"h5 mb-1\" itemprop=\"name\">"; 66 string headingLevelStop = $"</{headingLevel}>"; 67 68 switch (contentPadding) 69 { 70 case "small": 71 contentPaddingClass = " p-3"; 72 break; 73 case "large": 74 contentPaddingClass = " p-4"; 75 break; 76 } 77 78 switch (informationItemsAlignment) 79 { 80 case "Row": 81 informationItemsAlignmentClass = "flex-row"; 82 break; 83 } 84 85 switch (layout) 86 { 87 case "CircleImageTopCenter": 88 layoutClass += " d-flex flex-column gap-3 gap-lg-4"; 89 imageShape += " rounded-circle"; 90 contentAlignmentClass += " align-items-center text-center"; 91 imageAlignmentClass = " mx-auto"; 92 informationItemsAlignmentClass += " align-items-center justify-content-center text-center"; 93 break; 94 case "BoxedImageTopCenter1X1": 95 layoutClass += " d-flex flex-column gap-3 gap-lg-4"; 96 contentAlignmentClass += " align-items-center text-center"; 97 imageAlignmentClass = " mx-auto"; 98 informationItemsAlignmentClass += " align-items-center justify-content-center text-center"; 99 break; 100 case "BoxedImageTopLeft1X1": 101 layoutClass += " d-flex flex-column gap-3 gap-lg-4"; 102 break; 103 case "BoxedImageTopCenter3X4": 104 layoutClass += " d-flex flex-column gap-3 gap-lg-4"; 105 imageRatio = 133; 106 contentAlignmentClass += " align-items-center text-center"; 107 imageAlignmentClass = " mx-auto"; 108 imageWidth = 300; 109 informationItemsAlignmentClass += " align-items-center justify-content-center text-center"; 110 break; 111 case "BoxedImageTopLeft3X4": 112 layoutClass += " d-flex flex-column gap-3 gap-lg-4"; 113 imageRatio = 133; 114 imageWidth = 300; 115 break; 116 case "BoxedImageTopCenter4X3": 117 layoutClass += " d-flex flex-column gap-3 gap-lg-4"; 118 imageRatio = 75; 119 contentAlignmentClass += " align-items-center text-center"; 120 imageAlignmentClass = " mx-auto"; 121 imageHeight = 300; 122 informationItemsAlignmentClass += " align-items-center justify-content-center text-center"; 123 break; 124 case "BoxedImageTopLeft4X3": 125 layoutClass += " d-flex flex-column gap-3 gap-lg-4"; 126 imageRatio = 75; 127 imageHeight = 300; 128 break; 129 case "BoxedImageLeftLeft1X1": 130 layoutClass += " grid grid-12 gap-lg-4 align-items-start"; 131 imageGridSize = " g-col-4 g-col-lg-6"; 132 contentGridSize = "g-col-8 g-col-lg-6 "; 133 break; 134 case "CircleImageLeftLeft": 135 layoutClass += " grid grid-12 gap-lg-4 align-items-center"; 136 imageShape += " rounded-circle"; 137 imageGridSize = " g-col-4 g-col-lg-6"; 138 contentGridSize = "g-col-8 g-col-lg-6 "; 139 break; 140 } 141 } 142 143 <div class="h-100 position-relative@(layoutClass)@(contentPaddingClass)@(theme) @(css)" itemscope itemtype="https://schema.org/Person"> 144 <div id="@Model.ID" class="user-select-none position-absolute" style="scroll-margin-top:var(--header-height,150px)"></div> 145 146 @if (!string.IsNullOrEmpty(imagePath)) 147 { 148 <div class="ratio@(imageGridSize)@(imageShape)@(imageAlignmentClass)" style="--bs-aspect-ratio:@imageRatio%;"> 149 <img src="/Admin/Public/GetImage.ashx?image=@imagePath&width=@(imageWidth*2)&crop=0&format=webp;" width="@imageWidth" height="@imageHeight" alt="@name" style="object-fit:cover;object-position:@imagePosition" itemprop="image"> 150 </div> 151 } 152 153 <div class="@(contentGridSize)@(contentAlignmentClass)"> 154 155 <div> 156 @headingLevelStart 157 @name 158 @headingLevelStop 159 160 @if (!string.IsNullOrEmpty(jobTitle)) 161 { 162 <div class="fs-7 opacity-85" itemprop="jobTitle">@jobTitle</div> 163 } 164 165 @if (!string.IsNullOrEmpty(description)) 166 { 167 <div class="fs-6 mt-2">@description</div> 168 } 169 170 </div> 171 172 <div class="d-flex flex-wrap @informationItemsAlignmentClass gap-3"> 173 @foreach (var item in informationItems) 174 { 175 string label = item.GetString("Label", string.Empty); 176 string icon = item.GetString("Icon", string.Empty); 177 string schemaValue = item.GetString("Schema_org_Type", string.Empty); 178 Dynamicweb.Frontend.LinkViewModel link = new Dynamicweb.Frontend.LinkViewModel(); 179 180 if (item.GetLink("Link") != null) 181 { 182 link = item.GetLink("Link"); 183 } 184 185 if (link != null && !string.IsNullOrEmpty(link.Url)) 186 { 187 string target = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && link.IsExternal ? "target=\"_blank\"" : ""; 188 string rel = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && link.IsExternal ? "rel=\"noopener\"" : ""; 189 string schemaAttr = string.Empty; 190 191 if (schemaValue != string.Empty) 192 { 193 schemaAttr = "itemprop='" + schemaValue + "'"; 194 } 195 196 <a href="@link.Url" @target @rel @schemaAttr class="d-flex lh-1 align-items-center gap-2 text-decoration-none text-decoration-underline-hover"> 197 @if (!string.IsNullOrEmpty(icon) && !icon.ToLower().Contains("none")) 198 { 199 <span class="icon-2">@ReadFile(icon)</span> 200 } 201 @if (!string.IsNullOrEmpty(label)) 202 { 203 <div class="opacity-85 fs-8 text-break">@label</div> 204 } 205 </a> 206 } 207 else 208 { 209 <div class="d-flex gap-2"> 210 @if (!string.IsNullOrEmpty(icon) && !icon.ToLower().Contains("none")) 211 { 212 <span class="icon-2">@ReadFile(icon)</span> 213 } 214 @if (!string.IsNullOrEmpty(label)) 215 { 216 <div class="opacity-85 fs-8 text-break">@label</div> 217 } 218 </div> 219 } 220 } 221 </div> 222 223 </div> 224 </div> 225
Error executing template "Designs/Swift/Paragraph/Swift_Employee.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 @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 name = Model.Item.GetRawValueString("Name", string.Empty); 38 string jobTitle = Model.Item.GetRawValueString("Title", string.Empty); 39 string description = Model.Item.GetRawValueString("Description", string.Empty); 40 string layout = Model.Item.GetRawValueString("Layout", string.Empty); 41 string layoutClass = string.Empty; 42 string imageGridSize = string.Empty; 43 string contentGridSize = string.Empty; 44 string informationItemsAlignment = Model.Item.GetRawValueString("IconItemsAlignment", "Column"); 45 string informationItemsAlignmentClass = "flex-column"; 46 int imageRatio = 100; 47 string imageShape = " overflow-hidden"; 48 string contentAlignmentClass = "d-flex flex-column gap-3"; 49 string imageAlignmentClass = string.Empty; 50 int imageWidth = 400; 51 int imageHeight = 400; 52 string contentPadding = Model.Item.GetRawValueString("ContentPadding", ""); 53 string contentPaddingClass = string.Empty; 54 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : string.Empty; 55 var decorations = Model.Item?.GetList("CssDecorations")?.GetRawValue().OfType<string>() ?? Enumerable.Empty<string>(); 56 string css = RenderCustomCSS(decorations); 57 var informationItems = Model.Item?.GetItems("InformationItems") ?? Enumerable.Empty<Dynamicweb.Frontend.ItemViewModel>().ToList(); 58 Dynamicweb.Frontend.FileViewModel image = Model.Item.GetFile("Image"); 59 string imagePath = image?.PathUrlEncoded ?? string.Empty; 60 int xPos = image?.FocalPositionFromLeft ?? 50; 61 int yPos = image?.FocalPositionFromTop ?? 50; 62 string imagePosition = $"{xPos}% {yPos}%"; 63 64 string headingLevel = Model.Item.GetString("HeadingLevel", "h2"); 65 string headingLevelStart = $"<{headingLevel} class=\"h5 mb-1\" itemprop=\"name\">"; 66 string headingLevelStop = $"</{headingLevel}>"; 67 68 switch (contentPadding) 69 { 70 case "small": 71 contentPaddingClass = " p-3"; 72 break; 73 case "large": 74 contentPaddingClass = " p-4"; 75 break; 76 } 77 78 switch (informationItemsAlignment) 79 { 80 case "Row": 81 informationItemsAlignmentClass = "flex-row"; 82 break; 83 } 84 85 switch (layout) 86 { 87 case "CircleImageTopCenter": 88 layoutClass += " d-flex flex-column gap-3 gap-lg-4"; 89 imageShape += " rounded-circle"; 90 contentAlignmentClass += " align-items-center text-center"; 91 imageAlignmentClass = " mx-auto"; 92 informationItemsAlignmentClass += " align-items-center justify-content-center text-center"; 93 break; 94 case "BoxedImageTopCenter1X1": 95 layoutClass += " d-flex flex-column gap-3 gap-lg-4"; 96 contentAlignmentClass += " align-items-center text-center"; 97 imageAlignmentClass = " mx-auto"; 98 informationItemsAlignmentClass += " align-items-center justify-content-center text-center"; 99 break; 100 case "BoxedImageTopLeft1X1": 101 layoutClass += " d-flex flex-column gap-3 gap-lg-4"; 102 break; 103 case "BoxedImageTopCenter3X4": 104 layoutClass += " d-flex flex-column gap-3 gap-lg-4"; 105 imageRatio = 133; 106 contentAlignmentClass += " align-items-center text-center"; 107 imageAlignmentClass = " mx-auto"; 108 imageWidth = 300; 109 informationItemsAlignmentClass += " align-items-center justify-content-center text-center"; 110 break; 111 case "BoxedImageTopLeft3X4": 112 layoutClass += " d-flex flex-column gap-3 gap-lg-4"; 113 imageRatio = 133; 114 imageWidth = 300; 115 break; 116 case "BoxedImageTopCenter4X3": 117 layoutClass += " d-flex flex-column gap-3 gap-lg-4"; 118 imageRatio = 75; 119 contentAlignmentClass += " align-items-center text-center"; 120 imageAlignmentClass = " mx-auto"; 121 imageHeight = 300; 122 informationItemsAlignmentClass += " align-items-center justify-content-center text-center"; 123 break; 124 case "BoxedImageTopLeft4X3": 125 layoutClass += " d-flex flex-column gap-3 gap-lg-4"; 126 imageRatio = 75; 127 imageHeight = 300; 128 break; 129 case "BoxedImageLeftLeft1X1": 130 layoutClass += " grid grid-12 gap-lg-4 align-items-start"; 131 imageGridSize = " g-col-4 g-col-lg-6"; 132 contentGridSize = "g-col-8 g-col-lg-6 "; 133 break; 134 case "CircleImageLeftLeft": 135 layoutClass += " grid grid-12 gap-lg-4 align-items-center"; 136 imageShape += " rounded-circle"; 137 imageGridSize = " g-col-4 g-col-lg-6"; 138 contentGridSize = "g-col-8 g-col-lg-6 "; 139 break; 140 } 141 } 142 143 <div class="h-100 position-relative@(layoutClass)@(contentPaddingClass)@(theme) @(css)" itemscope itemtype="https://schema.org/Person"> 144 <div id="@Model.ID" class="user-select-none position-absolute" style="scroll-margin-top:var(--header-height,150px)"></div> 145 146 @if (!string.IsNullOrEmpty(imagePath)) 147 { 148 <div class="ratio@(imageGridSize)@(imageShape)@(imageAlignmentClass)" style="--bs-aspect-ratio:@imageRatio%;"> 149 <img src="/Admin/Public/GetImage.ashx?image=@imagePath&width=@(imageWidth*2)&crop=0&format=webp;" width="@imageWidth" height="@imageHeight" alt="@name" style="object-fit:cover;object-position:@imagePosition" itemprop="image"> 150 </div> 151 } 152 153 <div class="@(contentGridSize)@(contentAlignmentClass)"> 154 155 <div> 156 @headingLevelStart 157 @name 158 @headingLevelStop 159 160 @if (!string.IsNullOrEmpty(jobTitle)) 161 { 162 <div class="fs-7 opacity-85" itemprop="jobTitle">@jobTitle</div> 163 } 164 165 @if (!string.IsNullOrEmpty(description)) 166 { 167 <div class="fs-6 mt-2">@description</div> 168 } 169 170 </div> 171 172 <div class="d-flex flex-wrap @informationItemsAlignmentClass gap-3"> 173 @foreach (var item in informationItems) 174 { 175 string label = item.GetString("Label", string.Empty); 176 string icon = item.GetString("Icon", string.Empty); 177 string schemaValue = item.GetString("Schema_org_Type", string.Empty); 178 Dynamicweb.Frontend.LinkViewModel link = new Dynamicweb.Frontend.LinkViewModel(); 179 180 if (item.GetLink("Link") != null) 181 { 182 link = item.GetLink("Link"); 183 } 184 185 if (link != null && !string.IsNullOrEmpty(link.Url)) 186 { 187 string target = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && link.IsExternal ? "target=\"_blank\"" : ""; 188 string rel = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && link.IsExternal ? "rel=\"noopener\"" : ""; 189 string schemaAttr = string.Empty; 190 191 if (schemaValue != string.Empty) 192 { 193 schemaAttr = "itemprop='" + schemaValue + "'"; 194 } 195 196 <a href="@link.Url" @target @rel @schemaAttr class="d-flex lh-1 align-items-center gap-2 text-decoration-none text-decoration-underline-hover"> 197 @if (!string.IsNullOrEmpty(icon) && !icon.ToLower().Contains("none")) 198 { 199 <span class="icon-2">@ReadFile(icon)</span> 200 } 201 @if (!string.IsNullOrEmpty(label)) 202 { 203 <div class="opacity-85 fs-8 text-break">@label</div> 204 } 205 </a> 206 } 207 else 208 { 209 <div class="d-flex gap-2"> 210 @if (!string.IsNullOrEmpty(icon) && !icon.ToLower().Contains("none")) 211 { 212 <span class="icon-2">@ReadFile(icon)</span> 213 } 214 @if (!string.IsNullOrEmpty(label)) 215 { 216 <div class="opacity-85 fs-8 text-break">@label</div> 217 } 218 </div> 219 } 220 } 221 </div> 222 223 </div> 224 </div> 225

Looking for a great partnership?

Let us know
Error executing template "CookieWarning/Cookies.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.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2 @using Dynamicweb.Environment; 3 4 @{ 5 var categories = CookieManager.GetCategories(); 6 7 string cookieNoticeLink = Pageview.AreaSettings.GetLink("CookiePolicyLink") != null ? Pageview.AreaSettings.GetLink("CookiePolicyLink").Url : ""; 8 string privacyPolicyLink = Pageview.AreaSettings.GetLink("PrivacyPolicyLink") != null ? Pageview.AreaSettings.GetLink("PrivacyPolicyLink").Url : ""; 9 int cookieNoticePageID = Pageview.AreaSettings.GetLink("CookiePolicyLink") != null ? Pageview.AreaSettings.GetLink("CookiePolicyLink").PageId : 0; 10 int privacyPolicyPageID = Pageview.AreaSettings.GetLink("PrivacyPolicyLink") != null ? Pageview.AreaSettings.GetLink("PrivacyPolicyLink").PageId : 0; 11 string googleTagManagerID = Pageview.AreaSettings.GetString("GoogleTagManagerID"); 12 13 string layout = Pageview.AreaSettings.GetRawValueString("CookieLayout", "modal"); 14 15 layout = Pageview.Page.ID == cookieNoticePageID || Pageview.Page.ID == privacyPolicyPageID ? "both" : layout; 16 } 17 18 @if (!Pageview.IsVisualEditorMode) { 19 if (layout == "banner" || layout == "both") 20 { 21 string bannerTheme = !string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetRawValueString("CookieBannerTheme")) ? " theme " + Pageview.AreaSettings.GetRawValueString("CookieBannerTheme").Replace(" ", "").Trim().ToLower() : "theme light"; 22 23 <div class="position-fixed bottom-0 w-100 shadow @bannerTheme" id="dwCookieBanner"> 24 <div class="align-items-center grid p-3"> 25 @if (layout == "banner") 26 { 27 <div class="g-col-12 g-col-md-6 g-col-lg-8"> 28 <span>@Translate("By clicking 'Accept All' you consent that we may collect information about you for various purposes, including: Statistics and Marketing")</span> 29 </div> 30 <div class="g-col-12 g-col-md-6 g-col-lg-4"> 31 <div class="grid grid-1 grid-sm-2"> 32 <button type="button" onclick="setOptInCookie(2)" class="btn btn-primary" id="CookiesAcceptAll"> 33 @Translate("Accept all") 34 </button> 35 <button type="button" onclick="setOptInCookie(1)" class="btn btn-secondary" id="CookiesDeclineAll"> 36 @Translate("Decline") 37 </button> 38 </div> 39 </div> 40 } 41 @if (layout == "both") 42 { 43 <div class="g-col-12 g-col-lg-6 g-col-xxl-8"> 44 <span>@Translate("By clicking 'Accept All' you consent that we may collect information about you for various purposes, including: Statistics and Marketing")</span> 45 </div> 46 <div class="g-col-12 g-col-lg-6 g-col-xxl-4"> 47 <div class="grid grid-1 grid-sm-3"> 48 <button type="button" class="btn btn-link" data-bs-toggle="modal" data-bs-target="#dwCookieModal"> 49 @Translate("Customize settings") 50 </button> 51 <button type="button" onclick="setOptInCookie(2)" class="btn btn-secondary" id="CookiesAcceptAll"> 52 @Translate("Accept all") 53 </button> 54 <button type="button" onclick="setOptInCookie(1)" class="btn btn-secondary" id="CookiesDeclineAll"> 55 @Translate("Decline") 56 </button> 57 </div> 58 </div> 59 } 60 </div> 61 </div> 62 } 63 64 if (layout == "modal" || layout == "both") 65 { 66 string modalTheme = !string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetRawValueString("CookieModalTheme")) ? " theme " + Pageview.AreaSettings.GetRawValueString("CookieModalTheme").Replace(" ", "").Trim().ToLower() : "theme light"; 67 68 <div class="modal fade" id="dwCookieModal"> 69 <div class="modal-dialog modal-dialog-centered modal-dialog-scrollable" style="max-width:560px;"> 70 <div class="modal-content @modalTheme"> 71 <div style="overflow-y:auto;overflow-x:hidden"> 72 <div class="p-3 p-md-4 overflow-auto" style="max-height:50vh;"> 73 <div class="h3 mb-3">@Translate("You control your data")</div> 74 <p>@Translate("We and our partners use technologies, including cookies, to collect information about you for various purposes, including"):</p> 75 <ol> 76 <li>@Translate("Functionality")</li> 77 <li>@Translate("Statistics")</li> 78 <li>@Translate("Marketing")</li> 79 </ol> 80 <p>@Translate("By clicking 'Accept All' you consent to all these purposes. You can also choose to indicate what purposes you will consent to using the custom selections and then click 'Accept selected'").</p> 81 82 @if (!string.IsNullOrEmpty(cookieNoticeLink) || !string.IsNullOrEmpty(privacyPolicyLink)) 83 { 84 <p>@Translate("You can read more about our use of cookies and other technologies, as well as our collection and processing of personal data by clicking here"):</p> 85 } 86 87 @if (!string.IsNullOrEmpty(cookieNoticeLink)) 88 { 89 <a href="@cookieNoticeLink" class="d-block mb-3" id="CookiesReadModeAbout">@Translate("Read more about Cookies")</a> 90 } 91 @if (!string.IsNullOrEmpty(privacyPolicyLink)) 92 { 93 <a href="@privacyPolicyLink" class="d-block" id="CookiesPrivacyPolicy">@Translate("Our privacy policy")</a> 94 } 95 </div> 96 97 <div class="p-3 px-md-4 border-top"> 98 <div class="grid grid-1 grid-sm-2 gap-3"> 99 <button type="button" onclick="setOptInCookie(1)" class="btn btn-secondary" data-bs-dismiss="modal" id="dwCookieDeclineAll">@Translate("Decline")</button> 100 @if (categories.Any()) 101 { 102 <button type="button" onclick="acceptCustomSetup()" class="btn btn-secondary d-none" data-bs-dismiss="modal" id="dwCookieAcceptSelected">@Translate("Accept selected")</button> 103 } 104 <button type="button" onclick="setOptInCookie(2)" class="btn btn-secondary" data-bs-dismiss="modal" id="dwCookieAcceptAll">@Translate("Accept All")</button> 105 </div> 106 </div> 107 108 @if (categories.Any()) 109 { 110 int categoriesCount = 0; 111 int totalCategories = categories.Count(); 112 113 <form id="dwCookieModalCustomForm" method="post" action="/Admin/Public/CookieOptInLevelConfig.aspx"> 114 <input type="hidden" name="cmd" value="SetCookieOptInLevel"> 115 <input type="hidden" name="OptInLevel" id="OptInLevel" value="1"> 116 <div class="grid grid-2 grid-sm-4 gap-0 px-md-3 border-top border-1"> 117 <div class="p-3"> 118 <label class="form-check-label" for="dwCookieNecessary"><span>@Translate("Necessary")</span></label> 119 <div class="form-check form-switch form-control-lg py-0"> 120 <input class="form-check-input opacity-100" type="checkbox" id="dwCookieNecessary" checked disabled style="background-color: rgba(0,0,0,0.1);"> 121 </div> 122 </div> 123 @foreach (var category in categories) 124 { 125 string border = categoriesCount < (totalCategories - 1) ? "" : ""; 126 127 <div class="p-3 @(border)"> 128 <label class="form-check-label" for="CookieCategory_@category"><span>@Translate(category)</span></label> 129 <div class="form-check form-switch form-control-lg py-0"> 130 <input class="form-check-input js-checkbox" type="checkbox" name="OptInCategory" value="@category" id="CookieCategory_@category" onchange="toggleAcceptSelected()" style="background-color: rgba(0,0,0,0.1);"> 131 </div> 132 </div> 133 categoriesCount++; 134 } 135 </div> 136 </form> 137 } 138 </div> 139 </div> 140 </div> 141 </div> 142 } 143 144 145 <script> 146 async function setOptInCookie(optInLevel) { 147 let response = await fetch("/admin/public/CookieOptInLevelConfig.aspx?cmd=SetCookieOptInLevel&OptInLevel=" + optInLevel); 148 @if (!string.IsNullOrWhiteSpace(googleTagManagerID)){ <text> 149 if (optInLevel == '2') { 150 consentGrantedAll(); 151 } 152 </text> 153 } 154 155 if (response.ok) { 156 if (document.querySelector("#dwCookieBanner")) { 157 document.querySelector("#dwCookieBanner").classList.add("d-none"); 158 } 159 document.location.reload(); 160 return false; 161 } else { 162 return false; 163 } 164 } 165 166 async function acceptCustomSetup() { 167 var form = document.querySelector("#dwCookieModalCustomForm"); 168 169 let formData = new FormData(form); 170 var fetchOptions = { 171 method: 'POST', 172 body: formData 173 }; 174 175 for (const value of formData.values()) { 176 console.log(value); 177 if (value == 'Marketing') { console.log('Granting marketing cookies') consentGrantedMarketing(); 178 } 179 if (value == 'Statistical') { 180 console.log('Granting statistical cookies') 181 consentGrantedAnalyticsStorage(); 182 } 183 } 184 185 186 let response = await fetch(form.action, fetchOptions); 187 188 if (response.ok) { 189 if (document.querySelector("#dwCookieBanner")) { 190 document.querySelector("#dwCookieBanner").classList.add("d-none"); 191 } 192 document.location.reload(); 193 return false; 194 } else { 195 return false; 196 } 197 } 198 199 200 function consentGrantedAll() { 201 consentGrantedMarketing(); 202 consentGrantedAnalyticsStorage(); 203 } 204 function consentGrantedMarketing() { 205 consentGrantedAdStorage(); 206 consentGrantedAdUserData(); 207 consentGrantedAdPersonalization(); 208 } 209 210 function consentGrantedAdStorage() { 211 if (!window.dataLayer) return; 212 gtag('consent', 'update', { 213 'ad_storage': 'granted' 214 }); 215 } 216 217 function consentGrantedAdUserData() { 218 if (!window.dataLayer) return; 219 gtag('consent', 'update', { 220 'ad_user_data': 'granted' 221 }); 222 } 223 224 function consentGrantedAdPersonalization() { 225 if (!window.dataLayer) return; 226 gtag('consent', 'update', { 227 'ad_personalization': 'granted' 228 }); 229 } 230 231 function consentGrantedAnalyticsStorage() { 232 if (!window.dataLayer) return; 233 gtag('consent', 'update', { 234 'analytics_storage': 'granted' 235 }); 236 } 237 238 function toggleAcceptSelected() { 239 var cookieCalegoriesElement = document.querySelector("#dwCookieModalCustomForm"); 240 var enableAcceptSelected = false; 241 242 cookieCalegoriesElement.querySelectorAll(".js-checkbox").forEach(function (field) { 243 if (field.checked == true) { 244 enableAcceptSelected = true; 245 } 246 }); 247 248 if (enableAcceptSelected) { 249 document.querySelector("#dwCookieDeclineAll").classList.add("d-none"); 250 document.querySelector("#dwCookieAcceptSelected").classList.remove("d-none"); 251 } else { 252 document.querySelector("#dwCookieDeclineAll").classList.remove("d-none"); 253 document.querySelector("#dwCookieAcceptSelected").classList.add("d-none"); 254 } 255 } 256 257 function showCookieModal() { 258 var cookieModal = new bootstrap.Modal(document.querySelector('#dwCookieModal'), { 259 backdrop: 'static' 260 }); 261 cookieModal.show(); 262 } 263 </script> 264 265 if (layout == "modal") 266 { 267 <script type="module"> 268 showCookieModal(); 269 </script> 270 } 271 } 272