Error executing template "Designs/Swift/Paragraph/Swift_ProductCatalogDetailsApp.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 //Set default product data for use in Visual Editor 6 if (Pageview.IsVisualEditorMode) 7 { 8 ProductViewModelSettings productSetting = new ProductViewModelSettings 9 { 10 LanguageId = Dynamicweb.Ecommerce.Common.Context.LanguageID, 11 CurrencyCode = Dynamicweb.Ecommerce.Common.Context.Currency.Code, 12 CountryCode = Dynamicweb.Ecommerce.Common.Context.Country.Code2, 13 ShopId = Pageview.Area.EcomShopId 14 }; 15 16 string selectedDummyProduct = "PROD1"; 17 var list = new ProductListViewModel(); 18 if (Model.Item.GetValue("DummyProduct") != null) 19 { 20 list = Model.Item.GetValue("DummyProduct") as ProductListViewModel; 21 22 foreach (var product in list.Products) 23 { 24 selectedDummyProduct = product.Id; 25 } 26 27 ProductViewModel dummyProduct = ViewModelFactory.CreateView(productSetting, selectedDummyProduct); 28 29 if (!Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 30 { 31 Dynamicweb.Context.Current.Items.Add("ProductDetails", dummyProduct); 32 } 33 } 34 else 35 { 36 <div class="alert alert-danger" role="alert"> 37 <span>@Translate("Please select a Dummy product on this paragraph")</span> 38 </div> 39 } 40 } 41 else if (!Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 42 { 43 ProductViewModel dummyProduct = new ProductViewModel(); 44 Dynamicweb.Context.Current.Items.Add("ProductDetails", dummyProduct); 45 } 46 } 47 48 @if (Pageview.IsVisualEditorMode) 49 { 50 <div class="alert alert-info" role="alert"> 51 <span>@Translate("Product catalog App: Edit this column to configure. (Product catalog app must be attached this paragraph)")</span> 52 </div> 53 } 54 55 <div class="item_@Model.Item.SystemName.ToLower()"> 56 @Model.GetModuleOutput() 57 </div> 58
Error executing template "Designs/Swift/Paragraph/Swift_BreadcrumbNavigation.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.Frontend.Navigation 3 4 @{ 5 var navigationSettings = new NavigationSettings(); 6 navigationSettings.IncludeFoldersAndHidden = true; 7 navigationSettings.ExpandMode = ExpandMode.PathOnly; 8 navigationSettings.Parameters.Add("menu-id", "breadcrumb"); 9 navigationSettings.Parameters.Add("showProductInBreadcrumb", Model.Item.GetBoolean("ShowProductInBreadcrumb")); 10 } 11 12 @Navigation.RenderNavigation("Navigation/BreadcrumbNavigation.cshtml", navigationSettings) 13
Error executing template "/Designs/Swift/Grid/Page/RowTemplates/2Columns_8-4.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 containerClass = "container-xl"; 83 string width = Model.Item.GetRawValueString("Width", "container-xl"); 84 if (width == "none") 85 { 86 containerClass = "container-fluid px-0"; 87 } 88 if (width == "stretch") 89 { 90 containerClass = "container-fluid"; 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 { 107 rowClass = " gap-0"; 108 } 109 if (spaceBetweenColumnsMobile == "spacing-medium") 110 { 111 rowClass = " gap-4"; 112 } 113 if (spaceBetweenColumnsMobile == "spacing-large") 114 { 115 rowClass = " gap-5"; 116 } 117 //Desktop 118 if (spaceBetweenColumns == "stick") 119 { 120 rowClass += " gap-lg-0"; 121 } 122 if (spaceBetweenColumns == "spacing-medium") 123 { 124 rowClass += " gap-lg-4"; 125 } 126 if (spaceBetweenColumns == "spacing-large") 127 { 128 rowClass += " gap-lg-5"; 129 } 130 131 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 132 133 string animationOnScrollCol1 = Model.Item.GetRawValueString("AnimationOnScrollCol1", "no-animation"); 134 animationOnScrollCol1 = animationOnScrollCol1 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol1 + "'" : ""; 135 string animationOnScrollCol2 = Model.Item.GetRawValueString("AnimationOnScrollCol2", "no-animation"); 136 animationOnScrollCol2 = animationOnScrollCol2 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol2 + "'" : ""; 137 138 string hideOverflow = " overflow-hidden"; 139 hideOverflow = 140 animationOnScrollCol1 != "" || 141 animationOnScrollCol2 != "" 142 ? hideOverflow : ""; 143 144 Dynamicweb.Frontend.FileViewModel backgroundImage = Model.Item.GetFile("BackgroundImage"); 145 string backgroundImagePath = backgroundImage?.Path ?? string.Empty; 146 backgroundImagePath = !string.IsNullOrEmpty(backgroundImagePath) ? $"/Admin/Public/GetImage.ashx?image={backgroundImagePath}&width=2600&format=webp&compression=75" : string.Empty; 147 backgroundImagePath = Dynamicweb.Core.Encoders.HtmlEncoder.UrlPathEncode(backgroundImagePath); 148 string backgroundRepeat = Model.Item.GetRawValueString("BackgroundImageRepeat", "no-repeat"); 149 string backgroundImageSize = Model.Item.GetRawValueString("BackgroundImageSize", "initial"); 150 int xPos = backgroundImage?.FocalPositionFromLeft ?? 50; 151 int yPos = backgroundImage?.FocalPositionFromTop ?? 50; 152 string cssPosition = $"{xPos}% {yPos}%"; 153 string gradient = Model.Item.GetRawValueString("Gradient", string.Empty); 154 string gradientOpacity = Model.Item.GetRawValueString("GradientOpacity", "0.00"); 155 string gradientString = "linear-gradient(" + gradient + "deg," + "rgba(var(--swift-foreground-color-rgb)," + gradientOpacity + "), rgba(var(--swift-background-color-rgb)," + gradientOpacity + "))"; 156 string backgroundImageString = "url(" + backgroundImagePath + ")"; 157 string backgroundImagePositionString = "background-position:" + cssPosition + ";"; 158 string backgroundRepeatString = "background-repeat:" + backgroundRepeat + ";"; 159 string backgroundImageSizeString = "background-size:" + backgroundImageSize + ";"; 160 string styleString = string.Empty; 161 162 var decorations = Model.Item?.GetList("CssDecorations")?.GetRawValue().OfType<string>() ?? Enumerable.Empty<string>(); 163 var css = string.Empty; 164 var cssClasses = new List<string> { }; 165 166 foreach (var itemId in decorations) 167 { 168 var item = Dynamicweb.Content.Services.Items.GetItem("Swift_Css", itemId); 169 item.TryGetValue("Class", out object classes); 170 if (classes is null) 171 { 172 continue; 173 } 174 175 var cssString = (string)classes; 176 if (cssString.StartsWith("[")) 177 { 178 var cssArray = Dynamicweb.Core.Converter.Deserialize<string[]>(cssString); 179 cssClasses.AddRange(cssArray); 180 } 181 else 182 { 183 cssClasses.Add(cssString.Replace(",", " ")); 184 } 185 } 186 css = string.Join(" ", cssClasses).Trim(); 187 188 @* Only gradient *@ 189 190 if (!string.IsNullOrEmpty(gradient) && string.IsNullOrEmpty(backgroundImagePath) && gradientOpacity != ("0.00")) 191 { 192 styleString += "style=\"background-image:" + gradientString + ";\""; 193 } 194 195 @* Only background image *@ 196 197 else if (string.IsNullOrEmpty(gradient) && !string.IsNullOrEmpty(backgroundImagePath)) 198 { 199 styleString += "style=\"background-image:" + backgroundImageString + "; " + backgroundImagePositionString + backgroundRepeatString + backgroundImageSizeString + "\""; 200 } 201 202 @* Gradient and background image *@ 203 204 else if (!string.IsNullOrEmpty(gradient) && !string.IsNullOrEmpty(backgroundImagePath)) 205 { 206 styleString += "style=\"background-image:" + gradientString + "," + backgroundImageString + ";" + backgroundImagePositionString + backgroundRepeatString + backgroundImageSizeString + "\""; 207 } 208 209 int mobileColumnSize = Dynamicweb.Core.Converter.ToInt32(Model.Item.GetRawValueString("MobileColumnBehaviour", "1")); 210 int mobileOrderFirst = Dynamicweb.Core.Converter.ToInt32(Model.Item.GetRawValueString("MobileOrderFirst", "1")); 211 212 if (Pageview.IsVisualEditorMode || !string.IsNullOrWhiteSpace(Model.Column(1).Output()) || !string.IsNullOrWhiteSpace(Model.Column(2).Output())) 213 { 214 <div class="@(sectionClass)@(theme) @(css) item_@Model.Item.SystemName.ToLower()" @styleString data-swift-gridrow> 215 <div class="@containerClass@(hideOverflow)"> 216 <div class="grid grid-@(mobileColumnSize) grid-lg-3@(rowClass)"> 217 <div class="g-col g-col-lg-2 @(Model.Column(1).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="8" @animationOnScrollCol2 style="--bs-columns:12"> 218 @Model.Column(1).Output() 219 </div> 220 <div class="g-col @(Model.Column(2).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="4" @animationOnScrollCol1 style="--bs-columns:12"> 221 @Model.Column(2).Output() 222 </div> 223 </div> 224 </div> 225 </div> 226 } 227 } 228
Error executing template "/Designs/Swift/Grid/Page/RowTemplates/2Columns_8-4.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 containerClass = "container-xl"; 83 string width = Model.Item.GetRawValueString("Width", "container-xl"); 84 if (width == "none") 85 { 86 containerClass = "container-fluid px-0"; 87 } 88 if (width == "stretch") 89 { 90 containerClass = "container-fluid"; 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 { 107 rowClass = " gap-0"; 108 } 109 if (spaceBetweenColumnsMobile == "spacing-medium") 110 { 111 rowClass = " gap-4"; 112 } 113 if (spaceBetweenColumnsMobile == "spacing-large") 114 { 115 rowClass = " gap-5"; 116 } 117 //Desktop 118 if (spaceBetweenColumns == "stick") 119 { 120 rowClass += " gap-lg-0"; 121 } 122 if (spaceBetweenColumns == "spacing-medium") 123 { 124 rowClass += " gap-lg-4"; 125 } 126 if (spaceBetweenColumns == "spacing-large") 127 { 128 rowClass += " gap-lg-5"; 129 } 130 131 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 132 133 string animationOnScrollCol1 = Model.Item.GetRawValueString("AnimationOnScrollCol1", "no-animation"); 134 animationOnScrollCol1 = animationOnScrollCol1 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol1 + "'" : ""; 135 string animationOnScrollCol2 = Model.Item.GetRawValueString("AnimationOnScrollCol2", "no-animation"); 136 animationOnScrollCol2 = animationOnScrollCol2 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol2 + "'" : ""; 137 138 string hideOverflow = " overflow-hidden"; 139 hideOverflow = 140 animationOnScrollCol1 != "" || 141 animationOnScrollCol2 != "" 142 ? hideOverflow : ""; 143 144 Dynamicweb.Frontend.FileViewModel backgroundImage = Model.Item.GetFile("BackgroundImage"); 145 string backgroundImagePath = backgroundImage?.Path ?? string.Empty; 146 backgroundImagePath = !string.IsNullOrEmpty(backgroundImagePath) ? $"/Admin/Public/GetImage.ashx?image={backgroundImagePath}&width=2600&format=webp&compression=75" : string.Empty; 147 backgroundImagePath = Dynamicweb.Core.Encoders.HtmlEncoder.UrlPathEncode(backgroundImagePath); 148 string backgroundRepeat = Model.Item.GetRawValueString("BackgroundImageRepeat", "no-repeat"); 149 string backgroundImageSize = Model.Item.GetRawValueString("BackgroundImageSize", "initial"); 150 int xPos = backgroundImage?.FocalPositionFromLeft ?? 50; 151 int yPos = backgroundImage?.FocalPositionFromTop ?? 50; 152 string cssPosition = $"{xPos}% {yPos}%"; 153 string gradient = Model.Item.GetRawValueString("Gradient", string.Empty); 154 string gradientOpacity = Model.Item.GetRawValueString("GradientOpacity", "0.00"); 155 string gradientString = "linear-gradient(" + gradient + "deg," + "rgba(var(--swift-foreground-color-rgb)," + gradientOpacity + "), rgba(var(--swift-background-color-rgb)," + gradientOpacity + "))"; 156 string backgroundImageString = "url(" + backgroundImagePath + ")"; 157 string backgroundImagePositionString = "background-position:" + cssPosition + ";"; 158 string backgroundRepeatString = "background-repeat:" + backgroundRepeat + ";"; 159 string backgroundImageSizeString = "background-size:" + backgroundImageSize + ";"; 160 string styleString = string.Empty; 161 162 var decorations = Model.Item?.GetList("CssDecorations")?.GetRawValue().OfType<string>() ?? Enumerable.Empty<string>(); 163 var css = string.Empty; 164 var cssClasses = new List<string> { }; 165 166 foreach (var itemId in decorations) 167 { 168 var item = Dynamicweb.Content.Services.Items.GetItem("Swift_Css", itemId); 169 item.TryGetValue("Class", out object classes); 170 if (classes is null) 171 { 172 continue; 173 } 174 175 var cssString = (string)classes; 176 if (cssString.StartsWith("[")) 177 { 178 var cssArray = Dynamicweb.Core.Converter.Deserialize<string[]>(cssString); 179 cssClasses.AddRange(cssArray); 180 } 181 else 182 { 183 cssClasses.Add(cssString.Replace(",", " ")); 184 } 185 } 186 css = string.Join(" ", cssClasses).Trim(); 187 188 @* Only gradient *@ 189 190 if (!string.IsNullOrEmpty(gradient) && string.IsNullOrEmpty(backgroundImagePath) && gradientOpacity != ("0.00")) 191 { 192 styleString += "style=\"background-image:" + gradientString + ";\""; 193 } 194 195 @* Only background image *@ 196 197 else if (string.IsNullOrEmpty(gradient) && !string.IsNullOrEmpty(backgroundImagePath)) 198 { 199 styleString += "style=\"background-image:" + backgroundImageString + "; " + backgroundImagePositionString + backgroundRepeatString + backgroundImageSizeString + "\""; 200 } 201 202 @* Gradient and background image *@ 203 204 else if (!string.IsNullOrEmpty(gradient) && !string.IsNullOrEmpty(backgroundImagePath)) 205 { 206 styleString += "style=\"background-image:" + gradientString + "," + backgroundImageString + ";" + backgroundImagePositionString + backgroundRepeatString + backgroundImageSizeString + "\""; 207 } 208 209 int mobileColumnSize = Dynamicweb.Core.Converter.ToInt32(Model.Item.GetRawValueString("MobileColumnBehaviour", "1")); 210 int mobileOrderFirst = Dynamicweb.Core.Converter.ToInt32(Model.Item.GetRawValueString("MobileOrderFirst", "1")); 211 212 if (Pageview.IsVisualEditorMode || !string.IsNullOrWhiteSpace(Model.Column(1).Output()) || !string.IsNullOrWhiteSpace(Model.Column(2).Output())) 213 { 214 <div class="@(sectionClass)@(theme) @(css) item_@Model.Item.SystemName.ToLower()" @styleString data-swift-gridrow> 215 <div class="@containerClass@(hideOverflow)"> 216 <div class="grid grid-@(mobileColumnSize) grid-lg-3@(rowClass)"> 217 <div class="g-col g-col-lg-2 @(Model.Column(1).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="8" @animationOnScrollCol2 style="--bs-columns:12"> 218 @Model.Column(1).Output() 219 </div> 220 <div class="g-col @(Model.Column(2).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="4" @animationOnScrollCol1 style="--bs-columns:12"> 221 @Model.Column(2).Output() 222 </div> 223 </div> 224 </div> 225 </div> 226 } 227 } 228

Be comfortable with our equipments

Error executing template "Designs/Swift/Paragraph/Swift_ProductFieldDisplayGroups.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 @functions { 5 6 ProductViewModel GetProduct() 7 { 8 ProductViewModel product = null; 9 10 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 11 { 12 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 13 } 14 15 return product; 16 } 17 18 List<FieldGroupViewModel> GetDisplayGroups(ProductViewModel product) 19 { 20 21 bool hideFieldsWithZeroValue = Model.Item.GetBoolean("HideFieldsWithZeroValue"); 22 var selectedDisplayGroupSystemName = Model.Item.GetList("DisplayGroups")?.GetRawValue().OfType<string>(); 23 var displayGroups = product.GetProductDisplayGroupFieldsByGroupSystemNames(selectedDisplayGroupSystemName, hideFieldsWithZeroValue); 24 25 return displayGroups.ToList(); 26 } 27 28 public static string FirstCharToUpper(string input) 29 { 30 return input[0].ToString().ToUpper() + input.Substring(1); 31 } 32 } 33 34 @{ 35 ProductViewModel product = GetProduct(); 36 37 if (product is object) 38 { 39 40 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 41 string contentPadding = Model.Item.GetRawValueString("ContentPadding", ""); 42 contentPadding = contentPadding == "none" ? string.Empty : contentPadding; 43 contentPadding = contentPadding == "small" ? " p-2 p-md-3" : contentPadding; 44 contentPadding = contentPadding == "large" ? " p-4 p-md-5" : contentPadding; 45 46 string size = "compact"; 47 string gapCss = size == "full" ? " gap-4" : " gap-2"; 48 49 var displayGroups = GetDisplayGroups(product); 50 51 var templateParams = new Dictionary<string, object> 52 { 53 { "Groups", displayGroups }, 54 { "Size", size }, 55 { "HideGroupHeaders", Model.Item.GetBoolean("HideGroupHeaders") }, 56 { "HideTitle", Model.Item.GetBoolean("HideTitle") } 57 }; 58 59 string templateLayout = Model.Item.GetRawValueString("Layout", "list"); 60 string templateLayoutPath = $"Components/Specifications/{FirstCharToUpper(templateLayout)}.cshtml"; 61 62 <div class="h-100@(theme)@(contentPadding) item_@Model.Item.SystemName.ToLower()"> 63 <div class="grid@(gapCss)"> 64 @RenderPartial(templateLayoutPath, Model, templateParams) 65 </div> 66 </div> 67 68 } 69 else 70 { 71 <div class="alert alert-warning m-0">@Translate("Product Specification will be shown here if any")</div> 72 } 73 } 74
Error executing template "Designs/Swift/Paragraph/Swift_ProductDetailsGallery.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 @using Dynamicweb.Frontend 4 @using System.IO 5 @using System.Text.RegularExpressions; 6 7 @functions { 8 public ProductViewModel product { get; set; } = new ProductViewModel(); 9 public string galleryLayout { get; set; } 10 public string[] supportedImageFormats { get; set; } 11 public string[] supportedVideoFormats { get; set; } 12 public string[] supportedDocumentFormats { get; set; } 13 public string[] allSupportedFormats { get; set; } 14 15 public class RatioSettings { 16 public string Ratio { get; set; } 17 public string CssClass { get; set; } 18 public string CssVariable { get; set; } 19 public string Fill { get; set; } 20 } 21 22 public RatioSettings GetRatioSettings(string size = "desktop") { 23 var ratioSettings = new RatioSettings(); 24 25 string ratio = Model.Item.GetRawValueString("ImageAspectRatio", ""); 26 ratio = ratio != "0" ? ratio : ""; 27 string cssClass = ratio != "" && ratio != "fill" ? " ratio" : ""; 28 string cssVariable = ratio != "" && ratio != "fill" ? "--bs-aspect-ratio: " + ratio : ""; 29 cssClass = ratio != "" && ratio == "fill" && size == "mobile" ? " ratio" : cssClass; 30 cssVariable = ratio != "" && ratio == "fill" && size == "mobile" ? "--bs-aspect-ratio: 66%" : cssVariable; 31 32 ratioSettings.Ratio = ratio; 33 ratioSettings.CssClass = cssClass; 34 ratioSettings.CssVariable = cssVariable; 35 ratioSettings.Fill = ratio == "fill" ? " h-100" : ""; 36 37 return ratioSettings; 38 } 39 40 public string GetColumnClass(int total, int assetNumber) { 41 string colClass = total > 1 ? "g-col-lg-6" : "g-col-12"; 42 colClass = galleryLayout == "full-first" && assetNumber == 0 ? "g-col-12" : colClass; 43 colClass = galleryLayout == "full-last" && assetNumber == (total - 1) ? "g-col-12" : colClass; 44 colClass = galleryLayout == "advanced-grid" && assetNumber > 1 ? "g-col-4" : colClass; 45 46 colClass = galleryLayout == "advanced-grid" && total == 1 ? "g-col-12" : colClass; 47 colClass = galleryLayout == "advanced-grid" && total == 3 && assetNumber == 2 ? "g-col-12" : colClass; 48 colClass = galleryLayout == "advanced-grid" && total == 4 && assetNumber == 2 ? "g-col-6" : colClass; 49 colClass = galleryLayout == "advanced-grid" && total == 4 && assetNumber == 3 ? "g-col-6" : colClass; 50 colClass = galleryLayout == "advanced-grid" && total == 6 && assetNumber == 5 ? "g-col-12" : colClass; 51 colClass = galleryLayout == "advanced-grid" && total == 7 && assetNumber == 5 ? "g-col-6" : colClass; 52 colClass = galleryLayout == "advanced-grid" && total == 7 && assetNumber == 6 ? "g-col-6" : colClass; 53 colClass = galleryLayout == "advanced-grid" && total == 9 && assetNumber == 8 ? "g-col-12" : colClass; 54 55 return colClass; 56 } 57 58 public string GetArrowsColor() 59 { 60 var invertColor = Model.Item.GetBoolean("InvertModalArrowsColor"); 61 var arrowsColor = invertColor ? " carousel-dark" : string.Empty; 62 return arrowsColor; 63 } 64 65 public Dictionary<string, object> GetVideoParams(MediaViewModel asset, string size) 66 { 67 string assetName = !string.IsNullOrEmpty(asset.DisplayName) ? asset.DisplayName : asset.Name; 68 string type = GetVideoType(asset.Value); 69 bool openInModal = Model.Item.GetString("OpenVideoInModal") == "true" ? true : false; 70 bool autoPlay = Model.Item.GetBoolean("VideoAutoPlay"); 71 72 var videoParams = new Dictionary<string, object>(); 73 videoParams.Add("AssetName", asset.Name); 74 videoParams.Add("AssetVideoType", type); 75 videoParams.Add("AssetDisplayName", asset.DisplayName); 76 videoParams.Add("OpenVideoInModal", openInModal); 77 videoParams.Add("VideoAutoPlay", autoPlay); 78 videoParams.Add("Size", size); 79 videoParams.Add("Id", Model.ID); 80 return videoParams; 81 } 82 83 public string GetVideoType(string assetValue) 84 { 85 string type = assetValue.IndexOf("youtu.be", StringComparison.OrdinalIgnoreCase) >= 0 || assetValue.IndexOf("youtube", StringComparison.OrdinalIgnoreCase) >= 0 ? "youtube" : string.Empty; 86 type = assetValue.IndexOf("vimeo", StringComparison.OrdinalIgnoreCase) >= 0 ? "vimeo" : type; 87 type = string.IsNullOrEmpty(type) ? "selfhosted" : type; 88 return type; 89 } 90 91 public string GetYoutubeScreenDump(string assetValue, string quality) 92 { 93 var regex = new Regex(@"(?:youtube\.com\/.*[\?&]v=|youtu\.be\/|youtube\.com\/embed\/)([\w-]+)(?:\?.*)?"); 94 Match match = regex.Match(assetValue); 95 string videoId = match.Success ? match.Groups[1].Value : string.Empty; 96 string youtubeThumbnail = $"https://img.youtube.com/vi/{videoId}/{quality}.jpg"; 97 return youtubeThumbnail; 98 } 99 } 100 101 @{ 102 @* Get the product data *@ 103 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 104 { 105 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 106 } 107 else if (Pageview.Page.Item["DummyProduct"] != null && Pageview.IsVisualEditorMode) 108 { 109 var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); 110 ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); 111 112 if (productList?.Products is object) 113 { 114 product = productList.Products[0]; 115 } 116 } 117 } 118 119 @if (product is object) 120 { 121 @* Supported formats *@ 122 supportedImageFormats = new string[] { ".jpg", ".jpeg", ".webp", ".png", ".gif", ".bmp", ".tiff" }; 123 supportedVideoFormats = new string[] { "youtu.be", "youtube", "vimeo", ".mp4", ".webm" }; 124 supportedDocumentFormats = new string[] { ".pdf", ".docx", ".xlsx", ".ppt", "pptx" }; 125 allSupportedFormats = supportedImageFormats.Concat(supportedVideoFormats).Concat(supportedDocumentFormats).ToArray(); 126 127 @* Collect the assets *@ 128 var selectedAssetCategories = Model.Item.GetList("ImageAssets")?.GetRawValue().OfType<string>(); 129 bool includeImagePatternImages = Model.Item.GetBoolean("ImagePatternImages"); 130 131 @* Needed image data collection to support both DefaultImage, ImagePatterns and Image Assets *@ 132 string defaultImage = product.DefaultImage != null ? product.DefaultImage.Value : ""; 133 IEnumerable<MediaViewModel> assetsImages = product.AssetCategories.Where(x => selectedAssetCategories.Contains(x.SystemName)).SelectMany(x => x.Assets); 134 assetsImages = assetsImages.OrderByDescending(x => x.Value.Equals(defaultImage)); 135 IEnumerable<MediaViewModel> assetsList = new MediaViewModel[]{}; 136 assetsList = assetsList.Union(assetsImages); 137 assetsList = includeImagePatternImages ? assetsList.Union(product.ImagePatternImages) : assetsList; 138 assetsList = includeImagePatternImages && assetsList.Count() == 0 ? assetsList.Append(product.DefaultImage) : assetsList; 139 140 bool defaultImageFallback = Model.Item.GetBoolean("DefaultImageFallback"); 141 142 int totalAssets = 0; 143 foreach (MediaViewModel asset in assetsList) { 144 var assetValue = asset.Value; 145 foreach (string format in allSupportedFormats) { 146 if (assetValue.IndexOf(format, StringComparison.OrdinalIgnoreCase) >= 0) { 147 totalAssets++; 148 } 149 } 150 } 151 152 if (totalAssets == 0) 153 { 154 if (defaultImageFallback) { 155 assetsList = new List<MediaViewModel>(){ product.DefaultImage }; 156 totalAssets = 1; 157 } else { 158 assetsList = new List<MediaViewModel>(){ }; 159 totalAssets = 0; 160 } 161 } 162 163 @* Layout settings *@ 164 string spacing = Model.Item.GetRawValueString("Spacing", "4"); 165 spacing = spacing == "none" ? "gap-0" : spacing; 166 spacing = spacing == "small" ? "gap-3" : spacing; 167 spacing = spacing == "large" ? "gap-4" : spacing; 168 169 galleryLayout = Model.Item.GetRawValueString("Layout", "grid"); 170 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 171 172 var badgeParms = new Dictionary<string, object>(); 173 badgeParms.Add("size", "h5"); 174 badgeParms.Add("saleBadgeType", Model.Item.GetRawValue("SaleBadgeType")); 175 badgeParms.Add("saleBadgeCssClassName", Model.Item.GetRawValue("SaleBadgeDesign")); 176 badgeParms.Add("newBadgeCssClassName", Model.Item.GetRawValue("NewBadgeDesign")); 177 badgeParms.Add("newPublicationDays", Model.Item.GetInt32("NewPublicationDays")); 178 badgeParms.Add("campaignBadgesValues", Model.Item.GetList("CampaignBadges")?.GetRawValue().OfType<string>().ToList()); 179 180 bool saleBadgeEnabled = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("SaleBadgeDesign")) && Model.Item.GetRawValueString("SaleBadgeDesign") != "none" ? true : false; 181 bool newBadgeEnabled = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("NewBadgeDesign")) && Model.Item.GetRawValueString("NewBadgeDesign") != "none" ? true : false; 182 DateTime createdDate = product.Created.Value; 183 bool showBadges = saleBadgeEnabled && product.Discount.Price != 0 ? true : false; 184 showBadges = (newBadgeEnabled && Model.Item.GetInt32("NewPublicationDays") == 0) || (newBadgeEnabled && (createdDate.AddDays(Model.Item.GetInt32("NewPublicationDays")) > DateTime.Now)) ? true : showBadges; 185 showBadges = !string.IsNullOrEmpty(Model.Item.GetRawValueString("CampaignBadges")) ? true : showBadges; 186 187 188 @* Get assets from selected categories or get all assets *@ 189 if (totalAssets != 0 && assetsList.Count() != 0) { 190 int desktopAssetNumber = 0; 191 int mobileAssetNumber = 0; 192 int mobileAssetThumbnailNumber = 0; 193 int modalAssetNumber = 0; 194 195 @* Desktop: Show the gallery on large screens *@ 196 <div class="d-none d-lg-block h-100 position-relative @theme item_@Model.Item.SystemName.ToLower() desktop"> 197 <div class="grid @spacing"> 198 @foreach (MediaViewModel asset in assetsList) { 199 var assetName = asset.Value; 200 foreach (string format in allSupportedFormats) { 201 if (assetName.IndexOf(format, StringComparison.OrdinalIgnoreCase) >= 0) { 202 string size = "desktop"; 203 string imageTheme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("ImageTheme")) ? " theme " + Model.Item.GetRawValueString("ImageTheme").Replace(" ", "").Trim().ToLower() : ""; 204 string assetValue = asset.Value; 205 206 <div class="@GetColumnClass(totalAssets, desktopAssetNumber)"> 207 <div class="h-100 @(imageTheme)"> 208 @foreach (string imageFormat in supportedImageFormats) 209 { //Images 210 if (assetValue.IndexOf(imageFormat, StringComparison.OrdinalIgnoreCase) >= 0) 211 { 212 string productName = product.Name; 213 string imagePath = !string.IsNullOrEmpty(asset.Value) ? asset.Value : product.DefaultImage.Value; 214 string imageLinkPath = Uri.EscapeDataString(imagePath); 215 216 RatioSettings ratioSettings = GetRatioSettings(size); 217 218 var parms = new Dictionary<string, object>(); 219 parms.Add("alt", productName); 220 parms.Add("itemprop", "image"); 221 if (totalAssets > 1) 222 { 223 parms.Add("columns", 2); 224 } 225 else 226 { 227 parms.Add("columns", 1); 228 } 229 parms.Add("eagerLoadNewImages", Model.Item.GetBoolean("DisableLazyLoading")); 230 parms.Add("doNotUseGetimage", Model.Item.GetBoolean("DisableGetImage")); 231 232 if (!string.IsNullOrEmpty(asset.DisplayName)) 233 { 234 parms.Add("title", asset.DisplayName); 235 } 236 237 if (ratioSettings.Ratio == "fill" && galleryLayout != "grid") 238 { 239 parms.Add("cssClass", "w-100 h-100 image-zoom-lg-l-hover"); 240 } 241 else 242 { 243 parms.Add("cssClass", "mw-100 mh-100"); 244 } 245 246 <a href="@imageLinkPath" class="d-block @(ratioSettings.CssClass)@(ratioSettings.Fill)" style="@(ratioSettings.CssVariable)" data-bs-toggle="modal" data-bs-target="#modal_@Model.ID"> 247 <div class="d-flex align-items-center justify-content-center overflow-hidden h-100" data-bs-target="#ModalCarousel_@Model.ID" data-bs-slide-to="@desktopAssetNumber"> 248 @RenderPartial("Components/Image.cshtml", new FileViewModel { Path = imagePath }, parms) 249 </div> 250 </a> 251 } 252 } 253 @foreach (string videoFormat in supportedVideoFormats) 254 { //Videos 255 if (assetValue.IndexOf(videoFormat, StringComparison.OrdinalIgnoreCase) >= 0) 256 { 257 if (Model.Item.GetString("OpenVideoInModal") == "true") 258 { 259 string iconPath = "/Files/Templates/Designs/Swift/Assets/icons/"; 260 261 string type = GetVideoType(asset.Value); 262 string videoScreendumpPath = type == "selfhosted" ? System.Uri.EscapeUriString(asset.Value) : string.Empty; 263 videoScreendumpPath = type == "youtube" ? GetYoutubeScreenDump(asset.Value, "maxresdefault") : videoScreendumpPath; 264 string videoJsClass = type == "vimeo" ? "js-vimeo-video-thumbnail" : string.Empty; 265 266 string productName = product.Name; 267 productName += !string.IsNullOrEmpty(asset.Keywords) ? " " + asset.Keywords : ""; 268 string assetTitle = !string.IsNullOrEmpty(asset.DisplayName) ? "title=\"" + asset.DisplayName + "\"" : ""; 269 270 RatioSettings ratioSettings = GetRatioSettings(size); 271 <div class="d-block @(ratioSettings.CssClass)@(ratioSettings.Fill)" style="@(ratioSettings.CssVariable); cursor: pointer" data-bs-toggle="modal" data-bs-target="#modal_@Model.ID"> 272 <div class="d-flex align-items-center justify-content-center overflow-hidden h-100" data-bs-target="#ModalCarousel_@Model.ID" data-bs-slide-to="@desktopAssetNumber"> 273 <div class="icon-5 position-absolute" style="z-index: 1">@ReadFile(iconPath + "play-circle.svg")</div> 274 @if (type != "selfhosted") 275 { 276 <img src="@videoScreendumpPath" loading="lazy" decoding="async" alt="@productName" @assetTitle class="@videoJsClass mw-100 mh-100" data-asset-value="@asset.Value" style="object-fit: cover;" /> 277 } 278 else 279 { 280 string videoType = Path.GetExtension(asset.Value).ToLower(); 281 282 <video preload="auto" class="h-100 w-100" style="object-fit: contain;"> 283 <source src="@(videoScreendumpPath)#t=0.001" type="video/@videoType.Replace(".", "")"> 284 </video> 285 } 286 </div> 287 </div> 288 289 } 290 else 291 { 292 var videoParams = GetVideoParams(asset, size); 293 @RenderPartial("Components/VideoPlayer.cshtml", new FileViewModel { Path = asset.Value }, videoParams); 294 } 295 } 296 } 297 @foreach (string documentFormat in supportedDocumentFormats) 298 { //Documents 299 if (assetValue.IndexOf(documentFormat, StringComparison.OrdinalIgnoreCase) >= 0) 300 { 301 string iconPath = "/Files/Templates/Designs/Swift/Assets/icons/"; 302 303 string productName = product.Name; 304 string imagePath = !string.IsNullOrEmpty(asset.Value) ? asset.Value : product.DefaultImage.Value; 305 string imageLinkPath = Uri.EscapeDataString(imagePath); 306 307 RatioSettings ratioSettings = GetRatioSettings(size); 308 309 var parms = new Dictionary<string, object>(); 310 parms.Add("alt", productName); 311 parms.Add("itemprop", "image"); 312 parms.Add("fullwidth", true); 313 parms.Add("columns", Model.GridRowColumnCount); 314 if (!string.IsNullOrEmpty(asset.DisplayName)) 315 { 316 parms.Add("title", asset.DisplayName); 317 } 318 319 if (ratioSettings.Ratio == "fill" && galleryLayout != "grid") 320 { 321 parms.Add("cssClass", "w-100 h-100 image-zoom-lg-l-hover"); 322 } 323 else 324 { 325 parms.Add("cssClass", "mw-100 mh-100"); 326 } 327 328 <a href="@imageLinkPath" class="d-block @(ratioSettings.CssClass)@(ratioSettings.Fill)" style="@(ratioSettings.CssVariable)" download title="@Translate("Download")"> 329 <div class="d-flex align-items-center justify-content-center overflow-hidden h-100"> 330 <div class="icon-5 position-absolute" style="z-index: 1">@ReadFile(iconPath + "download.svg")</div> 331 @if (asset.Value.IndexOf(".pdf", StringComparison.OrdinalIgnoreCase) >= 0) 332 { 333 @RenderPartial("Components/Image.cshtml", new FileViewModel { Path = imagePath }, parms) 334 } 335 else 336 { 337 338 } 339 </div> 340 </a> 341 } 342 } 343 </div> 344 </div> 345 desktopAssetNumber++; 346 } 347 } 348 } 349 </div> 350 351 @if (showBadges) { 352 <div class="position-absolute top-0 left-0 p-2 p-lg-3 w-100"> 353 @RenderPartial("Components/EcommerceBadge.cshtml", product, badgeParms) 354 </div> 355 } 356 </div> 357 358 @* Mobile: Show the thumbs on small screens *@ 359 <div class="d-block d-lg-none mx-lg-0 position-relative @theme item_@Model.Item.SystemName.ToLower() mobile"> 360 <div id="SmallScreenImages_@Model.ID" class="carousel@(GetArrowsColor())" data-bs-ride="carousel"> 361 <div class="carousel-inner h-100"> 362 @foreach (MediaViewModel asset in assetsList) { 363 var assetValue = asset.Value; 364 foreach (string format in allSupportedFormats) { 365 if (assetValue.IndexOf(format, StringComparison.OrdinalIgnoreCase) >= 0) { 366 string activeSlide = mobileAssetNumber == 0 ? "active" : ""; 367 string size = "mobile"; 368 string imageTheme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("ImageTheme")) ? " theme " + Model.Item.GetRawValueString("ImageTheme").Replace(" ", "").Trim().ToLower() : ""; 369 370 <div class="carousel-item @activeSlide" data-bs-interval="99999"> 371 <div class="h-100 @(imageTheme)"> 372 @foreach (string imageFormat in supportedImageFormats) 373 { //Images 374 if (assetValue.IndexOf(imageFormat, StringComparison.OrdinalIgnoreCase) >= 0) 375 { 376 string productName = product.Name; 377 string imagePath = !string.IsNullOrEmpty(asset.Value) ? asset.Value : product.DefaultImage.Value; 378 string imageLinkPath = Uri.EscapeDataString(imagePath); 379 380 RatioSettings ratioSettings = GetRatioSettings(size); 381 382 var parms = new Dictionary<string, object>(); 383 parms.Add("alt", productName); 384 parms.Add("itemprop", "image"); 385 if (totalAssets > 1) 386 { 387 parms.Add("columns", 2); 388 } 389 else 390 { 391 parms.Add("columns", 1); 392 } 393 parms.Add("eagerLoadNewImages", Model.Item.GetBoolean("DisableLazyLoading")); 394 parms.Add("doNotUseGetimage", Model.Item.GetBoolean("DisableGetImage")); 395 396 if (!string.IsNullOrEmpty(asset.DisplayName)) 397 { 398 parms.Add("title", asset.DisplayName); 399 } 400 401 if (ratioSettings.Ratio == "fill" && galleryLayout != "grid") 402 { 403 parms.Add("cssClass", "w-100 h-100 image-zoom-lg-l-hover"); 404 } 405 else 406 { 407 parms.Add("cssClass", "mw-100 mh-100"); 408 } 409 410 <a href="@imageLinkPath" class="d-block @(ratioSettings.CssClass)@(ratioSettings.Fill)" style="@(ratioSettings.CssVariable)" data-bs-toggle="modal" data-bs-target="#modal_@Model.ID"> 411 <div class="d-flex align-items-center justify-content-center overflow-hidden h-100" data-bs-target="#ModalCarousel_@Model.ID" data-bs-slide-to="@mobileAssetNumber"> 412 @RenderPartial("Components/Image.cshtml", new FileViewModel { Path = imagePath }, parms) 413 </div> 414 </a> 415 } 416 } 417 @foreach (string videoFormat in supportedVideoFormats) 418 { //Videos 419 if (assetValue.IndexOf(videoFormat, StringComparison.OrdinalIgnoreCase) >= 0) 420 { 421 if (Model.Item.GetString("OpenVideoInModal") == "true") 422 { 423 string iconPath = "/Files/Templates/Designs/Swift/Assets/icons/"; 424 425 string type = GetVideoType(asset.Value); 426 427 string videoScreendumpPath = type == "selfhosted" ? System.Uri.EscapeUriString(asset.Value) : string.Empty; 428 videoScreendumpPath = type == "youtube" ? GetYoutubeScreenDump(asset.Value, "maxresdefault") : videoScreendumpPath; 429 string videoJsClass = type == "vimeo" ? "js-vimeo-video-thumbnail" : ""; 430 431 string productName = product.Name; 432 productName += !string.IsNullOrEmpty(asset.Keywords) ? " " + asset.Keywords : ""; 433 string assetTitle = !string.IsNullOrEmpty(asset.DisplayName) ? "title=\"" + asset.DisplayName + "\"" : ""; 434 435 RatioSettings ratioSettings = GetRatioSettings(size); 436 437 <div class="d-block @(ratioSettings.CssClass)@(ratioSettings.Fill)" style="@(ratioSettings.CssVariable); cursor: pointer" data-bs-toggle="modal" data-bs-target="#modal_@Model.ID"> 438 <div class="d-flex align-items-center justify-content-center overflow-hidden h-100" data-bs-target="#ModalCarousel_@Model.ID" data-bs-slide-to="@desktopAssetNumber"> 439 <div class="icon-5 position-absolute" style="z-index: 1">@ReadFile(iconPath + "play-circle.svg")</div> 440 @if (type != "selfhosted") 441 { 442 <img src="@videoScreendumpPath" loading="lazy" decoding="async" alt="@productName" @assetTitle class="@videoJsClass mw-100 mh-100" data-asset-value="@asset.Value" style="object-fit: cover;" > 443 } 444 else 445 { 446 string videoType = Path.GetExtension(asset.Value).ToLower(); 447 448 <video preload="auto" class="h-100 w-100" style="object-fit: contain;"> 449 <source src="@(videoScreendumpPath)#t=0.001" type="video/@videoType.Replace(".", "")"> 450 </video> 451 } 452 </div> 453 </div> 454 } 455 else 456 { 457 Dictionary<string, object> videoParams = GetVideoParams(asset, size); 458 @RenderPartial("Components/VideoPlayer.cshtml", new FileViewModel { Path = asset.Value }, videoParams); 459 } 460 } 461 } 462 </div> 463 </div> 464 mobileAssetNumber++; 465 } 466 } 467 } 468 </div> 469 </div> 470 471 @if (totalAssets > 1) { 472 <div id="SmallScreenImagesThumbnails_@Model.ID" class="d-flex flex-nowrap gap-2 overflow-x-auto my-3"> 473 @foreach (MediaViewModel asset in assetsList) { 474 var assetValue = asset.Value; 475 foreach (string format in allSupportedFormats) { 476 if (assetValue.IndexOf(format, StringComparison.OrdinalIgnoreCase) >= 0) { 477 string iconPath = "/Files/Templates/Designs/Swift/Assets/icons/"; 478 string type = GetVideoType(asset.Value); 479 480 string videoScreendumpPath = type == "youtube" ? GetYoutubeScreenDump(asset.Value, "maxresdefault") : string.Empty; 481 videoScreendumpPath = type == "selfhosted" ? System.Uri.EscapeUriString(asset.Value) : videoScreendumpPath; 482 string videoJsClass = type == "vimeo" ? "js-vimeo-video-thumbnail" : string.Empty; 483 484 string productName = product.Name; 485 productName += !string.IsNullOrEmpty(asset.Keywords) ? " " + asset.Keywords : ""; 486 string assetTitle = !string.IsNullOrEmpty(asset.DisplayName) ? "title=\"" + asset.DisplayName + "\"" : ""; 487 488 <div class="ratio ratio-4x3 border outline-none" style="flex:0 0 80px" data-bs-target="#SmallScreenImages_@Model.ID" data-bs-slide-to="@mobileAssetThumbnailNumber"> 489 @foreach (string imageFormat in supportedImageFormats) 490 { //Images 491 if (assetValue.IndexOf(imageFormat, StringComparison.OrdinalIgnoreCase) >= 0) 492 { 493 string imagePath = !string.IsNullOrEmpty(asset.Value) ? $"/Admin/Public/GetImage.ashx?image={asset.Value}&width=180&format=webp" : string.Empty; 494 <img src="@imagePath" class="p-1 mw-100 mh-100" style="object-fit: cover;" alt="@productName" @assetTitle > 495 } 496 } 497 @foreach (string videoFormat in supportedVideoFormats) 498 { //Videos 499 if (assetValue.IndexOf(videoFormat, StringComparison.OrdinalIgnoreCase) >= 0) 500 { 501 <div class="d-flex align-items-center justify-content-center overflow-hidden h-100"> 502 <div class="icon-3 position-absolute text-light" style="z-index: 1">@ReadFile(iconPath+"play-circle.svg")</div> 503 </div> 504 if (type != "selfhosted") 505 { 506 507 <img src="@(videoScreendumpPath)" class="p-1 @videoJsClass mw-100 mh-100" data-asset-value="@asset.Value" style="object-fit: cover;" alt="@productName" @assetTitle> 508 509 } 510 else 511 { 512 string videoType = Path.GetExtension(asset.Value).ToLower(); 513 514 <video preload="auto" class="h-100 w-100" style="object-fit: contain;"> 515 <source src="@(videoScreendumpPath)#t=0.001" type="video/@videoType.Replace(".", "")"> 516 </video> 517 } 518 } 519 } 520 @foreach (string documentFormat in supportedDocumentFormats) 521 { //Documents 522 if (assetValue.IndexOf(documentFormat, StringComparison.OrdinalIgnoreCase) >= 0) 523 { 524 string imagePath = !string.IsNullOrEmpty(asset.Value) ? $"/Admin/Public/GetImage.ashx?image={asset.Value}&width=180&format=webp" : string.Empty; 525 526 <a href="@Uri.EscapeDataString(assetValue)" style="cursor: pointer; min-width: 7rem; max-width: 8rem;" download title="@asset.Value"> 527 @if (asset.Value.IndexOf(".pdf", StringComparison.OrdinalIgnoreCase) >= 0) 528 { 529 <div class="d-flex align-items-center justify-content-center overflow-hidden h-100"> 530 <div class="icon-3 position-absolute text-light" style="z-index: 1">@ReadFile(iconPath + "download.svg")</div> 531 </div> 532 <img src="@imagePath" alt="@productName" @assetTitle class="p-0 p-lg-1 mw-100 mh-100" style="object-fit: cover;"> 533 } 534 else 535 { 536 <div class="d-flex align-items-center justify-content-center overflow-hidden h-100"> 537 <div class="icon-3 position-absolute" style="z-index: 1">@ReadFile(iconPath + "file-text.svg")</div> 538 </div> 539 } 540 </a> 541 } 542 } 543 </div> 544 545 mobileAssetThumbnailNumber++; 546 } 547 } 548 } 549 </div> 550 } 551 552 @if (showBadges) { 553 <div class="position-absolute top-0 left-0 p-2 p-lg-3"> 554 @RenderPartial("Components/EcommerceBadge.cshtml", product, badgeParms) 555 </div> 556 } 557 </div> 558 559 @* Modal with slides *@ 560 <div class="modal fade swift_products-details-images-modal" id="modal_@Model.ID" tabindex="-1" aria-labelledby="productDetailsGalleryModalTitle_@Model.ID" aria-hidden="true"> 561 <div class="modal-dialog modal-dialog-centered modal-xl"> 562 <div class="modal-content"> 563 <div class="modal-header visually-hidden"> 564 <h5 class="modal-title" id="productDetailsGalleryModalTitle_@Model.ID">@product.Title</h5> 565 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> 566 </div> 567 <div class="modal-body p-2 p-lg-3 h-100"> 568 <div id="ModalCarousel_@Model.ID" class="carousel@(GetArrowsColor()) h-100" data-bs-ride="carousel"> 569 <div class="carousel-inner h-100 @theme"> 570 @foreach (MediaViewModel asset in assetsList) { 571 var assetValue = !string.IsNullOrEmpty(asset.Value) ? asset.Value : product.DefaultImage.Value; 572 foreach (string format in allSupportedFormats) { 573 if (assetValue.IndexOf(format, StringComparison.OrdinalIgnoreCase) >= 0) { 574 string imagePath = assetValue; 575 string activeSlide = modalAssetNumber == 0 ? "active" : ""; 576 577 var parms = new Dictionary<string, object>(); 578 parms.Add("cssClass", "d-block mw-100 mh-100 m-auto"); 579 parms.Add("columns", Model.GridRowColumnCount); 580 parms.Add("eagerLoadNewImages", Model.Item.GetBoolean("DisableLazyLoading")); 581 parms.Add("doNotUseGetimage", Model.Item.GetBoolean("DisableGetImage")); 582 583 <div class="carousel-item @activeSlide h-100" data-bs-interval="99999"> 584 @foreach (string imageFormat in supportedImageFormats) { 585 if (assetValue.IndexOf(imageFormat, StringComparison.OrdinalIgnoreCase) >= 0) { 586 @RenderPartial("Components/Image.cshtml", new FileViewModel { Path = imagePath }, parms) 587 } 588 } 589 590 @foreach (string videoFormat in supportedVideoFormats) { 591 if (assetValue.IndexOf(videoFormat, StringComparison.OrdinalIgnoreCase) >= 0) { 592 593 Dictionary<string, object> videoParams = GetVideoParams(asset, "modal"); 594 @RenderPartial("Components/VideoPlayer.cshtml", new FileViewModel { Path = asset.Value }, videoParams); 595 596 } 597 } 598 </div> 599 600 modalAssetNumber++; 601 } 602 } 603 } 604 <button class="carousel-control-prev carousel-control-area" type="button" data-bs-target="#ModalCarousel_@Model.ID" data-bs-slide="prev"> 605 <span class="carousel-control-prev-icon" aria-hidden="true"></span> 606 <span class="visually-hidden">@Translate("Previous")</span> 607 </button> 608 <button class="carousel-control-next carousel-control-area" type="button" data-bs-target="#ModalCarousel_@Model.ID" data-bs-slide="next"> 609 <span class="carousel-control-next-icon" aria-hidden="true"></span> 610 <span class="visually-hidden">@Translate("Next")</span> 611 </button> 612 </div> 613 </div> 614 </div> 615 </div> 616 </div> 617 </div> 618 } else if (Pageview.IsVisualEditorMode) { 619 RatioSettings ratioSettings = GetRatioSettings("desktop"); 620 621 <div class="h-100 @theme"> 622 <div class="d-block @(ratioSettings.CssClass)@(ratioSettings.Fill)" style="@(ratioSettings.CssVariable)"> 623 <img src="/Files/Images/missing_image.jpg" loading="lazy" decoding="async" class="mh-100 mw-100" style="object-fit: cover;" alt="@Translate("Missing image")"> 624 </div> 625 </div> 626 } 627 } 628

Be updated on the newest events

Trending

More products

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