Error compiling template "Designs/Swift/Paragraph/Swift_Carousel.cshtml" Line 77: No overload for method 'RenderItem' takes 8 arguments Line 83: The name 'helper' does not exist in the current context Line 99: The name 'active' does not exist in the current context Line 105: The name 'theme' does not exist in the current context Line 109: The name 'RenderImage' does not exist in the current context Line 109: The name 'item' does not exist in the current context Line 111: The name 'layout' does not exist in the current context Line 114: The name 'alignment' does not exist in the current context Line 117: The name 'alignment' does not exist in the current context Line 120: The name 'alignment' does not exist in the current context Line 123: The name 'alignment' does not exist in the current context Line 126: The name 'alignment' does not exist in the current context Line 129: The name 'alignment' does not exist in the current context Line 132: The name 'alignment' does not exist in the current context Line 135: The name 'alignment' does not exist in the current context Line 138: The name 'alignment' does not exist in the current context Line 146: The name 'carouselWidth' does not exist in the current context Line 148: The name 'alignment' does not exist in the current context Line 152: The name 'RenderTitle' does not exist in the current context Line 152: The name 'item' does not exist in the current context Line 152: The name 'maxWidth' does not exist in the current context Line 154: The name 'RenderText' does not exist in the current context Line 154: The name 'item' does not exist in the current context Line 154: The name 'maxWidth' does not exist in the current context Line 156: The name 'RenderButton' does not exist in the current context Line 156: The name 'item' does not exist in the current context Line 158: The name 'helper' does not exist in the current context Line 178: The name 'imageFilter' does not exist in the current context Line 181: The name 'item' does not exist in the current context Line 181: The name 'parms' does not exist in the current context Line 183: The name 'helper' does not exist in the current context Line 191: The name 'maxWidth' does not exist in the current context Line 194: The name 'item' does not exist in the current context Line 196: The name 'helper' does not exist in the current context Line 205: The name 'maxWidth' does not exist in the current context Line 208: The name 'item' does not exist in the current context Line 210: The name 'helper' does not exist in the current context Line 282: The name 'link' does not exist in the current context Line 286: The name 'buttonStyle' does not exist in the current context Line 288: The name 'StretchedLink' does not exist in the current context Line 291: The name 'target' does not exist in the current context Line 293: The name 'rel' does not exist in the current context Line 295: The name 'item' does not exist in the current context Line 306: The name 'link' does not exist in the current context Line 309: The name 'target' does not exist in the current context Line 311: The name 'rel' does not exist in the current context Line 313: The name 'StretchedLink' does not exist in the current context
1 // <auto-generated/> 2 #pragma warning disable 1591 3 namespace CompiledRazorTemplates.Dynamic 4 { 5 #line hidden 6 using System.Threading.Tasks; 7 using System; 8 using System.Collections.Generic; 9 using System.Linq; 10 using Dynamicweb.Ecommerce.ProductCatalog; 11 using System.Web; 12 using Dynamicweb.Frontend; 13 internal class RazorEngine_c3fe390386b446828ad8cfb09e5605af : Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 14 { 15 #pragma warning disable 1998 16 public async override global::System.Threading.Tasks.Task ExecuteAsync() 17 { 18 WriteLiteral("\n"); 19 bool movePageBehind = false; bool isFirstPoster = false; string movePageBehindClass = ""; if (Pageview.Page.PropertyItem != null) { string headerCssClass = Pageview.Page.PropertyItem["MoveThisPageBehindTheHeader"] != null ? Pageview.Page.PropertyItem["MoveThisPageBehindTheHeader"].ToString() : "sticky-top"; movePageBehind = headerCssClass == "fixed-top" && !Pageview.IsVisualEditorMode ? true : false; if (movePageBehind) { movePageBehindClass = " poster-behind"; if (!Dynamicweb.Context.Current.Items.Contains("firstPosterIsRendered")) { isFirstPoster = true; Dynamicweb.Context.Current.Items.Add("firstPosterIsRendered", true); } } } var uniqueId = Pageview.CurrentParagraph.ID.ToString(); string title = Model.Item.GetString("Title"); var carouselItems = Model.Item?.GetItems("Carousel_Items") ?? Enumerable.Empty<Dynamicweb.Frontend.ItemViewModel>().ToList(); string enableControls = Model.Item.GetBoolean("EnableControls").ToString().ToLower(); string enableIndcators = Model.Item.GetBoolean("EnableIndicators").ToString().ToLower(); bool autoplay = Model.Item.GetBoolean("Autoplay"); string interval = (autoplay) ? Model.Item.GetString("Interval", "5000") : "0"; string enableAutoplay = autoplay.ToString().ToLower(); string animation = Model.Item.GetRawValueString("Animation", "carousel"); string carouselHeight = Model.Item.GetRawValueString("CarouselHeight", "h-100 min-vh-75 min-vh-md-100"); carouselHeight = carouselHeight == "small" ? "min-vh-25 min-vh-md-50" : carouselHeight; carouselHeight = carouselHeight == "medium" ? "min-vh-50 min-vh-md-75" : carouselHeight; carouselHeight = carouselHeight == "large" ? "min-vh-75 min-vh-md-100" : carouselHeight; string buttonSize = Model.Item.GetRawValueString("buttonSize", "regular"); buttonSize = buttonSize == "small" ? " btn-sm" : buttonSize; buttonSize = buttonSize == "regular" ? "" : buttonSize; buttonSize = buttonSize == "large" ? " btn-lg" : buttonSize; string carouselPadding = Model.Item.GetRawValueString("ContentPadding", ""); carouselPadding = carouselPadding == "none" ? "p-3 px-xl-3 py-xl-4" : carouselPadding; carouselPadding = carouselPadding == "small" ? "p-3 p-xl-4" : carouselPadding; carouselPadding = carouselPadding == "large" ? "p-4 p-xl-5" : carouselPadding; string titleFontSize = Model.Item.GetRawValueString("TitleFontSize", "display-1"); string subtitleFontSize = Model.Item.GetRawValueString("SubtitleFontSize", "fs-5"); WriteLiteral("\n<div"); 20 BeginWriteAttribute("id", " id=\"", 2661, "\"", 2684, 2); 21 WriteAttributeValue("", 2666, "carousel_", 2666, 9, true); 22 WriteAttributeValue("", 2675, uniqueId, 2675, 9, false); 23 EndWriteAttribute(); 24 BeginWriteAttribute("class", " class=\"", 2685, "\"", 2740, 3); 25 WriteAttributeValue("", 2693, "js-slider", 2693, 9, true); 26 WriteAttributeValue(" ", 2702, "item_", 2703, 6, true); 27 WriteAttributeValue("", 2708, Model.Item.SystemName.ToLower(), 2708, 32, false); 28 EndWriteAttribute(); 29 WriteLiteral(">\n\n"); 30 bool isFirst = true; WriteLiteral("\n"); 31 foreach (var item in carouselItems) { Write(RenderItem(item, isFirst, carouselHeight, carouselPadding, buttonSize, titleFontSize, subtitleFontSize, movePageBehindClass)); 32 isFirst = false; } WriteLiteral("\n</div>\n\n"); 33 Write(helper); 34 WriteLiteral(@" RenderItem(ItemViewModel item, bool isFirst, string carouselHeight, string carouselPadding, string buttonSize, string titleFontSize, string subtitleFontSize, string movePageBehindClass) { string layout = item.GetRawValueString(""Layout"", ""align-middle-center-text-center""); string carouselWidth = ""container-xl""; int xPos = item?.GetFile(""Image"")?.FocalPositionFromLeft ?? 50; int yPos = item?.GetFile(""Image"")?.FocalPositionFromTop ?? 50; string theme = !string.IsNullOrWhiteSpace(item.GetRawValueString(""Theme"")) ? "" theme "" + item.GetRawValueString(""Theme"").Replace("" "", """").Trim().ToLower() : """"; string active = isFirst ? ""active"" : """"; string alignment = """"; string maxWidth = item.GetRawValueString(""TextReadability"", ""max-width-on""); maxWidth = maxWidth == ""max-width-on"" ? ""mw-75ch d-inline-block"" : maxWidth; maxWidth = maxWidth == ""max-width-off"" ? """" : maxWidth; <div"); 35 BeginWriteAttribute("class", " class=\"", 3874, "\"", 3891, 1); 36 WriteAttributeValue("", 3882, active, 3882, 9, false); 37 EndWriteAttribute(); 38 WriteLiteral(">\n\t\t<div"); 39 BeginWriteAttribute("class", " class=\"", 3900, "\"", 3961, 4); 40 WriteAttributeValue("", 3908, "position-relative", 3908, 17, true); 41 WriteAttributeValue(" ", 3925, "h-100", 3926, 6, true); 42 WriteAttributeValue("", 3931, theme, 3931, 8, false); 43 WriteAttributeValue("", 3939, movePageBehindClass, 3939, 22, false); 44 EndWriteAttribute(); 45 WriteLiteral(">\n\t\t\t"); 46 Write(RenderImage(item)); 47 WriteLiteral("\n\n"); 48 switch (layout) { case "align-top-left-text-left": alignment = "text-start justify-content-start align-items-start"; break; case "align-top-center-text-center": alignment = "text-center justify-content-start align-items-start"; break; case "align-top-right-text-right": alignment = "text-end justify-content-start align-items-start"; break; case "align-middle-left-text-left": alignment = "text-start justify-content-center align-items-center"; break; case "align-middle-center-text-center": alignment = "text-center justify-content-center align-items-center"; break; case "align-middle-right-text-right": alignment = "text-end justify-content-center align-items-center"; break; case "align-bottom-left-text-left": alignment = "text-start justify-content-end align-items-end"; break; case "align-bottom-center-text-center": alignment = "text-center justify-content-end align-items-end"; break; case "align-bottom-right-text-right": alignment = "text-end justify-content-end align-items-end"; break; } WriteLiteral("\t\t\t<div class=\"position-relative h-100\">\n\t\t\t\t<div"); 49 BeginWriteAttribute("class", " class=\"", 5173, "\"", 5263, 7); 50 WriteAttributeValue("", 5181, "h-100", 5181, 5, true); 51 WriteAttributeValue(" ", 5186, "grid", 5187, 5, true); 52 WriteAttributeValue(" ", 5191, "grid-1", 5192, 7, true); 53 WriteAttributeValue(" ", 5198, carouselWidth, 5199, 16, false); 54 WriteAttributeValue(" ", 5215, carouselPadding, 5216, 16, false); 55 WriteAttributeValue(" ", 5232, alignment, 5233, 12, false); 56 WriteAttributeValue(" ", 5245, carouselHeight, 5246, 17, false); 57 EndWriteAttribute(); 58 WriteLiteral(">\n\t\t\t\t\t<div class=\"grid grid-1 gap-3 gap-md-4\">\n\t\t\t\t\t\t"); 59 Write(RenderTitle(item, titleFontSize, maxWidth)); 60 WriteLiteral("\n\t\t\t\t\t\t"); 61 Write(RenderText(item, subtitleFontSize, maxWidth)); 62 WriteLiteral("\n\t\t\t\t\t\t"); 63 Write(RenderButton(item, buttonSize)); 64 WriteLiteral("\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n}\n\n"); 65 Write(helper); 66 WriteLiteral(@" RenderImage(ItemViewModel item) { if (!string.IsNullOrEmpty(item.GetString(""Image""))) { var parms = new Dictionary<string, object>(); parms.Add(""cssClass"", ""h-100 w-100""); parms.Add(""columns"", Model.GridRowColumnCount); string imageFilter = item.GetRawValueString(""ImageFilter"", """"); imageFilter = imageFilter == ""no-filter"" ? """" : imageFilter; imageFilter = imageFilter == ""filter"" ? "" image-filter"" : imageFilter; <div"); 67 BeginWriteAttribute("class", " class=\"", 5951, "\"", 6019, 6); 68 WriteAttributeValue("", 5959, "position-absolute", 5959, 17, true); 69 WriteAttributeValue(" ", 5976, "top-0", 5977, 6, true); 70 WriteAttributeValue(" ", 5982, "bottom-0", 5983, 9, true); 71 WriteAttributeValue(" ", 5991, "end-0", 5992, 6, true); 72 WriteAttributeValue(" ", 5997, "start-0", 5998, 8, true); 73 WriteAttributeValue("", 6005, imageFilter, 6005, 14, false); 74 EndWriteAttribute(); 75 WriteLiteral(">\n\t\t\t"); 76 Write(RenderPartial("Components/Image.cshtml", item.GetFile("Image") ?? new Dynamicweb.Frontend.FileViewModel(), parms)); 77 WriteLiteral("\n\t\t</div>\n\t}\n}\n\n"); 78 Write(helper); 79 WriteLiteral(" RenderTitle(ItemViewModel item, string titleFontSize, string maxWidth)\n{\n\tif (!string.IsNullOrEmpty(item.GetString(\"Title\")) && !item.GetBoolean(\"HideTitle\"))\n\t{\n\t\t<h2"); 80 BeginWriteAttribute("class", " class=\"", 6330, "\"", 6356, 2); 81 WriteAttributeValue("", 6338, titleFontSize, 6338, 14, false); 82 WriteAttributeValue(" ", 6352, "m-0", 6353, 4, true); 83 EndWriteAttribute(); 84 WriteLiteral(">\n\t\t\t<span"); 85 BeginWriteAttribute("class", " class=\"", 6367, "\"", 6384, 1); 86 WriteAttributeValue("", 6375, maxWidth, 6375, 9, false); 87 EndWriteAttribute(); 88 WriteLiteral(">"); 89 Write(item.GetString("Title")); 90 WriteLiteral("</span>\n\t\t</h2>\n\t}\n}\n\n"); 91 Write(helper); 92 WriteLiteral(" RenderText(ItemViewModel item, string subtitleFontSize, string maxWidth)\n{\n\tif (!string.IsNullOrEmpty(item.GetString(\"Text\")))\n\t{\n\t\t<p"); 93 BeginWriteAttribute("class", " class=\"", 6574, "\"", 6608, 3); 94 WriteAttributeValue("", 6582, subtitleFontSize, 6582, 17, false); 95 WriteAttributeValue(" ", 6599, "lead", 6600, 5, true); 96 WriteAttributeValue(" ", 6604, "m-0", 6605, 4, true); 97 EndWriteAttribute(); 98 WriteLiteral(">\n\t\t\t<span"); 99 BeginWriteAttribute("class", " class=\"", 6619, "\"", 6636, 1); 100 WriteAttributeValue("", 6627, maxWidth, 6627, 9, false); 101 EndWriteAttribute(); 102 WriteLiteral(">"); 103 Write(item.GetString("Text")); 104 WriteLiteral("</span>\n\t\t</p>\n\t}\n}\n\n"); 105 Write(helper); 106 WriteLiteral(@" RenderButton(ItemViewModel item, string buttonSize) { string linkType = item.GetRawValueString(""LinkType"", ""page""); Dynamicweb.Frontend.LinkViewModel link = new Dynamicweb.Frontend.LinkViewModel(); string StretchedLink = item.GetRawValueString(""StretchedLink"", """"); StretchedLink = StretchedLink == ""item-not-clickable"" ? """" : StretchedLink; StretchedLink = StretchedLink == ""item-clickable"" ? "" stretched-link"" : StretchedLink; if (linkType == ""page"" && item.GetLink(""ButtonLink"") != null) { link = item.GetLink(""ButtonLink""); } if (linkType == ""product-group"") { IList<ProductGroupViewModel> selectedGroups = item.GetValue<IList<ProductGroupViewModel>>(""ProductGroupLink""); IList<string> groupIds = new List<string> { }; if (selectedGroups != null) { foreach (var fromGroup in selectedGroups) { groupIds.Add(fromGroup.Id); } } link = new Dynamicweb.Frontend.LinkViewModel() { Url = ""/Default.aspx?ID="" + GetPageIdByNavigationTag(""Shop"") + ""&GroupID="" + string.Join("","", grou"); 107 WriteLiteral(@"pIds).Trim(), IsExternal = false }; } if (linkType == ""product"") { ProductListViewModel products = item.GetValue<ProductListViewModel>(""ProductLink""); IList<string> productIds = new List<string> { }; if (products != null) { foreach (var product in products.Products) { productIds.Add(product.Id); } } string productParameter = productIds.Count == 1 ? ""ProductID"" : ""MainProductId""; string pageTag = productIds.Count == 1 ? ""ProductDetailPage"" : ""Shop""; link = new Dynamicweb.Frontend.LinkViewModel() { Url = ""/Default.aspx?ID="" + GetPageIdByNavigationTag(pageTag) + ""&"" + productParameter + ""="" + string.Join("","", productIds).Trim(), IsExternal = false }; } if (link != null && !string.IsNullOrEmpty(item.GetString(""ButtonLabel""))) { string target = Pageview.AreaSettings.GetBoolean(""OpenLinksInNewTab"") && link.IsExternal ? ""target=\""_blank\"""" : """"; string rel = Pageview.AreaSettings.GetBoolean(""OpenLinksInNewTab"") && link.IsExternal ? ""rel=\""noopener\"""" : """"; "); 108 WriteLiteral(@" string buttonStyle = item.GetRawValueString(""ButtonStyle"", ""primary""); buttonStyle = buttonStyle == ""primary"" ? ""btn-primary"" : buttonStyle; buttonStyle = buttonStyle == ""secondary"" ? ""btn-secondary"" : buttonStyle; buttonStyle = buttonStyle == ""link"" ? ""btn-link"" : buttonStyle; <div class=""m-0""> <a"); 109 BeginWriteAttribute("href", " href=\"", 9049, "\"", 9065, 1); 110 WriteAttributeValue("", 9056, link.Url, 9056, 9, false); 111 EndWriteAttribute(); 112 BeginWriteAttribute("class", " class=\"", 9066, "\"", 9119, 4); 113 WriteAttributeValue("", 9074, "btn", 9074, 3, true); 114 WriteAttributeValue(" ", 9077, buttonStyle, 9078, 12, false); 115 WriteAttributeValue("", 9090, buttonSize, 9090, 13, false); 116 WriteAttributeValue("", 9103, StretchedLink, 9103, 16, false); 117 EndWriteAttribute(); 118 WriteLiteral(" "); 119 Write(target); 120 WriteLiteral(" "); 121 Write(rel); 122 WriteLiteral(">"); 123 Write(item.GetString("ButtonLabel")); 124 WriteLiteral(@"</a> </div> } else if (link != null && !string.IsNullOrEmpty(link.Url)) { string target = Pageview.AreaSettings.GetBoolean(""OpenLinksInNewTab"") && link.IsExternal ? ""target=\""_blank\"""" : """"; string rel = Pageview.AreaSettings.GetBoolean(""OpenLinksInNewTab"") && link.IsExternal ? ""rel=\""noopener\"""" : """"; <a"); 125 BeginWriteAttribute("href", " href=\"", 9482, "\"", 9498, 1); 126 WriteAttributeValue("", 9489, link.Url, 9489, 9, false); 127 EndWriteAttribute(); 128 WriteLiteral(" "); 129 Write(target); 130 WriteLiteral(" "); 131 Write(rel); 132 WriteLiteral(" class=\""); 133 Write(StretchedLink); 134 WriteLiteral("\">\n\t\t\t<span class=\"visually-hidden\">"); 135 Write(Model.Item.GetString("Title")); 136 WriteLiteral(@"</span> </a> } } <script type=""module"" src=""~/Files/Templates/Designs/Swift/Assets/js/tiny-slider.js""></script> <script type=""module""> swift.AssetLoader.Load('Files/Templates/Designs/Swift/Assets/css/tiny-slider.css', 'css'); document.addEventListener('load.swift.assetloader', function () { var slider = tns({ container: ""#carousel_"); 137 Write(uniqueId); 138 WriteLiteral("\",\n\t\t\tcontrols: false,\n\t\t\tnav: false,\n\t\t\tautoplay: "); 139 Write(enableAutoplay); 140 WriteLiteral(",\n\t\t\tautoplayTimeout: "); 141 Write(interval); 142 WriteLiteral(",\n\t\t\tautoplayHoverPause: true,\n\t\t\tautoplayButtonOutput: false,\n\t\t\titems: 1,\n\t\t\tloop: "); 143 Write(enableAutoplay); 144 WriteLiteral(",\n\t\t\tmode: \""); 145 Write(animation); 146 WriteLiteral("\",\n\t\t\trewind: false,\n\t\t\tarrowKeys: false,\n\t\t\tlazyload: true,\n\t\t\tswipeAngle: 30,\n\t\t\tmouseDrag: true,\n\t\t\tpreventScrollOnTouch: \'auto\',\n\t\t\tresponsive: {\n\t\t\t\t992: {\n\t\t\t\t\tcontrols: "); 147 Write(enableControls); 148 WriteLiteral(@", mouseDrag: false, controlsText: [ '<span class=""tns-controls-icon"" style=""height:3em; width: 3em;""><span class=""visually-hidden"">Previous</span><span class=""icon-3""><svg viewBox=""0 0 16 16"" class=""bi bi-arrow-left"" fill=""currentColor"" xmlns=""http://www.w3.org/2000/svg""><path fill-rule=""evenodd"" d=""M15 8a.5.5 0 0 0-.5-.5H2.707l3.147-3.146a.5.5 0 1 0-.708-.708l-4 4a.5.5 0 0 0 0 .708l4 4a.5.5 0 0 0 .708-.708L2.707 8.5H14.5A.5.5 0 0 0 15 8z""/></svg></span></span>', '<span class=""tns-controls-icon"" style=""height:3em; width: 3em;""><span class=""visually-hidden"">Next</span><span class=""icon-3""><svg viewBox=""0 0 16 16"" class=""bi bi-arrow-right"" fill=""currentColor"" xmlns=""http://www.w3.org/2000/svg""><path fill-rule=""evenodd"" d=""M1 8a.5.5 0 0 1 .5-.5h11.793l-3.147-3.146a.5.5 0 0 1 .708-.708l4 4a.5.5 0 0 1 0 .708l-4 4a.5.5 0 0 1-.708-.708L13.293 8.5H1.5A.5.5 0 0 1 1 8z""/></svg></span></span>' ], } } }); }); </script> "); 149 if (movePageBehind && isFirstPoster) { WriteLiteral("\t<script>\n\t\t[\'resize\', \'load\'].forEach(function (e) {\n\t\t\twindow.addEventListener(e, () => swift.Scroll.setContentPosition());\n\t\t});\n\t</script>\n"); 150 } } 151 #pragma warning restore 1998 152 } 153 } 154 #pragma warning restore 1591 155
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> @using Dynamicweb.Ecommerce.ProductCatalog @using System.Web @using Dynamicweb.Frontend @{ bool movePageBehind = false; bool isFirstPoster = false; string movePageBehindClass = ""; if (Pageview.Page.PropertyItem != null) { string headerCssClass = Pageview.Page.PropertyItem["MoveThisPageBehindTheHeader"] != null ? Pageview.Page.PropertyItem["MoveThisPageBehindTheHeader"].ToString() : "sticky-top"; movePageBehind = headerCssClass == "fixed-top" && !Pageview.IsVisualEditorMode ? true : false; if (movePageBehind) { movePageBehindClass = " poster-behind"; if (!Dynamicweb.Context.Current.Items.Contains("firstPosterIsRendered")) { isFirstPoster = true; Dynamicweb.Context.Current.Items.Add("firstPosterIsRendered", true); } } } var uniqueId = Pageview.CurrentParagraph.ID.ToString(); string title = Model.Item.GetString("Title"); var carouselItems = Model.Item?.GetItems("Carousel_Items") ?? Enumerable.Empty<Dynamicweb.Frontend.ItemViewModel>().ToList(); string enableControls = Model.Item.GetBoolean("EnableControls").ToString().ToLower(); string enableIndcators = Model.Item.GetBoolean("EnableIndicators").ToString().ToLower(); bool autoplay = Model.Item.GetBoolean("Autoplay"); string interval = (autoplay) ? Model.Item.GetString("Interval", "5000") : "0"; string enableAutoplay = autoplay.ToString().ToLower(); string animation = Model.Item.GetRawValueString("Animation", "carousel"); string carouselHeight = Model.Item.GetRawValueString("CarouselHeight", "h-100 min-vh-75 min-vh-md-100"); carouselHeight = carouselHeight == "small" ? "min-vh-25 min-vh-md-50" : carouselHeight; carouselHeight = carouselHeight == "medium" ? "min-vh-50 min-vh-md-75" : carouselHeight; carouselHeight = carouselHeight == "large" ? "min-vh-75 min-vh-md-100" : carouselHeight; string buttonSize = Model.Item.GetRawValueString("buttonSize", "regular"); buttonSize = buttonSize == "small" ? " btn-sm" : buttonSize; buttonSize = buttonSize == "regular" ? "" : buttonSize; buttonSize = buttonSize == "large" ? " btn-lg" : buttonSize; string carouselPadding = Model.Item.GetRawValueString("ContentPadding", ""); carouselPadding = carouselPadding == "none" ? "p-3 px-xl-3 py-xl-4" : carouselPadding; carouselPadding = carouselPadding == "small" ? "p-3 p-xl-4" : carouselPadding; carouselPadding = carouselPadding == "large" ? "p-4 p-xl-5" : carouselPadding; string titleFontSize = Model.Item.GetRawValueString("TitleFontSize", "display-1"); string subtitleFontSize = Model.Item.GetRawValueString("SubtitleFontSize", "fs-5"); } <div id="carousel_@uniqueId" class="js-slider item_@Model.Item.SystemName.ToLower()"> @{ bool isFirst = true; } @foreach (var item in carouselItems) { @RenderItem(item, isFirst, carouselHeight, carouselPadding, buttonSize, titleFontSize, subtitleFontSize, movePageBehindClass) isFirst = false; } </div> @helper RenderItem(ItemViewModel item, bool isFirst, string carouselHeight, string carouselPadding, string buttonSize, string titleFontSize, string subtitleFontSize, string movePageBehindClass) { string layout = item.GetRawValueString("Layout", "align-middle-center-text-center"); string carouselWidth = "container-xl"; int xPos = item?.GetFile("Image")?.FocalPositionFromLeft ?? 50; int yPos = item?.GetFile("Image")?.FocalPositionFromTop ?? 50; string theme = !string.IsNullOrWhiteSpace(item.GetRawValueString("Theme")) ? " theme " + item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; string active = isFirst ? "active" : ""; string alignment = ""; string maxWidth = item.GetRawValueString("TextReadability", "max-width-on"); maxWidth = maxWidth == "max-width-on" ? "mw-75ch d-inline-block" : maxWidth; maxWidth = maxWidth == "max-width-off" ? "" : maxWidth; <div class="@(active)"> <div class="position-relative h-100@(theme)@(movePageBehindClass)"> @RenderImage(item) @switch (layout) { case "align-top-left-text-left": alignment = "text-start justify-content-start align-items-start"; break; case "align-top-center-text-center": alignment = "text-center justify-content-start align-items-start"; break; case "align-top-right-text-right": alignment = "text-end justify-content-start align-items-start"; break; case "align-middle-left-text-left": alignment = "text-start justify-content-center align-items-center"; break; case "align-middle-center-text-center": alignment = "text-center justify-content-center align-items-center"; break; case "align-middle-right-text-right": alignment = "text-end justify-content-center align-items-center"; break; case "align-bottom-left-text-left": alignment = "text-start justify-content-end align-items-end"; break; case "align-bottom-center-text-center": alignment = "text-center justify-content-end align-items-end"; break; case "align-bottom-right-text-right": alignment = "text-end justify-content-end align-items-end"; break; } <div class="position-relative h-100"> <div class="h-100 grid grid-1 @(carouselWidth) @carouselPadding @(alignment) @(carouselHeight)"> <div class="grid grid-1 gap-3 gap-md-4"> @RenderTitle(item, titleFontSize, maxWidth) @RenderText(item, subtitleFontSize, maxWidth) @RenderButton(item, buttonSize) </div> </div> </div> </div> </div> } @helper RenderImage(ItemViewModel item) { if (!string.IsNullOrEmpty(item.GetString("Image"))) { var parms = new Dictionary<string, object>(); parms.Add("cssClass", "h-100 w-100"); parms.Add("columns", Model.GridRowColumnCount); string imageFilter = item.GetRawValueString("ImageFilter", ""); imageFilter = imageFilter == "no-filter" ? "" : imageFilter; imageFilter = imageFilter == "filter" ? " image-filter" : imageFilter; <div class="position-absolute top-0 bottom-0 end-0 start-0@(imageFilter)"> @RenderPartial("Components/Image.cshtml", item.GetFile("Image") ?? new Dynamicweb.Frontend.FileViewModel(), parms) </div> } } @helper RenderTitle(ItemViewModel item, string titleFontSize, string maxWidth) { if (!string.IsNullOrEmpty(item.GetString("Title")) && !item.GetBoolean("HideTitle")) { <h2 class="@titleFontSize m-0"> <span class="@maxWidth">@item.GetString("Title")</span> </h2> } } @helper RenderText(ItemViewModel item, string subtitleFontSize, string maxWidth) { if (!string.IsNullOrEmpty(item.GetString("Text"))) { <p class="@subtitleFontSize lead m-0"> <span class="@maxWidth">@item.GetString("Text")</span> </p> } } @helper RenderButton(ItemViewModel item, string buttonSize) { string linkType = item.GetRawValueString("LinkType", "page"); Dynamicweb.Frontend.LinkViewModel link = new Dynamicweb.Frontend.LinkViewModel(); string StretchedLink = item.GetRawValueString("StretchedLink", ""); StretchedLink = StretchedLink == "item-not-clickable" ? "" : StretchedLink; StretchedLink = StretchedLink == "item-clickable" ? " stretched-link" : StretchedLink; if (linkType == "page" && item.GetLink("ButtonLink") != null) { link = item.GetLink("ButtonLink"); } if (linkType == "product-group") { IList<ProductGroupViewModel> selectedGroups = item.GetValue<IList<ProductGroupViewModel>>("ProductGroupLink"); IList<string> groupIds = new List<string> { }; if (selectedGroups != null) { foreach (var fromGroup in selectedGroups) { groupIds.Add(fromGroup.Id); } } link = new Dynamicweb.Frontend.LinkViewModel() { Url = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Shop") + "&GroupID=" + string.Join(",", groupIds).Trim(), IsExternal = false }; } if (linkType == "product") { ProductListViewModel products = item.GetValue<ProductListViewModel>("ProductLink"); IList<string> productIds = new List<string> { }; if (products != null) { foreach (var product in products.Products) { productIds.Add(product.Id); } } string productParameter = productIds.Count == 1 ? "ProductID" : "MainProductId"; string pageTag = productIds.Count == 1 ? "ProductDetailPage" : "Shop"; link = new Dynamicweb.Frontend.LinkViewModel() { Url = "/Default.aspx?ID=" + GetPageIdByNavigationTag(pageTag) + "&" + productParameter + "=" + string.Join(",", productIds).Trim(), IsExternal = false }; } if (link != null && !string.IsNullOrEmpty(item.GetString("ButtonLabel"))) { string target = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && link.IsExternal ? "target=\"_blank\"" : ""; string rel = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && link.IsExternal ? "rel=\"noopener\"" : ""; string buttonStyle = item.GetRawValueString("ButtonStyle", "primary"); buttonStyle = buttonStyle == "primary" ? "btn-primary" : buttonStyle; buttonStyle = buttonStyle == "secondary" ? "btn-secondary" : buttonStyle; buttonStyle = buttonStyle == "link" ? "btn-link" : buttonStyle; <div class="m-0"> <a href="@link.Url" class="btn @buttonStyle@(buttonSize)@(StretchedLink)" @target @rel>@item.GetString("ButtonLabel")</a> </div> } else if (link != null && !string.IsNullOrEmpty(link.Url)) { string target = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && link.IsExternal ? "target=\"_blank\"" : ""; string rel = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && link.IsExternal ? "rel=\"noopener\"" : ""; <a href="@link.Url" @target @rel class="@StretchedLink"> <span class="visually-hidden">@Model.Item.GetString("Title")</span> </a> } } <script type="module" src="~/Files/Templates/Designs/Swift/Assets/js/tiny-slider.js"></script> <script type="module"> swift.AssetLoader.Load('Files/Templates/Designs/Swift/Assets/css/tiny-slider.css', 'css'); document.addEventListener('load.swift.assetloader', function () { var slider = tns({ container: "#carousel_@uniqueId", controls: false, nav: false, autoplay: @enableAutoplay, autoplayTimeout: @interval, autoplayHoverPause: true, autoplayButtonOutput: false, items: 1, loop: @enableAutoplay, mode: "@animation", rewind: false, arrowKeys: false, lazyload: true, swipeAngle: 30, mouseDrag: true, preventScrollOnTouch: 'auto', responsive: { 992: { controls: @enableControls, mouseDrag: false, controlsText: [ '<span class="tns-controls-icon" style="height:3em; width: 3em;"><span class="visually-hidden">Previous</span><span class="icon-3"><svg viewBox="0 0 16 16" class="bi bi-arrow-left" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M15 8a.5.5 0 0 0-.5-.5H2.707l3.147-3.146a.5.5 0 1 0-.708-.708l-4 4a.5.5 0 0 0 0 .708l4 4a.5.5 0 0 0 .708-.708L2.707 8.5H14.5A.5.5 0 0 0 15 8z"/></svg></span></span>', '<span class="tns-controls-icon" style="height:3em; width: 3em;"><span class="visually-hidden">Next</span><span class="icon-3"><svg viewBox="0 0 16 16" class="bi bi-arrow-right" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M1 8a.5.5 0 0 1 .5-.5h11.793l-3.147-3.146a.5.5 0 0 1 .708-.708l4 4a.5.5 0 0 1 0 .708l-4 4a.5.5 0 0 1-.708-.708L13.293 8.5H1.5A.5.5 0 0 1 1 8z"/></svg></span></span>' ], } } }); }); </script> @if (movePageBehind && isFirstPoster) { <script> ['resize', 'load'].forEach(function (e) { window.addEventListener(e, () => swift.Scroll.setContentPosition()); }); </script> }
Error compiling template "Designs/Swift/Paragraph/Swift_Carousel.cshtml" Line 77: No overload for method 'RenderItem' takes 8 arguments Line 83: The name 'helper' does not exist in the current context Line 99: The name 'active' does not exist in the current context Line 105: The name 'theme' does not exist in the current context Line 109: The name 'RenderImage' does not exist in the current context Line 109: The name 'item' does not exist in the current context Line 111: The name 'layout' does not exist in the current context Line 114: The name 'alignment' does not exist in the current context Line 117: The name 'alignment' does not exist in the current context Line 120: The name 'alignment' does not exist in the current context Line 123: The name 'alignment' does not exist in the current context Line 126: The name 'alignment' does not exist in the current context Line 129: The name 'alignment' does not exist in the current context Line 132: The name 'alignment' does not exist in the current context Line 135: The name 'alignment' does not exist in the current context Line 138: The name 'alignment' does not exist in the current context Line 146: The name 'carouselWidth' does not exist in the current context Line 148: The name 'alignment' does not exist in the current context Line 152: The name 'RenderTitle' does not exist in the current context Line 152: The name 'item' does not exist in the current context Line 152: The name 'maxWidth' does not exist in the current context Line 154: The name 'RenderText' does not exist in the current context Line 154: The name 'item' does not exist in the current context Line 154: The name 'maxWidth' does not exist in the current context Line 156: The name 'RenderButton' does not exist in the current context Line 156: The name 'item' does not exist in the current context Line 158: The name 'helper' does not exist in the current context Line 178: The name 'imageFilter' does not exist in the current context Line 181: The name 'item' does not exist in the current context Line 181: The name 'parms' does not exist in the current context Line 183: The name 'helper' does not exist in the current context Line 191: The name 'maxWidth' does not exist in the current context Line 194: The name 'item' does not exist in the current context Line 196: The name 'helper' does not exist in the current context Line 205: The name 'maxWidth' does not exist in the current context Line 208: The name 'item' does not exist in the current context Line 210: The name 'helper' does not exist in the current context Line 282: The name 'link' does not exist in the current context Line 286: The name 'buttonStyle' does not exist in the current context Line 288: The name 'StretchedLink' does not exist in the current context Line 291: The name 'target' does not exist in the current context Line 293: The name 'rel' does not exist in the current context Line 295: The name 'item' does not exist in the current context Line 306: The name 'link' does not exist in the current context Line 309: The name 'target' does not exist in the current context Line 311: The name 'rel' does not exist in the current context Line 313: The name 'StretchedLink' does not exist in the current context
1 // <auto-generated/> 2 #pragma warning disable 1591 3 namespace CompiledRazorTemplates.Dynamic 4 { 5 #line hidden 6 using System.Threading.Tasks; 7 using System; 8 using System.Collections.Generic; 9 using System.Linq; 10 using Dynamicweb.Ecommerce.ProductCatalog; 11 using System.Web; 12 using Dynamicweb.Frontend; 13 internal class RazorEngine_06fd86ba359042d995b7ab7fc0ef23a3 : Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 14 { 15 #pragma warning disable 1998 16 public async override global::System.Threading.Tasks.Task ExecuteAsync() 17 { 18 WriteLiteral("\n"); 19 bool movePageBehind = false; bool isFirstPoster = false; string movePageBehindClass = ""; if (Pageview.Page.PropertyItem != null) { string headerCssClass = Pageview.Page.PropertyItem["MoveThisPageBehindTheHeader"] != null ? Pageview.Page.PropertyItem["MoveThisPageBehindTheHeader"].ToString() : "sticky-top"; movePageBehind = headerCssClass == "fixed-top" && !Pageview.IsVisualEditorMode ? true : false; if (movePageBehind) { movePageBehindClass = " poster-behind"; if (!Dynamicweb.Context.Current.Items.Contains("firstPosterIsRendered")) { isFirstPoster = true; Dynamicweb.Context.Current.Items.Add("firstPosterIsRendered", true); } } } var uniqueId = Pageview.CurrentParagraph.ID.ToString(); string title = Model.Item.GetString("Title"); var carouselItems = Model.Item?.GetItems("Carousel_Items") ?? Enumerable.Empty<Dynamicweb.Frontend.ItemViewModel>().ToList(); string enableControls = Model.Item.GetBoolean("EnableControls").ToString().ToLower(); string enableIndcators = Model.Item.GetBoolean("EnableIndicators").ToString().ToLower(); bool autoplay = Model.Item.GetBoolean("Autoplay"); string interval = (autoplay) ? Model.Item.GetString("Interval", "5000") : "0"; string enableAutoplay = autoplay.ToString().ToLower(); string animation = Model.Item.GetRawValueString("Animation", "carousel"); string carouselHeight = Model.Item.GetRawValueString("CarouselHeight", "h-100 min-vh-75 min-vh-md-100"); carouselHeight = carouselHeight == "small" ? "min-vh-25 min-vh-md-50" : carouselHeight; carouselHeight = carouselHeight == "medium" ? "min-vh-50 min-vh-md-75" : carouselHeight; carouselHeight = carouselHeight == "large" ? "min-vh-75 min-vh-md-100" : carouselHeight; string buttonSize = Model.Item.GetRawValueString("buttonSize", "regular"); buttonSize = buttonSize == "small" ? " btn-sm" : buttonSize; buttonSize = buttonSize == "regular" ? "" : buttonSize; buttonSize = buttonSize == "large" ? " btn-lg" : buttonSize; string carouselPadding = Model.Item.GetRawValueString("ContentPadding", ""); carouselPadding = carouselPadding == "none" ? "p-3 px-xl-3 py-xl-4" : carouselPadding; carouselPadding = carouselPadding == "small" ? "p-3 p-xl-4" : carouselPadding; carouselPadding = carouselPadding == "large" ? "p-4 p-xl-5" : carouselPadding; string titleFontSize = Model.Item.GetRawValueString("TitleFontSize", "display-1"); string subtitleFontSize = Model.Item.GetRawValueString("SubtitleFontSize", "fs-5"); WriteLiteral("\n<div"); 20 BeginWriteAttribute("id", " id=\"", 2661, "\"", 2684, 2); 21 WriteAttributeValue("", 2666, "carousel_", 2666, 9, true); 22 WriteAttributeValue("", 2675, uniqueId, 2675, 9, false); 23 EndWriteAttribute(); 24 BeginWriteAttribute("class", " class=\"", 2685, "\"", 2740, 3); 25 WriteAttributeValue("", 2693, "js-slider", 2693, 9, true); 26 WriteAttributeValue(" ", 2702, "item_", 2703, 6, true); 27 WriteAttributeValue("", 2708, Model.Item.SystemName.ToLower(), 2708, 32, false); 28 EndWriteAttribute(); 29 WriteLiteral(">\n\n"); 30 bool isFirst = true; WriteLiteral("\n"); 31 foreach (var item in carouselItems) { Write(RenderItem(item, isFirst, carouselHeight, carouselPadding, buttonSize, titleFontSize, subtitleFontSize, movePageBehindClass)); 32 isFirst = false; } WriteLiteral("\n</div>\n\n"); 33 Write(helper); 34 WriteLiteral(@" RenderItem(ItemViewModel item, bool isFirst, string carouselHeight, string carouselPadding, string buttonSize, string titleFontSize, string subtitleFontSize, string movePageBehindClass) { string layout = item.GetRawValueString(""Layout"", ""align-middle-center-text-center""); string carouselWidth = ""container-xl""; int xPos = item?.GetFile(""Image"")?.FocalPositionFromLeft ?? 50; int yPos = item?.GetFile(""Image"")?.FocalPositionFromTop ?? 50; string theme = !string.IsNullOrWhiteSpace(item.GetRawValueString(""Theme"")) ? "" theme "" + item.GetRawValueString(""Theme"").Replace("" "", """").Trim().ToLower() : """"; string active = isFirst ? ""active"" : """"; string alignment = """"; string maxWidth = item.GetRawValueString(""TextReadability"", ""max-width-on""); maxWidth = maxWidth == ""max-width-on"" ? ""mw-75ch d-inline-block"" : maxWidth; maxWidth = maxWidth == ""max-width-off"" ? """" : maxWidth; <div"); 35 BeginWriteAttribute("class", " class=\"", 3874, "\"", 3891, 1); 36 WriteAttributeValue("", 3882, active, 3882, 9, false); 37 EndWriteAttribute(); 38 WriteLiteral(">\n\t\t<div"); 39 BeginWriteAttribute("class", " class=\"", 3900, "\"", 3961, 4); 40 WriteAttributeValue("", 3908, "position-relative", 3908, 17, true); 41 WriteAttributeValue(" ", 3925, "h-100", 3926, 6, true); 42 WriteAttributeValue("", 3931, theme, 3931, 8, false); 43 WriteAttributeValue("", 3939, movePageBehindClass, 3939, 22, false); 44 EndWriteAttribute(); 45 WriteLiteral(">\n\t\t\t"); 46 Write(RenderImage(item)); 47 WriteLiteral("\n\n"); 48 switch (layout) { case "align-top-left-text-left": alignment = "text-start justify-content-start align-items-start"; break; case "align-top-center-text-center": alignment = "text-center justify-content-start align-items-start"; break; case "align-top-right-text-right": alignment = "text-end justify-content-start align-items-start"; break; case "align-middle-left-text-left": alignment = "text-start justify-content-center align-items-center"; break; case "align-middle-center-text-center": alignment = "text-center justify-content-center align-items-center"; break; case "align-middle-right-text-right": alignment = "text-end justify-content-center align-items-center"; break; case "align-bottom-left-text-left": alignment = "text-start justify-content-end align-items-end"; break; case "align-bottom-center-text-center": alignment = "text-center justify-content-end align-items-end"; break; case "align-bottom-right-text-right": alignment = "text-end justify-content-end align-items-end"; break; } WriteLiteral("\t\t\t<div class=\"position-relative h-100\">\n\t\t\t\t<div"); 49 BeginWriteAttribute("class", " class=\"", 5173, "\"", 5263, 7); 50 WriteAttributeValue("", 5181, "h-100", 5181, 5, true); 51 WriteAttributeValue(" ", 5186, "grid", 5187, 5, true); 52 WriteAttributeValue(" ", 5191, "grid-1", 5192, 7, true); 53 WriteAttributeValue(" ", 5198, carouselWidth, 5199, 16, false); 54 WriteAttributeValue(" ", 5215, carouselPadding, 5216, 16, false); 55 WriteAttributeValue(" ", 5232, alignment, 5233, 12, false); 56 WriteAttributeValue(" ", 5245, carouselHeight, 5246, 17, false); 57 EndWriteAttribute(); 58 WriteLiteral(">\n\t\t\t\t\t<div class=\"grid grid-1 gap-3 gap-md-4\">\n\t\t\t\t\t\t"); 59 Write(RenderTitle(item, titleFontSize, maxWidth)); 60 WriteLiteral("\n\t\t\t\t\t\t"); 61 Write(RenderText(item, subtitleFontSize, maxWidth)); 62 WriteLiteral("\n\t\t\t\t\t\t"); 63 Write(RenderButton(item, buttonSize)); 64 WriteLiteral("\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n}\n\n"); 65 Write(helper); 66 WriteLiteral(@" RenderImage(ItemViewModel item) { if (!string.IsNullOrEmpty(item.GetString(""Image""))) { var parms = new Dictionary<string, object>(); parms.Add(""cssClass"", ""h-100 w-100""); parms.Add(""columns"", Model.GridRowColumnCount); string imageFilter = item.GetRawValueString(""ImageFilter"", """"); imageFilter = imageFilter == ""no-filter"" ? """" : imageFilter; imageFilter = imageFilter == ""filter"" ? "" image-filter"" : imageFilter; <div"); 67 BeginWriteAttribute("class", " class=\"", 5951, "\"", 6019, 6); 68 WriteAttributeValue("", 5959, "position-absolute", 5959, 17, true); 69 WriteAttributeValue(" ", 5976, "top-0", 5977, 6, true); 70 WriteAttributeValue(" ", 5982, "bottom-0", 5983, 9, true); 71 WriteAttributeValue(" ", 5991, "end-0", 5992, 6, true); 72 WriteAttributeValue(" ", 5997, "start-0", 5998, 8, true); 73 WriteAttributeValue("", 6005, imageFilter, 6005, 14, false); 74 EndWriteAttribute(); 75 WriteLiteral(">\n\t\t\t"); 76 Write(RenderPartial("Components/Image.cshtml", item.GetFile("Image") ?? new Dynamicweb.Frontend.FileViewModel(), parms)); 77 WriteLiteral("\n\t\t</div>\n\t}\n}\n\n"); 78 Write(helper); 79 WriteLiteral(" RenderTitle(ItemViewModel item, string titleFontSize, string maxWidth)\n{\n\tif (!string.IsNullOrEmpty(item.GetString(\"Title\")) && !item.GetBoolean(\"HideTitle\"))\n\t{\n\t\t<h2"); 80 BeginWriteAttribute("class", " class=\"", 6330, "\"", 6356, 2); 81 WriteAttributeValue("", 6338, titleFontSize, 6338, 14, false); 82 WriteAttributeValue(" ", 6352, "m-0", 6353, 4, true); 83 EndWriteAttribute(); 84 WriteLiteral(">\n\t\t\t<span"); 85 BeginWriteAttribute("class", " class=\"", 6367, "\"", 6384, 1); 86 WriteAttributeValue("", 6375, maxWidth, 6375, 9, false); 87 EndWriteAttribute(); 88 WriteLiteral(">"); 89 Write(item.GetString("Title")); 90 WriteLiteral("</span>\n\t\t</h2>\n\t}\n}\n\n"); 91 Write(helper); 92 WriteLiteral(" RenderText(ItemViewModel item, string subtitleFontSize, string maxWidth)\n{\n\tif (!string.IsNullOrEmpty(item.GetString(\"Text\")))\n\t{\n\t\t<p"); 93 BeginWriteAttribute("class", " class=\"", 6574, "\"", 6608, 3); 94 WriteAttributeValue("", 6582, subtitleFontSize, 6582, 17, false); 95 WriteAttributeValue(" ", 6599, "lead", 6600, 5, true); 96 WriteAttributeValue(" ", 6604, "m-0", 6605, 4, true); 97 EndWriteAttribute(); 98 WriteLiteral(">\n\t\t\t<span"); 99 BeginWriteAttribute("class", " class=\"", 6619, "\"", 6636, 1); 100 WriteAttributeValue("", 6627, maxWidth, 6627, 9, false); 101 EndWriteAttribute(); 102 WriteLiteral(">"); 103 Write(item.GetString("Text")); 104 WriteLiteral("</span>\n\t\t</p>\n\t}\n}\n\n"); 105 Write(helper); 106 WriteLiteral(@" RenderButton(ItemViewModel item, string buttonSize) { string linkType = item.GetRawValueString(""LinkType"", ""page""); Dynamicweb.Frontend.LinkViewModel link = new Dynamicweb.Frontend.LinkViewModel(); string StretchedLink = item.GetRawValueString(""StretchedLink"", """"); StretchedLink = StretchedLink == ""item-not-clickable"" ? """" : StretchedLink; StretchedLink = StretchedLink == ""item-clickable"" ? "" stretched-link"" : StretchedLink; if (linkType == ""page"" && item.GetLink(""ButtonLink"") != null) { link = item.GetLink(""ButtonLink""); } if (linkType == ""product-group"") { IList<ProductGroupViewModel> selectedGroups = item.GetValue<IList<ProductGroupViewModel>>(""ProductGroupLink""); IList<string> groupIds = new List<string> { }; if (selectedGroups != null) { foreach (var fromGroup in selectedGroups) { groupIds.Add(fromGroup.Id); } } link = new Dynamicweb.Frontend.LinkViewModel() { Url = ""/Default.aspx?ID="" + GetPageIdByNavigationTag(""Shop"") + ""&GroupID="" + string.Join("","", grou"); 107 WriteLiteral(@"pIds).Trim(), IsExternal = false }; } if (linkType == ""product"") { ProductListViewModel products = item.GetValue<ProductListViewModel>(""ProductLink""); IList<string> productIds = new List<string> { }; if (products != null) { foreach (var product in products.Products) { productIds.Add(product.Id); } } string productParameter = productIds.Count == 1 ? ""ProductID"" : ""MainProductId""; string pageTag = productIds.Count == 1 ? ""ProductDetailPage"" : ""Shop""; link = new Dynamicweb.Frontend.LinkViewModel() { Url = ""/Default.aspx?ID="" + GetPageIdByNavigationTag(pageTag) + ""&"" + productParameter + ""="" + string.Join("","", productIds).Trim(), IsExternal = false }; } if (link != null && !string.IsNullOrEmpty(item.GetString(""ButtonLabel""))) { string target = Pageview.AreaSettings.GetBoolean(""OpenLinksInNewTab"") && link.IsExternal ? ""target=\""_blank\"""" : """"; string rel = Pageview.AreaSettings.GetBoolean(""OpenLinksInNewTab"") && link.IsExternal ? ""rel=\""noopener\"""" : """"; "); 108 WriteLiteral(@" string buttonStyle = item.GetRawValueString(""ButtonStyle"", ""primary""); buttonStyle = buttonStyle == ""primary"" ? ""btn-primary"" : buttonStyle; buttonStyle = buttonStyle == ""secondary"" ? ""btn-secondary"" : buttonStyle; buttonStyle = buttonStyle == ""link"" ? ""btn-link"" : buttonStyle; <div class=""m-0""> <a"); 109 BeginWriteAttribute("href", " href=\"", 9049, "\"", 9065, 1); 110 WriteAttributeValue("", 9056, link.Url, 9056, 9, false); 111 EndWriteAttribute(); 112 BeginWriteAttribute("class", " class=\"", 9066, "\"", 9119, 4); 113 WriteAttributeValue("", 9074, "btn", 9074, 3, true); 114 WriteAttributeValue(" ", 9077, buttonStyle, 9078, 12, false); 115 WriteAttributeValue("", 9090, buttonSize, 9090, 13, false); 116 WriteAttributeValue("", 9103, StretchedLink, 9103, 16, false); 117 EndWriteAttribute(); 118 WriteLiteral(" "); 119 Write(target); 120 WriteLiteral(" "); 121 Write(rel); 122 WriteLiteral(">"); 123 Write(item.GetString("ButtonLabel")); 124 WriteLiteral(@"</a> </div> } else if (link != null && !string.IsNullOrEmpty(link.Url)) { string target = Pageview.AreaSettings.GetBoolean(""OpenLinksInNewTab"") && link.IsExternal ? ""target=\""_blank\"""" : """"; string rel = Pageview.AreaSettings.GetBoolean(""OpenLinksInNewTab"") && link.IsExternal ? ""rel=\""noopener\"""" : """"; <a"); 125 BeginWriteAttribute("href", " href=\"", 9482, "\"", 9498, 1); 126 WriteAttributeValue("", 9489, link.Url, 9489, 9, false); 127 EndWriteAttribute(); 128 WriteLiteral(" "); 129 Write(target); 130 WriteLiteral(" "); 131 Write(rel); 132 WriteLiteral(" class=\""); 133 Write(StretchedLink); 134 WriteLiteral("\">\n\t\t\t<span class=\"visually-hidden\">"); 135 Write(Model.Item.GetString("Title")); 136 WriteLiteral(@"</span> </a> } } <script type=""module"" src=""~/Files/Templates/Designs/Swift/Assets/js/tiny-slider.js""></script> <script type=""module""> swift.AssetLoader.Load('Files/Templates/Designs/Swift/Assets/css/tiny-slider.css', 'css'); document.addEventListener('load.swift.assetloader', function () { var slider = tns({ container: ""#carousel_"); 137 Write(uniqueId); 138 WriteLiteral("\",\n\t\t\tcontrols: false,\n\t\t\tnav: false,\n\t\t\tautoplay: "); 139 Write(enableAutoplay); 140 WriteLiteral(",\n\t\t\tautoplayTimeout: "); 141 Write(interval); 142 WriteLiteral(",\n\t\t\tautoplayHoverPause: true,\n\t\t\tautoplayButtonOutput: false,\n\t\t\titems: 1,\n\t\t\tloop: "); 143 Write(enableAutoplay); 144 WriteLiteral(",\n\t\t\tmode: \""); 145 Write(animation); 146 WriteLiteral("\",\n\t\t\trewind: false,\n\t\t\tarrowKeys: false,\n\t\t\tlazyload: true,\n\t\t\tswipeAngle: 30,\n\t\t\tmouseDrag: true,\n\t\t\tpreventScrollOnTouch: \'auto\',\n\t\t\tresponsive: {\n\t\t\t\t992: {\n\t\t\t\t\tcontrols: "); 147 Write(enableControls); 148 WriteLiteral(@", mouseDrag: false, controlsText: [ '<span class=""tns-controls-icon"" style=""height:3em; width: 3em;""><span class=""visually-hidden"">Previous</span><span class=""icon-3""><svg viewBox=""0 0 16 16"" class=""bi bi-arrow-left"" fill=""currentColor"" xmlns=""http://www.w3.org/2000/svg""><path fill-rule=""evenodd"" d=""M15 8a.5.5 0 0 0-.5-.5H2.707l3.147-3.146a.5.5 0 1 0-.708-.708l-4 4a.5.5 0 0 0 0 .708l4 4a.5.5 0 0 0 .708-.708L2.707 8.5H14.5A.5.5 0 0 0 15 8z""/></svg></span></span>', '<span class=""tns-controls-icon"" style=""height:3em; width: 3em;""><span class=""visually-hidden"">Next</span><span class=""icon-3""><svg viewBox=""0 0 16 16"" class=""bi bi-arrow-right"" fill=""currentColor"" xmlns=""http://www.w3.org/2000/svg""><path fill-rule=""evenodd"" d=""M1 8a.5.5 0 0 1 .5-.5h11.793l-3.147-3.146a.5.5 0 0 1 .708-.708l4 4a.5.5 0 0 1 0 .708l-4 4a.5.5 0 0 1-.708-.708L13.293 8.5H1.5A.5.5 0 0 1 1 8z""/></svg></span></span>' ], } } }); }); </script> "); 149 if (movePageBehind && isFirstPoster) { WriteLiteral("\t<script>\n\t\t[\'resize\', \'load\'].forEach(function (e) {\n\t\t\twindow.addEventListener(e, () => swift.Scroll.setContentPosition());\n\t\t});\n\t</script>\n"); 150 } } 151 #pragma warning restore 1998 152 } 153 } 154 #pragma warning restore 1591 155
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> @using Dynamicweb.Ecommerce.ProductCatalog @using System.Web @using Dynamicweb.Frontend @{ bool movePageBehind = false; bool isFirstPoster = false; string movePageBehindClass = ""; if (Pageview.Page.PropertyItem != null) { string headerCssClass = Pageview.Page.PropertyItem["MoveThisPageBehindTheHeader"] != null ? Pageview.Page.PropertyItem["MoveThisPageBehindTheHeader"].ToString() : "sticky-top"; movePageBehind = headerCssClass == "fixed-top" && !Pageview.IsVisualEditorMode ? true : false; if (movePageBehind) { movePageBehindClass = " poster-behind"; if (!Dynamicweb.Context.Current.Items.Contains("firstPosterIsRendered")) { isFirstPoster = true; Dynamicweb.Context.Current.Items.Add("firstPosterIsRendered", true); } } } var uniqueId = Pageview.CurrentParagraph.ID.ToString(); string title = Model.Item.GetString("Title"); var carouselItems = Model.Item?.GetItems("Carousel_Items") ?? Enumerable.Empty<Dynamicweb.Frontend.ItemViewModel>().ToList(); string enableControls = Model.Item.GetBoolean("EnableControls").ToString().ToLower(); string enableIndcators = Model.Item.GetBoolean("EnableIndicators").ToString().ToLower(); bool autoplay = Model.Item.GetBoolean("Autoplay"); string interval = (autoplay) ? Model.Item.GetString("Interval", "5000") : "0"; string enableAutoplay = autoplay.ToString().ToLower(); string animation = Model.Item.GetRawValueString("Animation", "carousel"); string carouselHeight = Model.Item.GetRawValueString("CarouselHeight", "h-100 min-vh-75 min-vh-md-100"); carouselHeight = carouselHeight == "small" ? "min-vh-25 min-vh-md-50" : carouselHeight; carouselHeight = carouselHeight == "medium" ? "min-vh-50 min-vh-md-75" : carouselHeight; carouselHeight = carouselHeight == "large" ? "min-vh-75 min-vh-md-100" : carouselHeight; string buttonSize = Model.Item.GetRawValueString("buttonSize", "regular"); buttonSize = buttonSize == "small" ? " btn-sm" : buttonSize; buttonSize = buttonSize == "regular" ? "" : buttonSize; buttonSize = buttonSize == "large" ? " btn-lg" : buttonSize; string carouselPadding = Model.Item.GetRawValueString("ContentPadding", ""); carouselPadding = carouselPadding == "none" ? "p-3 px-xl-3 py-xl-4" : carouselPadding; carouselPadding = carouselPadding == "small" ? "p-3 p-xl-4" : carouselPadding; carouselPadding = carouselPadding == "large" ? "p-4 p-xl-5" : carouselPadding; string titleFontSize = Model.Item.GetRawValueString("TitleFontSize", "display-1"); string subtitleFontSize = Model.Item.GetRawValueString("SubtitleFontSize", "fs-5"); } <div id="carousel_@uniqueId" class="js-slider item_@Model.Item.SystemName.ToLower()"> @{ bool isFirst = true; } @foreach (var item in carouselItems) { @RenderItem(item, isFirst, carouselHeight, carouselPadding, buttonSize, titleFontSize, subtitleFontSize, movePageBehindClass) isFirst = false; } </div> @helper RenderItem(ItemViewModel item, bool isFirst, string carouselHeight, string carouselPadding, string buttonSize, string titleFontSize, string subtitleFontSize, string movePageBehindClass) { string layout = item.GetRawValueString("Layout", "align-middle-center-text-center"); string carouselWidth = "container-xl"; int xPos = item?.GetFile("Image")?.FocalPositionFromLeft ?? 50; int yPos = item?.GetFile("Image")?.FocalPositionFromTop ?? 50; string theme = !string.IsNullOrWhiteSpace(item.GetRawValueString("Theme")) ? " theme " + item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : ""; string active = isFirst ? "active" : ""; string alignment = ""; string maxWidth = item.GetRawValueString("TextReadability", "max-width-on"); maxWidth = maxWidth == "max-width-on" ? "mw-75ch d-inline-block" : maxWidth; maxWidth = maxWidth == "max-width-off" ? "" : maxWidth; <div class="@(active)"> <div class="position-relative h-100@(theme)@(movePageBehindClass)"> @RenderImage(item) @switch (layout) { case "align-top-left-text-left": alignment = "text-start justify-content-start align-items-start"; break; case "align-top-center-text-center": alignment = "text-center justify-content-start align-items-start"; break; case "align-top-right-text-right": alignment = "text-end justify-content-start align-items-start"; break; case "align-middle-left-text-left": alignment = "text-start justify-content-center align-items-center"; break; case "align-middle-center-text-center": alignment = "text-center justify-content-center align-items-center"; break; case "align-middle-right-text-right": alignment = "text-end justify-content-center align-items-center"; break; case "align-bottom-left-text-left": alignment = "text-start justify-content-end align-items-end"; break; case "align-bottom-center-text-center": alignment = "text-center justify-content-end align-items-end"; break; case "align-bottom-right-text-right": alignment = "text-end justify-content-end align-items-end"; break; } <div class="position-relative h-100"> <div class="h-100 grid grid-1 @(carouselWidth) @carouselPadding @(alignment) @(carouselHeight)"> <div class="grid grid-1 gap-3 gap-md-4"> @RenderTitle(item, titleFontSize, maxWidth) @RenderText(item, subtitleFontSize, maxWidth) @RenderButton(item, buttonSize) </div> </div> </div> </div> </div> } @helper RenderImage(ItemViewModel item) { if (!string.IsNullOrEmpty(item.GetString("Image"))) { var parms = new Dictionary<string, object>(); parms.Add("cssClass", "h-100 w-100"); parms.Add("columns", Model.GridRowColumnCount); string imageFilter = item.GetRawValueString("ImageFilter", ""); imageFilter = imageFilter == "no-filter" ? "" : imageFilter; imageFilter = imageFilter == "filter" ? " image-filter" : imageFilter; <div class="position-absolute top-0 bottom-0 end-0 start-0@(imageFilter)"> @RenderPartial("Components/Image.cshtml", item.GetFile("Image") ?? new Dynamicweb.Frontend.FileViewModel(), parms) </div> } } @helper RenderTitle(ItemViewModel item, string titleFontSize, string maxWidth) { if (!string.IsNullOrEmpty(item.GetString("Title")) && !item.GetBoolean("HideTitle")) { <h2 class="@titleFontSize m-0"> <span class="@maxWidth">@item.GetString("Title")</span> </h2> } } @helper RenderText(ItemViewModel item, string subtitleFontSize, string maxWidth) { if (!string.IsNullOrEmpty(item.GetString("Text"))) { <p class="@subtitleFontSize lead m-0"> <span class="@maxWidth">@item.GetString("Text")</span> </p> } } @helper RenderButton(ItemViewModel item, string buttonSize) { string linkType = item.GetRawValueString("LinkType", "page"); Dynamicweb.Frontend.LinkViewModel link = new Dynamicweb.Frontend.LinkViewModel(); string StretchedLink = item.GetRawValueString("StretchedLink", ""); StretchedLink = StretchedLink == "item-not-clickable" ? "" : StretchedLink; StretchedLink = StretchedLink == "item-clickable" ? " stretched-link" : StretchedLink; if (linkType == "page" && item.GetLink("ButtonLink") != null) { link = item.GetLink("ButtonLink"); } if (linkType == "product-group") { IList<ProductGroupViewModel> selectedGroups = item.GetValue<IList<ProductGroupViewModel>>("ProductGroupLink"); IList<string> groupIds = new List<string> { }; if (selectedGroups != null) { foreach (var fromGroup in selectedGroups) { groupIds.Add(fromGroup.Id); } } link = new Dynamicweb.Frontend.LinkViewModel() { Url = "/Default.aspx?ID=" + GetPageIdByNavigationTag("Shop") + "&GroupID=" + string.Join(",", groupIds).Trim(), IsExternal = false }; } if (linkType == "product") { ProductListViewModel products = item.GetValue<ProductListViewModel>("ProductLink"); IList<string> productIds = new List<string> { }; if (products != null) { foreach (var product in products.Products) { productIds.Add(product.Id); } } string productParameter = productIds.Count == 1 ? "ProductID" : "MainProductId"; string pageTag = productIds.Count == 1 ? "ProductDetailPage" : "Shop"; link = new Dynamicweb.Frontend.LinkViewModel() { Url = "/Default.aspx?ID=" + GetPageIdByNavigationTag(pageTag) + "&" + productParameter + "=" + string.Join(",", productIds).Trim(), IsExternal = false }; } if (link != null && !string.IsNullOrEmpty(item.GetString("ButtonLabel"))) { string target = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && link.IsExternal ? "target=\"_blank\"" : ""; string rel = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && link.IsExternal ? "rel=\"noopener\"" : ""; string buttonStyle = item.GetRawValueString("ButtonStyle", "primary"); buttonStyle = buttonStyle == "primary" ? "btn-primary" : buttonStyle; buttonStyle = buttonStyle == "secondary" ? "btn-secondary" : buttonStyle; buttonStyle = buttonStyle == "link" ? "btn-link" : buttonStyle; <div class="m-0"> <a href="@link.Url" class="btn @buttonStyle@(buttonSize)@(StretchedLink)" @target @rel>@item.GetString("ButtonLabel")</a> </div> } else if (link != null && !string.IsNullOrEmpty(link.Url)) { string target = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && link.IsExternal ? "target=\"_blank\"" : ""; string rel = Pageview.AreaSettings.GetBoolean("OpenLinksInNewTab") && link.IsExternal ? "rel=\"noopener\"" : ""; <a href="@link.Url" @target @rel class="@StretchedLink"> <span class="visually-hidden">@Model.Item.GetString("Title")</span> </a> } } <script type="module" src="~/Files/Templates/Designs/Swift/Assets/js/tiny-slider.js"></script> <script type="module"> swift.AssetLoader.Load('Files/Templates/Designs/Swift/Assets/css/tiny-slider.css', 'css'); document.addEventListener('load.swift.assetloader', function () { var slider = tns({ container: "#carousel_@uniqueId", controls: false, nav: false, autoplay: @enableAutoplay, autoplayTimeout: @interval, autoplayHoverPause: true, autoplayButtonOutput: false, items: 1, loop: @enableAutoplay, mode: "@animation", rewind: false, arrowKeys: false, lazyload: true, swipeAngle: 30, mouseDrag: true, preventScrollOnTouch: 'auto', responsive: { 992: { controls: @enableControls, mouseDrag: false, controlsText: [ '<span class="tns-controls-icon" style="height:3em; width: 3em;"><span class="visually-hidden">Previous</span><span class="icon-3"><svg viewBox="0 0 16 16" class="bi bi-arrow-left" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M15 8a.5.5 0 0 0-.5-.5H2.707l3.147-3.146a.5.5 0 1 0-.708-.708l-4 4a.5.5 0 0 0 0 .708l4 4a.5.5 0 0 0 .708-.708L2.707 8.5H14.5A.5.5 0 0 0 15 8z"/></svg></span></span>', '<span class="tns-controls-icon" style="height:3em; width: 3em;"><span class="visually-hidden">Next</span><span class="icon-3"><svg viewBox="0 0 16 16" class="bi bi-arrow-right" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M1 8a.5.5 0 0 1 .5-.5h11.793l-3.147-3.146a.5.5 0 0 1 .708-.708l4 4a.5.5 0 0 1 0 .708l-4 4a.5.5 0 0 1-.708-.708L13.293 8.5H1.5A.5.5 0 0 1 1 8z"/></svg></span></span>' ], } } }); }); </script> @if (movePageBehind && isFirstPoster) { <script> ['resize', 'load'].forEach(function (e) { window.addEventListener(e, () => swift.Scroll.setContentPosition()); }); </script> }