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_cf6aa460c8b34bce98c0f0549daf7e17.b__63_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\SharkogCo\hjemmehos97-rapido3.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 2658
   at RazorEngine.Templating.TemplateWriter.WriteTo(TextWriter writer)
   at RazorEngine.Templating.TemplateBase.WriteTo(TextWriter writer, TemplateWriter helper)
   at CompiledRazorTemplates.Dynamic.RazorEngine_cf6aa460c8b34bce98c0f0549daf7e17.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\SharkogCo\hjemmehos97-rapido3.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 163
   at RazorEngine.Templating.TemplateWriter.WriteTo(TextWriter writer)
   at RazorEngine.Templating.TemplateBase.WriteTo(TextWriter writer, TemplateWriter helper)
   at CompiledRazorTemplates.Dynamic.RazorEngine_cf6aa460c8b34bce98c0f0549daf7e17.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\SharkogCo\hjemmehos97-rapido3.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 127
   at RazorEngine.Templating.TemplateWriter.WriteTo(TextWriter writer)
   at RazorEngine.Templating.TemplateBase.WriteTo(TextWriter writer, TemplateWriter helper)
   at CompiledRazorTemplates.Dynamic.RazorEngine_cf6aa460c8b34bce98c0f0549daf7e17.b__62_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\SharkogCo\hjemmehos97-rapido3.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 2642
   at RazorEngine.Templating.TemplateWriter.WriteTo(TextWriter writer)
   at RazorEngine.Templating.TemplateBase.WriteTo(TextWriter writer, TemplateWriter helper)
   at CompiledRazorTemplates.Dynamic.RazorEngine_cf6aa460c8b34bce98c0f0549daf7e17.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\SharkogCo\hjemmehos97-rapido3.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 163
   at RazorEngine.Templating.TemplateWriter.WriteTo(TextWriter writer)
   at RazorEngine.Templating.TemplateBase.WriteTo(TextWriter writer, TemplateWriter helper)
   at CompiledRazorTemplates.Dynamic.RazorEngine_cf6aa460c8b34bce98c0f0549daf7e17.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\SharkogCo\hjemmehos97-rapido3.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 127
   at RazorEngine.Templating.TemplateWriter.WriteTo(TextWriter writer)
   at RazorEngine.Templating.TemplateBase.WriteTo(TextWriter writer, TemplateWriter helper)
   at CompiledRazorTemplates.Dynamic.RazorEngine_cf6aa460c8b34bce98c0f0549daf7e17.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\SharkogCo\hjemmehos97-rapido3.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 168
   at RazorEngine.Templating.TemplateWriter.WriteTo(TextWriter writer)
   at RazorEngine.Templating.TemplateBase.WriteTo(TextWriter writer, TemplateWriter helper)
   at CompiledRazorTemplates.Dynamic.RazorEngine_cf6aa460c8b34bce98c0f0549daf7e17.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\SharkogCo\hjemmehos97-rapido3.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 127
   at RazorEngine.Templating.TemplateWriter.WriteTo(TextWriter writer)
   at RazorEngine.Templating.TemplateBase.Write(TemplateWriter helper)
   at CompiledRazorTemplates.Dynamic.RazorEngine_cf6aa460c8b34bce98c0f0549daf7e17.Execute() in D:\dynamicweb.net\Solutions\SharkogCo\hjemmehos97-rapido3.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 2625
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineCore.RunTemplate(ICompiledTemplate template, TextWriter writer, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.DynamicWrapperService.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 RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, ITemplateSource templateSource, String name, Type modelType, Object model, DynamicViewBag viewBag)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

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