Error executing template "Designs/Rapido/_parsed/Page.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_fc5563eb149f447193df10200cfe1189.b__63_0(TextWriter __razor_helper_writer) in E:\Dynamicweb.net\Solutions\KirkKloegt\weisstue.dw9.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 2624
   at CompiledRazorTemplates.Dynamic.RazorEngine_fc5563eb149f447193df10200cfe1189.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb.net\Solutions\KirkKloegt\weisstue.dw9.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 161
   at CompiledRazorTemplates.Dynamic.RazorEngine_fc5563eb149f447193df10200cfe1189.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb.net\Solutions\KirkKloegt\weisstue.dw9.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 125
   at CompiledRazorTemplates.Dynamic.RazorEngine_fc5563eb149f447193df10200cfe1189.b__62_0(TextWriter __razor_helper_writer) in E:\Dynamicweb.net\Solutions\KirkKloegt\weisstue.dw9.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 2608
   at CompiledRazorTemplates.Dynamic.RazorEngine_fc5563eb149f447193df10200cfe1189.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb.net\Solutions\KirkKloegt\weisstue.dw9.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 161
   at CompiledRazorTemplates.Dynamic.RazorEngine_fc5563eb149f447193df10200cfe1189.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb.net\Solutions\KirkKloegt\weisstue.dw9.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 125
   at CompiledRazorTemplates.Dynamic.RazorEngine_fc5563eb149f447193df10200cfe1189.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb.net\Solutions\KirkKloegt\weisstue.dw9.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 166
   at CompiledRazorTemplates.Dynamic.RazorEngine_fc5563eb149f447193df10200cfe1189.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in E:\Dynamicweb.net\Solutions\KirkKloegt\weisstue.dw9.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 125
   at CompiledRazorTemplates.Dynamic.RazorEngine_fc5563eb149f447193df10200cfe1189.Execute() in E:\Dynamicweb.net\Solutions\KirkKloegt\weisstue.dw9.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 2591
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 2 3 @* Rapido version 3.0 *@ 4 5 @using System.Web; 6 @using Dynamicweb.Frontend 7 @using Dynamicweb.Frontend.Devices 8 @using Dynamicweb.Extensibility 9 @using Dynamicweb.Content 10 @using Dynamicweb.Security 11 @using Dynamicweb.Core 12 @using System 13 @using System.Web 14 @using System.IO 15 @using Dynamicweb.Rapido.Blocks 16 17 @functions { 18 BlocksPage masterPage = BlocksPage.GetBlockPage("Master"); 19 20 string getFontFamily(params string[] items) 21 { 22 var itemParent = Pageview.AreaSettings; 23 foreach (var item in items) 24 { 25 itemParent = itemParent.GetItem(item); 26 if (itemParent == null) 27 { 28 return null; 29 } 30 } 31 32 var googleFont = itemParent.GetGoogleFont("FontFamily"); 33 if (googleFont == null) 34 { 35 return null; 36 } 37 return googleFont.Family.Replace(" ", "+"); 38 } 39 } 40 @{ 41 //Font settings 42 var fonts = new string[] { 43 getFontFamily("Layout", "HeaderFont"), 44 getFontFamily("Layout", "SubheaderFont"), 45 getFontFamily("Layout", "TertiaryHeaderFont"), 46 getFontFamily("Layout", "Header", "ToolsFont"), 47 getFontFamily("Layout", "Header", "NavigationFont"), 48 getFontFamily("Layout", "MobileNavigation", "Font"), 49 getFontFamily("ProductList", "Facets", "HeaderFont"), 50 getFontFamily("ProductPage", "PriceFontDesign"), 51 getFontFamily("Ecommerce", "SaleSticker", "Font"), 52 getFontFamily("Ecommerce", "NewSticker", "Font"), 53 getFontFamily("Ecommerce", "CustomSticker", "Font") 54 }; 55 56 string autoCssLink = "/Files/Templates/Designs/Rapido/css/rapido/rapido_" + Model.Area.ID.ToString() + ".min.css?ticks=" + Model.Area.UpdatedDate.Ticks; 57 58 string favicon = Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon").Path : "/Files/Images/favicon.png"; 59 } 60 61 @{ 62 Block master = new Block() 63 { 64 Id = "Master", 65 BlocksList = new List<Block> { 66 new Block { 67 Id = "MasterTopSnippets", 68 SortId = 10 69 }, 70 new Block { 71 Id = "MasterMain", 72 SortId = 20, 73 Template = RenderMain(), 74 SkipRenderBlocksList = true, 75 BlocksList = new List<Block> { 76 new Block 77 { 78 Id = "MasterHeader", 79 SortId = 10, 80 Template = RenderMasterHeader(), 81 SkipRenderBlocksList = true 82 }, 83 new Block { 84 Id = "MasterPageContent", 85 SortId = 20, 86 Template = RenderPageContent() 87 } 88 } 89 }, 90 new Block { 91 Id = "MasterFooter", 92 SortId = 30 93 }, 94 new Block { 95 Id = "MasterReferences", 96 SortId = 40 97 }, 98 new Block { 99 Id = "MasterBottomSnippets", 100 SortId = 50 101 } 102 } 103 }; 104 masterPage.Add(master); 105 } 106 107 @* Include the required Grid builder (Contains the methods @RenderBlockList and @RenderBlock) *@ 108 @using System.Text.RegularExpressions 109 @using System.Collections.Generic 110 @using Dynamicweb.Rapido.Blocks 111 112 113 @*--- START: Base block renderers ---*@ 114 115 @helper RenderBlockList(List<Block> blocks) 116 { 117 blocks = blocks.OrderBy(item => item.SortId).ToList(); 118 119 foreach (Block item in blocks) 120 { 121 <!-- START: @item.Id --> 122 123 if (item.Design == null) 124 { 125 @RenderBlock(item) 126 } 127 else if (item.Design.RenderType != RenderType.Hide) 128 { 129 if (item.Design.RenderType == RenderType.Row) 130 { 131 <div class="grid grid--align-content-start"> 132 @RenderBlock(item) 133 </div> 134 } 135 136 if (item.Design.RenderType == RenderType.Column) 137 { 138 string hidePadding = item.Design.HidePadding ? "u-no-padding" : ""; 139 string size = item.Design.Size != null ? item.Design.Size : "12"; 140 size = Regex.IsMatch(size, @"\d") ? "md-" + item.Design.Size : item.Design.Size; 141 142 <div class="grid__col-lg-@item.Design.Size grid__col-md-@item.Design.Size grid__col-sm-12 grid__col-xs-12 @hidePadding" id="Block__@item.Id"> 143 @RenderBlock(item) 144 </div> 145 } 146 147 if (item.SkipRenderBlocksList == true) 148 { 149 @RenderBlock(item) 150 } 151 } 152 153 <!-- END: @item.Id --> 154 } 155 } 156 157 @helper RenderBlock(Block item) 158 { 159 if (item.Template != null) 160 { 161 @BlocksPage.RenderTemplate(item.Template) 162 } 163 164 if (item.BlocksList.Count > 0 && item.SkipRenderBlocksList == false) 165 { 166 @RenderBlockList(item.BlocksList) 167 } 168 } 169 170 @*--- END: Base block renderers ---*@ 171 172 173 @* Include the Blocks for the page *@ 174 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 175 176 @using System 177 @using System.Web 178 @using System.Collections.Generic 179 @using Dynamicweb.Rapido.Blocks.Extensibility 180 @using Dynamicweb.Rapido.Blocks 181 182 @{ 183 BlocksPage topSnippetsBlocksPage = BlocksPage.GetBlockPage("Master"); 184 185 Block tagManager = new Block() 186 { 187 Id = "TagManager", 188 SortId = 1, 189 Template = RenderGoogleTagManager() 190 }; 191 192 Block facebookPixel = new Block() 193 { 194 Id = "FacebookPixel", 195 SortId = 2, 196 Template = RenderFacebookPixel() 197 }; 198 199 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, tagManager); 200 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, facebookPixel); 201 } 202 203 @helper RenderGoogleTagManager() { 204 string GoogleTagManagerID = Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID") != null ? Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID") : ""; 205 206 if (!string.IsNullOrWhiteSpace(GoogleTagManagerID)) 207 { 208 <script> 209 (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': 210 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], 211 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 212 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); 213 })(window,document,'script','dataLayer','@GoogleTagManagerID'); 214 </script> 215 <!-- Google Tag Manager (noscript) --> 216 <noscript> 217 <iframe src="https://www.googletagmanager.com/ns.html?id=@GoogleTagManagerID" 218 height="0" width="0" style="display:none;visibility:hidden"></iframe> 219 </noscript> 220 <!-- End Google Tag Manager (noscript) --> 221 } 222 } 223 224 @helper RenderFacebookPixel() { 225 string FacebookPixelID = Model.Area.Item.GetItem("Settings").GetString("FacebookPixelID") != null ? Model.Area.Item.GetItem("Settings").GetString("FacebookPixelID") : ""; 226 227 if (!string.IsNullOrWhiteSpace(FacebookPixelID)) 228 { 229 <!-- Facebook Pixel Code --> 230 <script> 231 !function(f,b,e,v,n,t,s) 232 {if(f.fbq)return;n=f.fbq=function(){n.callMethod? 233 n.callMethod.apply(n,arguments):n.queue.push(arguments)}; 234 if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0'; 235 n.queue=[];t=b.createElement(e);t.async=!0; 236 t.src=v;s=b.getElementsByTagName(e)[0]; 237 s.parentNode.insertBefore(t,s)}(window, document,'script', 238 'https://connect.facebook.net/en_US/fbevents.js'); 239 fbq('init', '@FacebookPixelID'); 240 fbq('track', 'PageView'); 241 </script> 242 <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=@FacebookPixelID&ev=PageView&noscript=1" alt="" /></noscript> 243 } 244 } 245 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 246 247 @using System 248 @using System.Web 249 @using System.Collections.Generic 250 @using Dynamicweb.Rapido.Blocks.Extensibility 251 @using Dynamicweb.Rapido.Blocks 252 253 254 @{ 255 BlocksPage loginBlocksPage = BlocksPage.GetBlockPage("Master"); 256 257 Block loginModal = new Block() 258 { 259 Id = "LoginModal", 260 SortId = 10, 261 Template = LoginModal() 262 }; 263 264 loginBlocksPage.Add(MasterBlockId.MasterTopSnippets, loginModal); 265 } 266 267 @helper LoginModal() { 268 int pageId = Model.TopPage.ID; 269 string userSignedInError = !Model.LogOnFailed ? "" : "checked"; 270 string userSignedInErrorText = ""; 271 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 272 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; 273 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 274 275 if (Model.LogOnFailed) { 276 switch (Model.LogOnFailedReason) 277 { 278 case Dynamicweb.Security.UserManagement.LogOnFailedReason.PasswordLengthInvalid: 279 userSignedInErrorText = Translate("Password length is invalid"); 280 break; 281 case Dynamicweb.Security.UserManagement.LogOnFailedReason.IncorrectLogin: 282 userSignedInErrorText = Translate("Invalid email or password"); 283 break; 284 case Dynamicweb.Security.UserManagement.LogOnFailedReason.ExceededFailedLogOnLimit: 285 userSignedInErrorText = Translate("You have exceeded the limit of allowed login attempts. The user account is temporarily locked"); 286 break; 287 case Dynamicweb.Security.UserManagement.LogOnFailedReason.LoginLocked: 288 userSignedInErrorText = Translate("The user account is temporarily locked"); 289 break; 290 case Dynamicweb.Security.UserManagement.LogOnFailedReason.PasswordExpired: 291 userSignedInErrorText = Translate("The password has expired and needs to be renewed"); 292 break; 293 default: 294 userSignedInErrorText = Translate("An unknown error occured"); 295 break; 296 } 297 } 298 299 <!-- Trigger for the login modal --> 300 <input type="checkbox" id="SignInModalTrigger" class="modal-trigger" @userSignedInError /> 301 302 <!-- Login modal --> 303 <div class="modal-container"> 304 <label for="SignInModalTrigger" id="SignInModalOverlay" class="modal-overlay"></label> 305 <div class="modal modal--xs" id="SignInModal"> 306 <div class="modal__header"> 307 <h2>@Translate("Sign in")</h2> 308 </div> 309 <div class="modal__body"> 310 <form method="post" id="LoginForm" class="u-no-margin"> 311 <input type="hidden" name="ID" value="@pageId" /> 312 <input type="hidden" name="DWExtranetUsernameRemember" value="True" /> 313 <input type="hidden" name="DWExtranetPasswordRemember" value="True" /> 314 <input type="text" class="u-full-width" id="LoginUsername" name="username" placeholder="@Translate("Email")" /> 315 <input type="password" class="u-full-width" id="LoginPassword" name="password" placeholder="@Translate("Password")" /> 316 <div class="field-error dw-mod">@userSignedInErrorText</div> 317 318 <div class="form__field-group dw-mod"> 319 <input type="checkbox" id="rememberMe" name="Autologin" checked="checked" value="True" class="form__control"> 320 <label for="rememberMe"> 321 @Translate("Remember me", "Remember me") 322 </label> 323 </div> 324 325 <button type="submit" class="btn btn--primary btn--full dw-mod" name="LoginAction" value="Login" onclick="Buttons.LockButton(event)">@Translate("Sign in")</button> 326 327 <a class="btn btn--link-clean dw-mod" href="@forgotPasswordPageLink">@Translate("Forgot your password?", "Forgot your password?")</a> 328 329 <a class="btn btn--link-clean dw-mod" href="/default.aspx?ID=@createAccountPageId">@Translate("Create account")?</a> 330 </form> 331 </div> 332 </div> 333 </div> 334 } 335 @if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet") 336 { 337 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 338 339 @using System 340 @using System.Web 341 @using System.Collections.Generic 342 @using Dynamicweb.Rapido.Blocks.Extensibility 343 @using Dynamicweb.Rapido.Blocks 344 345 346 @functions { 347 BlocksPage mobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master"); 348 } 349 350 @{ 351 var mobileTopLayout = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetString("Design")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design").SelectedValue : "nav-left"; 352 353 Block mobileHeader = new Block() 354 { 355 Id = "MobileTop", 356 SortId = 10, 357 Template = RenderMobileTop(), 358 SkipRenderBlocksList = true 359 }; 360 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeader); 361 362 Block mobileHeaderNavigation = new Block() 363 { 364 Id = "MobileHeaderNavigation", 365 SortId = 10, 366 Template = RenderMobileHeaderNavigation(), 367 SkipRenderBlocksList = true, 368 BlocksList = new List<Block> { 369 new Block { 370 Id = "MobileHeaderNavigationTrigger", 371 SortId = 10, 372 Template = RenderMobileHeaderNavigationTrigger() 373 } 374 } 375 }; 376 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderNavigation); 377 378 379 Block mobileHeaderLogo = new Block() 380 { 381 Id = "MobileHeaderLogo", 382 SortId = 20, 383 Template = RenderMobileHeaderLogo(), 384 SkipRenderBlocksList = true 385 }; 386 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderLogo); 387 388 Block mobileHeaderActions = new Block() 389 { 390 Id = "MobileHeaderActions", 391 SortId = 30, 392 Template = RenderMobileTopActions(), 393 SkipRenderBlocksList = true 394 }; 395 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderActions); 396 397 Block mobileHeaderSearch = new Block 398 { 399 Id = "MobileHeaderSearch", 400 SortId = 10, 401 Template = RenderMobileTopSearch() 402 }; 403 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderSearch); 404 405 Block mobileHeaderMiniCart = new Block 406 { 407 Id = "MobileHeaderMiniCart", 408 SortId = 20, 409 Template = RenderMobileTopMiniCart() 410 }; 411 412 Block mobileHeaderSearchBar = new Block() 413 { 414 Id = "MobileHeaderSearchBar", 415 SortId = 30, 416 Template = RenderMobileTopSearchBar() 417 }; 418 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeaderSearchBar); 419 420 switch (mobileTopLayout) 421 { 422 case "nav-left": 423 mobileHeaderNavigation.SortId = 10; 424 mobileHeaderLogo.SortId = 20; 425 mobileHeaderActions.SortId = 30; 426 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart); 427 break; 428 case "nav-right": 429 mobileHeaderLogo.SortId = 10; 430 mobileHeaderActions.SortId = 20; 431 mobileHeaderNavigation.SortId = 30; 432 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart); 433 break; 434 case "nav-search-left": 435 mobileHeaderNavigation.SortId = 10; 436 mobileHeaderLogo.SortId = 20; 437 mobileHeaderActions.SortId = 30; 438 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart); 439 break; 440 case "search-left": 441 mobileHeaderActions.SortId = 10; 442 mobileHeaderLogo.SortId = 20; 443 mobileHeaderNavigation.SortId = 30; 444 mobileHeaderMiniCart.SortId = 0; 445 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart); 446 break; 447 } 448 } 449 450 451 @helper RenderMobileTop() { 452 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileTop").OrderBy(item => item.SortId).ToList(); 453 454 <nav class="main-navigation-mobile dw-mod"> 455 <div class="center-container top-container__center-container dw-mod"> 456 <div class="grid grid--align-center"> 457 @RenderBlockList(subBlocks) 458 </div> 459 </div> 460 </nav> 461 } 462 463 @helper RenderMobileHeaderNavigation() { 464 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderNavigation").OrderBy(item => item.SortId).ToList(); 465 466 <div class="grid__col-auto-width"> 467 <ul class="menu dw-mod"> 468 @RenderBlockList(subBlocks) 469 </ul> 470 </div> 471 } 472 473 @helper RenderMobileHeaderNavigationTrigger() { 474 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 475 <label for="MobileNavTrigger" class="mobile-nav-trigger-button menu__link menu__link--icon menu__link--mobile dw-mod"></label> 476 </li> 477 } 478 479 @helper RenderMobileHeaderLogo() { 480 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderLogo").OrderBy(item => item.SortId).ToList(); 481 482 string firstPageId = Model.Area.FirstActivePage.ID.ToString(); 483 string businessName = Model.Area.Item.GetItem("Settings").GetString("BusinessName"); 484 485 string mobileLogo = "/Files/Images/logo-dynamicweb.png"; 486 if (Model.Area.Item.GetItem("Layout").GetItem("MobileTop") != null && Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo") != null) 487 { 488 mobileLogo = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo").PathUrlEncoded; 489 } 490 491 if (Path.GetExtension(mobileLogo).ToLower() != ".svg") 492 { 493 mobileLogo = "/Admin/Public/GetImage.ashx?height=40&amp;crop=5&amp;Compression=75&amp;image=" + mobileLogo; 494 } 495 else 496 { 497 mobileLogo = HttpUtility.UrlDecode(mobileLogo); 498 } 499 500 <div class="grid__col-auto"> 501 <div class="logo dw-mod"> 502 <a href="/Default.aspx?ID=@firstPageId"> 503 <img class="grid__cell-img logo__img logo__img--mobile dw-mod" src="@mobileLogo" alt="@businessName" /> 504 </a> 505 </div> 506 507 @RenderBlockList(subBlocks) 508 </div> 509 } 510 511 @helper RenderMobileTopActions() { 512 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderActions").OrderBy(item => item.SortId).ToList(); 513 514 <div class="grid__col-auto-width"> 515 <ul class="menu dw-mod"> 516 @RenderBlockList(subBlocks) 517 </ul> 518 </div> 519 } 520 521 @helper RenderMobileTopSearch() { 522 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 523 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> 524 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> 525 </label> 526 </li> 527 } 528 529 @helper RenderMobileTopMiniCart() { 530 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 531 int cartPageId = GetPageIdByNavigationTag("CartPage"); 532 double cartProductsCount = Model.Cart.TotalProductsCount; 533 534 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod" id="miniCartWrapper" onmouseenter="Cart.UpdateMiniCart('miniCartWrapper', 'miniCart', 'cartCounter', '/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart')"> 535 <div class="mini-cart dw-mod"> 536 <a href="/Default.aspx?ID=@cartPageId&Purge=True" id="miniCartCounterWrap" class="menu__link menu__link--icon menu__link--mobile dw-mod js-mini-cart-button u-w50px"> 537 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue fa-1_5x"></i> 538 <div class="mini-cart__counter mini-cart__counter--inline dw-mod"> 539 <div class="js-handlebars-root js-mini-cart-counter" id="cartCounter" data-template="MiniCartCounterContent" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=Counter" data-init-onload="false" data-preloader="false"> 540 <div class="js-mini-cart-counter-content"> 541 @cartProductsCount 542 </div> 543 </div> 544 </div> 545 </a> 546 @if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 547 { 548 <div class="mini-cart-dropdown js-handlebars-root js-mini-cart dw-mod" id="miniCart" data-template="MiniCartContent" data-cart-id="@miniCartFeedPageId" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart" data-init-onload="false"></div> 549 } 550 </div> 551 </li> 552 } 553 554 @helper RenderMobileTopSearchBar() { 555 string searchFeedId = ""; 556 string searchSecondFeedId = ""; 557 int groupsFeedId; 558 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 559 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 560 string resultPageLink; 561 string searchPlaceholder; 562 string searchType = "product-search"; 563 string searchTemplate; 564 string searchContentTemplate = ""; 565 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") != null ? HttpContext.Current.Request.QueryString.Get("Search") : ""; 566 bool showGroups = true; 567 568 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch") 569 { 570 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 571 resultPageLink = contentSearchPageLink; 572 searchPlaceholder = Translate("Search page"); 573 groupsFeedId = 0; 574 searchType = "content-search"; 575 searchTemplate = "SearchPagesTemplate"; 576 showGroups = false; 577 } 578 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch") 579 { 580 searchFeedId = productsPageId + "&feed=true"; 581 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 582 resultPageLink = Converter.ToString(productsPageId); 583 searchPlaceholder = Translate("Search products or pages"); 584 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 585 searchType = "combined-search"; 586 searchTemplate = "SearchProductsTemplateWrap"; 587 searchContentTemplate = "SearchPagesTemplateWrap"; 588 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 589 } 590 else 591 { 592 resultPageLink = Converter.ToString(productsPageId); 593 searchFeedId = productsPageId + "&feed=true"; 594 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 595 searchPlaceholder = Translate("Search products"); 596 searchTemplate = "SearchProductsTemplate"; 597 searchType = "product-search"; 598 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 599 } 600 601 602 <input type="checkbox" id="MobileSearchTrigger" class="mobile-search-trigger" /> 603 604 <div class="main-navigation-mobile typeahead-mobile dw-mod"> 605 <div class="center-container top-container__center-container dw-mod"> 606 <div class="grid"> 607 <div class="grid__col-auto"> 608 <div class="typeahead-mobile__search-field dw-mod js-typeahead" data-page-size="@(searchType == "combined-search" ? 4 : 8)" id="MobileProductSearch" data-search-feed-id="@searchFeedId" data-search-second-feed-id="@searchSecondFeedId" data-result-page-id="@resultPageLink" data-search-type="@searchType"> 609 <input type="text" class="js-typeahead-search-field u-w160px u-no-margin" placeholder="@searchPlaceholder" value="@searchValue"> 610 @if (string.IsNullOrEmpty(searchSecondFeedId)) 611 { 612 <ul class="dropdown dropdown--absolute-position u-min-w220px u-full-width js-handlebars-root js-typeahead-search-content dw-mod" id="MobileProductSearchBarContent" data-template="@searchTemplate" data-json-feed="/Default.aspx?ID=@searchFeedId&feedType=productsOnly" data-init-onload="false"></ul> 613 } 614 else 615 { 616 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--combined-mobile grid"> 617 <div class="js-handlebars-root js-typeahead-search-content grid__col-sm-7 grid__col--bleed-y" id="MobileProductSearchBarContent" data-template="@searchTemplate" data-json-feed="/Default.aspx?ID=@searchFeedId&feedType=productsOnly" data-init-onload="false"></div> 618 <div class="js-handlebars-root js-typeahead-additional-search-content grid__col-sm-5 grid__col--bleed-y" id="MobileContentSearchBarContent" data-template="@searchContentTemplate" data-json-feed="/Default.aspx?ID=@searchSecondFeedId" data-init-onload="false"></div> 619 </div> 620 } 621 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod js-typeahead-enter-btn"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue"></i></button> 622 </div> 623 </div> 624 <div class="grid__col-auto-width"> 625 <ul class="menu dw-mod"> 626 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 627 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> 628 <i class="fas fa-times fa-1_5x"></i> 629 </label> 630 </li> 631 </ul> 632 </div> 633 </div> 634 </div> 635 </div> 636 } </text> 637 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 638 639 @using System 640 @using System.Web 641 @using System.Collections.Generic 642 @using Dynamicweb.Rapido.Blocks.Extensibility 643 @using Dynamicweb.Rapido.Blocks 644 645 @functions { 646 BlocksPage mobileNavigationBlocksPage = BlocksPage.GetBlockPage("Master"); 647 } 648 649 @{ 650 bool navigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 651 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideAccount"); 652 bool hideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); 653 bool hideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); 654 bool hideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); 655 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); 656 657 Block mobileNavigation = new Block() 658 { 659 Id = "MobileNavigation", 660 SortId = 10, 661 Template = MobileNavigation(), 662 SkipRenderBlocksList = true 663 }; 664 mobileNavigationBlocksPage.Add(MasterBlockId.MasterTopSnippets, mobileNavigation); 665 666 if (Model.CurrentUser.ID > 0) 667 { 668 Block mobileNavigationSignIn = new Block 669 { 670 Id = "MobileNavigationSignIn", 671 SortId = 10, 672 Template = RenderMobileNavigationSignIn() 673 }; 674 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationSignIn); 675 } 676 677 Block mobileNavigationMenu = new Block 678 { 679 Id = "MobileNavigationMenu", 680 SortId = 20, 681 Template = RenderMobileNavigationMenu() 682 }; 683 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationMenu); 684 685 Block mobileNavigationActions = new Block 686 { 687 Id = "MobileNavigationActions", 688 SortId = 30, 689 Template = RenderMobileNavigationActions(), 690 SkipRenderBlocksList = true 691 }; 692 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationActions); 693 694 if (!navigationItemsHideSignIn) 695 { 696 if (Model.CurrentUser.ID <= 0) 697 { 698 Block mobileNavigationSignInAction = new Block 699 { 700 Id = "MobileNavigationSignInAction", 701 SortId = 10, 702 Template = RenderMobileNavigationSignInAction() 703 }; 704 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignInAction); 705 706 if (hideCreateAccountLink) 707 { 708 Block mobileNavigationCreateAccountAction = new Block 709 { 710 Id = "MobileNavigationCreateAccountAction", 711 SortId = 20, 712 Template = RenderMobileNavigationCreateAccountAction() 713 }; 714 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignInAction); 715 } 716 } 717 else 718 { 719 if (hideMyProfileLink) 720 { 721 Block mobileNavigationProfileAction = new Block 722 { 723 Id = "MobileNavigationProfileAction", 724 SortId = 10, 725 Template = RenderMobileNavigationProfileAction() 726 }; 727 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationProfileAction); 728 } 729 if (hideMyOrdersLink) 730 { 731 Block mobileNavigationOrdersAction = new Block 732 { 733 Id = "MobileNavigationOrdersAction", 734 SortId = 20, 735 Template = RenderMobileNavigationOrdersAction() 736 }; 737 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationOrdersAction); 738 } 739 if (hideMyFavoritesLink) 740 { 741 Block mobileNavigationFavoritesAction = new Block 742 { 743 Id = "MobileNavigationFavoritesAction", 744 SortId = 30, 745 Template = RenderMobileNavigationFavoritesAction() 746 }; 747 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationFavoritesAction); 748 } 749 750 Block mobileNavigationSignOutAction = new Block 751 { 752 Id = "MobileNavigationSignOutAction", 753 SortId = 40, 754 Template = RenderMobileNavigationSignOutAction() 755 }; 756 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignOutAction); 757 } 758 } 759 760 if (Model.Languages.Count > 1) 761 { 762 Block mobileNavigationLanguagesAction = new Block 763 { 764 Id = "MobileNavigationLanguagesAction", 765 SortId = 50, 766 Template = RenderMobileNavigationLanguagesAction() 767 }; 768 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationLanguagesAction); 769 } 770 } 771 772 773 @helper MobileNavigation() { 774 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigation").OrderBy(item => item.SortId).ToList(); 775 776 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 777 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 778 int cartFeedPageId = GetPageIdByNavigationTag("CartOrderlinesFeed"); 779 string mobileTopDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileTop") != null ? Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design").SelectedValue : "nav-left"; 780 string position = mobileTopDesign == "nav-left" || mobileTopDesign == "nav-search-left" ? "left" : "right"; 781 782 <!-- Trigger for mobile navigation --> 783 <input type="checkbox" id="MobileNavTrigger" class="mobile-nav-trigger mobile-nav-trigger--@position" autocomplete="off" /> 784 785 <!-- Mobile navigation --> 786 <nav class="mobile-navigation mobile-navigation--@position dw-mod"> 787 @RenderBlockList(subBlocks) 788 </nav> 789 790 <label class="mobile-nav-trigger-off" for="MobileNavTrigger"></label> 791 792 if (!onlyPreview) 793 { 794 <div class="u-visually-hidden js-handlebars-root js-mini-cart" id="miniCart" data-template="MiniCartContent" data-cart-id="@cartFeedPageId" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart" data-init-onload="false"></div> 795 } 796 } 797 798 @helper RenderMobileNavigationSignIn() { 799 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 800 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 801 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 802 string myProfilePageLink = linkStart + myProfilePageId; 803 string userName = Model.CurrentUser.FirstName != null ? Model.CurrentUser.FirstName : ""; 804 userName += " " + Model.CurrentUser.LastName != null ? Model.CurrentUser.LastName : ""; 805 userName += userName == "" && Model.CurrentUser.UserName != null ? Model.CurrentUser.UserName : ""; 806 807 <ul class="menu menu-mobile"> 808 <li class="menu-mobile__item"> 809 <a href="@myProfilePageLink" class="menu-mobile__link dw-mod"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue menu-mobile__link-icon"></i> @userName</a> 810 </li> 811 </ul> 812 } 813 814 @helper RenderMobileNavigationMenu() { 815 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides"; 816 string menuTemplate = isSlidesDesign ? "BaseMenuForMobileSlides.xslt" : "BaseMenuForMobileExpandable.xslt"; 817 string levels = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels") : "3"; 818 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 819 int startLevel = renderPagesInToolBar ? 1 : 0; 820 821 @RenderNavigation(new 822 { 823 id = "mobilenavigation", 824 cssclass = "menu menu-mobile dwnavigation", 825 startLevel = @startLevel, 826 ecomStartLevel = @startLevel + 1, 827 endlevel = @levels, 828 expandmode = "all", 829 template = @menuTemplate 830 }) 831 832 if (renderPagesInToolBar) 833 { 834 @RenderNavigation(new 835 { 836 id = "topToolsMobileNavigation", 837 cssclass = "menu menu-mobile dwnavigation", 838 template = "ToolsMenuForMobile.xslt" 839 }) 840 } 841 } 842 843 @helper RenderMobileNavigationActions() { 844 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigationActions").OrderBy(item => item.SortId).ToList(); ; 845 846 <ul class="menu menu-mobile"> 847 @RenderBlockList(subBlocks) 848 </ul> 849 } 850 851 @helper RenderMobileNavigationSignInAction() { 852 <li class="menu-mobile__item"> 853 <label for="SignInModalTrigger" onclick="document.getElementById('MobileNavTrigger').checked = false;" class="menu-mobile__link dw-mod menu-mobile__link--highlighted"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue menu-mobile__link-icon"></i> @Translate("Sign in")</label> 854 </li> 855 } 856 857 @helper RenderMobileNavigationCreateAccountAction() { 858 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 859 860 <li class="menu-mobile__item"> 861 <a class="menu-mobile__link menu-mobile__link--highlighted dw-mod" href="/Default.aspx?ID=@createAccountPageId"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue menu-mobile__link-icon"></i> @Translate("Create account")</a> 862 </li> 863 } 864 865 @helper RenderMobileNavigationProfileAction() { 866 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 867 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 868 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 869 string myProfilePageLink = linkStart + myProfilePageId; 870 871 <li class="menu-mobile__item"> 872 <a href="@myProfilePageLink" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue menu-mobile__link-icon"></i> @Translate("My Profile")</a> 873 </li> 874 } 875 876 @helper RenderMobileNavigationOrdersAction() { 877 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 878 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 879 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); 880 string myOrdersPageLink = linkStart + myOrdersPageId; 881 882 <li class="menu-mobile__item"> 883 <a href="@myOrdersPageLink" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="fas fa-list menu-mobile__link-icon"></i> @Translate("My Orders")</a> 884 </li> 885 } 886 887 @helper RenderMobileNavigationFavoritesAction() { 888 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 889 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 890 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 891 string myFavoritesPageLink = linkStart + myFavoritesPageId; 892 893 <li class="menu-mobile__item"> 894 <a href="@myFavoritesPageLink" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue menu-mobile__link-icon"></i> @Translate("My Favorites")</a> 895 </li> 896 } 897 898 @helper RenderMobileNavigationSignOutAction() { 899 int pageId = Model.TopPage.ID; 900 901 <li class="menu-mobile__item"> 902 <a class="menu-mobile__link menu-mobile__link--highlighted dw-mod" href="/Admin/Public/ExtranetLogoff.aspx?ID=@pageId"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue menu-mobile__link-icon"></i> @Translate("Sign out")</a> 903 </li> 904 } 905 906 @helper RenderMobileNavigationLanguagesAction() { 907 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides"; 908 909 string selectedLanguage = ""; 910 foreach (var lang in Model.Languages) 911 { 912 if (lang.IsCurrent) 913 { 914 selectedLanguage = lang.Name; 915 } 916 } 917 918 <li class="menu-mobile__item dw-mod"> 919 <input id="MobileMenuCheck_Language" type="checkbox" class="expand-trigger"> 920 <div class="menu-mobile__link__wrap"> 921 <label for="MobileMenuCheck_Language" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue menu-mobile__link-icon"></i> @selectedLanguage</label> 922 <label for="MobileMenuCheck_Language" class="menu-mobile__trigger"></label> 923 </div> 924 <ul class="menu-mobile menu-mobile__submenu expand-menu"> 925 @if (isSlidesDesign) 926 { 927 <li class="menu-mobile__item dw-mod"> 928 <div class="menu-mobile__link__wrap"> 929 <label for="MobileMenuCheck_Language" class="menu-mobile__trigger menu-mobile__trigger--back"></label> 930 <label for="MobileMenuCheck_Language" class="menu-mobile__link dw-mod ">Back</label> 931 </div> 932 </li> 933 } 934 @foreach (var lang in Model.Languages) 935 { 936 <li class="menu-mobile__item dw-mod"> 937 <a class="menu-mobile__link menu-mobile__link--highlighted dw-mod menu-mobile__link--level-1" href="/Default.aspx?ID=@lang.Page.ID">@lang.Name</a> 938 </li> 939 } 940 </ul> 941 </li> 942 }</text> 943 } 944 else 945 { 946 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 947 948 @using System 949 @using System.Web 950 @using System.Collections.Generic 951 @using Dynamicweb.Rapido.Blocks.Extensibility 952 @using Dynamicweb.Rapido.Blocks 953 954 @functions { 955 BlocksPage headerBlocksPage = BlocksPage.GetBlockPage("Master"); 956 } 957 958 @{ 959 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 960 bool navigationActionHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 961 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); 962 bool showSearchIcon = false; 963 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 964 965 if (topLayout == "minimal" || topLayout == "minimal-right" || topLayout == "two-lines" || topLayout == "two-lines-centered") 966 { 967 showSearchIcon = true; 968 } 969 bool headerOnlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 970 971 if (renderPagesInToolBar && Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 972 { 973 Block masterTools = new Block() 974 { 975 Id = "MasterDesktopTools", 976 SortId = 10, 977 Template = RenderDesktopTools(), 978 SkipRenderBlocksList = true, 979 BlocksList = new List<Block> 980 { 981 new Block { 982 Id = "MasterDesktopToolsText", 983 SortId = 10, 984 Template = RenderDesktopToolsText(), 985 Design = new Design 986 { 987 Size = "auto", 988 HidePadding = true, 989 RenderType = RenderType.Column 990 } 991 }, 992 new Block { 993 Id = "MasterDesktopToolsNavigation", 994 SortId = 20, 995 Template = RenderDesktopToolsNavigation(), 996 Design = new Design 997 { 998 Size = "auto-width", 999 HidePadding = true, 1000 RenderType = RenderType.Column 1001 } 1002 } 1003 } 1004 }; 1005 headerBlocksPage.Add(MasterBlockId.MasterHeader, masterTools); 1006 }; 1007 1008 Block masterDesktopExtra = new Block() 1009 { 1010 Id = "MasterDesktopExtra", 1011 SortId = 10, 1012 Template = RenderDesktopExtra(), 1013 SkipRenderBlocksList = true 1014 }; 1015 headerBlocksPage.Add(MasterBlockId.MasterHeader, masterDesktopExtra); 1016 1017 Block masterDesktopNavigation = new Block() 1018 { 1019 Id = "MasterDesktopNavigation", 1020 SortId = 20, 1021 Template = RenderDesktopNavigation(), 1022 SkipRenderBlocksList = true 1023 }; 1024 headerBlocksPage.Add(MasterBlockId.MasterHeader, masterDesktopNavigation); 1025 1026 Block masterDesktopLogo = new Block 1027 { 1028 Id = "MasterDesktopLogo", 1029 SortId = 10, 1030 Template = RenderDesktopLogo(), 1031 Design = new Design 1032 { 1033 Size = "auto-width", 1034 HidePadding = true, 1035 RenderType = RenderType.Column 1036 } 1037 }; 1038 1039 Block masterDesktopMenu = new Block 1040 { 1041 Id = "MasterDesktopMenu", 1042 SortId = 20, 1043 Template = RenderDesktopMenu(), 1044 Design = new Design() 1045 { 1046 Size = "auto", 1047 HidePadding = true, 1048 RenderType = RenderType.Column 1049 } 1050 }; 1051 1052 Block masterDesktopActionsMenuContainer = new Block 1053 { 1054 Id = "MasterDesktopActionsMenuContainer", 1055 SortId = 30, 1056 Design = new Design 1057 { 1058 RenderType = RenderType.Column, 1059 Size = "auto" 1060 } 1061 }; 1062 1063 Block masterDesktopActionsMenu = new Block 1064 { 1065 Id = "MasterDesktopActionsMenu", 1066 SortId = 10, 1067 Template = RenderDesktopActionsMenu(), 1068 SkipRenderBlocksList = true 1069 }; 1070 1071 if (!navigationActionHideSearch && showSearchIcon) 1072 { 1073 Block masterDesktopActionsMenuSearch = new Block 1074 { 1075 Id = "MasterDesktopActionsMenuSearch", 1076 SortId = 10, 1077 Template = RenderMiniSearch() 1078 }; 1079 masterDesktopActionsMenu.Add(masterDesktopActionsMenuSearch); 1080 } 1081 1082 Block masterDesktopActionsMenuSignIn = new Block 1083 { 1084 Id = "MasterDesktopActionsMenuSignIn", 1085 SortId = 20, 1086 Template = RenderSignIn() 1087 }; 1088 masterDesktopActionsMenu.Add(masterDesktopActionsMenuSignIn); 1089 1090 if (!hideMyFavoritesLink && Model.CurrentUser.ID > 0) 1091 { 1092 Block masterDesktopActionsMenuFavorites = new Block 1093 { 1094 Id = "MasterDesktopActionsMenuFavorites", 1095 SortId = 30, 1096 Template = RenderFavorites() 1097 }; 1098 masterDesktopActionsMenu.Add(masterDesktopActionsMenuFavorites); 1099 } 1100 1101 Block masterDesktopActionsMenuLanguageSelector = new Block 1102 { 1103 Id = "MasterDesktopActionsMenuLanguageSelector", 1104 SortId = 40, 1105 Template = RenderLanguageSelector() 1106 }; 1107 masterDesktopActionsMenu.Add(masterDesktopActionsMenuLanguageSelector); 1108 1109 if (!headerOnlyPreview) 1110 { 1111 Block masterDesktopActionsMenuMiniCart = new Block 1112 { 1113 Id = "MasterDesktopActionsMenuMiniCart", 1114 SortId = 50, 1115 Template = RenderMiniCart() 1116 }; 1117 masterDesktopActionsMenu.Add(masterDesktopActionsMenuMiniCart); 1118 } 1119 1120 if (!string.IsNullOrWhiteSpace(Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink"))) 1121 { 1122 Block masterDesktopActionsHeaderButton = new Block 1123 { 1124 Id = "MasterDesktopActionsHeaderButton", 1125 SortId = 60, 1126 Template = RenderHeaderButton() 1127 }; 1128 masterDesktopActionsMenu.Add(masterDesktopActionsHeaderButton); 1129 } 1130 1131 Block searchBar = new Block() 1132 { 1133 Id = "SearchBar", 1134 SortId = 40, 1135 Template = RenderSearchBar(), 1136 Design = new Design() 1137 { 1138 Size = "auto", 1139 HidePadding = true, 1140 RenderType = RenderType.Column 1141 } 1142 }; 1143 1144 if (Model.CurrentUser.ID > 0 && Model.SecondaryUsers.Count > 0) 1145 { 1146 Block impersonationBar = new Block() 1147 { 1148 Id = "ImpersonationBar", 1149 SortId = 50, 1150 Template = RenderImpersonationBar(), 1151 Design = new Design() 1152 { 1153 Size = "auto-width", 1154 HidePadding = true, 1155 RenderType = RenderType.Column 1156 } 1157 }; 1158 headerBlocksPage.Add(MasterBlockId.MasterHeader, impersonationBar); 1159 } 1160 1161 switch (topLayout) 1162 { 1163 case "condensed": //2 1164 masterDesktopLogo.SortId = 10; 1165 masterDesktopLogo.Design.Size = "auto-width"; 1166 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopLogo); 1167 masterDesktopMenu.SortId = 20; 1168 masterDesktopMenu.Design.Size = "auto"; 1169 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopMenu); 1170 masterDesktopActionsMenuContainer.SortId = 30; 1171 masterDesktopActionsMenuContainer.Design.Size = "auto-width"; 1172 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopActionsMenuContainer); 1173 if (!navigationActionHideSearch) 1174 { 1175 searchBar.SortId = 40; 1176 searchBar.Design.Size = "12"; 1177 masterDesktopExtra.SortId = 50; 1178 headerBlocksPage.Add("MasterDesktopExtra", searchBar); 1179 } 1180 break; 1181 case "minimal": //4 1182 masterDesktopLogo.SortId = 10; 1183 masterDesktopLogo.Design.Size = "auto-width"; 1184 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopLogo); 1185 masterDesktopMenu.SortId = 10; 1186 masterDesktopMenu.Design.Size = "auto"; 1187 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopMenu); 1188 masterDesktopActionsMenuContainer.SortId = 20; 1189 masterDesktopActionsMenuContainer.Design.Size = "auto-width"; 1190 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopActionsMenuContainer); 1191 break; 1192 case "minimal-right": //5 1193 masterDesktopLogo.SortId = 10; 1194 masterDesktopLogo.Design.Size = "auto-width"; 1195 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopLogo); 1196 masterDesktopMenu.SortId = 10; 1197 masterDesktopMenu.Design.Size = "auto"; 1198 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopMenu); 1199 masterDesktopActionsMenuContainer.SortId = 20; 1200 masterDesktopActionsMenuContainer.Design.Size = "auto-width"; 1201 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopActionsMenuContainer); 1202 break; 1203 case "two-lines": //6 1204 masterDesktopLogo.SortId = 10; 1205 masterDesktopLogo.Design.Size = "auto"; 1206 headerBlocksPage.Add("MasterDesktopExtra", masterDesktopLogo); 1207 masterDesktopMenu.SortId = 10; 1208 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopMenu); 1209 masterDesktopActionsMenuContainer.SortId = 20; 1210 masterDesktopActionsMenuContainer.Design.Size = "auto-width"; 1211 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopActionsMenuContainer); 1212 break; 1213 case "two-lines-centered": //7 1214 masterDesktopLogo.SortId = 10; 1215 masterDesktopLogo.Design.Size = "auto"; 1216 headerBlocksPage.Add("MasterDesktopExtra", masterDesktopLogo); 1217 masterDesktopMenu.SortId = 10; 1218 masterDesktopMenu.Design.Size = "auto"; 1219 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopMenu); 1220 masterDesktopActionsMenuContainer.SortId = 20; 1221 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopActionsMenuContainer); 1222 break; 1223 case "splitted": //3 1224 masterDesktopLogo.SortId = 10; 1225 masterDesktopLogo.Design.Size = "auto"; 1226 headerBlocksPage.Add("MasterDesktopExtra", masterDesktopLogo); 1227 if (!navigationActionHideSearch) 1228 { 1229 searchBar.SortId = 20; 1230 searchBar.Design.Size = "auto"; 1231 headerBlocksPage.Add("MasterDesktopExtra", searchBar); 1232 } 1233 masterDesktopMenu.SortId = 10; 1234 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopMenu); 1235 masterDesktopActionsMenuContainer.SortId = 20; 1236 masterDesktopActionsMenuContainer.Design.Size = "auto-width"; 1237 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopActionsMenuContainer); 1238 break; 1239 case "normal": //1 1240 default: 1241 masterDesktopLogo.SortId = 10; 1242 headerBlocksPage.Add("MasterDesktopExtra", masterDesktopLogo); 1243 if (!navigationActionHideSearch) 1244 { 1245 searchBar.SortId = 20; 1246 headerBlocksPage.Add("MasterDesktopExtra", searchBar); 1247 } 1248 masterDesktopActionsMenuContainer.SortId = 30; 1249 headerBlocksPage.Add("MasterDesktopExtra", masterDesktopActionsMenuContainer); 1250 masterDesktopMenu.SortId = 10; 1251 masterDesktopActionsMenuContainer.Design.Size = "auto-width"; 1252 headerBlocksPage.Add("MasterDesktopNavigation", masterDesktopMenu); 1253 break; 1254 } 1255 1256 headerBlocksPage.Add("MasterDesktopActionsMenuContainer", masterDesktopActionsMenu); 1257 } 1258 1259 @helper RenderDesktopTools() 1260 { 1261 List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopTools").OrderBy(item => item.SortId).ToList(); 1262 1263 <div class="tools-navigation dw-mod"> 1264 <div class="center-container grid top-container__center-container dw-mod"> 1265 @RenderBlockList(subBlocks) 1266 </div> 1267 </div> 1268 } 1269 1270 @helper RenderDesktopToolsText() 1271 { 1272 string toolsText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("ToolsText"); 1273 1274 <div class="u-margin-top">@toolsText</div> 1275 } 1276 1277 @helper RenderDesktopToolsNavigation() 1278 { 1279 <div> 1280 @RenderNavigation(new 1281 { 1282 id = "topToolsNavigation", 1283 cssclass = "menu menu-tools dw-mod dwnavigation", 1284 template = "TopMenu.xslt" 1285 }) 1286 </div> 1287 } 1288 1289 @helper RenderDesktopNavigation() 1290 { 1291 List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopNavigation").OrderBy(item => item.SortId).ToList(); 1292 1293 <nav class="main-navigation dw-mod"> 1294 <div class="center-container top-container__center-container grid grid--align-center dw-mod"> 1295 @RenderBlockList(subBlocks) 1296 </div> 1297 </nav> 1298 } 1299 1300 @helper RenderDesktopExtra() 1301 { 1302 List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopExtra").OrderBy(item => item.SortId).ToList(); 1303 1304 if (subBlocks.Count > 0) 1305 { 1306 <div class="header header-top dw-mod"> 1307 <div class="center-container top-container__center-container grid grid--align-center dw-mod"> 1308 @RenderBlockList(subBlocks) 1309 </div> 1310 </div> 1311 } 1312 } 1313 1314 @helper RenderDesktopLogo() 1315 { 1316 string firstPageId = Model.Area.FirstActivePage.ID.ToString(); 1317 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 1318 string alignClass = topLayout == "two-lines-centered" || topLayout == "two-lines" ? "grid--align-self-center" : ""; 1319 string logo = Model.Area.Item.GetItem("Layout").GetFile("LogoImage") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoImage").PathUrlEncoded : "/Files/Images/logo-dynamicweb.png"; 1320 string logoHeight = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetString("LogoHeight")) ? Model.Area.Item.GetItem("Layout").GetString("LogoHeight") : "40"; 1321 logoHeight = logoHeight != "0" ? logoHeight : "40"; 1322 if (Path.GetExtension(logo).ToLower() != ".svg") 1323 { 1324 logo = "/Admin/Public/GetImage.ashx?height=" + logoHeight + "&amp;crop=5&amp;Compression=75&amp;image=" + logo; 1325 1326 if (Pageview.Device.ToString() == "Mobile") 1327 { 1328 logoHeight = "40"; 1329 } 1330 } 1331 else 1332 { 1333 logo = HttpUtility.UrlDecode(logo); 1334 } 1335 1336 <div class="logo @alignClass dw-mod"> 1337 <a href="/Default.aspx?ID=@firstPageId" class="logo__img dw-mod u-block"> 1338 <img class="grid__cell-img logo__img dw-mod" src="@logo" /> 1339 </a> 1340 </div> 1341 } 1342 1343 @helper RenderDesktopMenu() 1344 { 1345 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 1346 string menuAlignment = topLayout == "two-lines-centered" || topLayout == "minimal-right" ? "u-pull--right" : ""; 1347 1348 bool megaMenu = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu").SelectedValue.ToLower() == "true" ? true : false; 1349 string megamenuPromotionImage = Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage").PathUrlEncoded : ""; 1350 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 1351 int startLevel = renderPagesInToolBar ? 1 : 0; 1352 1353 <div class="grid__cell"> 1354 <div class="@menuAlignment"> 1355 @if (!megaMenu) 1356 { 1357 @RenderNavigation(new 1358 { 1359 id = "topnavigation", 1360 cssclass = "menu dw-mod dwnavigation u-full-max-width", 1361 startLevel = @startLevel, 1362 ecomStartLevel = @startLevel + 1, 1363 endlevel = 5, 1364 expandmode = "all", 1365 template = "BaseMenuWithDropdown.xslt" 1366 }); 1367 } 1368 else 1369 { 1370 @RenderNavigation(new 1371 { 1372 id = "topnavigation", 1373 cssclass = "menu dw-mod dwnavigation u-full-max-width", 1374 startLevel = @startLevel, 1375 ecomStartLevel = @startLevel + 1, 1376 endlevel = 5, 1377 promotionImage = megamenuPromotionImage, 1378 promotionLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("MegamenuPromotionLink"), 1379 expandmode = "all", 1380 template = "BaseMegaMenu.xslt" 1381 }); 1382 } 1383 </div> 1384 </div> 1385 } 1386 1387 @helper RenderDesktopActionsMenu() 1388 { 1389 List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopActionsMenu").OrderBy(item => item.SortId).ToList(); 1390 1391 <ul class="menu dw-mod"> 1392 @RenderBlockList(subBlocks) 1393 </ul> 1394 } 1395 1396 @helper RenderLanguageSelector() 1397 { 1398 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 1399 string liClasses = topLayout != "normal" ? "menu__item menu__item--horizontal menu__item--top-level dw-mod u-hidden-xxs" : "menu__item menu__item--horizontal menu--clean dw-mod"; 1400 string menuLinkClass = topLayout != "normal" ? "menu__link" : "header-menu__link"; 1401 string languageViewType = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("LanguageSelector").SelectedValue) ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("LanguageSelector").SelectedValue.ToLower() : ""; 1402 1403 if (Model.Languages.Count > 1) 1404 { 1405 <li class="@liClasses is-dropdown is-dropdown--no-icon"> 1406 <div class="@menuLinkClass menu__link--icon dw-mod"> 1407 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue fa-1_5x"></i> 1408 </div> 1409 <div class="menu menu--dropdown dw-mod"> 1410 @foreach (var lang in Model.Languages) 1411 { 1412 string langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " u-margin-right\"></span>" + lang.Name; 1413 1414 if (languageViewType == "flag") 1415 { 1416 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + "\"></span>"; 1417 } 1418 1419 if (languageViewType == "name") 1420 { 1421 langInfo = lang.Name; 1422 } 1423 1424 <a href="/Default.aspx?AreaID=@Dynamicweb.Services.Pages.GetPage(lang.Page.ID).Area.ID" class="menu-dropdown__item menu-dropdown__item--link dw-mod">@langInfo</a> 1425 } 1426 </div> 1427 </li> 1428 } 1429 } 1430 1431 @helper RenderMiniCart() 1432 { 1433 bool navigationItemsHideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 1434 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 1435 int cartPageId = GetPageIdByNavigationTag("CartPage"); 1436 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 1437 1438 if (!onlyPreview && !navigationItemsHideCart) 1439 { 1440 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 1441 string liClasses = topLayout != "normal" ? "menu__item menu__item--horizontal menu__item--top-level dw-mod" : "menu__item menu__item--horizontal menu--clean dw-mod"; 1442 string menuLinkClass = topLayout != "normal" ? "menu__link" : "header-menu__link"; 1443 string cartProductsCount = Model.Cart.TotalProductsCount.ToString(); 1444 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue; 1445 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 1446 string cartProductsTotalPrice = showPrice && Model.Cart.TotalPrice != null ? Model.Cart.TotalPrice.Price.Formatted : ""; 1447 cartProductsTotalPrice = counterPosition == "right" ? cartProductsTotalPrice : ""; 1448 1449 if (showPrice && counterPosition == "right") 1450 { 1451 cartProductsCount = Translate("Cart") + "(" + cartProductsCount + ")"; 1452 } 1453 1454 1455 <li class="@liClasses" id="miniCartWrapper" onmouseenter="Cart.UpdateMiniCart('miniCartWrapper', 'miniCart', 'cartCounter', '/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart')"> 1456 <div class="mini-cart dw-mod"> 1457 <a href="/Default.aspx?ID=@cartPageId&Purge=True" id="miniCartCounterWrap" class="@menuLinkClass menu__link--icon dw-mod js-mini-cart-button"> 1458 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue fa-1_5x"></i> 1459 <div class="mini-cart__counter dw-mod"> 1460 <div class="js-handlebars-root js-mini-cart-counter" id="cartCounter" data-template="MiniCartCounterContent" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=Counter" data-init-onload="false" data-preloader="false"> 1461 <div class="js-mini-cart-counter-content"> 1462 @cartProductsCount 1463 @cartProductsTotalPrice 1464 </div> 1465 </div> 1466 </div> 1467 </a> 1468 @if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 1469 { 1470 <div class="mini-cart-dropdown js-handlebars-root js-mini-cart dw-mod" id="miniCart" data-template="MiniCartContent" data-cart-id="@miniCartFeedPageId" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart" data-init-onload="false"></div> 1471 } 1472 </div> 1473 </li> 1474 } 1475 } 1476 1477 @helper RenderSignIn() 1478 { 1479 bool navigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 1480 string userInitials = ""; 1481 int pageId = Model.TopPage.ID; 1482 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 1483 int myDashboardPageId = GetPageIdByNavigationTag("CustomerDashboard"); 1484 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 1485 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); 1486 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 1487 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards"); 1488 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 1489 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideAccount"); 1490 bool hideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); 1491 bool hideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); 1492 bool hideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); 1493 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); 1494 1495 string linkStart = "/Default.aspx?ID="; 1496 if (Model.CurrentUser.ID <= 0) 1497 { 1498 linkStart = linkStart + signInProfilePageId + "&RedirectPageId="; 1499 } 1500 1501 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; 1502 string myProfilePageLink = linkStart + myProfilePageId; 1503 string myOrdersPageLink = linkStart + myOrdersPageId; 1504 string myFavoritesPageLink = linkStart + myFavoritesPageId; 1505 string mySavedCardsPageLink = linkStart + mySavedCardsPageId; 1506 1507 if (Model.CurrentUser.ID != 0) 1508 { 1509 if (!String.IsNullOrEmpty(Model.CurrentUser.Name)) 1510 { 1511 string[] names = Model.CurrentUser.Name.Split(' '); 1512 userInitials += Model.CurrentUser.Name.Substring(0, 1); 1513 1514 if (names.Length > 1) 1515 { 1516 userInitials += names[names.Length - 1].Substring(0, 1); 1517 } 1518 } 1519 else 1520 { 1521 userInitials += Model.CurrentUser.FirstName != null && Model.CurrentUser.FirstName != "" ? Model.CurrentUser.FirstName.Substring(0, 1) : ""; 1522 userInitials += Model.CurrentUser.LastName != null && Model.CurrentUser.LastName != "" ? Model.CurrentUser.LastName.Substring(0, 1) : ""; 1523 userInitials += userInitials.Length == 1 && Model.CurrentUser.FirstName != null && Model.CurrentUser.FirstName.Length > 1 ? Model.CurrentUser.FirstName.Substring(1, 2) : ""; 1524 userInitials += userInitials == "" && Model.CurrentUser.Email != null && Model.CurrentUser.Email.Length > 1 ? Model.CurrentUser.Email.Substring(0, 2) : ""; 1525 userInitials += userInitials == "" ? Model.CurrentUser.UserName.Substring(0, 2) : ""; 1526 } 1527 } 1528 1529 if (!navigationItemsHideSignIn) 1530 { 1531 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 1532 string liClasses = topLayout != "normal" ? "menu__item menu__item--horizontal menu__item--top-level dw-mod u-hidden-xxs" : "menu__item menu__item--horizontal menu__item--clean dw-mod"; 1533 string menuLinkClass = topLayout != "normal" ? "menu__link" : "header-menu__link"; 1534 1535 <li class="@liClasses is-dropdown is-dropdown--no-icon"> 1536 <div class="@menuLinkClass menu__link--icon dw-mod"> 1537 @if (Model.CurrentUser.ID <= 0) 1538 { 1539 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue fa-1_5x"></i> 1540 } 1541 else 1542 { 1543 <a href="/default.aspx?ID=@myDashboardPageId" class="u-color-inherit"><div class="circle-icon-btn">@userInitials.ToUpper()</div></a> 1544 } 1545 </div> 1546 <div class="menu menu--dropdown sign-in-dropdown dw-mod"> 1547 <ul class="list list--clean dw-mod"> 1548 @if (Model.CurrentUser.ID <= 0) 1549 { 1550 <li> 1551 <label for="SignInModalTrigger" class="btn btn--primary btn--full u-no-margin sign-in-modal-trigger-button dw-mod" onclick="setTimeout(function () { document.getElementById('LoginUsername').focus() }, 10)">@Translate("Sign in")</label> 1552 </li> 1553 if (!hideCreateAccountLink) 1554 { 1555 <li> 1556 <a href="/default.aspx?ID=@createAccountPageId" class="list__link dw-mod">@Translate("Create account")</a> 1557 </li> 1558 } 1559 <li> 1560 <a href="@forgotPasswordPageLink" class="list__link dw-mod">@Translate("Forgot your password?")</a> 1561 </li> 1562 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) 1563 { 1564 <li class="list__seperator dw-mod"></li> 1565 } 1566 } 1567 @if (!hideMyProfileLink) 1568 { 1569 <li> 1570 <a href="@myProfilePageLink" class="list__link dw-mod"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue u-margin-right"></i>@Translate("My Profile")</a> 1571 </li> 1572 } 1573 @if (!hideMyOrdersLink) 1574 { 1575 <li> 1576 <a href="@myOrdersPageLink" class="list__link dw-mod"><i class="fas fa-list u-margin-right"></i>@Translate("My Orders")</a> 1577 </li> 1578 } 1579 @if (!hideMyFavoritesLink) 1580 { 1581 <li> 1582 <a href="@myFavoritesPageLink" class="list__link dw-mod"><i class="fas fa-@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue u-margin-right"></i>@Translate("My Favorites")</a> 1583 </li> 1584 } 1585 @if (!hideMySavedCardsLink) 1586 { 1587 <li> 1588 <a href="@mySavedCardsPageLink" class="list__link dw-mod"><i class="fas fa-credit-card u-margin-right"></i>@Translate("My Saved cards")</a> 1589 </li> 1590 } 1591 @if (Model.CurrentUser.ID > 0) 1592 { 1593 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) 1594 { 1595 <li class="list__seperator dw-mod"></li> 1596 } 1597 <li> 1598 <a href="/Admin/Public/ExtranetLogoff.aspx?ID=@pageId" class="list__link dw-mod">@Translate("Sign out")</a> 1599 </li> 1600 } 1601 </ul> 1602 </div> 1603 </li> 1604 } 1605 } 1606 1607 @helper RenderFavorites() 1608 { 1609 bool navigationItemsHideFavorites = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideFavorites"); 1610 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 1611 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 1612 1613 string linkStart = "/Default.aspx?ID="; 1614 if (Model.CurrentUser.ID <= 0) 1615 { 1616 linkStart = linkStart + signInProfilePageId + "&RedirectPageId="; 1617 } 1618 1619 string myFavoritesPageLink = linkStart + myFavoritesPageId; 1620 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 1621 string liClasses = topLayout != "normal" ? "menu__item menu__item--horizontal menu__item--top-level dw-mod u-hidden-xxs" : "menu__item menu__item--horizontal menu--clean dw-mod"; 1622 string menuLinkClass = topLayout != "normal" ? "menu__link" : "header-menu__link"; 1623 1624 <li class="@liClasses"> 1625 <a href="@myFavoritesPageLink" class="@menuLinkClass menu__link--icon dw-mod"> 1626 <i class="fas fa-@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue fa-1_5x"></i> 1627 </a> 1628 </li> 1629 } 1630 1631 @helper RenderHeaderButton() 1632 { 1633 string headerButtonText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonText"); 1634 string headerButtonLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink"); 1635 string headerButtonType = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType") != null ? "btn--" + Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType").SelectedName.ToLower() : ""; 1636 1637 <li class="menu__item menu__item--horizontal menu--clean dw-mod"> 1638 <a class="btn @headerButtonType dw-mod u-no-margin u-margin-top u-margin-left" href="@headerButtonLink">@headerButtonText</a> 1639 </li> 1640 } 1641 1642 @helper RenderSearchBar(string alignment = "left") 1643 { 1644 string searchFeedId = ""; 1645 string searchSecondFeedId = ""; 1646 int groupsFeedId; 1647 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 1648 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 1649 string resultPageLink; 1650 string searchPlaceholder; 1651 string searchType = "product-search"; 1652 string searchTemplate; 1653 string searchContentTemplate = ""; 1654 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") != null ? HttpContext.Current.Request.QueryString.Get("Search") : ""; 1655 bool showGroups = true; 1656 1657 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch") 1658 { 1659 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 1660 resultPageLink = contentSearchPageLink; 1661 searchPlaceholder = Translate("Search page"); 1662 groupsFeedId = 0; 1663 searchType = "content-search"; 1664 searchTemplate = "SearchPagesTemplate"; 1665 showGroups = false; 1666 } 1667 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch") 1668 { 1669 searchFeedId = productsPageId + "&feed=true"; 1670 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 1671 resultPageLink = Converter.ToString(productsPageId); 1672 searchPlaceholder = Translate("Search products or pages"); 1673 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 1674 searchType = "combined-search"; 1675 searchTemplate = "SearchProductsTemplateWrap"; 1676 searchContentTemplate = "SearchPagesTemplateWrap"; 1677 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 1678 } 1679 else 1680 { 1681 resultPageLink = Converter.ToString(productsPageId); 1682 searchFeedId = productsPageId + "&feed=true"; 1683 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 1684 searchPlaceholder = Translate("Search products"); 1685 searchTemplate = "SearchProductsTemplate"; 1686 searchType = "product-search"; 1687 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 1688 } 1689 1690 <div class="typeahead typeahead--centered u-color-inherit js-typeahead dw-mod" data-page-size="7" id="ProductSearchBar" data-search-feed-id="@searchFeedId" data-search-second-feed-id="@searchSecondFeedId" data-result-page-id="@resultPageLink" data-groups-page-id="@groupsFeedId" data-search-type="@searchType"> 1691 @if (showGroups) 1692 { 1693 <button type="button" class="btn btn--condensed u-color-light-gray--bg typeahead-group-btn dw-mod js-typeahead-groups-btn" data-group-id="all">@Translate("All")</button> 1694 <ul class="dropdown dropdown--absolute-position u-min-w220px js-handlebars-root js-typeahead-groups-content dw-mod" id="ProductSearchBarGroupsContent" data-template="SearchGroupsTemplate" data-json-feed="/Default.aspx?ID=@groupsFeedId&feedType=productGroups" data-init-onload="false" data-preloader="minimal"></ul> 1695 } 1696 <div class="typeahead-search-field"> 1697 <input type="text" class="u-no-margin u-full-width u-full-height js-typeahead-search-field" placeholder="@searchPlaceholder" value="@searchValue"> 1698 @if (string.IsNullOrEmpty(searchSecondFeedId)) 1699 { 1700 <ul class="dropdown dropdown--absolute-position u-min-w220px u-full-width js-handlebars-root js-typeahead-search-content dw-mod" id="ProductSearchBarContent" data-template="@searchTemplate" data-json-feed="/Default.aspx?ID=@searchFeedId&feedType=productsOnly" data-init-onload="false"></ul> 1701 } 1702 else 1703 { 1704 <div class="dropdown dropdown--absolute-position dropdown--combined grid @(alignment == "right" ? "dropdown--right-aligned" : "")"> 1705 <div class="js-handlebars-root js-typeahead-search-content grid__col-sm-7 grid__col--bleed-y" id="ProductSearchBarContent" data-template="@searchTemplate" data-json-feed="/Default.aspx?ID=@searchFeedId&feedType=productsOnly" data-init-onload="false"></div> 1706 <div class="js-handlebars-root js-typeahead-additional-search-content grid__col-sm-5 grid__col--bleed-y" id="ContentSearchBarContent" data-template="@searchContentTemplate" data-json-feed="/Default.aspx?ID=@searchSecondFeedId" data-init-onload="false"></div> 1707 </div> 1708 } 1709 </div> 1710 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod js-typeahead-enter-btn"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue"></i></button> 1711 </div> 1712 } 1713 1714 @helper RenderMiniSearch() 1715 { 1716 string searchFeedId = ""; 1717 string searchSecondFeedId = ""; 1718 int groupsFeedId; 1719 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 1720 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 1721 string resultPageLink; 1722 string searchPlaceholder; 1723 string searchType = "product-search"; 1724 string searchTemplate; 1725 string searchContentTemplate = ""; 1726 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") != null ? HttpContext.Current.Request.QueryString.Get("Search") : ""; 1727 bool showGroups = true; 1728 1729 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch") 1730 { 1731 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 1732 resultPageLink = contentSearchPageLink; 1733 searchPlaceholder = Translate("Search page"); 1734 groupsFeedId = 0; 1735 searchType = "content-search"; 1736 searchTemplate = "SearchPagesTemplate"; 1737 showGroups = false; 1738 } 1739 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch") 1740 { 1741 searchFeedId = productsPageId + "&feed=true"; 1742 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 1743 resultPageLink = Converter.ToString(productsPageId); 1744 searchPlaceholder = Translate("Search products or pages"); 1745 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 1746 searchType = "combined-search"; 1747 searchTemplate = "SearchProductsTemplateWrap"; 1748 searchContentTemplate = "SearchPagesTemplateWrap"; 1749 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 1750 } 1751 else 1752 { 1753 resultPageLink = Converter.ToString(productsPageId); 1754 searchFeedId = productsPageId + "&feed=true"; 1755 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 1756 searchPlaceholder = Translate("Search products"); 1757 searchTemplate = "SearchProductsTemplate"; 1758 searchType = "product-search"; 1759 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 1760 } 1761 1762 <li class="menu__item menu__item--horizontal menu__item--top-level u-hidden-xxs is-dropdown is-dropdown--no-icon dw-mod" onmouseover="document.getElementById('headerSearch').focus()"> 1763 <div class="menu__link menu__link--icon dw-mod"> 1764 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> 1765 </div> 1766 <div class="menu menu--dropdown u-w380px top-micro-search dw-mod"> 1767 <div class="typeahead js-typeahead" data-page-size="7" id="ProductSearchBar" data-search-feed-id="@searchFeedId" data-search-second-feed-id="@searchSecondFeedId" data-result-page-id="@resultPageLink" data-search-type="@searchType"> 1768 <div class="typeahead-search-field"> 1769 <input type="text" class="u-no-margin u-full-width js-typeahead-search-field" id="headerSearch" placeholder="@searchPlaceholder" value="@searchValue"> 1770 @if (string.IsNullOrEmpty(searchSecondFeedId)) 1771 { 1772 <ul class="dropdown dropdown--absolute-position u-min-w220px u-full-width js-handlebars-root js-typeahead-search-content dw-mod" id="ProductSearchBarContent" data-template="@searchTemplate" data-json-feed="/Default.aspx?ID=@searchFeedId&feedType=productsOnly" data-init-onload="false"></ul> 1773 } 1774 else 1775 { 1776 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--right-aligned"> 1777 <div class="js-handlebars-root js-typeahead-search-content grid__col-sm-7 grid__col--bleed-y" id="ProductSearchBarContent" data-template="@searchTemplate" data-json-feed="/Default.aspx?ID=@searchFeedId&feedType=productsOnly" data-init-onload="false"></div> 1778 <div class="js-handlebars-root js-typeahead-additional-search-content grid__col-sm-5 grid__col--bleed-y" id="ContentSearchBarContent" data-template="@searchContentTemplate" data-json-feed="/Default.aspx?ID=@searchSecondFeedId" data-init-onload="false"></div> 1779 </div> 1780 } 1781 </div> 1782 </div> 1783 </div> 1784 </li> 1785 } 1786 1787 @helper RenderImpersonationBar() 1788 { 1789 int impersonationPageId = GetPageIdByNavigationTag("Impersonation"); 1790 1791 <div class="u-color-warning--bg"> 1792 <div class="center-container top-container__center-container dw-mod"> 1793 @*Impersonation*@ 1794 <div class="grid"> 1795 <div class="grid--align-self-center grid__col-x"> 1796 @if (Model.CurrentSecondaryUser != null && Model.CurrentSecondaryUser.ID > 0) 1797 { 1798 string stopImpersonateTranslation = Translate("Stop impersonation"); 1799 string username = ""; 1800 if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.FirstName) && !string.IsNullOrEmpty(Model.CurrentSecondaryUser.LastName)) 1801 { 1802 username = Model.CurrentSecondaryUser.FirstName + " " + Model.CurrentSecondaryUser.LastName; 1803 } 1804 else if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.Name)) 1805 { 1806 username = Model.CurrentSecondaryUser.Name; 1807 } 1808 else if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.Email)) 1809 { 1810 username = Model.CurrentSecondaryUser.Email; 1811 } 1812 else 1813 { 1814 username = Model.CurrentSecondaryUser.UserName; 1815 } 1816 <div class="grid-cell"> 1817 <div class="u-pull--left u-bold u-margin-top"> 1818 <i class="fas fa-user-secret"></i> 1819 @Pageview.User.UserName<text>&nbsp;</text>@Translate("is impersonating")<text>&nbsp;</text>@username 1820 </div> 1821 <form method="post" class="u-pull--right u-no-margin"> 1822 <input type="submit" class="btn btn--secondary dw-mod u-no-margin" name="DwExtranetRemoveSecondaryUser" value="@stopImpersonateTranslation"> 1823 </form> 1824 </div> 1825 } 1826 else 1827 { 1828 string viewListTranslation = Translate("View the list of users you can impersonate"); 1829 <div class="grid-cell u-bold"> 1830 <i class="fas fa-user-secret"></i> 1831 <a href="/Default.aspx?ID=@impersonationPageId" title="@viewListTranslation" class="u-color-font-black">@viewListTranslation</a> 1832 </div> 1833 } 1834 </div> 1835 </div> 1836 </div> 1837 </div> 1838 } 1839 1840 </text> 1841 } 1842 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 1843 1844 @using System 1845 @using System.Web 1846 @using System.Collections.Generic 1847 @using Dynamicweb.Rapido.Blocks.Extensibility 1848 @using Dynamicweb.Rapido.Blocks 1849 1850 @functions { 1851 BlocksPage footerBlocksPage = BlocksPage.GetBlockPage("Master"); 1852 } 1853 1854 @{ 1855 string footerColumnOneContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Content") : ""; 1856 string footerColumnTwoContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Content") : ""; 1857 string footerColumnThreeContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Content") : ""; 1858 string footerColumnOneHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Header") : ""; 1859 string footerColumnTwoHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Header") : ""; 1860 string footerColumnThreeHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Header") : ""; 1861 1862 Block masterFooterContent = new Block() 1863 { 1864 Id = "MasterFooterContent", 1865 SortId = 10, 1866 Template = RenderFooter(), 1867 SkipRenderBlocksList = true 1868 }; 1869 footerBlocksPage.Add(MasterBlockId.MasterFooter, masterFooterContent); 1870 1871 if (!string.IsNullOrEmpty(footerColumnOneContent) || !string.IsNullOrEmpty(footerColumnOneHeader)) 1872 { 1873 Block masterFooterColumnOne = new Block 1874 { 1875 Id = "MasterFooterColumnOne", 1876 SortId = 10, 1877 Template = RenderFooterColumn(footerColumnOneHeader, footerColumnOneContent), 1878 Design = new Design { 1879 Size = "auto", 1880 RenderType = RenderType.Column 1881 } 1882 }; 1883 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnOne); 1884 } 1885 1886 if (!string.IsNullOrEmpty(footerColumnTwoContent) || !string.IsNullOrEmpty(footerColumnTwoHeader)) 1887 { 1888 Block masterFooterColumnTwo = new Block 1889 { 1890 Id = "MasterFooterColumnTwo", 1891 SortId = 20, 1892 Template = RenderFooterColumn(footerColumnTwoHeader, footerColumnTwoContent), 1893 Design = new Design 1894 { 1895 Size = "auto", 1896 RenderType = RenderType.Column 1897 } 1898 }; 1899 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnTwo); 1900 } 1901 1902 if (!string.IsNullOrEmpty(footerColumnThreeContent) || !string.IsNullOrEmpty(footerColumnThreeHeader)) 1903 { 1904 Block masterFooterColumnThree = new Block 1905 { 1906 Id = "MasterFooterColumnThree", 1907 SortId = 30, 1908 Template = RenderFooterColumn(footerColumnThreeHeader, footerColumnThreeContent), 1909 Design = new Design 1910 { 1911 Size = "auto", 1912 RenderType = RenderType.Column 1913 } 1914 }; 1915 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnThree); 1916 } 1917 1918 if (Model.Area.Item.GetItem("Layout").GetBoolean("FooterNewsletterSignUp")) 1919 { 1920 Block masterFooterNewsletterSignUp = new Block 1921 { 1922 Id = "MasterFooterNewsletterSignUp", 1923 SortId = 40, 1924 Template = RenderFooterNewsletterSignUp(), 1925 Design = new Design 1926 { 1927 Size = "auto", 1928 RenderType = RenderType.Column 1929 } 1930 }; 1931 footerBlocksPage.Add("MasterFooterContent", masterFooterNewsletterSignUp); 1932 } 1933 1934 if (Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks").Count > 0) 1935 { 1936 Block masterFooterSocialLinks = new Block 1937 { 1938 Id = "MasterFooterSocialLinks", 1939 SortId = 50, 1940 Template = RenderFooterSocialLinks(), 1941 Design = new Design 1942 { 1943 Size = "auto", 1944 RenderType = RenderType.Column 1945 } 1946 }; 1947 footerBlocksPage.Add("MasterFooterContent", masterFooterSocialLinks); 1948 } 1949 1950 if (Model.Area.Item.GetItem("Layout").GetItems("FooterPayments") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterPayments").Count > 0) 1951 { 1952 Block masterFooterPayments = new Block 1953 { 1954 Id = "MasterFooterPayments", 1955 SortId = 60, 1956 Template = RenderFooterPayments(), 1957 Design = new Design 1958 { 1959 Size = "12", 1960 RenderType = RenderType.Column 1961 } 1962 }; 1963 footerBlocksPage.Add("MasterFooterContent", masterFooterPayments); 1964 } 1965 1966 Block masterFooterCopyright = new Block 1967 { 1968 Id = "MasterFooterCopyright", 1969 SortId = 70, 1970 Template = RenderFooterCopyright(), 1971 Design = new Design 1972 { 1973 Size = "12", 1974 RenderType = RenderType.Column 1975 } 1976 }; 1977 footerBlocksPage.Add("MasterFooterContent", masterFooterCopyright); 1978 } 1979 1980 @helper RenderFooter() { 1981 List<Block> subBlocks = this.footerBlocksPage.GetBlockListById("MasterFooterContent").OrderBy(item => item.SortId).ToList(); 1982 1983 <footer class="footer dw-mod"> 1984 <div class="center-container top-container__center-container dw-mod"> 1985 <div class="grid grid--external-bleed-x"> 1986 @RenderBlockList(subBlocks) 1987 </div> 1988 </div> 1989 </footer> 1990 } 1991 1992 @helper RenderFooterColumn(string header, string content) { 1993 <h3 class="footer__heading dw-mod">@header</h3> 1994 <div class="footer__content dw-mod"> 1995 @content 1996 </div> 1997 } 1998 1999 @helper RenderFooterNewsletterSignUp() { 2000 string newsletterSignUpPageId = GetPageIdByNavigationTag("NewsletterSignUp").ToString(); 2001 2002 <h3 class="footer__heading dw-mod">@Translate("Mailing list")</h3> 2003 <div class="footer__content dw-mod"> 2004 <p>@Translate("Sign up if you would like to receive occasional treats from us", "Sign up if you would like to receive occasional treats from us").</p> 2005 <form class="form dw-mod" name="NewsletterRedirect" action='/Default.aspx' method="get" enctype="multipart/form-data"> 2006 <input name="ID" value="@newsletterSignUpPageId" type="hidden" /> 2007 <div class="form__field-combi"> 2008 <input name="NewsletterEmail" id="NewsletterEmail" type="text" placeholder='@Translate("Your email address", "Your email address")' /> 2009 <input class="btn btn--primary btn--condensed dw-mod" type="submit" id="Submitter" value='@Translate("Go", "Go")' /> 2010 </div> 2011 </form> 2012 </div> 2013 } 2014 2015 @helper RenderFooterSocialLinks() { 2016 <h3 class="footer__heading dw-mod">@Translate("Social links")</h3> 2017 <div class="footer__content dw-mod"> 2018 <div class="collection dw-mod"> 2019 @foreach (var socialitem in Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks")) 2020 { 2021 var socialIcon = socialitem.GetValue("Icon") as Dynamicweb.Frontend.ListViewModel; 2022 string socialIconClass = socialIcon.SelectedValue; 2023 string socialIconTitle = socialIcon.SelectedName; 2024 string socialLink = socialitem.GetString("Link"); 2025 2026 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px"><i class="@socialIconClass fa-2x"></i></a> 2027 } 2028 </div> 2029 </div> 2030 } 2031 2032 @helper RenderFooterPayments() { 2033 <div class="footer__content dw-mod"> 2034 <div class="collection dw-mod"> 2035 @foreach (var payment in Model.Area.Item.GetItem("Layout").GetItems("FooterPayments")) 2036 { 2037 var paymentItem = payment.GetValue("CardTypeOrVerifiedPayment") as Dynamicweb.Frontend.ListViewModel; 2038 string paymentImage = null; 2039 string paymentTitle = paymentItem.SelectedName; 2040 ListOptionViewModel selected = paymentItem.SelectedOptions.FirstOrDefault(); 2041 if (selected != null) 2042 { 2043 paymentImage = selected.Icon; 2044 } 2045 2046 <div class="footer__card-type"> 2047 <img src="/Admin/Public/GetImage.ashx?width=60&Compression=75&image=@paymentImage" alt="@paymentTitle" title="@paymentTitle" /> 2048 </div> 2049 } 2050 </div> 2051 </div> 2052 } 2053 2054 @helper RenderFooterCopyright() { 2055 <div class="grid__col-12 footer__copyright dw-mod"> 2056 <p>@Model.Area.Item.GetItem("Layout").GetString("FooterCopyrightText")</p> 2057 </div> 2058 } 2059 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 2060 2061 @using System 2062 @using System.Web 2063 @using System.Collections.Generic 2064 @using Dynamicweb.Rapido.Blocks.Extensibility 2065 @using Dynamicweb.Rapido.Blocks 2066 2067 @{ 2068 BlocksPage miniCartBlocksPage = BlocksPage.GetBlockPage("Master"); 2069 bool navigationItemsHideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 2070 2071 if (!navigationItemsHideCart) 2072 { 2073 Block miniCartScriptTemplates = new Block() 2074 { 2075 Id = "MasterMiniCartTemplates", 2076 SortId = 1, 2077 Template = RenderMiniCartScriptTemplates(), 2078 SkipRenderBlocksList = true, 2079 BlocksList = new List<Block> 2080 { 2081 new Block { 2082 Id = "MiniCartHeader", 2083 SortId = 10, 2084 Template = RenderMiniCartHeader() 2085 }, 2086 new Block { 2087 Id = "MiniCartOrderLines", 2088 SortId = 20, 2089 Template = RenderMiniCartOrderLines() 2090 }, 2091 new Block { 2092 Id = "MiniCartFees", 2093 SortId = 30, 2094 Template = RenderMiniCartFees() 2095 }, 2096 new Block { 2097 Id = "MiniCartPoints", 2098 SortId = 40, 2099 Template = RenderMiniCartPoints() 2100 }, 2101 new Block { 2102 Id = "MiniCartTotal", 2103 SortId = 50 , 2104 Template = RenderMiniCartTotal() 2105 } 2106 } 2107 }; 2108 2109 miniCartBlocksPage.Add(MasterBlockId.MasterBottomSnippets, miniCartScriptTemplates); 2110 } 2111 } 2112 2113 @helper RenderMiniCartScriptTemplates() 2114 { 2115 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMiniCartTemplates").OrderBy(item => item.SortId).ToList(); 2116 2117 int cartPageId = GetPageIdByNavigationTag("CartPage"); 2118 bool showPriceInMiniCartCounter = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 2119 showPriceInMiniCartCounter = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue == "right" ? showPriceInMiniCartCounter : false; 2120 showPriceInMiniCartCounter = Pageview.Device.ToString() == "Mobile" ? false : showPriceInMiniCartCounter; 2121 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 2122 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 2123 string addingToCartNotification = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType").SelectedValue : ""; 2124 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 2125 2126 2127 <script id="MiniCartCounterContent" type="text/x-template"> 2128 {{#.}} 2129 <div class="js-mini-cart-counter-content dw-mod"> 2130 @if (showPriceInMiniCartCounter) { 2131 @Translate("Cart")<text>({{numberofproducts}}) {{totalprice}}</text> 2132 } else { 2133 <text>{{numberofproducts}}</text> 2134 } 2135 </div> 2136 {{/.}} 2137 </script> 2138 2139 <script id="MiniCartContent" type="text/x-template"> 2140 {{#.}} 2141 @if (useGoogleTagManager) 2142 { 2143 <text>{{{googleEnchantImpressionEmptyCart OrderLines}}}</text> 2144 } 2145 <div class="mini-cart-dropdown__inner {{isempty}} dw-mod"> 2146 <h4 class="u-ta-center u-no-margin u-margin-bottom u-margin-top">@Translate("Shopping cart")</h4> 2147 <div class="mini-cart-dropdown__body dw-mod"> 2148 <table class="table mini-cart-table dw-mod"> 2149 @RenderBlockList(subBlocks) 2150 </table> 2151 </div> 2152 2153 <table class="table mini-cart-table dw-mod"> 2154 <tr class="mini-cart-orderlines__footer dw-mod"> 2155 <td colspan="2"><button type="button" class="btn btn--secondary u-pull--left u-no-margin dw-mod btn--sm" onclick="googleEnchantImpressionEmptyCart(); Cart.EmptyCart(event);">@Translate("Empty cart")</button></td> 2156 <td colspan="2" class="u-ta-right"><a href="/Default.aspx?ID=@cartPageId" class="btn btn--primary u-pull--right u-no-margin dw-mod btn--sm">@Translate("Proceed to checkout")</a></td> 2157 </tr> 2158 </table> 2159 </div> 2160 {{/.}} 2161 </script> 2162 2163 <script id="MiniCartOrderline" type="text/x-template"> 2164 <tr class="{{isempty}}"> 2165 <td><a href="{{link}}" class="{{hideimage}}"><img src="/Admin/Public/GetImage.ashx?width=50&height=50&crop=5&Compression=75&image={{image}}" alt="{{name}}"></a></td> 2166 <td> 2167 <a href="{{link}}" class="mini-cart-orderlines__name" title="{{name}}">{{name}}</a> 2168 {{#if variantname}} 2169 <a href="{{link}}" class="mini-cart-orderlines__name mini-cart-orderlines__name--small">{{variantname}}</a> 2170 {{/if}} 2171 {{#if unitname}} 2172 <div class="mini-cart-orderlines__name mini-cart-orderlines__name--small">{{unitname}}</div> 2173 {{/if}} 2174 </td> 2175 <td class="u-ta-right">{{quantity}}</td> 2176 <td class="u-ta-right"> 2177 {{#if pointsTotal}} 2178 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 2179 {{else}} 2180 {{totalprice}} 2181 {{/if}} 2182 </td> 2183 </tr> 2184 </script> 2185 2186 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 2187 <tr class="table__row--no-border {{isempty}}"> 2188 <td>&nbsp;</td> 2189 <td><div class="mini-cart-orderlines__name dw-mod">{{name}}</div></td> 2190 <td class="u-ta-right">&nbsp;</td> 2191 <td class="u-ta-right">{{totalprice}}</td> 2192 </tr> 2193 </script> 2194 2195 if (!onlyPreview && addingToCartNotification == "modal") 2196 { 2197 <div id="LastAddedProductModal" data-template="LastAddedProductTemplate"></div> 2198 2199 <script id="LastAddedProductTemplate" type="text/x-template"> 2200 <!-- Trigger for the login modal --> 2201 <input type="checkbox" id="LastAddedProductModalTrigger" class="modal-trigger" /> 2202 2203 <!-- Login modal --> 2204 <div class="modal-container"> 2205 <label for="LastAddedProductModalTrigger" class="modal-overlay"></label> 2206 <div class="modal modal--md"> 2207 <div class="modal__header"> 2208 <h2>@Translate("Product is added to the cart")</h2> 2209 </div> 2210 <div class="modal__body"> 2211 <div class="grid"> 2212 <div> 2213 <a href="{{productInfo.link}}"><img src="{{productInfo.image}}" alt="{{productInfo.name}}" /></a> 2214 </div> 2215 <div class="u-padding"> 2216 <span>{{quantity}}</span> x 2217 </div> 2218 <div class="grid__col-auto"> 2219 <div>{{productInfo.name}}</div> 2220 {{#if productInfo.variantName}} 2221 <small class="u-margin-bottom-5px">{{productInfo.variantName}}</small> 2222 {{/if}} 2223 {{#if productInfo.unitName}} 2224 <small class="u-margin-bottom-5px">{{productInfo.unitName}}</small> 2225 {{/if}} 2226 </div> 2227 </div> 2228 <div class="modal__footer u-margin-top--lg"> 2229 <label class="btn btn--secondary u-pull--left u-no-margin dw-mod btn--sm" for="LastAddedProductModalTrigger">@Translate("Continue shopping")</label> 2230 <a href="/cart" class="btn btn--primary u-pull--right u-no-margin dw-mod btn--sm">@Translate("Proceed to checkout")</a> 2231 </div> 2232 </div> 2233 <label class="modal__close-btn" for="LastAddedProductModalTrigger"></label> 2234 </div> 2235 </div> 2236 </script> 2237 <script> 2238 document.addEventListener('addToCart', function (event) { 2239 Cart.ShowLastAddedProductModal(event.detail); 2240 }); 2241 </script> 2242 } 2243 else if (!onlyPreview && addingToCartNotification == "toggle") 2244 { 2245 <script> 2246 document.addEventListener('addToCart', function () { 2247 Cart.ToggleMiniCart('miniCartWrapper', 'miniCart', 'cartCounter', '@miniCartFeedPageId'); 2248 }); 2249 </script> 2250 } 2251 } 2252 2253 @helper RenderMiniCartHeader() { 2254 <thead> 2255 <tr> 2256 <td>&nbsp;</td> 2257 <td>@Translate("Product")</td> 2258 <td class="u-ta-right">@Translate("Qty")</td> 2259 <td class="u-ta-right" width="120">@Translate("Price")</td> 2260 </tr> 2261 </thead> 2262 } 2263 2264 @helper RenderMiniCartOrderLines() { 2265 <text> 2266 {{#OrderLines}} 2267 {{#ifCond template "===" "CartOrderline"}} 2268 {{>MiniCartOrderline}} 2269 {{/ifCond}} 2270 {{#ifCond template "===" "CartOrderlineMobile"}} 2271 {{>MiniCartOrderline}} 2272 {{/ifCond}} 2273 {{#ifCond template "===" "CartOrderlineDiscount"}} 2274 {{>MiniCartOrderlineDiscount}} 2275 {{/ifCond}} 2276 {{/OrderLines}} 2277 </text> 2278 } 2279 2280 @helper RenderMiniCartFees() { 2281 <tr> 2282 <td><i class="fas fa-credit-card"></i></td> 2283 <td>{{paymentmethod}}</td> 2284 <td colspan="2" class="u-ta-right" width="130">{{paymentfee}}</td> 2285 </tr> 2286 <tr> 2287 <td><i class="fas fa-truck"></i></td> 2288 <td>{{shippingmethod}}</td> 2289 <td colspan="2" class="u-ta-right" width="130">{{shippingfee}}</td> 2290 </tr> 2291 } 2292 2293 @helper RenderMiniCartPoints() { 2294 <text> 2295 {{#if earnings}} 2296 <tr> 2297 <td colspan="2">@Translate("Earnings")</td> 2298 <td colspan="2" class="u-ta-right" width="130"><span class="u-color--loyalty-points">{{earnings}}</span> @Translate("points")</td> 2299 </tr> 2300 {{/if}} 2301 </text> 2302 } 2303 2304 @helper RenderMiniCartTotal() { 2305 <tr class="mini-cart-totals dw-mod"> 2306 <td colspan="2">@Translate("Total")</td> 2307 <td class="u-ta-right">{{numberofproducts}}</td> 2308 <td class="u-ta-right" width="130">{{totalprice}}</td> 2309 </tr> 2310 } 2311 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2312 2313 @using System 2314 @using System.Web 2315 @using System.Collections.Generic 2316 @using Dynamicweb.Rapido.Blocks.Extensibility 2317 @using Dynamicweb.Rapido.Blocks 2318 @using Dynamicweb.Ecommerce.Common 2319 2320 @{ 2321 BlocksPage referencesBlocksPage = BlocksPage.GetBlockPage("Master"); 2322 2323 Block masterScriptReferences = new Block() 2324 { 2325 Id = "MasterScriptReferences", 2326 SortId = 1, 2327 Template = RenderMasterScriptReferences() 2328 }; 2329 referencesBlocksPage.Add(MasterBlockId.MasterReferences, masterScriptReferences); 2330 } 2331 2332 @helper RenderMasterScriptReferences() { 2333 <script src="/Files/Templates/Designs/Rapido/js/handlebars-v4.0.11.js"></script> 2334 <script src="/Files/Templates/Designs/Rapido/js/master.min.js"></script> 2335 2336 if (Model.Area.Item.GetItem("Settings").GetBoolean("UseCustomJavascript")) 2337 { 2338 <script src="/Files/Templates/Designs/Rapido/js/custom.min.js"></script> 2339 } 2340 } 2341 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 2342 2343 @using System 2344 @using System.Web 2345 @using System.Collections.Generic 2346 @using Dynamicweb.Rapido.Blocks.Extensibility 2347 @using Dynamicweb.Rapido.Blocks 2348 2349 @{ 2350 BlocksPage searchBlocksPage = BlocksPage.GetBlockPage("Master"); 2351 bool navigationItemsHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 2352 2353 if (!navigationItemsHideSearch) 2354 { 2355 Block masterSearchScriptTemplates = new Block() 2356 { 2357 Id = "MasterSearchScriptTemplates", 2358 SortId = 1, 2359 Template = RenderSearchScriptTemplates() 2360 }; 2361 2362 searchBlocksPage.Add(MasterBlockId.MasterBottomSnippets, masterSearchScriptTemplates); 2363 } 2364 } 2365 2366 @helper RenderSearchScriptTemplates() 2367 { 2368 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 2369 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 2370 bool useFacebookPixel = !string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID")); 2371 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 2372 bool useGoogleTagManager = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID")); 2373 2374 <script id="SearchGroupsTemplate" type="text/x-template"> 2375 {{#.}} 2376 <li class="dropdown__item dw-mod" onclick="Search.UpdateGroupSelection(this)" data-group-id="{{id}}">{{name}}</li> 2377 {{/.}} 2378 </script> 2379 2380 <script id="SearchProductsTemplate" type="text/x-template"> 2381 {{#each .}} 2382 {{#Product}} 2383 {{#ifCond template "!==" "SearchMore"}} 2384 <li class="dropdown__item dropdown__item--seperator dw-mod"> 2385 @if (useFacebookPixel) 2386 { 2387 <text>{{{facebookPixelSearch name number priceDouble currency searchParameter}}}</text> 2388 } 2389 @if (useGoogleTagManager) 2390 { 2391 <text>{{{googleEnchantImpression 'Search results' currency googleImpression}}}</text> 2392 } 2393 <div> 2394 <a href="{{link}}" class="js-typeahead-link u-color-inherit u-pull--left" onclick="{{googleImpressionClick}}" title="{{name}}"> 2395 <div class="u-margin-right u-pull--left {{noimage}} u-hidden-xs u-hidden-xxs"><img src="/Admin/Public/GetImage.ashx?width=45&height=36&crop=5&FillCanvas=True&Compression=75&image={{image}}" alt="{{name}}"></div> 2396 <div class="u-pull--left"> 2397 <div class="u-bold u-max-w220px u-truncate-text js-typeahead-name">{{name}}</div> 2398 @if (!onlyPreview) 2399 { 2400 <div>{{price}}</div> 2401 } 2402 </div> 2403 </a> 2404 <div class="u-margin-left u-pull--right u-w80px"> 2405 <button class="btn btn--primary btn--condensed btn--full u-no-margin dw-mod {{hideBuyOptions}} js-ignore-click-outside" 2406 onclick="Cart.AddToCart(event, { 2407 id: '{{productId}}', 2408 quantity: 1, 2409 productInfo: {{productInfo}} 2410 }); {{facebookPixelAction}}"> 2411 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue js-ignore-click-outside"></i> 2412 </button> 2413 <a href="{{link}}" onclick="{{googleImpressionClick}}" class="btn btn--secondary btn--condensed btn--full u-no-margin dw-mod {{hideViewMore}} js-ignore-click-outside" title="@Translate("View")">@Translate("View")</a> 2414 </div> 2415 </div> 2416 </li> 2417 {{/ifCond}} 2418 {{#ifCond template "===" "SearchMore"}} 2419 {{>SearchMoreProducts}} 2420 {{/ifCond}} 2421 {{/Product}} 2422 {{else}} 2423 <li class="dropdown__item dropdown__item--seperator dw-mod"> 2424 @Translate("Your search gave 0 results") 2425 </li> 2426 {{/each}} 2427 </script> 2428 2429 <script id="SearchMoreProducts" type="text/x-template"> 2430 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 2431 <a href="/Default.aspx?ID=@productsPageId&Search={{searchParameter}}&GroupID={{groupId}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 2432 @Translate("View all") 2433 </a> 2434 </li> 2435 </script> 2436 2437 <script id="SearchMorePages" type="text/x-template"> 2438 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 2439 <a href="/Default.aspx?ID=@contentSearchPageLink&Search={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 2440 @Translate("View all") 2441 </a> 2442 </li> 2443 </script> 2444 2445 <script id="SearchPagesTemplate" type="text/x-template"> 2446 {{#each .}} 2447 {{#ifCond template "!==" "SearchMore"}} 2448 <li class="dropdown__item dropdown__item--seperator dw-mod"> 2449 <div> 2450 <a href="/Default.aspx?ID={{id}}" class="js-typeahead-link u-pull--left u-color-inherit"> 2451 <div class="u-margin-right u-pull--left"><i class="fa {{icon}} u-w20px u-ta-center"></i></div> 2452 <div class="u-pull--left"> 2453 <div class="u-bold u-truncate-text u-max-w220px js-typeahead-name">{{name}}</div> 2454 </div> 2455 </a> 2456 </div> 2457 </li> 2458 {{/ifCond}} 2459 {{#ifCond template "===" "SearchMore"}} 2460 {{>SearchMorePages}} 2461 {{/ifCond}} 2462 {{else}} 2463 <li class="dropdown__item dropdown__item--seperator dw-mod"> 2464 @Translate("Your search gave 0 results") 2465 </li> 2466 {{/each}} 2467 </script> 2468 2469 <script id="SearchPagesTemplateWrap" type="text/x-template"> 2470 <div class="dropdown__column-header">@Translate("Pages")</div> 2471 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom dw-mod"> 2472 {{>SearchPagesTemplate}} 2473 </ul> 2474 </script> 2475 2476 <script id="SearchProductsTemplateWrap" type="text/x-template"> 2477 <div class="dropdown__column-header">@Translate("Products")</div> 2478 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom dw-mod"> 2479 {{>SearchProductsTemplate}} 2480 </ul> 2481 </script> 2482 } 2483 2484 2485 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2486 2487 @using System 2488 @using System.Web 2489 @using System.Collections.Generic 2490 @using Dynamicweb.Rapido.Blocks.Extensibility 2491 @using Dynamicweb.Rapido.Blocks 2492 2493 @{ 2494 BlocksPage bottomSnippetsBlocksPage = BlocksPage.GetBlockPage("Master"); 2495 2496 Block primaryBottomSnippets = new Block() 2497 { 2498 Id = "MasterJavascriptInitializers", 2499 SortId = 1, 2500 Template = RenderPrimaryBottomSnippets() 2501 }; 2502 bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, primaryBottomSnippets); 2503 } 2504 2505 @helper RenderPrimaryBottomSnippets() { 2506 bool isWireframeMode = Model.Area.Item.GetItem("Settings").GetBoolean("WireframeMode") != null ? Model.Area.Item.GetItem("Settings").GetBoolean("WireframeMode") : false; 2507 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 2508 2509 <script> 2510 Wireframe.Init(@Converter.ToString(isWireframeMode).ToLower()); 2511 </script> 2512 2513 2514 if (useGoogleTagManager) 2515 { 2516 <script> 2517 document.addEventListener('addToCart', function(event) { 2518 var googleImpression = event.detail.cartItem.productInfo.googleImpression; 2519 dataLayer.push({ 2520 'event': 'addToCart', 2521 'ecommerce': { 2522 'currencyCode': '@Dynamicweb.Ecommerce.Services.Currencies.GetDefaultCurrency()', 2523 'add': { 2524 'products': [{ 2525 'name': googleImpression.name, 2526 'id': googleImpression.id, 2527 'price': googleImpression.price, 2528 'brand': googleImpression.brand, 2529 'category': googleImpression.category, 2530 'variant': googleImpression.variant, 2531 'quantity': event.detail.cartItem.quantity 2532 }] 2533 } 2534 } 2535 }); 2536 }); 2537 </script> 2538 } 2539 2540 <!--@Javascripts--> 2541 } 2542 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2543 2544 @using System 2545 @using System.Web 2546 @using System.Collections.Generic 2547 @using Dynamicweb.Rapido.Blocks 2548 2549 @{ 2550 BlocksPage masterBlocksBlocksPage = BlocksPage.GetBlockPage("Master"); 2551 2552 } 2553 2554 <!DOCTYPE html> 2555 2556 <html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName"> 2557 <head> 2558 <meta charset="utf-8" /> 2559 <title>@Model.Title</title> 2560 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1"> 2561 <meta name="robots" content="index, follow"> 2562 2563 <!-- Favicon --> 2564 <link href="@favicon" rel="icon" type="image/png"> 2565 2566 <!-- Font awesome --> 2567 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/fonts/FontAwesomePro/css/fontawesome-all.min.css" type="text/css"> 2568 2569 <!-- Flag icon --> 2570 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.1.0/css/flag-icon.min.css" type="text/css"> 2571 2572 <!-- Base (Default, wireframe) styles --> 2573 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/base/base.min.css" type="text/css"> 2574 2575 <!-- Rapido Css from Website Settings --> 2576 <link id="rapidoCss" rel="stylesheet" href="@autoCssLink" type="text/css"> 2577 2578 <!-- Ignite Css (Custom site specific styles) --> 2579 <link id="igniteCss" type="text/css" href="/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css" rel="stylesheet"> 2580 2581 <!-- Google fonts --> 2582 @{ 2583 var family = string.Join("%7C", fonts.Where(x => !string.IsNullOrEmpty(x)).Distinct().Select(x => string.Format("{0}:100,200,300,400,500,600,700,800,900", x))); 2584 } 2585 <link href="https://fonts.googleapis.com/css?family=@family" rel="stylesheet"> 2586 </head> 2587 2588 <body> 2589 2590 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 2591 @RenderBlockList(masterPage.BlocksRoot.BlocksList) 2592 2593 2594 @helper RenderMasterHeader() { 2595 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterHeader").OrderBy(item => item.SortId).ToList(); 2596 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 2597 string stickyTop = isNavigationStickyMenu ? "top-container--sticky" : ""; 2598 2599 <header class="top-container @stickyTop dw-mod" id="Top"> 2600 @RenderBlockList(subBlocks) 2601 </header> 2602 } 2603 2604 @helper RenderMain() { 2605 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMain").OrderBy(item => item.SortId).ToList(); 2606 2607 <main class="site dw-mod"> 2608 @RenderBlockList(subBlocks) 2609 </main> 2610 } 2611 2612 @helper RenderPageContent() { 2613 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 2614 string pagePos = isNavigationStickyMenu ? "js-page-pos" : ""; 2615 2616 <div id="Page" class="page @pagePos"> 2617 <section class="center-container content-container dw-mod" id="content"> 2618 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 2619 2620 2621 @{ 2622 string columnClass = "12"; 2623 bool isProductPage = HttpContext.Current.Request.QueryString.Get("ProductID") != null ? true : false; 2624 string backgroundColorClass = Model.PropertyItem.GetString("BackgroundColor") != null && !isProductPage ? "u-" + Model.PropertyItem.GetList("BackgroundColor").SelectedValue + "--bg" : ""; 2625 } 2626 2627 @if (Model.PropertyItem.GetList("ShowBreadcrumb").SelectedValue == "True") 2628 { 2629 <div class="grid__col-12 grid__col--bleed-y"> 2630 @RenderNavigation(new 2631 { 2632 id = "breadcrumb", 2633 template = "Breadcrumb.xslt" 2634 }) 2635 </div> 2636 } 2637 2638 <div class="grid"> 2639 @if (Model.PropertyItem.GetList("LeftMenu") != null && Model.PropertyItem.GetList("LeftMenu").SelectedValue == "True" && (Pageview.Page.NavigationSettings == null || !Pageview.Page.NavigationSettings.UseEcomGroups)) 2640 { 2641 var navigationMarkup = RenderNavigation(new 2642 { 2643 id = "leftnav", 2644 cssclass = "dwnavigation", 2645 startLevel = 2, 2646 expandmode = "all", 2647 endlevel = 5, 2648 template = "LeftNavigation.xslt" 2649 }); 2650 2651 if (!string.IsNullOrEmpty(navigationMarkup)) 2652 { 2653 <nav class="grid__col-md-3"> 2654 <div class="grid__cell"> 2655 @navigationMarkup 2656 </div> 2657 </nav> 2658 columnClass = "9"; 2659 } 2660 } 2661 <div class="grid__col-md-@columnClass grid__col--bleed"> 2662 <div class="grid"> 2663 @Model.Placeholder("dwcontent", "content", "default:true;sort:1") 2664 </div> 2665 </div> 2666 </div> 2667 2668 2669 @* Very small hack to make it cleanly, and easily possible to change the background color on a single page *@ 2670 @if (backgroundColorClass != "") 2671 { 2672 <script> 2673 document.getElementById("Page").classList.add("@backgroundColorClass"); 2674 </script> 2675 } 2676 </section> 2677 </div> 2678 } 2679 2680 </body> 2681 </html> 2682 2683