Error executing template "Designs/Swift/Paragraph/Swift_VideoPoster.cshtml" System.IO.IOException: There is not enough space on the disk. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.WriteCore(Byte[] buffer, Int32 offset, Int32 count) at System.IO.FileStream.FlushWrite(Boolean calledFromFinalizer) at System.IO.FileStream.Dispose(Boolean disposing) at System.IO.Stream.Close() at System.IO.StreamWriter.Dispose(Boolean disposing) at System.IO.TextWriter.Dispose() at System.IO.File.InternalWriteAllText(String path, String contents, Encoding encoding, Boolean checkHost) at RazorEngine.Roslyn.CSharp.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.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer) at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter) 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 System.IO 4 5 @functions 6 { 7 8 private string RenderCustomCSS(IEnumerable<string> decorations) 9 { 10 var cssClasses = new List<string>(); 11 12 foreach (var itemId in decorations) 13 { 14 var item = Dynamicweb.Content.Services.Items.GetItem("Swift_Css", itemId); 15 item.TryGetValue("Class", out object classes); 16 17 if (classes is null) 18 { 19 continue; 20 } 21 22 var cssString = (string)classes; 23 24 if (cssString.StartsWith("[")) 25 { 26 var cssArray = Dynamicweb.Core.Converter.Deserialize<string[]>(cssString); 27 cssClasses.AddRange(cssArray); 28 } 29 else 30 { 31 cssClasses.Add(cssString.Replace(",", " ")); 32 } 33 } 34 35 return string.Join(" ", cssClasses).Trim(); 36 } 37 38 } 39 40 @{ 41 string layout = Model.Item.GetRawValueString("Layout", "align-middle-center-text-center"); 42 43 bool movePageBehind = false; 44 bool isFirstPoster = false; 45 string movePageBehindClass = ""; 46 if (Pageview.Page.PropertyItem != null) 47 { 48 string headerCssClass = Pageview.Page.PropertyItem["MoveThisPageBehindTheHeader"] != null ? Pageview.Page.PropertyItem["MoveThisPageBehindTheHeader"].ToString() : "sticky-top"; 49 movePageBehind = headerCssClass == "fixed-top" && !Pageview.IsVisualEditorMode ? true : false; 50 if (movePageBehind) 51 { 52 movePageBehindClass = " poster-behind"; 53 if (!Dynamicweb.Context.Current.Items.Contains("firstPosterIsRendered")) 54 { 55 isFirstPoster = true; 56 Dynamicweb.Context.Current.Items.Add("firstPosterIsRendered", true); 57 } 58 } 59 } 60 61 string posterHeight = Model.Item.GetRawValueString("PosterHeight", "h-100 min-vh-75 min-vh-md-100"); 62 posterHeight = posterHeight == "small" ? "min-vh-25 min-vh-md-50" : posterHeight; 63 posterHeight = posterHeight == "medium" ? "min-vh-50 min-vh-md-75" : posterHeight; 64 posterHeight = posterHeight == "large" ? "min-vh-75 min-vh-md-100" : posterHeight; 65 66 string posterPadding = Model.Item.GetRawValueString("ContentPadding", ""); 67 posterPadding = posterPadding == "none" ? "p-3 px-xl-3 py-xl-4" : posterPadding; 68 posterPadding = posterPadding == "small" ? "p-3 p-xl-4" : posterPadding; 69 posterPadding = posterPadding == "large" ? "p-4 p-xl-5" : posterPadding; 70 71 string posterWidth = "container-xl"; 72 73 int xPos = Model.Item?.GetFile("Image")?.FocalPositionFromLeft ?? 50; 74 int yPos = Model.Item?.GetFile("Image")?.FocalPositionFromTop ?? 50; 75 76 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 77 var decorations = Model.Item?.GetList("CssDecorations")?.GetRawValue().OfType<string>() ?? Enumerable.Empty<string>(); 78 string css = RenderCustomCSS(decorations); 79 string alignment = ""; 80 81 string maxWidth = Model.Item.GetRawValueString("TextReadability", "max-width-on"); 82 maxWidth = maxWidth == "max-width-on" ? "mw-75ch d-inline-block" : maxWidth; 83 maxWidth = maxWidth == "max-width-off" ? "" : maxWidth; 84 } 85 86 <div class="position-relative h-100@(theme)@(movePageBehindClass) @(css) item_@Model.Item.SystemName.ToLower()"> 87 <div id="@Model.ID" class="user-select-none position-absolute top-0" style="scroll-margin-top:var(--header-height,150px)"></div> 88 @*Render video*@ 89 @if (!string.IsNullOrEmpty(Model.Item.GetString("Video"))) 90 { 91 string video = Model.Item.GetString("Video"); 92 string imageFilter = Model.Item.GetRawValueString("ImageFilter", ""); 93 imageFilter = imageFilter == "no-filter" ? "" : imageFilter; 94 imageFilter = imageFilter == "filter" ? " image-filter" : imageFilter; 95 string videoType = Path.GetExtension(video).ToLower(); 96 string videoPath = System.Uri.EscapeDataString(Model.Item.GetString("Video")); 97 98 <div class="position-absolute top-0 bottom-0 end-0 start-0@(imageFilter)"> 99 <video preload="auto" loop autoplay muted playsinline class="h-100 w-100" style="object-fit: cover;"> 100 <source src="@videoPath" 101 type="video/@videoType.Replace(".", "")"> 102 </video> 103 </div> 104 } 105106 @switch (layout) 107 { 108 case "align-top-left-text-left": 109 alignment = "text-start justify-content-start align-items-start"; 110 break; 111 case "align-top-center-text-center": 112 alignment = "text-center justify-content-start align-items-start"; 113 break; 114 case "align-top-right-text-right": 115 alignment = "text-end justify-content-start align-items-start"; 116 break; 117 case "align-middle-left-text-left": 118 alignment = "text-start justify-content-center align-items-center"; 119 break; 120 case "align-middle-center-text-center": 121 alignment = "text-center justify-content-center align-items-center"; 122 break; 123 case "align-middle-right-text-right": 124 alignment = "text-end justify-content-center align-items-center"; 125 break; 126 case "align-bottom-left-text-left": 127 alignment = "text-start justify-content-end align-items-end"; 128 break; 129 case "align-bottom-center-text-center": 130 alignment = "text-center justify-content-end align-items-end"; 131 break; 132 case "align-bottom-right-text-right": 133 alignment = "text-end justify-content-end align-items-end"; 134 break; 135 } 136 <div class="position-relative h-100"> 137 <div class="h-100 grid grid-1 @(posterWidth) @posterPadding @(alignment) @(posterHeight)" id="Poster_@Pageview.CurrentParagraph.ID"> 138 <div class="grid grid-1 gap-3 gap-md-4"> 139 @{ 140 //Render title 141 if (!string.IsNullOrEmpty(Model.Item.GetString("Title")) && !Model.Item.GetBoolean("HideTitle")) 142 { 143 string titleFontSize = Model.Item.GetRawValueString("TitleFontSize", "display-1"); 144 string headingLevel = Model.Item.GetString("HeadingLevel", "h2"); 145 string headingLevelStart = $"<{headingLevel} class=\"{titleFontSize} m-0\">"; 146 string headingLevelStop = $"</{headingLevel}>"; 147148 @headingLevelStart 149 <span class="@maxWidth">@Model.Item.GetString("Title")</span> 150 @headingLevelStop 151 } 152153 //Render text 154 if (!string.IsNullOrEmpty(Model.Item.GetString("Text"))) 155 { 156157 string subtitleFontSize = Model.Item.GetRawValueString("SubtitleFontSize", "fs-5"); 158 <p class="@subtitleFontSize lead m-0"> 159 <span class="@maxWidth"> 160 @Model.Item.GetString("Text") 161 </span> 162 </p> 163 } 164 //Render button 165 string linkType = Model.Item.GetRawValueString("LinkType", "page"); 166 Dynamicweb.Frontend.LinkViewModel link = new Dynamicweb.Frontend.LinkViewModel(); 167168 string StretchedLink = Model.Item.GetRawValueString("StretchedLink", ""); 169 StretchedLink = StretchedLink == "column-not-clickable" ? "" : StretchedLink; 170 StretchedLink = StretchedLink == "column-clickable" ? " stretched-link" : StretchedLink; 171172 if (linkType == "page" && Model.Item.GetLink("ButtonLink") != null) 173 { 174 link = Model.Item.GetLink("ButtonLink"); 175 } 176177 if (linkType == "product-group") 178 { 179 IList<ProductGroupViewModel> selectedGroups = Model.Item.GetValue<IList<ProductGroupViewModel>>("ProductGroupLink"); 180 IList<string> groupIds = new List<string> { }; 181182 if (selectedGroups != null) 183 { 184 foreach (var fromGroup in selectedGroups) 185 { 186 groupIds.Add(fromGroup.Id); 187 } 188 } 189190 link = new Dynamicweb.Frontend.LinkViewModel() 191 { 192 Url = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Shop") + "&GroupID=" + string.Join(",", groupIds).Trim(), 193 IsExternal = false 194 }; 195 } 196197 if (linkType == "product") 198 { 199 ProductListViewModel products = Model.Item.GetValue<ProductListViewModel>("ProductLink"); 200 IList<string> productIds = new List<string> { }; 201202 if (products != null && products.Products.Any()) 203 { 204 foreach (var product in products.Products) 205 { 206 productIds.Add(product.Id); 207 } 208209 string productParameter = productIds.Count == 1 ? "ProductID" : "MainProductId"; 210 string productLink = products.Products?.FirstOrDefault()?.GetProductLink(GetPageIdByNavigationTag("Shop"), false); 211 productLink = productIds.Count != 1 ? "/Default.aspx?ID=" + GetPageIdByNavigationTag("Shop") + "&" + productParameter + "=" + string.Join(",", productIds).Trim() : productLink; 212213 link = new Dynamicweb.Frontend.LinkViewModel() 214 { 215 Url = productLink, 216 IsExternal = false 217 }; 218 } 219 } 220221 if (link != null && !string.IsNullOrEmpty(Model.Item.GetString("ButtonLabel"))) 222 { 223 string target = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && link.IsExternal ? "target=\"_blank\"" : ""; 224 string rel = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && link.IsExternal ? "rel=\"noopener\"" : ""; 225226 string buttonStyle = Model.Item.GetRawValueString("ButtonStyle", "primary"); 227 buttonStyle = buttonStyle == "primary" ? "btn-primary" : buttonStyle; 228 buttonStyle = buttonStyle == "secondary" ? "btn-secondary" : buttonStyle; 229 buttonStyle = buttonStyle == "link" ? "btn-link" : buttonStyle; 230231 string ButtonSize = Model.Item.GetRawValueString("ButtonSize", "regular"); 232 ButtonSize = ButtonSize == "small" ? " btn-sm" : ButtonSize; 233 ButtonSize = ButtonSize == "regular" ? "" : ButtonSize; 234 ButtonSize = ButtonSize == "large" ? " btn-lg" : ButtonSize; 235236 <div class="mt-0"> 237 <a href="@link.Url" @target @rel class="btn @buttonStyle@(ButtonSize)@(StretchedLink)">@Model.Item.GetString("ButtonLabel")</a> 238 </div> 239 } 240 else if (link != null && !string.IsNullOrEmpty(link.Url)) 241 { 242 string target = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && link.IsExternal ? "target=\"_blank\"" : ""; 243 string rel = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && link.IsExternal ? "rel=\"noopener\"" : ""; 244245 <a href="@link.Url" @target @rel class="@StretchedLink"> 246 <span class="visually-hidden">@Model.Item.GetString("Title")</span> 247 </a> 248 } 249 } 250 </div> 251 </div> 252 </div> 253 </div> 254255 @if (movePageBehind && isFirstPoster) 256 { 257 <script> 258 ['resize', 'load'].forEach(function (e) { 259 window.addEventListener(e, () => swift.Scroll.setContentPosition()); 260 }); 261 </script> 262 } 263
Kvalitetsprodukter til byggesektoren siden 2006
Error executing template "Designs/Swift/Paragraph/Swift_SectionHeader.cshtml" System.IO.IOException: There is not enough space on the disk. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.WriteCore(Byte[] buffer, Int32 offset, Int32 count) at System.IO.FileStream.FlushWrite(Boolean calledFromFinalizer) at System.IO.FileStream.Dispose(Boolean disposing) at System.IO.Stream.Close() at System.IO.StreamWriter.Dispose(Boolean disposing) at System.IO.TextWriter.Dispose() at System.IO.File.InternalWriteAllText(String path, String contents, Encoding encoding, Boolean checkHost) at RazorEngine.Roslyn.CSharp.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.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer) at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter) 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 layout = Model.Item.GetRawValueString("Layout", "text-start"); 38 39 string layoutClasses = layout == "text-start" ? "" : ""; 40 layoutClasses = layout == "text-center" ? " align-items-center text-center" : layoutClasses; 41 layoutClasses = layout == "text-end" ? " align-items-end text-end" : layoutClasses; 42 layoutClasses = layout == "alignLeftMiddle" ? " justify-content-center" : layoutClasses; 43 layoutClasses = layout == "alignCenterMiddle" ? " align-items-center justify-content-center text-center" : layoutClasses; 44 45 string contentPadding = Model.Item.GetRawValueString("ContentPadding", ""); 46 contentPadding = contentPadding == "none" ? "p-0" : contentPadding; 47 contentPadding = contentPadding == "small" ? "p-2 p-md-3" : contentPadding; 48 contentPadding = contentPadding == "large" ? "p-4 p-md-5" : contentPadding; 49 50 string maxWidth = Model.Item.GetRawValueString("TextReadability", "max-width-on"); 51 maxWidth = maxWidth == "max-width-on" ? " mw-75ch d-inline-block" : ""; 52 53 string titleColor = Model.Item.GetString("TitleColor", "text-inherit"); 54 string titleOpacity = Model.Item.GetString("TitleOpacity", "opacity-100"); 55 string titleFontSize = Model.Item.GetRawValueString("TitleFontSize", "display-4"); 56 string headingLevel = Model.Item.GetString("HeadingLevel", "h2"); 57 string headingLevelStart = $"<{headingLevel} class=\"{titleFontSize} {titleColor} {titleOpacity}{maxWidth} m-0\">"; 58 string headingLevelStop = $"</{headingLevel}>"; 59 60 string subtitleFontSize = Model.Item.GetRawValueString("SubtitleFontSize", "fs-5"); 61 string subtitleColor = Model.Item.GetString("SubtitleColor", "text-inherit"); 62 string subtitleOpacity = Model.Item.GetString("SubtitleOpacity", "opacity-100"); 63 64 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 65 var decorations = Model.Item?.GetList("CssDecorations")?.GetRawValue().OfType<string>() ?? Enumerable.Empty<string>(); 66 string css = RenderCustomCSS(decorations); 67 } 68 69 <div class="h-100 @(contentPadding)@(theme) @(css) item_@Model.Item.SystemName.ToLower()"> 70 <div id="@Model.ID" class="user-select-none" style="scroll-margin-top:var(--header-height,150px)"></div> 71 <div class="d-flex flex-column h-100@(layoutClasses)"> 72 @if (!string.IsNullOrEmpty(Model.Item.GetString("Text"))) 73 { 74 <p class="@subtitleFontSize @subtitleColor @subtitleOpacity lead d-block mb-2"> 75 <span class="@maxWidth">@Model.Item.GetString("Text")</span> 76 </p> 77 } 78 @if (!string.IsNullOrEmpty(Model.Item.GetString("Title"))) 79 { 80 @headingLevelStart 81 @Model.Item.GetString("Title") 82 @headingLevelStop 83 } 84 </div> 85 </div> 86
Error executing template "/Designs/Swift/Grid/Page/RowTemplates/2Columns_9-3.cshtml" System.IO.IOException: There is not enough space on the disk. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.WriteCore(Byte[] buffer, Int32 offset, Int32 count) at System.IO.FileStream.FlushWrite(Boolean calledFromFinalizer) at System.IO.FileStream.Dispose(Boolean disposing) at System.IO.Stream.Close() at System.IO.StreamWriter.Dispose(Boolean disposing) at System.IO.TextWriter.Dispose() at System.IO.File.InternalWriteAllText(String path, String contents, Encoding encoding, Boolean checkHost) at RazorEngine.Roslyn.CSharp.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.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer) at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter) 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 3 @{ 4 string sectionClass = "py-3"; 5 string spaceBetweenRows = Model.Item.GetRawValueString("SpaceBetweenRows", "spacing"); 6 string spaceBetweenRowsMobile = Model.Item.GetRawValueString("SpaceBetweenRowsMobile", "auto"); 7 8 //Row spacing mobile auto 9 if (spaceBetweenRowsMobile == "auto") { 10 spaceBetweenRowsMobile = spaceBetweenRows; 11 } 12 13 //Row spacing mobile 14 switch (spaceBetweenRowsMobile) { 15 case "none": //No spacing 16 sectionClass = "py-0"; 17 break; 18 case "spacing": //Small spacing top and bottom 19 sectionClass = "py-3"; 20 break; 21 case "spacing-small-top": //Small spacing top 22 sectionClass = "pt-3"; 23 break; 24 case "spacing-small-bottom": //Small spacing bottom 25 sectionClass = "pb-3"; 26 break; 27 case "spacing-medium": //Medium spacing top and bottom 28 sectionClass = "py-4"; 29 break; 30 case "spacing-medium-top": //Medium spacing top 31 sectionClass = "pt-4"; 32 break; 33 case "spacing-medium-bottom": //Medium spacing bottom 34 sectionClass = "pb-4"; 35 break; 36 case "spacing-large": //Large spacing top and bottom 37 sectionClass = "py-5"; 38 break; 39 case "spacing-top": //Large spacing top 40 sectionClass = "pt-5"; 41 break; 42 case "spacing-bottom": //Large spacing bottom 43 sectionClass = "pb-5"; 44 break; 45 } 46 47 //Row spacing dekstop 48 switch (spaceBetweenRows) { 49 case "none": //No spacing 50 sectionClass += " py-lg-0"; 51 break; 52 case "spacing": //Small spacing top and bottom 53 sectionClass += " py-lg-3"; 54 break; 55 case "spacing-small-top": //Small spacing top 56 sectionClass += " pt-lg-3 pb-lg-0"; 57 break; 58 case "spacing-small-bottom": //Small spacing bottom 59 sectionClass += " pb-lg-3 pt-lg-0"; 60 break; 61 case "spacing-medium": //Medium spacing top and bottom 62 sectionClass += " py-lg-5"; 63 break; 64 case "spacing-medium-top": //Medium spacing top 65 sectionClass += " pt-lg-5 pb-lg-0"; 66 break; 67 case "spacing-medium-bottom": //Medium spacing bottom 68 sectionClass += " pb-lg-5 pt-lg-0"; 69 break; 70 case "spacing-large": //Large spacing top and bottom 71 sectionClass += " py-lg-6"; 72 break; 73 case "spacing-top": //Large spacing top 74 sectionClass += " pt-lg-6 pb-lg-0"; 75 break; 76 case "spacing-bottom": //Large spacing bottom 77 sectionClass += " pb-lg-6 pt-lg-0"; 78 break; 79 } 80 81 string containerClass = "container-xl"; 82 string width = Model.Item.GetRawValueString("Width", "container-xl"); 83 if (width == "none") 84 { 85 containerClass = "container-fluid px-0"; 86 } 87 if (width == "stretch") 88 { 89 containerClass = "container-fluid"; 90 } 91 if (width == "compressed") 92 { 93 containerClass = " container-compressed"; 94 } 95 96 string rowClass = string.Empty; 97 string spaceBetweenColumns = Model.Item.GetRawValueString("SpaceBetweenColumns", string.Empty).ToLower(); 98 string spaceBetweenColumnsMobile = Model.Item.GetRawValueString("SpaceBetweenColumnsMobile", string.Empty).ToLower(); 99 //Mobile 100 if (spaceBetweenColumnsMobile == "auto") 101 { 102 spaceBetweenColumnsMobile = spaceBetweenColumns; 103 } 104 if (spaceBetweenColumnsMobile == "stick") 105 { 106 rowClass = " gap-0"; 107 } 108 if (spaceBetweenColumnsMobile == "spacing-medium") 109 { 110 rowClass = " gap-4"; 111 } 112 if (spaceBetweenColumnsMobile == "spacing-large") 113 { 114 rowClass = " gap-5"; 115 } 116 //Desktop 117 if (spaceBetweenColumns == "stick") 118 { 119 rowClass += " gap-lg-0"; 120 } 121 if (spaceBetweenColumns == "spacing-medium") 122 { 123 rowClass += " gap-lg-4"; 124 } 125 if (spaceBetweenColumns == "spacing-large") 126 { 127 rowClass += " gap-lg-5"; 128 } 129130 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 131132 string animationOnScrollCol1 = Model.Item.GetRawValueString("AnimationOnScrollCol1", "no-animation"); 133 animationOnScrollCol1 = animationOnScrollCol1 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol1 + "'" : ""; 134 string animationOnScrollCol2 = Model.Item.GetRawValueString("AnimationOnScrollCol2", "no-animation"); 135 animationOnScrollCol2 = animationOnScrollCol2 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol2 + "'" : ""; 136137 string hideOverflow = " overflow-hidden"; 138 hideOverflow = 139 animationOnScrollCol1 != "" || 140 animationOnScrollCol2 != "" 141 ? hideOverflow : ""; 142143 Dynamicweb.Frontend.FileViewModel backgroundImage = Model.Item.GetFile("BackgroundImage"); 144 string backgroundImagePath = backgroundImage?.Path ?? string.Empty; 145 backgroundImagePath = $"/Admin/Public/GetImage.ashx?image={backgroundImagePath}&width=2600&format=webp&compression=75&quality=90"; 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; 160161 var decorations = Model.Item?.GetList("CssDecorations")?.GetRawValue().OfType<string>() ?? Enumerable.Empty<string>(); 162 var css = string.Empty; 163 var cssClasses = new List<string> { }; 164165 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 } 173174 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(); 186187 @* Only gradient *@ 188189 if (!string.IsNullOrEmpty(gradient) && string.IsNullOrEmpty(backgroundImagePath) && gradientOpacity != ("0.00")) 190 { 191 styleString += "style=\"background-image:" + gradientString + ";\""; 192 } 193194 @* Only background image *@ 195196 else if (string.IsNullOrEmpty(gradient) && !string.IsNullOrEmpty(backgroundImagePath)) 197 { 198 styleString += "style=\"background-image:" + backgroundImageString + "; " + backgroundImagePositionString + backgroundRepeatString + backgroundImageSizeString + "\""; 199 } 200201 @* Gradient and background image *@ 202203 else if (!string.IsNullOrEmpty(gradient) && !string.IsNullOrEmpty(backgroundImagePath)) 204 { 205 styleString += "style=\"background-image:" + gradientString + "," + backgroundImageString + ";" + backgroundImagePositionString + backgroundRepeatString + backgroundImageSizeString + "\""; 206 } 207208 int mobileColumnSize = Dynamicweb.Core.Converter.ToInt32(Model.Item.GetRawValueString("MobileColumnBehaviour", "1")); 209 int mobileOrderFirst = Dynamicweb.Core.Converter.ToInt32(Model.Item.GetRawValueString("MobileOrderFirst", "1")); 210211 if (Pageview.IsVisualEditorMode || !string.IsNullOrWhiteSpace(Model.Column(1).Output()) || !string.IsNullOrWhiteSpace(Model.Column(2).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-4@(rowClass)"> 216 <div class="g-col g-col-lg-3 @(Model.Column(1).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="9" @animationOnScrollCol2 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="3" @animationOnScrollCol1 style="--bs-columns:12"> 220 @Model.Column(2).Output() 221 </div> 222 </div> 223 </div> 224 </div> 225 } 226 } 227
Error executing template "Designs/Swift/Paragraph/Swift_SectionHeader.cshtml" System.IO.IOException: There is not enough space on the disk. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.WriteCore(Byte[] buffer, Int32 offset, Int32 count) at System.IO.FileStream.FlushWrite(Boolean calledFromFinalizer) at System.IO.FileStream.Dispose(Boolean disposing) at System.IO.Stream.Close() at System.IO.StreamWriter.Dispose(Boolean disposing) at System.IO.TextWriter.Dispose() at System.IO.File.InternalWriteAllText(String path, String contents, Encoding encoding, Boolean checkHost) at RazorEngine.Roslyn.CSharp.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.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer) at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter) 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 layout = Model.Item.GetRawValueString("Layout", "text-start"); 38 39 string layoutClasses = layout == "text-start" ? "" : ""; 40 layoutClasses = layout == "text-center" ? " align-items-center text-center" : layoutClasses; 41 layoutClasses = layout == "text-end" ? " align-items-end text-end" : layoutClasses; 42 layoutClasses = layout == "alignLeftMiddle" ? " justify-content-center" : layoutClasses; 43 layoutClasses = layout == "alignCenterMiddle" ? " align-items-center justify-content-center text-center" : layoutClasses; 44 45 string contentPadding = Model.Item.GetRawValueString("ContentPadding", ""); 46 contentPadding = contentPadding == "none" ? "p-0" : contentPadding; 47 contentPadding = contentPadding == "small" ? "p-2 p-md-3" : contentPadding; 48 contentPadding = contentPadding == "large" ? "p-4 p-md-5" : contentPadding; 49 50 string maxWidth = Model.Item.GetRawValueString("TextReadability", "max-width-on"); 51 maxWidth = maxWidth == "max-width-on" ? " mw-75ch d-inline-block" : ""; 52 53 string titleColor = Model.Item.GetString("TitleColor", "text-inherit"); 54 string titleOpacity = Model.Item.GetString("TitleOpacity", "opacity-100"); 55 string titleFontSize = Model.Item.GetRawValueString("TitleFontSize", "display-4"); 56 string headingLevel = Model.Item.GetString("HeadingLevel", "h2"); 57 string headingLevelStart = $"<{headingLevel} class=\"{titleFontSize} {titleColor} {titleOpacity}{maxWidth} m-0\">"; 58 string headingLevelStop = $"</{headingLevel}>"; 59 60 string subtitleFontSize = Model.Item.GetRawValueString("SubtitleFontSize", "fs-5"); 61 string subtitleColor = Model.Item.GetString("SubtitleColor", "text-inherit"); 62 string subtitleOpacity = Model.Item.GetString("SubtitleOpacity", "opacity-100"); 63 64 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 65 var decorations = Model.Item?.GetList("CssDecorations")?.GetRawValue().OfType<string>() ?? Enumerable.Empty<string>(); 66 string css = RenderCustomCSS(decorations); 67 } 68 69 <div class="h-100 @(contentPadding)@(theme) @(css) item_@Model.Item.SystemName.ToLower()"> 70 <div id="@Model.ID" class="user-select-none" style="scroll-margin-top:var(--header-height,150px)"></div> 71 <div class="d-flex flex-column h-100@(layoutClasses)"> 72 @if (!string.IsNullOrEmpty(Model.Item.GetString("Text"))) 73 { 74 <p class="@subtitleFontSize @subtitleColor @subtitleOpacity lead d-block mb-2"> 75 <span class="@maxWidth">@Model.Item.GetString("Text")</span> 76 </p> 77 } 78 @if (!string.IsNullOrEmpty(Model.Item.GetString("Title"))) 79 { 80 @headingLevelStart 81 @Model.Item.GetString("Title") 82 @headingLevelStop 83 } 84 </div> 85 </div> 86
Error executing template "Designs/Swift/Paragraph/Swift_RelatedProducts.cshtml" System.IO.IOException: There is not enough space on the disk. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.WriteCore(Byte[] buffer, Int32 offset, Int32 count) at System.IO.FileStream.FlushWrite(Boolean calledFromFinalizer) at System.IO.FileStream.Dispose(Boolean disposing) at System.IO.Stream.Close() at System.IO.StreamWriter.Dispose(Boolean disposing) at System.IO.TextWriter.Dispose() at System.IO.File.InternalWriteAllText(String path, String contents, Encoding encoding, Boolean checkHost) at RazorEngine.Roslyn.CSharp.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.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer) at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter) 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.Core 3 @using Dynamicweb.Ecommerce.ProductCatalog 4 5 @{ 6 ProductViewModel product = null; 7 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 8 { 9 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 10 } 11 else if (Pageview.Page.Item["DummyProduct"] != null && Pageview.IsVisualEditorMode) 12 { 13 var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); 14 ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); 15 16 if (productList?.Products is object) 17 { 18 product = productList.Products[0]; 19 } 20 } 21 22 string title = Model?.Item?.GetRawValueString("Title", Translate("Products")); 23 string campaignValues = string.Join(",", Model.Item.GetList("CampaignBadges")?.GetRawValue().OfType<string>().ToList()); 24 25 //Styling 26 string titleFontSize = Model.Item.GetRawValueString("TitleFontSize", "h3"); 27 string subtitleFontSize = Model.Item.GetRawValueString("SubtitleFontSize", "fs-5"); 28 string buttonStyle = Model.Item.GetRawValueString("ButtonStyle", ""); 29 buttonStyle = buttonStyle == "primary" ? " btn-primary" : buttonStyle; 30 buttonStyle = buttonStyle == "secondary" ? " btn-secondary" : buttonStyle; 31 buttonStyle = buttonStyle == "link" ? " btn-link" : buttonStyle; 32 string maxWidth = Model.Item.GetRawValueString("TextReadability", ""); 33 maxWidth = maxWidth == "max-width-on" ? " mw-75ch" : maxWidth; 34 maxWidth = maxWidth == "max-width-off" ? "" : maxWidth; 35 36 string generalTheme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("GeneralTheme")) ? " theme " + Model.Item.GetRawValueString("GeneralTheme").Replace(" ", "").Trim().ToLower() : ""; 37 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 38 string imageTheme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("ImageTheme")) ? " theme " + Model.Item.GetRawValueString("ImageTheme").Replace(" ", "").Trim().ToLower() : ""; 39 40 //Link generation 41 string pageId = !string.IsNullOrEmpty(Model.Item.GetRawValueString("ProductSliderServicePage")) ? Model.Item.GetLink("ProductSliderServicePage").PageId.ToString() : ""; 42 if (string.IsNullOrEmpty(pageId)) 43 { 44 pageId = GetPageIdByNavigationTag("ProductSliderService").ToString(); 45 } 46 47 string url = "/Default.aspx?ID=" + pageId; 48 if (!url.Contains("LayoutTemplate", StringComparison.OrdinalIgnoreCase)) 49 { 50 url += url.Contains("?") ? "&LayoutTemplate=Designs/Swift/Swift_PageClean.cshtml" : "?LayoutTemplate=Designs/Swift/Swift_PageClean.cshtml"; 51 } 52 if (Pageview.IsVisualEditorMode) 53 { 54 url += "&VisualEdit=True"; 55 } 56 57 bool isLazyLoadingForProductInfoEnabled = Dynamicweb.Core.Converter.ToBoolean(Dynamicweb.Context.Current.Items["IsLazyLoadingForProductInfoEnabled"]); 58 if (isLazyLoadingForProductInfoEnabled) 59 { 60 url += "&getproductinfo=true"; 61 } 62 63 //Source type 64 string sourceType = Model.Item.GetRawValueString("RelationType", "trending"); 65 IList<string> relateFromGroupIds = new List<string> { }; 66 IList<string> relateFromProductVariantIds = new List<string> { }; 67 IList<string> relateFromProductIds = new List<string> { }; 68 bool hasVariants = false; 69 70 //--- VARIANTS --- 71 if (sourceType == "variants" && Model.Item.GetValue<ProductListViewModel>("ProductsToRelateToVariants") is ProductListViewModel productsToRelateToVariants) 72 { 73 foreach (var productSelection in productsToRelateToVariants.Products) 74 { 75 relateFromProductIds.Add(productSelection.Id); 76 } 77 } 78 79 //--- MOST SOLD --- 80 if (sourceType == "most-sold" && Model.Item.GetValue<IList<ProductGroupViewModel>>("GroupsToRelateToMostSold") is IList<ProductGroupViewModel> groupsToRelateToMostSold) 81 { 82 foreach (var fromGroup in groupsToRelateToMostSold) 83 { 84 relateFromGroupIds.Add(fromGroup.Id); 85 } 86 } 87 88 //--- TRENDING --- 89 if (sourceType == "trending" && Model.Item.GetValue<IList<ProductGroupViewModel>>("GroupsToRelateToTrending") is IList<ProductGroupViewModel> groupsToRelateToTrending) 90 { 91 foreach (var fromGroup in groupsToRelateToTrending) 92 { 93 relateFromGroupIds.Add(fromGroup.Id); 94 } 95 } 96 97 //--- LATEST --- 98 if (sourceType == "latest" && Model.Item.GetValue<IList<ProductGroupViewModel>>("GroupsToRelateToLatest") is IList<ProductGroupViewModel> groupsToRelateToLatest) 99 { 100 foreach (var fromGroup in groupsToRelateToLatest) 101 { 102 relateFromGroupIds.Add(fromGroup.Id); 103 } 104 } 105106 //--- FREQUENTLY BOUGHT --- 107 if (sourceType == "frequently" && Model.Item.GetValue<ProductListViewModel>("ProductsToRelateTo") is ProductListViewModel productsToRelateTo) 108 { 109 foreach (var fromProduct in productsToRelateTo.Products) 110 { 111 relateFromProductIds.Add(fromProduct.Id); 112 } 113 } 114115 //--- SELECTED PRODUCTS --- 116 if ((sourceType == "selected" || sourceType == "frequently") && Model.Item.GetValue<ProductListViewModel>("Products") is ProductListViewModel products) 117 { 118 hasVariants = products.Products.Any(p => !string.IsNullOrEmpty(p.VariantId)); 119 foreach (var productSelection in products.Products) 120 { 121 if (hasVariants) 122 { 123 if (!string.IsNullOrEmpty(productSelection.VariantId)) 124 { 125 relateFromProductVariantIds.Add($"{productSelection.Id} {productSelection.VariantId}"); 126 } 127 else 128 { 129 relateFromProductVariantIds.Add($"{productSelection.Id}"); 130 } 131 } 132 relateFromProductIds.Add($"{productSelection.Id}"); 133 } 134 } 135136 //--- RELATED PRODUCTS --- 137 if (sourceType == "related-products" && Model.Item.GetValue<ProductListViewModel>("ProductsToRelateTo2") is ProductListViewModel selectedRelationProduct) 138 { 139 if (selectedRelationProduct.Products.Any()) 140 { 141 product = selectedRelationProduct.Products.FirstOrDefault(); 142 } 143144 if (product?.RelatedGroups != null) 145 { 146 foreach (var group in product.RelatedGroups) 147 { 148 foreach (var relatedProduct in group.Products) 149 { 150 if (!string.IsNullOrEmpty(relatedProduct.VariantId)) 151 { 152 relateFromProductVariantIds.Add($"{relatedProduct.ProductId} {relatedProduct.VariantId}"); 153 } 154 else 155 { 156 relateFromProductVariantIds.Add($"{relatedProduct.ProductId}"); 157 } 158 } 159 } 160 } 161 } 162163 //Create group id collection and products id collection strings 164 string groupIds = product is object ? product.PrimaryOrDefaultGroup.Id : string.Join(",", relateFromGroupIds); 165 string productVariantIds = relateFromProductVariantIds.Count > 0 ? string.Join(",", relateFromProductVariantIds) : ""; 166 string productIds = product is object && relateFromProductIds.Count == 0 ? product.Id : string.Join(",", relateFromProductIds); 167168 //Set the parameters to the url 169 string linkParameters = ""; 170 linkParameters += sourceType != "related-products" && sourceType != "frequently" && sourceType != "selected" ? "&GroupId=" + groupIds : ""; 171 linkParameters += !string.IsNullOrEmpty(productIds) && sourceType != "most-sold" && sourceType != "trending" && sourceType != "latest" && sourceType != "frequently" && sourceType != "related-products" ? "&MainProductId=" + productIds : ""; 172 linkParameters += !string.IsNullOrEmpty(productVariantIds) && sourceType == "related-products" ? "&ProductVariantId=" + productVariantIds : ""; 173 linkParameters += sourceType == "variants" ? "&IsVariant=true" : ""; 174 linkParameters += sourceType == "latest" ? "&SortBy=Created" : ""; 175 linkParameters += sourceType == "most-sold" ? "&SortBy=OrderCount" : ""; 176 linkParameters += sourceType == "trending" ? "&SortBy=OrderCountGrowth" : ""; 177 linkParameters += !string.IsNullOrEmpty(productIds) && sourceType == "frequently" ? $"&BoughtWithProductIds=[{productIds}]" : ""; 178 var productListPageId = GetPageIdByNavigationTag("Shop"); 179 string link = "/Default.aspx?ID=" + productListPageId + linkParameters; 180181 // Slider settings (documentation: swiffyslider.com/configuration) 182 string navigationStyle = $"{Model.Item.GetRawValueString("NavigationStyle", "slider-nav-round")}"; 183 string navigationPlacement = $"{Model.Item.GetRawValueString("NavigationPlacement", "slider-nav-on-slides")}"; 184 string indicatorStyle = $"{Model.Item.GetRawValueString("IndicatorStyle", "slider-indicators-hidden")}"; 185 string revealSlides = Model.Item.GetRawValueString("RevealSlides", "no-reveal") == "reveal" ? "slider-item-reveal" : string.Empty; 186 string navigationAlwaysVisible = (Model.Item.GetBoolean("NavigationAlwaysVisible")) ? "slider-nav-visible" : string.Empty; 187 string navigationVisibleOnTouch = (Model.Item.GetBoolean("NavigationVisibleOnTouch")) ? "slider-nav-touch" : string.Empty; 188 string navigationShowScrollbar = (Model.Item.GetBoolean("NavigationShowScrollbar")) ? "slider-nav-scrollbar" : string.Empty; 189 string navigationSmall = (Model.Item.GetBoolean("NavigationSmall")) ? "slider-nav-sm" : string.Empty; 190 string navigationInvertColors = (Model.Item.GetBoolean("NavigationInvertColors")) ? "slider-nav-dark" : string.Empty; 191 string navigationSlideEntirePage = (Model.Item.GetBoolean("NavigationSlideEntirePage")) ? "slider-nav-page" : string.Empty; 192 string navigationNoLoop = (Model.Item.GetBoolean("NavigationNoLoop")) ? "slider-nav-noloop" : string.Empty; 193 string indicatorsOutsideSlider = (Model.Item.GetBoolean("IndicatorsOutsideSlider") && indicatorStyle != string.Empty) ? "slider-indicators-outside" : string.Empty; 194 string indicatorsHighlightActive = (Model.Item.GetBoolean("IndicatorsHighlightActive")) ? "slider-indicators-highlight" : string.Empty; 195 string indicatorsInvertColors = (Model.Item.GetBoolean("IndicatorsInvertedColors")) ? "slider-indicators-dark" : string.Empty; 196 string indicatorsVisibleOnSmallDevices = (Model.Item.GetBoolean("IndicatorsVisibleOnSmallDevices")) ? "slider-indicators-sm" : string.Empty; 197198 bool productsFound = true; 199 if (string.IsNullOrEmpty(groupIds) && string.IsNullOrEmpty(productIds) && string.IsNullOrEmpty(productVariantIds)) 200 { 201 if (Pageview.IsVisualEditorMode) 202 { 203 productIds = product.Id; 204 sourceType = "selected"; 205 } 206 else 207 { 208 productsFound = false; 209 } 210 } 211 } 212213 @*Container element for the request*@ 214 @if (productsFound) 215 { 216 <form method="post" action="@url" id="RelatedProductsForm_@Model.ID" data-response-target-element="RelatedProducts_@Model.ID" data-preloader="inline" data-update-url="false" class="item_@Model.Item.SystemName.ToLower()"> 217 <input type="hidden" name="ModelID" value="@Model.ID"> 218 <input type="hidden" name="SourceType" value="@sourceType"> 219220 @*--- SLIDER SETTINGS ---*@ 221 <input type="hidden" name="NavigationStyle" value="@navigationStyle"> 222 <input type="hidden" name="NavigationPlacement" value="@navigationPlacement"> 223 <input type="hidden" name="IndicatorStyle" value="@indicatorStyle"> 224 <input type="hidden" name="RevealSlides" value="@revealSlides"> 225 <input type="hidden" name="NavigationAlwaysVisible" value="@(navigationAlwaysVisible)"> 226 <input type="hidden" name="NavigationVisibleOnTouch" value="@(navigationVisibleOnTouch)"> 227 <input type="hidden" name="NavigationShowScrollbar" value="@(navigationShowScrollbar)"> 228 <input type="hidden" name="NavigationSmall" value="@(navigationSmall)"> 229 <input type="hidden" name="NavigationInvertColors" value="@(navigationInvertColors)"> 230 <input type="hidden" name="NavigationNoLoop" value="@(navigationNoLoop)"> 231 <input type="hidden" name="NavigationSlideEntirePage" value="@(navigationSlideEntirePage)"> 232 <input type="hidden" name="IndicatorsOutsideSlider" value="@(indicatorsOutsideSlider)"> 233 <input type="hidden" name="IndicatorsHighlightActive" value="@(indicatorsHighlightActive)"> 234 <input type="hidden" name="IndicatorsInvertColors" value="@(indicatorsInvertColors)"> 235 <input type="hidden" name="IndicatorsVisibleOnSmallDevices" value="@(indicatorsVisibleOnSmallDevices)"> 236237 @*--- VARIANTS ---*@ 238 @if (sourceType == "variants") 239 { 240 <input type="hidden" name="isVariant" value="true"> 241 <input type="hidden" name="MainProductID" id="MainProductID_@Model.ID" value="@productIds"> 242 } 243244 @*--- MOST SOLD ---*@ 245 @if (sourceType == "most-sold") 246 { 247 <input type="hidden" name="SortBy" value="OrderCount"> 248 if (groupIds != "") 249 { 250 <input type="hidden" name="GroupId" value="@groupIds"> 251 } 252 } 253254 @*--- TRENDING ---*@ 255 @if (sourceType == "trending") 256 { 257 <input type="hidden" name="SortBy" value="OrderCountGrowth"> 258 if (groupIds != "") 259 { 260 <input type="hidden" name="GroupId" value="@groupIds"> 261 } 262 } 263264 @*--- FREQUENTLY BOUGHT ---*@ 265 @if (sourceType == "frequently" && !string.IsNullOrEmpty(productIds)) 266 { 267 <input type="hidden" name="BoughtWithProductIds" value="[@productIds]"> 268 } 269 @if (sourceType != "frequently" && hasVariants) 270 { 271 <input type="hidden" name="ProductVariantId" value="@productVariantIds"> 272 } 273274 @*--- LATEST ---*@ 275 @if (sourceType == "latest") 276 { 277 <input type="hidden" name="SortBy" value="Created"> 278 <input type="hidden" name="GroupId" value="@groupIds"> 279 } 280281 @*--- SELECTED PRODUCTS ---*@ 282 @if (sourceType == "selected" && !string.IsNullOrEmpty(productIds) && !hasVariants) 283 { 284 <input type="hidden" name="MainProductId" id="MainProductID_@Model.ID" value="@productIds"> 285 } 286 @if (sourceType == "selected" && hasVariants) 287 { 288 <input type="hidden" name="ProductVariantId" value="@productVariantIds"> 289 } 290291 @*--- RELATED PRODUCTS ---*@ 292 @if (sourceType == "related-products") 293 { 294 <input type="hidden" name="ProductVariantId" id="MainProductID_@Model.ID" value="@productVariantIds"> 295 } 296297 @* General parameters *@ 298 <input type="hidden" name="Link" value="@link"> 299 <input type="hidden" name="HideTitle" value="@Model.Item.GetString("HideTitle")"> 300301 @if (Model.Item.GetInt32("ProductsCount") != 0) 302 { 303 <input type="hidden" name="PageSize" value="@Model.Item.GetInt32("ProductsCount")"> 304 } 305 <input type="hidden" name="HeadingTitle" id="RelatedProductsTitle_@Model.ID" value="@title"> 306 @if (!string.IsNullOrEmpty(Model.Item.GetString("Subtitle"))) 307 { 308 <input type="hidden" name="Subtitle" value="@Model.Item.GetString("Subtitle")"> 309 } 310 @if (!string.IsNullOrEmpty(Model.Item.GetString("LinkText"))) 311 { 312 <input type="hidden" name="LinkText" value="@Model.Item.GetString("LinkText")"> 313 } 314 @if (!string.IsNullOrEmpty(Model.Item.GetString("ImageAspectRatio"))) 315 { 316 string ratio = Model.Item.GetRawValueString("ImageAspectRatio", ""); 317 ratio = ratio != "0" ? ratio : ""; 318 <input type="hidden" name="ImageAspectRatio" value="@ratio"> 319 } 320 @if (!string.IsNullOrEmpty(Model.Item.GetString("Layout"))) 321 { 322 <input type="hidden" name="Layout" value="@Model.Item.GetRawValueString("Layout")"> 323 } 324 @if (titleFontSize != "") 325 { 326 <input type="hidden" name="TitleFontSize" value="@titleFontSize"> 327 } 328 @if (subtitleFontSize != "") 329 { 330 <input type="hidden" name="SubtitleFontSize" value="@subtitleFontSize"> 331 } 332 @if (buttonStyle != "") 333 { 334 <input type="hidden" name="ButtonStyle" value="@buttonStyle"> 335 } 336 @if (generalTheme != "") 337 { 338 <input type="hidden" name="GeneralTheme" value="@generalTheme"> 339 } 340 @if (theme != "") 341 { 342 <input type="hidden" name="Theme" value="@theme"> 343 } 344 @if (imageTheme != "") 345 { 346 <input type="hidden" name="ImageTheme" value="@imageTheme"> 347 } 348 @if (!string.IsNullOrEmpty(Model.Item.GetString("ContentPadding"))) 349 { 350 string contentPadding = Model.Item.GetRawValueString("ContentPadding"); 351 <input type="hidden" name="ContentPadding" value="@contentPadding"> 352 } 353 <input type="hidden" name="TextReadability" value="@maxWidth"> 354 <input type="hidden" name="ParentColumnSize" id="ParentColumnSize_@Model.ID" value="12"> 355356 <input type="hidden" name="SaleBadgeType" value="@Model.Item.GetRawValue("SaleBadgeType")"> 357 <input type="hidden" name="SaleBadgeCssClassName" value="@Model.Item.GetRawValue("SaleBadgeDesign")"> 358 <input type="hidden" name="NewBadgeCssClassName" value="@Model.Item.GetRawValue("NewBadgeDesign")"> 359 <input type="hidden" name="NewPublicationDays" value="@Model.Item.GetInt32("NewPublicationDays")"> 360361 @if (campaignValues != string.Empty) 362 { 363 <input type="hidden" name="CampaignBadgesValues" value="@campaignValues"> 364 } 365 </form> 366367 <script type="module" src="/Files/Templates/Designs/Swift/Assets/js/swiffy-slider.js"></script> 368 <script> 369 window.addEventListener("load", () => { 370 swift.AssetLoader.Load('/Files/Templates/Designs/Swift/Assets/css/swiffy-slider.min.css', 'css'); 371 }); 372 </script> 373374 if (Pageview.IsVisualEditorMode) 375 { 376 <div class="alert alert-info" role="alert"> 377 <span>@Translate("Product slider: Edit this column to configure")</span> 378 </div> 379 } 380381 if (sourceType != "related-products") 382 { 383 <div class="w-100 h-100"> 384 <div id="@Model.ID" class="user-select-none" style="scroll-margin-top:var(--header-height,150px)"></div> 385 <div id="RelatedProducts_@Model.ID" class="h-100 swift_product_slider_container"></div> 386 </div> 387 } 388 else if (product?.RelatedGroups != null) 389 { 390 @* Create multiple slider containers, if type is Product relation *@ 391 <div class="grid w-100 h-100@(generalTheme)" style="grid-row-gap: 4rem"> 392 <div id="@Model.ID" class="user-select-none" style="scroll-margin-top:var(--header-height,150px)"></div> 393 @foreach (var group in product.RelatedGroups) 394 { 395 <div id="RelatedProducts_@(Model.ID)_@group.Id" class="g-col-12 h-100 swift_product_slider_container"></div> 396 } 397 </div> 398 } 399400 @* Initialize *@ 401 if (sourceType != "related-products") 402 { 403 <script type="module"> 404 if (document.querySelector("#RelatedProducts_@Model.ID").closest("[data-col-size]")) { 405 document.querySelector("#ParentColumnSize_@Model.ID").value = document.querySelector("#RelatedProducts_@Model.ID").closest("[data-col-size]").getAttribute("data-col-size"); 406 } 407 swift.PageUpdater.Update(document.querySelector("#RelatedProductsForm_@Model.ID")).then(function () { 408 setTimeout(function() { 409 const isVisualEditor = @(Converter.ToString(Pageview.IsVisualEditorMode).ToLowerInvariant()); 410 const productSliderContainer = document.querySelector(".swift_product_slider_container"); 411412 if (productSliderContainer && productSliderContainer.innerHTML !== "") { 413 productSliderContainer.classList.remove("d-none"); 414 } 415 else if (!isVisualEditor) { 416 productSliderContainer.closest("[class*=column]").classList.add("d-none"); 417 } 418 }, 150); 419 }); 420 </script> 421 } 422 else if (product?.RelatedGroups != null) 423 { 424 @* Create multiple sliders, if type is Product relation *@ 425 foreach (var group in product.RelatedGroups) 426 { 427 IList<string> fromProductIds = new List<string> { }; 428429 foreach (var relatedProduct in group.Products) 430 { 431 if (!string.IsNullOrEmpty(relatedProduct.VariantId)) 432 { 433 fromProductIds.Add($"{relatedProduct.ProductId} {relatedProduct.VariantId}"); 434 } 435 else 436 { 437 fromProductIds.Add($"{relatedProduct.ProductId}"); 438 } 439 } 440 <script type="module"> 441 document.querySelector("#ParentColumnSize_@Model.ID").value = document.querySelector("#RelatedProducts_@(Model.ID)_@group.Id").closest("[data-col-size]").getAttribute("data-col-size"); 442 document.querySelector("#MainProductID_@Model.ID").value = "@string.Join(",", fromProductIds)"; 443 document.querySelector("#RelatedProductsTitle_@Model.ID").value = "@group.Name"; 444 document.querySelector("#RelatedProductsForm_@Model.ID").setAttribute("data-response-target-element", "RelatedProducts_@(Model.ID)_@group.Id"); 445446 swift.PageUpdater.Update(document.querySelector("#RelatedProductsForm_@Model.ID")); 447 </script> 448 } 449 } 450 } 451
Error executing template "Designs/Swift/Paragraph/Swift_Poster.cshtml" System.IO.IOException: There is not enough space on the disk. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.WriteCore(Byte[] buffer, Int32 offset, Int32 count) at System.IO.FileStream.FlushWrite(Boolean calledFromFinalizer) at System.IO.FileStream.Dispose(Boolean disposing) at System.IO.Stream.Close() at System.IO.StreamWriter.Dispose(Boolean disposing) at System.IO.TextWriter.Dispose() at System.IO.File.InternalWriteAllText(String path, String contents, Encoding encoding, Boolean checkHost) at RazorEngine.Roslyn.CSharp.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.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer) at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter) 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 private string RenderCustomCSS(IEnumerable<string> decorations) 7 { 8 var cssClasses = new List<string>(); 9 10 foreach (var itemId in decorations) 11 { 12 var item = Dynamicweb.Content.Services.Items.GetItem("Swift_Css", itemId); 13 item.TryGetValue("Class", out object classes); 14 15 if (classes is null) 16 { 17 continue; 18 } 19 20 var cssString = (string)classes; 21 22 if (cssString.StartsWith("[")) 23 { 24 var cssArray = Dynamicweb.Core.Converter.Deserialize<string[]>(cssString); 25 cssClasses.AddRange(cssArray); 26 } 27 else 28 { 29 cssClasses.Add(cssString.Replace(",", " ")); 30 } 31 } 32 33 return string.Join(" ", cssClasses).Trim(); 34 } 35 } 36 37 @{ 38 bool movePageBehind = false; 39 bool isFirstPoster = false; 40 string movePageBehindClass = string.Empty; 41 42 if (Pageview.Page.PropertyItem != null) 43 { 44 string headerCssClass = Pageview.Page.PropertyItem["MoveThisPageBehindTheHeader"] != null ? Pageview.Page.PropertyItem["MoveThisPageBehindTheHeader"].ToString() : "sticky-top"; 45 movePageBehind = headerCssClass == "fixed-top" && !Pageview.IsVisualEditorMode ? true : false; 46 if (movePageBehind) 47 { 48 movePageBehindClass = " poster-behind"; 49 if (!Dynamicweb.Context.Current.Items.Contains("firstPosterIsRendered")) 50 { 51 isFirstPoster = true; 52 Dynamicweb.Context.Current.Items.Add("firstPosterIsRendered", true); 53 } 54 } 55 } 56 57 bool hideTitle = Model.Item?.GetBoolean("HideTitle") ?? false; 58 string title = !hideTitle ? Model.Item.GetString("Title", string.Empty) : string.Empty; 59 60 string titleFontSize = Model.Item.GetRawValueString("TitleFontSize", "display-1"); 61 string titleColor = Model.Item.GetString("TitleColor", "text-inherit"); 62 string titleOpacity = Model.Item.GetString("TitleOpacity", "opacity-100"); 63 64 string subtitleFontSize = Model.Item.GetRawValueString("SubtitleFontSize", "fs-5"); 65 string subtitleColor = Model.Item.GetString("SubtitleColor", "text-inherit"); 66 string subtitleOpacity = Model.Item.GetString("SubtitleOpacity", "opacity-100"); 67 68 string headingLevel = Model.Item.GetString("HeadingLevel", "h2"); 69 string headingLevelStart = $"<{headingLevel} class=\"{titleFontSize} {titleColor} {titleOpacity} mb-0\">"; 70 string headingLevelStop = $"</{headingLevel}>"; 71 72 bool roundedCorners = Model.Item?.GetBoolean("RoundedCorners") ?? false; 73 string classRoundedCorners = roundedCorners ? "rounded-corners" : string.Empty; 74 75 //Link generation 76 Dynamicweb.Frontend.LinkViewModel link = new Dynamicweb.Frontend.LinkViewModel(); 77 Dynamicweb.Frontend.LinkViewModel link2 = new Dynamicweb.Frontend.LinkViewModel(); 78 79 string linkType = Model.Item.GetRawValueString("LinkType", "page"); 80 string linkType2 = Model.Item.GetRawValueString("LinkType2", "page2"); 81 82 if (linkType == "page" && Model.Item.GetLink("ButtonLink") != null) 83 { 84 link = Model.Item.GetLink("ButtonLink"); 85 } 86 87 if (linkType2 == "page2" && Model.Item.GetLink("ButtonLink2") != null) 88 { 89 link2 = Model.Item.GetLink("ButtonLink2"); 90 } 91 92 if (linkType == "product-group") 93 { 94 IList<ProductGroupViewModel> selectedGroups = Model.Item.GetValue<IList<ProductGroupViewModel>>("ProductGroupLink"); 95 IList<string> groupIds = new List<string> { }; 96 97 if (selectedGroups != null) 98 { 99 foreach (var fromGroup in selectedGroups) 100 { 101 groupIds.Add(fromGroup.Id); 102 } 103 } 104105 link = new Dynamicweb.Frontend.LinkViewModel() 106 { 107 Url = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Shop") + "&GroupID=" + string.Join(",", groupIds).Trim(), 108 IsExternal = false 109 }; 110 } 111112 if (linkType2 == "product-group2") 113 { 114 IList<ProductGroupViewModel> selectedGroups = Model.Item.GetValue<IList<ProductGroupViewModel>>("ProductGroupLink2"); 115 IList<string> groupIds = new List<string> { }; 116117 if (selectedGroups != null) 118 { 119 foreach (var fromGroup in selectedGroups) 120 { 121 groupIds.Add(fromGroup.Id); 122 } 123 } 124125 link2 = new Dynamicweb.Frontend.LinkViewModel() 126 { 127 Url = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Shop") + "&GroupID=" + string.Join(",", groupIds).Trim(), 128 IsExternal = false 129 }; 130 } 131132 if (linkType == "product") 133 { 134 ProductListViewModel products = Model.Item.GetValue<ProductListViewModel>("ProductLink"); 135 IList<string> productIds = new List<string> { }; 136137 if (products != null && products.Products.Any()) 138 { 139 foreach (var product in products.Products) 140 { 141 productIds.Add(product.Id); 142 } 143 string productParameter = productIds.Count == 1 ? "ProductID" : "MainProductId"; 144 string productLink = products.Products?.FirstOrDefault()?.GetProductLink(GetPageIdByNavigationTag("Shop"), false); 145 productLink = productIds.Count != 1 ? "/Default.aspx?ID=" + GetPageIdByNavigationTag("Shop") + "&" + productParameter + "=" + string.Join(",", productIds).Trim() : productLink; 146147 link = new Dynamicweb.Frontend.LinkViewModel() 148 { 149 Url = productLink, 150 IsExternal = false 151 }; 152 } 153 } 154155 if (linkType == "product2") 156 { 157 ProductListViewModel products = Model.Item.GetValue<ProductListViewModel>("ProductLink2"); 158 IList<string> productIds = new List<string> { }; 159160 if (products != null && products.Products.Any()) 161 { 162 foreach (var product in products.Products) 163 { 164 productIds.Add(product.Id); 165 } 166167 string productParameter = productIds.Count == 1 ? "ProductID" : "MainProductId"; 168 string productLink = products.Products?.FirstOrDefault()?.GetProductLink(GetPageIdByNavigationTag("Shop"), false); 169 productLink = productIds.Count != 1 ? "/Default.aspx?ID=" + GetPageIdByNavigationTag("Shop") + "&" + productParameter + "=" + string.Join(",", productIds).Trim() : productLink; 170171 link2 = new Dynamicweb.Frontend.LinkViewModel() 172 { 173 Url = productLink, 174 IsExternal = false 175 }; 176 } 177 } 178179 //Buttons setup 180 string target = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && link.IsExternal ? "target=\"_blank\"" : string.Empty; 181 string rel = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && link.IsExternal ? "rel=\"noopener\"" : string.Empty; 182183 string buttonSize = Model.Item.GetRawValueString("ButtonSize", "regular"); 184 buttonSize = buttonSize == "small" ? " btn-sm" : buttonSize; 185 buttonSize = buttonSize == "regular" ? string.Empty : buttonSize; 186 buttonSize = buttonSize == "large" ? " btn-lg" : buttonSize; 187188 //Button 1 189 string buttonStyle = Model.Item.GetRawValueString("ButtonStyle", "primary"); 190 buttonStyle = buttonStyle == "primary" ? " btn-primary" : buttonStyle; 191 buttonStyle = buttonStyle == "secondary" ? " btn-secondary" : buttonStyle; 192 buttonStyle = buttonStyle == "link" ? " btn-link" : buttonStyle; 193 string buttonLabel = Model.Item.GetString("ButtonLabel", string.Empty); 194 string stretchedLink = Model.Item.GetRawValueString("StretchedLink", "column-not-clickable"); 195 string stretchedLinkClass = stretchedLink == "column-clickable" && string.IsNullOrEmpty(link2.Url) && string.IsNullOrEmpty(buttonLabel) ? " stretched-link" : string.Empty; 196197 //Button 2 198 string buttonStyle2 = Model.Item.GetRawValueString("ButtonStyle2", "secondary"); 199 buttonStyle2 = buttonStyle2 == "primary" ? " btn-primary" : buttonStyle2; 200 buttonStyle2 = buttonStyle2 == "secondary" ? " btn-secondary" : buttonStyle2; 201 buttonStyle2 = buttonStyle2 == "link" ? " btn-link" : buttonStyle2; 202 string buttonLabel2 = Model.Item.GetString("ButtonLabel2", string.Empty); 203 string stretchedLink2 = Model.Item.GetRawValueString("StretchedLink2", "column-not-clickable"); 204 string stretchedLinkClass2 = stretchedLink2 == "column-clickable" && string.IsNullOrEmpty(link.Url) && string.IsNullOrEmpty(buttonLabel2) ? " stretched-link" : string.Empty; 205206 //Image 207 string image = Model.Item.GetString("Image", string.Empty); 208 string imgAltText = Model.Item.GetString("PosterAltText", string.Empty); 209 string imageFilter = Model.Item.GetRawValueString("ImageFilter", string.Empty) == "filter" ? "image-filter" : string.Empty; 210211 int xPos = Model.Item?.GetFile("Image")?.FocalPositionFromLeft ?? 50; 212 int yPos = Model.Item?.GetFile("Image")?.FocalPositionFromTop ?? 50; 213214 var parms = new Dictionary<string, object>(); 215 parms.Add("columns", Model.GridRowColumnCount); 216 parms.Add("alt", imgAltText); 217 parms.Add("quality", 90); 218219 //General layout and styling 220 string maxWidth = Model.Item.GetRawValueString("TextReadability", string.Empty) == "max-width-on" ? "mw-75ch d-inline-block" : string.Empty; 221 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", string.Empty).Trim().ToLower() : string.Empty; 222 var decorations = Model.Item?.GetList("CssDecorations")?.GetRawValue().OfType<string>() ?? Enumerable.Empty<string>(); 223 string css = RenderCustomCSS(decorations); 224225 string posterPaddingClass = string.Empty; 226 string posterPadding = Model.Item.GetRawValueString("ContentPadding", string.Empty); 227 posterPaddingClass = posterPadding == "none" ? " p-3 px-xl-3 py-xl-4" : posterPaddingClass; 228 posterPaddingClass = posterPadding == "small" ? " p-3 p-xl-4" : posterPaddingClass; 229 posterPaddingClass = posterPadding == "large" ? " p-4 p-xl-5" : posterPaddingClass; 230231 string posterHeightClass = string.Empty; 232 string posterHeight = Model.Item.GetRawValueString("PosterHeight", "large"); 233 posterHeightClass = posterHeight == "small" ? " min-vh-25 min-vh-md-50" : posterHeightClass; 234 posterHeightClass = posterHeight == "medium" ? " min-vh-50 min-vh-md-75" : posterHeightClass; 235 posterHeightClass = posterHeight == "large" ? " min-vh-75 min-vh-md-100" : posterHeightClass; 236237 string posterSizeBase = posterHeight.Contains("%") || posterHeight.Contains("0") ? "aspect-ratio" : "height"; 238239 string ratio = Model.Item.GetRawValueString("PosterHeight", string.Empty); 240 ratio = ratio != "0" ? ratio : string.Empty; 241 string ratioCssClass = ratio != string.Empty ? "ratio" : string.Empty; 242 string ratioVariable = ratio != string.Empty ? "style=\"--bs-aspect-ratio: " + ratio + "\"" : string.Empty; 243244 string layout = Model.Item.GetRawValueString("Layout", "align-middle-center-text-center"); 245246 string alignment = string.Empty; 247 switch (layout) 248 { 249 case "align-top-left-text-left": 250 alignment = " text-start justify-content-start align-items-start"; 251 break; 252 case "align-top-center-text-center": 253 alignment = " text-center justify-content-start align-items-center"; 254 break; 255 case "align-top-right-text-right": 256 alignment = " text-end justify-content-start align-items-end"; 257 break; 258 case "align-middle-left-text-left": 259 alignment = " text-start justify-content-center align-items-start"; 260 break; 261 case "align-middle-center-text-center": 262 alignment = " text-center justify-content-center align-items-center"; 263 break; 264 case "align-middle-right-text-right": 265 alignment = " text-end justify-content-center align-items-end"; 266 break; 267 case "align-bottom-left-text-left": 268 alignment = " text-start justify-content-end align-items-start"; 269 break; 270 case "align-bottom-center-text-center": 271 alignment = " text-center justify-content-end align-items-center"; 272 break; 273 case "align-bottom-right-text-right": 274 alignment = " text-end justify-content-end align-items-end"; 275 break; 276 } 277278 //Container classes for each size + if there is an image 279 string noImageRatioCssClass = posterSizeBase == "aspect-ratio" && string.IsNullOrEmpty(Model.Item.GetString("Image")) ? ratioCssClass : "h-100"; 280 string noImageRatioVariable = posterSizeBase == "aspect-ratio" && string.IsNullOrEmpty(Model.Item.GetString("Image")) ? ratioVariable : string.Empty; 281282 string containerCssClasses = posterSizeBase == "height" ? "container-xl px-0" : string.Empty; 283 containerCssClasses = posterSizeBase == "aspect-ratio" && string.IsNullOrEmpty(Model.Item.GetString("Image")) ? $"container-xl px-0 {noImageRatioCssClass}" : containerCssClasses; 284 containerCssClasses = posterSizeBase == "aspect-ratio" && !string.IsNullOrEmpty(Model.Item.GetString("Image")) ? "position-absolute top-0 bottom-0 end-0 start-0" : containerCssClasses; 285286 string containerInnerCssClasses = posterSizeBase == "height" ? "position-relative" : string.Empty; 287 containerInnerCssClasses = posterSizeBase == "aspect-ratio" && string.IsNullOrEmpty(Model.Item.GetString("Image")) ? "container-xl" : containerInnerCssClasses; 288 containerInnerCssClasses = posterSizeBase == "aspect-ratio" && !string.IsNullOrEmpty(Model.Item.GetString("Image")) ? "container-xl" : containerInnerCssClasses; 289 } 290291 <div class="position-relative@(theme)@(movePageBehindClass) @(css) @classRoundedCorners item_@Model.Item.SystemName.ToLower()"> 292 <div id="@Model.ID" class="user-select-none position-absolute top-0" style="scroll-margin-top:var(--header-height,150px)"></div> 293294 @if (!string.IsNullOrEmpty(Model.Item.GetString("Image"))) 295 { 296 if (!string.IsNullOrEmpty(image)) 297 { 298 if (posterSizeBase == "height") 299 { 300 parms.Add("cssClass", "h-100 w-100"); 301302 <div class="position-absolute top-0 bottom-0 end-0 start-0 @(imageFilter)"> 303 @RenderPartial("Components/Image.cshtml", Model.Item.GetFile("Image") ?? new Dynamicweb.Frontend.FileViewModel(), parms) 304 </div> 305 } 306307 if (posterSizeBase == "aspect-ratio") 308 { 309 if (ratio == string.Empty) 310 { 311 parms.Add("cssClass", "w-100 mh-100 mw-100"); 312 parms.Add("fullwidth", true); 313 } 314315 <figure class="m-0 @(imageFilter) @(ratioCssClass)" @ratioVariable> 316 @RenderPartial("Components/Image.cshtml", Model.Item.GetFile("Image") ?? new Dynamicweb.Frontend.FileViewModel(), parms) 317 </figure> 318 } 319 } 320 } 321322 @if ( 323 !string.IsNullOrEmpty(Model.Item.GetString("Title")) || 324 Model.Item?.GetBoolean("HideTitle") == false || 325 !string.IsNullOrEmpty(Model.Item.GetString("Text")) || 326 link != null && !string.IsNullOrEmpty(link.Url) || 327 link2 != null && !string.IsNullOrEmpty(link2.Url)) 328 { 329 <div class="@containerCssClasses" @ratioVariable> 330 <div class="h-100 d-flex flex-column gap-3 gap-md-4@(posterPaddingClass)@(alignment)@(posterHeightClass) @(containerInnerCssClasses)" id="Poster_@Pageview.CurrentParagraph.ID"> 331 @if (!string.IsNullOrEmpty(title)) 332 { 333 @headingLevelStart 334 <span class="@maxWidth">@title</span> 335 @headingLevelStop 336 } 337 @if (!string.IsNullOrEmpty(Model.Item.GetString("Text"))) 338 { 339 <p class="@subtitleFontSize @(subtitleColor) @(subtitleOpacity) lead mb-0"> 340 <span class="@maxWidth">@Model.Item.GetString("Text")</span> 341 </p> 342 } 343 @if (link != null && !string.IsNullOrEmpty(link.Url) || link2 != null && !string.IsNullOrEmpty(link2.Url)) 344 { 345 if ((link != null && !string.IsNullOrEmpty(link.Url)) && (link2 != null && !string.IsNullOrEmpty(link2.Url))) { 346 @:<div class="d-flex flex-wrap gap-3@(alignment)"> 347 } 348349 if (link != null && !string.IsNullOrEmpty(link.Url)) 350 { 351 if (!string.IsNullOrEmpty(buttonLabel)) 352 { 353 <a href="@link.Url" @target @rel class="text-nowrap btn@(buttonStyle)@(buttonSize)@(stretchedLinkClass)">@buttonLabel</a> 354 } 355 else 356 { 357 <a href="@link.Url" @target @rel class="@(!string.IsNullOrEmpty(stretchedLinkClass) ? "position-absolute top-0 bottom-0 start-0 end-0" : stretchedLinkClass)"> 358 <span class="visually-hidden">@Model.Item.GetString("Title")</span> 359 </a> 360 } 361 } 362363 if (link2 != null && !string.IsNullOrEmpty(link2.Url)) 364 { 365 if (!string.IsNullOrEmpty(buttonLabel2)) 366 { 367 <a href="@link2.Url" @target @rel class="text-nowrap btn@(buttonStyle2)@(buttonSize)@(stretchedLinkClass2)">@buttonLabel2</a> 368 } 369 else 370 { 371 <a href="@link2.Url" @target @rel class="@(!string.IsNullOrEmpty(stretchedLinkClass2) ? "position-absolute top-0 bottom-0 start-0 end-0" : stretchedLinkClass2)"> 372 <span class="visually-hidden">@Model.Item.GetString("Title")</span> 373 </a> 374 } 375 } 376377 if ((link != null && !string.IsNullOrEmpty(link.Url)) && (link2 != null && !string.IsNullOrEmpty(link2.Url))) { 378 @:</div> 379 } 380 } 381 </div> 382 </div> 383 } 384 </div> 385386 @if (movePageBehind && isFirstPoster) 387 { 388 <script> 389 ['resize', 'load'].forEach(function (e) { 390 window.addEventListener(e, () => swift.Scroll.setContentPosition()); 391 }); 392 </script> 393 } 394
Stjæl stilen
Det nye sort
NOIR-serien kombinerer rå luksuriøsitet og moderne minimalisme — både udvendigt og indvendigt. Sæt fokus på detaljen med en sort cylinder på din hoveddør og fuldendt det sorte look med et matchende dørgreb.
Error executing template "/Designs/Swift/Grid/Page/RowTemplates/2Columns_9-3.cshtml" System.IO.IOException: There is not enough space on the disk. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.WriteCore(Byte[] buffer, Int32 offset, Int32 count) at System.IO.FileStream.FlushWrite(Boolean calledFromFinalizer) at System.IO.FileStream.Dispose(Boolean disposing) at System.IO.Stream.Close() at System.IO.StreamWriter.Dispose(Boolean disposing) at System.IO.TextWriter.Dispose() at System.IO.File.InternalWriteAllText(String path, String contents, Encoding encoding, Boolean checkHost) at RazorEngine.Roslyn.CSharp.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.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer) at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter) 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 3 @{ 4 string sectionClass = "py-3"; 5 string spaceBetweenRows = Model.Item.GetRawValueString("SpaceBetweenRows", "spacing"); 6 string spaceBetweenRowsMobile = Model.Item.GetRawValueString("SpaceBetweenRowsMobile", "auto"); 7 8 //Row spacing mobile auto 9 if (spaceBetweenRowsMobile == "auto") { 10 spaceBetweenRowsMobile = spaceBetweenRows; 11 } 12 13 //Row spacing mobile 14 switch (spaceBetweenRowsMobile) { 15 case "none": //No spacing 16 sectionClass = "py-0"; 17 break; 18 case "spacing": //Small spacing top and bottom 19 sectionClass = "py-3"; 20 break; 21 case "spacing-small-top": //Small spacing top 22 sectionClass = "pt-3"; 23 break; 24 case "spacing-small-bottom": //Small spacing bottom 25 sectionClass = "pb-3"; 26 break; 27 case "spacing-medium": //Medium spacing top and bottom 28 sectionClass = "py-4"; 29 break; 30 case "spacing-medium-top": //Medium spacing top 31 sectionClass = "pt-4"; 32 break; 33 case "spacing-medium-bottom": //Medium spacing bottom 34 sectionClass = "pb-4"; 35 break; 36 case "spacing-large": //Large spacing top and bottom 37 sectionClass = "py-5"; 38 break; 39 case "spacing-top": //Large spacing top 40 sectionClass = "pt-5"; 41 break; 42 case "spacing-bottom": //Large spacing bottom 43 sectionClass = "pb-5"; 44 break; 45 } 46 47 //Row spacing dekstop 48 switch (spaceBetweenRows) { 49 case "none": //No spacing 50 sectionClass += " py-lg-0"; 51 break; 52 case "spacing": //Small spacing top and bottom 53 sectionClass += " py-lg-3"; 54 break; 55 case "spacing-small-top": //Small spacing top 56 sectionClass += " pt-lg-3 pb-lg-0"; 57 break; 58 case "spacing-small-bottom": //Small spacing bottom 59 sectionClass += " pb-lg-3 pt-lg-0"; 60 break; 61 case "spacing-medium": //Medium spacing top and bottom 62 sectionClass += " py-lg-5"; 63 break; 64 case "spacing-medium-top": //Medium spacing top 65 sectionClass += " pt-lg-5 pb-lg-0"; 66 break; 67 case "spacing-medium-bottom": //Medium spacing bottom 68 sectionClass += " pb-lg-5 pt-lg-0"; 69 break; 70 case "spacing-large": //Large spacing top and bottom 71 sectionClass += " py-lg-6"; 72 break; 73 case "spacing-top": //Large spacing top 74 sectionClass += " pt-lg-6 pb-lg-0"; 75 break; 76 case "spacing-bottom": //Large spacing bottom 77 sectionClass += " pb-lg-6 pt-lg-0"; 78 break; 79 } 80 81 string containerClass = "container-xl"; 82 string width = Model.Item.GetRawValueString("Width", "container-xl"); 83 if (width == "none") 84 { 85 containerClass = "container-fluid px-0"; 86 } 87 if (width == "stretch") 88 { 89 containerClass = "container-fluid"; 90 } 91 if (width == "compressed") 92 { 93 containerClass = " container-compressed"; 94 } 95 96 string rowClass = string.Empty; 97 string spaceBetweenColumns = Model.Item.GetRawValueString("SpaceBetweenColumns", string.Empty).ToLower(); 98 string spaceBetweenColumnsMobile = Model.Item.GetRawValueString("SpaceBetweenColumnsMobile", string.Empty).ToLower(); 99 //Mobile 100 if (spaceBetweenColumnsMobile == "auto") 101 { 102 spaceBetweenColumnsMobile = spaceBetweenColumns; 103 } 104 if (spaceBetweenColumnsMobile == "stick") 105 { 106 rowClass = " gap-0"; 107 } 108 if (spaceBetweenColumnsMobile == "spacing-medium") 109 { 110 rowClass = " gap-4"; 111 } 112 if (spaceBetweenColumnsMobile == "spacing-large") 113 { 114 rowClass = " gap-5"; 115 } 116 //Desktop 117 if (spaceBetweenColumns == "stick") 118 { 119 rowClass += " gap-lg-0"; 120 } 121 if (spaceBetweenColumns == "spacing-medium") 122 { 123 rowClass += " gap-lg-4"; 124 } 125 if (spaceBetweenColumns == "spacing-large") 126 { 127 rowClass += " gap-lg-5"; 128 } 129130 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 131132 string animationOnScrollCol1 = Model.Item.GetRawValueString("AnimationOnScrollCol1", "no-animation"); 133 animationOnScrollCol1 = animationOnScrollCol1 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol1 + "'" : ""; 134 string animationOnScrollCol2 = Model.Item.GetRawValueString("AnimationOnScrollCol2", "no-animation"); 135 animationOnScrollCol2 = animationOnScrollCol2 != "no-animation" ? "data-aos=" + "'" + animationOnScrollCol2 + "'" : ""; 136137 string hideOverflow = " overflow-hidden"; 138 hideOverflow = 139 animationOnScrollCol1 != "" || 140 animationOnScrollCol2 != "" 141 ? hideOverflow : ""; 142143 Dynamicweb.Frontend.FileViewModel backgroundImage = Model.Item.GetFile("BackgroundImage"); 144 string backgroundImagePath = backgroundImage?.Path ?? string.Empty; 145 backgroundImagePath = $"/Admin/Public/GetImage.ashx?image={backgroundImagePath}&width=2600&format=webp&compression=75&quality=90"; 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; 160161 var decorations = Model.Item?.GetList("CssDecorations")?.GetRawValue().OfType<string>() ?? Enumerable.Empty<string>(); 162 var css = string.Empty; 163 var cssClasses = new List<string> { }; 164165 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 } 173174 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(); 186187 @* Only gradient *@ 188189 if (!string.IsNullOrEmpty(gradient) && string.IsNullOrEmpty(backgroundImagePath) && gradientOpacity != ("0.00")) 190 { 191 styleString += "style=\"background-image:" + gradientString + ";\""; 192 } 193194 @* Only background image *@ 195196 else if (string.IsNullOrEmpty(gradient) && !string.IsNullOrEmpty(backgroundImagePath)) 197 { 198 styleString += "style=\"background-image:" + backgroundImageString + "; " + backgroundImagePositionString + backgroundRepeatString + backgroundImageSizeString + "\""; 199 } 200201 @* Gradient and background image *@ 202203 else if (!string.IsNullOrEmpty(gradient) && !string.IsNullOrEmpty(backgroundImagePath)) 204 { 205 styleString += "style=\"background-image:" + gradientString + "," + backgroundImageString + ";" + backgroundImagePositionString + backgroundRepeatString + backgroundImageSizeString + "\""; 206 } 207208 int mobileColumnSize = Dynamicweb.Core.Converter.ToInt32(Model.Item.GetRawValueString("MobileColumnBehaviour", "1")); 209 int mobileOrderFirst = Dynamicweb.Core.Converter.ToInt32(Model.Item.GetRawValueString("MobileOrderFirst", "1")); 210211 if (Pageview.IsVisualEditorMode || !string.IsNullOrWhiteSpace(Model.Column(1).Output()) || !string.IsNullOrWhiteSpace(Model.Column(2).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-4@(rowClass)"> 216 <div class="g-col g-col-lg-3 @(Model.Column(1).ColumnNumber == mobileOrderFirst ? "order-first order-lg-0" : string.Empty)" data-col-size="9" @animationOnScrollCol2 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="3" @animationOnScrollCol1 style="--bs-columns:12"> 220 @Model.Column(2).Output() 221 </div> 222 </div> 223 </div> 224 </div> 225 } 226 } 227
Error executing template "Designs/Swift/Paragraph/Swift_SectionHeader.cshtml" System.IO.IOException: There is not enough space on the disk. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.WriteCore(Byte[] buffer, Int32 offset, Int32 count) at System.IO.FileStream.FlushWrite(Boolean calledFromFinalizer) at System.IO.FileStream.Dispose(Boolean disposing) at System.IO.Stream.Close() at System.IO.StreamWriter.Dispose(Boolean disposing) at System.IO.TextWriter.Dispose() at System.IO.File.InternalWriteAllText(String path, String contents, Encoding encoding, Boolean checkHost) at RazorEngine.Roslyn.CSharp.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.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer) at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter) 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 layout = Model.Item.GetRawValueString("Layout", "text-start"); 38 39 string layoutClasses = layout == "text-start" ? "" : ""; 40 layoutClasses = layout == "text-center" ? " align-items-center text-center" : layoutClasses; 41 layoutClasses = layout == "text-end" ? " align-items-end text-end" : layoutClasses; 42 layoutClasses = layout == "alignLeftMiddle" ? " justify-content-center" : layoutClasses; 43 layoutClasses = layout == "alignCenterMiddle" ? " align-items-center justify-content-center text-center" : layoutClasses; 44 45 string contentPadding = Model.Item.GetRawValueString("ContentPadding", ""); 46 contentPadding = contentPadding == "none" ? "p-0" : contentPadding; 47 contentPadding = contentPadding == "small" ? "p-2 p-md-3" : contentPadding; 48 contentPadding = contentPadding == "large" ? "p-4 p-md-5" : contentPadding; 49 50 string maxWidth = Model.Item.GetRawValueString("TextReadability", "max-width-on"); 51 maxWidth = maxWidth == "max-width-on" ? " mw-75ch d-inline-block" : ""; 52 53 string titleColor = Model.Item.GetString("TitleColor", "text-inherit"); 54 string titleOpacity = Model.Item.GetString("TitleOpacity", "opacity-100"); 55 string titleFontSize = Model.Item.GetRawValueString("TitleFontSize", "display-4"); 56 string headingLevel = Model.Item.GetString("HeadingLevel", "h2"); 57 string headingLevelStart = $"<{headingLevel} class=\"{titleFontSize} {titleColor} {titleOpacity}{maxWidth} m-0\">"; 58 string headingLevelStop = $"</{headingLevel}>"; 59 60 string subtitleFontSize = Model.Item.GetRawValueString("SubtitleFontSize", "fs-5"); 61 string subtitleColor = Model.Item.GetString("SubtitleColor", "text-inherit"); 62 string subtitleOpacity = Model.Item.GetString("SubtitleOpacity", "opacity-100"); 63 64 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 65 var decorations = Model.Item?.GetList("CssDecorations")?.GetRawValue().OfType<string>() ?? Enumerable.Empty<string>(); 66 string css = RenderCustomCSS(decorations); 67 } 68 69 <div class="h-100 @(contentPadding)@(theme) @(css) item_@Model.Item.SystemName.ToLower()"> 70 <div id="@Model.ID" class="user-select-none" style="scroll-margin-top:var(--header-height,150px)"></div> 71 <div class="d-flex flex-column h-100@(layoutClasses)"> 72 @if (!string.IsNullOrEmpty(Model.Item.GetString("Text"))) 73 { 74 <p class="@subtitleFontSize @subtitleColor @subtitleOpacity lead d-block mb-2"> 75 <span class="@maxWidth">@Model.Item.GetString("Text")</span> 76 </p> 77 } 78 @if (!string.IsNullOrEmpty(Model.Item.GetString("Title"))) 79 { 80 @headingLevelStart 81 @Model.Item.GetString("Title") 82 @headingLevelStop 83 } 84 </div> 85 </div> 86
Error executing template "Designs/Swift/Paragraph/Swift_RelatedProducts.cshtml" System.IO.IOException: There is not enough space on the disk. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.WriteCore(Byte[] buffer, Int32 offset, Int32 count) at System.IO.FileStream.FlushWrite(Boolean calledFromFinalizer) at System.IO.FileStream.Dispose(Boolean disposing) at System.IO.Stream.Close() at System.IO.StreamWriter.Dispose(Boolean disposing) at System.IO.TextWriter.Dispose() at System.IO.File.InternalWriteAllText(String path, String contents, Encoding encoding, Boolean checkHost) at RazorEngine.Roslyn.CSharp.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.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer) at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter) 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.Core 3 @using Dynamicweb.Ecommerce.ProductCatalog 4 5 @{ 6 ProductViewModel product = null; 7 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails")) 8 { 9 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"]; 10 } 11 else if (Pageview.Page.Item["DummyProduct"] != null && Pageview.IsVisualEditorMode) 12 { 13 var pageViewModel = Dynamicweb.Frontend.ContentViewModelFactory.CreatePageInfoViewModel(Pageview.Page); 14 ProductListViewModel productList = pageViewModel.Item.GetValue("DummyProduct") != null ? pageViewModel.Item.GetValue("DummyProduct") as ProductListViewModel : new ProductListViewModel(); 15 16 if (productList?.Products is object) 17 { 18 product = productList.Products[0]; 19 } 20 } 21 22 string title = Model?.Item?.GetRawValueString("Title", Translate("Products")); 23 string campaignValues = string.Join(",", Model.Item.GetList("CampaignBadges")?.GetRawValue().OfType<string>().ToList()); 24 25 //Styling 26 string titleFontSize = Model.Item.GetRawValueString("TitleFontSize", "h3"); 27 string subtitleFontSize = Model.Item.GetRawValueString("SubtitleFontSize", "fs-5"); 28 string buttonStyle = Model.Item.GetRawValueString("ButtonStyle", ""); 29 buttonStyle = buttonStyle == "primary" ? " btn-primary" : buttonStyle; 30 buttonStyle = buttonStyle == "secondary" ? " btn-secondary" : buttonStyle; 31 buttonStyle = buttonStyle == "link" ? " btn-link" : buttonStyle; 32 string maxWidth = Model.Item.GetRawValueString("TextReadability", ""); 33 maxWidth = maxWidth == "max-width-on" ? " mw-75ch" : maxWidth; 34 maxWidth = maxWidth == "max-width-off" ? "" : maxWidth; 35 36 string generalTheme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("GeneralTheme")) ? " theme " + Model.Item.GetRawValueString("GeneralTheme").Replace(" ", "").Trim().ToLower() : ""; 37 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 38 string imageTheme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("ImageTheme")) ? " theme " + Model.Item.GetRawValueString("ImageTheme").Replace(" ", "").Trim().ToLower() : ""; 39 40 //Link generation 41 string pageId = !string.IsNullOrEmpty(Model.Item.GetRawValueString("ProductSliderServicePage")) ? Model.Item.GetLink("ProductSliderServicePage").PageId.ToString() : ""; 42 if (string.IsNullOrEmpty(pageId)) 43 { 44 pageId = GetPageIdByNavigationTag("ProductSliderService").ToString(); 45 } 46 47 string url = "/Default.aspx?ID=" + pageId; 48 if (!url.Contains("LayoutTemplate", StringComparison.OrdinalIgnoreCase)) 49 { 50 url += url.Contains("?") ? "&LayoutTemplate=Designs/Swift/Swift_PageClean.cshtml" : "?LayoutTemplate=Designs/Swift/Swift_PageClean.cshtml"; 51 } 52 if (Pageview.IsVisualEditorMode) 53 { 54 url += "&VisualEdit=True"; 55 } 56 57 bool isLazyLoadingForProductInfoEnabled = Dynamicweb.Core.Converter.ToBoolean(Dynamicweb.Context.Current.Items["IsLazyLoadingForProductInfoEnabled"]); 58 if (isLazyLoadingForProductInfoEnabled) 59 { 60 url += "&getproductinfo=true"; 61 } 62 63 //Source type 64 string sourceType = Model.Item.GetRawValueString("RelationType", "trending"); 65 IList<string> relateFromGroupIds = new List<string> { }; 66 IList<string> relateFromProductVariantIds = new List<string> { }; 67 IList<string> relateFromProductIds = new List<string> { }; 68 bool hasVariants = false; 69 70 //--- VARIANTS --- 71 if (sourceType == "variants" && Model.Item.GetValue<ProductListViewModel>("ProductsToRelateToVariants") is ProductListViewModel productsToRelateToVariants) 72 { 73 foreach (var productSelection in productsToRelateToVariants.Products) 74 { 75 relateFromProductIds.Add(productSelection.Id); 76 } 77 } 78 79 //--- MOST SOLD --- 80 if (sourceType == "most-sold" && Model.Item.GetValue<IList<ProductGroupViewModel>>("GroupsToRelateToMostSold") is IList<ProductGroupViewModel> groupsToRelateToMostSold) 81 { 82 foreach (var fromGroup in groupsToRelateToMostSold) 83 { 84 relateFromGroupIds.Add(fromGroup.Id); 85 } 86 } 87 88 //--- TRENDING --- 89 if (sourceType == "trending" && Model.Item.GetValue<IList<ProductGroupViewModel>>("GroupsToRelateToTrending") is IList<ProductGroupViewModel> groupsToRelateToTrending) 90 { 91 foreach (var fromGroup in groupsToRelateToTrending) 92 { 93 relateFromGroupIds.Add(fromGroup.Id); 94 } 95 } 96 97 //--- LATEST --- 98 if (sourceType == "latest" && Model.Item.GetValue<IList<ProductGroupViewModel>>("GroupsToRelateToLatest") is IList<ProductGroupViewModel> groupsToRelateToLatest) 99 { 100 foreach (var fromGroup in groupsToRelateToLatest) 101 { 102 relateFromGroupIds.Add(fromGroup.Id); 103 } 104 } 105106 //--- FREQUENTLY BOUGHT --- 107 if (sourceType == "frequently" && Model.Item.GetValue<ProductListViewModel>("ProductsToRelateTo") is ProductListViewModel productsToRelateTo) 108 { 109 foreach (var fromProduct in productsToRelateTo.Products) 110 { 111 relateFromProductIds.Add(fromProduct.Id); 112 } 113 } 114115 //--- SELECTED PRODUCTS --- 116 if ((sourceType == "selected" || sourceType == "frequently") && Model.Item.GetValue<ProductListViewModel>("Products") is ProductListViewModel products) 117 { 118 hasVariants = products.Products.Any(p => !string.IsNullOrEmpty(p.VariantId)); 119 foreach (var productSelection in products.Products) 120 { 121 if (hasVariants) 122 { 123 if (!string.IsNullOrEmpty(productSelection.VariantId)) 124 { 125 relateFromProductVariantIds.Add($"{productSelection.Id} {productSelection.VariantId}"); 126 } 127 else 128 { 129 relateFromProductVariantIds.Add($"{productSelection.Id}"); 130 } 131 } 132 relateFromProductIds.Add($"{productSelection.Id}"); 133 } 134 } 135136 //--- RELATED PRODUCTS --- 137 if (sourceType == "related-products" && Model.Item.GetValue<ProductListViewModel>("ProductsToRelateTo2") is ProductListViewModel selectedRelationProduct) 138 { 139 if (selectedRelationProduct.Products.Any()) 140 { 141 product = selectedRelationProduct.Products.FirstOrDefault(); 142 } 143144 if (product?.RelatedGroups != null) 145 { 146 foreach (var group in product.RelatedGroups) 147 { 148 foreach (var relatedProduct in group.Products) 149 { 150 if (!string.IsNullOrEmpty(relatedProduct.VariantId)) 151 { 152 relateFromProductVariantIds.Add($"{relatedProduct.ProductId} {relatedProduct.VariantId}"); 153 } 154 else 155 { 156 relateFromProductVariantIds.Add($"{relatedProduct.ProductId}"); 157 } 158 } 159 } 160 } 161 } 162163 //Create group id collection and products id collection strings 164 string groupIds = product is object ? product.PrimaryOrDefaultGroup.Id : string.Join(",", relateFromGroupIds); 165 string productVariantIds = relateFromProductVariantIds.Count > 0 ? string.Join(",", relateFromProductVariantIds) : ""; 166 string productIds = product is object && relateFromProductIds.Count == 0 ? product.Id : string.Join(",", relateFromProductIds); 167168 //Set the parameters to the url 169 string linkParameters = ""; 170 linkParameters += sourceType != "related-products" && sourceType != "frequently" && sourceType != "selected" ? "&GroupId=" + groupIds : ""; 171 linkParameters += !string.IsNullOrEmpty(productIds) && sourceType != "most-sold" && sourceType != "trending" && sourceType != "latest" && sourceType != "frequently" && sourceType != "related-products" ? "&MainProductId=" + productIds : ""; 172 linkParameters += !string.IsNullOrEmpty(productVariantIds) && sourceType == "related-products" ? "&ProductVariantId=" + productVariantIds : ""; 173 linkParameters += sourceType == "variants" ? "&IsVariant=true" : ""; 174 linkParameters += sourceType == "latest" ? "&SortBy=Created" : ""; 175 linkParameters += sourceType == "most-sold" ? "&SortBy=OrderCount" : ""; 176 linkParameters += sourceType == "trending" ? "&SortBy=OrderCountGrowth" : ""; 177 linkParameters += !string.IsNullOrEmpty(productIds) && sourceType == "frequently" ? $"&BoughtWithProductIds=[{productIds}]" : ""; 178 var productListPageId = GetPageIdByNavigationTag("Shop"); 179 string link = "/Default.aspx?ID=" + productListPageId + linkParameters; 180181 // Slider settings (documentation: swiffyslider.com/configuration) 182 string navigationStyle = $"{Model.Item.GetRawValueString("NavigationStyle", "slider-nav-round")}"; 183 string navigationPlacement = $"{Model.Item.GetRawValueString("NavigationPlacement", "slider-nav-on-slides")}"; 184 string indicatorStyle = $"{Model.Item.GetRawValueString("IndicatorStyle", "slider-indicators-hidden")}"; 185 string revealSlides = Model.Item.GetRawValueString("RevealSlides", "no-reveal") == "reveal" ? "slider-item-reveal" : string.Empty; 186 string navigationAlwaysVisible = (Model.Item.GetBoolean("NavigationAlwaysVisible")) ? "slider-nav-visible" : string.Empty; 187 string navigationVisibleOnTouch = (Model.Item.GetBoolean("NavigationVisibleOnTouch")) ? "slider-nav-touch" : string.Empty; 188 string navigationShowScrollbar = (Model.Item.GetBoolean("NavigationShowScrollbar")) ? "slider-nav-scrollbar" : string.Empty; 189 string navigationSmall = (Model.Item.GetBoolean("NavigationSmall")) ? "slider-nav-sm" : string.Empty; 190 string navigationInvertColors = (Model.Item.GetBoolean("NavigationInvertColors")) ? "slider-nav-dark" : string.Empty; 191 string navigationSlideEntirePage = (Model.Item.GetBoolean("NavigationSlideEntirePage")) ? "slider-nav-page" : string.Empty; 192 string navigationNoLoop = (Model.Item.GetBoolean("NavigationNoLoop")) ? "slider-nav-noloop" : string.Empty; 193 string indicatorsOutsideSlider = (Model.Item.GetBoolean("IndicatorsOutsideSlider") && indicatorStyle != string.Empty) ? "slider-indicators-outside" : string.Empty; 194 string indicatorsHighlightActive = (Model.Item.GetBoolean("IndicatorsHighlightActive")) ? "slider-indicators-highlight" : string.Empty; 195 string indicatorsInvertColors = (Model.Item.GetBoolean("IndicatorsInvertedColors")) ? "slider-indicators-dark" : string.Empty; 196 string indicatorsVisibleOnSmallDevices = (Model.Item.GetBoolean("IndicatorsVisibleOnSmallDevices")) ? "slider-indicators-sm" : string.Empty; 197198 bool productsFound = true; 199 if (string.IsNullOrEmpty(groupIds) && string.IsNullOrEmpty(productIds) && string.IsNullOrEmpty(productVariantIds)) 200 { 201 if (Pageview.IsVisualEditorMode) 202 { 203 productIds = product.Id; 204 sourceType = "selected"; 205 } 206 else 207 { 208 productsFound = false; 209 } 210 } 211 } 212213 @*Container element for the request*@ 214 @if (productsFound) 215 { 216 <form method="post" action="@url" id="RelatedProductsForm_@Model.ID" data-response-target-element="RelatedProducts_@Model.ID" data-preloader="inline" data-update-url="false" class="item_@Model.Item.SystemName.ToLower()"> 217 <input type="hidden" name="ModelID" value="@Model.ID"> 218 <input type="hidden" name="SourceType" value="@sourceType"> 219220 @*--- SLIDER SETTINGS ---*@ 221 <input type="hidden" name="NavigationStyle" value="@navigationStyle"> 222 <input type="hidden" name="NavigationPlacement" value="@navigationPlacement"> 223 <input type="hidden" name="IndicatorStyle" value="@indicatorStyle"> 224 <input type="hidden" name="RevealSlides" value="@revealSlides"> 225 <input type="hidden" name="NavigationAlwaysVisible" value="@(navigationAlwaysVisible)"> 226 <input type="hidden" name="NavigationVisibleOnTouch" value="@(navigationVisibleOnTouch)"> 227 <input type="hidden" name="NavigationShowScrollbar" value="@(navigationShowScrollbar)"> 228 <input type="hidden" name="NavigationSmall" value="@(navigationSmall)"> 229 <input type="hidden" name="NavigationInvertColors" value="@(navigationInvertColors)"> 230 <input type="hidden" name="NavigationNoLoop" value="@(navigationNoLoop)"> 231 <input type="hidden" name="NavigationSlideEntirePage" value="@(navigationSlideEntirePage)"> 232 <input type="hidden" name="IndicatorsOutsideSlider" value="@(indicatorsOutsideSlider)"> 233 <input type="hidden" name="IndicatorsHighlightActive" value="@(indicatorsHighlightActive)"> 234 <input type="hidden" name="IndicatorsInvertColors" value="@(indicatorsInvertColors)"> 235 <input type="hidden" name="IndicatorsVisibleOnSmallDevices" value="@(indicatorsVisibleOnSmallDevices)"> 236237 @*--- VARIANTS ---*@ 238 @if (sourceType == "variants") 239 { 240 <input type="hidden" name="isVariant" value="true"> 241 <input type="hidden" name="MainProductID" id="MainProductID_@Model.ID" value="@productIds"> 242 } 243244 @*--- MOST SOLD ---*@ 245 @if (sourceType == "most-sold") 246 { 247 <input type="hidden" name="SortBy" value="OrderCount"> 248 if (groupIds != "") 249 { 250 <input type="hidden" name="GroupId" value="@groupIds"> 251 } 252 } 253254 @*--- TRENDING ---*@ 255 @if (sourceType == "trending") 256 { 257 <input type="hidden" name="SortBy" value="OrderCountGrowth"> 258 if (groupIds != "") 259 { 260 <input type="hidden" name="GroupId" value="@groupIds"> 261 } 262 } 263264 @*--- FREQUENTLY BOUGHT ---*@ 265 @if (sourceType == "frequently" && !string.IsNullOrEmpty(productIds)) 266 { 267 <input type="hidden" name="BoughtWithProductIds" value="[@productIds]"> 268 } 269 @if (sourceType != "frequently" && hasVariants) 270 { 271 <input type="hidden" name="ProductVariantId" value="@productVariantIds"> 272 } 273274 @*--- LATEST ---*@ 275 @if (sourceType == "latest") 276 { 277 <input type="hidden" name="SortBy" value="Created"> 278 <input type="hidden" name="GroupId" value="@groupIds"> 279 } 280281 @*--- SELECTED PRODUCTS ---*@ 282 @if (sourceType == "selected" && !string.IsNullOrEmpty(productIds) && !hasVariants) 283 { 284 <input type="hidden" name="MainProductId" id="MainProductID_@Model.ID" value="@productIds"> 285 } 286 @if (sourceType == "selected" && hasVariants) 287 { 288 <input type="hidden" name="ProductVariantId" value="@productVariantIds"> 289 } 290291 @*--- RELATED PRODUCTS ---*@ 292 @if (sourceType == "related-products") 293 { 294 <input type="hidden" name="ProductVariantId" id="MainProductID_@Model.ID" value="@productVariantIds"> 295 } 296297 @* General parameters *@ 298 <input type="hidden" name="Link" value="@link"> 299 <input type="hidden" name="HideTitle" value="@Model.Item.GetString("HideTitle")"> 300301 @if (Model.Item.GetInt32("ProductsCount") != 0) 302 { 303 <input type="hidden" name="PageSize" value="@Model.Item.GetInt32("ProductsCount")"> 304 } 305 <input type="hidden" name="HeadingTitle" id="RelatedProductsTitle_@Model.ID" value="@title"> 306 @if (!string.IsNullOrEmpty(Model.Item.GetString("Subtitle"))) 307 { 308 <input type="hidden" name="Subtitle" value="@Model.Item.GetString("Subtitle")"> 309 } 310 @if (!string.IsNullOrEmpty(Model.Item.GetString("LinkText"))) 311 { 312 <input type="hidden" name="LinkText" value="@Model.Item.GetString("LinkText")"> 313 } 314 @if (!string.IsNullOrEmpty(Model.Item.GetString("ImageAspectRatio"))) 315 { 316 string ratio = Model.Item.GetRawValueString("ImageAspectRatio", ""); 317 ratio = ratio != "0" ? ratio : ""; 318 <input type="hidden" name="ImageAspectRatio" value="@ratio"> 319 } 320 @if (!string.IsNullOrEmpty(Model.Item.GetString("Layout"))) 321 { 322 <input type="hidden" name="Layout" value="@Model.Item.GetRawValueString("Layout")"> 323 } 324 @if (titleFontSize != "") 325 { 326 <input type="hidden" name="TitleFontSize" value="@titleFontSize"> 327 } 328 @if (subtitleFontSize != "") 329 { 330 <input type="hidden" name="SubtitleFontSize" value="@subtitleFontSize"> 331 } 332 @if (buttonStyle != "") 333 { 334 <input type="hidden" name="ButtonStyle" value="@buttonStyle"> 335 } 336 @if (generalTheme != "") 337 { 338 <input type="hidden" name="GeneralTheme" value="@generalTheme"> 339 } 340 @if (theme != "") 341 { 342 <input type="hidden" name="Theme" value="@theme"> 343 } 344 @if (imageTheme != "") 345 { 346 <input type="hidden" name="ImageTheme" value="@imageTheme"> 347 } 348 @if (!string.IsNullOrEmpty(Model.Item.GetString("ContentPadding"))) 349 { 350 string contentPadding = Model.Item.GetRawValueString("ContentPadding"); 351 <input type="hidden" name="ContentPadding" value="@contentPadding"> 352 } 353 <input type="hidden" name="TextReadability" value="@maxWidth"> 354 <input type="hidden" name="ParentColumnSize" id="ParentColumnSize_@Model.ID" value="12"> 355356 <input type="hidden" name="SaleBadgeType" value="@Model.Item.GetRawValue("SaleBadgeType")"> 357 <input type="hidden" name="SaleBadgeCssClassName" value="@Model.Item.GetRawValue("SaleBadgeDesign")"> 358 <input type="hidden" name="NewBadgeCssClassName" value="@Model.Item.GetRawValue("NewBadgeDesign")"> 359 <input type="hidden" name="NewPublicationDays" value="@Model.Item.GetInt32("NewPublicationDays")"> 360361 @if (campaignValues != string.Empty) 362 { 363 <input type="hidden" name="CampaignBadgesValues" value="@campaignValues"> 364 } 365 </form> 366367 <script type="module" src="/Files/Templates/Designs/Swift/Assets/js/swiffy-slider.js"></script> 368 <script> 369 window.addEventListener("load", () => { 370 swift.AssetLoader.Load('/Files/Templates/Designs/Swift/Assets/css/swiffy-slider.min.css', 'css'); 371 }); 372 </script> 373374 if (Pageview.IsVisualEditorMode) 375 { 376 <div class="alert alert-info" role="alert"> 377 <span>@Translate("Product slider: Edit this column to configure")</span> 378 </div> 379 } 380381 if (sourceType != "related-products") 382 { 383 <div class="w-100 h-100"> 384 <div id="@Model.ID" class="user-select-none" style="scroll-margin-top:var(--header-height,150px)"></div> 385 <div id="RelatedProducts_@Model.ID" class="h-100 swift_product_slider_container"></div> 386 </div> 387 } 388 else if (product?.RelatedGroups != null) 389 { 390 @* Create multiple slider containers, if type is Product relation *@ 391 <div class="grid w-100 h-100@(generalTheme)" style="grid-row-gap: 4rem"> 392 <div id="@Model.ID" class="user-select-none" style="scroll-margin-top:var(--header-height,150px)"></div> 393 @foreach (var group in product.RelatedGroups) 394 { 395 <div id="RelatedProducts_@(Model.ID)_@group.Id" class="g-col-12 h-100 swift_product_slider_container"></div> 396 } 397 </div> 398 } 399400 @* Initialize *@ 401 if (sourceType != "related-products") 402 { 403 <script type="module"> 404 if (document.querySelector("#RelatedProducts_@Model.ID").closest("[data-col-size]")) { 405 document.querySelector("#ParentColumnSize_@Model.ID").value = document.querySelector("#RelatedProducts_@Model.ID").closest("[data-col-size]").getAttribute("data-col-size"); 406 } 407 swift.PageUpdater.Update(document.querySelector("#RelatedProductsForm_@Model.ID")).then(function () { 408 setTimeout(function() { 409 const isVisualEditor = @(Converter.ToString(Pageview.IsVisualEditorMode).ToLowerInvariant()); 410 const productSliderContainer = document.querySelector(".swift_product_slider_container"); 411412 if (productSliderContainer && productSliderContainer.innerHTML !== "") { 413 productSliderContainer.classList.remove("d-none"); 414 } 415 else if (!isVisualEditor) { 416 productSliderContainer.closest("[class*=column]").classList.add("d-none"); 417 } 418 }, 150); 419 }); 420 </script> 421 } 422 else if (product?.RelatedGroups != null) 423 { 424 @* Create multiple sliders, if type is Product relation *@ 425 foreach (var group in product.RelatedGroups) 426 { 427 IList<string> fromProductIds = new List<string> { }; 428429 foreach (var relatedProduct in group.Products) 430 { 431 if (!string.IsNullOrEmpty(relatedProduct.VariantId)) 432 { 433 fromProductIds.Add($"{relatedProduct.ProductId} {relatedProduct.VariantId}"); 434 } 435 else 436 { 437 fromProductIds.Add($"{relatedProduct.ProductId}"); 438 } 439 } 440 <script type="module"> 441 document.querySelector("#ParentColumnSize_@Model.ID").value = document.querySelector("#RelatedProducts_@(Model.ID)_@group.Id").closest("[data-col-size]").getAttribute("data-col-size"); 442 document.querySelector("#MainProductID_@Model.ID").value = "@string.Join(",", fromProductIds)"; 443 document.querySelector("#RelatedProductsTitle_@Model.ID").value = "@group.Name"; 444 document.querySelector("#RelatedProductsForm_@Model.ID").setAttribute("data-response-target-element", "RelatedProducts_@(Model.ID)_@group.Id"); 445446 swift.PageUpdater.Update(document.querySelector("#RelatedProductsForm_@Model.ID")); 447 </script> 448 } 449 } 450 } 451
Error executing template "Designs/Swift/Paragraph/Swift_SectionHeader.cshtml" System.IO.IOException: There is not enough space on the disk. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.WriteCore(Byte[] buffer, Int32 offset, Int32 count) at System.IO.FileStream.FlushWrite(Boolean calledFromFinalizer) at System.IO.FileStream.Dispose(Boolean disposing) at System.IO.Stream.Close() at System.IO.StreamWriter.Dispose(Boolean disposing) at System.IO.TextWriter.Dispose() at System.IO.File.InternalWriteAllText(String path, String contents, Encoding encoding, Boolean checkHost) at RazorEngine.Roslyn.CSharp.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.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer) at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter) 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 layout = Model.Item.GetRawValueString("Layout", "text-start"); 38 39 string layoutClasses = layout == "text-start" ? "" : ""; 40 layoutClasses = layout == "text-center" ? " align-items-center text-center" : layoutClasses; 41 layoutClasses = layout == "text-end" ? " align-items-end text-end" : layoutClasses; 42 layoutClasses = layout == "alignLeftMiddle" ? " justify-content-center" : layoutClasses; 43 layoutClasses = layout == "alignCenterMiddle" ? " align-items-center justify-content-center text-center" : layoutClasses; 44 45 string contentPadding = Model.Item.GetRawValueString("ContentPadding", ""); 46 contentPadding = contentPadding == "none" ? "p-0" : contentPadding; 47 contentPadding = contentPadding == "small" ? "p-2 p-md-3" : contentPadding; 48 contentPadding = contentPadding == "large" ? "p-4 p-md-5" : contentPadding; 49 50 string maxWidth = Model.Item.GetRawValueString("TextReadability", "max-width-on"); 51 maxWidth = maxWidth == "max-width-on" ? " mw-75ch d-inline-block" : ""; 52 53 string titleColor = Model.Item.GetString("TitleColor", "text-inherit"); 54 string titleOpacity = Model.Item.GetString("TitleOpacity", "opacity-100"); 55 string titleFontSize = Model.Item.GetRawValueString("TitleFontSize", "display-4"); 56 string headingLevel = Model.Item.GetString("HeadingLevel", "h2"); 57 string headingLevelStart = $"<{headingLevel} class=\"{titleFontSize} {titleColor} {titleOpacity}{maxWidth} m-0\">"; 58 string headingLevelStop = $"</{headingLevel}>"; 59 60 string subtitleFontSize = Model.Item.GetRawValueString("SubtitleFontSize", "fs-5"); 61 string subtitleColor = Model.Item.GetString("SubtitleColor", "text-inherit"); 62 string subtitleOpacity = Model.Item.GetString("SubtitleOpacity", "opacity-100"); 63 64 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? " theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; 65 var decorations = Model.Item?.GetList("CssDecorations")?.GetRawValue().OfType<string>() ?? Enumerable.Empty<string>(); 66 string css = RenderCustomCSS(decorations); 67 } 68 69 <div class="h-100 @(contentPadding)@(theme) @(css) item_@Model.Item.SystemName.ToLower()"> 70 <div id="@Model.ID" class="user-select-none" style="scroll-margin-top:var(--header-height,150px)"></div> 71 <div class="d-flex flex-column h-100@(layoutClasses)"> 72 @if (!string.IsNullOrEmpty(Model.Item.GetString("Text"))) 73 { 74 <p class="@subtitleFontSize @subtitleColor @subtitleOpacity lead d-block mb-2"> 75 <span class="@maxWidth">@Model.Item.GetString("Text")</span> 76 </p> 77 } 78 @if (!string.IsNullOrEmpty(Model.Item.GetString("Title"))) 79 { 80 @headingLevelStart 81 @Model.Item.GetString("Title") 82 @headingLevelStop 83 } 84 </div> 85 </div> 86
Error executing template "Designs/Swift/Paragraph/Swift_Slider.cshtml" System.IO.IOException: There is not enough space on the disk. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.WriteCore(Byte[] buffer, Int32 offset, Int32 count) at System.IO.FileStream.FlushWrite(Boolean calledFromFinalizer) at System.IO.FileStream.Dispose(Boolean disposing) at System.IO.Stream.Close() at System.IO.StreamWriter.Dispose(Boolean disposing) at System.IO.TextWriter.Dispose() at System.IO.File.InternalWriteAllText(String path, String contents, Encoding encoding, Boolean checkHost) at RazorEngine.Roslyn.CSharp.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.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer) at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter) 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 5 @functions { 6 7 private Dynamicweb.Frontend.LinkViewModel GetLink(ItemViewModel item) 8 { 9 string linkType = item.GetRawValueString("LinkType", "page"); 10 11 if (linkType == "page" && item.GetLink("ButtonLink") is LinkViewModel buttonLink) 12 { 13 return buttonLink; 14 } 15 else if (linkType == "product-group") 16 { 17 IList<ProductGroupViewModel> selectedGroups = item.GetValue<IList<ProductGroupViewModel>>("ProductGroupLink"); 18 IList<string> groupIds = new List<string> { }; 19 20 if (selectedGroups != null) 21 { 22 foreach (var fromGroup in selectedGroups) 23 { 24 groupIds.Add(fromGroup.Id); 25 } 26 } 27 28 return new Dynamicweb.Frontend.LinkViewModel() 29 { 30 Url = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Shop") + "&GroupID=" + string.Join(",", groupIds).Trim(), 31 IsExternal = false 32 }; 33 } 34 else if (linkType == "product") 35 { 36 ProductListViewModel products = item.GetValue<ProductListViewModel>("ProductLink"); 37 IList<string> productIds = new List<string> { }; 38 39 if (products != null && products.Products.Any()) 40 { 41 foreach (var product in products.Products) 42 { 43 productIds.Add(product.Id); 44 } 45 string productLink; 46 if (productIds.Count != 1) 47 { 48 productLink = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Shop") + "&MainProductId=" + string.Join(",", productIds).Trim(); 49 } 50 else 51 { 52 productLink = products.Products?.FirstOrDefault()?.GetProductLink(GetPageIdByNavigationTag("Shop"), false); 53 } 54 55 return new Dynamicweb.Frontend.LinkViewModel() 56 { 57 Url = productLink, 58 IsExternal = false 59 }; 60 } 61 } 62 63 return new Dynamicweb.Frontend.LinkViewModel(); 64 } 65 66 private string RenderButton(ItemViewModel item, string buttonSize) 67 { 68 var link = GetLink(item); 69 string stretchedLink = item.GetRawValueString("StretchedLink", string.Empty); 70 stretchedLink = stretchedLink == "not-clickable" ? string.Empty : stretchedLink; 71 stretchedLink = stretchedLink == "clickable" ? "stretched-link" : stretchedLink; 72 73 if (link != null && !string.IsNullOrEmpty(item.GetString("ButtonLabel"))) 74 { 75 string target = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && link.IsExternal ? "target=\"_blank\"" : ""; 76 string rel = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && link.IsExternal ? "rel=\"noopener\"" : ""; 77 78 string buttonStyle = item.GetRawValueString("ButtonStyle", "primary"); 79 buttonStyle = buttonStyle == "primary" ? "btn-primary" : buttonStyle; 80 buttonStyle = buttonStyle == "secondary" ? "btn-secondary" : buttonStyle; 81 buttonStyle = buttonStyle == "link" ? "btn-link" : buttonStyle; 82 83 return $"<div class=\"m-0\"><a href=\"{link.Url}\" class=\"btn {buttonStyle}{buttonSize} {stretchedLink}\" {target} {rel}>{item.GetString("ButtonLabel")}</a></div>"; 84 } 85 else if (link != null && !string.IsNullOrEmpty(link.Url)) 86 { 87 string target = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && link.IsExternal ? "target=\"_blank\"" : ""; 88 string rel = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && link.IsExternal ? "rel=\"noopener\"" : ""; 89 90 return $"<a href=\"{link.Url}\" class=\"{stretchedLink}\" {target} {rel}><span class=\"visually-hidden\">{item.GetString("Title")}</span></a>"; 91 } 92 93 return string.Empty; 94 } 95 96 private string RenderCustomCSS(IEnumerable<string> decorations) 97 { 98 var cssClasses = new List<string>(); 99100 foreach (var itemId in decorations) 101 { 102 var item = Dynamicweb.Content.Services.Items.GetItem("Swift_Css", itemId); 103 item.TryGetValue("Class", out object classes); 104105 if (classes is null) 106 { 107 continue; 108 } 109110 var cssString = (string)classes; 111112 if (cssString.StartsWith("[")) 113 { 114 var cssArray = Dynamicweb.Core.Converter.Deserialize<string[]>(cssString); 115 cssClasses.AddRange(cssArray); 116 } 117 else 118 { 119 cssClasses.Add(cssString.Replace(",", " ")); 120 } 121 } 122123 return string.Join(" ", cssClasses).Trim(); 124 } 125 } 126127 @{ 128 bool movePageBehind = false; 129 bool isFirstPoster = false; 130 string movePageBehindClass = string.Empty; 131 if (Pageview.Page.PropertyItem != null) 132 { 133 string headerCssClass = Pageview.Page.PropertyItem["MoveThisPageBehindTheHeader"] != null ? Pageview.Page.PropertyItem["MoveThisPageBehindTheHeader"].ToString() : "sticky-top"; 134 movePageBehind = headerCssClass == "fixed-top" && !Pageview.IsVisualEditorMode ? true : false; 135 if (movePageBehind) 136 { 137 movePageBehindClass = " poster-behind"; 138 if (!Dynamicweb.Context.Current.Items.Contains("firstPosterIsRendered")) 139 { 140 isFirstPoster = true; 141 Dynamicweb.Context.Current.Items.Add("firstPosterIsRendered", true); 142 } 143 } 144 } 145146 string title = Model.Item.GetString("Title"); 147 var sliderItems = Model.Item?.GetItems("Slider_Items") ?? Enumerable.Empty<Dynamicweb.Frontend.ItemViewModel>().ToList(); 148149 // Style 150 string buttonSize = Model.Item.GetRawValueString("buttonSize", "regular"); 151 buttonSize = buttonSize == "small" ? " btn-sm" : buttonSize; 152 buttonSize = buttonSize == "regular" ? "" : buttonSize; 153 buttonSize = buttonSize == "large" ? " btn-lg" : buttonSize; 154 string contentPadding = Model.Item.GetRawValueString("ContentPadding", string.Empty); 155 switch (contentPadding) 156 { 157 case "small": 158 contentPadding = " p-3"; 159 break; 160 case "large": 161 contentPadding = " p-4"; 162 break; 163 } 164 string titleFontSize = Model.Item.GetRawValueString("TitleFontSize", "display-1"); 165 string subtitleFontSize = Model.Item.GetRawValueString("SubtitleFontSize", "fs-5"); 166 string theme = !string.IsNullOrWhiteSpace(Model.Item.GetRawValueString("Theme")) ? "theme " + Model.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : string.Empty; 167 var decorations = Model.Item?.GetList("CssDecorations")?.GetRawValue().OfType<string>() ?? Enumerable.Empty<string>(); 168 string css = RenderCustomCSS(decorations); 169170 // Navgation 171 string slidesPerPage = $"slider-item-show{Model.Item.GetRawValueString("SlidesPerPage", "1")}"; 172 string sliderRatio = Model.Item.GetRawValueString("SliderRatio", "original") != "original" ? $"slider-item-ratio {Model.Item.GetRawValueString("SliderRatio", string.Empty)}" : string.Empty; 173 string navigationStyle = $"{Model.Item.GetRawValueString("NavigationStyle", "slider-nav-round")}"; 174 string navigationPlacement = $"{Model.Item.GetRawValueString("NavigationPlacement", "slider-nav-on-slides")}"; 175 string indicatorStyle = $"{Model.Item.GetRawValueString("IndicatorStyle", string.Empty)}"; 176 string revealSlides = Model.Item.GetRawValueString("RevealSlides", "no-reveal") == "reveal" ? "slider-item-reveal" : string.Empty; 177 string sliderItemsGap = Model.Item.GetRawValueString("SliderItemsGap", "slider-item-gap") == "slider-item-nogap" ? "slider-item-nogap" : string.Empty; 178 string navigationAlwaysVisible = (Model.Item.GetBoolean("NavigationAlwaysVisible")) ? "slider-nav-visible" : string.Empty; 179 string navigationVisibleOnTouch = (Model.Item.GetBoolean("NavigationVisibleOnTouch")) ? "slider-nav-touch" : string.Empty; 180 string navigationShowScrollbar = (Model.Item.GetBoolean("NavigationShowScrollbar")) ? "slider-nav-scrollbar" : string.Empty; 181 string scrollBarForceMobile = (Model.Item.GetBoolean("NavigationShowScrollbar")) ? "--swiffy-slider-track-height:0.5rem !important;" : string.Empty; 182 string navigationSmall = (Model.Item.GetBoolean("NavigationSmall")) ? "slider-nav-sm" : string.Empty; 183 string navigationInvertColors = (Model.Item.GetBoolean("NavigationInvertColors")) ? "slider-nav-dark" : string.Empty; 184 string navigationSlideEntirePage = (Model.Item.GetBoolean("NavigationSlideEntirePage")) ? "slider-nav-page" : string.Empty; 185 string navigationNoLoop = (Model.Item.GetBoolean("NavigationNoLoop")) ? "slider-nav-noloop" : string.Empty; 186 string indicatorsOutsideSlider = (Model.Item.GetBoolean("IndicatorsOutsideSlider") && indicatorStyle != string.Empty) ? "slider-indicators-outside" : string.Empty; 187 string indicatorsHighlightActive = (Model.Item.GetBoolean("IndicatorsHighlightActive")) ? "slider-indicators-highlight" : string.Empty; 188 string indicatorsInvertColors = (Model.Item.GetBoolean("IndicatorsInvertedColors")) ? "slider-indicators-dark" : string.Empty; 189 string indicatorsVisibleOnSmallDevices = (Model.Item.GetBoolean("IndicatorsVisibleOnSmallDevices")) ? "slider-indicators-sm" : string.Empty; 190 string animation = Model.Item.GetRawValueString("Animation", string.Empty) != string.Empty ? $"slider-nav-animation {Model.Item.GetRawValueString("Animation")}" : string.Empty; 191 string autoplay = (Model.Item.GetBoolean("Autoplay")) ? "slider-nav-autoplay" : string.Empty; 192 string autoplayInterval = Model.Item.GetRawValueString("AutoplayInterval", string.Empty); 193 bool hideSliderNavigation = false; 194195 var parms = new Dictionary<string, object>(); 196 parms.Add("cssClass", "h-100 w-100"); 197 parms.Add("columns", Model.GridRowColumnCount); 198199 if (navigationStyle == "slider-nav-none") 200 { 201 hideSliderNavigation = true; 202 } 203 } 204 <div class="h-100 grid gap-0"> 205 <div class="g-col-12 @(css) item_@(Model.Item.SystemName.ToLower())"> 206 <div id="@Model.ID" class="user-select-none" style="scroll-margin-top:var(--header-height,150px)"></div> 207 <div id="Slider_@Model.ID" class="swiffy-slider @(sliderRatio) @(slidesPerPage) @(navigationStyle) @(revealSlides) @(navigationPlacement) @(navigationAlwaysVisible) @(navigationVisibleOnTouch) @(sliderItemsGap) @(indicatorStyle) @(navigationShowScrollbar) @(navigationSmall) @(navigationInvertColors) @(indicatorsOutsideSlider) @(navigationNoLoop) @(indicatorsHighlightActive) @(indicatorsInvertColors) @(indicatorsVisibleOnSmallDevices) @(navigationSlideEntirePage) @(animation) @(autoplay) @(theme)@(contentPadding)" style="--swiffy-slider-nav-light:var(--swift-foreground-color);--swiffy-slider-nav-dark:var(--swift-background-color);visibility:hidden;opacity:0;@(scrollBarForceMobile)" data-slider-nav-autoplay-interval="@(autoplayInterval)"> 208 <ul class="slider-container"> 209 @{ 210 bool isFirst = true; 211 parms.Add("alt", string.Empty); 212 } 213214 @foreach (var item in sliderItems) 215 { 216 isFirst = false; 217218 string itemLayout = item.GetRawValueString("ItemLayout", "poster"); 219 string layout = item.GetRawValueString("Layout", "align-middle-center-text-center"); 220 string containerWidth = "container-xl"; 221 FileViewModel image = item.GetFile("Image"); 222 int xPos = image?.FocalPositionFromLeft ?? 50; 223 int yPos = image?.FocalPositionFromTop ?? 50; 224 string active = isFirst ? "active" : ""; 225 string alignment = string.Empty; 226 string maxWidth = item.GetRawValueString("TextReadability", "max-width-on"); 227 maxWidth = maxWidth == "max-width-on" ? "style=\"grid-template-columns: minmax(auto,75ch);\"" : maxWidth; 228 maxWidth = maxWidth == "max-width-off" ? string.Empty : maxWidth; 229 string titleColor = item.GetString("TitleColor", "text-inherit"); 230 string titleOpacity = item.GetString("TitleOpacity", "opacity-100"); 231 string subtitleColor = item.GetString("SubtitleColor", "text-inherit"); 232 string subtitleOpacity = item.GetString("SubtitleOpacity", "opacity-100"); 233 string textColor = item.GetString("TextColor", "text-inherit"); 234 string textOpacity = item.GetString("TextOpacity", "opacity-100"); 235 theme = !string.IsNullOrWhiteSpace(item.GetRawValueString("Theme")) && item.GetRawValueString("Theme") != "none" ? " theme " + item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : theme; 236 parms["alt"] = !string.IsNullOrEmpty(item.GetString("ImageAlt")) ? item.GetString("ImageAlt") : item.GetString("Title", string.Empty); 237238 switch (layout) 239 { 240 case "align-top-left-text-left": 241 alignment = "text-start justify-content-start align-items-start"; 242 break; 243 case "align-top-center-text-center": 244 alignment = "text-center justify-content-center align-items-start"; 245 break; 246 case "align-top-right-text-right": 247 alignment = "text-end justify-content-end align-items-start"; 248 break; 249 case "align-middle-left-text-left": 250 alignment = "text-start justify-content-start align-items-center"; 251 break; 252 case "align-middle-center-text-center": 253 alignment = "text-center justify-content-center align-items-center"; 254 break; 255 case "align-middle-right-text-right": 256 alignment = "text-end justify-content-end align-items-center"; 257 break; 258 case "align-bottom-left-text-left": 259 alignment = "text-start justify-content-start align-items-end"; 260 break; 261 case "align-bottom-center-text-center": 262 alignment = "text-center justify-content-center align-items-end"; 263 break; 264 case "align-bottom-right-text-right": 265 alignment = "text-end justify-content-end align-items-end"; 266 break; 267 } 268269 switch (itemLayout) 270 { 271 case "poster": 272273 <li class="@(theme)"> 274 @RenderPartial("Components/Image.cshtml", image ?? new Dynamicweb.Frontend.FileViewModel(), parms) 275276 @{string position = image is object ? "position-absolute top-0 bottom-0 start-0 end-0 " : string.Empty;} 277278 <div class="@(position)h-100 grid grid-1 p-3 px-xl-3 py-xl-4 @(containerWidth) @(alignment)" @(maxWidth)> 279 <div class="grid grid-1 gap-3"> 280 @if (!string.IsNullOrEmpty(item.GetString("Title")) && !item.GetBoolean("HideTitle")) 281 { 282 <h2 class="@titleFontSize @titleColor @titleOpacity m-0">@item.GetString("Title")</h2> 283 } 284 @if (!string.IsNullOrEmpty(item.GetString("Subtitle"))) 285 { 286 <p class="@subtitleFontSize @subtitleColor @subtitleOpacity lead m-0">@item.GetString("Subtitle")</p> 287 } 288 @if (!string.IsNullOrEmpty(item.GetString("Text"))) 289 { 290 <div class="mb-0-last-child @textColor @textOpacity">@item.GetString("Text")</div> 291 } 292 @RenderButton(item, buttonSize) 293 </div> 294 </div> 295 </li> 296297 break; 298299 case "story-image-left": 300301 <li class="@(theme)"> 302 <div class="row g-0 h-100"> 303 <div class="col-12 col-lg-6 col-xl-7 mh-100"> 304 <div class="overflow-hidden h-100 w-100"> 305 @RenderPartial("Components/Image.cshtml", image ?? new Dynamicweb.Frontend.FileViewModel(), parms) 306 </div> 307 </div> 308 <div class="col-12 col-lg-6 col-xl-5 mh-100 grid grid-1 p-3 px-xl-3 py-xl-4 @(containerWidth) @(alignment)" @(maxWidth)> 309 <div class="grid grid-1 gap-3"> 310 @if (!string.IsNullOrEmpty(item.GetString("Subtitle"))) 311 { 312 <p class="@subtitleFontSize @subtitleColor @subtitleOpacity lead m-0">@item.GetString("Subtitle")</p> 313 } 314 @if (!string.IsNullOrEmpty(item.GetString("Title")) && !item.GetBoolean("HideTitle")) 315 { 316 <h2 class="@titleFontSize @titleColor @titleOpacity m-0">@item.GetString("Title")</h2> 317 } 318 @if (!string.IsNullOrEmpty(item.GetString("Text"))) 319 { 320 <div class="mb-0-last-child @textColor @textOpacity">@item.GetString("Text")</div> 321 } 322 @RenderButton(item, buttonSize) 323 </div> 324 </div> 325 </div> 326 </li> 327328 break; 329330 case "story-image-right": 331332 <li class="@(theme)"> 333 <div class="row g-0 h-100"> 334 <div class="col-12 col-lg-6 col-xl-5 mh-100 grid grid-1 p-3 px-xl-3 py-xl-4 @(containerWidth) @(alignment)" @(maxWidth)> 335 <div class="grid grid-1 gap-3"> 336337 @if (!string.IsNullOrEmpty(item.GetString("Subtitle"))) 338 { 339 <p class="@subtitleFontSize @subtitleColor @subtitleOpacity lead m-0">@item.GetString("Subtitle")</p> 340 } 341 @if (!string.IsNullOrEmpty(item.GetString("Title")) && !item.GetBoolean("HideTitle")) 342 { 343 <h2 class="@titleFontSize @titleColor @titleOpacity m-0">@item.GetString("Title")</h2> 344 } 345 @if (!string.IsNullOrEmpty(item.GetString("Text"))) 346 { 347 <div class="mb-0-last-child @textColor @textOpacity">@item.GetString("Text")</div> 348 } 349 @RenderButton(item, buttonSize) 350 </div> 351 </div> 352 <div class="col-12 col-lg-6 col-xl-7 mh-100"> 353 @RenderPartial("Components/Image.cshtml", image ?? new Dynamicweb.Frontend.FileViewModel(), parms) 354 </div> 355 </div> 356 </li> 357358 break; 359360 case "story-image-top": 361362 <li class="@(theme)"> 363 <div class="row g-0 h-100"> 364 <div class="col-12 mh-100"> 365 <div class="overflow-hidden h-100 w-100"> 366 @RenderPartial("Components/Image.cshtml", image ?? new Dynamicweb.Frontend.FileViewModel(), parms) 367 </div> 368 </div> 369 <div class="col-12 mh-100 grid grid-1 p-3 px-xl-3 py-xl-4 @(containerWidth) @(alignment)" @(maxWidth)> 370 <div class="grid grid-1 gap-3"> 371 @if (!string.IsNullOrEmpty(item.GetString("Subtitle"))) 372 { 373 <p class="@subtitleFontSize @subtitleColor @subtitleOpacity lead m-0">@item.GetString("Subtitle")</p> 374 } 375 @if (!string.IsNullOrEmpty(item.GetString("Title")) && !item.GetBoolean("HideTitle")) 376 { 377 <h2 class="@titleFontSize @titleColor @titleOpacity m-0">@item.GetString("Title")</h2> 378 } 379 @if (!string.IsNullOrEmpty(item.GetString("Text"))) 380 { 381 <div class="mb-0-last-child @textColor @textOpacity">@item.GetString("Text")</div> 382 } 383 @RenderButton(item, buttonSize) 384 </div> 385 </div> 386 </div> 387 </li> 388389 break; 390391 case "logo": 392393 <li class="@(theme)"> 394 @if (image is object) 395 { 396 var link = GetLink(item); 397398 if (link is object && !string.IsNullOrEmpty(link.Url)) 399 { 400 string target = link.IsExternal ? "target=\"_blank\"" : string.Empty; 401 <a href="@link.Url" class="d-flex h-100 text-center" @(target)> 402 <img src="@image.Path" class="mw-100 mh-100 m-auto" alt="@(!string.IsNullOrEmpty(item.GetString("ImageAlt")) ? item.GetString("ImageAlt") : item.GetString("Title", string.Empty))" loading="lazy" style="object-fit: contain;"> 403 </a> 404 } 405 else 406 { 407 <div class="d-flex h-100 text-center"> 408 <img src="@image.Path" class="mw-100 mh-100 m-auto" alt="@(!string.IsNullOrEmpty(item.GetString("ImageAlt")) ? item.GetString("ImageAlt") : item.GetString("Title", string.Empty))" loading="lazy" style="object-fit: contain;"> 409 </div> 410 } 411 } 412 </li> 413414 break; 415 } 416 } 417 </ul> 418419 @if (!hideSliderNavigation) 420 { 421 <button type="button" title="@Translate("Previous slide")" class="slider-nav" style="z-index:1;"> 422 <span class="visually-hidden">@Translate("Previous slide")</span> 423 </button> 424 <button type="button" title="@Translate("Next slide")" class="slider-nav slider-nav-next" style="z-index:1;"> 425 <span class="visually-hidden">@Translate("Next slide")</span> 426 </button> 427 } 428429 @if (indicatorStyle != "slider-indicators-hidden") 430 { 431 <div class="slider-indicators" style="z-index:1;"> 432 @{ 433 string isActive = "active"; 434 int slideCount = 1; 435 } 436437 @foreach (var item in sliderItems) 438 { 439 <button class="@isActive" type="button" title='@Translate("Go to slide") @slideCount'> 440 <span class="visually-hidden">@Translate("Go to slide") @slideCount</span> 441 </button> 442443 slideCount++; 444 isActive = null; 445 } 446 </div> 447 } 448 </div> 449450 <script type="module" src="/Files/Templates/Designs/Swift/Assets/js/swiffy-slider.js"></script> 451 <script> 452 window.addEventListener("load", () => { 453 swift.AssetLoader.Load('/Files/Templates/Designs/Swift/Assets/css/swiffy-slider.min.css', 'css'); 454 window.swiffyslider.initSlider(document.querySelector('#Slider_@Model.ID')); 455 document.querySelector('#Slider_@Model.ID').style.opacity = 1; 456 document.querySelector('#Slider_@Model.ID').style.visibility = "visible"; 457 }); 458 </script> 459 </div> 460 </div> 461462 @if (movePageBehind && isFirstPoster) 463 { 464 <script> 465 ['resize', 'load'].forEach(function (e) { 466 window.addEventListener(e, () => swift.Scroll.setContentPosition()); 467 }); 468 </script> 469 } 470
Få hjælp og rådgivning. Spørg os!
Vi er mere end 25 dygtige og dedikerede medarbejdere hos Jasa Company, og vi er her for at hjælpe dig.