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