Error compiling template "Designs/Swift/Navigation/MegaMenu_Custom.cshtml" Line 18: The type or namespace name 'NineAltitudes' could not be found (are you missing a using directive or an assembly reference?) Line 73: 'IEnumerable' does not contain a definition for 'FindNodes' and no accessible extension method 'FindNodes' accepting a first argument of type 'IEnumerable ' could be found (are you missing a using directive or an assembly reference?) Line 92: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source. Line 93: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source. Line 96: The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. Auto-generated code requires an explicit '#nullable' directive in source. Line 562: 'User.GetCurrentSecondaryUser()' is obsolete: 'Use UserContext.Current.ImpersonatingUser instead.'
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; 11 using Dynamicweb.Ecommerce.Orders; 12 using System.IO; 13 using Dynamicweb.Ecommerce.ProductCatalog; 14 using Dynamicweb.Ecommerce.Common; 15 using System.Text; 16 using Dynamicweb.Frontend; 17 using Dynamicweb.Frontend.Navigation; 18 using NineAltitudes.CustomCode.MegaMenu.ExtensionsMethods; 19 internal class RazorEngine_df3b104504fb4d879bcf0430adb87aab : Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.Navigation.NavigationTreeViewModel> 20 { 21 #pragma warning disable 1998 22 public async override global::System.Threading.Tasks.Task ExecuteAsync() 23 { 24 WriteLiteral("\r\n"); 25 WriteLiteral("\r\n"); 26 27 string theme = !string.IsNullOrEmpty(Model.Parameters["theme"].ToString()) ? Model.Parameters["theme"].ToString() : string.Empty; 28 string highlightedTheme = !string.IsNullOrEmpty(Model.Parameters["highlightedTheme"].ToString()) ? Model.Parameters["highlightedTheme"].ToString() : string.Empty; 29 string linkFontWeight = !string.IsNullOrEmpty(Model.Parameters["LinkFontWeight"].ToString()) ? Model.Parameters["LinkFontWeight"].ToString() : string.Empty; 30 string linkCasing = !string.IsNullOrEmpty(Model.Parameters["LinkCasing"].ToString()) ? Model.Parameters["LinkCasing"].ToString() : string.Empty; 31 string linkFontSize = !string.IsNullOrEmpty(Model.Parameters["LinkFontSize"].ToString()) ? Model.Parameters["LinkFontSize"].ToString() : string.Empty; 32 string layout = !string.IsNullOrEmpty(Model.Parameters["Layout"].ToString()) ? Model.Parameters["Layout"].ToString() : string.Empty; 33 string iconSize = "icon-2"; 34 35 if (linkFontSize == "fs-7") 36 { 37 iconSize = "icon-2"; 38 } 39 if (linkFontSize == "fs-5") 40 { 41 iconSize = "icon-3"; 42 } 43 44 string dropdownLinkHeaderFontWeight = Model.Parameters["DropdownLinkHeaderFontWeight"] != null ? Model.Parameters["DropdownLinkHeaderFontWeight"].ToString() : string.Empty; 45 string dropdownLinkHeaderCasing = Model.Parameters["DropdownLinkHeaderCasing"] != null ? Model.Parameters["DropdownLinkHeaderCasing"].ToString() : string.Empty; 46 string dropdownLinkHeaderFontSize = Model.Parameters["DropdownLinkHeaderFontSize"] != null ? Model.Parameters["DropdownLinkHeaderFontSize"].ToString() : string.Empty; 47 string dropdownLinkFontWeight = Model.Parameters["DropdownLinkFontWeight"] != null ? Model.Parameters["DropdownLinkFontWeight"].ToString() : string.Empty; 48 string dropdownLinkCasing = Model.Parameters["DropdownLinkCasing"] != null ? Model.Parameters["DropdownLinkCasing"].ToString() : string.Empty; 49 string dropdownLinkFontSize = Model.Parameters["DropdownLinkFontSize"] != null ? Model.Parameters["DropdownLinkFontSize"].ToString() : string.Empty; 50 string hiFontWeight = Model.Parameters["HighlightedIndustriesFontWeight"] != null ? Model.Parameters["HighlightedIndustriesFontWeight"].ToString() : string.Empty; 51 string hiCasing = Model.Parameters["HighlightedIndustriesCasing"] != null ? Model.Parameters["HighlightedIndustriesCasing"].ToString() : string.Empty; 52 string hiFontSize = Model.Parameters["HighlightedIndustriesFontSize"] != null ? Model.Parameters["HighlightedIndustriesFontSize"].ToString() : string.Empty; 53 string customTitleFontWeight = Model.Parameters["CustomTitleFontWeight"] != null ? Model.Parameters["CustomTitleFontWeight"].ToString() : string.Empty; 54 string customTitleCasing = Model.Parameters["CustomTitleCasing"] != null ? Model.Parameters["CustomTitleCasing"].ToString() : string.Empty; 55 string customTitleFontSize = Model.Parameters["CustomTitleFontSize"] != null ? Model.Parameters["CustomTitleFontSize"].ToString() : string.Empty; 56 57 string menuId = Model.Parameters.ContainsKey("menu-id") ? $"menu_{Model.Parameters["menu-id"].ToString().ToLower()}" : string.Empty; 58 bool useCustomNavigation = Model.Parameters.ContainsKey("UseCustomNavigation") ? Dynamicweb.Core.Converter.ToBoolean(Model.Parameters["UseCustomNavigation"]) : false; 59 int currentParagraphId = Pageview.CurrentParagraph.ID; 60 61 62 bool hideSubpages = false; 63 if (Pageview.Page.PropertyItem is object && Pageview.Page.PropertyItem.TryGetValue("HideSubpagesCustomNavigation", out object hideSubpagesValue)) 64 { 65 hideSubpages = (bool?)hideSubpagesValue??false; 66 } 67 68 (bool, IEnumerable<NavigationTreeNodeViewModel>) nodesTuple; 69 bool showParentInMenu = false; 70 IEnumerable<NavigationTreeNodeViewModel> navigationNodes = Model.Nodes; 71 if (useCustomNavigation) 72 { 73 nodesTuple = Model.Nodes.FindNodes(Pageview.ID, hideSubpages); 74 showParentInMenu = nodesTuple.Item1; 75 navigationNodes = nodesTuple.Item2; 76 } 77 WriteLiteral("\r\n<nav class=\"d-flex py-0\">\r\n\t<ul"); 78 BeginWriteAttribute("class", " class=\"", 5901, "\"", 5945, 5); 79 WriteAttributeValue("", 5909, "nav", 5909, 3, true); 80 WriteAttributeValue(" ", 5912, "flex-wrap", 5913, 10, true); 81 WriteAttributeValue(" ", 5922, "gap-3", 5923, 6, true); 82 WriteAttributeValue(" ", 5928, "gap-xl-4", 5929, 9, true); 83 WriteAttributeValue(" ", 5937, menuId, 5938, 7, false); 84 EndWriteAttribute(); 85 WriteLiteral(">\r\n"); 86 foreach (var node in navigationNodes) 87 { 88 bool hasHighlightedPages = false; 89 var page = Dynamicweb.Content.Services.Pages.GetPage(node.PageId); 90 var pageType = !string.IsNullOrEmpty(page.ItemType) ? page.ItemType : "Swift_Page"; 91 92 string? buttonLink = page?.PropertyItem?.FirstOrDefault(o => o.Key == "ButtonInNavigation").Value?.ToString(); 93 string? buttonTextFromItem = page?.PropertyItem?.FirstOrDefault(o => o.Key == "ButtonInNavigationText").Value?.ToString(); 94 string buttonText = !String.IsNullOrEmpty(buttonTextFromItem) ? buttonTextFromItem : Translate("MegaMenu:SeeAll", "See all"); 95 96 string? titleInDropdown = page?.PropertyItem?.FirstOrDefault(o => o.Key == "TitleInDropdown").Value?.ToString(); 97 98 string submenuType = "auto"; 99 if (page.PropertyItem is object && page.PropertyItem.TryGetValue("SubmenuType", out object submenuTypeValue)) 100 { 101 submenuType = Dynamicweb.Core.Converter.ToString(submenuTypeValue); 102 } 103 string pageIcon = string.Empty; 104 if (page.PropertyItem is object && page.PropertyItem.TryGetValue("Icon", out object pageIconValue)) 105 { 106 pageIcon = Dynamicweb.Core.Converter.ToString(pageIconValue); 107 } 108 109 var hasChildren = node.Nodes.Count() > 0; 110 var shouldShowChildren = hasChildren && submenuType != "none"; 111 string dropdownAttributes = shouldShowChildren ? " role=\"button\" aria-haspopup=\"true\" aria-expanded=\"false\" data-bs-toggle=\"dropdown\" data-bs-offset=\"0,0\"" : ""; 112 113 submenuType = submenuType == "auto" ? "megamenu" : submenuType; 114 string submenuTypeCss = submenuType == "dropdown" ? " dropdown" : ""; 115 submenuTypeCss = submenuType == "megamenu" ? " dropdown position-static" : submenuTypeCss; 116 117 string nodeId = !string.IsNullOrEmpty(node.GroupId) ? "Megamenu_" + node.GroupId + "_" + currentParagraphId : "Megamenu_Page_" + node.PageId.ToString() + "_" + currentParagraphId; 118 string dataType = !string.IsNullOrEmpty(node.GroupId) ? "group" : "page"; 119 120 WriteLiteral("\t\t\t<li"); 121 BeginWriteAttribute("id", " id=\"", 7941, "\"", 7955, 1); 122 WriteAttributeValue("", 7946, nodeId, 7946, 9, false); 123 EndWriteAttribute(); 124 WriteLiteral(" data-type=\""); 125 Write(dataType); 126 WriteLiteral("\""); 127 BeginWriteAttribute("class", " class=\"", 7978, "\"", 8042, 3); 128 WriteAttributeValue("", 7986, "nav-item", 7986, 8, true); 129 WriteAttributeValue("", 7994, node.IsActive ? " active" : "", 7994, 33, false); 130 WriteAttributeValue("", 8027, submenuTypeCss, 8027, 15, false); 131 EndWriteAttribute(); 132 WriteLiteral(">\r\n"); 133 if (node.IsClickable) 134 { 135 WriteLiteral("\t\t\t\t\t"); 136 WriteLiteral("<a class=\"custom-nav-link nav-link p-0 "); 137 Write(linkFontWeight); 138 WriteLiteral(" "); 139 Write(linkCasing); 140 WriteLiteral(" "); 141 Write(linkFontSize); 142 Write(node.IsActive ? " active" : ""); 143 Write(shouldShowChildren ? " dropdown-toggle" : ""); 144 WriteLiteral("\" href=\""); 145 Write(node.Link); 146 WriteLiteral("\" "); 147 Write(dropdownAttributes); 148 WriteLiteral(" id=\"NavLink_"); 149 Write(nodeId); 150 WriteLiteral("\">\r\n"); 151 } 152 else 153 { 154 WriteLiteral("\t\t\t\t\t"); 155 WriteLiteral("<span class=\"custom-nav-link nav-link p-0 "); 156 Write(linkFontWeight); 157 WriteLiteral(" "); 158 Write(linkCasing); 159 WriteLiteral(" "); 160 Write(linkFontSize); 161 WriteLiteral(" "); 162 Write(shouldShowChildren ? " dropdown-toggle" : ""); 163 WriteLiteral("\" "); 164 Write(dropdownAttributes); 165 WriteLiteral(" id=\"NavLink_"); 166 Write(nodeId); 167 WriteLiteral("\">\r\n"); 168 } 169 WriteLiteral("\r\n\t\t\t\t"); 170 Write(RenderNavigationItem(node, pageType, pageIcon, iconSize, layout)); 171 WriteLiteral("\r\n\r\n"); 172 if (node.IsClickable) 173 { 174 WriteLiteral("\t\t\t\t\t"); 175 WriteLiteral("</a>\r\n"); 176 } 177 else 178 { 179 WriteLiteral("\t\t\t\t"); 180 WriteLiteral("</span>\r\n"); 181 } 182 WriteLiteral("\r\n"); 183 if (!showParentInMenu && shouldShowChildren) 184 { 185 if (submenuType == "megamenu") 186 { 187 WriteLiteral("\t\t\t\t\t\t\t<div"); 188 BeginWriteAttribute("class", " class=\"", 8823, "\"", 8898, 5); 189 WriteAttributeValue("", 8831, "dropdown-menu", 8831, 13, true); 190 WriteAttributeValue(" ", 8844, "custom-dropdown-menu", 8845, 21, true); 191 WriteAttributeValue(" ", 8865, "negativeLeftMargin", 8866, 19, true); 192 WriteAttributeValue(" ", 8884, "p-0", 8885, 4, true); 193 WriteAttributeValue(" ", 8888, theme, 8890, 8, false); 194 EndWriteAttribute(); 195 WriteLiteral(" style=\"max-width:100%;\""); 196 BeginWriteAttribute("aria-labelledby", " aria-labelledby=\"", 8923, "\"", 8948, 1); 197 WriteAttributeValue("", 8941, nodeId, 8941, 7, false); 198 EndWriteAttribute(); 199 BeginWriteAttribute("id", " id=\"", 8949, "\"", 8971, 2); 200 WriteAttributeValue("", 8954, "NavGroup", 8954, 8, true); 201 WriteAttributeValue("", 8962, nodeId, 8962, 9, false); 202 EndWriteAttribute(); 203 WriteLiteral("> \r\n\t\t\t\t\t\t\t<div class=\"container-xl p-0 overflow-y-auto\">\t\t\t\t\t\t\t\t\t\r\n"); 204 string colSize = node.Nodes.Count() == 1 ? "g-col-12" : node.Nodes.Count() == 2 ? "g-col-6" : "g-col-4";WriteLiteral("\t\t\t\t\t\t\t\t<div class=\"p-4\">\r\n"); 205 if (!string.IsNullOrWhiteSpace(titleInDropdown)) 206 { 207 WriteLiteral("\t\t\t\t\t\t\t\t\t<div><span"); 208 BeginWriteAttribute("class", " class=\"", 9309, "\"", 9388, 5); 209 WriteAttributeValue("", 9317, "m-0", 9317, 3, true); 210 WriteAttributeValue(" ", 9320, "px-4", 9321, 5, true); 211 WriteAttributeValue(" ", 9325, customTitleFontWeight, 9326, 22, false); 212 WriteAttributeValue(" ", 9348, customTitleCasing, 9349, 18, false); 213 WriteAttributeValue(" ", 9367, customTitleFontSize, 9368, 20, false); 214 EndWriteAttribute(); 215 WriteLiteral(" style=\"color:var(--swift-accent-color)\">"); 216 Write(titleInDropdown); 217 WriteLiteral("</span></div>\r\n"); 218 } 219 WriteLiteral("\t\t\t\t\t\t\t\t\t<div class=\"grid\">\r\n\t\t\t\t\t\t\t\t\t\r\n"); 220 foreach (var subnode in node.Nodes) 221 { 222 var subPage = Dynamicweb.Content.Services.Pages.GetPage(subnode.PageId); 223 bool? isHighlighted = (bool?)subPage?.PropertyItem?.FirstOrDefault(o => o.Key == "IsHighlighted").Value; 224 225 226 if (isHighlighted==true) 227 { 228 hasHighlightedPages = true; 229 continue; 230 } 231 nodeId = !string.IsNullOrEmpty(subnode.GroupId) ? "Megamenu_" + subnode.GroupId + "_" + currentParagraphId : "Megamenu_Page_" + subnode.PageId.ToString() + "_" + currentParagraphId; 232 dataType = !string.IsNullOrEmpty(subnode.GroupId) ? "group" : "page"; 233 234 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t\t<div"); 235 BeginWriteAttribute("class", " class=\"", 10234, "\"", 10255, 2); 236 WriteAttributeValue("", 10242, colSize, 10242, 8, false); 237 WriteAttributeValue(" ", 10250, "px-4", 10251, 5, true); 238 EndWriteAttribute(); 239 WriteLiteral(">\t\t\t\t\r\n"); 240 if (subnode.IsClickable) 241 { 242 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t\t\t"); 243 WriteLiteral("<a id=\""); 244 Write(nodeId); 245 WriteLiteral("\" data-type=\""); 246 Write(dataType); 247 WriteLiteral("\" href=\""); 248 Write(subnode.Link); 249 WriteLiteral("\" class=\"custom-nav-link nav-link px-0 text-decoration-underline-hover lh-sm text-break\">\r\n"); 250 } else { 251 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t\t\t"); 252 WriteLiteral("<div id=\""); 253 Write(nodeId); 254 WriteLiteral("\" data-type=\""); 255 Write(dataType); 256 WriteLiteral("\" class=\"custom-nav-link nav-link px-0 lh-sm text-break\">\r\n"); 257 } 258 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t\t\t<span"); 259 BeginWriteAttribute("class", " class=\"", 10652, "\"", 10747, 4); 260 WriteAttributeValue("", 10660, "m-0", 10660, 3, true); 261 WriteAttributeValue(" ", 10663, dropdownLinkHeaderFontWeight, 10664, 29, false); 262 WriteAttributeValue(" ", 10693, dropdownLinkHeaderCasing, 10694, 25, false); 263 WriteAttributeValue(" ", 10719, dropdownLinkHeaderFontSize, 10720, 27, false); 264 EndWriteAttribute(); 265 WriteLiteral(">"); 266 Write(subnode.Name); 267 WriteLiteral("</span>\t\t\t\t\t\t\t\t\t\t\r\n"); 268 if (subnode.IsClickable) 269 { 270 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t\t\t"); 271 WriteLiteral("</a>\r\n"); 272 } 273 else 274 { 275 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t\t\t"); 276 WriteLiteral("</div>\r\n"); 277 } 278 WriteLiteral("\r\n"); 279 if (!subnode.IsClickable && subnode.Nodes.Any()) 280 { 281 foreach (var subsubnode in subnode.Nodes) 282 { 283 nodeId = !string.IsNullOrEmpty(subsubnode.GroupId) ? "Megamenu_" + subsubnode.GroupId + "_" + currentParagraphId : "Megamenu_Page_" + subsubnode.PageId.ToString() + "_" + currentParagraphId; 284 dataType = !string.IsNullOrEmpty(subsubnode.GroupId) ? "group" : "page"; 285 286 if (subsubnode.IsClickable) { 287 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"); 288 WriteLiteral("<a id=\""); 289 Write(nodeId); 290 WriteLiteral("\" data-type=\""); 291 Write(dataType); 292 WriteLiteral("\" class=\"custom-nav-link nav-link px-0 text-decoration-underline-hover lh-sm text-break\" href=\""); 293 Write(subsubnode.Link); 294 WriteLiteral("\" "); 295 Write(subnode.IsActive ? " aria-current='page'" : ""); 296 WriteLiteral(">\r\n"); 297 } else { 298 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"); 299 WriteLiteral("<div id=\""); 300 Write(nodeId); 301 WriteLiteral("\" data-type=\""); 302 Write(dataType); 303 WriteLiteral("\" class=\"custom-nav-link nav-link px-0 lh-sm text-break\" "); 304 Write(subnode.IsActive ? " aria-current='page'" : ""); 305 WriteLiteral(">\r\n"); 306 } 307 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span"); 308 BeginWriteAttribute("class", " class=\"", 11896, "\"", 11969, 3); 309 WriteAttributeValue("", 11904, dropdownLinkFontWeight, 11904, 23, false); 310 WriteAttributeValue(" ", 11927, dropdownLinkCasing, 11928, 19, false); 311 WriteAttributeValue(" ", 11947, dropdownLinkFontSize, 11948, 21, false); 312 EndWriteAttribute(); 313 WriteLiteral(">"); 314 Write(subsubnode.Name); 315 WriteLiteral("</span>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n"); 316 if (subsubnode.IsClickable) 317 { 318 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"); 319 WriteLiteral("</a>\t\r\n"); 320 } 321 else 322 { 323 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"); 324 WriteLiteral("</div>\r\n"); 325 } 326 } 327 } 328 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t</div>\r\n"); 329 } 330 WriteLiteral("\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t</div>\r\n\r\n"); 331 if (hasHighlightedPages) { 332 WriteLiteral("\t\t\t\t\t\t\t\t<div"); 333 BeginWriteAttribute("class", " class=\"", 12366, "\"", 12415, 3); 334 WriteAttributeValue("", 12374, "p-4", 12374, 3, true); 335 WriteAttributeValue(" ", 12377, "highlightedMenuPart", 12378, 20, true); 336 WriteAttributeValue(" ", 12397, highlightedTheme, 12398, 17, false); 337 EndWriteAttribute(); 338 WriteLiteral(" >\r\n\t\t\t\t\t\t\t\t\t\t<div>\r\n\t\t\t\t\t\t\t\t\t\t\t<span"); 339 BeginWriteAttribute("class", " class=\"", 12453, "\"", 12505, 5); 340 WriteAttributeValue("", 12461, "m-0", 12461, 3, true); 341 WriteAttributeValue(" ", 12464, "px-4", 12465, 5, true); 342 WriteAttributeValue(" ", 12469, hiFontWeight, 12470, 13, false); 343 WriteAttributeValue(" ", 12483, hiCasing, 12484, 9, false); 344 WriteAttributeValue(" ", 12493, hiFontSize, 12494, 11, false); 345 EndWriteAttribute(); 346 WriteLiteral(" style=\"color:var(--swift-accent-color)\">"); 347 Write(Translate("Highlighted Industries")); 348 WriteLiteral("</span>\t\r\n\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\t<div class=\"grid\">\r\n"); 349 string colSizeHightlighted = node.Nodes.Count() == 1 ? "g-col-12" : node.Nodes.Count() == 2 ? "g-col-6" : "g-col-4"; foreach (var subnode in node.Nodes) 350 { 351 352 var subPage = Dynamicweb.Content.Services.Pages.GetPage(subnode.PageId); 353 bool? isHighlighted = (bool?)subPage?.PropertyItem?.FirstOrDefault(o => o.Key == "IsHighlighted").Value; 354 355 if (isHighlighted!=true) 356 { 357 continue; 358 } 359 nodeId = !string.IsNullOrEmpty(subnode.GroupId) ? "Megamenu_" + subnode.GroupId + "_" + currentParagraphId : "Megamenu_Page_" + subnode.PageId.ToString() + "_" + currentParagraphId; 360 dataType = !string.IsNullOrEmpty(subnode.GroupId) ? "group" : "page"; 361 362 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t\t<div"); 363 BeginWriteAttribute("class", " class=\"", 13463, "\"", 13484, 2); 364 WriteAttributeValue("", 13471, colSize, 13471, 8, false); 365 WriteAttributeValue(" ", 13479, "px-4", 13480, 5, true); 366 EndWriteAttribute(); 367 WriteLiteral(">\r\n"); 368 if (subnode.IsClickable) 369 { 370 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t\t\t"); 371 WriteLiteral("<a id=\""); 372 Write(nodeId); 373 WriteLiteral("\" data-type=\""); 374 Write(dataType); 375 WriteLiteral("\" href=\""); 376 Write(subnode.Link); 377 WriteLiteral("\" class=\"custom-nav-link nav-link px-0 text-decoration-underline-hover lh-sm text-break\">\r\n"); 378 } else { 379 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t\t\t"); 380 WriteLiteral("<div id=\""); 381 Write(nodeId); 382 WriteLiteral("\" data-type=\""); 383 Write(dataType); 384 WriteLiteral("\" class=\"custom-nav-link nav-link px-0 lh-sm text-break\">\r\n"); 385 } 386 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t\t\t<span"); 387 BeginWriteAttribute("class", " class=\"", 13877, "\"", 13972, 4); 388 WriteAttributeValue("", 13885, "m-0", 13885, 3, true); 389 WriteAttributeValue(" ", 13888, dropdownLinkHeaderFontWeight, 13889, 29, false); 390 WriteAttributeValue(" ", 13918, dropdownLinkHeaderCasing, 13919, 25, false); 391 WriteAttributeValue(" ", 13944, dropdownLinkHeaderFontSize, 13945, 27, false); 392 EndWriteAttribute(); 393 WriteLiteral(">"); 394 Write(subnode.Name); 395 WriteLiteral("</span>\t\t\t\t\t\t\t\t\t\t\r\n"); 396 if (subnode.IsClickable) 397 { 398 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t\t\t"); 399 WriteLiteral("</a>\r\n"); 400 } 401 else 402 { 403 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t\t\t"); 404 WriteLiteral("</div>\r\n"); 405 } 406 WriteLiteral("\r\n"); 407 if (!subnode.IsClickable && subnode.Nodes.Any()) 408 { 409 foreach (var subsubnode in subnode.Nodes) 410 { 411 nodeId = !string.IsNullOrEmpty(subsubnode.GroupId) ? "Megamenu_" + subsubnode.GroupId + "_" + currentParagraphId : "Megamenu_Page_" + subsubnode.PageId.ToString() + "_" + currentParagraphId; 412 dataType = !string.IsNullOrEmpty(subsubnode.GroupId) ? "group" : "page"; 413 414 if (subsubnode.IsClickable) { 415 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"); 416 WriteLiteral("<a id=\""); 417 Write(nodeId); 418 WriteLiteral("\" data-type=\""); 419 Write(dataType); 420 WriteLiteral("\" class=\"custom-nav-link nav-link px-0 text-decoration-underline-hover lh-sm text-break\" href=\""); 421 Write(subsubnode.Link); 422 WriteLiteral("\" "); 423 Write(subnode.IsActive ? " aria-current='page'" : ""); 424 WriteLiteral(">\r\n"); 425 } else { 426 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"); 427 WriteLiteral("<div id=\""); 428 Write(nodeId); 429 WriteLiteral("\" data-type=\""); 430 Write(dataType); 431 WriteLiteral("\" class=\"custom-nav-link nav-link px-0 lh-sm text-break\" "); 432 Write(subnode.IsActive ? " aria-current='page'" : ""); 433 WriteLiteral(">\r\n"); 434 } 435 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span"); 436 BeginWriteAttribute("class", " class=\"", 15121, "\"", 15194, 3); 437 WriteAttributeValue("", 15129, dropdownLinkFontWeight, 15129, 23, false); 438 WriteAttributeValue(" ", 15152, dropdownLinkCasing, 15153, 19, false); 439 WriteAttributeValue(" ", 15172, dropdownLinkFontSize, 15173, 21, false); 440 EndWriteAttribute(); 441 WriteLiteral(">"); 442 Write(subsubnode.Name); 443 WriteLiteral("</span>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n"); 444 if (subsubnode.IsClickable) 445 { 446 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"); 447 WriteLiteral("</a>\t\r\n"); 448 } 449 else 450 { 451 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"); 452 WriteLiteral("</div>\r\n"); 453 } 454 } 455 } 456 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t</div>\r\n"); 457 } 458 WriteLiteral("\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t</div>\r\n"); 459 } 460 if(!String.IsNullOrEmpty(buttonLink)){ 461 WriteLiteral("\t\t\t\t\t\t\t\t\t\t<div class=\"d-flex flex-wrap justify-content-center py-3\">\r\n\t\t\t\t\t\t\t\t\t\t\t<a"); 462 BeginWriteAttribute("href", " href=\"", 15674, "\"", 15692, 1); 463 WriteAttributeValue("", 15681, buttonLink, 15681, 11, false); 464 EndWriteAttribute(); 465 WriteLiteral(" class=\"btn btn-primary\">"); 466 Write(buttonText); 467 WriteLiteral("</a>\r\n\t\t\t\t\t\t\t\t\t\t</div>\r\n"); 468 } 469 WriteLiteral("\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t</div>\r\n"); 470 } 471 else if(submenuType == "dropdown") 472 { 473 WriteLiteral("\t\t\t\t\t\t\t\t<ul"); 474 BeginWriteAttribute("class", " class=\"", 15886, "\"", 15941, 4); 475 WriteAttributeValue("", 15894, "dropdown-menu", 15894, 13, true); 476 WriteAttributeValue(" ", 15907, "custom-dropdown-menu", 15908, 21, true); 477 WriteAttributeValue(" ", 15928, "p-4", 15929, 4, true); 478 WriteAttributeValue(" ", 15932, theme, 15933, 8, false); 479 EndWriteAttribute(); 480 BeginWriteAttribute("aria-labelledby", " aria-labelledby=\"", 15942, "\"", 15967, 1); 481 WriteAttributeValue("", 15960, nodeId, 15960, 7, false); 482 EndWriteAttribute(); 483 WriteLiteral(">\r\n"); 484 if (pageType == "Swift_SignIn") 485 { 486 if (Pageview.User == null) 487 { 488 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t<li>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<a"); 489 BeginWriteAttribute("href", " href=\"", 16108, "\"", 16125, 1); 490 WriteAttributeValue("", 16115, node.Link, 16115, 10, false); 491 EndWriteAttribute(); 492 BeginWriteAttribute("class", " class=\"", 16126, "\"", 16231, 7); 493 WriteAttributeValue("", 16134, "px-3", 16134, 4, true); 494 WriteAttributeValue(" ", 16138, "py-2", 16139, 5, true); 495 WriteAttributeValue(" ", 16143, "dropdown-item", 16144, 14, true); 496 WriteAttributeValue(" ", 16157, "text-decoration-underline-hover", 16158, 32, true); 497 WriteAttributeValue(" ", 16189, linkFontWeight, 16190, 15, false); 498 WriteAttributeValue(" ", 16205, linkCasing, 16206, 11, false); 499 WriteAttributeValue(" ", 16217, linkFontSize, 16218, 13, false); 500 EndWriteAttribute(); 501 WriteLiteral(" "); 502 Write(node.IsActive ? " aria-current='page'" : ""); 503 WriteLiteral(">"); 504 Write(node.Name); 505 WriteLiteral("</a>\r\n\t\t\t\t\t\t\t\t\t\t\t</li>\r\n"); 506 } 507 } 508 WriteLiteral("\r\n"); 509 foreach (var subnode in node.Nodes) 510 { 511 WriteLiteral("\t\t\t\t\t\t\t\t\t\t<li>\r\n"); 512 if (subnode.IsClickable) 513 { 514 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t\t<a"); 515 BeginWriteAttribute("class", " class=\"", 16482, "\"", 16603, 8); 516 WriteAttributeValue("", 16490, "custom-nav-link", 16490, 15, true); 517 WriteAttributeValue(" ", 16505, "px-3", 16506, 5, true); 518 WriteAttributeValue(" ", 16510, "py-2", 16511, 5, true); 519 WriteAttributeValue(" ", 16515, "dropdown-item", 16516, 14, true); 520 WriteAttributeValue(" ", 16529, "text-decoration-underline-hover", 16530, 32, true); 521 WriteAttributeValue(" ", 16561, linkFontWeight, 16562, 15, false); 522 WriteAttributeValue(" ", 16577, linkCasing, 16578, 11, false); 523 WriteAttributeValue(" ", 16589, linkFontSize, 16590, 13, false); 524 EndWriteAttribute(); 525 BeginWriteAttribute("href", " href=\"", 16604, "\"", 16624, 1); 526 WriteAttributeValue("", 16611, subnode.Link, 16611, 13, false); 527 EndWriteAttribute(); 528 WriteLiteral(" "); 529 Write(node.IsActive ? " aria-current='page'" : ""); 530 WriteLiteral(">"); 531 Write(subnode.Name); 532 WriteLiteral("</a>\r\n"); 533 } 534 else 535 { 536 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t\t<span"); 537 BeginWriteAttribute("class", " class=\"", 16754, "\"", 16827, 6); 538 WriteAttributeValue("", 16762, "px-3", 16762, 4, true); 539 WriteAttributeValue(" ", 16766, "py-2", 16767, 5, true); 540 WriteAttributeValue(" ", 16771, "dropdown-item", 16772, 14, true); 541 WriteAttributeValue(" ", 16785, linkFontWeight, 16786, 15, false); 542 WriteAttributeValue(" ", 16801, linkCasing, 16802, 11, false); 543 WriteAttributeValue(" ", 16813, linkFontSize, 16814, 13, false); 544 EndWriteAttribute(); 545 WriteLiteral(" "); 546 Write(node.IsActive ? " aria-current='page'" : ""); 547 WriteLiteral(">"); 548 Write(subnode.Name); 549 WriteLiteral("</span>\r\n"); 550 } 551 WriteLiteral("\t\t\t\t\t\t\t\t\t\t</li>\r\n"); 552 } 553 WriteLiteral("\r\n"); 554 if (pageType == "Swift_SignIn") 555 { 556 if (Pageview.User != null) 557 { 558 string link = "/Admin/Public/ExtranetLogoff.aspx?redirect=no"; 559 560 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t<li><hr class=\"dropdown-divider\"></li>\r\n"); 561 562 if (Dynamicweb.Security.UserManagement.User.GetCurrentSecondaryUser() != null) 563 { 564 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t\t<li>\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<a"); 565 BeginWriteAttribute("href", " href=\"", 17317, "\"", 17386, 3); 566 WriteAttributeValue("", 17324, "Default.aspx?ID=", 17324, 16, true); 567 WriteAttributeValue("", 17340, Pageview.ID, 17340, 14, false); 568 WriteAttributeValue("", 17354, "&DwExtranetRemoveSecondaryUser=1", 17354, 32, true); 569 EndWriteAttribute(); 570 BeginWriteAttribute("class", " class=\"", 17387, "\"", 17524, 8); 571 WriteAttributeValue("", 17395, "px-3", 17395, 4, true); 572 WriteAttributeValue(" ", 17399, "py-2", 17400, 5, true); 573 WriteAttributeValue(" ", 17404, "dropdown-item", 17405, 14, true); 574 WriteAttributeValue(" ", 17418, "text-decoration-underline-hover", 17419, 32, true); 575 WriteAttributeValue(" ", 17450, "swift_sign-out-as-customer-link", 17451, 32, true); 576 WriteAttributeValue(" ", 17482, linkFontWeight, 17483, 15, false); 577 WriteAttributeValue(" ", 17498, linkCasing, 17499, 11, false); 578 WriteAttributeValue(" ", 17510, linkFontSize, 17511, 13, false); 579 EndWriteAttribute(); 580 WriteLiteral(" "); 581 Write(node.IsActive ? " aria-current='page'" : ""); 582 WriteLiteral(">"); 583 Write(Translate("Sign out as a customer")); 584 WriteLiteral("</a>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</li>\r\n"); 585 } 586 WriteLiteral("\t\t\t\t\t\t\t\t\t\t\t<li>\r\n\t\t\t\t\t\t\t\t\t\t\t\t<a"); 587 BeginWriteAttribute("href", " href=\"", 17679, "\"", 17691, 1); 588 WriteAttributeValue("", 17686, link, 17686, 5, false); 589 EndWriteAttribute(); 590 BeginWriteAttribute("class", " class=\"", 17692, "\"", 17817, 8); 591 WriteAttributeValue("", 17700, "px-3", 17700, 4, true); 592 WriteAttributeValue(" ", 17704, "py-2", 17705, 5, true); 593 WriteAttributeValue(" ", 17709, "dropdown-item", 17710, 14, true); 594 WriteAttributeValue(" ", 17723, "text-decoration-underline-hover", 17724, 32, true); 595 WriteAttributeValue(" ", 17755, "swift_sign-out-link", 17756, 20, true); 596 WriteAttributeValue(" ", 17775, linkFontWeight, 17776, 15, false); 597 WriteAttributeValue(" ", 17791, linkCasing, 17792, 11, false); 598 WriteAttributeValue(" ", 17803, linkFontSize, 17804, 13, false); 599 EndWriteAttribute(); 600 WriteLiteral(" "); 601 Write(node.IsActive ? " aria-current='page'" : ""); 602 WriteLiteral(">"); 603 Write(Translate("Sign out")); 604 WriteLiteral("</a>\r\n\t\t\t\t\t\t\t\t\t\t\t</li>\r\n"); 605 } 606 607 } 608 WriteLiteral("\t\t\t\t\t\t\t\t\t<li>\r\n"); 609 if(!String.IsNullOrEmpty(buttonLink)){ 610 WriteLiteral("\t\t\t\t\t\t\t\t\t\t<div class=\"d-flex flex-wrap justify-content-center py-3\">\r\n\t\t\t\t\t\t\t\t\t\t\t<a"); 611 BeginWriteAttribute("href", " href=\"", 18088, "\"", 18106, 1); 612 WriteAttributeValue("", 18095, buttonLink, 18095, 11, false); 613 EndWriteAttribute(); 614 WriteLiteral(" class=\"btn btn-primary\">"); 615 Write(buttonText); 616 WriteLiteral("</a>\r\n\t\t\t\t\t\t\t\t\t\t</div>\r\n"); 617 } 618 WriteLiteral("\t\t\t\t\t\t\t\t\t</li>\r\n\t\t\t\t\t\t\t\t</ul>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n"); 619 } 620 } 621 WriteLiteral("\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t</li>\r\n"); 622 } 623 WriteLiteral("\t</ul>\r\n</nav>\r\n"); 624 } 625 #pragma warning restore 1998 626 627 string RenderNavigationItem(Dynamicweb.Frontend.Navigation.NavigationTreeNodeViewModel node, string pageType, string pageIcon, string iconSize, string layout) 628 { 629 var page = Dynamicweb.Content.Services.Pages.GetPage(node.PageId); 630 631 bool iconValid = pageIcon.EndsWith(".svg", StringComparison.OrdinalIgnoreCase) && !pageIcon.EndsWith("none.svg", StringComparison.OrdinalIgnoreCase); 632 string iconPath = iconValid ? Dynamicweb.Context.Current.Server.MapPath(pageIcon) : string.Empty; 633 634 string iconRender = iconValid ? $"<span class=\"{iconSize}\">{ReadFile(iconPath)}</span>" : string.Empty; 635 string nameRender = $"<span class=\"text-wrap-nowrap\">{node.Name}</span>"; 636 637 List<string> navigationItemBuilder = new List<string>(); 638 navigationItemBuilder.Add(layout.ToLower().StartsWith("link") ? nameRender : iconRender); 639 navigationItemBuilder.Add(layout.ToLower().EndsWith("icons") ? iconRender : layout.ToLower().EndsWith("links") ? nameRender : string.Empty); 640 641 return string.Join(" ", navigationItemBuilder); 642 } 643 644 645 public string GetImagePathSanitized(string imagePath) 646 { 647 if (!imagePath.StartsWith("/Files", StringComparison.OrdinalIgnoreCase)) 648 { 649 if (!imagePath.StartsWith("Files/", StringComparison.OrdinalIgnoreCase)) 650 { 651 imagePath = $"/Files/Images/{imagePath}"; 652 } 653 } 654 return imagePath; 655 } 656 } 657 } 658 #pragma warning restore 1591 659
1 @* This is a copy of MegaMenu.cshtml, where everything regarding products and cart is removed, as the customer has no products. This is removed for readability. There is also custom code in here. *@ 2 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.Navigation.NavigationTreeViewModel> 3 @using Dynamicweb 4 @using Dynamicweb.Ecommerce.Orders 5 @using System.IO 6 @using Dynamicweb.Ecommerce.ProductCatalog 7 @using Dynamicweb.Ecommerce.Common 8 @using System.Text 9 @using Dynamicweb.Frontend 10 @using Dynamicweb.Frontend.Navigation 11 @using NineAltitudes.CustomCode.MegaMenu.ExtensionsMethods 12 13 @functions { 14 string RenderNavigationItem(Dynamicweb.Frontend.Navigation.NavigationTreeNodeViewModel node, string pageType, string pageIcon, string iconSize, string layout) 15 { 16 var page = Dynamicweb.Content.Services.Pages.GetPage(node.PageId); 17 18 bool iconValid = pageIcon.EndsWith(".svg", StringComparison.OrdinalIgnoreCase) && !pageIcon.EndsWith("none.svg", StringComparison.OrdinalIgnoreCase); 19 string iconPath = iconValid ? Dynamicweb.Context.Current.Server.MapPath(pageIcon) : string.Empty; 20 21 string iconRender = iconValid ? $"<span class=\"{iconSize}\">{ReadFile(iconPath)}</span>" : string.Empty; 22 string nameRender = $"<span class=\"text-wrap-nowrap\">{node.Name}</span>"; 23 24 List<string> navigationItemBuilder = new List<string>(); 25 navigationItemBuilder.Add(layout.ToLower().StartsWith("link") ? nameRender : iconRender); 26 navigationItemBuilder.Add(layout.ToLower().EndsWith("icons") ? iconRender : layout.ToLower().EndsWith("links") ? nameRender : string.Empty); 27 28 return string.Join(" ", navigationItemBuilder); 29 } 30 31 32 public string GetImagePathSanitized(string imagePath) 33 { 34 if (!imagePath.StartsWith("/Files", StringComparison.OrdinalIgnoreCase)) 35 { 36 if (!imagePath.StartsWith("Files/", StringComparison.OrdinalIgnoreCase)) 37 { 38 imagePath = $"/Files/Images/{imagePath}"; 39 } 40 } 41 return imagePath; 42 } 43 } 44 45 @{ 46 string theme = !string.IsNullOrEmpty(Model.Parameters["theme"].ToString()) ? Model.Parameters["theme"].ToString() : string.Empty; 47 string highlightedTheme = !string.IsNullOrEmpty(Model.Parameters["highlightedTheme"].ToString()) ? Model.Parameters["highlightedTheme"].ToString() : string.Empty; 48 string linkFontWeight = !string.IsNullOrEmpty(Model.Parameters["LinkFontWeight"].ToString()) ? Model.Parameters["LinkFontWeight"].ToString() : string.Empty; 49 string linkCasing = !string.IsNullOrEmpty(Model.Parameters["LinkCasing"].ToString()) ? Model.Parameters["LinkCasing"].ToString() : string.Empty; 50 string linkFontSize = !string.IsNullOrEmpty(Model.Parameters["LinkFontSize"].ToString()) ? Model.Parameters["LinkFontSize"].ToString() : string.Empty; 51 string layout = !string.IsNullOrEmpty(Model.Parameters["Layout"].ToString()) ? Model.Parameters["Layout"].ToString() : string.Empty; 52 string iconSize = "icon-2"; 53 54 if (linkFontSize == "fs-7") 55 { 56 iconSize = "icon-2"; 57 } 58 if (linkFontSize == "fs-5") 59 { 60 iconSize = "icon-3"; 61 } 62 63 string dropdownLinkHeaderFontWeight = Model.Parameters["DropdownLinkHeaderFontWeight"] != null ? Model.Parameters["DropdownLinkHeaderFontWeight"].ToString() : string.Empty; 64 string dropdownLinkHeaderCasing = Model.Parameters["DropdownLinkHeaderCasing"] != null ? Model.Parameters["DropdownLinkHeaderCasing"].ToString() : string.Empty; 65 string dropdownLinkHeaderFontSize = Model.Parameters["DropdownLinkHeaderFontSize"] != null ? Model.Parameters["DropdownLinkHeaderFontSize"].ToString() : string.Empty; 66 string dropdownLinkFontWeight = Model.Parameters["DropdownLinkFontWeight"] != null ? Model.Parameters["DropdownLinkFontWeight"].ToString() : string.Empty; 67 string dropdownLinkCasing = Model.Parameters["DropdownLinkCasing"] != null ? Model.Parameters["DropdownLinkCasing"].ToString() : string.Empty; 68 string dropdownLinkFontSize = Model.Parameters["DropdownLinkFontSize"] != null ? Model.Parameters["DropdownLinkFontSize"].ToString() : string.Empty; 69 string hiFontWeight = Model.Parameters["HighlightedIndustriesFontWeight"] != null ? Model.Parameters["HighlightedIndustriesFontWeight"].ToString() : string.Empty; 70 string hiCasing = Model.Parameters["HighlightedIndustriesCasing"] != null ? Model.Parameters["HighlightedIndustriesCasing"].ToString() : string.Empty; 71 string hiFontSize = Model.Parameters["HighlightedIndustriesFontSize"] != null ? Model.Parameters["HighlightedIndustriesFontSize"].ToString() : string.Empty; 72 string customTitleFontWeight = Model.Parameters["CustomTitleFontWeight"] != null ? Model.Parameters["CustomTitleFontWeight"].ToString() : string.Empty; 73 string customTitleCasing = Model.Parameters["CustomTitleCasing"] != null ? Model.Parameters["CustomTitleCasing"].ToString() : string.Empty; 74 string customTitleFontSize = Model.Parameters["CustomTitleFontSize"] != null ? Model.Parameters["CustomTitleFontSize"].ToString() : string.Empty; 75 76 string menuId = Model.Parameters.ContainsKey("menu-id") ? $"menu_{Model.Parameters["menu-id"].ToString().ToLower()}" : string.Empty; 77 bool useCustomNavigation = Model.Parameters.ContainsKey("UseCustomNavigation") ? Dynamicweb.Core.Converter.ToBoolean(Model.Parameters["UseCustomNavigation"]) : false; 78 int currentParagraphId = Pageview.CurrentParagraph.ID; 79 80 81 bool hideSubpages = false; 82 if (Pageview.Page.PropertyItem is object && Pageview.Page.PropertyItem.TryGetValue("HideSubpagesCustomNavigation", out object hideSubpagesValue)) 83 { 84 hideSubpages = (bool?)hideSubpagesValue??false; 85 } 86 87 (bool, IEnumerable<NavigationTreeNodeViewModel>) nodesTuple; 88 bool showParentInMenu = false; 89 IEnumerable<NavigationTreeNodeViewModel> navigationNodes = Model.Nodes; 90 if (useCustomNavigation) 91 { 92 nodesTuple = Model.Nodes.FindNodes(Pageview.ID, hideSubpages); 93 showParentInMenu = nodesTuple.Item1; 94 navigationNodes = nodesTuple.Item2; 95 } 96 } 97 98 <nav class="d-flex py-0"> 99 <ul class="nav flex-wrap gap-3 gap-xl-4 @menuId"> 100 @foreach (var node in navigationNodes) 101 { 102 bool hasHighlightedPages = false; 103 var page = Dynamicweb.Content.Services.Pages.GetPage(node.PageId); 104 var pageType = !string.IsNullOrEmpty(page.ItemType) ? page.ItemType : "Swift_Page"; 105 106 string? buttonLink = page?.PropertyItem?.FirstOrDefault(o => o.Key == "ButtonInNavigation").Value?.ToString(); 107 string? buttonTextFromItem = page?.PropertyItem?.FirstOrDefault(o => o.Key == "ButtonInNavigationText").Value?.ToString(); 108 string buttonText = !String.IsNullOrEmpty(buttonTextFromItem) ? buttonTextFromItem : Translate("MegaMenu:SeeAll", "See all"); 109 110 string? titleInDropdown = page?.PropertyItem?.FirstOrDefault(o => o.Key == "TitleInDropdown").Value?.ToString(); 111 112 string submenuType = "auto"; 113 if (page.PropertyItem is object && page.PropertyItem.TryGetValue("SubmenuType", out object submenuTypeValue)) 114 { 115 submenuType = Dynamicweb.Core.Converter.ToString(submenuTypeValue); 116 } 117 string pageIcon = string.Empty; 118 if (page.PropertyItem is object && page.PropertyItem.TryGetValue("Icon", out object pageIconValue)) 119 { 120 pageIcon = Dynamicweb.Core.Converter.ToString(pageIconValue); 121 } 122 123 var hasChildren = node.Nodes.Count() > 0; 124 var shouldShowChildren = hasChildren && submenuType != "none"; 125 string dropdownAttributes = shouldShowChildren ? " role=\"button\" aria-haspopup=\"true\" aria-expanded=\"false\" data-bs-toggle=\"dropdown\" data-bs-offset=\"0,0\"" : ""; 126 127 submenuType = submenuType == "auto" ? "megamenu" : submenuType; 128 string submenuTypeCss = submenuType == "dropdown" ? " dropdown" : ""; 129 submenuTypeCss = submenuType == "megamenu" ? " dropdown position-static" : submenuTypeCss; 130 131 string nodeId = !string.IsNullOrEmpty(node.GroupId) ? "Megamenu_" + node.GroupId + "_" + currentParagraphId : "Megamenu_Page_" + node.PageId.ToString() + "_" + currentParagraphId; 132 string dataType = !string.IsNullOrEmpty(node.GroupId) ? "group" : "page"; 133 134 <li id="@(nodeId)" data-type="@dataType" class="nav-item@(node.IsActive ? " active" : "")@submenuTypeCss"> 135 @if (node.IsClickable) 136 { 137 @:<a class="custom-nav-link nav-link p-0 @linkFontWeight @linkCasing @linkFontSize@(node.IsActive ? " active" : "")@(shouldShowChildren ? " dropdown-toggle" : "")" href="@node.Link" @dropdownAttributes id="NavLink_@nodeId"> 138 } 139 else 140 { 141 @:<span class="custom-nav-link nav-link p-0 @linkFontWeight @linkCasing @linkFontSize @(shouldShowChildren ? " dropdown-toggle" : "")" @dropdownAttributes id="NavLink_@nodeId"> 142 } 143 144 @RenderNavigationItem(node, pageType, pageIcon, iconSize, layout) 145 146 @if (node.IsClickable) 147 { 148 @:</a> 149 } 150 else 151 { 152 @:</span> 153 } 154 155 @if (!showParentInMenu && shouldShowChildren) 156 { 157 if (submenuType == "megamenu") 158 { 159 <div class="dropdown-menu custom-dropdown-menu negativeLeftMargin p-0 @(theme)" style="max-width:100%;" aria-labelledby="@nodeId" id="NavGroup@(nodeId)"> 160 <div class="container-xl p-0 overflow-y-auto"> 161 @{string colSize = node.Nodes.Count() == 1 ? "g-col-12" : node.Nodes.Count() == 2 ? "g-col-6" : "g-col-4";} 162 <div class="p-4"> 163 @if (!string.IsNullOrWhiteSpace(titleInDropdown)) 164 { 165 <div><span class="m-0 px-4 @customTitleFontWeight @customTitleCasing @customTitleFontSize" style="color:var(--swift-accent-color)">@titleInDropdown</span></div> 166 } 167 <div class="grid"> 168 169 @foreach (var subnode in node.Nodes) 170 { 171 var subPage = Dynamicweb.Content.Services.Pages.GetPage(subnode.PageId); 172 bool? isHighlighted = (bool?)subPage?.PropertyItem?.FirstOrDefault(o => o.Key == "IsHighlighted").Value; 173 174 175 if (isHighlighted==true) 176 { 177 hasHighlightedPages = true; 178 continue; 179 } 180 nodeId = !string.IsNullOrEmpty(subnode.GroupId) ? "Megamenu_" + subnode.GroupId + "_" + currentParagraphId : "Megamenu_Page_" + subnode.PageId.ToString() + "_" + currentParagraphId; 181 dataType = !string.IsNullOrEmpty(subnode.GroupId) ? "group" : "page"; 182 183 <div class="@colSize px-4"> 184 @if (subnode.IsClickable) 185 { 186 @:<a id="@(nodeId)" data-type="@dataType" href="@subnode.Link" class="custom-nav-link nav-link px-0 text-decoration-underline-hover lh-sm text-break"> 187 } else { 188 @:<div id="@(nodeId)" data-type="@dataType" class="custom-nav-link nav-link px-0 lh-sm text-break"> 189 } 190 <span class="m-0 @dropdownLinkHeaderFontWeight @dropdownLinkHeaderCasing @dropdownLinkHeaderFontSize">@subnode.Name</span> 191 @if (subnode.IsClickable) 192 { 193 @:</a> 194 } 195 else 196 { 197 @:</div> 198 } 199 200 @if (!subnode.IsClickable && subnode.Nodes.Any()) 201 { 202 foreach (var subsubnode in subnode.Nodes) 203 { 204 nodeId = !string.IsNullOrEmpty(subsubnode.GroupId) ? "Megamenu_" + subsubnode.GroupId + "_" + currentParagraphId : "Megamenu_Page_" + subsubnode.PageId.ToString() + "_" + currentParagraphId; 205 dataType = !string.IsNullOrEmpty(subsubnode.GroupId) ? "group" : "page"; 206 207 if (subsubnode.IsClickable) { 208 @:<a id="@(nodeId)" data-type="@dataType" class="custom-nav-link nav-link px-0 text-decoration-underline-hover lh-sm text-break" href="@subsubnode.Link" @(subnode.IsActive ? " aria-current='page'" : "")> 209 } else { 210 @:<div id="@(nodeId)" data-type="@dataType" class="custom-nav-link nav-link px-0 lh-sm text-break" @(subnode.IsActive ? " aria-current='page'" : "")> 211 } 212 <span class="@dropdownLinkFontWeight @dropdownLinkCasing @dropdownLinkFontSize">@subsubnode.Name</span> 213 if (subsubnode.IsClickable) 214 { 215 @:</a> 216 } 217 else 218 { 219 @:</div> 220 } 221 } 222 } 223 </div> 224 } 225 </div> 226 </div> 227 228 @*Hightlighted*@ 229 @if (hasHighlightedPages) { 230 <div class="p-4 highlightedMenuPart @highlightedTheme" > 231 <div> 232 <span class="m-0 px-4 @hiFontWeight @hiCasing @hiFontSize" style="color:var(--swift-accent-color)">@Translate("Highlighted Industries")</span> 233 </div> 234 <div class="grid"> 235 @{string colSizeHightlighted = node.Nodes.Count() == 1 ? "g-col-12" : node.Nodes.Count() == 2 ? "g-col-6" : "g-col-4";} 236 @foreach (var subnode in node.Nodes) 237 { 238 239 var subPage = Dynamicweb.Content.Services.Pages.GetPage(subnode.PageId); 240 bool? isHighlighted = (bool?)subPage?.PropertyItem?.FirstOrDefault(o => o.Key == "IsHighlighted").Value; 241 242 if (isHighlighted!=true) 243 { 244 continue; 245 } 246 nodeId = !string.IsNullOrEmpty(subnode.GroupId) ? "Megamenu_" + subnode.GroupId + "_" + currentParagraphId : "Megamenu_Page_" + subnode.PageId.ToString() + "_" + currentParagraphId; 247 dataType = !string.IsNullOrEmpty(subnode.GroupId) ? "group" : "page"; 248 249 <div class="@colSize px-4"> 250 @if (subnode.IsClickable) 251 { 252 @:<a id="@(nodeId)" data-type="@dataType" href="@subnode.Link" class="custom-nav-link nav-link px-0 text-decoration-underline-hover lh-sm text-break"> 253 } else { 254 @:<div id="@(nodeId)" data-type="@dataType" class="custom-nav-link nav-link px-0 lh-sm text-break"> 255 } 256 <span class="m-0 @dropdownLinkHeaderFontWeight @dropdownLinkHeaderCasing @dropdownLinkHeaderFontSize">@subnode.Name</span> 257 @if (subnode.IsClickable) 258 { 259 @:</a> 260 } 261 else 262 { 263 @:</div> 264 } 265 266 @if (!subnode.IsClickable && subnode.Nodes.Any()) 267 { 268 foreach (var subsubnode in subnode.Nodes) 269 { 270 nodeId = !string.IsNullOrEmpty(subsubnode.GroupId) ? "Megamenu_" + subsubnode.GroupId + "_" + currentParagraphId : "Megamenu_Page_" + subsubnode.PageId.ToString() + "_" + currentParagraphId; 271 dataType = !string.IsNullOrEmpty(subsubnode.GroupId) ? "group" : "page"; 272 273 if (subsubnode.IsClickable) { 274 @:<a id="@(nodeId)" data-type="@dataType" class="custom-nav-link nav-link px-0 text-decoration-underline-hover lh-sm text-break" href="@subsubnode.Link" @(subnode.IsActive ? " aria-current='page'" : "")> 275 } else { 276 @:<div id="@(nodeId)" data-type="@dataType" class="custom-nav-link nav-link px-0 lh-sm text-break" @(subnode.IsActive ? " aria-current='page'" : "")> 277 } 278 <span class="@dropdownLinkFontWeight @dropdownLinkCasing @dropdownLinkFontSize">@subsubnode.Name</span> 279 if (subsubnode.IsClickable) 280 { 281 @:</a> 282 } 283 else 284 { 285 @:</div> 286 } 287 } 288 } 289 290 </div> 291 } 292 </div> 293 </div> 294 } 295 @if(!String.IsNullOrEmpty(buttonLink)){ 296 <div class="d-flex flex-wrap justify-content-center py-3"> 297 <a href="@buttonLink" class="btn btn-primary">@buttonText</a> 298 </div> 299 } 300 </div> 301 </div> 302 } 303 else if(submenuType == "dropdown") 304 { 305 <ul class="dropdown-menu custom-dropdown-menu p-4 @(theme)" aria-labelledby="@nodeId"> 306 @if (pageType == "Swift_SignIn") 307 { 308 if (Pageview.User == null) 309 { 310 <li> 311 <a href="@node.Link" class="px-3 py-2 dropdown-item text-decoration-underline-hover @linkFontWeight @linkCasing @linkFontSize" @(node.IsActive ? " aria-current='page'" : "")>@node.Name</a> 312 </li> 313 } 314 } 315 316 @foreach (var subnode in node.Nodes) 317 { 318 <li> 319 @if (subnode.IsClickable) 320 { 321 <a class="custom-nav-link px-3 py-2 dropdown-item text-decoration-underline-hover @linkFontWeight @linkCasing @linkFontSize" href="@subnode.Link" @(node.IsActive ? " aria-current='page'" : "")>@subnode.Name</a> 322 } 323 else 324 { 325 <span class="px-3 py-2 dropdown-item @linkFontWeight @linkCasing @linkFontSize" @(node.IsActive ? " aria-current='page'" : "")>@subnode.Name</span> 326 } 327 </li> 328 } 329 330 @if (pageType == "Swift_SignIn") 331 { 332 if (Pageview.User != null) 333 { 334 string link = "/Admin/Public/ExtranetLogoff.aspx?redirect=no"; 335 336 <li><hr class="dropdown-divider"></li> 337 338 if (Dynamicweb.Security.UserManagement.User.GetCurrentSecondaryUser() != null) 339 { 340 <li> 341 <a href="Default.aspx?ID=@(Pageview.ID)&DwExtranetRemoveSecondaryUser=1" class="px-3 py-2 dropdown-item text-decoration-underline-hover swift_sign-out-as-customer-link @linkFontWeight @linkCasing @linkFontSize" @(node.IsActive ? " aria-current='page'" : "")>@Translate("Sign out as a customer")</a> 342 </li> 343 } 344 <li> 345 <a href="@link" class="px-3 py-2 dropdown-item text-decoration-underline-hover swift_sign-out-link @linkFontWeight @linkCasing @linkFontSize" @(node.IsActive ? " aria-current='page'" : "")>@Translate("Sign out")</a> 346 </li> 347 } 348 349 } 350 <li> 351 @if(!String.IsNullOrEmpty(buttonLink)){ 352 <div class="d-flex flex-wrap justify-content-center py-3"> 353 <a href="@buttonLink" class="btn btn-primary">@buttonText</a> 354 </div> 355 } 356 </li> 357 </ul> 358 } 359 } 360 361 362 </li> 363 } 364 </ul> 365 </nav> 366
We and our partners use technologies, including cookies, to collect information about you for various purposes, including:
By clicking 'Accept All' you consent to all these purposes. You can also choose to indicate what purposes you will consent to using the custom selections and then click 'Accept selected'.
You can read more about our use of cookies and other technologies, as well as our collection and processing of personal data by clicking here:
Read more about Cookies Our privacy policy