Error executing template "Designs/Rapido/_parsed/BlogArticle.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_6231015e95a7486da536923f9dd53898.b__149_0(TextWriter __razor_helper_writer) in C:\DW9Staging\Solutions\Files-rapidofull\Templates\Designs\Rapido\_parsed\BlogArticle.parsed.cshtml:line 6323
   at CompiledRazorTemplates.Dynamic.RazorEngine_6231015e95a7486da536923f9dd53898.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in C:\DW9Staging\Solutions\Files-rapidofull\Templates\Designs\Rapido\_parsed\BlogArticle.parsed.cshtml:line 226
   at CompiledRazorTemplates.Dynamic.RazorEngine_6231015e95a7486da536923f9dd53898.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in C:\DW9Staging\Solutions\Files-rapidofull\Templates\Designs\Rapido\_parsed\BlogArticle.parsed.cshtml:line 138
   at CompiledRazorTemplates.Dynamic.RazorEngine_6231015e95a7486da536923f9dd53898.b__147_0(TextWriter __razor_helper_writer) in C:\DW9Staging\Solutions\Files-rapidofull\Templates\Designs\Rapido\_parsed\BlogArticle.parsed.cshtml:line 6214
   at CompiledRazorTemplates.Dynamic.RazorEngine_6231015e95a7486da536923f9dd53898.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in C:\DW9Staging\Solutions\Files-rapidofull\Templates\Designs\Rapido\_parsed\BlogArticle.parsed.cshtml:line 226
   at CompiledRazorTemplates.Dynamic.RazorEngine_6231015e95a7486da536923f9dd53898.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in C:\DW9Staging\Solutions\Files-rapidofull\Templates\Designs\Rapido\_parsed\BlogArticle.parsed.cshtml:line 138
   at CompiledRazorTemplates.Dynamic.RazorEngine_6231015e95a7486da536923f9dd53898.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in C:\DW9Staging\Solutions\Files-rapidofull\Templates\Designs\Rapido\_parsed\BlogArticle.parsed.cshtml:line 246
   at CompiledRazorTemplates.Dynamic.RazorEngine_6231015e95a7486da536923f9dd53898.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in C:\DW9Staging\Solutions\Files-rapidofull\Templates\Designs\Rapido\_parsed\BlogArticle.parsed.cshtml:line 138
   at CompiledRazorTemplates.Dynamic.RazorEngine_6231015e95a7486da536923f9dd53898.Execute() in C:\DW9Staging\Solutions\Files-rapidofull\Templates\Designs\Rapido\_parsed\BlogArticle.parsed.cshtml:line 6195
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 2 3 @using System.Web; 4 @using Dynamicweb.Frontend 5 @using Dynamicweb.Frontend.Devices 6 @using Dynamicweb.Extensibility 7 @using Dynamicweb.Content 8 @using Dynamicweb.Security 9 @using Dynamicweb.Core 10 @using System 11 @using System.Web 12 @using System.IO 13 @using Dynamicweb.Rapido.Blocks 14 @using System.Net 15 16 17 18 @functions { 19 BlocksPage masterPage = BlocksPage.GetBlockPage("Master"); 20 21 string getFontFamily(params string[] items) 22 { 23 var itemParent = Pageview.AreaSettings; 24 foreach (var item in items) 25 { 26 itemParent = itemParent.GetItem(item); 27 if (itemParent == null) 28 { 29 return null; 30 } 31 } 32 33 var googleFont = itemParent.GetGoogleFont("FontFamily"); 34 if (googleFont == null) 35 { 36 return null; 37 } 38 return googleFont.Family.Replace(" ", "+"); 39 } 40 } 41 42 @{ 43 //Font settings 44 var fonts = new string[] { 45 getFontFamily("Layout", "HeaderFont"), 46 getFontFamily("Layout", "SubheaderFont"), 47 getFontFamily("Layout", "TertiaryHeaderFont"), 48 getFontFamily("Layout", "BodyText"), 49 getFontFamily("Layout", "Header", "ToolsFont"), 50 getFontFamily("Layout", "Header", "NavigationFont"), 51 getFontFamily("Layout", "MobileNavigation", "Font"), 52 getFontFamily("ProductList", "Facets", "HeaderFont"), 53 getFontFamily("ProductPage", "PriceFontDesign"), 54 getFontFamily("Ecommerce", "SaleSticker", "Font"), 55 getFontFamily("Ecommerce", "NewSticker", "Font"), 56 getFontFamily("Ecommerce", "CustomSticker", "Font") 57 }; 58 59 string autoCssLink = "/Files/Templates/Designs/Rapido/css/rapido/rapido_" + Model.Area.ID.ToString() + ".min.css?ticks=" + Model.Area.UpdatedDate.Ticks; 60 string favicon = Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon").Path : "/Files/Images/favicon.png"; 61 bool useFontAwesomePro = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetBoolean("UseFontAwesomePro"); 62 string fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomeFree/css/fontawesome-all.min.css"; 63 if (useFontAwesomePro) 64 { 65 fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomePro/css/fontawesome-all.min.css"; 66 } 67 } 68 69 @{ 70 Block master = new Block() 71 { 72 Id = "Master", 73 BlocksList = new List<Block> { 74 new Block { 75 Id = "MasterTopSnippets", 76 SortId = 10 77 }, 78 new Block { 79 Id = "MasterMain", 80 SortId = 20, 81 Template = RenderMain(), 82 SkipRenderBlocksList = true, 83 BlocksList = new List<Block> { 84 new Block { 85 Id = "MasterHeader", 86 SortId = 10, 87 Template = RenderMasterHeader(), 88 SkipRenderBlocksList = true 89 }, 90 new Block { 91 Id = "MasterPageContent", 92 SortId = 20, 93 Template = RenderPageContent() 94 } 95 } 96 }, 97 new Block { 98 Id = "MasterFooter", 99 SortId = 30 100 }, 101 new Block { 102 Id = "MasterReferences", 103 SortId = 40 104 }, 105 new Block { 106 Id = "MasterBottomSnippets", 107 SortId = 50 108 } 109 } 110 }; 111 112 masterPage.Add(master); 113 } 114 115 @* Include the required Grid builder (Contains the methods @RenderBlockList and @RenderBlock) *@ 116 @using System.Text.RegularExpressions 117 @using System.Collections.Generic 118 @using System.Reflection 119 @using System.Web.UI.HtmlControls 120 @using Dynamicweb.Rapido.Blocks.Components 121 @using Dynamicweb.Rapido.Blocks.Components.Articles 122 @using Dynamicweb.Rapido.Blocks.Components.Documentation 123 @using Dynamicweb.Rapido.Blocks 124 125 126 @*--- START: Base block renderers ---*@ 127 128 @helper RenderBlockList(List<Block> blocks) 129 { 130 blocks = blocks.OrderBy(item => item.SortId).ToList(); 131 132 foreach (Block item in blocks) 133 { 134 <!-- START: @item.Id --> 135 136 if (item.Design == null) 137 { 138 @RenderBlock(item) 139 } 140 else if (item.Design.RenderType == RenderType.None) { 141 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : ""; 142 143 <div class="@cssClass dw-mod"> 144 @RenderBlock(item) 145 </div> 146 } 147 else if (item.Design.RenderType != RenderType.Hide) 148 { 149 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : ""; 150 151 if (!item.SkipRenderBlocksList) { 152 if (item.Design.RenderType == RenderType.Row) 153 { 154 <div class="grid grid--align-content-start @cssClass dw-mod" id="Block__@item.Id"> 155 @RenderBlock(item) 156 </div> 157 } 158 159 if (item.Design.RenderType == RenderType.Column) 160 { 161 string hidePadding = item.Design.HidePadding ? "u-no-padding" : ""; 162 string size = item.Design.Size ?? "12"; 163 size = Regex.IsMatch(size, @"\d") ? "md-" + item.Design.Size : item.Design.Size; 164 165 <div class="grid__col-lg-@item.Design.Size grid__col-md-@item.Design.Size grid__col-sm-12 grid__col-xs-12 @hidePadding @cssClass dw-mod" id="Block__@item.Id"> 166 @RenderBlock(item) 167 </div> 168 } 169 170 if (item.Design.RenderType == RenderType.Table) 171 { 172 <table class="table @cssClass dw-mod" id="Block__@item.Id"> 173 @RenderBlock(item) 174 </table> 175 } 176 177 if (item.Design.RenderType == RenderType.TableRow) 178 { 179 <tr class="@cssClass dw-mod" id="Block__@item.Id"> 180 @RenderBlock(item) 181 </tr> 182 } 183 184 if (item.Design.RenderType == RenderType.TableColumn) 185 { 186 <td class="@cssClass dw-mod" id="Block__@item.Id"> 187 @RenderBlock(item) 188 </td> 189 } 190 191 if (item.Design.RenderType == RenderType.CardHeader) 192 { 193 <div class="card-header @cssClass dw-mod"> 194 @RenderBlock(item) 195 </div> 196 } 197 198 if (item.Design.RenderType == RenderType.CardBody) 199 { 200 <div class="card @cssClass dw-mod"> 201 @RenderBlock(item) 202 </div> 203 } 204 205 if (item.Design.RenderType == RenderType.CardFooter) 206 { 207 <div class="card-footer @cssClass dw-mod"> 208 @RenderBlock(item) 209 </div> 210 } 211 } 212 else 213 { 214 @RenderBlock(item) 215 } 216 } 217 218 <!-- END: @item.Id --> 219 } 220 } 221 222 @helper RenderBlock(Block item) 223 { 224 if (item.Template != null) 225 { 226 @BlocksPage.RenderTemplate(item.Template) 227 } 228 229 if (item.Component != null) 230 { 231 string methodName = item.Component.HelperName; 232 dynamic[] methodParameters = new dynamic[1]; 233 methodParameters[0] = item.Component; 234 Type methodType = this.GetType(); 235 MethodInfo generalMethod = methodType.GetMethod(methodName); 236 237 if (generalMethod != null) { 238 @generalMethod.Invoke(this, methodParameters).ToString(); 239 } else { 240 throw new Exception(item.Component.GetType().Name + " method '" + methodName +"' could not be invoked"); 241 } 242 } 243 244 if (item.BlocksList.Count > 0 && !item.SkipRenderBlocksList) 245 { 246 @RenderBlockList(item.BlocksList) 247 } 248 } 249 250 @*--- END: Base block renderers ---*@ 251 252 253 @* Include the components *@ 254 @using Dynamicweb.Rapido.Blocks.Components 255 @using Dynamicweb.Rapido.Blocks.Components.General 256 @using Dynamicweb.Rapido.Blocks 257 258 259 @* Components *@ 260 @using System.Reflection 261 @using Dynamicweb.Rapido.Blocks.Components.General 262 263 264 @* Component *@ 265 266 @helper RenderIcon(Icon settings) { 267 if (settings != null) 268 { 269 dynamic[] methodParameters = new dynamic[1]; 270 methodParameters[0] = settings; 271 MethodInfo customMethod = this.GetType().GetMethod("RenderIconCustom"); 272 273 if (customMethod != null) 274 { 275 @customMethod.Invoke(this, methodParameters).ToString(); 276 } else { 277 string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : ""; 278 279 if (settings.Name != null) 280 { 281 if (String.IsNullOrEmpty(settings.Label)) { 282 <i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i> 283 } else { 284 if (settings.LabelPosition == IconLabelPosition.Before) { 285 <span>@settings.Label <i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i></span> 286 } else { 287 <span><i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i> @settings.Label</span> 288 } 289 } 290 } 291 } 292 } 293 } 294 @using System.Reflection 295 @using Dynamicweb.Rapido.Blocks.Components.General 296 @using Dynamicweb.Rapido.Blocks.Components 297 298 299 @* Component *@ 300 301 @helper RenderButton(Button settings) { 302 dynamic[] methodParameters = new dynamic[1]; 303 methodParameters[0] = settings; 304 MethodInfo customMethod = this.GetType().GetMethod("RenderButtonCustom"); 305 306 if (customMethod != null) 307 { 308 @customMethod.Invoke(this, methodParameters).ToString(); 309 } 310 else 311 { 312 string target; 313 string disabled = settings.Disabled ? "disabled" : ""; 314 string buttonType = settings.ButtonType == ButtonType.Submit ? "submit" : "button"; 315 buttonType = settings.ButtonType == ButtonType.Reset ? "reset" : buttonType; 316 string buttonLayout = settings.ButtonLayout.ToString().ToLower(); 317 318 switch (settings.Target) 319 { 320 case LinkTargetType.Blank: 321 target = "_blank"; 322 break; 323 case LinkTargetType.Parent: 324 target = "_parent"; 325 break; 326 case LinkTargetType.Self: 327 target = "_self"; 328 break; 329 case LinkTargetType.Top: 330 target = "_top"; 331 break; 332 default: 333 target = "_self"; 334 break; 335 } 336 337 string onClickAction = settings.OnClick != null ? settings.OnClick : ""; 338 string noOpener = target == "_blank" ? "rel=\"noopener\"" : ""; 339 340 if (!String.IsNullOrEmpty(settings.ConfirmText)) 341 { 342 string modalId = settings.Id; 343 @RenderConfirmDialog(settings); 344 onClickAction = "document.getElementById('" + modalId + "ModalTrigger').checked = true"; 345 } 346 347 if (settings.Icon != null) 348 { 349 if (settings.IconPosition == null) { 350 settings.Icon.LabelPosition = IconLabelPosition.After; 351 } else { 352 settings.Icon.LabelPosition = settings.IconPosition == IconPosition.Before ? IconLabelPosition.After : IconLabelPosition.Before; 353 } 354 if (settings.Icon.Label == null) { 355 settings.Icon.Label = settings.Title; 356 } 357 } 358 string content = settings.Icon == null ? settings.Title : Convert.ToString(RenderIcon(settings.Icon)); 359 360 if (!String.IsNullOrEmpty(settings.Link) && String.IsNullOrEmpty(settings.ConfirmText)) 361 { 362 <a href="@settings.Link" target="@target" @noOpener class="btn btn--@buttonLayout @settings.CssClass @disabled dw-mod" onclick="@onClickAction" @ComponentMethods.AddAttributes(settings.ExtraAttributes) @disabled>@content</a> 363 } 364 else 365 { 366 <button type="@buttonType" class="btn btn--@buttonLayout @settings.CssClass @disabled dw-mod" onclick="@onClickAction" @ComponentMethods.AddAttributes(settings.ExtraAttributes) @disabled>@content</button> 367 } 368 } 369 } 370 371 372 @helper RenderConfirmDialog(Button settings) { 373 dynamic[] methodParameters = new dynamic[1]; 374 methodParameters[0] = settings; 375 MethodInfo customMethod = this.GetType().GetMethod("RenderConfirmDialogCustom"); 376 377 if (customMethod != null) 378 { 379 @customMethod.Invoke(this, methodParameters).ToString(); 380 } else { 381 string modalTriggerId = settings.Id + "ModalTrigger"; 382 383 <!-- Trigger for the confirm modal --> 384 <input type="checkbox" id="@modalTriggerId" class="modal-trigger" /> 385 386 <!-- Login modal --> 387 <div class="modal-container"> 388 <label for="@modalTriggerId" class="modal-overlay"></label> 389 <div class="modal modal--xs"> 390 <div class="modal__header"> 391 <h2>@settings.ConfirmText</h2> 392 </div> 393 <div class="modal__body"> 394 @RenderButton(new Button { Title = Translate("OK"), ButtonLayout = ButtonLayout.Primary, OnClick = settings.OnClick, CssClass = "u-full-width", Link = settings.Link }) 395 </div> 396 </div> 397 </div> 398 } 399 } 400 @using System.Reflection 401 @using Dynamicweb.Rapido.Blocks.Components 402 @using Dynamicweb.Rapido.Blocks.Components.General 403 @using Dynamicweb.Rapido.Blocks 404 405 406 @* Component *@ 407 408 @helper RenderRating(Rating settings) 409 { 410 dynamic[] methodParameters = new dynamic[1]; 411 methodParameters[0] = settings; 412 MethodInfo customMethod = this.GetType().GetMethod("RenderRatingCustom"); 413 414 if (customMethod != null) 415 { 416 @customMethod.Invoke(this, methodParameters).ToString(); 417 } else { 418 if (settings.Score > 0) 419 { 420 int rating = settings.Score; 421 string iconType = "fa-star"; 422 423 switch (settings.Type.ToString()) { 424 case "Stars": 425 iconType = "fa-star"; 426 break; 427 case "Hearts": 428 iconType = "fa-heart"; 429 break; 430 case "Lemons": 431 iconType = "fa-lemon"; 432 break; 433 case "Bombs": 434 iconType = "fa-bomb"; 435 break; 436 } 437 438 <div class="u-ta-right"> 439 @for (int i = 0; i < settings.OutOf; i++) 440 { 441 <i class="@(rating > i ? "fas" : "far") @iconType"></i> 442 } 443 </div> 444 } 445 } 446 } 447 @using System.Reflection 448 @using Dynamicweb.Rapido.Blocks.Components.General 449 @using Dynamicweb.Rapido.Blocks.Components 450 451 452 @* Component *@ 453 454 @helper RenderFieldListOption(FieldListOption settings) { 455 dynamic[] methodParameters = new dynamic[1]; 456 methodParameters[0] = settings; 457 MethodInfo customMethod = this.GetType().GetMethod("RenderFieldListOptionCustom"); 458 459 if (customMethod != null) 460 { 461 @customMethod.Invoke(this, methodParameters).ToString(); 462 } else { 463 string disabled = settings.Disabled ? "disabled" : ""; 464 string selected = settings.Checked ? "checked" : ""; 465 466 if (settings.Type.ToString() == "RadioButton") 467 { 468 <input class="form__control @disabled dw-mod" onchange="@settings.OnChange" onclick="@settings.OnClick" type="radio" name="@settings.Name" id="@settings.Id" value="@settings.Value" @selected @disabled @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 469 <label for="@settings.Id" class="u-inline @disabled dw-mod">@settings.Label</label> 470 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 471 } 472 473 if (settings.Type.ToString() == "Checkbox") 474 { 475 @RenderCheckboxField(settings) 476 } 477 478 if (settings.Type.ToString() == "SelectOption") 479 { 480 <option value="@settings.Value" id="@settings.Id" onclick="@settings.OnClick" class="@disabled" @disabled @selected @ComponentMethods.AddAttributes(settings.ExtraAttributes) >@settings.Name</option> 481 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 482 } 483 } 484 } 485 486 @using System.Reflection 487 @using Dynamicweb.Rapido.Blocks.Components.General 488 @using Dynamicweb.Rapido.Blocks.Components 489 490 491 @* Component *@ 492 493 @helper RenderNavigation(Navigation settings) { 494 dynamic[] methodParameters = new dynamic[1]; 495 methodParameters[0] = settings; 496 MethodInfo customMethod = this.GetType().GetMethod("RenderNavigationCustom"); 497 498 if (customMethod != null) 499 { 500 @customMethod.Invoke(this, methodParameters).ToString(); 501 } else { 502 @RenderNavigation(new 503 { 504 id = settings.Id, 505 cssclass = settings.CssClass, 506 startLevel = settings.StartLevel, 507 endlevel = settings.EndLevel, 508 expandmode = settings.Expandmode, 509 template = settings.Template 510 }) 511 } 512 } 513 @using System.Reflection 514 @using Dynamicweb.Rapido.Blocks.Components.General 515 @using Dynamicweb.Rapido.Blocks.Components 516 517 518 @* Component *@ 519 520 @helper RenderBreadcrumbNavigation(BreadcrumbNavigation settings) { 521 dynamic[] methodParameters = new dynamic[1]; 522 methodParameters[0] = settings; 523 MethodInfo customMethod = this.GetType().GetMethod("RenderBreadcrumbNavigationCustom"); 524 525 if (customMethod != null) 526 { 527 @customMethod.Invoke(this, methodParameters).ToString(); 528 } else { 529 settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id; 530 settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template; 531 settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel; 532 settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel; 533 settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode; 534 535 @RenderNavigation(settings) 536 } 537 } 538 @using System.Reflection 539 @using Dynamicweb.Rapido.Blocks.Components.General 540 541 542 @* Component *@ 543 544 @helper RenderHeading(Heading settings) { 545 dynamic[] methodParameters = new dynamic[1]; 546 methodParameters[0] = settings; 547 MethodInfo customMethod = this.GetType().GetMethod("RenderHeadingCustom"); 548 549 if (customMethod != null) 550 { 551 @customMethod.Invoke(this, methodParameters).ToString(); 552 } else { 553 string startTag = "<h" + settings.Level.ToString() + " class=\"" + settings.CssClass + "\">"; 554 string endTag = "</h" + settings.Level.ToString() + "\">"; 555 556 if (settings.Icon != null) 557 { 558 if (settings.IconPosition == null) { 559 settings.Icon.LabelPosition = IconLabelPosition.After; 560 } else { 561 settings.Icon.LabelPosition = settings.IconPosition == IconPosition.Before ? IconLabelPosition.After : IconLabelPosition.Before; 562 } 563 if (settings.Icon.Label == null) { 564 settings.Icon.Label = settings.Title; 565 } 566 567 @startTag@RenderIcon(settings.Icon)@endTag 568 } else { 569 @startTag@settings.Title@endTag 570 } 571 } 572 } 573 @using System.Reflection 574 @using Dynamicweb.Rapido.Blocks.Components 575 @using Dynamicweb.Rapido.Blocks.Components.General 576 @using Dynamicweb.Rapido.Blocks 577 578 579 @* Component *@ 580 581 @helper RenderImage(Image settings) 582 { 583 if (settings.Path != null) 584 { 585 dynamic[] methodParameters = new dynamic[1]; 586 methodParameters[0] = settings; 587 MethodInfo customMethod = this.GetType().GetMethod("RenderImageCustom"); 588 589 if (customMethod != null) 590 { 591 @customMethod.Invoke(this, methodParameters).ToString(); 592 } else { 593 <div> 594 @if (settings.Link != null) 595 { 596 <a href="@settings.Link"> 597 @RenderTheImage(settings); 598 </a> 599 } 600 else 601 { 602 @RenderTheImage(settings); 603 } 604 </div> 605 } 606 } 607 } 608 609 @functions { 610 string getImagePathFromSettings(ImageSettings settings) 611 { 612 string result = ""; 613 614 if (settings != null) 615 { 616 result += settings.Width != 0 ? "Width=" + settings.Width + "&" : ""; 617 result += settings.Height != 0 ? "Height=" + settings.Height + "&" : ""; 618 result += "Crop=" + settings.Crop + "&"; 619 result += "Compression=" + settings.Compression + "&"; 620 result += "DoNotUpscale=" + settings.DoNotUpscale.ToString() + "&"; 621 result += "FillCanvas=" + settings.FillCanvas.ToString() + "&"; 622 } 623 624 return result; 625 } 626 } 627 628 @helper RenderTheImage(Image settings) 629 { 630 if (settings != null) 631 { 632 dynamic[] methodParameters = new dynamic[1]; 633 methodParameters[0] = settings; 634 MethodInfo customMethod = this.GetType().GetMethod("RenderTheImageCustom"); 635 636 if (customMethod != null) 637 { 638 @customMethod.Invoke(this, methodParameters).ToString(); 639 } else { 640 string placeholderImage = "/Files/Images/placeholder.gif"; 641 string imageEngine = "/Admin/Public/GetImage.ashx?"; 642 643 string imageStyle = ""; 644 645 switch (settings.Style) 646 { 647 case ImageStyle.Ball: 648 imageStyle = "grid__cell-img--ball"; 649 break; 650 } 651 652 if (settings.Style == ImageStyle.Ball || settings.Style == ImageStyle.Circle) 653 { 654 if (settings.ImageDefault != null) 655 { 656 settings.ImageDefault.Height = settings.ImageDefault.Width; 657 } 658 if (settings.ImageMedium != null) 659 { 660 settings.ImageMedium.Height = settings.ImageMedium.Width; 661 } 662 if (settings.ImageSmall != null) 663 { 664 settings.ImageSmall.Height = settings.ImageSmall.Width; 665 } 666 } 667 668 string defaultImage = imageEngine; 669 string imageSmall = ""; 670 string imageMedium = ""; 671 672 if (settings.DisableImageEngine) { 673 defaultImage = settings.Path; 674 } else { 675 if (settings.ImageDefault != null) 676 { 677 defaultImage += getImagePathFromSettings(settings.ImageDefault); 678 679 if (settings.Path.GetType() != typeof(string)) 680 { 681 defaultImage += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 682 defaultImage += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 683 } 684 else 685 { 686 defaultImage += settings.Path != null ? "Image=" + settings.Path : ""; 687 } 688 } 689 690 if (settings.ImageSmall != null) 691 { 692 imageSmall = "data-src-small=\"" + imageEngine; 693 imageSmall += getImagePathFromSettings(settings.ImageSmall); 694 695 if (settings.Path.GetType() != typeof(string)) 696 { 697 imageSmall += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 698 imageSmall += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 699 } 700 else 701 { 702 imageSmall += settings.Path != null ? "Image=" + settings.Path : ""; 703 } 704 705 imageSmall += "\""; 706 } 707 708 if (settings.ImageMedium != null) 709 { 710 imageMedium = "data-src-medium=\"" + imageEngine; 711 imageMedium += getImagePathFromSettings(settings.ImageMedium); 712 713 if (settings.Path.GetType() != typeof(string)) 714 { 715 imageMedium += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 716 imageMedium += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 717 } 718 else 719 { 720 imageMedium += settings.Path != null ? "Image=" + settings.Path : ""; 721 } 722 723 imageMedium += "\""; 724 } 725 } 726 727 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>(); 728 if (!String.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick); } 729 if (!String.IsNullOrEmpty(settings.Title)) { optionalAttributes.Add("alt", settings.Title); } 730 731 if (settings.DisableLazyLoad) { 732 <img class="grid__cell-img @imageStyle @settings.CssClass dw-mod" src="@defaultImage" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 733 } else { 734 <img class="grid__cell-img b-lazy @imageStyle @settings.CssClass dw-mod" src="@placeholderImage" data-src="@defaultImage" @imageSmall @imageMedium @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 735 } 736 737 if (settings.Caption != null) 738 { 739 <span class="image-caption dw-mod">@settings.Caption</span> 740 } 741 } 742 } 743 } 744 @using System.Reflection 745 @using Dynamicweb.Rapido.Blocks.Components.General 746 @using Dynamicweb.Rapido.Blocks.Components 747 748 749 @* Component *@ 750 751 @helper RenderTextField(TextField settings) { 752 dynamic[] methodParameters = new dynamic[1]; 753 methodParameters[0] = settings; 754 MethodInfo customMethod = this.GetType().GetMethod("RenderTextFieldCustom"); 755 756 if (customMethod != null) 757 { 758 @customMethod.Invoke(this, methodParameters).ToString(); 759 } else { 760 int maxLength = settings.MaxLength != 0 ? settings.MaxLength : 524288; 761 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>(); 762 if (settings.Type == TextFieldType.Password) { optionalAttributes.Add("autocomplete", "off"); }; 763 if (!String.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick.ToString()); } 764 if (!String.IsNullOrEmpty(settings.Placeholder)) { optionalAttributes.Add("placeholder", settings.Placeholder); } 765 if (settings.Disabled) { optionalAttributes.Add("disabled", settings.Disabled.ToString()); } 766 if (settings.Required) { optionalAttributes.Add("required", settings.Required.ToString()); } 767 if (settings.MaxLength != 0) { optionalAttributes.Add("maxlength", settings.MaxLength.ToString()); } 768 769 <div class="form__field-group dw-mod"> 770 @if (!String.IsNullOrEmpty(settings.Label)) 771 { 772 <label for="@settings.Id">@settings.Label</label> 773 } 774 775 <input type="@settings.Type" class="u-full-width @settings.CssClass dw-mod" name="@settings.Id" id="@(settings.Id)" value="@settings.Value" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 776 777 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 778 </div> 779 } 780 } 781 @using System.Reflection 782 @using Dynamicweb.Rapido.Blocks.Components.General 783 @using Dynamicweb.Rapido.Blocks.Components 784 785 786 @* Component *@ 787 788 @helper RenderNumberField(NumberField settings) { 789 dynamic[] methodParameters = new dynamic[1]; 790 methodParameters[0] = settings; 791 MethodInfo customMethod = this.GetType().GetMethod("RenderNumberFieldCustom"); 792 793 if (customMethod != null) 794 { 795 @customMethod.Invoke(this, methodParameters).ToString(); 796 } else { 797 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>(); 798 if (!String.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick.ToString()); } 799 if (settings.Disabled) { optionalAttributes.Add("disabled", settings.Disabled.ToString()); } 800 if (settings.Required) { optionalAttributes.Add("required", settings.Required.ToString()); } 801 if (settings.Max != 0) { optionalAttributes.Add("max", settings.Max.ToString()); } 802 if (settings.Min != 0) { optionalAttributes.Add("min", settings.Min.ToString()); } 803 if (settings.Step != 0) { optionalAttributes.Add("step", settings.Step.ToString()); } 804 805 <div class="form__field-group dw-mod"> 806 @if (!String.IsNullOrEmpty(settings.Label)) 807 { 808 <div> 809 <label for="@settings.Id">@settings.Label</label> 810 </div> 811 } 812 813 <input type="Number" class="u-w70px @settings.CssClass dw-mod" name="@settings.Id" id="@(settings.Id)" value="@settings.Value" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 814 815 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 816 </div> 817 } 818 } 819 @using System.Reflection 820 @using Dynamicweb.Rapido.Blocks.Components.General 821 @using Dynamicweb.Rapido.Blocks.Components 822 823 824 @* Component *@ 825 826 @helper RenderTextareaField(TextareaField settings) { 827 dynamic[] methodParameters = new dynamic[1]; 828 methodParameters[0] = settings; 829 MethodInfo customMethod = this.GetType().GetMethod("RenderTextareaFieldCustom"); 830 831 if (customMethod != null) 832 { 833 @customMethod.Invoke(this, methodParameters).ToString(); 834 } else { 835 int maxLength = settings.MaxLength != 0 ? settings.MaxLength : 524288; 836 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>(); 837 if (!String.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick.ToString()); } 838 if (!String.IsNullOrEmpty(settings.Placeholder)) { optionalAttributes.Add("placeholder", settings.Placeholder); } 839 if (settings.Disabled) { optionalAttributes.Add("disabled", settings.Disabled.ToString()); } 840 if (settings.Required) { optionalAttributes.Add("required", settings.Required.ToString()); } 841 if (settings.MaxLength != 0) { optionalAttributes.Add("maxlength", settings.MaxLength.ToString()); } 842 if (settings.Rows != 0) { optionalAttributes.Add("rows", settings.Rows.ToString()); } 843 844 <div class="form__field-group dw-mod"> 845 @if (!String.IsNullOrEmpty(@settings.Label)) 846 { 847 <label for="@settings.Id">@settings.Label</label> 848 } 849 850 <textarea class="u-full-width @settings.CssClass dw-mod" name="@settings.Id" id="@(settings.Id)" value="@settings.Value" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)></textarea> 851 852 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 853 </div> 854 } 855 } 856 @using System.Reflection 857 @using Dynamicweb.Rapido.Blocks.Components.General 858 @using Dynamicweb.Rapido.Blocks.Components 859 860 861 @* Component *@ 862 863 @helper RenderHiddenField(HiddenField settings) { 864 dynamic[] methodParameters = new dynamic[1]; 865 methodParameters[0] = settings; 866 MethodInfo customMethod = this.GetType().GetMethod(settings.HelperName + "Custom"); 867 868 if (customMethod != null) 869 { 870 @customMethod.Invoke(this, methodParameters).ToString(); 871 } else { 872 <input type="hidden" name="@settings.Id" id="@(settings.Id)" value="@settings.Value" @ComponentMethods.AddAttributes(settings.ExtraAttributes)/> 873 } 874 } 875 @using System.Reflection 876 @using Dynamicweb.Rapido.Blocks.Components.General 877 @using Dynamicweb.Rapido.Blocks.Components 878 879 880 @* Component *@ 881 882 @helper RenderCheckboxField(dynamic settings) { 883 dynamic[] methodParameters = new dynamic[1]; 884 methodParameters[0] = settings; 885 MethodInfo customMethod = this.GetType().GetMethod("RenderCheckboxFieldCustom"); 886 887 if (customMethod != null) 888 { 889 @customMethod.Invoke(this, methodParameters).ToString(); 890 } else { 891 settings.Type = FieldListOptionType.Checkbox; 892 string disabled = settings.Disabled ? "disabled" : ""; 893 string required = settings.Required ? "required" : ""; 894 string checkedString = settings.Checked == true ? "checked" : ""; 895 string id = settings.Id != null ? settings.Id : settings.Label.Replace(" ", ""); 896 897 <div class="form__field-group dw-mod"> 898 <input type="checkbox" class="form__control @settings.CssClass @disabled dw-mod" name="@settings.Name" id="@id" value="@settings.Value" onclick="@settings.OnClick" @disabled @required @checkedString @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 899 900 @if (!String.IsNullOrEmpty(settings.Label)) 901 { 902 <label for="@id" class="@disabled dw-mod">@settings.Label</label> 903 } 904 905 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 906 </div> 907 } 908 } 909 @using System.Reflection 910 @using Dynamicweb.Rapido.Blocks.Components.General 911 @using Dynamicweb.Rapido.Blocks.Components 912 913 914 @* Component *@ 915 916 @helper RenderCheckboxListField(CheckboxListField settings) { 917 dynamic[] methodParameters = new dynamic[1]; 918 methodParameters[0] = settings; 919 MethodInfo customMethod = this.GetType().GetMethod("RenderCheckboxListFieldCustom"); 920 921 if (customMethod != null) 922 { 923 @customMethod.Invoke(this, methodParameters).ToString(); 924 } else { 925 string disabled = settings.Disabled ? "disabled" : ""; 926 927 <div class="form__field-group @settings.CssClass u-margin-bottom @disabled dw-mod" @disabled @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 928 @if (!String.IsNullOrEmpty(settings.Label)) 929 { 930 <div class="u-bold u-margin-bottom">@settings.Label</div> 931 } 932 933 @foreach (var item in settings.Options) 934 { 935 item.Type = FieldListOptionType.Checkbox; 936 @RenderFieldListOption(item) 937 } 938 939 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 940 </div> 941 } 942 } 943 944 @using System.Reflection 945 @using Dynamicweb.Rapido.Blocks.Components.General 946 @using Dynamicweb.Rapido.Blocks.Components 947 948 949 @* Component *@ 950 951 @helper RenderSelectField(SelectField settings) { 952 dynamic[] methodParameters = new dynamic[1]; 953 methodParameters[0] = settings; 954 MethodInfo customMethod = this.GetType().GetMethod("RenderSelectFieldCustom"); 955 956 if (customMethod != null) 957 { 958 @customMethod.Invoke(this, methodParameters).ToString(); 959 } else { 960 string disabled = settings.Disabled ? "disabled" : ""; 961 string required = settings.Required ? "required" : ""; 962 963 if (settings.Default != null) 964 { 965 settings.Default.Type = FieldListOptionType.SelectOption; 966 } 967 968 <div class="form__field-group u-full-width dw-mod"> 969 @if (!String.IsNullOrEmpty(settings.Label)) 970 { 971 <label for="@settings.Id">@settings.Label</label> 972 } 973 974 <div class="form__field-combi u-no-margin dw-mod"> 975 <select id="@settings.Id" class="u-full-width @settings.CssClass dw-mod" onchange="@settings.OnChange" @ComponentMethods.AddAttributes(settings.ExtraAttributes) > 976 @if (settings.Default.Value != null) 977 { 978 @RenderFieldListOption(settings.Default) 979 } 980 981 @foreach (var item in settings.Options) 982 { 983 item.Type = FieldListOptionType.SelectOption; 984 @RenderFieldListOption(item) 985 } 986 </select> 987 @if (settings.ActionButton.Link != null || settings.ActionButton.OnClick != null) { 988 settings.ActionButton.CssClass += " btn--condensed u-no-margin"; 989 @RenderButton(settings.ActionButton); 990 } 991 </div> 992 993 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 994 </div> 995 } 996 } 997 @using System.Reflection 998 @using Dynamicweb.Rapido.Blocks.Components.General 999 @using Dynamicweb.Rapido.Blocks.Components 1000 1001 1002 @* Component *@ 1003 1004 @helper RenderRadioButtonField(RadioButtonField settings) { 1005 dynamic[] methodParameters = new dynamic[1]; 1006 methodParameters[0] = settings; 1007 MethodInfo customMethod = this.GetType().GetMethod("RenderRadioButtonFieldCustom"); 1008 1009 if (customMethod != null) 1010 { 1011 @customMethod.Invoke(this, methodParameters).ToString(); 1012 } else { 1013 string disabled = settings.Disabled ? "disabled" : ""; 1014 1015 <div class="form__field-group @settings.CssClass u-margin-bottom @disabled" @disabled @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1016 @if (!String.IsNullOrEmpty(settings.Label)) 1017 { 1018 <div class="u-bold u-margin-bottom">@settings.Label</div> 1019 } 1020 1021 @foreach (var item in settings.Options) 1022 { 1023 item.Type = FieldListOptionType.RadioButton; 1024 1025 if (settings.Name != null) 1026 { 1027 item.Name = settings.Name; 1028 } 1029 1030 if (settings.RenderOptionsInline) 1031 { 1032 @RenderFieldListOption(item) 1033 } 1034 else 1035 { 1036 <div> 1037 @RenderFieldListOption(item) 1038 </div> 1039 } 1040 } 1041 1042 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 1043 </div> 1044 } 1045 } 1046 @using System.Reflection 1047 @using Dynamicweb.Rapido.Blocks.Components.General 1048 @using Dynamicweb.Rapido.Blocks.Components 1049 1050 1051 @* Component *@ 1052 1053 @helper RenderNotificationMessage(NotificationMessage settings) { 1054 dynamic[] methodParameters = new dynamic[1]; 1055 methodParameters[0] = settings; 1056 MethodInfo customMethod = this.GetType().GetMethod("RenderNotificationMessageCustom"); 1057 1058 if (customMethod != null) 1059 { 1060 @customMethod.Invoke(this, methodParameters).ToString(); 1061 } else { 1062 if (!String.IsNullOrEmpty(settings.Message)) 1063 { 1064 string messageTypeClass = settings.MessageType.ToString().ToLower(); 1065 <div class="field-@messageTypeClass @settings.CssClass u-full-width dw-mod">@settings.Message</div> 1066 } 1067 } 1068 } 1069 @using System.Reflection 1070 @using Dynamicweb.Rapido.Blocks.Components.General 1071 1072 1073 @* Component *@ 1074 1075 @helper RenderHandlebarsRoot(HandlebarsRoot settings) { 1076 dynamic[] methodParameters = new dynamic[1]; 1077 methodParameters[0] = settings; 1078 MethodInfo customMethod = this.GetType().GetMethod("RenderHandlebarsRootCustom"); 1079 1080 if (customMethod != null) 1081 { 1082 @customMethod.Invoke(this, methodParameters).ToString(); 1083 } else { 1084 string preRender = !String.IsNullOrEmpty(settings.PreRenderScriptTemplate) ? "data-pre-render-template=\"" + settings.PreRenderScriptTemplate + "\"" : ""; 1085 1086 <div class="@settings.CssClass dw-mod js-handlebars-root" id="@settings.Id" data-template="@settings.ScriptTemplate" data-json-feed="@settings.FeedUrl" data-init-onload="@settings.InitOnLoad.ToString()" data-preloader="@settings.Preloader" @preRender> 1087 @if (settings.SubBlocks != null) { 1088 @RenderBlockList(settings.SubBlocks) 1089 } 1090 </div> 1091 } 1092 } 1093 @using System.Reflection 1094 @using Dynamicweb.Rapido.Blocks.Components.General 1095 @using Dynamicweb.Rapido.Blocks.Components 1096 @using System.Text.RegularExpressions 1097 1098 1099 @* Component *@ 1100 1101 @helper RenderSticker(Sticker settings) { 1102 dynamic[] methodParameters = new dynamic[1]; 1103 methodParameters[0] = settings; 1104 MethodInfo customMethod = this.GetType().GetMethod("RenderStickerCustom"); 1105 1106 if (customMethod != null) 1107 { 1108 @customMethod.Invoke(this, methodParameters).ToString(); 1109 } 1110 else 1111 { 1112 if (!String.IsNullOrEmpty(settings.Title)) { 1113 string size = settings.Size.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Size.ToString().ToLower() : ""; 1114 string style = settings.Style.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Style.ToString().ToLower() : ""; 1115 1116 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>(); 1117 if (!String.IsNullOrEmpty(settings.Color) || !String.IsNullOrEmpty(settings.BackgroundColor)) { 1118 string styleTag = !String.IsNullOrEmpty(settings.Color) ? "color: " + settings.Color + "; " : ""; 1119 styleTag += !String.IsNullOrEmpty(settings.BackgroundColor) ? "background-color: " + settings.BackgroundColor + "; " : ""; 1120 optionalAttributes.Add("style", styleTag); 1121 } 1122 1123 <div class="stickers-container__tag @size @style @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Title</div> 1124 } 1125 } 1126 } 1127 1128 @using System.Reflection 1129 @using Dynamicweb.Rapido.Blocks.Components.General 1130 @using Dynamicweb.Rapido.Blocks.Components 1131 1132 1133 @* Component *@ 1134 1135 @helper RenderStickersCollection(StickersCollection settings) { 1136 dynamic[] methodParameters = new dynamic[1]; 1137 methodParameters[0] = settings; 1138 MethodInfo customMethod = this.GetType().GetMethod("RenderStickersCollectionCustom"); 1139 1140 if (customMethod != null) 1141 { 1142 @customMethod.Invoke(this, methodParameters).ToString(); 1143 } 1144 else 1145 { 1146 if (settings.Stickers.Count > 0) { 1147 string position = settings.Position != null ? "" + "stickers-container--" + Regex.Replace(settings.Position.ToString(), "([a-z])([A-Z])", "$1-$2").ToLower() : ""; 1148 1149 <div class="stickers-container @position @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1150 @foreach (Sticker sticker in settings.Stickers) 1151 { 1152 @RenderSticker(sticker) 1153 } 1154 </div> 1155 } 1156 } 1157 } 1158 1159 @using System.Reflection 1160 @using Dynamicweb.Rapido.Blocks.Components.General 1161 @using Dynamicweb.Rapido.Blocks.Components 1162 1163 1164 1165 @* Component *@ 1166 1167 @helper RenderField(Field settings) { 1168 dynamic[] methodParameters = new dynamic[1]; 1169 methodParameters[0] = settings; 1170 MethodInfo customMethod = this.GetType().GetMethod("RenderFieldCustom"); 1171 1172 if (customMethod != null) 1173 { 1174 @customMethod.Invoke(this, methodParameters).ToString(); 1175 } else { 1176 switch (settings.FieldType) 1177 { 1178 case FieldType.Checkbox: 1179 CheckboxField checkbox = new CheckboxField 1180 { 1181 Label = settings.Label, 1182 Id = settings.Id, 1183 Name = settings.Label.Replace(" ", ""), 1184 Value = settings.Value, 1185 Checked = Convert.ToBoolean(settings.Placeholder), 1186 OnClick = settings.OnClick, 1187 Disabled = settings.Disabled, 1188 Required = settings.Required, 1189 CssClass = settings.CssClass, 1190 ExtraAttributes = settings.ExtraAttributes, 1191 ErrorMessage = settings.ErrorMessage 1192 }; 1193 1194 @RenderCheckboxField(checkbox) 1195 break; 1196 case FieldType.Email: 1197 TextField emailField = new TextField 1198 { 1199 Label = settings.Label != null ? settings.Label : Translate("Email"), 1200 Id = settings.Id, 1201 Value = settings.Value, 1202 OnClick = settings.OnClick, 1203 Disabled = settings.Disabled, 1204 Required = settings.Required, 1205 CssClass = settings.CssClass, 1206 ExtraAttributes = settings.ExtraAttributes, 1207 ErrorMessage = settings.ErrorMessage, 1208 Placeholder = settings.Placeholder, 1209 Type = TextFieldType.Email 1210 }; 1211 1212 @RenderTextField(emailField) 1213 break; 1214 case FieldType.Hidden: 1215 HiddenField hiddenField = new HiddenField 1216 { 1217 Label = settings.Label, 1218 Id = settings.Id, 1219 Value = settings.Value, 1220 Disabled = settings.Disabled, 1221 Required = settings.Required, 1222 CssClass = settings.CssClass, 1223 ExtraAttributes = settings.ExtraAttributes, 1224 ErrorMessage = settings.ErrorMessage 1225 }; 1226 1227 @RenderHiddenField(hiddenField) 1228 break; 1229 case FieldType.Integer: 1230 NumberField numberField = new NumberField 1231 { 1232 Label = settings.Label, 1233 Id = settings.Id, 1234 Value = settings.Value.GetType() == typeof(int) ? Convert.ToInt32(settings.Value) : 1, 1235 OnClick = settings.OnClick, 1236 Disabled = settings.Disabled, 1237 Required = settings.Required, 1238 CssClass = settings.CssClass, 1239 ExtraAttributes = settings.ExtraAttributes, 1240 ErrorMessage = settings.ErrorMessage, 1241 Step = 1 1242 }; 1243 1244 @RenderNumberField(numberField) 1245 break; 1246 case FieldType.Password: 1247 TextField passwordField = new TextField 1248 { 1249 Label = settings.Label != null ? settings.Label : Translate("Password"), 1250 Id = settings.Id, 1251 Value = settings.Value, 1252 OnClick = settings.OnClick, 1253 Disabled = settings.Disabled, 1254 Required = settings.Required, 1255 CssClass = settings.CssClass, 1256 ExtraAttributes = settings.ExtraAttributes, 1257 ErrorMessage = settings.ErrorMessage, 1258 Placeholder = settings.Placeholder, 1259 Type = TextFieldType.Password 1260 }; 1261 1262 @RenderTextField(passwordField) 1263 break; 1264 case FieldType.Reset: 1265 Button resetField = new Button 1266 { 1267 Title = settings.Label != null ? settings.Label : Translate("Reset"), 1268 Id = settings.Id, 1269 OnClick = settings.OnClick, 1270 Disabled = settings.Disabled, 1271 CssClass = settings.CssClass, 1272 ExtraAttributes = settings.ExtraAttributes, 1273 ButtonLayout = ButtonLayout.Secondary, 1274 ButtonType = ButtonType.Reset 1275 }; 1276 1277 @RenderButton(resetField) 1278 break; 1279 case FieldType.Submit: 1280 Button submitField = new Button 1281 { 1282 Title = settings.Label != null ? settings.Label : Translate("Submit"), 1283 Id = settings.Id, 1284 OnClick = settings.OnClick, 1285 Disabled = settings.Disabled, 1286 CssClass = settings.CssClass, 1287 ExtraAttributes = settings.ExtraAttributes, 1288 ButtonLayout = ButtonLayout.Primary, 1289 ButtonType = ButtonType.Submit 1290 }; 1291 1292 @RenderButton(submitField) 1293 break; 1294 case FieldType.Tel: 1295 TextField telField = new TextField 1296 { 1297 Label = settings.Label != null ? settings.Label : Translate("Phone"), 1298 Id = settings.Id, 1299 Value = settings.Value, 1300 OnClick = settings.OnClick, 1301 Disabled = settings.Disabled, 1302 Required = settings.Required, 1303 CssClass = settings.CssClass, 1304 ExtraAttributes = settings.ExtraAttributes, 1305 ErrorMessage = settings.ErrorMessage, 1306 Placeholder = settings.Placeholder, 1307 Type = TextFieldType.Tel 1308 }; 1309 1310 @RenderTextField(telField) 1311 break; 1312 case FieldType.Text: 1313 TextField textField = new TextField 1314 { 1315 Label = settings.Label, 1316 Id = settings.Id, 1317 Value = settings.Value, 1318 OnClick = settings.OnClick, 1319 Disabled = settings.Disabled, 1320 Required = settings.Required, 1321 CssClass = settings.CssClass, 1322 ExtraAttributes = settings.ExtraAttributes, 1323 ErrorMessage = settings.ErrorMessage, 1324 Placeholder = settings.Placeholder, 1325 Type = TextFieldType.Text 1326 }; 1327 1328 @RenderTextField(textField) 1329 break; 1330 case FieldType.Textarea: 1331 TextareaField textareaField = new TextareaField 1332 { 1333 Label = settings.Label, 1334 Id = settings.Id, 1335 Value = settings.Value, 1336 OnClick = settings.OnClick, 1337 Disabled = settings.Disabled, 1338 Required = settings.Required, 1339 CssClass = settings.CssClass, 1340 ExtraAttributes = settings.ExtraAttributes, 1341 ErrorMessage = settings.ErrorMessage, 1342 Placeholder = settings.Placeholder 1343 }; 1344 1345 @RenderTextareaField(textareaField) 1346 break; 1347 default: 1348 TextField defaultField = new TextField 1349 { 1350 Label = settings.Label, 1351 Id = settings.Id, 1352 Value = settings.Value, 1353 OnClick = settings.OnClick, 1354 Disabled = settings.Disabled, 1355 Required = settings.Required, 1356 CssClass = settings.CssClass, 1357 ExtraAttributes = settings.ExtraAttributes, 1358 ErrorMessage = settings.ErrorMessage, 1359 Placeholder = settings.Placeholder, 1360 Type = TextFieldType.Text 1361 }; 1362 1363 @RenderTextField(defaultField) 1364 break; 1365 } 1366 } 1367 } 1368 1369 1370 @using Dynamicweb.Frontend 1371 @using System.Reflection 1372 @using Dynamicweb.Content.Items 1373 @using System.Web.UI.HtmlControls 1374 @using Dynamicweb.Rapido.Blocks.Components 1375 @using Dynamicweb.Rapido.Blocks 1376 1377 1378 @* Components for the articles *@ 1379 @using System.Reflection 1380 @using Dynamicweb.Rapido.Blocks.Components.Articles 1381 1382 1383 @* Component for the articles *@ 1384 1385 @helper RenderArticleBanner(dynamic settings) { 1386 dynamic[] methodParameters = new dynamic[1]; 1387 methodParameters[0] = settings; 1388 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleBannerCustom"); 1389 1390 if (customMethod != null) 1391 { 1392 @customMethod.Invoke(this, methodParameters).ToString(); 1393 } else { 1394 string filterClasses = "image-filter image-filter--darken"; 1395 settings.Layout = ArticleHeaderLayout.Banner; 1396 1397 if (settings.Image != null) 1398 { 1399 if (settings.Image.Path != null) 1400 { 1401 <section class="multiple-paragraphs-container u-color-light paragraph-container--full-width"> 1402 <div class="background-image @filterClasses dw-mod"> 1403 <div class="background-image__wrapper @filterClasses dw-mod"> 1404 @{ 1405 settings.Image.CssClass += "background-image__cover dw-mod"; 1406 } 1407 @RenderImage(settings.Image) 1408 </div> 1409 </div> 1410 <div class="center-container dw-mod"> 1411 <div class="grid"> 1412 <div class="grid__col-md-8 grid__col-xs-12 paragraph-container paragraph-container--height-lg"> 1413 <div class="u-left-middle"> 1414 <div> 1415 @if (!String.IsNullOrEmpty(settings.Heading)) 1416 { 1417 <h1 class="article__header article__header--giant dw-mod" style="color: @settings.TextColor">@settings.Heading</h1> 1418 } 1419 @if (!String.IsNullOrEmpty(settings.Subheading)) 1420 { 1421 <div class="article__leadtext dw-mod" style="color: @settings.TextColor">@settings.Subheading</div> 1422 } 1423 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 1424 { 1425 <small class="article__post-info u-margin-bottom--lg dw-mod" style="color: @settings.TextColor">@settings.Author @settings.Date</small> 1426 } 1427 @if (!String.IsNullOrEmpty(settings.Link)) { 1428 <div class="grid__cell"> 1429 @RenderButton(new Button { Link= settings.Link, Title= settings.LinkText, ButtonLayout= settings.ButtonLayout }) 1430 </div> 1431 } 1432 </div> 1433 </div> 1434 </div> 1435 @if (settings.ExternalParagraphId != 0) 1436 { 1437 <div class="grid__col-md-4 grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-auto dw-mod"> 1438 <div class="u-color-light-gray--bg u-color-dark dw-mod"> 1439 @RenderParagraphContent(settings.ExternalParagraphId) 1440 </div> 1441 </div> 1442 } 1443 </div> 1444 </div> 1445 </section> 1446 } 1447 else 1448 { 1449 settings.Layout = ArticleHeaderLayout.Clean; 1450 @RenderArticleCleanHeader(settings); 1451 } 1452 } 1453 else 1454 { 1455 settings.Layout = ArticleHeaderLayout.Clean; 1456 @RenderArticleCleanHeader(settings); 1457 } 1458 } 1459 } 1460 @using System.Reflection 1461 @using Dynamicweb.Rapido.Blocks.Components 1462 @using Dynamicweb.Rapido.Blocks.Components.General 1463 @using Dynamicweb.Rapido.Blocks.Components.Articles 1464 @using Dynamicweb.Rapido.Blocks 1465 1466 1467 @* Component for the articles *@ 1468 1469 @helper RenderArticleHeader(ArticleHeader settings) { 1470 dynamic[] methodParameters = new dynamic[1]; 1471 methodParameters[0] = settings; 1472 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleHeaderCustom"); 1473 1474 if (customMethod != null) 1475 { 1476 @customMethod.Invoke(this, methodParameters).ToString(); 1477 } else { 1478 switch (settings.Layout) 1479 { 1480 case ArticleHeaderLayout.Clean: 1481 @RenderArticleCleanHeader(settings); 1482 break; 1483 case ArticleHeaderLayout.Split: 1484 @RenderArticleSplitHeader(settings); 1485 break; 1486 case ArticleHeaderLayout.Banner: 1487 @RenderArticleBannerHeader(settings); 1488 break; 1489 case ArticleHeaderLayout.Overlay: 1490 @RenderArticleOverlayHeader(settings); 1491 break; 1492 default: 1493 @RenderArticleCleanHeader(settings); 1494 break; 1495 } 1496 } 1497 } 1498 1499 @helper RenderArticleCleanHeader(ArticleHeader settings) { 1500 dynamic[] methodParameters = new dynamic[1]; 1501 methodParameters[0] = settings; 1502 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleCleanHeaderCustom"); 1503 1504 if (customMethod != null) 1505 { 1506 @customMethod.Invoke(this, methodParameters).ToString(); 1507 } 1508 else 1509 { 1510 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12"; 1511 1512 <div class="grid grid--align-content-start grid--justify-start"> 1513 <div class="grid__col-md-@contentColumns grid__col-sm-12 u-padding--lg dw-mod"> 1514 @if (!String.IsNullOrEmpty(settings.Category) || !String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date) || settings.RatingOutOf != 0) 1515 { 1516 <div class="u-border-bottom u-padding-bottom"> 1517 @if (!String.IsNullOrEmpty(settings.Category)) 1518 { 1519 <div class="u-pull--left"> 1520 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div> 1521 </div> 1522 } 1523 <div class="u-pull--right"> 1524 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 1525 { 1526 <small class="article__post-info dw-mod">@settings.Author @settings.Date</small> 1527 } 1528 @if (settings.RatingOutOf != 0) 1529 { 1530 @RenderRating(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) 1531 } 1532 </div> 1533 </div> 1534 } 1535 1536 <div class="grid__cell"> 1537 @if (!String.IsNullOrEmpty(settings.Heading)) 1538 { 1539 <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1> 1540 } 1541 @if (settings.Image != null) 1542 { 1543 if (settings.Image.Path != null) 1544 { 1545 <div class="u-padding-bottom--lg"> 1546 @RenderImage(settings.Image) 1547 </div> 1548 } 1549 } 1550 @if (!String.IsNullOrEmpty(settings.Subheading)) 1551 { 1552 <div class="article__leadtext dw-mod">@settings.Subheading</div> 1553 } 1554 @if (!String.IsNullOrEmpty(settings.Link)) 1555 { 1556 <div class="grid__cell"> 1557 @RenderButton(new Button { Link = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 1558 </div> 1559 } 1560 </div> 1561 </div> 1562 @if (settings.ExternalParagraphId != 0) 1563 { 1564 <div class="grid__col-md-4 grid__col-sm-12 u-padding--lg u-color-light-gray--bg dw-mod"> 1565 @RenderParagraphContent(settings.ExternalParagraphId) 1566 </div> 1567 } 1568 </div> 1569 } 1570 } 1571 1572 @helper RenderArticleSplitHeader(ArticleHeader settings) { 1573 dynamic[] methodParameters = new dynamic[1]; 1574 methodParameters[0] = settings; 1575 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSplitHeaderCustom"); 1576 1577 if (customMethod != null) 1578 { 1579 @customMethod.Invoke(this, methodParameters).ToString(); 1580 } 1581 else 1582 { 1583 string headerColumnWidth = settings.ExternalParagraphId != 0 ? "4" : "6"; 1584 1585 if (settings.Image != null) 1586 { 1587 if (settings.Image.Path != null) 1588 { 1589 <section class="multiple-paragraphs-container paragraph-container--full-width"> 1590 <div class="grid"> 1591 <div class="grid__col-md-@headerColumnWidth grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-xl dw-mod"> 1592 <div class="u-left-middle u-padding--lg"> 1593 <div> 1594 @if (!String.IsNullOrEmpty(settings.Category)) 1595 { 1596 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div> 1597 } 1598 @if (!String.IsNullOrEmpty(settings.Heading)) 1599 { 1600 <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1> 1601 } 1602 @if (!String.IsNullOrEmpty(settings.Subheading)) 1603 { 1604 <div class="article__leadtext dw-mod">@settings.Subheading</div> 1605 } 1606 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 1607 { 1608 <small class="article__post-info u-pull--left dw-mod">@settings.Author @settings.Date</small> 1609 } 1610 @if (settings.RatingOutOf != 0) 1611 { 1612 <div class="u-pull--right"> 1613 @RenderRating(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) 1614 </div> 1615 } 1616 @if (!String.IsNullOrEmpty(settings.Link)) { 1617 @RenderButton(new Button { Link = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 1618 } 1619 </div> 1620 </div> 1621 </div> 1622 <div class="grid__col-md-@headerColumnWidth grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-auto dw-mod" style="background-image:url(/Admin/Public/GetImage.ashx?width=1800&amp;height=1100&amp;crop=0&amp;Compression=85&amp;DoNotUpscale=true&amp;image=@settings.Image.Path); background-position: center center; background-size: cover;"></div> 1623 @if (settings.ExternalParagraphId != 0) 1624 { 1625 <div class="grid__col-md-4 grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-auto u-color-light-gray--bg dw-mod"> 1626 @RenderParagraphContent(settings.ExternalParagraphId) 1627 </div> 1628 } 1629 </div> 1630 </section> 1631 } 1632 } 1633 else 1634 { 1635 @RenderArticleCleanHeader(settings); 1636 } 1637 } 1638 } 1639 1640 @helper RenderArticleOverlayHeader(ArticleHeader settings) { 1641 dynamic[] methodParameters = new dynamic[1]; 1642 methodParameters[0] = settings; 1643 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleOverlayHeaderCustom"); 1644 1645 if (customMethod != null) 1646 { 1647 @customMethod.Invoke(this, methodParameters).ToString(); 1648 } 1649 else 1650 { 1651 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12"; 1652 string contentAlignment = settings.TextLayout == ArticleHeaderTextLayout.Center ? "grid--justify-center" : ""; 1653 1654 if (settings.Image != null) 1655 { 1656 if (settings.Image.Path != null) 1657 { 1658 if (settings.ExternalParagraphId == 0) 1659 { 1660 <section class="multiple-paragraphs-container u-color-light paragraph-container--full-width"> 1661 <div class="background-image image-filter image-filter--darken dw-mod"> 1662 <div class="background-image__wrapper image-filter image-filter--darken dw-mod"> 1663 @{ 1664 settings.Image.CssClass += "background-image__cover dw-mod"; 1665 } 1666 @RenderImage(settings.Image) 1667 </div> 1668 </div> 1669 <div class="center-container dw-mod"> 1670 <div class="grid @contentAlignment"> 1671 <div class="grid__col-md-@contentColumns grid__col-xs-12 paragraph-container paragraph-container--height-xl u-no-padding dw-mod"> 1672 @if (!String.IsNullOrEmpty(settings.Heading)) 1673 { 1674 <h1 class="article__header article__header--giant u-padding-top--lg dw-mod" style="color: @settings.TextColor">@settings.Heading</h1> 1675 } 1676 @if (!String.IsNullOrEmpty(settings.Subheading)) 1677 { 1678 <div class="article__leadtext dw-mod" style="color: @settings.TextColor">@settings.Subheading</div> 1679 } 1680 <div class="u-margin-top"> 1681 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 1682 { 1683 <small class="article__post-info u-pull--left dw-mod" style="color: @settings.TextColor">@settings.Author @settings.Date</small> 1684 } 1685 @if (settings.RatingOutOf != 0) 1686 { 1687 <div class="u-pull--right"> 1688 @RenderRating(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) 1689 </div> 1690 } 1691 </div> 1692 @if (!String.IsNullOrEmpty(settings.Link)) 1693 { 1694 <div class="grid__cell"> 1695 @RenderButton(new Button { Link= settings.Link, Title= settings.LinkText, ButtonLayout= settings.ButtonLayout }) 1696 </div> 1697 } 1698 </div> 1699 </div> 1700 </div> 1701 </section> 1702 } 1703 else 1704 { 1705 @RenderArticleBanner(settings); 1706 } 1707 } 1708 } 1709 else 1710 { 1711 @RenderArticleCleanHeader(settings); 1712 } 1713 } 1714 } 1715 1716 @helper RenderArticleBannerHeader(dynamic settings) { 1717 dynamic[] methodParameters = new dynamic[1]; 1718 methodParameters[0] = settings; 1719 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleBannerHeaderCustom"); 1720 1721 if (customMethod != null) 1722 { 1723 @customMethod.Invoke(this, methodParameters).ToString(); 1724 } 1725 else 1726 { 1727 @RenderArticleBanner(settings); 1728 } 1729 } 1730 @using System.Reflection 1731 @using System.Text.RegularExpressions; 1732 @using Dynamicweb.Frontend 1733 @using Dynamicweb.Content.Items 1734 @using Dynamicweb.Rapido.Blocks.Components 1735 @using Dynamicweb.Rapido.Blocks.Components.Articles 1736 @using Dynamicweb.Rapido.Blocks 1737 1738 @* Component for the articles *@ 1739 1740 @helper RenderArticleBodyRow(ArticleBodyRow settings) 1741 { 1742 dynamic[] methodParameters = new dynamic[1]; 1743 methodParameters[0] = settings; 1744 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleBodyRowCustom"); 1745 1746 if (customMethod != null) 1747 { 1748 @customMethod.Invoke(this, methodParameters).ToString(); 1749 } else { 1750 string position = settings.TopLayout == "overlay" ? "article__overlay-offset" : ""; 1751 string contentAlignment = settings.TextLayout == "center" ? "grid--justify-center" : ""; 1752 1753 <div class="grid grid--align-content-start @contentAlignment @position dw-mod"> 1754 @RenderBlockList(settings.SubBlocks) 1755 </div> 1756 } 1757 } 1758 @using System.Reflection 1759 @using Dynamicweb.Rapido.Blocks.Components 1760 @using Dynamicweb.Rapido.Blocks.Components.General 1761 @using Dynamicweb.Rapido.Blocks.Components.Articles 1762 @using Dynamicweb.Rapido.Blocks 1763 1764 @* Component for the articles *@ 1765 1766 @helper RenderArticleImage(ArticleImage settings) 1767 { 1768 dynamic[] methodParameters = new dynamic[1]; 1769 methodParameters[0] = settings; 1770 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleImageCustom"); 1771 1772 if (customMethod != null) 1773 { 1774 @customMethod.Invoke(this, methodParameters).ToString(); 1775 } 1776 else 1777 { 1778 if (settings.Image != null) 1779 { 1780 if (settings.Image.Path != null) 1781 { 1782 <div class="u-margin-bottom--lg"> 1783 @RenderImage(settings.Image) 1784 </div> 1785 } 1786 } 1787 } 1788 } 1789 @using System.Reflection 1790 @using Dynamicweb.Rapido.Blocks.Components 1791 @using Dynamicweb.Rapido.Blocks.Components.Articles 1792 1793 1794 @* Component for the articles *@ 1795 1796 @helper RenderArticleSubHeader(ArticleSubHeader settings) 1797 { 1798 dynamic[] methodParameters = new dynamic[1]; 1799 methodParameters[0] = settings; 1800 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSubHeaderCustom"); 1801 1802 if (customMethod != null) 1803 { 1804 @customMethod.Invoke(this, methodParameters).ToString(); 1805 } else { 1806 if (!String.IsNullOrEmpty(settings.Title)) 1807 { 1808 <h2 class="article__header">@settings.Title</h2> 1809 } 1810 } 1811 } 1812 @using System.Reflection 1813 @using Dynamicweb.Rapido.Blocks.Components 1814 @using Dynamicweb.Rapido.Blocks.Components.Articles 1815 @using Dynamicweb.Rapido.Blocks 1816 1817 1818 @* Component for the articles *@ 1819 1820 @helper RenderArticleText(ArticleText settings) 1821 { 1822 dynamic[] methodParameters = new dynamic[1]; 1823 methodParameters[0] = settings; 1824 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleTextCustom"); 1825 1826 if (customMethod != null) 1827 { 1828 @customMethod.Invoke(this, methodParameters).ToString(); 1829 } else { 1830 if (!String.IsNullOrEmpty(settings.Text)) 1831 { 1832 string greatTextClass = settings.EnableLargeText == true ? "article__paragraph--great-text" : ""; 1833 1834 <div class="article__paragraph @greatTextClass"> 1835 @settings.Text 1836 </div> 1837 } 1838 } 1839 } 1840 @using System.Reflection 1841 @using Dynamicweb.Rapido.Blocks.Components 1842 @using Dynamicweb.Rapido.Blocks.Components.Articles 1843 @using Dynamicweb.Rapido.Blocks 1844 1845 1846 @* Component for the articles *@ 1847 1848 @helper RenderArticleQuote(ArticleQuote settings) 1849 { 1850 dynamic[] methodParameters = new dynamic[1]; 1851 methodParameters[0] = settings; 1852 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleQuoteCustom"); 1853 1854 if (customMethod != null) 1855 { 1856 @customMethod.Invoke(this, methodParameters).ToString(); 1857 } else { 1858 string text = Regex.Replace(settings.Text, "<.*?>", String.Empty); 1859 1860 <div class="grid u-padding-bottom--lg"> 1861 @if (settings.Image != null) 1862 { 1863 if (settings.Image.Path != null) { 1864 <div class="grid__col-3"> 1865 <div class="grid__cell-img"> 1866 @{ 1867 settings.Image.Title = !String.IsNullOrEmpty(settings.Image.Title) ? settings.Image.Title : settings.Author; 1868 settings.Image.CssClass += " article__image article__image--ball"; 1869 settings.Image.ImageDefault.Width = 200; 1870 settings.Image.ImageDefault.Height = 200; 1871 } 1872 @RenderImage(settings.Image) 1873 </div> 1874 </div> 1875 } 1876 } 1877 <div class="grid__col-auto"> 1878 @if (!String.IsNullOrEmpty(settings.Text)) 1879 { 1880 <div class="article__quote dw-mod"> 1881 <i class="fas fa-quote-right u-margin-bottom--lg"></i> 1882 @settings.Text 1883 <i class="fas fa-quote-right"></i> 1884 </div> 1885 } 1886 @if (!String.IsNullOrEmpty(settings.Author)) 1887 { 1888 <div class="article__quote-author dw-mod"> 1889 - @settings.Author 1890 </div> 1891 } 1892 </div> 1893 </div> 1894 } 1895 } 1896 @using System.Reflection 1897 @using Dynamicweb.Rapido.Blocks.Components 1898 @using Dynamicweb.Rapido.Blocks.Components.Articles 1899 @using Dynamicweb.Rapido.Blocks 1900 1901 @* Component for the articles *@ 1902 1903 @helper RenderArticleInfoTable(ArticleInfoTable settings) 1904 { 1905 dynamic[] methodParameters = new dynamic[1]; 1906 methodParameters[0] = settings; 1907 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleInfoTableCustom"); 1908 1909 if (customMethod != null) 1910 { 1911 @customMethod.Invoke(this, methodParameters).ToString(); 1912 } else { 1913 <table class="table table--clean"> 1914 @foreach (var row in settings.Rows) 1915 { 1916 string iconColor = row.IconColor != null ? row.IconColor : "u-brand-color-two"; 1917 1918 <tr> 1919 @if (!String.IsNullOrEmpty(row.Icon)) 1920 { 1921 <td class="u-w32px"><i class="@row.Icon fa-2x @row.IconColor"></i></td> 1922 } 1923 <td class="u-no-margin-on-p-elements"> 1924 <div class="u-bold">@row.Title</div> 1925 @if (!String.IsNullOrEmpty(row.SubTitle)) 1926 { 1927 if (row.Link == null) 1928 { 1929 <div>@row.SubTitle</div> 1930 } 1931 else 1932 { 1933 <a href="@row.Link" class="u-color-inherit">@row.SubTitle</a> 1934 } 1935 } 1936 </td> 1937 </tr> 1938 } 1939 </table> 1940 } 1941 } 1942 @using System.Reflection 1943 @using Dynamicweb.Rapido.Blocks.Components 1944 @using Dynamicweb.Rapido.Blocks.Components.Articles 1945 @using Dynamicweb.Rapido.Blocks 1946 1947 @* Component for the articles *@ 1948 1949 @helper RenderArticleGalleryModal(ArticleGalleryModal settings) 1950 { 1951 dynamic[] methodParameters = new dynamic[1]; 1952 methodParameters[0] = settings; 1953 MethodInfo customMethod = this.GetType().GetMethod(settings.HelperName + "Custom"); 1954 1955 if (customMethod != null) 1956 { 1957 @customMethod.Invoke(this, methodParameters).ToString(); 1958 } 1959 else 1960 { 1961 <input type="checkbox" id="ParagraphGalleryModalTrigger" class="modal-trigger" /> 1962 <div class="modal-container"> 1963 <label for="ParagraphGalleryModalTrigger" id="ParagraphGalleryModalOverlay" class="modal-overlay"></label> 1964 <div class="modal modal--full" id="ParagraphGalleryModal"> 1965 <div class="modal__body modal__body--full"> 1966 <div class="modal__image-min-size-wrapper"> 1967 <img src="/Files/Images/placeholder.gif" id="ParagraphGallery" class="modal--full__img dw-mod" alt=""> 1968 </div> 1969 <div class="modal__images-counter" id="ParagraphGallery_counter"></div> 1970 <button class="modal__prev-btn dw-mod" id="ParagraphGallery_prev" onclick="Gallery.prevImage('ParagraphGallery')" type="button"> 1971 <i class="far fa-angle-left"></i> 1972 </button> 1973 <button class="modal__next-btn dw-mod" id="ParagraphGallery_next" onclick="Gallery.nextImage('ParagraphGallery')" type="button"> 1974 <i class="far fa-angle-right"></i> 1975 </button> 1976 </div> 1977 <label class="modal__close-btn" for="ParagraphGalleryModalTrigger"></label> 1978 </div> 1979 </div> 1980 } 1981 } 1982 @using System.Reflection 1983 @using Dynamicweb.Rapido.Blocks.Components 1984 @using Dynamicweb.Rapido.Blocks.Components.Articles 1985 @using Dynamicweb.Rapido.Blocks 1986 1987 1988 @* Component for the articles *@ 1989 1990 @helper RenderArticleRelated(ArticleRelated settings) 1991 { 1992 string cardClass = Pageview.Device.ToString() != "Tablet" ? "card u-color-light--bg u-full-height" : ""; 1993 string cardFooterClass = Pageview.Device.ToString() != "Tablet" ? "card-footer u-color-light--bg" : ""; 1994 1995 <section class="multiple-paragraphs-container u-color-light-gray--bg paragraph-container--full-width"> 1996 <div class="center-container dw-mod"> 1997 <div class="grid u-padding"> 1998 <div class="grid__col-md-12 grid__col-xs-12"> 1999 <h2 class="article__header u-no-margin u-margin-top">@settings.Title</h2> 2000 </div> 2001 </div> 2002 2003 <div class="js-handlebars-root u-padding" id="@settings.Title.Replace(" ", String.Empty)" data-template="RelatedSimpleTemplate" data-json-feed="/Default.aspx?ID=@settings.FeedPageId&@settings.Query&ExcludeItemID=@settings.CurrentPageId&PageSize=@settings.PageSize"></div> 2004 2005 <script id="RelatedSimpleTemplate" type="text/x-template"> 2006 {{#.}} 2007 <div class="grid u-padding-bottom--lg"> 2008 {{#Cases}} 2009 <div class="grid__col-3 image-hover--zoom dw-mod"> 2010 <a href="{{link}}" class="u-full-height u-color-light--bg"> 2011 {{#if image}} 2012 <div class="u-color-light--bg u-no-padding dw-mod"> 2013 <div class="flex-img image-hover__wrapper"> 2014 <img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=680&height=314&amp;crop=1&amp;DoNotUpscale=True&amp;Compression=75&amp;image={{image}}" alt="{{title}}" /> 2015 </div> 2016 </div> 2017 {{/if}} 2018 2019 <div class="card u-color-light--bg dw-mod"> 2020 <h3 class="article-list__item-header u-truncate-text dw-mod">{{title}}</h3> 2021 <p class="article__short-summary dw-mod">{{summary}}</p> 2022 </div> 2023 </a> 2024 </div> 2025 {{/Cases}} 2026 </div> 2027 {{/.}} 2028 </script> 2029 </div> 2030 </section> 2031 } 2032 @using System.Reflection 2033 @using Dynamicweb.Rapido.Blocks.Components 2034 @using Dynamicweb.Rapido.Blocks.Components.Articles 2035 @using Dynamicweb.Rapido.Blocks 2036 2037 2038 @* Component for the articles *@ 2039 2040 @helper RenderArticleMenu(ArticleMenu settings) 2041 { 2042 dynamic[] methodParameters = new dynamic[1]; 2043 methodParameters[0] = settings; 2044 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleMenuCustom"); 2045 2046 if (customMethod != null) 2047 { 2048 @customMethod.Invoke(this, methodParameters).ToString(); 2049 } else { 2050 if (!String.IsNullOrEmpty(settings.Title)) { 2051 <div class="u-margin u-border-bottom"> 2052 <h3 class="u-no-margin">@settings.Title</h3> 2053 </div> 2054 } 2055 2056 <ul class="menu-left u-margin-bottom dw-mod"> 2057 @foreach (var item in settings.Items) 2058 { 2059 @RenderArticleMenuItem(item) 2060 } 2061 </ul> 2062 } 2063 } 2064 2065 @helper RenderArticleMenuItem(ArticleMenuItem settings) 2066 { 2067 dynamic[] methodParameters = new dynamic[1]; 2068 methodParameters[0] = settings; 2069 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleMenuItemCustom"); 2070 2071 if (customMethod != null) 2072 { 2073 @customMethod.Invoke(this, methodParameters).ToString(); 2074 } else { 2075 string link = !String.IsNullOrEmpty(settings.Link) ? settings.Link : "#"; 2076 2077 if (!String.IsNullOrEmpty(settings.Title)) { 2078 <li class="menu-left__item dw-mod"> 2079 <a href="@link" onclick="@settings.OnClick" class="menu-left__link dw-mod">@settings.Title</a> 2080 </li> 2081 } 2082 } 2083 } 2084 @using System.Reflection 2085 @using Dynamicweb.Rapido.Blocks.Components 2086 @using Dynamicweb.Rapido.Blocks.Components.Articles 2087 @using Dynamicweb.Rapido.Blocks 2088 2089 @* Component for the articles *@ 2090 2091 @helper RenderArticleList(ArticleList settings) 2092 { 2093 dynamic[] methodParameters = new dynamic[1]; 2094 methodParameters[0] = settings; 2095 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListCustom"); 2096 2097 if (customMethod != null) 2098 { 2099 @customMethod.Invoke(this, methodParameters).ToString(); 2100 } else { 2101 if (Pageview != null) 2102 { 2103 bool isParagraph = Pageview.CurrentParagraph != null ? true : false; 2104 string[] sortArticlesListBy = new string[2]; 2105 2106 if (isParagraph) { 2107 sortArticlesListBy = Pageview.CurrentParagraph.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString()) ? Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" }; 2108 } 2109 else { 2110 sortArticlesListBy = Pageview.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.Item["SortArticlesListBy"].ToString()) ? Pageview.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" }; 2111 } 2112 2113 string sourcePage = settings.SourcePage != null ? settings.SourcePage : Pageview.ID.ToString(); 2114 2115 @RenderItemList(new 2116 { 2117 ItemType = !String.IsNullOrEmpty(settings.ItemType) ? settings.ItemType : "DynamicArticle", 2118 ListSourceType = settings.SourceType, 2119 ListSourcePage = sourcePage, 2120 ItemFieldsList = "*", 2121 Filter = settings.Filter, 2122 ListOrderBy = sortArticlesListBy[0], 2123 ListOrderByDirection = sortArticlesListBy[1], 2124 ListSecondOrderBy = sortArticlesListBy[0] == "Date" ? "InFocusSortId" : "Date", 2125 ListSecondOrderByDirection = "ASC", 2126 IncludeAllChildItems = true, 2127 ListTemplate = settings.Template, 2128 ListPageSize = settings.PageSize.ToString() 2129 }); 2130 } 2131 } 2132 } 2133 @using System.Reflection 2134 @using Dynamicweb.Rapido.Blocks.Components.Articles 2135 2136 2137 @* Component for the articles *@ 2138 2139 @helper RenderArticleSummary(ArticleSummary settings) 2140 { 2141 dynamic[] methodParameters = new dynamic[1]; 2142 methodParameters[0] = settings; 2143 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSummaryCustom"); 2144 2145 if (customMethod != null) 2146 { 2147 @customMethod.Invoke(this, methodParameters).ToString(); 2148 } else { 2149 if (!String.IsNullOrEmpty(settings.Text)) 2150 { 2151 <div class="article__summary dw-mod">@settings.Text</div> 2152 } 2153 } 2154 } 2155 @using System.Reflection 2156 @using Dynamicweb.Rapido.Blocks.Components 2157 @using Dynamicweb.Rapido.Blocks.Components.Articles 2158 @using Dynamicweb.Rapido.Blocks 2159 2160 @* Component for the articles *@ 2161 2162 @helper RenderArticleListCategoryFilter(ArticleListCategoryFilter settings) 2163 { 2164 dynamic[] methodParameters = new dynamic[1]; 2165 methodParameters[0] = settings; 2166 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListCategoryFilterCustom"); 2167 2168 if (customMethod != null) 2169 { 2170 @customMethod.Invoke(this, methodParameters).ToString(); 2171 } else { 2172 string pageId = Pageview.ID.ToString(); 2173 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("sourcePage")) ? HttpContext.Current.Request.QueryString.Get("sourcePage") : Translate("All"); 2174 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString()); 2175 2176 foreach (var option in settings.Categories) 2177 { 2178 selectedFilter = selectedFilter == option.Value ? option.Key : selectedFilter; 2179 } 2180 2181 if (selectedFilter == pageId) 2182 { 2183 selectedFilter = Translate("All"); 2184 } 2185 2186 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 2187 { 2188 <div class="u-pull--right u-margin-left"> 2189 <div class="collection u-no-margin"> 2190 <h5>@Translate("Category")</h5> 2191 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" /> 2192 <div class="dropdown u-w180px dw-mod"> 2193 <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label> 2194 <div class="dropdown__content dw-mod"> 2195 @foreach (var option in settings.Categories) 2196 { 2197 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div> 2198 } 2199 </div> 2200 <label class="dropdown-trigger-off" for="CategorySelector"></label> 2201 </div> 2202 </div> 2203 </div> 2204 } 2205 else 2206 { 2207 <div class="u-full-width u-margin-bottom"> 2208 <h5 class="u-no-margin">@Translate("Category")</h5> 2209 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" /> 2210 <div class="dropdown u-full-width dw-mod"> 2211 <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label> 2212 <div class="dropdown__content dw-mod"> 2213 @foreach (var option in settings.Categories) 2214 { 2215 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div> 2216 } 2217 </div> 2218 <label class="dropdown-trigger-off" for="CategorySelector"></label> 2219 </div> 2220 </div> 2221 } 2222 } 2223 } 2224 @using System.Reflection 2225 @using Dynamicweb.Rapido.Blocks.Components 2226 @using Dynamicweb.Rapido.Blocks.Components.Articles 2227 @using Dynamicweb.Rapido.Blocks 2228 2229 @* Component for the articles *@ 2230 2231 @helper RenderArticleListFilter(ArticleListFilter settings) 2232 { 2233 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get(settings.SystemName)) ? HttpContext.Current.Request.QueryString.Get(settings.SystemName) : Translate("All"); 2234 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString()); 2235 2236 if (settings.Options != null) 2237 { 2238 foreach (var option in settings.Options) 2239 { 2240 selectedFilter = selectedFilter == option.Value ? option.Name : selectedFilter; 2241 } 2242 2243 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 2244 { 2245 <div class="u-pull--right u-margin-left"> 2246 <div class="collection u-no-margin"> 2247 <h5>@settings.Label</h5> 2248 <input type="checkbox" id="@(settings.SystemName)Selector" class="dropdown-trigger" /> 2249 <div class="dropdown u-w180px dw-mod"> 2250 <label class="dropdown__header dropdown__btn dw-mod" for="@(settings.SystemName)Selector">@Translate(selectedFilter)</label> 2251 <div class="dropdown__content dw-mod"> 2252 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')">@Translate("All")</div> 2253 @foreach (var option in settings.Options) 2254 { 2255 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')">@Translate(option.Name)</div> 2256 } 2257 </div> 2258 <label class="dropdown-trigger-off" for="@(settings.SystemName)Selector"></label> 2259 </div> 2260 </div> 2261 </div> 2262 } 2263 else 2264 { 2265 <div class="u-full-width u-margin-bottom"> 2266 <h5 class="u-no-margin">@settings.Label</h5> 2267 <input type="checkbox" id="@(settings.SystemName)Selector" class="dropdown-trigger" /> 2268 <div class="dropdown u-full-width w-mod"> 2269 <label class="dropdown__header dropdown__btn dw-mod" for="@(settings.SystemName)Selector">@Translate(selectedFilter)</label> 2270 <div class="dropdown__content dw-mod"> 2271 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')">@Translate("All")</div> 2272 @foreach (var option in settings.Options) 2273 { 2274 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')">@Translate(option.Name)</div> 2275 } 2276 </div> 2277 <label class="dropdown-trigger-off" for="@(settings.SystemName)Selector"></label> 2278 </div> 2279 </div> 2280 } 2281 } 2282 } 2283 @using System.Reflection 2284 @using Dynamicweb.Rapido.Blocks.Components 2285 @using Dynamicweb.Rapido.Blocks.Components.Articles 2286 @using Dynamicweb.Rapido.Blocks 2287 2288 @* Component for the articles *@ 2289 2290 @helper RenderArticleListSearch(ArticleListSearch settings) 2291 { 2292 dynamic[] methodParameters = new dynamic[1]; 2293 methodParameters[0] = settings; 2294 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListSearchCustom"); 2295 2296 if (customMethod != null) 2297 { 2298 @customMethod.Invoke(this, methodParameters).ToString(); 2299 } else { 2300 string searchString = !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("Title")) ? HttpContext.Current.Request.QueryString.Get("Title").Trim('*') : ""; 2301 string className = "u-w340px u-pull--right u-margin-left"; 2302 2303 if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet") 2304 { 2305 className = "u-full-width"; 2306 } 2307 2308 <div class="typeahead u-color-inherit u-margin-bottom dw-mod @className"> 2309 <input type="text" class="typeahead-search-field u-no-margin dw-mod" placeholder="@Translate("Search in list")" value="@searchString" id="ArticleListSearchInput" onchange="QueryArray.setParameterInCurrentURL('Title', '*' + document.getElementById('ArticleListSearchInput').value + '*')"> 2310 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod"><i class="fas fa-search"></i></button> 2311 </div> 2312 } 2313 } 2314 @using System.Reflection 2315 @using Dynamicweb.Rapido.Blocks.Components 2316 @using Dynamicweb.Rapido.Blocks.Components.Articles 2317 @using Dynamicweb.Rapido.Blocks 2318 2319 @* Component for the articles *@ 2320 2321 @helper RenderArticleListNoResultsInfo(ArticleListNoResultsInfo settings) 2322 { 2323 dynamic[] methodParameters = new dynamic[1]; 2324 methodParameters[0] = settings; 2325 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListNoResultsInfoCustom"); 2326 2327 if (customMethod != null) 2328 { 2329 @customMethod.Invoke(this, methodParameters).ToString(); 2330 } else { 2331 <div class="u-margin-top--lg u-bold u-ta-center u-bold">@Translate(settings.Message)</div> 2332 } 2333 } 2334 @using System.Reflection 2335 @using Dynamicweb.Rapido.Blocks.Components 2336 @using Dynamicweb.Rapido.Blocks.Components.General 2337 @using Dynamicweb.Rapido.Blocks.Components.Articles 2338 @using Dynamicweb.Rapido.Blocks 2339 @using System.Text.RegularExpressions 2340 2341 @* Component for the articles *@ 2342 2343 @helper RenderArticleListItem(ArticleListItem settings) 2344 { 2345 switch (settings.Type) { 2346 case ArticleListItemType.Card: 2347 @RenderArticleListItemCard(settings); 2348 break; 2349 case ArticleListItemType.List: 2350 @RenderArticleListItemList(settings); 2351 break; 2352 case ArticleListItemType.Simple: 2353 @RenderArticleListItemSimple(settings); 2354 break; 2355 default: 2356 @RenderArticleListItemCard(settings); 2357 break; 2358 } 2359 } 2360 2361 @helper RenderArticleListItemCard(ArticleListItem settings) { 2362 <a href="@settings.Link" class="u-full-height u-color-light--bg"> 2363 <div class="u-color-light--bg u-no-padding dw-mod"> 2364 @if (settings.Logo != null) 2365 { 2366 string backgroundImage = settings.Image != null ? "background-image:url(/Admin/Public/GetImage.ashx?width=992&amp;height=760&amp;crop=0&amp;Compression=75&amp;DoNotUpscale=True&amp;image=" + settings.Image.Path + "); background-size: cover;" : ""; 2367 settings.Logo.ImageDefault.Crop = 5; 2368 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width; 2369 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height; 2370 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage"> 2371 @if (settings.Stickers != null) 2372 { 2373 if (settings.Stickers.Position != StickersListPosition.Custom) 2374 { 2375 @RenderStickersCollection(settings.Stickers); 2376 } 2377 } 2378 @RenderImage(settings.Logo) 2379 </div> 2380 } else if (settings.Image != null) 2381 { 2382 <div class="flex-img image-hover__wrapper u-position-relative dw-mod"> 2383 @if (settings.Stickers != null) 2384 { 2385 if (settings.Stickers.Position != StickersListPosition.Custom) 2386 { 2387 @RenderStickersCollection(settings.Stickers); 2388 } 2389 } 2390 @RenderImage(settings.Image) 2391 </div> 2392 } 2393 </div> 2394 2395 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary)) 2396 { 2397 <div class="card u-color-light--bg dw-mod"> 2398 @if (settings.Stickers != null) 2399 { 2400 if (settings.Stickers.Position == StickersListPosition.Custom) 2401 { 2402 @RenderStickersCollection(settings.Stickers); 2403 } 2404 } 2405 @if (!String.IsNullOrEmpty(settings.Title)) 2406 { 2407 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3> 2408 } 2409 @if (!String.IsNullOrEmpty(settings.SubTitle)) 2410 { 2411 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 2412 } 2413 @if (!String.IsNullOrEmpty(settings.Summary)) 2414 { 2415 <p class="article__short-summary dw-mod">@settings.Summary</p> 2416 } 2417 </div> 2418 } 2419 </a> 2420 } 2421 2422 @helper RenderArticleListItemList(ArticleListItem settings) { 2423 <a href="@settings.Link"> 2424 <div class="grid u-color-light--bg u-no-padding dw-mod"> 2425 <div class="grid__col-md-3"> 2426 <div class="u-color-light--bg u-no-padding dw-mod"> 2427 @if (settings.Logo != null) 2428 { 2429 string backgroundImage = settings.Image != null ? "background-image:url(/Admin/Public/GetImage.ashx?width=992&amp;height=760&amp;crop=0&amp;Compression=75&amp;DoNotUpscale=True&amp;image=" + settings.Image.Path + "); background-size: cover;" : ""; 2430 settings.Logo.ImageDefault.Crop = 5; 2431 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width; 2432 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height; 2433 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage"> 2434 @if (settings.Stickers != null) 2435 { 2436 if (settings.Stickers.Position != StickersListPosition.Custom) 2437 { 2438 @RenderStickersCollection(settings.Stickers); 2439 } 2440 } 2441 @RenderImage(settings.Logo) 2442 </div> 2443 } else if (settings.Image != null) 2444 { 2445 <div class="flex-img image-hover__wrapper dw-mod"> 2446 @if (settings.Stickers != null) 2447 { 2448 if (settings.Stickers.Position != StickersListPosition.Custom) 2449 { 2450 @RenderStickersCollection(settings.Stickers); 2451 } 2452 } 2453 @RenderImage(settings.Image) 2454 </div> 2455 } 2456 </div> 2457 </div> 2458 2459 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary)) 2460 { 2461 <div class="grid__col-md-9"> 2462 @if (!String.IsNullOrEmpty(settings.Title)) 2463 { 2464 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3> 2465 } 2466 @if (settings.Stickers != null) 2467 { 2468 if (settings.Stickers.Position == StickersListPosition.Custom) 2469 { 2470 @RenderStickersCollection(settings.Stickers); 2471 } 2472 } 2473 @if (!String.IsNullOrEmpty(settings.SubTitle)) 2474 { 2475 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 2476 } 2477 @if (!String.IsNullOrEmpty(settings.Summary)) 2478 { 2479 <p class="article__short-summary dw-mod">@settings.Summary</p> 2480 } 2481 </div> 2482 } 2483 </div> 2484 </a> 2485 } 2486 2487 @helper RenderArticleListItemSimple(ArticleListItem settings) { 2488 <a href="@settings.Link" class="u-color-inherit"> 2489 <div class="grid u-color-light--bg u-no-padding dw-mod"> 2490 <div class="grid__col-md-12"> 2491 @if (!String.IsNullOrEmpty(settings.Title)) 2492 { 2493 <div class="article-list-item__header u-truncate-text u-no-margin dw-mod">@settings.Title</div> 2494 } 2495 @if (!String.IsNullOrEmpty(settings.SubTitle)) 2496 { 2497 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 2498 } 2499 </div> 2500 </div> 2501 </a> 2502 } 2503 @using System.Reflection 2504 @using Dynamicweb.Rapido.Blocks.Components.Articles 2505 2506 2507 @* Component for the articles *@ 2508 2509 @helper RenderArticleAuthorAndDate(ArticleAuthorAndDate settings) 2510 { 2511 dynamic[] methodParameters = new dynamic[1]; 2512 methodParameters[0] = settings; 2513 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleAuthorAndDateCustom"); 2514 2515 if (customMethod != null) 2516 { 2517 @customMethod.Invoke(this, methodParameters).ToString(); 2518 } else { 2519 <small class="article__subscription"> 2520 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date))) 2521 { 2522 <text>@Translate("Written")</text> 2523 } 2524 @if (!string.IsNullOrWhiteSpace(settings.Author)) 2525 { 2526 <text>@Translate("by") @settings.Author</text> 2527 } 2528 @if (!string.IsNullOrWhiteSpace(settings.Date)) 2529 { 2530 <text>@Translate("on") @settings.Date</text> 2531 } 2532 </small> 2533 } 2534 } 2535 @using System.Reflection 2536 @using Dynamicweb.Rapido.Blocks.Components.Articles 2537 2538 2539 @* Component for the articles *@ 2540 2541 @helper RenderArticleLink(ArticleLink settings) 2542 { 2543 dynamic[] methodParameters = new dynamic[1]; 2544 methodParameters[0] = settings; 2545 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleLinkCustom"); 2546 2547 if (customMethod != null) 2548 { 2549 @customMethod.Invoke(this, methodParameters).ToString(); 2550 } else { 2551 if (!String.IsNullOrEmpty(settings.Title)) 2552 { 2553 <div class="grid__cell"> 2554 @RenderButton(settings) 2555 </div> 2556 } 2557 } 2558 } 2559 @using System.Reflection 2560 @using Dynamicweb.Rapido.Blocks 2561 @using Dynamicweb.Rapido.Blocks.Components.Articles 2562 @using Dynamicweb.Rapido.Blocks.Components.General 2563 2564 2565 @* Component for the articles *@ 2566 2567 @helper RenderArticleCarousel(ArticleCarousel settings) 2568 { 2569 dynamic[] methodParameters = new dynamic[1]; 2570 methodParameters[0] = settings; 2571 MethodInfo customMethod = this.GetType().GetMethod(settings.HelperName + "Custom"); 2572 2573 if (customMethod != null) 2574 { 2575 @customMethod.Invoke(this, methodParameters).ToString(); 2576 } else { 2577 <div class="grid"> 2578 <div class="grid__col-12"> 2579 <div class="carousel" id="carousel_@settings.Id"> 2580 <div class="carousel__container js-carousel-slides dw-mod"> 2581 @RenderBlockList(settings.SubBlocks) 2582 </div> 2583 </div> 2584 </div> 2585 </div> 2586 2587 <script> 2588 document.addEventListener("DOMContentLoaded", function () { 2589 new CarouselModule("#carousel_@settings.Id", { 2590 slideTime: 0, 2591 dots: true 2592 }); 2593 }); 2594 </script> 2595 } 2596 } 2597 2598 @helper RenderArticleCarouselSlide(ArticleCarouselSlide settings) 2599 { 2600 dynamic[] methodParameters = new dynamic[1]; 2601 methodParameters[0] = settings; 2602 MethodInfo customMethod = this.GetType().GetMethod(settings.HelperName + "Custom"); 2603 2604 if (customMethod != null) 2605 { 2606 @customMethod.Invoke(this, methodParameters).ToString(); 2607 } 2608 else 2609 { 2610 string imageEngine = "/Admin/Public/GetImage.ashx?"; 2611 2612 string defaultImage = settings.ImageSettings != null ? imageEngine : settings.Image; 2613 if (settings.ImageSettings != null) 2614 { 2615 defaultImage += settings.ImageSettings.Width != 0 ? "Width=" + settings.ImageSettings.Width + "&" : ""; 2616 defaultImage += settings.ImageSettings.Height != 0 ? "Height=" + settings.ImageSettings.Height + "&" : ""; 2617 defaultImage += "Crop=" + settings.ImageSettings.Crop + "&"; 2618 defaultImage += "Compression=" + settings.ImageSettings.Compression + "&"; 2619 defaultImage += "DoNotUpscale=" + settings.ImageSettings.DoNotUpscale.ToString() + "&"; 2620 defaultImage += "FillCanvas=" + settings.ImageSettings.FillCanvas.ToString() + "&"; 2621 } 2622 defaultImage += "&Image=" + settings.Image; 2623 2624 <div class="carousel__slide u-min-h300px u-flex dw-mod" style="background-size:cover; background-image:url('@defaultImage')"> 2625 <a class="article-carousel-item__wrap" href="@settings.Link" title="@settings.Title"> 2626 <h2 class="article-list__item-header u-truncate-text u-color-light dw-mod">@settings.Title</h2> 2627 <div class="article-list__item-info"> 2628 @if (settings.Stickers != null) 2629 { 2630 settings.Stickers.Position = StickersListPosition.Custom; 2631 @RenderStickersCollection(settings.Stickers); 2632 } 2633 2634 <small class="u-margin-top--lg u-color-light"> 2635 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date))) 2636 { 2637 <text>@Translate("Written")</text> 2638 } 2639 @if (!string.IsNullOrWhiteSpace(settings.Author)) 2640 { 2641 <text>@Translate("by") @settings.Author</text> 2642 } 2643 @if (!string.IsNullOrWhiteSpace(settings.Date)) 2644 { 2645 <text>@Translate("on") @settings.Date</text> 2646 } 2647 </small> 2648 </div> 2649 2650 <h3 class="article__short-summary u-color-light">@settings.Summary</h3> 2651 </a> 2652 @if (settings.UseFilters == true) 2653 { 2654 <div class="background-image image-filter image-filter--darken dw-mod"></div> 2655 } 2656 </div> 2657 } 2658 } 2659 @using System.Text.RegularExpressions 2660 @using Dynamicweb.Rapido.Blocks.Components 2661 @using Dynamicweb.Rapido.Blocks.Components.General 2662 @using Dynamicweb.Rapido.Blocks.Components.Articles 2663 @using Dynamicweb.Rapido.Blocks 2664 2665 @* Component for the articles *@ 2666 2667 @helper RenderArticleVideo(ArticleVideo settings) 2668 { 2669 dynamic[] methodParameters = new dynamic[1]; 2670 methodParameters[0] = settings; 2671 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleTextCustom"); 2672 2673 if (customMethod != null) 2674 { 2675 @customMethod.Invoke(this, methodParameters).ToString(); 2676 } else { 2677 if (settings.Url != null) 2678 { 2679 //getting video ID from youtube URL 2680 string videoCode = settings.Url; 2681 Regex regex = new Regex(@".be\/(.[^?]*)"); 2682 Match match = regex.Match(videoCode); 2683 string videoId = ""; 2684 if (match.Success) 2685 { 2686 videoId = match.Groups[1].Value; 2687 } 2688 else 2689 { 2690 regex = new Regex(@"v=([^&]+)"); 2691 match = regex.Match(videoCode); 2692 if (match.Success) 2693 { 2694 videoId = match.Groups[1].Value; 2695 } 2696 } 2697 2698 int autoPlay = settings.AutoPlay == "true" ? 1 : 0; 2699 2700 <div class="video-wrapper"> 2701 <div class="js-youtube-video" data-video="@videoId" id="ytPlayer@(Guid.NewGuid().ToString("N"))" data-auto-play="@autoPlay" data-enable-controls="1"></div> 2702 </div> 2703 } 2704 } 2705 } 2706 2707 2708 2709 @* Simple helpers *@ 2710 2711 @*Requires the Gallery ItemType that comes with Rapido*@ 2712 @helper RenderArticleItemGallery(IList<ItemViewModel> gallery) { 2713 if (gallery != null && gallery.Count > 0) 2714 { 2715 int count = 1; 2716 2717 foreach (var item in gallery) 2718 { 2719 if (item.GetFile("ImagePath") != null) 2720 { 2721 string image = item.GetFile("ImagePath").PathUrlEncoded; 2722 string imagePrefix = "/Admin/Public/GetImage.ashx?width=1200&amp;height=820&amp;crop=5&amp;Compression=75&amp;DoNotUpscale=1&amp;image="; 2723 int imagesCount = gallery.Count; 2724 2725 if (count == 1) 2726 { 2727 <label class="gallery" for="ParagraphGalleryModalTrigger" onclick="Gallery.openImage(this.querySelector('.js-gallery'))"> 2728 <span class="gallery__main-image"> 2729 <img src="/Admin/Public/GetImage.ashx?width=992&amp;height=760&amp;crop=0&amp;Compression=75&amp;DoNotUpscale=1&amp;image=@image" class="flex-img js-gallery" alt="" data-for="ParagraphGallery" data-image="@imagePrefix@image" /> 2730 </span> 2731 <span class="gallery__image-counter"> 2732 <i class="fas fa-camera fa-2x"></i> <span class="gallery__image-counter__number">@imagesCount</span> 2733 <span class="gallery__image-counter__text">@Translate("See all") <i class="fas fa-angle-right"></i></span> 2734 </span> 2735 </label> 2736 } 2737 else 2738 { 2739 <div class="u-hidden js-gallery" data-for="ParagraphGallery" data-image="@imagePrefix@image"></div> 2740 } 2741 2742 count++; 2743 } 2744 } 2745 @RenderArticleGalleryModal(new ArticleGalleryModal()) 2746 } 2747 } 2748 2749 @helper RenderMobileFilters(List<Block> subBlocks) 2750 { 2751 if (subBlocks.Count > 0) 2752 { 2753 <div class="grid__col-12"> 2754 <input type="checkbox" id="CheckFilters" class="js-remember-state u-hidden" data-expand="CheckFilters" /> 2755 <div class="grid u-margin-bottom dw-mod" data-trigger="CheckFilters"> 2756 @RenderBlockList(subBlocks) 2757 </div> 2758 <label for="CheckFilters" class="btn btn--secondary btn--full dw-mod js-expand-hide" data-trigger="CheckFilters">@Translate("Select filters")</label> 2759 <label for="CheckFilters" class="btn btn--secondary btn--full dw-mod expandable--collapsed" data-trigger="CheckFilters">@Translate("Close filters")</label> 2760 </div> 2761 } 2762 } 2763 2764 @if (File.Exists(HttpContext.Current.Server.MapPath("/Components/Custom/Custom__Components.cshtml"))) 2765 { 2766 <text>@using Dynamicweb.Rapido.Blocks.Components.General 2767 </text> 2768 } 2769 2770 2771 @* Include the Blocks for the page *@ 2772 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2773 2774 @using System 2775 @using System.Web 2776 @using System.Collections.Generic 2777 @using Dynamicweb.Rapido.Blocks.Extensibility 2778 @using Dynamicweb.Rapido.Blocks 2779 2780 @{ 2781 BlocksPage topSnippetsBlocksPage = BlocksPage.GetBlockPage("Master"); 2782 2783 Block tagManager = new Block() 2784 { 2785 Id = "TagManager", 2786 SortId = 1, 2787 Template = RenderGoogleTagManager() 2788 }; 2789 2790 Block facebookPixel = new Block() 2791 { 2792 Id = "FacebookPixel", 2793 SortId = 2, 2794 Template = RenderFacebookPixel() 2795 }; 2796 2797 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, tagManager); 2798 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, facebookPixel); 2799 } 2800 2801 @helper RenderGoogleTagManager() { 2802 string GoogleTagManagerID = Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID"); 2803 2804 if (!string.IsNullOrWhiteSpace(GoogleTagManagerID)) 2805 { 2806 <script> 2807 (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': 2808 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], 2809 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 2810 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); 2811 })(window,document,'script','dataLayer','@GoogleTagManagerID'); 2812 </script> 2813 <!-- Google Tag Manager (noscript) --> 2814 <noscript> 2815 <iframe src="https://www.googletagmanager.com/ns.html?id=@GoogleTagManagerID" 2816 height="0" width="0" style="display:none;visibility:hidden"></iframe> 2817 </noscript> 2818 <!-- End Google Tag Manager (noscript) --> 2819 } 2820 } 2821 2822 @helper RenderFacebookPixel() { 2823 string FacebookPixelID = Model.Area.Item.GetItem("Settings").GetString("FacebookPixelID"); 2824 2825 if (!string.IsNullOrWhiteSpace(FacebookPixelID)) 2826 { 2827 <!-- Facebook Pixel Code --> 2828 <script> 2829 !function(f,b,e,v,n,t,s) 2830 {if(f.fbq)return;n=f.fbq=function(){n.callMethod? 2831 n.callMethod.apply(n,arguments):n.queue.push(arguments)}; 2832 if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0'; 2833 n.queue=[];t=b.createElement(e);t.async=!0; 2834 t.src=v;s=b.getElementsByTagName(e)[0]; 2835 s.parentNode.insertBefore(t,s)}(window, document,'script', 2836 'https://connect.facebook.net/en_US/fbevents.js'); 2837 fbq('init', '@FacebookPixelID'); 2838 fbq('track', 'PageView'); 2839 </script> 2840 <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=@FacebookPixelID&ev=PageView&noscript=1" alt="" /></noscript> 2841 } 2842 } 2843 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2844 2845 @using System 2846 @using System.Web 2847 @using System.Collections.Generic 2848 @using Dynamicweb.Rapido.Blocks 2849 @using Dynamicweb.Rapido.Blocks.Extensibility 2850 @using Dynamicweb.Security.UserManagement 2851 @using Dynamicweb.Security.UserManagement.ExternalAuthentication 2852 @{ 2853 BlocksPage loginBlocksPage = BlocksPage.GetBlockPage("Master"); 2854 2855 Block loginModal = new Block() 2856 { 2857 Id = "LoginModal", 2858 SortId = 10, 2859 Template = LoginModal() 2860 }; 2861 2862 loginBlocksPage.Add(MasterBlockId.MasterTopSnippets, loginModal); 2863 } 2864 2865 @helper LoginModal() { 2866 int pageId = Model.TopPage.ID; 2867 pageId = 3;//CS NT Test for rredirect 2868 string userSignedInError = !Model.LogOnFailed ? "" : "checked"; 2869 string userSignedInErrorText = ""; 2870 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 2871 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; 2872 //CS NT int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 2873 int createAccountPageId = GetPageIdByNavigationTag("CreateECommerceAccount"); 2874 2875 if (Model.LogOnFailed) { 2876 switch (Model.LogOnFailedReason) 2877 { 2878 case LogOnFailedReason.PasswordLengthInvalid: 2879 userSignedInErrorText = Translate("Password length is invalid"); 2880 break; 2881 case LogOnFailedReason.IncorrectLogin: 2882 userSignedInErrorText = Translate("Invalid email or password"); 2883 break; 2884 case LogOnFailedReason.ExceededFailedLogOnLimit: 2885 userSignedInErrorText = Translate("You have exceeded the limit of allowed login attempts. The user account is temporarily locked"); 2886 break; 2887 case LogOnFailedReason.LoginLocked: 2888 userSignedInErrorText = Translate("The user account is temporarily locked"); 2889 break; 2890 case LogOnFailedReason.PasswordExpired: 2891 userSignedInErrorText = Translate("The password has expired and needs to be renewed"); 2892 break; 2893 default: 2894 userSignedInErrorText = Translate("An unknown error occured"); 2895 break; 2896 } 2897 } 2898 2899 <!-- Trigger for the login modal --> 2900 <!--CS NT Hide Pop up sign in --> 2901 if (Pageview.Device.ToString() != "Desktop") 2902 { 2903 <input type="checkbox" id="SignInModalTrigger" class="modal-trigger" @userSignedInError /> 2904 } 2905 2906 <!-- Login modal --> 2907 <div class="modal-container"> 2908 <label for="SignInModalTrigger" id="SignInModalOverlay" class="modal-overlay"></label> 2909 <div class="modal modal--xs" id="SignInModal"> 2910 <div class="modal__header"> 2911 <h2>@Translate("Sign in")</h2> 2912 </div> 2913 <div class="modal__body"> 2914 <form method="post" id="LoginForm" class="u-no-margin"> 2915 <input type="hidden" name="ID" value="@pageId" /> 2916 <input type="hidden" name="DWExtranetUsernameRemember" value="True" /> 2917 <input type="hidden" name="DWExtranetPasswordRemember" value="True" /> 2918 <input type="text" class="u-full-width" id="LoginUsername" name="username" placeholder="@Translate("Email")" /> 2919 <input type="password" class="u-full-width" id="LoginPassword" name="password" placeholder="@Translate("Password")" /> 2920 <div class="field-error dw-mod">@userSignedInErrorText</div> 2921 2922 <div class="form__field-group dw-mod"> 2923 <input type="checkbox" id="LoginRememberMe" name="Autologin" checked="checked" value="True" class="form__control"> 2924 <label for="LoginRememberMe"> 2925 @Translate("Remember me", "Remember me") 2926 </label> 2927 </div> 2928 2929 <button type="submit" class="btn btn--primary btn--full dw-mod" name="LoginAction" value="Login" onclick="Buttons.LockButton(event)">@Translate("Sign in")</button> 2930 @{ 2931 ProviderCollection providers = Provider.GetActiveProviders(); 2932 } 2933 2934 @foreach(Provider LoginProvider in providers) 2935 { 2936 var ProviderName = LoginProvider.Name.ToLower(); 2937 <a href="/Admin/Public/Social/ExternalLogin.aspx?action=login&providerID=@LoginProvider.ID" title="@LoginProvider.Name" class="btn btn--clean btn--condensed u-color-@ProviderName dw-mod"><i class="fab fa-@ProviderName fa-1_5x"></i></a> 2938 } 2939 2940 <a class="btn btn--link-clean dw-mod" href="@forgotPasswordPageLink">@Translate("Forgot your password?", "Forgot your password?")</a> 2941 2942 <!-- CS NT<a class="btn btn--link-clean dw-mod" href="/default.aspx?ID=@createAccountPageId">@Translate("Create account")?</a> --> 2943 <a class="btn btn--link-clean dw-mod" href="/default.aspx?ID=@createAccountPageId">@Translate("Create account")?</a> 2944 </form> 2945 </div> 2946 </div> 2947 </div> 2948 } 2949 2950 @if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet") 2951 { 2952 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 2953 2954 @using System 2955 @using System.Web 2956 @using System.Collections.Generic 2957 @using Dynamicweb.Rapido.Blocks.Extensibility 2958 @using Dynamicweb.Rapido.Blocks 2959 2960 2961 @functions { 2962 BlocksPage mobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master"); 2963 } 2964 2965 @{ 2966 bool mobileOnlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("mobileOnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 2967 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"; 2968 bool mobileHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 2969 bool mobileHideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart") || mobileOnlyPreview; 2970 2971 Block mobileHeader = new Block() 2972 { 2973 Id = "MobileTop", 2974 SortId = 10, 2975 Template = RenderMobileTop(), 2976 SkipRenderBlocksList = true 2977 }; 2978 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeader); 2979 2980 Block mobileHeaderNavigation = new Block() 2981 { 2982 Id = "MobileHeaderNavigation", 2983 SortId = 10, 2984 Template = RenderMobileHeaderNavigation(), 2985 SkipRenderBlocksList = true, 2986 BlocksList = new List<Block> { 2987 new Block { 2988 Id = "MobileHeaderNavigationTrigger", 2989 SortId = 10, 2990 Template = RenderMobileHeaderNavigationTrigger() 2991 } 2992 } 2993 }; 2994 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderNavigation); 2995 2996 Block mobileHeaderLogo = new Block() 2997 { 2998 Id = "MobileHeaderLogo", 2999 SortId = 20, 3000 Template = RenderMobileHeaderLogo(), 3001 SkipRenderBlocksList = true 3002 }; 3003 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderLogo); 3004 3005 Block mobileHeaderActions = new Block() 3006 { 3007 Id = "MobileHeaderActions", 3008 SortId = 30, 3009 Template = RenderMobileTopActions(), 3010 SkipRenderBlocksList = true 3011 }; 3012 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderActions); 3013 3014 if (mobileHideSearch == false) 3015 { 3016 Block mobileHeaderSearch = new Block 3017 { 3018 Id = "MobileHeaderSearch", 3019 SortId = 10, 3020 Template = RenderMobileTopSearch() 3021 }; 3022 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderSearch); 3023 } 3024 3025 Block mobileHeaderMiniCart; 3026 3027 if (!mobileHideCart) 3028 { 3029 mobileHeaderMiniCart = new Block 3030 { 3031 Id = "MobileHeaderMiniCart", 3032 SortId = 20, 3033 Template = RenderMobileTopMiniCart() 3034 }; 3035 3036 Block miniCartCounterScriptTemplate = new Block 3037 { 3038 Id = "MiniCartCounterScriptTemplate", 3039 Template = RenderMobileMiniCartCounterContent() 3040 }; 3041 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate); 3042 } 3043 else 3044 { 3045 mobileHeaderMiniCart = new Block 3046 { 3047 Id = "MobileHeaderMiniCart", 3048 SortId = 20 3049 }; 3050 } 3051 3052 if (!mobileHideSearch) 3053 { 3054 Block mobileHeaderSearchBar = new Block() 3055 { 3056 Id = "MobileHeaderSearchBar", 3057 SortId = 30, 3058 Template = RenderMobileTopSearchBar() 3059 }; 3060 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeaderSearchBar); 3061 } 3062 3063 switch (mobileTopLayout) 3064 { 3065 case "nav-left": 3066 mobileHeaderNavigation.SortId = 10; 3067 mobileHeaderLogo.SortId = 20; 3068 mobileHeaderActions.SortId = 30; 3069 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart); 3070 break; 3071 case "nav-right": 3072 mobileHeaderLogo.SortId = 10; 3073 mobileHeaderActions.SortId = 20; 3074 mobileHeaderNavigation.SortId = 30; 3075 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart); 3076 break; 3077 case "nav-search-left": 3078 mobileHeaderNavigation.SortId = 10; 3079 mobileHeaderLogo.SortId = 20; 3080 mobileHeaderActions.SortId = 30; 3081 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart); 3082 break; 3083 case "search-left": 3084 mobileHeaderActions.SortId = 10; 3085 mobileHeaderLogo.SortId = 20; 3086 mobileHeaderNavigation.SortId = 30; 3087 mobileHeaderMiniCart.SortId = 0; 3088 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart); 3089 break; 3090 } 3091 3092 if (!mobileOnlyPreview) 3093 { 3094 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", new Block { 3095 Id = "CartInitialization", 3096 Template = RenderMobileCartInitialization() 3097 }); 3098 } 3099 } 3100 3101 @helper RenderMobileCartInitialization() 3102 { 3103 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 3104 <script> 3105 window.cartId = "@miniCartFeedPageId"; 3106 </script> 3107 } 3108 3109 @helper RenderMobileTop() { 3110 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileTop").OrderBy(item => item.SortId).ToList(); 3111 3112 <nav class="main-navigation-mobile dw-mod"> 3113 <div class="center-container top-container__center-container dw-mod"> 3114 <div class="grid grid--align-center"> 3115 @RenderBlockList(subBlocks) 3116 </div> 3117 </div> 3118 </nav> 3119 } 3120 3121 @helper RenderMobileHeaderNavigation() { 3122 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderNavigation").OrderBy(item => item.SortId).ToList(); 3123 3124 <div class="grid__col-auto-width"> 3125 <ul class="menu dw-mod"> 3126 @RenderBlockList(subBlocks) 3127 </ul> 3128 </div> 3129 } 3130 3131 @helper RenderMobileHeaderNavigationTrigger() { 3132 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 3133 <label for="MobileNavTrigger" class="mobile-nav-trigger-button menu__link menu__link--icon menu__link--mobile dw-mod"></label> 3134 </li> 3135 } 3136 3137 @helper RenderMobileHeaderLogo() { 3138 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderLogo").OrderBy(item => item.SortId).ToList(); 3139 3140 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"; 3141 string centeredLogo = mobileTopLayout != "nav-right" ? "u-ta-center" : ""; 3142 string firstPageId = Model.Area.FirstActivePage.ID.ToString(); 3143 string businessName = Model.Area.Item.GetItem("Settings").GetString("BusinessName"); 3144 3145 string mobileLogo = "/Files/Images/logo-dynamicweb.png"; 3146 if (Model.Area.Item.GetItem("Layout").GetItem("MobileTop") != null && Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo") != null) 3147 { 3148 mobileLogo = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo").PathUrlEncoded; 3149 } 3150 3151 if (Path.GetExtension(mobileLogo).ToLower() != ".svg") 3152 { 3153 mobileLogo = "/Admin/Public/GetImage.ashx?height=40&amp;crop=5&amp;Compression=75&amp;image=" + mobileLogo; 3154 } 3155 else 3156 { 3157 mobileLogo = HttpUtility.UrlDecode(mobileLogo); 3158 } 3159 3160 <div class="grid__col-auto grid__col--bleed"> 3161 <div class="grid__cell @centeredLogo"> 3162 <a href="/Default.aspx?ID=@firstPageId" class="logo logo--mobile u-inline-block dw-mod"> 3163 <img class="grid__cell-img logo__img logo__img--mobile dw-mod" src="@mobileLogo" alt="@businessName" /> 3164 </a> 3165 </div> 3166 3167 @RenderBlockList(subBlocks) 3168 </div> 3169 } 3170 3171 @helper RenderMobileTopActions() { 3172 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderActions").OrderBy(item => item.SortId).ToList(); 3173 3174 <div class="grid__col-auto-width"> 3175 <ul class="menu dw-mod"> 3176 @RenderBlockList(subBlocks) 3177 </ul> 3178 </div> 3179 } 3180 3181 @helper RenderMobileTopSearch() { 3182 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 3183 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> 3184 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> 3185 </label> 3186 </li> 3187 } 3188 3189 @helper RenderMobileTopMiniCart() { 3190 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 3191 int cartPageId = GetPageIdByNavigationTag("CartPage"); 3192 double cartProductsCount = Model.Cart.TotalProductsCount; 3193 3194 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod" id="miniCartWrapper"> 3195 <div class="mini-cart dw-mod"> 3196 <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"> 3197 <div class="u-inline u-position-relative"> 3198 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue fa-1_5x"></i> 3199 <div class="mini-cart__counter dw-mod"> 3200 <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"> 3201 <div class="js-mini-cart-counter-content" data-count="@cartProductsCount"> 3202 @cartProductsCount 3203 </div> 3204 </div> 3205 </div> 3206 </div> 3207 </a> 3208 </div> 3209 </li> 3210 } 3211 3212 @helper RenderMobileTopSearchBar() 3213 { 3214 string searchFeedId = ""; 3215 string searchSecondFeedId = ""; 3216 int groupsFeedId; 3217 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 3218 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 3219 string resultPageLink; 3220 string searchPlaceholder; 3221 string searchType = "product-search"; 3222 string searchTemplate; 3223 string searchContentTemplate = ""; 3224 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; 3225 bool showGroups = true; 3226 3227 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch") 3228 { 3229 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 3230 resultPageLink = contentSearchPageLink; 3231 searchPlaceholder = Translate("Search page"); 3232 groupsFeedId = 0; 3233 searchType = "content-search"; 3234 searchTemplate = "SearchPagesTemplate"; 3235 showGroups = false; 3236 } 3237 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch") 3238 { 3239 searchFeedId = productsPageId + "&feed=true"; 3240 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 3241 resultPageLink = Converter.ToString(productsPageId); 3242 searchPlaceholder = Translate("Search products or pages"); 3243 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 3244 searchType = "combined-search"; 3245 searchTemplate = "SearchProductsTemplateWrap"; 3246 searchContentTemplate = "SearchPagesTemplateWrap"; 3247 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 3248 } 3249 else 3250 { 3251 resultPageLink = Converter.ToString(productsPageId); 3252 searchFeedId = productsPageId + "&feed=true"; 3253 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 3254 searchPlaceholder = Translate("Search products"); 3255 searchTemplate = "SearchProductsTemplate"; 3256 searchType = "product-search"; 3257 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 3258 } 3259 3260 3261 <input type="checkbox" id="MobileSearchTrigger" class="mobile-search-trigger" /> 3262 3263 <div class="main-navigation-mobile typeahead-mobile dw-mod"> 3264 <div class="center-container top-container__center-container dw-mod"> 3265 <div class="grid"> 3266 <div class="grid__col-auto"> 3267 <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"> 3268 <input type="text" class="js-typeahead-search-field u-w160px u-no-margin" placeholder="@searchPlaceholder" value="@searchValue"> 3269 @if (string.IsNullOrEmpty(searchSecondFeedId)) 3270 { 3271 <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> 3272 } 3273 else 3274 { 3275 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--combined-mobile grid"> 3276 <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> 3277 <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> 3278 </div> 3279 } 3280 <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> 3281 </div> 3282 </div> 3283 <div class="grid__col-auto-width"> 3284 <ul class="menu dw-mod"> 3285 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 3286 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> 3287 <i class="fas fa-times fa-1_5x"></i> 3288 </label> 3289 </li> 3290 </ul> 3291 </div> 3292 </div> 3293 </div> 3294 </div> 3295 } 3296 3297 @helper RenderMobileMiniCartCounterContent() 3298 { 3299 <script id="MiniCartCounterContent" type="text/x-template"> 3300 {{#.}} 3301 <div class="js-mini-cart-counter-content dw-mod" data-count="{{numberofproducts}}"> 3302 {{numberofproducts}} 3303 </div> 3304 {{/.}} 3305 </script> 3306 }</text> 3307 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3308 3309 @using System 3310 @using System.Web 3311 @using System.Collections.Generic 3312 @using Dynamicweb.Rapido.Blocks.Extensibility 3313 @using Dynamicweb.Rapido.Blocks 3314 3315 @functions { 3316 BlocksPage mobileNavigationBlocksPage = BlocksPage.GetBlockPage("Master"); 3317 } 3318 3319 @{ 3320 bool mobileNavigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 3321 bool mobileHideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); 3322 bool mobileHideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); 3323 bool mobileHideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); 3324 bool mobileHideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); 3325 bool mobileHideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); 3326 3327 Block mobileNavigation = new Block() 3328 { 3329 Id = "MobileNavigation", 3330 SortId = 10, 3331 Template = MobileNavigation(), 3332 SkipRenderBlocksList = true 3333 }; 3334 mobileNavigationBlocksPage.Add(MasterBlockId.MasterTopSnippets, mobileNavigation); 3335 3336 if (Model.CurrentUser.ID > 0 && !mobileHideMyProfileLink) 3337 { 3338 Block mobileNavigationSignIn = new Block 3339 { 3340 Id = "MobileNavigationSignIn", 3341 SortId = 10, 3342 Template = RenderMobileNavigationSignIn() 3343 }; 3344 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationSignIn); 3345 } 3346 3347 Block mobileNavigationMenu = new Block 3348 { 3349 Id = "MobileNavigationMenu", 3350 SortId = 20, 3351 Template = RenderMobileNavigationMenu() 3352 }; 3353 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationMenu); 3354 3355 Block mobileNavigationActions = new Block 3356 { 3357 Id = "MobileNavigationActions", 3358 SortId = 30, 3359 Template = RenderMobileNavigationActions(), 3360 SkipRenderBlocksList = true 3361 }; 3362 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationActions); 3363 3364 if (!mobileNavigationItemsHideSignIn) 3365 { 3366 if (Model.CurrentUser.ID <= 0) 3367 { 3368 Block mobileNavigationSignInAction = new Block 3369 { 3370 Id = "MobileNavigationSignInAction", 3371 SortId = 10, 3372 Template = RenderMobileNavigationSignInAction() 3373 }; 3374 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignInAction); 3375 3376 if (!mobileHideCreateAccountLink) 3377 { 3378 Block mobileNavigationCreateAccountAction = new Block 3379 { 3380 Id = "MobileNavigationCreateAccountAction", 3381 SortId = 20, 3382 Template = RenderMobileNavigationCreateAccountAction() 3383 }; 3384 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationCreateAccountAction); 3385 } 3386 } 3387 else 3388 { 3389 //CS NT Show 'My Account' 3390 Block mobileNavigationMyAccount = new Block 3391 { 3392 Id = "MobileNavigationMyAccount", 3393 SortId = 19, 3394 Template = RenderMobileNavigationMyAccount() 3395 }; 3396 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationMyAccount); 3397 3398 3399 if (!mobileHideMyOrdersLink) 3400 { 3401 Block mobileNavigationOrdersAction = new Block 3402 { 3403 Id = "MobileNavigationOrdersAction", 3404 SortId = 20, 3405 Template = RenderMobileNavigationOrdersAction() 3406 }; 3407 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationOrdersAction); 3408 } 3409 if (!mobileHideMyFavoritesLink) 3410 { 3411 Block mobileNavigationFavoritesAction = new Block 3412 { 3413 Id = "MobileNavigationFavoritesAction", 3414 SortId = 30, 3415 Template = RenderMobileNavigationFavoritesAction() 3416 }; 3417 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationFavoritesAction); 3418 } 3419 if (!mobileHideMySavedCardsLink) 3420 { 3421 Block mobileNavigationSavedCardsAction = new Block 3422 { 3423 Id = "MobileNavigationFavoritesAction", 3424 SortId = 30, 3425 Template = RenderMobileNavigationSavedCardsAction() 3426 }; 3427 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSavedCardsAction); 3428 } 3429 3430 Block mobileNavigationSignOutAction = new Block 3431 { 3432 Id = "MobileNavigationSignOutAction", 3433 SortId = 40, 3434 Template = RenderMobileNavigationSignOutAction() 3435 }; 3436 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignOutAction); 3437 } 3438 } 3439 3440 /*CS NT Hide for now 3441 if (Model.Languages.Count > 1) 3442 { 3443 Block mobileNavigationLanguagesAction = new Block 3444 { 3445 Id = "MobileNavigationLanguagesAction", 3446 SortId = 50, 3447 Template = RenderMobileNavigationLanguagesAction() 3448 }; 3449 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationLanguagesAction); 3450 } 3451 */ 3452 } 3453 3454 3455 @helper MobileNavigation() 3456 { 3457 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigation").OrderBy(item => item.SortId).ToList(); 3458 string mobileTopDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design") != null ? Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design").SelectedValue : "nav-left"; 3459 string position = mobileTopDesign == "nav-left" || mobileTopDesign == "nav-search-left" ? "left" : "right"; 3460 3461 <!-- Trigger for mobile navigation --> 3462 <input type="checkbox" id="MobileNavTrigger" class="mobile-nav-trigger mobile-nav-trigger--@position" autocomplete="off" /> 3463 3464 <!-- Mobile navigation --> 3465 <nav class="mobile-navigation mobile-navigation--@position dw-mod"> 3466 <div class="mobile-navigation__wrapper" id="mobileNavigationWrapper"> 3467 @RenderBlockList(subBlocks) 3468 </div> 3469 </nav> 3470 3471 <label class="mobile-nav-trigger-off" for="MobileNavTrigger"></label> 3472 } 3473 3474 @helper RenderMobileNavigationSignIn() 3475 { 3476 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 3477 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 3478 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 3479 string myProfilePageLink = linkStart + myProfilePageId; 3480 string userName = Model.CurrentUser.FirstName ?? ""; 3481 userName += " " + (Model.CurrentUser.LastName ?? ""); 3482 userName += userName == "" && Model.CurrentUser.UserName != null ? Model.CurrentUser.UserName : ""; 3483 3484 <ul class="menu menu-mobile"> 3485 <li class="menu-mobile__item"> 3486 <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> 3487 </li> 3488 </ul> 3489 } 3490 3491 @helper RenderMobileNavigationMenu() 3492 { 3493 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides"; 3494 string menuTemplate = isSlidesDesign ? "BaseMenuForMobileSlides.xslt" : "BaseMenuForMobileExpandable.xslt"; 3495 string levels = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels") : "3"; 3496 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 3497 int startLevel = renderPagesInToolBar ? 1 : 0; 3498 3499 @RenderNavigation(new 3500 { 3501 id = "mobilenavigation", 3502 cssclass = "menu menu-mobile dwnavigation", 3503 startLevel = @startLevel, 3504 ecomStartLevel = @startLevel + 1, 3505 endlevel = @levels, 3506 expandmode = "all", 3507 template = @menuTemplate 3508 }) 3509 3510 if (isSlidesDesign) 3511 { 3512 <script> 3513 function goToLevel(level) { 3514 document.getElementById('mobileNavigationWrapper').style.left = -(level * 100) + "%"; 3515 } 3516 3517 document.addEventListener('DOMContentLoaded', function () { 3518 goToLevel(document.getElementById('mobileNavigationWrapper').querySelectorAll('input[type=radio]:checked').length); 3519 }); 3520 </script> 3521 } 3522 3523 if (renderPagesInToolBar) 3524 { 3525 @RenderNavigation(new 3526 { 3527 id = "topToolsMobileNavigation", 3528 cssclass = "menu menu-mobile dwnavigation", 3529 template = "ToolsMenuForMobile.xslt" 3530 }) 3531 } 3532 } 3533 3534 @helper RenderMobileNavigationActions() 3535 { 3536 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigationActions").OrderBy(item => item.SortId).ToList(); ; 3537 3538 <ul class="menu menu-mobile"> 3539 @RenderBlockList(subBlocks) 3540 </ul> 3541 } 3542 3543 @helper RenderMobileNavigationSignInAction() 3544 { 3545 <li class="menu-mobile__item"> 3546 <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> 3547 </li> 3548 } 3549 3550 @helper RenderMobileNavigationCreateAccountAction() 3551 { 3552 //CS NT int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 3553 int createAccountPageId = GetPageIdByNavigationTag("CreateECommerceAccount"); 3554 3555 <li class="menu-mobile__item"> 3556 <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> 3557 </li> 3558 } 3559 3560 @helper RenderMobileNavigationProfileAction() 3561 { 3562 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 3563 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 3564 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 3565 string myProfilePageLink = linkStart + myProfilePageId; 3566 3567 <li class="menu-mobile__item"> 3568 <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> 3569 </li> 3570 } 3571 3572 @helper RenderMobileNavigationMyAccount() 3573 { 3574 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 3575 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 3576 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 3577 string myProfilePageLink = linkStart + myProfilePageId; 3578 3579 <li class="menu-mobile__item"> 3580 <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 Account")</a> 3581 </li> 3582 } 3583 3584 @helper RenderMobileNavigationOrdersAction() 3585 { 3586 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 3587 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 3588 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); 3589 string myOrdersPageLink = linkStart + myOrdersPageId; 3590 string ordersIcon = "fas fa-list"; 3591 3592 <li class="menu-mobile__item"> 3593 <a href="@myOrdersPageLink" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@ordersIcon menu-mobile__link-icon"></i> @Translate("My Orders")</a> 3594 </li> 3595 } 3596 3597 @helper RenderMobileNavigationFavoritesAction() 3598 { 3599 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 3600 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 3601 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 3602 string myFavoritesPageLink = linkStart + myFavoritesPageId; 3603 string favoritesIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon") != null ? "fas fa-" + Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue : "fa fa-star"; 3604 3605 3606 <li class="menu-mobile__item"> 3607 <a href="@myFavoritesPageLink" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@favoritesIcon menu-mobile__link-icon"></i> @Translate("My Favorites")</a> 3608 </li> 3609 } 3610 3611 @helper RenderMobileNavigationSavedCardsAction() 3612 { 3613 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 3614 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 3615 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards"); 3616 string mySavedCardsPageLink = linkStart + mySavedCardsPageId; 3617 string savedCardsIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SavedCards") != null ? "fas fa-" + Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SavedCards").SelectedValue : "fas fa-credit-card"; 3618 3619 <li class="menu-mobile__item"> 3620 <a href="@mySavedCardsPageLink" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@savedCardsIcon menu-mobile__link-icon"></i> @Translate("My Saved Cards")</a> 3621 </li> 3622 } 3623 3624 @helper RenderMobileNavigationSignOutAction() 3625 { 3626 int pageId = Model.TopPage.ID; 3627 string signOutIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignOutIcon") != null ? "fas fa-" + Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignOutIcon").SelectedValue : "far fa-sign-out-alt"; 3628 3629 <li class="menu-mobile__item"> 3630 <a class="menu-mobile__link menu-mobile__link--highlighted dw-mod" href="/Admin/Public/ExtranetLogoff.aspx?ID=@pageId"><i class="@signOutIcon menu-mobile__link-icon"></i> @Translate("Sign out")</a> 3631 </li> 3632 } 3633 3634 @helper RenderMobileNavigationLanguagesAction() 3635 { 3636 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides"; 3637 3638 string selectedLanguage = ""; 3639 foreach (var lang in Model.Languages) 3640 { 3641 if (lang.IsCurrent) 3642 { 3643 selectedLanguage = lang.Name; 3644 } 3645 } 3646 3647 <li class="menu-mobile__item dw-mod"> 3648 @if (isSlidesDesign) 3649 { 3650 <input id="MobileMenuCheck_Language" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(1);"> 3651 } 3652 else 3653 { 3654 <input id="MobileMenuCheck_Language" type="checkbox" class="expand-trigger"> 3655 } 3656 <div class="menu-mobile__link__wrap"> 3657 <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> 3658 <label for="MobileMenuCheck_Language" class="menu-mobile__trigger"></label> 3659 </div> 3660 <ul class="menu-mobile menu-mobile__submenu expand-menu"> 3661 @if (isSlidesDesign) 3662 { 3663 <li class="menu-mobile__item dw-mod"> 3664 <div class="menu-mobile__link__wrap"> 3665 <input id="MobileMenuCheck_Language_back" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(0);" /> 3666 <label for="MobileMenuCheck_Language_back" class="menu-mobile__trigger menu-mobile__trigger--back"></label> 3667 <label for="MobileMenuCheck_Language_back" class="menu-mobile__link dw-mod ">@Translate("Back")</label> 3668 </div> 3669 </li> 3670 } 3671 @foreach (var lang in Model.Languages) 3672 { 3673 <li class="menu-mobile__item dw-mod"> 3674 <a class="menu-mobile__link menu-mobile__link--highlighted dw-mod menu-mobile__link--level-1" href="/Default.aspx?ID=@lang.Page.ID">@lang.Name</a> 3675 </li> 3676 } 3677 </ul> 3678 </li> 3679 }</text> 3680 } 3681 else 3682 { 3683 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3684 3685 @using System 3686 @using System.Web 3687 @using System.Collections.Generic 3688 @using Dynamicweb.Rapido.Blocks.Extensibility 3689 @using Dynamicweb.Rapido.Blocks 3690 3691 @functions { 3692 BlocksPage headerBlocksPage = BlocksPage.GetBlockPage("Master"); 3693 } 3694 3695 @{ 3696 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 3697 { 3698 Block masterTools = new Block() 3699 { 3700 Id = "MasterDesktopTools", 3701 SortId = 10, 3702 Template = RenderDesktopTools(), 3703 SkipRenderBlocksList = true, 3704 BlocksList = new List<Block> 3705 { 3706 new Block { 3707 Id = "MasterDesktopToolsText", 3708 SortId = 10, 3709 Template = RenderDesktopToolsText(), 3710 Design = new Design 3711 { 3712 Size = "auto", 3713 HidePadding = true, 3714 RenderType = RenderType.Column 3715 } 3716 }, 3717 new Block { 3718 Id = "MasterDesktopToolsNavigation", 3719 SortId = 20, 3720 Template = RenderDesktopToolsNavigation(), 3721 Design = new Design 3722 { 3723 Size = "auto-width", 3724 HidePadding = true, 3725 RenderType = RenderType.Column 3726 } 3727 } 3728 } 3729 }; 3730 headerBlocksPage.Add("MasterHeader", masterTools); 3731 } 3732 3733 Block masterDesktopExtra = new Block() 3734 { 3735 Id = "MasterDesktopExtra", 3736 SortId = 10, 3737 Template = RenderDesktopExtra(), 3738 SkipRenderBlocksList = true 3739 }; 3740 headerBlocksPage.Add("MasterHeader", masterDesktopExtra); 3741 3742 Block masterDesktopNavigation = new Block() 3743 { 3744 Id = "MasterDesktopNavigation", 3745 SortId = 20, 3746 Template = RenderDesktopNavigation(), 3747 SkipRenderBlocksList = true 3748 }; 3749 headerBlocksPage.Add("MasterHeader", masterDesktopNavigation); 3750 } 3751 3752 3753 @*Include the Blocks for the page *@ 3754 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3755 3756 @using System 3757 @using System.Web 3758 @using Dynamicweb.Rapido.Blocks.Extensibility 3759 @using Dynamicweb.Rapido.Blocks 3760 3761 @{ 3762 Block masterDesktopLogo = new Block 3763 { 3764 Id = "MasterDesktopLogo", 3765 SortId = 10, 3766 Template = RenderDesktopLogo(), 3767 Design = new Design 3768 { 3769 Size = "auto-width", 3770 HidePadding = true, 3771 RenderType = RenderType.Column, 3772 CssClass = "grid--align-self-center" 3773 } 3774 }; 3775 3776 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopLogo); 3777 } 3778 3779 3780 @helper RenderDesktopLogo() 3781 { 3782 string firstPageId = Model.Area.FirstActivePage.ID.ToString(); 3783 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 3784 string alignClass = topLayout == "two-lines-centered" || topLayout == "two-lines" ? "grid--align-self-center" : ""; 3785 string logo = Model.Area.Item.GetItem("Layout").GetFile("LogoImage") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoImage").PathUrlEncoded : "/Files/Images/logo-dynamicweb.png"; 3786 if (Path.GetExtension(logo).ToLower() != ".svg") 3787 { 3788 int logoHeight = Model.Area.Item.GetItem("Layout").GetInt32("LogoHeight"); 3789 logoHeight = logoHeight > 0 && Pageview.Device.ToString() != "Mobile" ? logoHeight : 40; 3790 logo = "/Admin/Public/GetImage.ashx?height=" + Converter.ToString(logoHeight) + "&amp;crop=5&amp;Compression=75&amp;image=" + logo; 3791 } 3792 else 3793 { 3794 logo = HttpUtility.UrlDecode(logo); 3795 } 3796 3797 <div class="logo @alignClass dw-mod"> 3798 <a href="/Default.aspx?ID=@firstPageId" class="logo__img dw-mod u-block"> 3799 <img class="grid__cell-img logo__img dw-mod" src="@logo" alt="@Translate("Logo")" /> 3800 </a> 3801 </div> 3802 } 3803 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3804 3805 @using System 3806 @using System.Web 3807 @using Dynamicweb.Rapido.Blocks.Extensibility 3808 @using Dynamicweb.Rapido.Blocks 3809 3810 @functions { 3811 bool isMegaMenu; 3812 } 3813 3814 @{ 3815 isMegaMenu = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu") != null ? Converter.ToBoolean(Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu").SelectedValue) : false; 3816 Block masterDesktopMenu = new Block 3817 { 3818 Id = "MasterDesktopMenu", 3819 SortId = 10, 3820 Template = RenderDesktopMenu(), 3821 Design = new Design 3822 { 3823 Size = "auto", 3824 HidePadding = true, 3825 RenderType = RenderType.Column 3826 } 3827 }; 3828 3829 if (isMegaMenu) 3830 { 3831 masterDesktopMenu.Design.CssClass = "u-reset-position"; 3832 } 3833 3834 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopMenu); 3835 } 3836 3837 @helper RenderDesktopMenu() 3838 { 3839 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 3840 string menuAlignment = topLayout == "minimal-right" ? "grid--align-self-end" : ""; 3841 string megamenuPromotionImage = Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage").PathUrlEncoded : ""; 3842 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 3843 bool showOnlyHeaders = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowOnlyHeaders"); 3844 int startLevel = renderPagesInToolBar ? 1 : 0; 3845 3846 string promotionLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("MegamenuPromotionLink"); 3847 3848 <div class="grid__cell u-flex @(isMegaMenu ? "u-reset-position" : "") @menuAlignment"> 3849 @if (!isMegaMenu) 3850 { 3851 @RenderNavigation(new 3852 { 3853 id = "topnavigation", 3854 cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap", 3855 startLevel = startLevel, 3856 ecomStartLevel = startLevel + 1, 3857 endlevel = 5, 3858 expandmode = "all", 3859 template = "BaseMenuWithDropdown.xslt" 3860 }); 3861 } 3862 else 3863 { 3864 @RenderNavigation(new 3865 { 3866 id = "topnavigation", 3867 cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap", 3868 startLevel = startLevel, 3869 ecomStartLevel = startLevel + 1, 3870 endlevel = 5, 3871 promotionImage = megamenuPromotionImage, 3872 promotionLink = promotionLink, 3873 expandmode = "all", 3874 showOnlyHeaders = showOnlyHeaders.ToString().ToLower(), 3875 template = "BaseMegaMenu.xslt" 3876 }); 3877 } 3878 </div> 3879 } 3880 3881 3882 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3883 3884 @using System 3885 @using System.Web 3886 @using Dynamicweb.Rapido.Blocks.Extensibility 3887 @using Dynamicweb.Rapido.Blocks 3888 3889 @{ 3890 Block masterDesktopActionsMenu = new Block 3891 { 3892 Id = "MasterDesktopActionsMenu", 3893 SortId = 10, 3894 Template = RenderDesktopActionsMenu(), 3895 Design = new Design 3896 { 3897 CssClass = "u-flex" 3898 }, 3899 SkipRenderBlocksList = true 3900 3901 }; 3902 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopActionsMenu); 3903 3904 if (!string.IsNullOrWhiteSpace(Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink"))) 3905 { 3906 Block masterDesktopActionsHeaderButton = new Block 3907 { 3908 Id = "MasterDesktopActionsHeaderButton", 3909 SortId = 60, 3910 Template = RenderHeaderButton() 3911 }; 3912 masterDesktopActionsMenu.Add(masterDesktopActionsHeaderButton); 3913 } 3914 } 3915 3916 @helper RenderDesktopActionsMenu() 3917 { 3918 List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopActionsMenu").OrderBy(item => item.SortId).ToList(); 3919 3920 <ul class="menu u-flex dw-mod"> 3921 @RenderBlockList(subBlocks) 3922 </ul> 3923 } 3924 3925 @helper RenderHeaderButton() 3926 { 3927 string headerButtonText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonText"); 3928 string headerButtonLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink"); 3929 string headerButtonType = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType") != null ? "btn--" + Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType").SelectedName.ToLower() : ""; 3930 3931 <li class="menu__item menu__item--horizontal menu--clean dw-mod"> 3932 <a class="btn @headerButtonType dw-mod u-no-margin u-margin-top u-margin-left" href="@headerButtonLink">@headerButtonText</a> 3933 </li> 3934 } 3935 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3936 3937 @using System 3938 @using System.Web 3939 @using Dynamicweb.Core; 3940 @using System.Text.RegularExpressions 3941 @using Dynamicweb.Rapido.Blocks.Extensibility 3942 @using Dynamicweb.Rapido.Blocks 3943 3944 @{ 3945 //CS NT Hide this for now 20210303 3946 Block masterDesktopActionsMenuLanguageSelector = new Block 3947 { 3948 Id = "MasterDesktopActionsMenuLanguageSelector", 3949 SortId = 40, 3950 Template = RenderLanguageSelector() 3951 }; 3952 3953 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuLanguageSelector); 3954 3955 } 3956 3957 @helper RenderLanguageSelector() 3958 { 3959 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 3960 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 3961 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 3962 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() : ""; 3963 3964 if (Model.Languages.Count > 1) 3965 { 3966 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon is-dropdown is-dropdown--no-icon dw-mod"> 3967 <div class="@menuLinkClass dw-mod"> 3968 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue fa-1_5x"></i> 3969 </div> 3970 <div class="menu menu--dropdown menu--dropdown-right languages-dropdown dw-mod grid__cell"> 3971 @foreach (var lang in Model.Languages) 3972 { 3973 string langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " u-margin-right\"></span>" + lang.Name; 3974 string cultureName = Regex.Replace(Dynamicweb.Services.Areas.GetArea(lang.ID).CultureInfo.NativeName, @" ?\(.*?\)", string.Empty); 3975 cultureName = char.ToUpper(cultureName[0]) + cultureName.Substring(1); 3976 3977 if (languageViewType == "flag-culture") 3978 { 3979 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span> " + cultureName; 3980 } 3981 3982 if (languageViewType == "flag") 3983 { 3984 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span>"; 3985 } 3986 3987 if (languageViewType == "name") 3988 { 3989 langInfo = lang.Name; 3990 } 3991 3992 if (languageViewType == "culture") 3993 { 3994 langInfo = cultureName; 3995 } 3996 3997 <div class="menu__item dw-mod menu__item--fixed-width"> 3998 <a href="/Default.aspx?AreaID=@Dynamicweb.Services.Pages.GetPage(lang.Page.ID).Area.ID" class="menu-dropdown__link dw-mod">@langInfo</a> 3999 </div> 4000 } 4001 </div> 4002 </li> 4003 } 4004 } 4005 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4006 4007 @using System 4008 @using System.Web 4009 @using Dynamicweb.Rapido.Blocks.Extensibility 4010 @using Dynamicweb.Rapido.Blocks 4011 4012 @{ 4013 Block masterDesktopActionsMenuSignIn = new Block 4014 { 4015 Id = "MasterDesktopActionsMenuSignIn", 4016 SortId = 20, 4017 Template = RenderSignIn() 4018 }; 4019 4020 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuSignIn); 4021 } 4022 4023 @helper RenderSignIn() 4024 { 4025 bool navigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 4026 string userInitials = ""; 4027 int pageId = Model.TopPage.ID; 4028 //CS NT int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 4029 int createAccountPageId = GetPageIdByNavigationTag("CreateECommerceAccount"); 4030 int myDashboardPageId = GetPageIdByNavigationTag("CustomerDashboard"); 4031 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 4032 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); 4033 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 4034 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards"); 4035 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 4036 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); 4037 bool hideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); 4038 bool hideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); 4039 bool hideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); 4040 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); 4041 bool hideForgotPasswordLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideForgotPasswordLink"); 4042 4043 string linkStart = "/Default.aspx?ID="; 4044 if (Model.CurrentUser.ID <= 0) 4045 { 4046 linkStart += signInProfilePageId + "&RedirectPageId="; 4047 } 4048 4049 4050 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; 4051 string myProfilePageLink = linkStart + myProfilePageId; 4052 string myOrdersPageLink = linkStart + myOrdersPageId; 4053 string myFavoritesPageLink = linkStart + myFavoritesPageId; 4054 string mySavedCardsPageLink = linkStart + mySavedCardsPageId; 4055 4056 string profileIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue : "fa fa-user"; 4057 string favoritesIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon") != null ? "fas fa-" + Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue : "fa fa-star"; 4058 4059 if (Model.CurrentUser.ID != 0) 4060 { 4061 if (!String.IsNullOrEmpty(Model.CurrentUser.Name)) 4062 { 4063 string[] names = Model.CurrentUser.Name.Trim().Split(' '); 4064 userInitials += Model.CurrentUser.Name.Substring(0, 1); 4065 4066 if (names.Length > 1) 4067 { 4068 userInitials += names[names.Length - 1].Substring(0, 1); 4069 } 4070 } 4071 else 4072 { 4073 userInitials += Model.CurrentUser.FirstName != null && Model.CurrentUser.FirstName != "" ? Model.CurrentUser.FirstName.Substring(0, 1) : ""; 4074 userInitials += Model.CurrentUser.LastName != null && Model.CurrentUser.LastName != "" ? Model.CurrentUser.LastName.Substring(0, 1) : ""; 4075 userInitials += userInitials.Length == 1 && Model.CurrentUser.FirstName != null && Model.CurrentUser.FirstName.Length > 1 ? Model.CurrentUser.FirstName.Substring(1, 2) : ""; 4076 userInitials += userInitials == "" && Model.CurrentUser.Email != null && Model.CurrentUser.Email.Length > 1 ? Model.CurrentUser.Email.Substring(0, 2) : ""; 4077 userInitials += userInitials == "" ? Model.CurrentUser.UserName.Substring(0, 2) : ""; 4078 } 4079 } 4080 4081 if (!navigationItemsHideSignIn) 4082 { 4083 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4084 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu__item--clean"; 4085 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4086 4087 <li class="menu__item menu__item--horizontal menu__item menu__item--icon @liClasses is-dropdown is-dropdown--no-icon dw-mod"> 4088 <div class="@menuLinkClass dw-mod"> 4089 @if (Model.CurrentUser.ID <= 0) 4090 { 4091 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue fa-1_5x"></i> 4092 } 4093 else 4094 { 4095 <!--<a href="/default.aspx?ID=@myDashboardPageId" class="u-color-inherit"><div class="circle-icon-btn">@userInitials.ToUpper()</div></a>--> 4096 <a href="/@myProfilePageLink" class="u-color-inherit"><div class="circle-icon-btn">@userInitials.ToUpper()</div></a> 4097 } 4098 </div> 4099 <div class="menu menu--dropdown menu--dropdown-right menu--sign-in grid__cell dw-mod"> 4100 <ul class="list list--clean dw-mod"> 4101 @if (Model.CurrentUser.ID <= 0) 4102 { 4103 <li> 4104 <a class="btn btn--primary btn--full u-no-margin sign-in-modal-trigger-button dw-mod" href="/createecommerceaccount">@Translate("Sign in")</a> 4105 <!--Commented out by CS NT and added the line above <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>--> 4106 </li> 4107 4108 if (!hideCreateAccountLink) 4109 { 4110 @RenderListItem("/default.aspx?ID=" + createAccountPageId, Translate("Create account")); 4111 } 4112 if (!hideForgotPasswordLink) 4113 { 4114 @RenderListItem(forgotPasswordPageLink, Translate("Forgot your password?")) 4115 } 4116 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) 4117 { 4118 @RenderSeparator() 4119 } 4120 } 4121 @if (!hideMyProfileLink) 4122 { 4123 @RenderListItem(myProfilePageLink, Translate("My Profile"), profileIcon) 4124 } 4125 @if (!hideMyOrdersLink) 4126 { 4127 @RenderListItem(myOrdersPageLink, Translate("My Orders"), "fas fa-list") 4128 } 4129 @if (!hideMyFavoritesLink) 4130 { 4131 @RenderListItem(myFavoritesPageLink, Translate("My Favorites"), favoritesIcon) 4132 } 4133 @if (!hideMySavedCardsLink) 4134 { 4135 @RenderListItem(mySavedCardsPageLink, Translate("My Saved cards"), "fas fa-credit-card") 4136 } 4137 @if (Model.CurrentUser.ID > 0) 4138 { 4139 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) 4140 { 4141 @RenderSeparator() 4142 } 4143 4144 @RenderListItem("/Admin/Public/ExtranetLogoff.aspx?ID=" + pageId, Translate("Sign out")) 4145 } 4146 </ul> 4147 </div> 4148 </li> 4149 } 4150 } 4151 4152 @helper RenderListItem(string link, string text, string icon = null) { 4153 <li> 4154 <a href="@link" class="list__link dw-mod"> 4155 @if (!string.IsNullOrEmpty(icon)) 4156 { 4157 <i class="@icon u-margin-right"></i> 4158 } 4159 @text 4160 </a> 4161 </li> 4162 } 4163 4164 @helper RenderSeparator() 4165 { 4166 <li class="list__seperator dw-mod"></li> 4167 } 4168 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4169 4170 @using System 4171 @using System.Web 4172 @using Dynamicweb.Rapido.Blocks.Extensibility 4173 @using Dynamicweb.Rapido.Blocks 4174 4175 @{ 4176 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideFavorites"); 4177 4178 Block masterDesktopActionsMenuFavorites = new Block 4179 { 4180 Id = "MasterDesktopActionsMenuFavorites", 4181 SortId = 30, 4182 Template = RenderFavorites() 4183 }; 4184 4185 if (!hideMyFavoritesLink && Model.CurrentUser.ID > 0) 4186 { 4187 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuFavorites); 4188 } 4189 } 4190 4191 @helper RenderFavorites() 4192 { 4193 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 4194 string myFavoritesPageLink = "/Default.aspx?ID=" + myFavoritesPageId; 4195 4196 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4197 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 4198 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4199 4200 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod"> 4201 <a href="@myFavoritesPageLink" class="@menuLinkClass dw-mod"> 4202 <i class="fas fa-@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue fa-1_5x"></i> 4203 </a> 4204 </li> 4205 } 4206 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4207 4208 @using System 4209 @using System.Web 4210 @using Dynamicweb.Rapido.Blocks.Extensibility 4211 @using Dynamicweb.Rapido.Blocks 4212 4213 @{ 4214 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 4215 bool hideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 4216 string miniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown"; 4217 4218 if (!onlyPreview && !hideCart) 4219 { 4220 Block masterDesktopActionsMenuMiniCart = new Block 4221 { 4222 Id = "MasterDesktopActionsMenuMiniCart", 4223 SortId = 50, 4224 Template = RenderMiniCart(miniCartLayout == "dropdown"), 4225 SkipRenderBlocksList = true, 4226 BlocksList = new List<Block>() 4227 }; 4228 4229 Block miniCartCounterScriptTemplate = new Block 4230 { 4231 Id = "MiniCartCounterScriptTemplate", 4232 Template = RenderMiniCartCounterContent() 4233 }; 4234 4235 //dropdown layout is default 4236 RazorEngine.Templating.TemplateWriter layoutTemplate = RenderMiniCartDropdownLayout(); 4237 RazorEngine.Templating.TemplateWriter miniCartTriggerTemplate = RenderMiniCartTriggerLink(); 4238 4239 switch (miniCartLayout) 4240 { 4241 case "panel": 4242 layoutTemplate = RenderMiniCartPanelLayout(); 4243 miniCartTriggerTemplate = RenderMiniCartTriggerLabel(); 4244 break; 4245 case "modal": 4246 layoutTemplate = RenderMiniCartModalLayout(); 4247 miniCartTriggerTemplate = RenderMiniCartTriggerLabel(); 4248 break; 4249 } 4250 4251 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block 4252 { 4253 Id = "MiniCartTrigger", 4254 Template = miniCartTriggerTemplate 4255 }); 4256 4257 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 4258 { 4259 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block 4260 { 4261 Id = "MiniCartLayout", 4262 Template = layoutTemplate 4263 }); 4264 } 4265 4266 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuMiniCart); 4267 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate); 4268 } 4269 } 4270 4271 @helper RenderMiniCart(bool hasMouseEnterEvent) 4272 { 4273 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterDesktopActionsMenuMiniCart").OrderBy(item => item.SortId).ToList(); 4274 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4275 string liClasses = topLayout != "normal" ? "menu__item--top-level" : "menu--clean"; 4276 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4277 string mouseEvent = ""; 4278 string id = "MiniCart"; 4279 if (hasMouseEnterEvent) 4280 { 4281 mouseEvent = "onmouseenter=\"Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=" + miniCartFeedPageId + "&feedType=MiniCart')\""; 4282 id = "miniCartTrigger"; 4283 } 4284 <li class="menu__item menu__item--horizontal menu__item--icon @liClasses dw-mod" id="@id" @mouseEvent> 4285 @RenderBlockList(subBlocks) 4286 </li> 4287 } 4288 4289 @helper RenderMiniCartTriggerLabel() 4290 { 4291 int cartPageId = GetPageIdByNavigationTag("CartPage"); 4292 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart"; 4293 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4294 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4295 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4296 4297 <div class="@menuLinkClass dw-mod js-mini-cart-button" onclick="Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart')"> 4298 <div class="u-inline u-position-relative"> 4299 <i class="@cartIcon fa-1_5x"></i> 4300 @RenderMiniCartCounter() 4301 </div> 4302 </div> 4303 } 4304 4305 @helper RenderMiniCartTriggerLink() 4306 { 4307 int cartPageId = GetPageIdByNavigationTag("CartPage"); 4308 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart"; 4309 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4310 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4311 4312 <a href="/Default.aspx?ID=@cartPageId&Purge=True" class="@menuLinkClass menu__item--icon dw-mod js-mini-cart-button"> 4313 <div class="u-inline u-position-relative"> 4314 <i class="@cartIcon fa-1_5x"></i> 4315 @RenderMiniCartCounter() 4316 </div> 4317 </a> 4318 } 4319 4320 @helper RenderMiniCartCounter() 4321 { 4322 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4323 string cartProductsCount = Model.Cart.TotalProductsCount.ToString(); 4324 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right"; 4325 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 4326 string cartProductsTotalPrice = showPrice && Model.Cart.TotalPrice != null ? Model.Cart.TotalPrice.Price.Formatted : ""; 4327 cartProductsTotalPrice = counterPosition == "right" ? cartProductsTotalPrice : ""; 4328 4329 if (showPrice && counterPosition == "right") 4330 { 4331 cartProductsCount = Translate("Cart") + "(" + cartProductsCount + ")"; 4332 } 4333 4334 <div class="mini-cart__counter dw-mod"> 4335 <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"> 4336 <div class="js-mini-cart-counter-content" data-count="@Model.Cart.TotalProductsCount.ToString()"> 4337 @cartProductsCount 4338 @cartProductsTotalPrice 4339 </div> 4340 </div> 4341 </div> 4342 } 4343 4344 @helper RenderMiniCartCounterContent() 4345 { 4346 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 4347 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right"; 4348 bool showPriceInMiniCartCounter = Pageview.Device.ToString() != "Mobile" && counterPosition == "right" && showPrice; 4349 4350 <script id="MiniCartCounterContent" type="text/x-template"> 4351 {{#.}} 4352 <div class="js-mini-cart-counter-content dw-mod" data-count="{{numberofproducts}}"> 4353 @if (showPriceInMiniCartCounter) 4354 { 4355 @Translate("Cart")<text>({{numberofproducts}}) {{totalprice}}</text> 4356 } 4357 else 4358 { 4359 <text>{{numberofproducts}}</text> 4360 } 4361 </div> 4362 {{/.}} 4363 </script> 4364 } 4365 4366 @helper RenderMiniCartDropdownLayout() 4367 { 4368 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4369 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage"); 4370 4371 <div class="mini-cart mini-cart-dropdown js-mini-cart grid__cell dw-mod" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="dropdown" data-cart-page-link="@cartPageLink"> 4372 <div class="mini-cart-dropdown__inner dw-mod"> 4373 <h3 class="u-ta-center dw-mod">@Translate("Shopping cart")</h3> 4374 <div class="mini-cart-dropdown__body u-flex dw-mod"> 4375 <div class="js-handlebars-root u-flex grid--direction-column u-full-width dw-mod" id="miniCartContent" data-template="MiniCartContent" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart" data-init-onload="false"></div> 4376 </div> 4377 </div> 4378 </div> 4379 } 4380 4381 @helper RenderMiniCartPanelLayout() 4382 { 4383 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4384 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage"); 4385 4386 <div class="mini-cart grid__cell dw-mod"> 4387 <input type="checkbox" id="miniCartTrigger" class="panel-trigger" /> 4388 <div class="panel panel--right panel--with-close-btn dw-mod js-mini-cart" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="block" data-cart-page-link="@cartPageLink"> 4389 <label for="miniCartTrigger" class="panel__close-btn" title="@Translate("Close panel")"><i class="fas fa-times"></i></label> 4390 <div class="panel__content u-full-width dw-mod"> 4391 <h3 class="panel__header dw-mod u-margin-bottom u-ta-center">@Translate("Shopping cart")</h3> 4392 <div class="panel__content-body panel__content-body--cart dw-mod"> 4393 <div class="js-handlebars-root u-flex grid--direction-column u-full-height dw-mod" id="miniCartContent" data-template="MiniCartContent" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart" data-init-onload="false"></div> 4394 </div> 4395 </div> 4396 </div> 4397 </div> 4398 } 4399 4400 @helper RenderMiniCartModalLayout() 4401 { 4402 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4403 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage"); 4404 4405 <div class="mini-cart grid__cell dw-mod"> 4406 <input type="checkbox" id="miniCartTrigger" class="modal-trigger" autocomplete="off" /> 4407 <div class="modal-container dw-mod js-mini-cart" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="block" data-cart-page-link="@cartPageLink"> 4408 <label for="miniCartTrigger" class="modal-overlay"></label> 4409 <div class="modal modal--top-right dw-mod"> 4410 <div class="modal__body u-flex grid--direction-column dw-mod"> 4411 <h3 class="dw-mod u-ta-center">@Translate("Shopping cart")</h3> 4412 <div class="js-handlebars-root u-flex grid--direction-column dw-mod" id="miniCartContent" data-template="MiniCartContent" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart" data-init-onload="false"></div> 4413 </div> 4414 <label class="modal__close-btn modal__close-btn--clean dw-mod" for="miniCartTrigger" title="@Translate("Close modal")"></label> 4415 </div> 4416 </div> 4417 </div> 4418 } 4419 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4420 4421 @using System 4422 @using System.Web 4423 @using Dynamicweb.Rapido.Blocks.Extensibility 4424 @using Dynamicweb.Rapido.Blocks 4425 4426 @{ 4427 bool showDownloadCartLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart"); 4428 4429 Block masterDesktopActionsMenuDownloadCart = new Block 4430 { 4431 Id = "MasterDesktopActionsMenuDownloadCart", 4432 SortId = 35, 4433 Template = RenderDownloadCart() 4434 }; 4435 4436 if (showDownloadCartLink && Model.CurrentUser.ID > 0) 4437 { 4438 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuDownloadCart); 4439 } 4440 } 4441 4442 @helper RenderDownloadCart() 4443 { 4444 int downloadCartPageId = GetPageIdByNavigationTag("DownloadCart"); 4445 string downloadCartPageLink = "/Default.aspx?ID=" + downloadCartPageId; 4446 4447 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4448 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 4449 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4450 4451 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod"> 4452 <a href="@downloadCartPageLink" class="@menuLinkClass dw-mod"> 4453 <i class="fas fa-cart-arrow-down fa-1_5x"></i> 4454 </a> 4455 </li> 4456 } 4457 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4458 4459 @using System 4460 @using System.Web 4461 @using Dynamicweb.Rapido.Blocks.Extensibility 4462 @using Dynamicweb.Rapido.Blocks 4463 4464 @functions { 4465 public class SearchConfiguration 4466 { 4467 public string searchFeedId { get; set; } 4468 public string searchSecondFeedId { get; set; } 4469 public int groupsFeedId { get; set; } 4470 public string resultPageLink { get; set; } 4471 public string searchPlaceholder { get; set; } 4472 public string searchType { get; set; } 4473 public string searchTemplate { get; set; } 4474 public string searchContentTemplate { get; set; } 4475 public string searchValue { get; set; } 4476 public bool showGroups { get; set; } 4477 4478 public SearchConfiguration() 4479 { 4480 searchFeedId = ""; 4481 searchSecondFeedId = ""; 4482 searchType = "product-search"; 4483 searchContentTemplate = ""; 4484 showGroups = true; 4485 } 4486 } 4487 } 4488 @{ 4489 Block masterSearchBar = new Block 4490 { 4491 Id = "MasterSearchBar", 4492 SortId = 40, 4493 Template = RenderSearch("bar"), 4494 Design = new Design 4495 { 4496 Size = "auto", 4497 HidePadding = true, 4498 RenderType = RenderType.Column 4499 } 4500 }; 4501 4502 Block masterSearchAction = new Block 4503 { 4504 Id = "MasterDesktopActionsMenuSearch", 4505 SortId = 10, 4506 Template = RenderSearch() 4507 }; 4508 4509 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterSearchBar); 4510 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterSearchAction); 4511 } 4512 4513 @helper RenderSearch(string type = "mini-search") 4514 { 4515 string productsPageId = Converter.ToString(GetPageIdByNavigationTag("ProductsPage")); 4516 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 4517 string searchType = Model.Area.Item.GetItem("Layout").GetList("TopSearch") != null ? Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue : "productSearch"; 4518 4519 SearchConfiguration searchConfiguration = null; 4520 4521 switch (searchType) { 4522 case "contentSearch": 4523 searchConfiguration = new SearchConfiguration() { 4524 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true", 4525 resultPageLink = contentSearchPageLink, 4526 searchPlaceholder = Translate("Search page"), 4527 groupsFeedId = 0, 4528 searchType = "content-search", 4529 searchTemplate = "SearchPagesTemplate", 4530 showGroups = false 4531 }; 4532 break; 4533 case "combinedSearch": 4534 searchConfiguration = new SearchConfiguration() { 4535 searchFeedId = productsPageId + "&feed=true", 4536 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true", 4537 resultPageLink = Converter.ToString(productsPageId), 4538 searchPlaceholder = Translate("Search products or pages"), 4539 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"), 4540 searchType = "combined-search", 4541 searchTemplate = "SearchProductsTemplateWrap", 4542 searchContentTemplate = "SearchPagesTemplateWrap", 4543 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector") 4544 }; 4545 break; 4546 default: //productSearch 4547 searchConfiguration = new SearchConfiguration() { 4548 resultPageLink = Converter.ToString(productsPageId), 4549 searchFeedId = productsPageId + "&feed=true", 4550 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"), 4551 searchPlaceholder = Translate("Search products"), 4552 searchTemplate = "SearchProductsTemplate", 4553 searchType = "product-search", 4554 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector") 4555 }; 4556 break; 4557 } 4558 searchConfiguration.searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; 4559 4560 if (type == "mini-search") { 4561 @RenderMiniSearch(searchConfiguration) 4562 } else { 4563 @RenderSearchBar(searchConfiguration) 4564 } 4565 } 4566 4567 @helper RenderSearchBar(SearchConfiguration options) 4568 { 4569 <div class="typeahead typeahead--centered u-color-inherit js-typeahead dw-mod" id="ProductSearchBar" 4570 data-page-size="7" 4571 data-search-feed-id="@options.searchFeedId" 4572 data-search-second-feed-id="@options.searchSecondFeedId" 4573 data-result-page-id="@options.resultPageLink" 4574 data-groups-page-id="@options.groupsFeedId" 4575 data-search-type="@options.searchType"> 4576 @if (options.showGroups) 4577 { 4578 <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> 4579 <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=@options.groupsFeedId&feedType=productGroups" data-init-onload="false" data-preloader="minimal"></ul> 4580 } 4581 <div class="typeahead-search-field"> 4582 <input type="text" class="u-no-margin u-full-width u-full-height js-typeahead-search-field" placeholder="@options.searchPlaceholder" value="@options.searchValue"> 4583 @if (string.IsNullOrEmpty(options.searchSecondFeedId)) 4584 { 4585 <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="@options.searchTemplate" data-json-feed="/Default.aspx?ID=@options.searchFeedId&feedType=productsOnly" data-init-onload="false"></ul> 4586 } 4587 else 4588 { 4589 <div class="dropdown dropdown--absolute-position dropdown--combined grid"> 4590 <div class="js-typeahead-search-content grid__col-sm-7 grid__col--bleed-y" id="ProductSearchBarContent" data-template="@options.searchTemplate" data-init-onload="false"></div> 4591 <div class="js-typeahead-additional-search-content grid__col-sm-5 grid__col--bleed-y" id="ContentSearchBarContent" data-template="@options.searchContentTemplate" data-init-onload="false"></div> 4592 </div> 4593 } 4594 </div> 4595 <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> 4596 </div> 4597 } 4598 4599 @helper RenderMiniSearch(SearchConfiguration options) 4600 { 4601 <li class="menu__item menu__item--horizontal menu__item--top-level menu__item--icon u-hidden-xxs is-dropdown is-dropdown--no-icon dw-mod" onmouseover="document.getElementById('headerSearch').focus()"> 4602 <div class="menu__link menu__link--icon dw-mod"> 4603 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> 4604 </div> 4605 <div class="menu menu--dropdown menu--dropdown-right u-no-padding u-w380px grid__cell dw-mod"> 4606 <div class="typeahead js-typeahead" id="ProductSearchBar" 4607 data-page-size="7" 4608 data-search-feed-id="@options.searchFeedId" 4609 data-search-second-feed-id="@options.searchSecondFeedId" 4610 data-result-page-id="@options.resultPageLink" 4611 data-search-type="@options.searchType"> 4612 <div class="typeahead-search-field"> 4613 <input type="text" class="u-no-margin u-full-width js-typeahead-search-field" id="headerSearch" placeholder="@options.searchPlaceholder" value="@options.searchValue"> 4614 @if (string.IsNullOrEmpty(options.searchSecondFeedId)) 4615 { 4616 <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="@options.searchTemplate" data-json-feed="/Default.aspx?ID=@options.searchFeedId&feedType=productsOnly" data-init-onload="false"></ul> 4617 } 4618 else 4619 { 4620 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--right-aligned"> 4621 <div class="js-handlebars-root js-typeahead-search-content grid__col-sm-7 grid__col--bleed-y" id="ProductSearchBarContent" data-template="@options.searchTemplate" data-json-feed="/Default.aspx?ID=@options.searchFeedId&feedType=productsOnly" data-init-onload="false"></div> 4622 <div class="js-handlebars-root js-typeahead-additional-search-content grid__col-sm-5 grid__col--bleed-y" id="ContentSearchBarContent" data-template="@options.searchContentTemplate" data-json-feed="/Default.aspx?ID=@options.searchSecondFeedId" data-init-onload="false"></div> 4623 </div> 4624 } 4625 </div> 4626 </div> 4627 </div> 4628 </li> 4629 } 4630 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4631 4632 @using System 4633 @using System.Web 4634 @using Dynamicweb.Rapido.Blocks.Extensibility 4635 @using Dynamicweb.Rapido.Blocks 4636 4637 @{ 4638 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4639 bool hideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 4640 4641 BlocksPage headerConfigurationPage = BlocksPage.GetBlockPage("Master"); 4642 4643 Block configDesktopLogo = headerConfigurationPage.GetBlockById("MasterDesktopLogo"); 4644 headerConfigurationPage.RemoveBlock(configDesktopLogo); 4645 4646 Block configDesktopMenu = headerConfigurationPage.GetBlockById("MasterDesktopMenu"); 4647 headerConfigurationPage.RemoveBlock(configDesktopMenu); 4648 4649 Block configSearchBar = headerConfigurationPage.GetBlockById("MasterSearchBar"); 4650 headerConfigurationPage.RemoveBlock(configSearchBar); 4651 4652 Block configSearchAction = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenuSearch"); 4653 headerConfigurationPage.RemoveBlock(configSearchAction); 4654 4655 Block configDesktopActionsMenu = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenu"); 4656 headerConfigurationPage.RemoveBlock(configDesktopActionsMenu); 4657 4658 Block configDesktopExtra = headerConfigurationPage.GetBlockById("MasterDesktopExtra"); 4659 4660 switch (topLayout) 4661 { 4662 case "condensed": //2 4663 configDesktopLogo.Design.Size = "auto-width"; 4664 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); 4665 4666 configDesktopMenu.SortId = 20; 4667 configDesktopMenu.Design.Size = "auto"; 4668 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 4669 4670 configDesktopActionsMenu.SortId = 30; 4671 configDesktopActionsMenu.Design.Size = "auto-width"; 4672 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 4673 4674 if (!hideSearch) 4675 { 4676 configSearchBar.SortId = 40; 4677 configSearchBar.Design.Size = "12"; 4678 configDesktopExtra.SortId = 50; 4679 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); 4680 } 4681 break; 4682 case "splitted": //3 4683 configDesktopLogo.Design.Size = "auto"; 4684 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 4685 4686 if (!hideSearch) 4687 { 4688 configSearchBar.SortId = 20; 4689 configSearchBar.Design.Size = "auto"; 4690 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); 4691 } 4692 4693 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 4694 4695 configDesktopActionsMenu.SortId = 20; 4696 configDesktopActionsMenu.Design.Size = "auto-width"; 4697 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 4698 break; 4699 case "minimal": //4 4700 configDesktopLogo.Design.Size = "auto-width"; 4701 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); 4702 4703 configDesktopMenu.Design.Size = "auto"; 4704 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 4705 4706 configDesktopActionsMenu.SortId = 20; 4707 configDesktopActionsMenu.Design.Size = "auto-width"; 4708 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 4709 4710 if (!hideSearch) 4711 { 4712 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 4713 } 4714 break; 4715 case "minimal-right": //5 4716 configDesktopLogo.Design.Size = "auto-width"; 4717 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); 4718 4719 configDesktopMenu.Design.Size = "auto"; 4720 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 4721 4722 configDesktopActionsMenu.SortId = 20; 4723 configDesktopActionsMenu.Design.Size = "auto-width"; 4724 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 4725 4726 if (!hideSearch) 4727 { 4728 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 4729 } 4730 break; 4731 case "two-lines": //6 4732 configDesktopLogo.Design.Size = "auto"; 4733 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 4734 4735 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 4736 4737 configDesktopActionsMenu.SortId = 20; 4738 configDesktopActionsMenu.Design.Size = "auto-width"; 4739 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 4740 4741 if (!hideSearch) 4742 { 4743 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 4744 } 4745 break; 4746 case "two-lines-centered": //7 4747 configDesktopLogo.Design.Size = "auto"; 4748 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 4749 4750 configDesktopMenu.Design.Size = "auto-width"; 4751 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 4752 4753 configDesktopActionsMenu.SortId = 20; 4754 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 4755 4756 if (!hideSearch) 4757 { 4758 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 4759 } 4760 break; 4761 case "normal": //1 4762 default: 4763 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 4764 4765 if (!hideSearch) 4766 { 4767 configSearchBar.SortId = 20; 4768 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); 4769 } 4770 4771 configDesktopActionsMenu.SortId = 30; 4772 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopActionsMenu); 4773 4774 configDesktopActionsMenu.Design.Size = "auto-width"; 4775 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 4776 break; 4777 } 4778 } 4779 @if (File.Exists(HttpContext.Current.Server.MapPath("/Files/Templates/Designs/Rapido/MasterBlocks/HeaderBlocks/Custom__Blocks.cshtml"))) 4780 { 4781 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4782 4783 @using System 4784 @using System.Web 4785 @using Dynamicweb.Rapido.Blocks.Extensibility 4786 @using Dynamicweb.Rapido.Blocks 4787 4788 @{ 4789 4790 }</text> 4791 } 4792 4793 4794 @helper RenderDesktopTools() 4795 { 4796 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopTools").OrderBy(item => item.SortId).ToList(); 4797 4798 4799 4800 <div class="tools-navigation dw-mod"> 4801 <div class="center-container grid top-container__center-container dw-mod"> 4802 @RenderBlockList(subBlocks) 4803 </div> 4804 </div> 4805 } 4806 4807 @helper RenderDesktopToolsText() 4808 { 4809 string toolsText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("ToolsText"); 4810 if (!string.IsNullOrEmpty(toolsText)) 4811 { 4812 <div class="u-margin-top u-margin-bottom">@toolsText</div> 4813 } 4814 } 4815 4816 @helper RenderDesktopToolsNavigation() 4817 { 4818 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 4819 4820 if (renderPagesInToolBar) 4821 { 4822 @RenderNavigation(new 4823 { 4824 id = "topToolsNavigation", 4825 cssclass = "menu menu-tools dw-mod dwnavigation", 4826 template = "TopMenu.xslt" 4827 }) 4828 } 4829 } 4830 4831 @helper RenderDesktopNavigation() 4832 { 4833 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopNavigation").OrderBy(item => item.SortId).ToList(); 4834 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4835 string alignClass = topLayout == "two-lines-centered" ? "grid--justify-center" : ""; 4836 <nav class="main-navigation dw-mod"> 4837 <div class="center-container top-container__center-container grid @alignClass dw-mod"> 4838 @RenderBlockList(subBlocks) 4839 4840 </div> 4841 </nav> 4842 } 4843 4844 @helper RenderDesktopExtra() 4845 { 4846 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopExtra").OrderBy(item => item.SortId).ToList(); 4847 4848 if (subBlocks.Count > 0) 4849 { 4850 <div class="header header-top dw-mod"> 4851 <div class="center-container top-container__center-container grid--justify-space-between grid grid--align-center dw-mod"> 4852 @RenderBlockList(subBlocks) 4853 </div> 4854 </div> 4855 } 4856 }</text> 4857 } 4858 4859 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4860 4861 @using System 4862 @using System.Web 4863 @using Dynamicweb.Rapido.Blocks.Extensibility 4864 @using Dynamicweb.Rapido.Blocks 4865 4866 @{ 4867 Block impersonationBar = new Block 4868 { 4869 Id = "ImpersonationBar", 4870 SortId = 50, 4871 Template = RenderImpersonationBar(), 4872 Design = new Design 4873 { 4874 Size = "auto-width", 4875 HidePadding = true, 4876 RenderType = RenderType.Column 4877 } 4878 }; 4879 4880 if (Model.CurrentUser.ID > 0 && Model.SecondaryUsers.Count > 0) 4881 { 4882 BlocksPage.GetBlockPage("Master").Add("MasterHeader", impersonationBar); 4883 } 4884 } 4885 4886 @helper RenderImpersonationBar() 4887 { 4888 int impersonationPageId = GetPageIdByNavigationTag("Impersonation"); 4889 4890 <div class="u-color-warning--bg"> 4891 <div class="center-container top-container__center-container dw-mod"> 4892 @*Impersonation*@ 4893 <div class="grid"> 4894 <div class="grid--align-self-center grid__col-x"> 4895 @if (Model.CurrentSecondaryUser != null && Model.CurrentSecondaryUser.ID > 0) 4896 { 4897 string stopImpersonateTranslation = Translate("Stop impersonation"); 4898 string username = ""; 4899 if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.FirstName) && !string.IsNullOrEmpty(Model.CurrentSecondaryUser.LastName)) 4900 { 4901 username = Model.CurrentSecondaryUser.FirstName + " " + Model.CurrentSecondaryUser.LastName; 4902 } 4903 else if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.Name)) 4904 { 4905 username = Model.CurrentSecondaryUser.Name; 4906 } 4907 else if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.Email)) 4908 { 4909 username = Model.CurrentSecondaryUser.Email; 4910 } 4911 else 4912 { 4913 username = Model.CurrentSecondaryUser.UserName; 4914 } 4915 <div class="grid-cell"> 4916 <div class="u-pull--left u-bold u-margin-top"> 4917 <i class="fas fa-user-secret"></i> 4918 @Pageview.User.UserName<text>&nbsp;</text>@Translate("is impersonating")<text>&nbsp;</text>@username 4919 </div> 4920 <form method="post" class="u-pull--right u-no-margin"> 4921 <input type="submit" class="btn btn--secondary dw-mod u-no-margin" name="DwExtranetRemoveSecondaryUser" value="@stopImpersonateTranslation"> 4922 </form> 4923 </div> 4924 } 4925 else 4926 { 4927 string viewListTranslation = Translate("View the list of users you can impersonate"); 4928 <div class="grid-cell u-bold"> 4929 <i class="fas fa-user-secret"></i> 4930 <a href="/Default.aspx?ID=@impersonationPageId" title="@viewListTranslation" class="u-color-font-black">@viewListTranslation</a> 4931 </div> 4932 } 4933 </div> 4934 </div> 4935 </div> 4936 </div> 4937 } 4938 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4939 4940 @using System 4941 @using System.Web 4942 @using System.Collections.Generic 4943 @using Dynamicweb.Rapido.Blocks.Extensibility 4944 @using Dynamicweb.Rapido.Blocks 4945 @using NextechDWAddIn.Handlers 4946 @using NextechDWAddIn.Common 4947 4948 @{ 4949 4950 4951 BlocksPage miniCartBlocksPage = BlocksPage.GetBlockPage("Master"); 4952 string orderlinesView = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView").SelectedValue : "table"; 4953 4954 Block orderLines = new Block 4955 { 4956 Id = "MiniCartOrderLines", 4957 SkipRenderBlocksList = true, 4958 BlocksList = new List<Block> 4959 { 4960 new Block { 4961 Id = "MiniCartOrderLinesList", 4962 SortId = 20, 4963 Template = RenderMiniCartOrderLinesList() 4964 } 4965 } 4966 }; 4967 4968 Block orderlinesScriptTemplates = new Block 4969 { 4970 Id = "OrderlinesScriptTemplates" 4971 }; 4972 4973 if (orderlinesView == "table") 4974 { 4975 orderLines.Template = RenderMiniCartOrderLinesTable(); 4976 orderLines.BlocksList.Add( 4977 new Block { 4978 Id = "MiniCartOrderlinesTableHeader", 4979 SortId = 10, 4980 Template = RenderMiniCartOrderLinesHeader() 4981 } 4982 ); 4983 4984 orderlinesScriptTemplates.Template = RenderMiniCartScriptsTableTemplates(); 4985 } 4986 else 4987 { 4988 orderLines.Template = RenderMiniCartOrderLinesBlocks(); 4989 orderlinesScriptTemplates.Template = RenderMiniCartScriptsListTemplates(); 4990 } 4991 4992 miniCartBlocksPage.Add("MasterBottomSnippets", orderlinesScriptTemplates); 4993 4994 Block miniCartScriptTemplates = new Block() 4995 { 4996 Id = "MasterMiniCartTemplates", 4997 SortId = 1, 4998 Template = RenderMiniCartScriptTemplates(), 4999 SkipRenderBlocksList = true, 5000 BlocksList = new List<Block> 5001 { 5002 orderLines, 5003 new Block { 5004 Id = "MiniCartFooter", 5005 Template = RenderMiniCartFooter(), 5006 SortId = 50, 5007 SkipRenderBlocksList = true, 5008 BlocksList = new List<Block> 5009 { 5010 new Block { 5011 Id = "MiniCartFees", 5012 Template = RenderMiniCartFees(), 5013 SortId = 30 5014 }, 5015 new Block { 5016 Id = "MiniCartPoints", 5017 Template = RenderMiniCartPoints(), 5018 SortId = 40 5019 }, 5020 new Block { 5021 Id = "MiniCartTotal", 5022 Template = RenderMiniCartTotal(), 5023 SortId = 50 5024 }, 5025 new Block { 5026 Id = "MiniCartActions", 5027 Template = RenderMiniCartActions(), 5028 SortId = 60 5029 } 5030 } 5031 } 5032 } 5033 }; 5034 5035 miniCartBlocksPage.Add("MasterBottomSnippets", miniCartScriptTemplates); 5036 } 5037 5038 @helper RenderMiniCartScriptsTableTemplates() 5039 { 5040 <script id="MiniCartOrderline" type="text/x-template"> 5041 {{#unless isEmpty}} 5042 <tr> 5043 <td class="u-w60px"><a href="{{link}}" class="{{hideimage}}"><img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=50&height=50&crop=5&Compression=75&image={{image}}" alt="{{name}}"></a></td> 5044 <td class="u-va-middle"> 5045 <a href="{{link}}" class="mini-cart-orderline__name" title="{{name}}">{{name}}</a> 5046 {{#if variantname}} 5047 <a href="{{link}}" class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{variantname}}</a> 5048 {{/if}} 5049 {{#if unitname}} 5050 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{unitname}}</div> 5051 {{/if}} 5052 </td> 5053 <td class="u-ta-right u-va-middle">{{quantity}}</td> 5054 <td class="u-ta-right u-va-middle"> 5055 {{#if pointsTotal}} 5056 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 5057 {{else}} 5058 {{totalprice}} 5059 {{/if}} 5060 </td> 5061 </tr> 5062 5063 {{#OrderLineChildren}} 5064 <tr class="table__row--no-border"> 5065 <!--CS NT Do not show the XDO NOT LET USER REMOVE ProductDiscount--> 5066 <td>&nbsp;</td> 5067 <td colspan="2">{{nameCS}} </td> 5068 <td class="cart-table__price u-ta-right dw-mod">{{totalpriceCS}}</td> 5069 </tr> 5070 {{/OrderLineChildren}} 5071 5072 {{/unless}} 5073 </script> 5074 5075 @*TODO CS NT Comment out and move further below with different html OR add seperator *@ 5076 5077 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 5078 {{#unless isEmpty}} 5079 5080 {{#if parentId}} 5081 {{else}} 5082 <tr class="table__row--no-border"> 5083 <td colspan="3">{{name}}</td> 5084 @*<td class="u-w60px">&nbsp;</td>*@ 5085 @*<td><div class="mini-cart-orderline__name dw-mod">{{name}}</div></td>*@ 5086 @*<td class="u-ta-right">&nbsp;</td>*@ 5087 <td class="u-ta-right">{{totalprice}}</td> 5088 </tr> 5089 {{/if}} 5090 {{/unless}} 5091 </script> 5092 } 5093 5094 @helper RenderMiniCartScriptsListTemplates() 5095 { 5096 int cartOrderlinesFeedPageId = GetPageIdByNavigationTag("CartOrderlinesFeed"); 5097 <script id="MiniCartOrderline" type="text/x-template"> 5098 {{#unless isEmpty}} 5099 <div class="mini-cart-orderline grid dw-mod"> 5100 <div class="grid__col-4"> 5101 <a href="{{link}}" class="{{hideimage}}"> 5102 <img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=100&height=100&crop=5&Compression=75&image={{image}}" alt="{{name}}" title="{{name}}"> 5103 </a> 5104 </div> 5105 <div class="grid__col-8"> 5106 <a href="{{link}}" class="mini-cart-orderline__name mini-cart-orderline__name--truncate mini-cart-orderline__name--md u-padding-right--lg" title="{{name}}">{{name}}</a> 5107 {{#if variantname}} 5108 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Variant"): {{variantname}}</div> 5109 {{/if}} 5110 {{#if unitname}} 5111 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Unit"): {{unitname}}</div> 5112 {{/if}} 5113 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Qty"): {{quantity}}</div> 5114 5115 <div class="grid__cell-footer"> 5116 <div class="grid__cell"> 5117 <div class="u-pull--left mini-cart-orderline__price dw-mod"> 5118 {{#if pointsTotal}} 5119 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 5120 {{else}} 5121 {{totalprice}} 5122 {{/if}} 5123 </div> 5124 <button type="button" title="@Translate("Remove orderline")" class="btn btn--clean btn--condensed u-pull--right mini-cart-orderline__remove-btn dw-mod" onclick="{{removeFromCartGoogleImpression}}; Cart.UpdateCart('Cart', '/Default.aspx?ID=@cartOrderlinesFeedPageId', 'CartCmd=DelOrderLine&key={{orderLineId}}', true);">@Translate("Remove")</button> 5125 </div> 5126 </div> 5127 </div> 5128 </div> 5129 {{/unless}} 5130 </script> 5131 5132 @*TODO CS NT Comment out and move further below with different html OR add seperator *@ 5133 5134 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 5135 {{#unless isEmpty}} 5136 5137 <div class="mini-cart-orderline mini-cart-orderline--discount grid dw-mod"> 5138 <div class="grid__col-4"> 5139 <div class="mini-cart-orderline__name mini-cart-orderline__name dw-mod">CS{{name}}</div> 5140 </div> 5141 <div class="grid__col-8">{{totalprice}}</div> 5142 </div> 5143 {{/unless}} 5144 </script> 5145 } 5146 5147 @helper RenderMiniCartScriptTemplates() 5148 { 5149 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMiniCartTemplates").OrderBy(item => item.SortId).ToList(); 5150 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 5151 string cartPageLink = string.Concat("/Default.aspx?ID=", GetPageIdByNavigationTag("CartPage")); 5152 5153 <script id="MiniCartContent" type="text/x-template"> 5154 {{#.}} 5155 {{#unless isEmpty}} 5156 @if (useGoogleTagManager) 5157 { 5158 <text>{{{googleEnchantImpressionEmptyCart OrderLines}}}</text> 5159 } 5160 @RenderBlockList(subBlocks) 5161 {{/unless}} 5162 {{#if isEmpty}} 5163 {{{locationReload '@cartPageLink'}}} 5164 {{/if}} 5165 {{/.}} 5166 </script> 5167 } 5168 5169 @helper RenderMiniCartOrderLinesTable() 5170 { 5171 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList(); 5172 5173 <div class="u-overflow-auto"> 5174 <table class="table mini-cart-table dw-mod"> 5175 @RenderBlockList(subBlocks) 5176 </table> 5177 </div> 5178 } 5179 5180 @helper RenderMiniCartOrderLinesBlocks() 5181 { 5182 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList(); 5183 5184 <div class="u-overflow-auto"> 5185 @RenderBlockList(subBlocks) 5186 </div> 5187 } 5188 5189 @helper RenderMiniCartOrderLinesHeader() 5190 { 5191 <thead> 5192 <tr> 5193 <td>&nbsp;</td> 5194 <td>@Translate("Product")</td> 5195 <td class="u-ta-right">@Translate("Qty")</td> 5196 <td class="u-ta-right" width="120">@Translate("Price")</td> 5197 </tr> 5198 </thead> 5199 } 5200 5201 @helper RenderMiniCartOrderLinesList() 5202 { 5203 <text> 5204 {{#OrderLines}} 5205 {{#ifCond template "===" "CartOrderline"}} 5206 {{>MiniCartOrderline}} 5207 {{/ifCond}} 5208 {{#ifCond template "===" "CartOrderlineMobile"}} 5209 {{>MiniCartOrderline}} 5210 {{/ifCond}} 5211 {{#ifCond template "===" "CartOrderlineDiscount"}} 5212 {{>MiniCartOrderlineDiscount}} 5213 {{/ifCond}} 5214 {{/OrderLines}} 5215 </text> 5216 } 5217 5218 @helper RenderMiniCartFees() 5219 { 5220 @*CS NT Hide Payment 5221 <div class="grid u-border-top grid--external-bleed-bottom"> 5222 <div class="grid__col-6"> 5223 {{paymentmethod}} 5224 </div> 5225 <div class="grid__col-6 grid--align-end">{{paymentfee}}</div> 5226 </div> 5227 *@ 5228 <div class="grid grid--external-bleed-bottom"> 5229 <div class="grid__col-6"> 5230 {{shippingmethod}} 5231 </div> 5232 <div class="grid__col-6 grid--align-end">{{shippingfee}}</div> 5233 </div> 5234 } 5235 5236 @helper RenderMiniCartFooter() 5237 { 5238 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartFooter").OrderBy(item => item.SortId).ToList(); 5239 5240 <div class="mini-cart__footer dw-mod"> 5241 @RenderBlockList(subBlocks) 5242 </div> 5243 } 5244 5245 @helper RenderMiniCartActions() 5246 { 5247 int cartPageId = GetPageIdByNavigationTag("CartPage"); 5248 5249 <!-- CS NT Hide Empty Cart <button type="button" title="@Translate("Empty cart")" class="btn btn--secondary u-full-width dw-mod u-no-margin u-margin-bottom" onclick="googleEnchantImpressionEmptyCart(); Cart.EmptyCart(event);">@Translate("Empty cart")</button>--> 5250 <a href="/Default.aspx?ID=@cartPageId" title="@Translate("Proceed to checkout")" class="btn btn--primary u-full-width u-no-margin dw-mod">@Translate("Proceed to checkout")</a> 5251 } 5252 5253 @helper RenderMiniCartPoints() 5254 { 5255 <text> 5256 {{#if earnings}} 5257 <div class="grid grid--external-bleed-bottom"> 5258 <div class="grid__col-6">@Translate("Earnings")</div> 5259 <div class="grid__col-6 grid--align-end"> 5260 <div> 5261 <span class="u-color--loyalty-points">{{earnings}}</span> @Translate("points") 5262 </div> 5263 </div> 5264 </div> 5265 {{/if}} 5266 </text> 5267 } 5268 5269 @helper RenderMiniCartTotal() 5270 { 5271 <div class="mini-cart-totals grid u-margin-bottom dw-mod"> 5272 <div class="grid__col-6">@Translate("Total")</div> 5273 <div class="grid__col-6 grid--align-end">{{totalprice}}</div> 5274 </div> 5275 } 5276 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5277 5278 @using Dynamicweb.Rapido.Blocks.Extensibility 5279 @using Dynamicweb.Rapido.Blocks 5280 5281 @{ 5282 bool addToCartNotificationOnlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 5283 string addToCartNotificationType = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType").SelectedValue : ""; 5284 bool addToCartHideCartIcon = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 5285 5286 if (!addToCartNotificationOnlyPreview && !string.IsNullOrEmpty(addToCartNotificationType)) { 5287 if (addToCartNotificationType == "modal") 5288 { 5289 Block addToCartNotificationModal = new Block 5290 { 5291 Id = "AddToCartNotificationModal", 5292 Template = RenderAddToCartNotificationModal() 5293 }; 5294 5295 Block addToCartNotificationScript = new Block 5296 { 5297 Id = "AddToCartNotificationScript", 5298 Template = RenderAddToCartNotificationModalScript() 5299 }; 5300 BlocksPage.GetBlockPage("Master").Add("MasterTopSnippets", addToCartNotificationModal); 5301 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript); 5302 } 5303 else if (addToCartNotificationType == "toggle" && !addToCartHideCartIcon && Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 5304 { 5305 Block addToCartNotificationScript = new Block 5306 { 5307 Id = "AddToCartNotificationScript", 5308 Template = RenderAddToCartNotificationToggleScript() 5309 }; 5310 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript); 5311 } 5312 } 5313 } 5314 5315 @helper RenderAddToCartNotificationModal() 5316 { 5317 <div id="LastAddedProductModal" data-template="LastAddedProductTemplate"></div> 5318 } 5319 5320 @helper RenderAddToCartNotificationModalScript() 5321 { 5322 int cartPageId = GetPageIdByNavigationTag("CartPage"); 5323 5324 <script id="LastAddedProductTemplate" type="text/x-template"> 5325 <!-- Trigger for the login modal --> 5326 <input type="checkbox" id="LastAddedProductModalTrigger" class="modal-trigger" /> 5327 5328 <!-- Login modal --> 5329 <div class="modal-container"> 5330 <label for="LastAddedProductModalTrigger" class="modal-overlay"></label> 5331 <div class="modal modal--md"> 5332 <div class="modal__header"> 5333 <h2>@Translate("Product is added to the cart")</h2> 5334 </div> 5335 <div class="modal__body"> 5336 <div class="grid"> 5337 <div class="grid__col-2"> 5338 <a href="{{productInfo.link}}"> 5339 <img src="{{productInfo.image}}" alt="{{productInfo.name}}" class="dw-mod" /> 5340 </a> 5341 </div> 5342 <div class="u-padding grid--align-self-center"> 5343 <span>{{quantity}}</span> x 5344 </div> 5345 <div class="grid__col-auto grid--align-self-center"> 5346 <div>{{productInfo.name}}</div> 5347 {{#if productInfo.variantName}} 5348 <small class="u-margin-bottom-5px">{{productInfo.variantName}}</small> 5349 {{/if}} 5350 {{#if productInfo.unitName}} 5351 <small class="u-margin-bottom-5px">{{productInfo.unitName}}</small> 5352 {{/if}} 5353 </div> 5354 </div> 5355 <div class="modal__footer u-margin-top--lg"> 5356 <label class="btn btn--secondary u-pull--left u-no-margin dw-mod btn--sm" for="LastAddedProductModalTrigger">@Translate("Continue shopping")</label> 5357 <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> 5358 </div> 5359 </div> 5360 <label class="modal__close-btn" for="LastAddedProductModalTrigger"></label> 5361 </div> 5362 </div> 5363 </script> 5364 <script> 5365 document.addEventListener('addToCart', function (event) { 5366 Cart.ShowLastAddedProductModal(event.detail); 5367 }); 5368 </script> 5369 } 5370 5371 @helper RenderAddToCartNotificationToggleScript() 5372 { 5373 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 5374 5375 <script> 5376 document.addEventListener('addToCart', function () { 5377 Cart.ToggleMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '@miniCartFeedPageId'); 5378 }); 5379 </script> 5380 } 5381 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5382 5383 @using System 5384 @using System.Web 5385 @using System.Collections.Generic 5386 @using Dynamicweb.Rapido.Blocks.Extensibility 5387 @using Dynamicweb.Rapido.Blocks 5388 5389 @functions { 5390 BlocksPage footerBlocksPage = BlocksPage.GetBlockPage("Master"); 5391 } 5392 5393 @{ 5394 string footerColumnOneContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Content"); 5395 string footerColumnTwoContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Content"); 5396 string footerColumnThreeContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Content"); 5397 string footerColumnOneHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Header"); 5398 string footerColumnTwoHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Header"); 5399 string footerColumnThreeHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Header"); 5400 5401 Block masterFooterContent = new Block() 5402 { 5403 Id = "MasterFooterContent", 5404 SortId = 10, 5405 Template = RenderFooter(), 5406 SkipRenderBlocksList = true 5407 }; 5408 footerBlocksPage.Add(MasterBlockId.MasterFooter, masterFooterContent); 5409 5410 if (!string.IsNullOrEmpty(footerColumnOneContent) || !string.IsNullOrEmpty(footerColumnOneHeader)) 5411 { 5412 Block masterFooterColumnOne = new Block 5413 { 5414 Id = "MasterFooterColumnOne", 5415 SortId = 10, 5416 Template = RenderFooterColumn(footerColumnOneHeader, footerColumnOneContent), 5417 Design = new Design { 5418 Size = "auto", 5419 RenderType = RenderType.Column 5420 } 5421 }; 5422 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnOne); 5423 } 5424 5425 if (!string.IsNullOrEmpty(footerColumnTwoContent) || !string.IsNullOrEmpty(footerColumnTwoHeader)) 5426 { 5427 Block masterFooterColumnTwo = new Block 5428 { 5429 Id = "MasterFooterColumnTwo", 5430 SortId = 20, 5431 Template = RenderFooterColumn(footerColumnTwoHeader, footerColumnTwoContent), 5432 Design = new Design 5433 { 5434 Size = "auto", 5435 RenderType = RenderType.Column 5436 } 5437 }; 5438 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnTwo); 5439 } 5440 5441 if (!string.IsNullOrEmpty(footerColumnThreeContent) || !string.IsNullOrEmpty(footerColumnThreeHeader)) 5442 { 5443 Block masterFooterColumnThree = new Block 5444 { 5445 Id = "MasterFooterColumnThree", 5446 SortId = 30, 5447 Template = RenderFooterColumn(footerColumnThreeHeader, footerColumnThreeContent), 5448 Design = new Design 5449 { 5450 Size = "auto", 5451 RenderType = RenderType.Column 5452 } 5453 }; 5454 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnThree); 5455 } 5456 5457 if (Model.Area.Item.GetItem("Layout").GetBoolean("FooterNewsletterSignUp")) 5458 { 5459 Block masterFooterNewsletterSignUp = new Block 5460 { 5461 Id = "MasterFooterNewsletterSignUp", 5462 SortId = 40, 5463 Template = RenderFooterNewsletterSignUp(), 5464 Design = new Design 5465 { 5466 Size = "auto", 5467 RenderType = RenderType.Column 5468 } 5469 }; 5470 footerBlocksPage.Add("MasterFooterContent", masterFooterNewsletterSignUp); 5471 } 5472 5473 if (Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks").Count > 0) 5474 { 5475 Block masterFooterSocialLinks = new Block 5476 { 5477 Id = "MasterFooterSocialLinks", 5478 SortId = 50, 5479 Template = RenderFooterSocialLinks(), 5480 Design = new Design 5481 { 5482 Size = "auto", 5483 RenderType = RenderType.Column 5484 } 5485 }; 5486 footerBlocksPage.Add("MasterFooterContent", masterFooterSocialLinks); 5487 } 5488 5489 if (Model.Area.Item.GetItem("Layout").GetItems("FooterPayments") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterPayments").Count > 0) 5490 { 5491 Block masterFooterPayments = new Block 5492 { 5493 Id = "MasterFooterPayments", 5494 SortId = 60, 5495 Template = RenderFooterPayments(), 5496 Design = new Design 5497 { 5498 Size = "12", 5499 RenderType = RenderType.Column 5500 } 5501 }; 5502 footerBlocksPage.Add("MasterFooterContent", masterFooterPayments); 5503 } 5504 5505 Block masterFooterCopyright = new Block 5506 { 5507 Id = "MasterFooterCopyright", 5508 SortId = 70, 5509 Template = RenderFooterCopyright(), 5510 Design = new Design 5511 { 5512 Size = "12", 5513 RenderType = RenderType.Column 5514 } 5515 }; 5516 footerBlocksPage.Add("MasterFooterContent", masterFooterCopyright); 5517 } 5518 5519 @helper RenderFooter() { 5520 List<Block> subBlocks = this.footerBlocksPage.GetBlockListById("MasterFooterContent").OrderBy(item => item.SortId).ToList(); 5521 5522 <footer class="footer dw-mod"> 5523 <div class="center-container u-padding dw-mod" id="productPageDeliveryBenefitsAdvice"> 5524 <div class="grid productPage-Delivery-Benefits-Advice"> 5525 <div class="grid__col-lg-4 grid__col-md-4 grid__col-sm-12 grid__col-xs-12 oneThirdDiv"> 5526 <p> 5527 <a href="/"> 5528 <img src="Files/Images/General/delivery_icon.svg" /> 5529 </a> 5530 </p> 5531 <div> 5532 <p><strong>Free Standard Delivery when you </strong></p> 5533 5534 <p><strong>spend &euro;15 or more</strong></p> 5535 5536 <p>Delivery will take 3-5 working days</p> 5537 </div> 5538 </div> 5539 5540 <div class="grid__col-lg-4 grid__col-md-4 grid__col-sm-12 grid__col-xs-12 oneThirdDiv"> 5541 <p> 5542 <a href="/createecommerceaccount"> 5543 <img src="Files/Images/General/loyalty_icon.svg" /> 5544 </a> 5545 </p> 5546 <div> 5547 <p> 5548 <a href="/createecommerceaccount"><strong>Join our &lsquo;Benefits&rsquo; Loyalty Scheme</strong></a> 5549 </p> 5550 <p>Join our loyalty scheme today. Every &euro;1 of purchases adds 1 point to your account</p> 5551 <p>&nbsp;</p> 5552 </div> 5553 </div> 5554 5555 <div class="grid__col-lg-4 grid__col-md-4 grid__col-sm-12 grid__col-xs-12 oneThirdDiv"> 5556 <p> 5557 <a href="/qualified-to-advise"> 5558 <img src="Files/Images/General/qualified_to_advise.png" style="width: 55px; height: 45px;" /> 5559 </a> 5560 </p> 5561 <div> 5562 <p> 5563 <a href="/qualified-to-advise"><strong>Qualified to Advise</strong></a> 5564 </p> 5565 <p>Our associated are qualified to advise. Visit us in-store or online for qualified advices</p> 5566 <p>&nbsp;</p> 5567 </div> 5568 </div> 5569 </div> 5570 </div> 5571 <div class="center-container top-container__center-container dw-mod"> 5572 5573 <!-- CS NT add Payments-Social and Lines Start..--> 5574 <div class="fullSoftLine"></div> 5575 <div class="grid" style="padding: 1rem 0;"> 5576 <!--<div class="oneHalfDiv_Payments"><img src="Files/Images/General/payment-options.svg" /></div> 5577 <div class="oneHalfDiv_Social"><img src="Files/Images/General/social-instagram.svg" /> <img src="Files/Images/General/social-facebook.svg" /></div>--> 5578 <div class="oneDiv_Payments"><img src="Files/Images/General/payments options.png" /></div> 5579 </div> 5580 <div class="fullThickLine"></div> 5581 <!-- CS NT add Payments-Social and Lines ..End--> 5582 5583 <div class="grid grid--external-bleed-x"> 5584 @RenderBlockList(subBlocks) 5585 </div> 5586 </div> 5587 </footer> 5588 } 5589 5590 @helper RenderFooterColumn(string header, string content) { 5591 <h3 class="footer__heading dw-mod">@header</h3> 5592 <div class="footer__content dw-mod"> 5593 @content 5594 </div> 5595 } 5596 5597 @helper RenderFooterNewsletterSignUp() { 5598 string newsletterSignUpPageId = GetPageIdByNavigationTag("NewsletterSignUp").ToString(); 5599 5600 <h3 class="footer__heading dw-mod">@Translate("Mailing list")</h3> 5601 <div class="footer__content dw-mod"> 5602 <form class="form dw-mod" name="NewsletterRedirect" action='/Default.aspx' method="get" enctype="multipart/form-data"> 5603 <input name="ID" value="@newsletterSignUpPageId" type="hidden" /> 5604 <label for="NewsletterEmail" class="u-margin-bottom">@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")</label> 5605 <div class="form__field-combi"> 5606 <input name="NewsletterEmail" id="NewsletterEmail" type="text" placeholder='@Translate("Your email address", "Your email address")' class="u-full-width use-btn-primary-height" /> 5607 <input class="btn btn--primary btn--condensed dw-mod" type="submit" id="Submitter" value='@Translate("Go", "Go")' /> 5608 </div> 5609 </form> 5610 </div> 5611 } 5612 5613 @helper RenderFooterSocialLinks() { 5614 <h3 class="footer__heading dw-mod">@Translate("Social links")</h3> 5615 <div class="footer__content dw-mod"> 5616 <div class="collection dw-mod"> 5617 @foreach (var socialitem in Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks")) 5618 { 5619 var socialIcon = socialitem.GetValue("Icon") as Dynamicweb.Frontend.ListViewModel; 5620 string socialIconClass = socialIcon.SelectedValue; 5621 string socialIconTitle = socialIcon.SelectedName; 5622 string socialLink = socialitem.GetString("Link"); 5623 5624 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px" rel="noopener"><i class="@socialIconClass fa-2x"></i></a> 5625 } 5626 </div> 5627 </div> 5628 } 5629 5630 @helper RenderFooterPayments() { 5631 <div class="footer__content dw-mod"> 5632 <div class="collection dw-mod"> 5633 @foreach (var payment in Model.Area.Item.GetItem("Layout").GetItems("FooterPayments")) 5634 { 5635 var paymentItem = payment.GetValue("CardTypeOrVerifiedPayment") as Dynamicweb.Frontend.ListViewModel; 5636 string paymentImage = null; 5637 string paymentTitle = paymentItem.SelectedName; 5638 ListOptionViewModel selected = paymentItem.SelectedOptions.FirstOrDefault(); 5639 if (selected != null) 5640 { 5641 paymentImage = selected.Icon; 5642 } 5643 5644 <div class="footer__card-type"> 5645 <img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=60&Compression=75&image=@paymentImage" alt="@paymentTitle" title="@paymentTitle" /> 5646 </div> 5647 } 5648 </div> 5649 </div> 5650 } 5651 5652 @helper RenderFooterCopyright() { 5653 <div class="grid__col-12 footer__copyright dw-mod"> 5654 <p>@Model.Area.Item.GetItem("Layout").GetString("FooterCopyrightText")</p> 5655 </div> 5656 } 5657 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 5658 5659 @using System 5660 @using System.Web 5661 @using System.Collections.Generic 5662 @using Dynamicweb.Rapido.Blocks.Extensibility 5663 @using Dynamicweb.Rapido.Blocks 5664 @using Dynamicweb.Ecommerce.Common 5665 5666 @{ 5667 BlocksPage referencesBlocksPage = BlocksPage.GetBlockPage("Master"); 5668 5669 Block masterScriptReferences = new Block() 5670 { 5671 Id = "MasterScriptReferences", 5672 SortId = 1, 5673 Template = RenderMasterScriptReferences() 5674 }; 5675 referencesBlocksPage.Add(MasterBlockId.MasterReferences, masterScriptReferences); 5676 } 5677 5678 @helper RenderMasterScriptReferences() 5679 { 5680 5681 5682 <script src="/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js"></script> 5683 <!--CS NT Use ticks <script src="/Files/Templates/Designs/Rapido/js/master.min.js"></script>--> 5684 //CS NT Ticks for files 5685 var masterMinJSfileInfo = new System.IO.FileInfo(System.Web.HttpContext.Current.Server.MapPath("/Files/Templates/Designs/Rapido/js/master.min.js")); 5686 <script type="text/javascript" src="/Files/Templates/Designs/Rapido/js/master.min.js?ticks=@masterMinJSfileInfo.LastWriteTime.Ticks.ToString()"></script> 5687 5688 if (Model.Area.Item.GetItem("Custom").GetBoolean("UseCustomJavascript")) 5689 { 5690 <script src="/Files/Templates/Designs/Rapido/js/custom.min.js"></script> 5691 PushPromise("/Files/Templates/Designs/Rapido/js/custom.min.js"); 5692 } 5693 5694 PushPromise("/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js"); 5695 PushPromise("/Files/Templates/Designs/Rapido/js/master.min.js"); 5696 } 5697 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5698 5699 @using System 5700 @using System.Web 5701 @using System.Collections.Generic 5702 @using Dynamicweb.Rapido.Blocks.Extensibility 5703 @using Dynamicweb.Rapido.Blocks 5704 5705 @{ 5706 BlocksPage searchBlocksPage = BlocksPage.GetBlockPage("Master"); 5707 bool navigationItemsHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 5708 bool isFavoriteList = !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("ListID")); 5709 5710 if (!navigationItemsHideSearch || isFavoriteList) 5711 { 5712 Block masterSearchScriptTemplates = new Block() 5713 { 5714 Id = "MasterSearchScriptTemplates", 5715 SortId = 1, 5716 Template = RenderSearchScriptTemplates() 5717 }; 5718 5719 searchBlocksPage.Add(MasterBlockId.MasterBottomSnippets, masterSearchScriptTemplates); 5720 } 5721 } 5722 5723 @helper RenderSearchScriptTemplates() 5724 { 5725 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 5726 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 5727 bool useFacebookPixel = !string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID")); 5728 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 5729 bool useGoogleTagManager = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID")); 5730 bool showPrice = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HidePriceInSearchResults"); 5731 bool showAddToCartButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideAddToCartButton"); 5732 bool showViewButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideViewButton"); 5733 bool showAddToDownloadButton = Pageview.AreaSettings.GetItem("Layout").GetBoolean("ShowAddToDownloadButton"); 5734 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 5735 5736 <script id="SearchGroupsTemplate" type="text/x-template"> 5737 {{#.}} 5738 <li class="dropdown__item dw-mod" onclick="Search.UpdateGroupSelection(this)" data-group-id="{{id}}">{{name}}</li> 5739 {{/.}} 5740 </script> 5741 5742 <script id="SearchProductsTemplate" type="text/x-template"> 5743 {{#each .}} 5744 {{#Product}} 5745 {{#ifCond template "!==" "SearchMore"}} 5746 <li class="dropdown__item dropdown__item--seperator dw-mod"> 5747 @if (useFacebookPixel) 5748 { 5749 <text>{{{facebookPixelSearch name number priceDouble currency searchParameter}}}</text> 5750 } 5751 @if (useGoogleTagManager) 5752 { 5753 <text>{{{googleEnchantImpression 'Search results' currency googleImpression}}}</text> 5754 } 5755 <div> 5756 <a href="{{link}}" class="js-typeahead-link u-color-inherit u-pull--left" onclick="{{googleImpressionClick}}" title="{{name}}"> 5757 <div class="u-margin-right u-pull--left {{noimage}} u-hidden-xs u-hidden-xxs"><img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=45&height=36&crop=5&FillCanvas=True&Compression=75&image={{image}}" alt="{{name}}"></div> 5758 <div class="u-pull--left"> 5759 <div class="u-bold u-max-w220px u-truncate-text js-typeahead-name">{{name}}</div> 5760 @if (showPrice && !onlyPreview) 5761 { 5762 if (pointShopOnly) 5763 { 5764 <text> 5765 {{#if havePointPrice}} 5766 <div> 5767 <span class="u-color--loyalty-points">{{points}}</span> @Translate("points") 5768 </div> 5769 {{else}} 5770 <small class="help-text u-no-margin">@Translate("Not available")</small> 5771 {{/if}} 5772 {{#unless canBePurchasedWithPoints}} 5773 {{#if havePointPrice}} 5774 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small> 5775 {{/if}} 5776 {{/unless}} 5777 </text> 5778 } 5779 else 5780 { 5781 <div>{{price}}</div> 5782 } 5783 } 5784 </div> 5785 </a> 5786 <div class="u-margin-left u-pull--right"> 5787 @if (showAddToCartButton && !onlyPreview) { 5788 if (pointShopOnly) 5789 { 5790 <button type="button" class="btn btn--primary btn--condensed btn--full u-no-margin dw-mod {{hideBuyOptions}} js-ignore-click-outside {{#unless canBePurchasedWithPoints}}js-stay-disabled{{/unless}}" name="CartCmd" value="addWithPoints" 5791 onclick="Cart.AddToCart(event, { 5792 id: '{{productId}}', 5793 quantity: 1, 5794 buyForPoints: true, 5795 productInfo: {{productInfo}} 5796 }); {{facebookPixelAction}}" {{disabledBuyButton}}> 5797 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue js-ignore-click-outside"></i> 5798 </button> 5799 } else { 5800 @* CS NT Comment out for onClick.. 5801 <button type="button" class="btn btn--primary btn--condensed btn--full u-no-margin dw-mod {{hideBuyOptions}} js-ignore-click-outside" 5802 onclick="Cart.AddToCart(event, { 5803 id: '{{productId}}', 5804 quantity: 1, 5805 productInfo: {{productInfo}} 5806 }); {{facebookPixelAction}}"> 5807 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue js-ignore-click-outside"></i> 5808 </button> 5809 .. CS NT Comment out for onClick*@ 5810 <input type="number" class="product__quantity-selector u-w70px use-btn-primary-height dw-mod" style="display: none;" id="Quantity_{{id}}" name="Quantity" value="1" min="1" data-qtyincart="{{qtyInCart}}" data-id="{{id}}"> 5811 <button type="button" id="CartButton_{{id}}" class="btn btn--primary btn--condensed btn--full u-no-margin dw-mod {{hideBuyOptions}} js-ignore-click-outside" 5812 onclick="ProductAddToCart(event, {{id}}, { 5813 id: '{{productId}}', 5814 variantId: '{{variantid}}', 5815 unitId: '{{unitId}}', 5816 quantity: 1, 5817 productInfo: {{productInfo}} 5818 }); {{facebookPixelAction}}" > 5819 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue js-ignore-click-outside"></i> 5820 </button> 5821 } 5822 <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> 5823 } 5824 else if (showViewButton) 5825 { 5826 <a href="{{link}}" onclick="{{googleImpressionClick}}" class="btn btn--secondary btn--condensed btn--full u-no-margin dw-mod js-ignore-click-outside" title="@Translate("View")">@Translate("View")</a> 5827 } 5828 @if (showAddToDownloadButton) 5829 { 5830 <button type="button" class="btn btn--primary u-no-margin btn--condensed dw-mod js-add-to-downloads" title="@Translate("Add")" data-product-id="{{productId}}"> 5831 <i class="fas fa-plus js-button-icon"></i> 5832 </button> 5833 } 5834 </div> 5835 5836 <div class="error-message" style="display:none" id="error-message{{id}}"> 5837 <br /> 5838 <div class="error-block-nextech">@Translate("Available stock is") <span id="stockSpan{{id}}"></span></div> 5839 </div> 5840 5841 </div> 5842 </li> 5843 {{/ifCond}} 5844 {{#ifCond template "===" "SearchMore"}} 5845 {{>SearchMoreProducts}} 5846 {{/ifCond}} 5847 {{/Product}} 5848 {{else}} 5849 <li class="dropdown__item dropdown__item--seperator dw-mod"> 5850 @Translate("Your search gave 0 results") 5851 </li> 5852 {{/each}} 5853 </script> 5854 5855 <script id="SearchMoreProducts" type="text/x-template"> 5856 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 5857 <a href="/Default.aspx?ID=@productsPageId&Search={{searchParameter}}&GroupID={{groupId}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 5858 @Translate("View all") 5859 </a> 5860 </li> 5861 </script> 5862 5863 <script id="SearchMorePages" type="text/x-template"> 5864 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 5865 <a href="/Default.aspx?ID=@contentSearchPageLink&Search={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 5866 @Translate("View all") 5867 </a> 5868 </li> 5869 </script> 5870 5871 <script id="SearchPagesTemplate" type="text/x-template"> 5872 {{#each .}} 5873 {{#ifCond template "!==" "SearchMore"}} 5874 <li class="dropdown__item dropdown__item--seperator dw-mod"> 5875 <div> 5876 <a href="/Default.aspx?ID={{id}}" class="js-typeahead-link u-pull--left u-color-inherit"> 5877 <div class="u-margin-right u-pull--left"><i class="fa {{icon}} u-w20px u-ta-center"></i></div> 5878 <div class="u-pull--left"> 5879 <div class="u-bold u-truncate-text u-max-w220px js-typeahead-name">{{name}}</div> 5880 </div> 5881 </a> 5882 </div> 5883 </li> 5884 {{/ifCond}} 5885 {{#ifCond template "===" "SearchMore"}} 5886 {{>SearchMorePages}} 5887 {{/ifCond}} 5888 {{else}} 5889 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable dw-mod"> 5890 @Translate("Your search gave 0 results") 5891 </li> 5892 {{/each}} 5893 </script> 5894 5895 <script id="SearchPagesTemplateWrap" type="text/x-template"> 5896 <div class="dropdown__column-header">@Translate("Pages")</div> 5897 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom dw-mod"> 5898 {{>SearchPagesTemplate}} 5899 </ul> 5900 </script> 5901 5902 <script id="SearchProductsTemplateWrap" type="text/x-template"> 5903 <div class="dropdown__column-header">@Translate("Products")</div> 5904 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom dw-mod"> 5905 {{>SearchProductsTemplate}} 5906 </ul> 5907 </script> 5908 } 5909 5910 5911 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 5912 5913 @using System 5914 @using System.Web 5915 @using System.Collections.Generic 5916 @using Dynamicweb.Rapido.Blocks.Extensibility 5917 @using Dynamicweb.Rapido.Blocks 5918 5919 @{ 5920 BlocksPage bottomSnippetsBlocksPage = BlocksPage.GetBlockPage("Master"); 5921 5922 Block primaryBottomSnippets = new Block() 5923 { 5924 Id = "MasterJavascriptInitializers", 5925 SortId = 100, 5926 Template = RenderPrimaryBottomSnippets() 5927 }; 5928 bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, primaryBottomSnippets); 5929 } 5930 5931 @helper RenderPrimaryBottomSnippets() { 5932 bool isWireframeMode = Model.Area.Item.GetItem("Settings").GetBoolean("WireframeMode"); 5933 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 5934 5935 if (isWireframeMode) 5936 { 5937 <script> 5938 Wireframe.Init(true); 5939 </script> 5940 } 5941 5942 5943 if (useGoogleTagManager) 5944 { 5945 <script> 5946 document.addEventListener('addToCart', function(event) { 5947 var googleImpression = event.detail.productInfo.googleImpression; 5948 dataLayer.push({ 5949 'event': 'addToCart', 5950 'ecommerce': { 5951 'currencyCode': '@Dynamicweb.Ecommerce.Services.Currencies.GetDefaultCurrency().Code', 5952 'add': { 5953 'products': [{ 5954 'name': googleImpression.name, 5955 'id': googleImpression.id, 5956 'price': googleImpression.price, 5957 'brand': googleImpression.brand, 5958 'category': googleImpression.category, 5959 'variant': googleImpression.variant, 5960 'quantity': event.detail.quantity 5961 }] 5962 } 5963 } 5964 }); 5965 }); 5966 </script> 5967 } 5968 5969 //if digitalwarehouse 5970 if (Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart")) 5971 { 5972 string cartContextId = Converter.ToString(HttpContext.Current.Application["DownloadCartContext"]); 5973 5974 if (string.IsNullOrEmpty(cartContextId)) { 5975 var moduleProps = Dynamicweb.Modules.Properties.GetParagraphModuleSettings(GetPageIdByNavigationTag("DownloadCart"), "eCom_CartV2"); 5976 var cartSettings = new Dynamicweb.Ecommerce.Cart.ModuleSettings(moduleProps); 5977 cartContextId = cartSettings.OrderContextID; 5978 HttpContext.Current.Application["DownloadCartContext"] = cartContextId; 5979 } 5980 5981 <script> 5982 let downloadCart = new DownloadCart({ 5983 cartPageId: @GetPageIdByNavigationTag("MiniCartFeed"), 5984 contextId: "@cartContextId", 5985 addButtonText: "@Translate("Add")", 5986 removeButtonText: "@Translate("Remove")" 5987 }); 5988 </script> 5989 } 5990 5991 <!--@Javascripts--> 5992 } 5993 @if (File.Exists(HttpContext.Current.Server.MapPath("/MasterBlocks/Custom__Blocks.cshtml"))) 5994 { 5995 <text>@inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 5996 5997 @using System 5998 @using System.Web 5999 @using System.Collections.Generic 6000 @using Dynamicweb.Rapido.Blocks 6001 6002 @{ 6003 BlocksPage masterCustomBlocksPage = BlocksPage.GetBlockPage("Master"); 6004 6005 }</text> 6006 } 6007 6008 6009 @functions { 6010 public class ManifestIcon 6011 { 6012 public string src { get; set; } 6013 public string type { get; set; } 6014 public string sizes { get; set; } 6015 } 6016 6017 public class Manifest 6018 { 6019 public string name { get; set; } 6020 public string short_name { get; set; } 6021 public string start_url { get; set; } 6022 public string display { get; set; } 6023 public string background_color { get; set; } 6024 public string theme_color { get; set; } 6025 public List<ManifestIcon> icons { get; set; } 6026 } 6027 } 6028 @{ 6029 if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName")) && Model.Area.Item.GetItem("Settings").GetFile("AppIcon") != null) { 6030 Manifest manifest = new Manifest 6031 { 6032 name = Model.Area.Item.GetItem("Settings").GetString("AppName"), 6033 short_name = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppShortName")) ? Model.Area.Item.GetItem("Settings").GetString("AppShortName") : Model.Area.Item.GetItem("Settings").GetString("AppName"), 6034 start_url = "/", 6035 display = "standalone", 6036 background_color = Model.Area.Item.GetItem("Settings").GetString("AppBackgroundColor"), 6037 theme_color = Model.Area.Item.GetItem("Settings").GetString("AppThemeColor") 6038 }; 6039 6040 manifest.icons = new List<ManifestIcon> { 6041 new ManifestIcon { 6042 src = "/Admin/Public/GetImage.ashx?width=192&height=192&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 6043 sizes = "192x192", 6044 type = "image/png" 6045 }, 6046 new ManifestIcon { 6047 src = "/Admin/Public/GetImage.ashx?width=512&height=512&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 6048 sizes = "512x512", 6049 type = "image/png" 6050 }, 6051 new ManifestIcon { 6052 src = "/Admin/Public/GetImage.ashx?width=1024&height=1024&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 6053 sizes = "1024x1024", 6054 type = "image/png" 6055 } 6056 }; 6057 6058 string manifestFilePath = HttpContext.Current.Request.MapPath("/Files/Templates/Designs/Rapido/manifest.json"); 6059 string manifestJSON = Newtonsoft.Json.JsonConvert.SerializeObject(manifest); 6060 string currentManifest = File.ReadAllText(manifestFilePath); 6061 6062 if (manifestJSON != currentManifest) 6063 { 6064 File.WriteAllText(manifestFilePath, manifestJSON); 6065 } 6066 } 6067 } 6068 6069 @{ 6070 var swatches = new Dynamicweb.Content.Items.ColorSwatchService(); 6071 var brandColors = swatches.GetColorSwatch(1); 6072 string brandColorOne = brandColors.Palette["BrandColor1"]; 6073 6074 //CS NT Ticks for files 6075 var customJSfileInfo = new System.IO.FileInfo(System.Web.HttpContext.Current.Server.MapPath("/Files/Templates/Designs/Rapido/js/source/Custom.js")); 6076 var nextechCSSfileInfo = new System.IO.FileInfo(System.Web.HttpContext.Current.Server.MapPath("/Files/Templates/Designs/Rapido/css/nextech.css")); 6077 6078 string addId_FB = ""; 6079 string url_FB = HttpContext.Current.Request.Url.AbsoluteUri; 6080 string imageURL_FB_path = ""; 6081 string imageURL_FB = ""; 6082 string imageExtension_FB ="png"; 6083 string title_FB = ""; 6084 string description_FB = ""; 6085 if(Model != null && Model.Item != null && Model.Item.GetFile("Image") != null )//&& !string.IsNullOrWhiteSpace(Model.Item.GetFile("Image").Path)) 6086 { 6087 imageURL_FB_path = Model.Item.GetFile("Image").ToString(); 6088 imageURL_FB = string.Format("{0}://{1}{2}", Dynamicweb.Context.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, imageURL_FB_path); 6089 title_FB = Model.Item.GetString("Title"); 6090 description_FB = Model.Item.GetString("Summary"); 6091 imageExtension_FB = Model.Item.GetFile("Image").Extension.Replace(".",""); 6092 6093 }else{ 6094 imageURL_FB = "https://staging.hollandandbarrett.com.cy/Files/Images/FeaturedImageForURLs.png"; 6095 title_FB = "Holland & Barrett Cyprus"; 6096 description_FB = "Holland And Barrett Cyprus"; 6097 } 6098 imageExtension_FB = "image/" + imageExtension_FB; 6099 6100 if (!string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID"))) 6101 { 6102 //addId_FB = Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID"); 6103 } 6104 6105 } 6106 6107 <!DOCTYPE html> 6108 6109 <html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName"> 6110 <head> 6111 <!-- Rapido version 3.1.1 --> 6112 <meta charset="utf-8" /> 6113 <title>@Model.Title</title> 6114 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 6115 <meta name="robots" content="index, follow"> 6116 <meta name="theme-color" content="@brandColorOne" /> 6117 <!--FACEBOOK--> 6118 <meta property="fb:app_id" content="@addId_FB"> 6119 <meta property="og:image" content="@imageURL_FB"> 6120 <meta property="og:image:type" content="image/png"> 6121 <meta property="og:image:width" content="1024"> 6122 <meta property="og:image:height" content="1024"> 6123 <meta property="og:type" content="website" /> 6124 <!--CS NT This redirects all pages <meta property="og:url" content="https://staging.hollandandbarrett.com.cy"/>--> 6125 <meta property="og:url" content="@url_FB"/> 6126 <meta property="og:title" content="@title_FB" /> 6127 <meta property="og:description" content="@description_FB" /> 6128 6129 @Model.MetaTags 6130 6131 <!-- CS NT JQuery Library--> 6132 <script type="text/javascript" src="/Files/Templates/Designs/Rapido/js/jquery.min.js"></script> 6133 6134 <!-- CS NT Slick.js Library--> 6135 <script type="text/javascript" src="/Files/Templates/Designs/Rapido/js/slick.js"></script> 6136 6137 <!-- CS NT Jquery Mask.js Library UNUSED --> 6138 <!--<script type="text/javascript" src="/Files/Templates/Designs/Rapido/js/jquery.mask.min.js"></script>--> 6139 6140 <!-- CS NT Custom.js from DW--> 6141 <script type="text/javascript" src="/Files/Templates/Designs/Rapido/js/source/Custom.js?ticks=@customJSfileInfo.LastWriteTime.Ticks.ToString()"></script> 6142 6143 <!-- Favicon --> 6144 <link href="@favicon" rel="icon" type="image/png"> 6145 6146 <!-- Base (Default, wireframe) styles --> 6147 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/base/base.min.css" type="text/css"> 6148 6149 <!-- Rapido Css from Website Settings --> 6150 <link rel="stylesheet" id="rapidoCss" href="@autoCssLink" type="text/css"> 6151 6152 <!-- Ignite Css (Custom site specific styles) --> 6153 <link rel="stylesheet" id="igniteCss" type="text/css" href="/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css"> 6154 6155 <!-- Font awesome --> 6156 <link rel="stylesheet" href="@fontAwesomeCssLink" type="text/css"> 6157 6158 <!-- Flag icon --> 6159 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css" type="text/css"> 6160 6161 <!-- CS NT Custom nextech.css--> 6162 <link rel="stylesheet" type="text/css" href="/Files/Templates/Designs/Rapido/css/nextech.css?ticks=@nextechCSSfileInfo.LastWriteTime.Ticks.ToString()"> 6163 6164 <!-- CS NT Custom slick.css--> 6165 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/slick.css" type="text/css"> 6166 6167 <!-- CS NT Custom slick-theme.css--> 6168 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/slick-theme.css" type="text/css"> 6169 6170 <!-- Google fonts --> 6171 @{ 6172 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))); 6173 } 6174 <link href="https://fonts.googleapis.com/css?family=@family" rel="stylesheet"> 6175 @{ 6176 PushPromise(favicon); 6177 PushPromise(fontAwesomeCssLink); 6178 PushPromise("/Files/Templates/Designs/Rapido/css/base/base.min.css"); 6179 PushPromise(autoCssLink); 6180 PushPromise("/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css"); 6181 PushPromise("/Files/Images/placeholder.gif"); 6182 PushPromise("/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css"); 6183 } 6184 6185 @if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName"))) 6186 { 6187 <link rel="manifest" href="/Files/Templates/Designs/Rapido/manifest.json"> 6188 PushPromise("/Files/Templates/Designs/Rapido/manifest.json"); 6189 } 6190 </head> 6191 6192 <body> 6193 6194 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 6195 @RenderBlockList(masterPage.BlocksRoot.BlocksList) 6196 6197 6198 @helper RenderMasterHeader() 6199 { 6200 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterHeader").OrderBy(item => item.SortId).ToList(); 6201 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 6202 string stickyTop = isNavigationStickyMenu ? "top-container--sticky" : ""; 6203 6204 <header class="top-container @stickyTop dw-mod" id="Top"> 6205 @RenderBlockList(subBlocks) 6206 </header> 6207 } 6208 6209 @helper RenderMain() 6210 { 6211 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMain").OrderBy(item => item.SortId).ToList(); 6212 6213 <main class="site dw-mod"> 6214 @RenderBlockList(subBlocks) 6215 </main> 6216 } 6217 6218 @helper RenderPageContent() 6219 { 6220 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 6221 string pagePos = isNavigationStickyMenu ? "js-page-pos" : ""; 6222 6223 <div id="Page" class="page @pagePos"> 6224 <section class="center-container content-container dw-mod" id="content"> 6225 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 6226 6227 6228 @using Dynamicweb.Rapido.Blocks.Components 6229 @using Dynamicweb.Rapido.Blocks.Components.Articles 6230 @using Dynamicweb.Rapido.Blocks.Components.General 6231 @using Dynamicweb.Rapido.Blocks 6232 6233 @functions { 6234 BlocksPage articlePage = BlocksPage.GetBlockPage("BlogArticle"); 6235 } 6236 6237 @{ 6238 string image = !String.IsNullOrEmpty(Model.Item.GetString("Image")) ? Model.Item.GetFile("Image").PathUrlEncoded : ""; 6239 6240 ArticleHeader topBanner = new ArticleHeader 6241 { 6242 Layout = ArticleHeaderLayout.Banner, 6243 Image = new Image { Path = image }, 6244 Heading = Model.Item.GetString("Title"), 6245 Subheading = Model.Item.GetString("Summary"), 6246 TextColor = "#fff", 6247 Category = Model.Item.GetString("Author"), 6248 Date = Model.Item.GetString("Date"), 6249 ButtonLayout = ButtonLayout.Primary, 6250 TextLayout = ArticleHeaderTextLayout.Full 6251 }; 6252 6253 ButtonLayout buttonDesign; 6254 Enum.TryParse<ButtonLayout>(Model.Item.GetString("ButtonDesign"), out buttonDesign); 6255 if (Enum.GetName(typeof(ButtonLayout), buttonDesign).ToLower() == "none") 6256 { 6257 buttonDesign = ButtonLayout.Primary; 6258 } 6259 6260 Block articleContainer = new Block 6261 { 6262 Id = "ArticleContainer", 6263 SortId = 10, 6264 Design = new Design 6265 { 6266 RenderType = RenderType.Row 6267 }, 6268 BlocksList = new List<Block> { 6269 new Block { 6270 Id = "ArticleHeader", 6271 SortId = 20, 6272 Component = topBanner, 6273 Design = new Design { 6274 RenderType = RenderType.Column, 6275 Size = "12", 6276 HidePadding = true, 6277 CssClass = "article-head" 6278 } 6279 }, 6280 new Block { 6281 Id = "ArticleBody", 6282 SortId = 30, 6283 Design = new Design { 6284 RenderType = RenderType.Column, 6285 Size = "8" 6286 }, 6287 BlocksList = new List<Block> { 6288 new Block { 6289 Id = "ArticleBodyRow", 6290 SortId = 10, 6291 Design = new Design { 6292 RenderType = RenderType.Row 6293 }, 6294 BlocksList = new List<Block> { 6295 new Block { 6296 Id = "ArticleText", 6297 SortId = 10, 6298 Component = new ArticleText { Text = Model.Item.GetString("Text") }, 6299 Design = new Design { 6300 RenderType = RenderType.Column, 6301 Size = "12", 6302 CssClass = "u-padding--lg" 6303 } 6304 }, 6305 new Block { 6306 Id = "ArticleLink", 6307 SortId = 20, 6308 Component = new ArticleLink { Link = Model.Item.GetString("Link"), Title = Model.Item.GetString("LinkText"), ButtonLayout = buttonDesign }, 6309 Design = new Design { 6310 RenderType = RenderType.Column, 6311 Size = "12", 6312 CssClass = "u-padding--lg u-ta-right" 6313 } 6314 } 6315 } 6316 } 6317 } 6318 } 6319 } 6320 }; 6321 articlePage.Add(articleContainer); 6322 6323 if (Model.PropertyItem.GetList("ShowBreadcrumb").SelectedValue == "True") 6324 { 6325 Block breadcrumb = new Block 6326 { 6327 Id = "ArticleBreadcrumb", 6328 SortId = 10, 6329 Component = new BreadcrumbNavigation { }, 6330 Design = new Design 6331 { 6332 RenderType = RenderType.Column, 6333 Size = "12" 6334 } 6335 }; 6336 articlePage.Add("ArticleContainer", breadcrumb); 6337 } 6338 } 6339 6340 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 6341 @RenderBlockList(articlePage.BlocksRoot.BlocksList) 6342 6343 </section> 6344 </div> 6345 } 6346 6347 <script> 6348 $(document).ready(function(){ 6349 //CS NT Not used now.. Maybe used in the future to displaying and error anywhere as an alert or a modal 6350 let searchParams = new URLSearchParams(window.location.search); 6351 if (searchParams.has('StockError')) 6352 { 6353 let stockErrorPar = searchParams.get('StockError'); 6354 alert(stockErrorPar); 6355 } 6356 }); 6357 </script> 6358 </body> 6359 </html> 6360 6361