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_29763181659541dda380faf804f47df0.b__149_0(TextWriter __razor_helper_writer) in C:\DW9Staging\Solutions\Files-rapidofull\Templates\Designs\Rapido\_parsed\BlogArticle.parsed.cshtml:line 6358
   at CompiledRazorTemplates.Dynamic.RazorEngine_29763181659541dda380faf804f47df0.<>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_29763181659541dda380faf804f47df0.<>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_29763181659541dda380faf804f47df0.b__147_0(TextWriter __razor_helper_writer) in C:\DW9Staging\Solutions\Files-rapidofull\Templates\Designs\Rapido\_parsed\BlogArticle.parsed.cshtml:line 6249
   at CompiledRazorTemplates.Dynamic.RazorEngine_29763181659541dda380faf804f47df0.<>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_29763181659541dda380faf804f47df0.<>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_29763181659541dda380faf804f47df0.<>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_29763181659541dda380faf804f47df0.<>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_29763181659541dda380faf804f47df0.Execute() in C:\DW9Staging\Solutions\Files-rapidofull\Templates\Designs\Rapido\_parsed\BlogArticle.parsed.cshtml:line 6230
   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 bool DoNotTrackForURL = false; 2826 string currentURL = HttpContext.Current.Request.Url.AbsoluteUri; 2827 //Logger.Instance.Log(ErrorLevel.DebugInfo,"TopSnippets.cshtml URL: " + currentURL); 2828 if (currentURL.Contains("create-user-profile") || currentURL.Contains("existing-customer") || currentURL.Contains("UserManagementForm") || currentURL.Contains("customer") 2829 || currentURL.Contains("FirstName") || currentURL.Contains("First Name") 2830 || currentURL.Contains("LastName") || currentURL.Contains("Last Name") 2831 || currentURL.Contains("DateOfBirth") || currentURL.Contains("Form_Email") 2832 || currentURL.Contains("ID=59") || currentURL.Contains("ID=2227") 2833 || currentURL.Contains("ID=2319") || currentURL.Contains("ID=2320") 2834 || currentURL.Contains("ID=2321") || currentURL.Contains("ID=2322") 2835 || currentURL.Contains("ID=2323") || currentURL.Contains("ID=2324") 2836 || currentURL.Contains("ID=2335") || currentURL.Contains("ID=2336") 2837 || currentURL.Contains("ID=2337") || currentURL.Contains("ID=2338") 2838 || currentURL.Contains("ID=2339") || currentURL.Contains("ID=2340") 2839 || currentURL.Contains("ID=2341") || currentURL.Contains("ID=2342") 2840 || currentURL.Contains("ID=2343") || currentURL.Contains("ID=2344") 2841 || currentURL.Contains("ID=2345") || currentURL.Contains("ID=2346") 2842 || currentURL.Contains("ID=2347") || currentURL.Contains("ID=2348")) 2843 { 2844 DoNotTrackForURL = true; 2845 } 2846 2847 if (!string.IsNullOrWhiteSpace(FacebookPixelID) && !DoNotTrackForURL) 2848 { 2849 <!-- Facebook Pixel Code --> 2850 <script> 2851 !function(f,b,e,v,n,t,s) 2852 {if(f.fbq)return;n=f.fbq=function(){n.callMethod? 2853 n.callMethod.apply(n,arguments):n.queue.push(arguments)}; 2854 if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0'; 2855 n.queue=[];t=b.createElement(e);t.async=!0; 2856 t.src=v;s=b.getElementsByTagName(e)[0]; 2857 s.parentNode.insertBefore(t,s)}(window, document,'script', 2858 'https://connect.facebook.net/en_US/fbevents.js'); 2859 fbq('init', '@FacebookPixelID'); 2860 fbq('track', 'PageView'); 2861 </script> 2862 <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=@FacebookPixelID&ev=PageView&noscript=1" alt="" /></noscript> 2863 } 2864 } 2865 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2866 2867 @using System 2868 @using System.Web 2869 @using System.Collections.Generic 2870 @using Dynamicweb.Rapido.Blocks 2871 @using Dynamicweb.Rapido.Blocks.Extensibility 2872 @using Dynamicweb.Security.UserManagement 2873 @using Dynamicweb.Security.UserManagement.ExternalAuthentication 2874 @{ 2875 BlocksPage loginBlocksPage = BlocksPage.GetBlockPage("Master"); 2876 2877 Block loginModal = new Block() 2878 { 2879 Id = "LoginModal", 2880 SortId = 10, 2881 Template = LoginModal() 2882 }; 2883 2884 loginBlocksPage.Add(MasterBlockId.MasterTopSnippets, loginModal); 2885 } 2886 2887 @helper LoginModal() { 2888 int pageId = Model.TopPage.ID; 2889 pageId = 3;//CS NT Test for rredirect 2890 string userSignedInError = !Model.LogOnFailed ? "" : "checked"; 2891 string userSignedInErrorText = ""; 2892 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 2893 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; 2894 //CS NT int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 2895 int createAccountPageId = GetPageIdByNavigationTag("CreateECommerceAccount"); 2896 2897 if (Model.LogOnFailed) { 2898 switch (Model.LogOnFailedReason) 2899 { 2900 case LogOnFailedReason.PasswordLengthInvalid: 2901 userSignedInErrorText = Translate("Password length is invalid"); 2902 break; 2903 case LogOnFailedReason.IncorrectLogin: 2904 userSignedInErrorText = Translate("Invalid email or password"); 2905 break; 2906 case LogOnFailedReason.ExceededFailedLogOnLimit: 2907 userSignedInErrorText = Translate("You have exceeded the limit of allowed login attempts. The user account is temporarily locked"); 2908 break; 2909 case LogOnFailedReason.LoginLocked: 2910 userSignedInErrorText = Translate("The user account is temporarily locked"); 2911 break; 2912 case LogOnFailedReason.PasswordExpired: 2913 userSignedInErrorText = Translate("The password has expired and needs to be renewed"); 2914 break; 2915 default: 2916 userSignedInErrorText = Translate("An unknown error occured"); 2917 break; 2918 } 2919 } 2920 2921 <!-- Trigger for the login modal --> 2922 <!--CS NT Hide Pop up sign in --> 2923 if (Pageview.Device.ToString() != "Desktop") 2924 { 2925 <input type="checkbox" id="SignInModalTrigger" class="modal-trigger" @userSignedInError /> 2926 } 2927 2928 <!-- Login modal --> 2929 <div class="modal-container"> 2930 <label for="SignInModalTrigger" id="SignInModalOverlay" class="modal-overlay"></label> 2931 <div class="modal modal--xs" id="SignInModal"> 2932 <div class="modal__header"> 2933 <h2>@Translate("Sign in")</h2> 2934 </div> 2935 <div class="modal__body"> 2936 <form method="post" id="LoginForm" class="u-no-margin"> 2937 <input type="hidden" name="ID" value="@pageId" /> 2938 <input type="hidden" name="DWExtranetUsernameRemember" value="True" /> 2939 <input type="hidden" name="DWExtranetPasswordRemember" value="True" /> 2940 <input type="text" class="u-full-width" id="LoginUsername" name="username" placeholder="@Translate("Email")" /> 2941 <input type="password" class="u-full-width" id="LoginPassword" name="password" placeholder="@Translate("Password")" /> 2942 <div class="field-error dw-mod">@userSignedInErrorText</div> 2943 2944 <div class="form__field-group dw-mod"> 2945 <input type="checkbox" id="LoginRememberMe" name="Autologin" checked="checked" value="True" class="form__control"> 2946 <label for="LoginRememberMe"> 2947 @Translate("Remember me", "Remember me") 2948 </label> 2949 </div> 2950 2951 <button type="submit" class="btn btn--primary btn--full dw-mod" name="LoginAction" value="Login" onclick="Buttons.LockButton(event)">@Translate("Sign in")</button> 2952 @{ 2953 ProviderCollection providers = Provider.GetActiveProviders(); 2954 } 2955 2956 @foreach(Provider LoginProvider in providers) 2957 { 2958 var ProviderName = LoginProvider.Name.ToLower(); 2959 <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> 2960 } 2961 2962 <a class="btn btn--link-clean dw-mod" href="@forgotPasswordPageLink">@Translate("Forgot your password?", "Forgot your password?")</a> 2963 2964 <!-- CS NT<a class="btn btn--link-clean dw-mod" href="/default.aspx?ID=@createAccountPageId">@Translate("Create account")?</a> --> 2965 <a class="btn btn--link-clean dw-mod" href="/default.aspx?ID=@createAccountPageId">@Translate("Create account")?</a> 2966 </form> 2967 </div> 2968 </div> 2969 </div> 2970 } 2971 2972 @if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet") 2973 { 2974 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 2975 2976 @using System 2977 @using System.Web 2978 @using System.Collections.Generic 2979 @using Dynamicweb.Rapido.Blocks.Extensibility 2980 @using Dynamicweb.Rapido.Blocks 2981 2982 2983 @functions { 2984 BlocksPage mobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master"); 2985 } 2986 2987 @{ 2988 bool mobileOnlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("mobileOnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 2989 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"; 2990 bool mobileHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 2991 bool mobileHideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart") || mobileOnlyPreview; 2992 2993 Block mobileHeader = new Block() 2994 { 2995 Id = "MobileTop", 2996 SortId = 10, 2997 Template = RenderMobileTop(), 2998 SkipRenderBlocksList = true 2999 }; 3000 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeader); 3001 3002 Block mobileHeaderNavigation = new Block() 3003 { 3004 Id = "MobileHeaderNavigation", 3005 SortId = 10, 3006 Template = RenderMobileHeaderNavigation(), 3007 SkipRenderBlocksList = true, 3008 BlocksList = new List<Block> { 3009 new Block { 3010 Id = "MobileHeaderNavigationTrigger", 3011 SortId = 10, 3012 Template = RenderMobileHeaderNavigationTrigger() 3013 } 3014 } 3015 }; 3016 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderNavigation); 3017 3018 Block mobileHeaderLogo = new Block() 3019 { 3020 Id = "MobileHeaderLogo", 3021 SortId = 20, 3022 Template = RenderMobileHeaderLogo(), 3023 SkipRenderBlocksList = true 3024 }; 3025 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderLogo); 3026 3027 Block mobileHeaderActions = new Block() 3028 { 3029 Id = "MobileHeaderActions", 3030 SortId = 30, 3031 Template = RenderMobileTopActions(), 3032 SkipRenderBlocksList = true 3033 }; 3034 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderActions); 3035 3036 if (mobileHideSearch == false) 3037 { 3038 Block mobileHeaderSearch = new Block 3039 { 3040 Id = "MobileHeaderSearch", 3041 SortId = 10, 3042 Template = RenderMobileTopSearch() 3043 }; 3044 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderSearch); 3045 } 3046 3047 Block mobileHeaderMiniCart; 3048 3049 if (!mobileHideCart) 3050 { 3051 mobileHeaderMiniCart = new Block 3052 { 3053 Id = "MobileHeaderMiniCart", 3054 SortId = 20, 3055 Template = RenderMobileTopMiniCart() 3056 }; 3057 3058 Block miniCartCounterScriptTemplate = new Block 3059 { 3060 Id = "MiniCartCounterScriptTemplate", 3061 Template = RenderMobileMiniCartCounterContent() 3062 }; 3063 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate); 3064 } 3065 else 3066 { 3067 mobileHeaderMiniCart = new Block 3068 { 3069 Id = "MobileHeaderMiniCart", 3070 SortId = 20 3071 }; 3072 } 3073 3074 if (!mobileHideSearch) 3075 { 3076 Block mobileHeaderSearchBar = new Block() 3077 { 3078 Id = "MobileHeaderSearchBar", 3079 SortId = 30, 3080 Template = RenderMobileTopSearchBar() 3081 }; 3082 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeaderSearchBar); 3083 } 3084 3085 switch (mobileTopLayout) 3086 { 3087 case "nav-left": 3088 mobileHeaderNavigation.SortId = 10; 3089 mobileHeaderLogo.SortId = 20; 3090 mobileHeaderActions.SortId = 30; 3091 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart); 3092 break; 3093 case "nav-right": 3094 mobileHeaderLogo.SortId = 10; 3095 mobileHeaderActions.SortId = 20; 3096 mobileHeaderNavigation.SortId = 30; 3097 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart); 3098 break; 3099 case "nav-search-left": 3100 mobileHeaderNavigation.SortId = 10; 3101 mobileHeaderLogo.SortId = 20; 3102 mobileHeaderActions.SortId = 30; 3103 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart); 3104 break; 3105 case "search-left": 3106 mobileHeaderActions.SortId = 10; 3107 mobileHeaderLogo.SortId = 20; 3108 mobileHeaderNavigation.SortId = 30; 3109 mobileHeaderMiniCart.SortId = 0; 3110 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart); 3111 break; 3112 } 3113 3114 if (!mobileOnlyPreview) 3115 { 3116 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", new Block { 3117 Id = "CartInitialization", 3118 Template = RenderMobileCartInitialization() 3119 }); 3120 } 3121 } 3122 3123 @helper RenderMobileCartInitialization() 3124 { 3125 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 3126 <script> 3127 window.cartId = "@miniCartFeedPageId"; 3128 </script> 3129 } 3130 3131 @helper RenderMobileTop() { 3132 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileTop").OrderBy(item => item.SortId).ToList(); 3133 3134 <nav class="main-navigation-mobile dw-mod"> 3135 <div class="center-container top-container__center-container dw-mod"> 3136 <div class="grid grid--align-center"> 3137 @RenderBlockList(subBlocks) 3138 </div> 3139 </div> 3140 </nav> 3141 } 3142 3143 @helper RenderMobileHeaderNavigation() { 3144 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderNavigation").OrderBy(item => item.SortId).ToList(); 3145 3146 <div class="grid__col-auto-width"> 3147 <ul class="menu dw-mod"> 3148 @RenderBlockList(subBlocks) 3149 </ul> 3150 </div> 3151 } 3152 3153 @helper RenderMobileHeaderNavigationTrigger() { 3154 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 3155 <label for="MobileNavTrigger" class="mobile-nav-trigger-button menu__link menu__link--icon menu__link--mobile dw-mod"></label> 3156 </li> 3157 } 3158 3159 @helper RenderMobileHeaderLogo() { 3160 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderLogo").OrderBy(item => item.SortId).ToList(); 3161 3162 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"; 3163 string centeredLogo = mobileTopLayout != "nav-right" ? "u-ta-center" : ""; 3164 string firstPageId = Model.Area.FirstActivePage.ID.ToString(); 3165 string businessName = Model.Area.Item.GetItem("Settings").GetString("BusinessName"); 3166 3167 string mobileLogo = "/Files/Images/logo-dynamicweb.png"; 3168 if (Model.Area.Item.GetItem("Layout").GetItem("MobileTop") != null && Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo") != null) 3169 { 3170 mobileLogo = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo").PathUrlEncoded; 3171 } 3172 3173 if (Path.GetExtension(mobileLogo).ToLower() != ".svg") 3174 { 3175 mobileLogo = "/Admin/Public/GetImage.ashx?height=40&amp;crop=5&amp;Compression=75&amp;image=" + mobileLogo; 3176 } 3177 else 3178 { 3179 mobileLogo = HttpUtility.UrlDecode(mobileLogo); 3180 } 3181 3182 <div class="grid__col-auto grid__col--bleed"> 3183 <div class="grid__cell @centeredLogo"> 3184 <a href="/Default.aspx?ID=@firstPageId" class="logo logo--mobile u-inline-block dw-mod"> 3185 <img class="grid__cell-img logo__img logo__img--mobile dw-mod" src="@mobileLogo" alt="@businessName" /> 3186 </a> 3187 </div> 3188 3189 @RenderBlockList(subBlocks) 3190 </div> 3191 } 3192 3193 @helper RenderMobileTopActions() { 3194 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderActions").OrderBy(item => item.SortId).ToList(); 3195 3196 <div class="grid__col-auto-width"> 3197 <ul class="menu dw-mod"> 3198 @RenderBlockList(subBlocks) 3199 </ul> 3200 </div> 3201 } 3202 3203 @helper RenderMobileTopSearch() { 3204 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 3205 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> 3206 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> 3207 </label> 3208 </li> 3209 } 3210 3211 @helper RenderMobileTopMiniCart() { 3212 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 3213 int cartPageId = GetPageIdByNavigationTag("CartPage"); 3214 double cartProductsCount = Model.Cart.TotalProductsCount; 3215 3216 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod" id="miniCartWrapper"> 3217 <div class="mini-cart dw-mod"> 3218 <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"> 3219 <div class="u-inline u-position-relative"> 3220 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue fa-1_5x"></i> 3221 <div class="mini-cart__counter dw-mod"> 3222 <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"> 3223 <div class="js-mini-cart-counter-content" data-count="@cartProductsCount"> 3224 @cartProductsCount 3225 </div> 3226 </div> 3227 </div> 3228 </div> 3229 </a> 3230 </div> 3231 </li> 3232 } 3233 3234 @helper RenderMobileTopSearchBar() 3235 { 3236 string searchFeedId = ""; 3237 string searchSecondFeedId = ""; 3238 int groupsFeedId; 3239 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 3240 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 3241 string resultPageLink; 3242 string searchPlaceholder; 3243 string searchType = "product-search"; 3244 string searchTemplate; 3245 string searchContentTemplate = ""; 3246 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; 3247 bool showGroups = true; 3248 3249 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch") 3250 { 3251 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 3252 resultPageLink = contentSearchPageLink; 3253 searchPlaceholder = Translate("Search page"); 3254 groupsFeedId = 0; 3255 searchType = "content-search"; 3256 searchTemplate = "SearchPagesTemplate"; 3257 showGroups = false; 3258 } 3259 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch") 3260 { 3261 searchFeedId = productsPageId + "&feed=true"; 3262 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 3263 resultPageLink = Converter.ToString(productsPageId); 3264 searchPlaceholder = Translate("Search products or pages"); 3265 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 3266 searchType = "combined-search"; 3267 searchTemplate = "SearchProductsTemplateWrap"; 3268 searchContentTemplate = "SearchPagesTemplateWrap"; 3269 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 3270 } 3271 else 3272 { 3273 resultPageLink = Converter.ToString(productsPageId); 3274 searchFeedId = productsPageId + "&feed=true"; 3275 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 3276 searchPlaceholder = Translate("Search products"); 3277 searchTemplate = "SearchProductsTemplate"; 3278 searchType = "product-search"; 3279 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 3280 } 3281 3282 3283 <input type="checkbox" id="MobileSearchTrigger" class="mobile-search-trigger" /> 3284 3285 <div class="main-navigation-mobile typeahead-mobile dw-mod"> 3286 <div class="center-container top-container__center-container dw-mod"> 3287 <div class="grid"> 3288 <div class="grid__col-auto"> 3289 <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"> 3290 <input type="text" class="js-typeahead-search-field u-w160px u-no-margin" placeholder="@searchPlaceholder" value="@searchValue"> 3291 @if (string.IsNullOrEmpty(searchSecondFeedId)) 3292 { 3293 <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> 3294 } 3295 else 3296 { 3297 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--combined-mobile grid"> 3298 <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> 3299 <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> 3300 </div> 3301 } 3302 <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> 3303 </div> 3304 </div> 3305 <div class="grid__col-auto-width"> 3306 <ul class="menu dw-mod"> 3307 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 3308 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> 3309 <i class="fas fa-times fa-1_5x"></i> 3310 </label> 3311 </li> 3312 </ul> 3313 </div> 3314 </div> 3315 </div> 3316 </div> 3317 } 3318 3319 @helper RenderMobileMiniCartCounterContent() 3320 { 3321 <script id="MiniCartCounterContent" type="text/x-template"> 3322 {{#.}} 3323 <div class="js-mini-cart-counter-content dw-mod" data-count="{{numberofproducts}}"> 3324 {{numberofproducts}} 3325 </div> 3326 {{/.}} 3327 </script> 3328 }</text> 3329 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3330 3331 @using System 3332 @using System.Web 3333 @using System.Collections.Generic 3334 @using Dynamicweb.Rapido.Blocks.Extensibility 3335 @using Dynamicweb.Rapido.Blocks 3336 3337 @functions { 3338 BlocksPage mobileNavigationBlocksPage = BlocksPage.GetBlockPage("Master"); 3339 } 3340 3341 @{ 3342 bool mobileNavigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 3343 bool mobileHideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); 3344 bool mobileHideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); 3345 bool mobileHideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); 3346 bool mobileHideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); 3347 bool mobileHideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); 3348 3349 Block mobileNavigation = new Block() 3350 { 3351 Id = "MobileNavigation", 3352 SortId = 10, 3353 Template = MobileNavigation(), 3354 SkipRenderBlocksList = true 3355 }; 3356 mobileNavigationBlocksPage.Add(MasterBlockId.MasterTopSnippets, mobileNavigation); 3357 3358 if (Model.CurrentUser.ID > 0 && !mobileHideMyProfileLink) 3359 { 3360 Block mobileNavigationSignIn = new Block 3361 { 3362 Id = "MobileNavigationSignIn", 3363 SortId = 10, 3364 Template = RenderMobileNavigationSignIn() 3365 }; 3366 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationSignIn); 3367 } 3368 3369 Block mobileNavigationMenu = new Block 3370 { 3371 Id = "MobileNavigationMenu", 3372 SortId = 20, 3373 Template = RenderMobileNavigationMenu() 3374 }; 3375 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationMenu); 3376 3377 Block mobileNavigationActions = new Block 3378 { 3379 Id = "MobileNavigationActions", 3380 SortId = 30, 3381 Template = RenderMobileNavigationActions(), 3382 SkipRenderBlocksList = true 3383 }; 3384 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationActions); 3385 3386 if (!mobileNavigationItemsHideSignIn) 3387 { 3388 if (Model.CurrentUser.ID <= 0) 3389 { 3390 Block mobileNavigationSignInAction = new Block 3391 { 3392 Id = "MobileNavigationSignInAction", 3393 SortId = 10, 3394 Template = RenderMobileNavigationSignInAction() 3395 }; 3396 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignInAction); 3397 3398 if (!mobileHideCreateAccountLink) 3399 { 3400 Block mobileNavigationCreateAccountAction = new Block 3401 { 3402 Id = "MobileNavigationCreateAccountAction", 3403 SortId = 20, 3404 Template = RenderMobileNavigationCreateAccountAction() 3405 }; 3406 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationCreateAccountAction); 3407 } 3408 } 3409 else 3410 { 3411 //CS NT Show 'My Account' 3412 Block mobileNavigationMyAccount = new Block 3413 { 3414 Id = "MobileNavigationMyAccount", 3415 SortId = 19, 3416 Template = RenderMobileNavigationMyAccount() 3417 }; 3418 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationMyAccount); 3419 3420 3421 if (!mobileHideMyOrdersLink) 3422 { 3423 Block mobileNavigationOrdersAction = new Block 3424 { 3425 Id = "MobileNavigationOrdersAction", 3426 SortId = 20, 3427 Template = RenderMobileNavigationOrdersAction() 3428 }; 3429 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationOrdersAction); 3430 } 3431 if (!mobileHideMyFavoritesLink) 3432 { 3433 Block mobileNavigationFavoritesAction = new Block 3434 { 3435 Id = "MobileNavigationFavoritesAction", 3436 SortId = 30, 3437 Template = RenderMobileNavigationFavoritesAction() 3438 }; 3439 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationFavoritesAction); 3440 } 3441 if (!mobileHideMySavedCardsLink) 3442 { 3443 Block mobileNavigationSavedCardsAction = new Block 3444 { 3445 Id = "MobileNavigationFavoritesAction", 3446 SortId = 30, 3447 Template = RenderMobileNavigationSavedCardsAction() 3448 }; 3449 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSavedCardsAction); 3450 } 3451 3452 Block mobileNavigationSignOutAction = new Block 3453 { 3454 Id = "MobileNavigationSignOutAction", 3455 SortId = 40, 3456 Template = RenderMobileNavigationSignOutAction() 3457 }; 3458 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignOutAction); 3459 } 3460 } 3461 3462 /*CS NT Hide for now 3463 if (Model.Languages.Count > 1) 3464 { 3465 Block mobileNavigationLanguagesAction = new Block 3466 { 3467 Id = "MobileNavigationLanguagesAction", 3468 SortId = 50, 3469 Template = RenderMobileNavigationLanguagesAction() 3470 }; 3471 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationLanguagesAction); 3472 } 3473 */ 3474 } 3475 3476 3477 @helper MobileNavigation() 3478 { 3479 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigation").OrderBy(item => item.SortId).ToList(); 3480 string mobileTopDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design") != null ? Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design").SelectedValue : "nav-left"; 3481 string position = mobileTopDesign == "nav-left" || mobileTopDesign == "nav-search-left" ? "left" : "right"; 3482 3483 <!-- Trigger for mobile navigation --> 3484 <input type="checkbox" id="MobileNavTrigger" class="mobile-nav-trigger mobile-nav-trigger--@position" autocomplete="off" /> 3485 3486 <!-- Mobile navigation --> 3487 <nav class="mobile-navigation mobile-navigation--@position dw-mod"> 3488 <div class="mobile-navigation__wrapper" id="mobileNavigationWrapper"> 3489 @RenderBlockList(subBlocks) 3490 </div> 3491 </nav> 3492 3493 <label class="mobile-nav-trigger-off" for="MobileNavTrigger"></label> 3494 } 3495 3496 @helper RenderMobileNavigationSignIn() 3497 { 3498 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 3499 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 3500 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 3501 string myProfilePageLink = linkStart + myProfilePageId; 3502 string userName = Model.CurrentUser.FirstName ?? ""; 3503 userName += " " + (Model.CurrentUser.LastName ?? ""); 3504 userName += userName == "" && Model.CurrentUser.UserName != null ? Model.CurrentUser.UserName : ""; 3505 3506 <ul class="menu menu-mobile"> 3507 <li class="menu-mobile__item"> 3508 <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> 3509 </li> 3510 </ul> 3511 } 3512 3513 @helper RenderMobileNavigationMenu() 3514 { 3515 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides"; 3516 string menuTemplate = isSlidesDesign ? "BaseMenuForMobileSlides.xslt" : "BaseMenuForMobileExpandable.xslt"; 3517 string levels = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels") : "3"; 3518 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 3519 int startLevel = renderPagesInToolBar ? 1 : 0; 3520 3521 @RenderNavigation(new 3522 { 3523 id = "mobilenavigation", 3524 cssclass = "menu menu-mobile dwnavigation", 3525 startLevel = @startLevel, 3526 ecomStartLevel = @startLevel + 1, 3527 endlevel = @levels, 3528 expandmode = "all", 3529 template = @menuTemplate 3530 }) 3531 3532 if (isSlidesDesign) 3533 { 3534 <script> 3535 function goToLevel(level) { 3536 document.getElementById('mobileNavigationWrapper').style.left = -(level * 100) + "%"; 3537 } 3538 3539 document.addEventListener('DOMContentLoaded', function () { 3540 goToLevel(document.getElementById('mobileNavigationWrapper').querySelectorAll('input[type=radio]:checked').length); 3541 }); 3542 </script> 3543 } 3544 3545 if (renderPagesInToolBar) 3546 { 3547 @RenderNavigation(new 3548 { 3549 id = "topToolsMobileNavigation", 3550 cssclass = "menu menu-mobile dwnavigation", 3551 template = "ToolsMenuForMobile.xslt" 3552 }) 3553 } 3554 } 3555 3556 @helper RenderMobileNavigationActions() 3557 { 3558 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigationActions").OrderBy(item => item.SortId).ToList(); ; 3559 3560 <ul class="menu menu-mobile"> 3561 @RenderBlockList(subBlocks) 3562 </ul> 3563 } 3564 3565 @helper RenderMobileNavigationSignInAction() 3566 { 3567 <li class="menu-mobile__item"> 3568 <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> 3569 </li> 3570 } 3571 3572 @helper RenderMobileNavigationCreateAccountAction() 3573 { 3574 //CS NT int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 3575 int createAccountPageId = GetPageIdByNavigationTag("CreateECommerceAccount"); 3576 3577 <li class="menu-mobile__item"> 3578 <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> 3579 </li> 3580 } 3581 3582 @helper RenderMobileNavigationProfileAction() 3583 { 3584 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 3585 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 3586 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 3587 string myProfilePageLink = linkStart + myProfilePageId; 3588 3589 <li class="menu-mobile__item"> 3590 <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> 3591 </li> 3592 } 3593 3594 @helper RenderMobileNavigationMyAccount() 3595 { 3596 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 3597 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 3598 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 3599 string myProfilePageLink = linkStart + myProfilePageId; 3600 3601 <li class="menu-mobile__item"> 3602 <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> 3603 </li> 3604 } 3605 3606 @helper RenderMobileNavigationOrdersAction() 3607 { 3608 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 3609 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 3610 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); 3611 string myOrdersPageLink = linkStart + myOrdersPageId; 3612 string ordersIcon = "fas fa-list"; 3613 3614 <li class="menu-mobile__item"> 3615 <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> 3616 </li> 3617 } 3618 3619 @helper RenderMobileNavigationFavoritesAction() 3620 { 3621 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 3622 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 3623 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 3624 string myFavoritesPageLink = linkStart + myFavoritesPageId; 3625 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"; 3626 3627 3628 <li class="menu-mobile__item"> 3629 <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> 3630 </li> 3631 } 3632 3633 @helper RenderMobileNavigationSavedCardsAction() 3634 { 3635 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 3636 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 3637 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards"); 3638 string mySavedCardsPageLink = linkStart + mySavedCardsPageId; 3639 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"; 3640 3641 <li class="menu-mobile__item"> 3642 <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> 3643 </li> 3644 } 3645 3646 @helper RenderMobileNavigationSignOutAction() 3647 { 3648 int pageId = Model.TopPage.ID; 3649 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"; 3650 3651 <li class="menu-mobile__item"> 3652 <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> 3653 </li> 3654 } 3655 3656 @helper RenderMobileNavigationLanguagesAction() 3657 { 3658 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides"; 3659 3660 string selectedLanguage = ""; 3661 foreach (var lang in Model.Languages) 3662 { 3663 if (lang.IsCurrent) 3664 { 3665 selectedLanguage = lang.Name; 3666 } 3667 } 3668 3669 <li class="menu-mobile__item dw-mod"> 3670 @if (isSlidesDesign) 3671 { 3672 <input id="MobileMenuCheck_Language" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(1);"> 3673 } 3674 else 3675 { 3676 <input id="MobileMenuCheck_Language" type="checkbox" class="expand-trigger"> 3677 } 3678 <div class="menu-mobile__link__wrap"> 3679 <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> 3680 <label for="MobileMenuCheck_Language" class="menu-mobile__trigger"></label> 3681 </div> 3682 <ul class="menu-mobile menu-mobile__submenu expand-menu"> 3683 @if (isSlidesDesign) 3684 { 3685 <li class="menu-mobile__item dw-mod"> 3686 <div class="menu-mobile__link__wrap"> 3687 <input id="MobileMenuCheck_Language_back" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(0);" /> 3688 <label for="MobileMenuCheck_Language_back" class="menu-mobile__trigger menu-mobile__trigger--back"></label> 3689 <label for="MobileMenuCheck_Language_back" class="menu-mobile__link dw-mod ">@Translate("Back")</label> 3690 </div> 3691 </li> 3692 } 3693 @foreach (var lang in Model.Languages) 3694 { 3695 <li class="menu-mobile__item dw-mod"> 3696 <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> 3697 </li> 3698 } 3699 </ul> 3700 </li> 3701 }</text> 3702 } 3703 else 3704 { 3705 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3706 3707 @using System 3708 @using System.Web 3709 @using System.Collections.Generic 3710 @using Dynamicweb.Rapido.Blocks.Extensibility 3711 @using Dynamicweb.Rapido.Blocks 3712 3713 @functions { 3714 BlocksPage headerBlocksPage = BlocksPage.GetBlockPage("Master"); 3715 } 3716 3717 @{ 3718 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 3719 { 3720 Block masterTools = new Block() 3721 { 3722 Id = "MasterDesktopTools", 3723 SortId = 10, 3724 Template = RenderDesktopTools(), 3725 SkipRenderBlocksList = true, 3726 BlocksList = new List<Block> 3727 { 3728 new Block { 3729 Id = "MasterDesktopToolsText", 3730 SortId = 10, 3731 Template = RenderDesktopToolsText(), 3732 Design = new Design 3733 { 3734 Size = "auto", 3735 HidePadding = true, 3736 RenderType = RenderType.Column 3737 } 3738 }, 3739 new Block { 3740 Id = "MasterDesktopToolsNavigation", 3741 SortId = 20, 3742 Template = RenderDesktopToolsNavigation(), 3743 Design = new Design 3744 { 3745 Size = "auto-width", 3746 HidePadding = true, 3747 RenderType = RenderType.Column 3748 } 3749 } 3750 } 3751 }; 3752 headerBlocksPage.Add("MasterHeader", masterTools); 3753 } 3754 3755 Block masterDesktopExtra = new Block() 3756 { 3757 Id = "MasterDesktopExtra", 3758 SortId = 10, 3759 Template = RenderDesktopExtra(), 3760 SkipRenderBlocksList = true 3761 }; 3762 headerBlocksPage.Add("MasterHeader", masterDesktopExtra); 3763 3764 Block masterDesktopNavigation = new Block() 3765 { 3766 Id = "MasterDesktopNavigation", 3767 SortId = 20, 3768 Template = RenderDesktopNavigation(), 3769 SkipRenderBlocksList = true 3770 }; 3771 headerBlocksPage.Add("MasterHeader", masterDesktopNavigation); 3772 } 3773 3774 3775 @*Include the Blocks for the page *@ 3776 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3777 3778 @using System 3779 @using System.Web 3780 @using Dynamicweb.Rapido.Blocks.Extensibility 3781 @using Dynamicweb.Rapido.Blocks 3782 3783 @{ 3784 Block masterDesktopLogo = new Block 3785 { 3786 Id = "MasterDesktopLogo", 3787 SortId = 10, 3788 Template = RenderDesktopLogo(), 3789 Design = new Design 3790 { 3791 Size = "auto-width", 3792 HidePadding = true, 3793 RenderType = RenderType.Column, 3794 CssClass = "grid--align-self-center" 3795 } 3796 }; 3797 3798 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopLogo); 3799 } 3800 3801 3802 @helper RenderDesktopLogo() 3803 { 3804 string firstPageId = Model.Area.FirstActivePage.ID.ToString(); 3805 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 3806 string alignClass = topLayout == "two-lines-centered" || topLayout == "two-lines" ? "grid--align-self-center" : ""; 3807 string logo = Model.Area.Item.GetItem("Layout").GetFile("LogoImage") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoImage").PathUrlEncoded : "/Files/Images/logo-dynamicweb.png"; 3808 if (Path.GetExtension(logo).ToLower() != ".svg") 3809 { 3810 int logoHeight = Model.Area.Item.GetItem("Layout").GetInt32("LogoHeight"); 3811 logoHeight = logoHeight > 0 && Pageview.Device.ToString() != "Mobile" ? logoHeight : 40; 3812 logo = "/Admin/Public/GetImage.ashx?height=" + Converter.ToString(logoHeight) + "&amp;crop=5&amp;Compression=75&amp;image=" + logo; 3813 } 3814 else 3815 { 3816 logo = HttpUtility.UrlDecode(logo); 3817 } 3818 3819 <div class="logo @alignClass dw-mod"> 3820 <a href="/Default.aspx?ID=@firstPageId" class="logo__img dw-mod u-block"> 3821 <img class="grid__cell-img logo__img dw-mod" src="@logo" alt="@Translate("Logo")" /> 3822 </a> 3823 </div> 3824 } 3825 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3826 3827 @using System 3828 @using System.Web 3829 @using Dynamicweb.Rapido.Blocks.Extensibility 3830 @using Dynamicweb.Rapido.Blocks 3831 3832 @functions { 3833 bool isMegaMenu; 3834 } 3835 3836 @{ 3837 isMegaMenu = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu") != null ? Converter.ToBoolean(Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu").SelectedValue) : false; 3838 Block masterDesktopMenu = new Block 3839 { 3840 Id = "MasterDesktopMenu", 3841 SortId = 10, 3842 Template = RenderDesktopMenu(), 3843 Design = new Design 3844 { 3845 Size = "auto", 3846 HidePadding = true, 3847 RenderType = RenderType.Column 3848 } 3849 }; 3850 3851 if (isMegaMenu) 3852 { 3853 masterDesktopMenu.Design.CssClass = "u-reset-position"; 3854 } 3855 3856 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopMenu); 3857 } 3858 3859 @helper RenderDesktopMenu() 3860 { 3861 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 3862 string menuAlignment = topLayout == "minimal-right" ? "grid--align-self-end" : ""; 3863 string megamenuPromotionImage = Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage").PathUrlEncoded : ""; 3864 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 3865 bool showOnlyHeaders = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowOnlyHeaders"); 3866 int startLevel = renderPagesInToolBar ? 1 : 0; 3867 3868 string promotionLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("MegamenuPromotionLink"); 3869 3870 <div class="grid__cell u-flex @(isMegaMenu ? "u-reset-position" : "") @menuAlignment"> 3871 @if (!isMegaMenu) 3872 { 3873 @RenderNavigation(new 3874 { 3875 id = "topnavigation", 3876 cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap", 3877 startLevel = startLevel, 3878 ecomStartLevel = startLevel + 1, 3879 endlevel = 5, 3880 expandmode = "all", 3881 template = "BaseMenuWithDropdown.xslt" 3882 }); 3883 } 3884 else 3885 { 3886 @RenderNavigation(new 3887 { 3888 id = "topnavigation", 3889 cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap", 3890 startLevel = startLevel, 3891 ecomStartLevel = startLevel + 1, 3892 endlevel = 5, 3893 promotionImage = megamenuPromotionImage, 3894 promotionLink = promotionLink, 3895 expandmode = "all", 3896 showOnlyHeaders = showOnlyHeaders.ToString().ToLower(), 3897 template = "BaseMegaMenu.xslt" 3898 }); 3899 } 3900 </div> 3901 } 3902 3903 3904 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3905 3906 @using System 3907 @using System.Web 3908 @using Dynamicweb.Rapido.Blocks.Extensibility 3909 @using Dynamicweb.Rapido.Blocks 3910 3911 @{ 3912 Block masterDesktopActionsMenu = new Block 3913 { 3914 Id = "MasterDesktopActionsMenu", 3915 SortId = 10, 3916 Template = RenderDesktopActionsMenu(), 3917 Design = new Design 3918 { 3919 CssClass = "u-flex" 3920 }, 3921 SkipRenderBlocksList = true 3922 3923 }; 3924 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopActionsMenu); 3925 3926 if (!string.IsNullOrWhiteSpace(Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink"))) 3927 { 3928 Block masterDesktopActionsHeaderButton = new Block 3929 { 3930 Id = "MasterDesktopActionsHeaderButton", 3931 SortId = 60, 3932 Template = RenderHeaderButton() 3933 }; 3934 masterDesktopActionsMenu.Add(masterDesktopActionsHeaderButton); 3935 } 3936 } 3937 3938 @helper RenderDesktopActionsMenu() 3939 { 3940 List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopActionsMenu").OrderBy(item => item.SortId).ToList(); 3941 3942 <ul class="menu u-flex dw-mod"> 3943 @RenderBlockList(subBlocks) 3944 </ul> 3945 } 3946 3947 @helper RenderHeaderButton() 3948 { 3949 string headerButtonText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonText"); 3950 string headerButtonLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink"); 3951 string headerButtonType = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType") != null ? "btn--" + Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType").SelectedName.ToLower() : ""; 3952 3953 <li class="menu__item menu__item--horizontal menu--clean dw-mod"> 3954 <a class="btn @headerButtonType dw-mod u-no-margin u-margin-top u-margin-left" href="@headerButtonLink">@headerButtonText</a> 3955 </li> 3956 } 3957 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3958 3959 @using System 3960 @using System.Web 3961 @using Dynamicweb.Core; 3962 @using System.Text.RegularExpressions 3963 @using Dynamicweb.Rapido.Blocks.Extensibility 3964 @using Dynamicweb.Rapido.Blocks 3965 3966 @{ 3967 //CS NT Hide this for now 20210303 3968 Block masterDesktopActionsMenuLanguageSelector = new Block 3969 { 3970 Id = "MasterDesktopActionsMenuLanguageSelector", 3971 SortId = 40, 3972 Template = RenderLanguageSelector() 3973 }; 3974 3975 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuLanguageSelector); 3976 3977 } 3978 3979 @helper RenderLanguageSelector() 3980 { 3981 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 3982 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 3983 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 3984 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() : ""; 3985 3986 if (Model.Languages.Count > 1) 3987 { 3988 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon is-dropdown is-dropdown--no-icon dw-mod"> 3989 <div class="@menuLinkClass dw-mod"> 3990 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue fa-1_5x"></i> 3991 </div> 3992 <div class="menu menu--dropdown menu--dropdown-right languages-dropdown dw-mod grid__cell"> 3993 @foreach (var lang in Model.Languages) 3994 { 3995 string langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " u-margin-right\"></span>" + lang.Name; 3996 string cultureName = Regex.Replace(Dynamicweb.Services.Areas.GetArea(lang.ID).CultureInfo.NativeName, @" ?\(.*?\)", string.Empty); 3997 cultureName = char.ToUpper(cultureName[0]) + cultureName.Substring(1); 3998 3999 if (languageViewType == "flag-culture") 4000 { 4001 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span> " + cultureName; 4002 } 4003 4004 if (languageViewType == "flag") 4005 { 4006 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span>"; 4007 } 4008 4009 if (languageViewType == "name") 4010 { 4011 langInfo = lang.Name; 4012 } 4013 4014 if (languageViewType == "culture") 4015 { 4016 langInfo = cultureName; 4017 } 4018 4019 <div class="menu__item dw-mod menu__item--fixed-width"> 4020 <a href="/Default.aspx?AreaID=@Dynamicweb.Services.Pages.GetPage(lang.Page.ID).Area.ID" class="menu-dropdown__link dw-mod">@langInfo</a> 4021 </div> 4022 } 4023 </div> 4024 </li> 4025 } 4026 } 4027 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4028 4029 @using System 4030 @using System.Web 4031 @using Dynamicweb.Rapido.Blocks.Extensibility 4032 @using Dynamicweb.Rapido.Blocks 4033 4034 @{ 4035 Block masterDesktopActionsMenuSignIn = new Block 4036 { 4037 Id = "MasterDesktopActionsMenuSignIn", 4038 SortId = 20, 4039 Template = RenderSignIn() 4040 }; 4041 4042 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuSignIn); 4043 } 4044 4045 @helper RenderSignIn() 4046 { 4047 bool navigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 4048 string userInitials = ""; 4049 int pageId = Model.TopPage.ID; 4050 //CS NT int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 4051 int createAccountPageId = GetPageIdByNavigationTag("CreateECommerceAccount"); 4052 int myDashboardPageId = GetPageIdByNavigationTag("CustomerDashboard"); 4053 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 4054 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); 4055 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 4056 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards"); 4057 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 4058 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); 4059 bool hideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); 4060 bool hideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); 4061 bool hideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); 4062 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); 4063 bool hideForgotPasswordLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideForgotPasswordLink"); 4064 4065 string linkStart = "/Default.aspx?ID="; 4066 if (Model.CurrentUser.ID <= 0) 4067 { 4068 linkStart += signInProfilePageId + "&RedirectPageId="; 4069 } 4070 4071 4072 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; 4073 string myProfilePageLink = linkStart + myProfilePageId; 4074 string myOrdersPageLink = linkStart + myOrdersPageId; 4075 string myFavoritesPageLink = linkStart + myFavoritesPageId; 4076 string mySavedCardsPageLink = linkStart + mySavedCardsPageId; 4077 4078 string profileIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue : "fa fa-user"; 4079 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"; 4080 4081 if (Model.CurrentUser.ID != 0) 4082 { 4083 if (!String.IsNullOrEmpty(Model.CurrentUser.Name)) 4084 { 4085 string[] names = Model.CurrentUser.Name.Trim().Split(' '); 4086 userInitials += Model.CurrentUser.Name.Substring(0, 1); 4087 4088 if (names.Length > 1) 4089 { 4090 userInitials += names[names.Length - 1].Substring(0, 1); 4091 } 4092 } 4093 else 4094 { 4095 userInitials += Model.CurrentUser.FirstName != null && Model.CurrentUser.FirstName != "" ? Model.CurrentUser.FirstName.Substring(0, 1) : ""; 4096 userInitials += Model.CurrentUser.LastName != null && Model.CurrentUser.LastName != "" ? Model.CurrentUser.LastName.Substring(0, 1) : ""; 4097 userInitials += userInitials.Length == 1 && Model.CurrentUser.FirstName != null && Model.CurrentUser.FirstName.Length > 1 ? Model.CurrentUser.FirstName.Substring(1, 2) : ""; 4098 userInitials += userInitials == "" && Model.CurrentUser.Email != null && Model.CurrentUser.Email.Length > 1 ? Model.CurrentUser.Email.Substring(0, 2) : ""; 4099 userInitials += userInitials == "" ? Model.CurrentUser.UserName.Substring(0, 2) : ""; 4100 } 4101 } 4102 4103 if (!navigationItemsHideSignIn) 4104 { 4105 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4106 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu__item--clean"; 4107 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4108 4109 <li class="menu__item menu__item--horizontal menu__item menu__item--icon @liClasses is-dropdown is-dropdown--no-icon dw-mod"> 4110 <div class="@menuLinkClass dw-mod"> 4111 @if (Model.CurrentUser.ID <= 0) 4112 { 4113 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue fa-1_5x"></i> 4114 } 4115 else 4116 { 4117 <!--<a href="/default.aspx?ID=@myDashboardPageId" class="u-color-inherit"><div class="circle-icon-btn">@userInitials.ToUpper()</div></a>--> 4118 <a href="/@myProfilePageLink" class="u-color-inherit"><div class="circle-icon-btn">@userInitials.ToUpper()</div></a> 4119 } 4120 </div> 4121 <div class="menu menu--dropdown menu--dropdown-right menu--sign-in grid__cell dw-mod"> 4122 <ul class="list list--clean dw-mod"> 4123 @if (Model.CurrentUser.ID <= 0) 4124 { 4125 <li> 4126 <a class="btn btn--primary btn--full u-no-margin sign-in-modal-trigger-button dw-mod" href="/createecommerceaccount">@Translate("Sign in")</a> 4127 <!--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>--> 4128 </li> 4129 4130 if (!hideCreateAccountLink) 4131 { 4132 @RenderListItem("/default.aspx?ID=" + createAccountPageId, Translate("Create account")); 4133 } 4134 if (!hideForgotPasswordLink) 4135 { 4136 @RenderListItem(forgotPasswordPageLink, Translate("Forgot your password?")) 4137 } 4138 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) 4139 { 4140 @RenderSeparator() 4141 } 4142 } 4143 @if (!hideMyProfileLink) 4144 { 4145 @RenderListItem(myProfilePageLink, Translate("My Profile"), profileIcon) 4146 } 4147 @if (!hideMyOrdersLink) 4148 { 4149 @RenderListItem(myOrdersPageLink, Translate("My Orders"), "fas fa-list") 4150 } 4151 @if (!hideMyFavoritesLink) 4152 { 4153 @RenderListItem(myFavoritesPageLink, Translate("My Favorites"), favoritesIcon) 4154 } 4155 @if (!hideMySavedCardsLink) 4156 { 4157 @RenderListItem(mySavedCardsPageLink, Translate("My Saved cards"), "fas fa-credit-card") 4158 } 4159 @if (Model.CurrentUser.ID > 0) 4160 { 4161 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) 4162 { 4163 @RenderSeparator() 4164 } 4165 4166 @RenderListItem("/Admin/Public/ExtranetLogoff.aspx?ID=" + pageId, Translate("Sign out")) 4167 } 4168 </ul> 4169 </div> 4170 </li> 4171 } 4172 } 4173 4174 @helper RenderListItem(string link, string text, string icon = null) { 4175 <li> 4176 <a href="@link" class="list__link dw-mod"> 4177 @if (!string.IsNullOrEmpty(icon)) 4178 { 4179 <i class="@icon u-margin-right"></i> 4180 } 4181 @text 4182 </a> 4183 </li> 4184 } 4185 4186 @helper RenderSeparator() 4187 { 4188 <li class="list__seperator dw-mod"></li> 4189 } 4190 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4191 4192 @using System 4193 @using System.Web 4194 @using Dynamicweb.Rapido.Blocks.Extensibility 4195 @using Dynamicweb.Rapido.Blocks 4196 4197 @{ 4198 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideFavorites"); 4199 4200 Block masterDesktopActionsMenuFavorites = new Block 4201 { 4202 Id = "MasterDesktopActionsMenuFavorites", 4203 SortId = 30, 4204 Template = RenderFavorites() 4205 }; 4206 4207 if (!hideMyFavoritesLink && Model.CurrentUser.ID > 0) 4208 { 4209 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuFavorites); 4210 } 4211 } 4212 4213 @helper RenderFavorites() 4214 { 4215 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 4216 string myFavoritesPageLink = "/Default.aspx?ID=" + myFavoritesPageId; 4217 4218 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4219 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 4220 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4221 4222 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod"> 4223 <a href="@myFavoritesPageLink" class="@menuLinkClass dw-mod"> 4224 <i class="fas fa-@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue fa-1_5x"></i> 4225 </a> 4226 </li> 4227 } 4228 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4229 4230 @using System 4231 @using System.Web 4232 @using Dynamicweb.Rapido.Blocks.Extensibility 4233 @using Dynamicweb.Rapido.Blocks 4234 4235 @{ 4236 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 4237 bool hideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 4238 string miniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown"; 4239 4240 if (!onlyPreview && !hideCart) 4241 { 4242 Block masterDesktopActionsMenuMiniCart = new Block 4243 { 4244 Id = "MasterDesktopActionsMenuMiniCart", 4245 SortId = 50, 4246 Template = RenderMiniCart(miniCartLayout == "dropdown"), 4247 SkipRenderBlocksList = true, 4248 BlocksList = new List<Block>() 4249 }; 4250 4251 Block miniCartCounterScriptTemplate = new Block 4252 { 4253 Id = "MiniCartCounterScriptTemplate", 4254 Template = RenderMiniCartCounterContent() 4255 }; 4256 4257 //dropdown layout is default 4258 RazorEngine.Templating.TemplateWriter layoutTemplate = RenderMiniCartDropdownLayout(); 4259 RazorEngine.Templating.TemplateWriter miniCartTriggerTemplate = RenderMiniCartTriggerLink(); 4260 4261 switch (miniCartLayout) 4262 { 4263 case "panel": 4264 layoutTemplate = RenderMiniCartPanelLayout(); 4265 miniCartTriggerTemplate = RenderMiniCartTriggerLabel(); 4266 break; 4267 case "modal": 4268 layoutTemplate = RenderMiniCartModalLayout(); 4269 miniCartTriggerTemplate = RenderMiniCartTriggerLabel(); 4270 break; 4271 } 4272 4273 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block 4274 { 4275 Id = "MiniCartTrigger", 4276 Template = miniCartTriggerTemplate 4277 }); 4278 4279 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 4280 { 4281 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block 4282 { 4283 Id = "MiniCartLayout", 4284 Template = layoutTemplate 4285 }); 4286 } 4287 4288 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuMiniCart); 4289 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate); 4290 } 4291 } 4292 4293 @helper RenderMiniCart(bool hasMouseEnterEvent) 4294 { 4295 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterDesktopActionsMenuMiniCart").OrderBy(item => item.SortId).ToList(); 4296 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4297 string liClasses = topLayout != "normal" ? "menu__item--top-level" : "menu--clean"; 4298 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4299 string mouseEvent = ""; 4300 string id = "MiniCart"; 4301 if (hasMouseEnterEvent) 4302 { 4303 mouseEvent = "onmouseenter=\"Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=" + miniCartFeedPageId + "&feedType=MiniCart')\""; 4304 id = "miniCartTrigger"; 4305 } 4306 <li class="menu__item menu__item--horizontal menu__item--icon @liClasses dw-mod" id="@id" @mouseEvent> 4307 @RenderBlockList(subBlocks) 4308 </li> 4309 } 4310 4311 @helper RenderMiniCartTriggerLabel() 4312 { 4313 int cartPageId = GetPageIdByNavigationTag("CartPage"); 4314 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart"; 4315 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4316 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4317 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4318 4319 <div class="@menuLinkClass dw-mod js-mini-cart-button" onclick="Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart')"> 4320 <div class="u-inline u-position-relative"> 4321 <i class="@cartIcon fa-1_5x"></i> 4322 @RenderMiniCartCounter() 4323 </div> 4324 </div> 4325 } 4326 4327 @helper RenderMiniCartTriggerLink() 4328 { 4329 int cartPageId = GetPageIdByNavigationTag("CartPage"); 4330 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart"; 4331 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4332 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4333 4334 <a href="/Default.aspx?ID=@cartPageId&Purge=True" class="@menuLinkClass menu__item--icon dw-mod js-mini-cart-button"> 4335 <div class="u-inline u-position-relative"> 4336 <i class="@cartIcon fa-1_5x"></i> 4337 @RenderMiniCartCounter() 4338 </div> 4339 </a> 4340 } 4341 4342 @helper RenderMiniCartCounter() 4343 { 4344 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4345 string cartProductsCount = Model.Cart.TotalProductsCount.ToString(); 4346 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right"; 4347 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 4348 string cartProductsTotalPrice = showPrice && Model.Cart.TotalPrice != null ? Model.Cart.TotalPrice.Price.Formatted : ""; 4349 cartProductsTotalPrice = counterPosition == "right" ? cartProductsTotalPrice : ""; 4350 4351 if (showPrice && counterPosition == "right") 4352 { 4353 cartProductsCount = Translate("Cart") + "(" + cartProductsCount + ")"; 4354 } 4355 4356 <div class="mini-cart__counter dw-mod"> 4357 <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"> 4358 <div class="js-mini-cart-counter-content" data-count="@Model.Cart.TotalProductsCount.ToString()"> 4359 @cartProductsCount 4360 @cartProductsTotalPrice 4361 </div> 4362 </div> 4363 </div> 4364 } 4365 4366 @helper RenderMiniCartCounterContent() 4367 { 4368 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 4369 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right"; 4370 bool showPriceInMiniCartCounter = Pageview.Device.ToString() != "Mobile" && counterPosition == "right" && showPrice; 4371 4372 <script id="MiniCartCounterContent" type="text/x-template"> 4373 {{#.}} 4374 <div class="js-mini-cart-counter-content dw-mod" data-count="{{numberofproducts}}"> 4375 @if (showPriceInMiniCartCounter) 4376 { 4377 @Translate("Cart")<text>({{numberofproducts}}) {{totalprice}}</text> 4378 } 4379 else 4380 { 4381 <text>{{numberofproducts}}</text> 4382 } 4383 </div> 4384 {{/.}} 4385 </script> 4386 } 4387 4388 @helper RenderMiniCartDropdownLayout() 4389 { 4390 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4391 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage"); 4392 4393 <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"> 4394 <div class="mini-cart-dropdown__inner dw-mod"> 4395 <h3 class="u-ta-center dw-mod">@Translate("Shopping cart")</h3> 4396 <div class="mini-cart-dropdown__body u-flex dw-mod"> 4397 <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> 4398 </div> 4399 </div> 4400 </div> 4401 } 4402 4403 @helper RenderMiniCartPanelLayout() 4404 { 4405 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4406 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage"); 4407 4408 <div class="mini-cart grid__cell dw-mod"> 4409 <input type="checkbox" id="miniCartTrigger" class="panel-trigger" /> 4410 <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"> 4411 <label for="miniCartTrigger" class="panel__close-btn" title="@Translate("Close panel")"><i class="fas fa-times"></i></label> 4412 <div class="panel__content u-full-width dw-mod"> 4413 <h3 class="panel__header dw-mod u-margin-bottom u-ta-center">@Translate("Shopping cart")</h3> 4414 <div class="panel__content-body panel__content-body--cart dw-mod"> 4415 <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> 4416 </div> 4417 </div> 4418 </div> 4419 </div> 4420 } 4421 4422 @helper RenderMiniCartModalLayout() 4423 { 4424 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4425 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage"); 4426 4427 <div class="mini-cart grid__cell dw-mod"> 4428 <input type="checkbox" id="miniCartTrigger" class="modal-trigger" autocomplete="off" /> 4429 <div class="modal-container dw-mod js-mini-cart" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="block" data-cart-page-link="@cartPageLink"> 4430 <label for="miniCartTrigger" class="modal-overlay"></label> 4431 <div class="modal modal--top-right dw-mod"> 4432 <div class="modal__body u-flex grid--direction-column dw-mod"> 4433 <h3 class="dw-mod u-ta-center">@Translate("Shopping cart")</h3> 4434 <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> 4435 </div> 4436 <label class="modal__close-btn modal__close-btn--clean dw-mod" for="miniCartTrigger" title="@Translate("Close modal")"></label> 4437 </div> 4438 </div> 4439 </div> 4440 } 4441 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4442 4443 @using System 4444 @using System.Web 4445 @using Dynamicweb.Rapido.Blocks.Extensibility 4446 @using Dynamicweb.Rapido.Blocks 4447 4448 @{ 4449 bool showDownloadCartLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart"); 4450 4451 Block masterDesktopActionsMenuDownloadCart = new Block 4452 { 4453 Id = "MasterDesktopActionsMenuDownloadCart", 4454 SortId = 35, 4455 Template = RenderDownloadCart() 4456 }; 4457 4458 if (showDownloadCartLink && Model.CurrentUser.ID > 0) 4459 { 4460 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuDownloadCart); 4461 } 4462 } 4463 4464 @helper RenderDownloadCart() 4465 { 4466 int downloadCartPageId = GetPageIdByNavigationTag("DownloadCart"); 4467 string downloadCartPageLink = "/Default.aspx?ID=" + downloadCartPageId; 4468 4469 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4470 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 4471 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4472 4473 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod"> 4474 <a href="@downloadCartPageLink" class="@menuLinkClass dw-mod"> 4475 <i class="fas fa-cart-arrow-down fa-1_5x"></i> 4476 </a> 4477 </li> 4478 } 4479 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4480 4481 @using System 4482 @using System.Web 4483 @using Dynamicweb.Rapido.Blocks.Extensibility 4484 @using Dynamicweb.Rapido.Blocks 4485 4486 @functions { 4487 public class SearchConfiguration 4488 { 4489 public string searchFeedId { get; set; } 4490 public string searchSecondFeedId { get; set; } 4491 public int groupsFeedId { get; set; } 4492 public string resultPageLink { get; set; } 4493 public string searchPlaceholder { get; set; } 4494 public string searchType { get; set; } 4495 public string searchTemplate { get; set; } 4496 public string searchContentTemplate { get; set; } 4497 public string searchValue { get; set; } 4498 public bool showGroups { get; set; } 4499 4500 public SearchConfiguration() 4501 { 4502 searchFeedId = ""; 4503 searchSecondFeedId = ""; 4504 searchType = "product-search"; 4505 searchContentTemplate = ""; 4506 showGroups = true; 4507 } 4508 } 4509 } 4510 @{ 4511 Block masterSearchBar = new Block 4512 { 4513 Id = "MasterSearchBar", 4514 SortId = 40, 4515 Template = RenderSearch("bar"), 4516 Design = new Design 4517 { 4518 Size = "auto", 4519 HidePadding = true, 4520 RenderType = RenderType.Column 4521 } 4522 }; 4523 4524 Block masterSearchAction = new Block 4525 { 4526 Id = "MasterDesktopActionsMenuSearch", 4527 SortId = 10, 4528 Template = RenderSearch() 4529 }; 4530 4531 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterSearchBar); 4532 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterSearchAction); 4533 } 4534 4535 @helper RenderSearch(string type = "mini-search") 4536 { 4537 string productsPageId = Converter.ToString(GetPageIdByNavigationTag("ProductsPage")); 4538 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 4539 string searchType = Model.Area.Item.GetItem("Layout").GetList("TopSearch") != null ? Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue : "productSearch"; 4540 4541 SearchConfiguration searchConfiguration = null; 4542 4543 switch (searchType) { 4544 case "contentSearch": 4545 searchConfiguration = new SearchConfiguration() { 4546 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true", 4547 resultPageLink = contentSearchPageLink, 4548 searchPlaceholder = Translate("Search page"), 4549 groupsFeedId = 0, 4550 searchType = "content-search", 4551 searchTemplate = "SearchPagesTemplate", 4552 showGroups = false 4553 }; 4554 break; 4555 case "combinedSearch": 4556 searchConfiguration = new SearchConfiguration() { 4557 searchFeedId = productsPageId + "&feed=true", 4558 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true", 4559 resultPageLink = Converter.ToString(productsPageId), 4560 searchPlaceholder = Translate("Search products or pages"), 4561 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"), 4562 searchType = "combined-search", 4563 searchTemplate = "SearchProductsTemplateWrap", 4564 searchContentTemplate = "SearchPagesTemplateWrap", 4565 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector") 4566 }; 4567 break; 4568 default: //productSearch 4569 searchConfiguration = new SearchConfiguration() { 4570 resultPageLink = Converter.ToString(productsPageId), 4571 searchFeedId = productsPageId + "&feed=true", 4572 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"), 4573 searchPlaceholder = Translate("Search products"), 4574 searchTemplate = "SearchProductsTemplate", 4575 searchType = "product-search", 4576 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector") 4577 }; 4578 break; 4579 } 4580 searchConfiguration.searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; 4581 4582 if (type == "mini-search") { 4583 @RenderMiniSearch(searchConfiguration) 4584 } else { 4585 @RenderSearchBar(searchConfiguration) 4586 } 4587 } 4588 4589 @helper RenderSearchBar(SearchConfiguration options) 4590 { 4591 <div class="typeahead typeahead--centered u-color-inherit js-typeahead dw-mod" id="ProductSearchBar" 4592 data-page-size="7" 4593 data-search-feed-id="@options.searchFeedId" 4594 data-search-second-feed-id="@options.searchSecondFeedId" 4595 data-result-page-id="@options.resultPageLink" 4596 data-groups-page-id="@options.groupsFeedId" 4597 data-search-type="@options.searchType"> 4598 @if (options.showGroups) 4599 { 4600 <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> 4601 <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> 4602 } 4603 <div class="typeahead-search-field"> 4604 <input type="text" class="u-no-margin u-full-width u-full-height js-typeahead-search-field" placeholder="@options.searchPlaceholder" value="@options.searchValue"> 4605 @if (string.IsNullOrEmpty(options.searchSecondFeedId)) 4606 { 4607 <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> 4608 } 4609 else 4610 { 4611 <div class="dropdown dropdown--absolute-position dropdown--combined grid"> 4612 <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> 4613 <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> 4614 </div> 4615 } 4616 </div> 4617 <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> 4618 </div> 4619 } 4620 4621 @helper RenderMiniSearch(SearchConfiguration options) 4622 { 4623 <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()"> 4624 <div class="menu__link menu__link--icon dw-mod"> 4625 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> 4626 </div> 4627 <div class="menu menu--dropdown menu--dropdown-right u-no-padding u-w380px grid__cell dw-mod"> 4628 <div class="typeahead js-typeahead" id="ProductSearchBar" 4629 data-page-size="7" 4630 data-search-feed-id="@options.searchFeedId" 4631 data-search-second-feed-id="@options.searchSecondFeedId" 4632 data-result-page-id="@options.resultPageLink" 4633 data-search-type="@options.searchType"> 4634 <div class="typeahead-search-field"> 4635 <input type="text" class="u-no-margin u-full-width js-typeahead-search-field" id="headerSearch" placeholder="@options.searchPlaceholder" value="@options.searchValue"> 4636 @if (string.IsNullOrEmpty(options.searchSecondFeedId)) 4637 { 4638 <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> 4639 } 4640 else 4641 { 4642 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--right-aligned"> 4643 <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> 4644 <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> 4645 </div> 4646 } 4647 </div> 4648 </div> 4649 </div> 4650 </li> 4651 } 4652 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4653 4654 @using System 4655 @using System.Web 4656 @using Dynamicweb.Rapido.Blocks.Extensibility 4657 @using Dynamicweb.Rapido.Blocks 4658 4659 @{ 4660 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4661 bool hideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 4662 4663 BlocksPage headerConfigurationPage = BlocksPage.GetBlockPage("Master"); 4664 4665 Block configDesktopLogo = headerConfigurationPage.GetBlockById("MasterDesktopLogo"); 4666 headerConfigurationPage.RemoveBlock(configDesktopLogo); 4667 4668 Block configDesktopMenu = headerConfigurationPage.GetBlockById("MasterDesktopMenu"); 4669 headerConfigurationPage.RemoveBlock(configDesktopMenu); 4670 4671 Block configSearchBar = headerConfigurationPage.GetBlockById("MasterSearchBar"); 4672 headerConfigurationPage.RemoveBlock(configSearchBar); 4673 4674 Block configSearchAction = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenuSearch"); 4675 headerConfigurationPage.RemoveBlock(configSearchAction); 4676 4677 Block configDesktopActionsMenu = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenu"); 4678 headerConfigurationPage.RemoveBlock(configDesktopActionsMenu); 4679 4680 Block configDesktopExtra = headerConfigurationPage.GetBlockById("MasterDesktopExtra"); 4681 4682 switch (topLayout) 4683 { 4684 case "condensed": //2 4685 configDesktopLogo.Design.Size = "auto-width"; 4686 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); 4687 4688 configDesktopMenu.SortId = 20; 4689 configDesktopMenu.Design.Size = "auto"; 4690 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 4691 4692 configDesktopActionsMenu.SortId = 30; 4693 configDesktopActionsMenu.Design.Size = "auto-width"; 4694 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 4695 4696 if (!hideSearch) 4697 { 4698 configSearchBar.SortId = 40; 4699 configSearchBar.Design.Size = "12"; 4700 configDesktopExtra.SortId = 50; 4701 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); 4702 } 4703 break; 4704 case "splitted": //3 4705 configDesktopLogo.Design.Size = "auto"; 4706 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 4707 4708 if (!hideSearch) 4709 { 4710 configSearchBar.SortId = 20; 4711 configSearchBar.Design.Size = "auto"; 4712 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); 4713 } 4714 4715 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 4716 4717 configDesktopActionsMenu.SortId = 20; 4718 configDesktopActionsMenu.Design.Size = "auto-width"; 4719 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 4720 break; 4721 case "minimal": //4 4722 configDesktopLogo.Design.Size = "auto-width"; 4723 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); 4724 4725 configDesktopMenu.Design.Size = "auto"; 4726 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 4727 4728 configDesktopActionsMenu.SortId = 20; 4729 configDesktopActionsMenu.Design.Size = "auto-width"; 4730 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 4731 4732 if (!hideSearch) 4733 { 4734 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 4735 } 4736 break; 4737 case "minimal-right": //5 4738 configDesktopLogo.Design.Size = "auto-width"; 4739 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); 4740 4741 configDesktopMenu.Design.Size = "auto"; 4742 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 4743 4744 configDesktopActionsMenu.SortId = 20; 4745 configDesktopActionsMenu.Design.Size = "auto-width"; 4746 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 4747 4748 if (!hideSearch) 4749 { 4750 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 4751 } 4752 break; 4753 case "two-lines": //6 4754 configDesktopLogo.Design.Size = "auto"; 4755 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 4756 4757 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 4758 4759 configDesktopActionsMenu.SortId = 20; 4760 configDesktopActionsMenu.Design.Size = "auto-width"; 4761 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 4762 4763 if (!hideSearch) 4764 { 4765 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 4766 } 4767 break; 4768 case "two-lines-centered": //7 4769 configDesktopLogo.Design.Size = "auto"; 4770 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 4771 4772 configDesktopMenu.Design.Size = "auto-width"; 4773 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 4774 4775 configDesktopActionsMenu.SortId = 20; 4776 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 4777 4778 if (!hideSearch) 4779 { 4780 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 4781 } 4782 break; 4783 case "normal": //1 4784 default: 4785 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 4786 4787 if (!hideSearch) 4788 { 4789 configSearchBar.SortId = 20; 4790 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); 4791 } 4792 4793 configDesktopActionsMenu.SortId = 30; 4794 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopActionsMenu); 4795 4796 configDesktopActionsMenu.Design.Size = "auto-width"; 4797 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 4798 break; 4799 } 4800 } 4801 @if (File.Exists(HttpContext.Current.Server.MapPath("/Files/Templates/Designs/Rapido/MasterBlocks/HeaderBlocks/Custom__Blocks.cshtml"))) 4802 { 4803 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4804 4805 @using System 4806 @using System.Web 4807 @using Dynamicweb.Rapido.Blocks.Extensibility 4808 @using Dynamicweb.Rapido.Blocks 4809 4810 @{ 4811 4812 }</text> 4813 } 4814 4815 4816 @helper RenderDesktopTools() 4817 { 4818 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopTools").OrderBy(item => item.SortId).ToList(); 4819 4820 4821 4822 <div class="tools-navigation dw-mod"> 4823 <div class="center-container grid top-container__center-container dw-mod"> 4824 @RenderBlockList(subBlocks) 4825 </div> 4826 </div> 4827 } 4828 4829 @helper RenderDesktopToolsText() 4830 { 4831 string toolsText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("ToolsText"); 4832 if (!string.IsNullOrEmpty(toolsText)) 4833 { 4834 <div class="u-margin-top u-margin-bottom">@toolsText</div> 4835 } 4836 } 4837 4838 @helper RenderDesktopToolsNavigation() 4839 { 4840 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 4841 4842 if (renderPagesInToolBar) 4843 { 4844 @RenderNavigation(new 4845 { 4846 id = "topToolsNavigation", 4847 cssclass = "menu menu-tools dw-mod dwnavigation", 4848 template = "TopMenu.xslt" 4849 }) 4850 } 4851 } 4852 4853 @helper RenderDesktopNavigation() 4854 { 4855 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopNavigation").OrderBy(item => item.SortId).ToList(); 4856 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4857 string alignClass = topLayout == "two-lines-centered" ? "grid--justify-center" : ""; 4858 <nav class="main-navigation dw-mod"> 4859 <div class="center-container top-container__center-container grid @alignClass dw-mod"> 4860 @RenderBlockList(subBlocks) 4861 4862 </div> 4863 </nav> 4864 } 4865 4866 @helper RenderDesktopExtra() 4867 { 4868 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopExtra").OrderBy(item => item.SortId).ToList(); 4869 4870 if (subBlocks.Count > 0) 4871 { 4872 <div class="header header-top dw-mod"> 4873 <div class="center-container top-container__center-container grid--justify-space-between grid grid--align-center dw-mod"> 4874 @RenderBlockList(subBlocks) 4875 </div> 4876 </div> 4877 } 4878 }</text> 4879 } 4880 4881 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4882 4883 @using System 4884 @using System.Web 4885 @using Dynamicweb.Rapido.Blocks.Extensibility 4886 @using Dynamicweb.Rapido.Blocks 4887 4888 @{ 4889 Block impersonationBar = new Block 4890 { 4891 Id = "ImpersonationBar", 4892 SortId = 50, 4893 Template = RenderImpersonationBar(), 4894 Design = new Design 4895 { 4896 Size = "auto-width", 4897 HidePadding = true, 4898 RenderType = RenderType.Column 4899 } 4900 }; 4901 4902 if (Model.CurrentUser.ID > 0 && Model.SecondaryUsers.Count > 0) 4903 { 4904 BlocksPage.GetBlockPage("Master").Add("MasterHeader", impersonationBar); 4905 } 4906 } 4907 4908 @helper RenderImpersonationBar() 4909 { 4910 int impersonationPageId = GetPageIdByNavigationTag("Impersonation"); 4911 4912 <div class="u-color-warning--bg"> 4913 <div class="center-container top-container__center-container dw-mod"> 4914 @*Impersonation*@ 4915 <div class="grid"> 4916 <div class="grid--align-self-center grid__col-x"> 4917 @if (Model.CurrentSecondaryUser != null && Model.CurrentSecondaryUser.ID > 0) 4918 { 4919 string stopImpersonateTranslation = Translate("Stop impersonation"); 4920 string username = ""; 4921 if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.FirstName) && !string.IsNullOrEmpty(Model.CurrentSecondaryUser.LastName)) 4922 { 4923 username = Model.CurrentSecondaryUser.FirstName + " " + Model.CurrentSecondaryUser.LastName; 4924 } 4925 else if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.Name)) 4926 { 4927 username = Model.CurrentSecondaryUser.Name; 4928 } 4929 else if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.Email)) 4930 { 4931 username = Model.CurrentSecondaryUser.Email; 4932 } 4933 else 4934 { 4935 username = Model.CurrentSecondaryUser.UserName; 4936 } 4937 <div class="grid-cell"> 4938 <div class="u-pull--left u-bold u-margin-top"> 4939 <i class="fas fa-user-secret"></i> 4940 @Pageview.User.UserName<text>&nbsp;</text>@Translate("is impersonating")<text>&nbsp;</text>@username 4941 </div> 4942 <form method="post" class="u-pull--right u-no-margin"> 4943 <input type="submit" class="btn btn--secondary dw-mod u-no-margin" name="DwExtranetRemoveSecondaryUser" value="@stopImpersonateTranslation"> 4944 </form> 4945 </div> 4946 } 4947 else 4948 { 4949 string viewListTranslation = Translate("View the list of users you can impersonate"); 4950 <div class="grid-cell u-bold"> 4951 <i class="fas fa-user-secret"></i> 4952 <a href="/Default.aspx?ID=@impersonationPageId" title="@viewListTranslation" class="u-color-font-black">@viewListTranslation</a> 4953 </div> 4954 } 4955 </div> 4956 </div> 4957 </div> 4958 </div> 4959 } 4960 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4961 4962 @using System 4963 @using System.Web 4964 @using System.Collections.Generic 4965 @using Dynamicweb.Rapido.Blocks.Extensibility 4966 @using Dynamicweb.Rapido.Blocks 4967 @using NextechDWAddIn.Handlers 4968 @using NextechDWAddIn.Common 4969 4970 @{ 4971 4972 4973 BlocksPage miniCartBlocksPage = BlocksPage.GetBlockPage("Master"); 4974 string orderlinesView = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView").SelectedValue : "table"; 4975 4976 Block orderLines = new Block 4977 { 4978 Id = "MiniCartOrderLines", 4979 SkipRenderBlocksList = true, 4980 BlocksList = new List<Block> 4981 { 4982 new Block { 4983 Id = "MiniCartOrderLinesList", 4984 SortId = 20, 4985 Template = RenderMiniCartOrderLinesList() 4986 } 4987 } 4988 }; 4989 4990 Block orderlinesScriptTemplates = new Block 4991 { 4992 Id = "OrderlinesScriptTemplates" 4993 }; 4994 4995 if (orderlinesView == "table") 4996 { 4997 orderLines.Template = RenderMiniCartOrderLinesTable(); 4998 orderLines.BlocksList.Add( 4999 new Block { 5000 Id = "MiniCartOrderlinesTableHeader", 5001 SortId = 10, 5002 Template = RenderMiniCartOrderLinesHeader() 5003 } 5004 ); 5005 5006 orderlinesScriptTemplates.Template = RenderMiniCartScriptsTableTemplates(); 5007 } 5008 else 5009 { 5010 orderLines.Template = RenderMiniCartOrderLinesBlocks(); 5011 orderlinesScriptTemplates.Template = RenderMiniCartScriptsListTemplates(); 5012 } 5013 5014 miniCartBlocksPage.Add("MasterBottomSnippets", orderlinesScriptTemplates); 5015 5016 Block miniCartScriptTemplates = new Block() 5017 { 5018 Id = "MasterMiniCartTemplates", 5019 SortId = 1, 5020 Template = RenderMiniCartScriptTemplates(), 5021 SkipRenderBlocksList = true, 5022 BlocksList = new List<Block> 5023 { 5024 orderLines, 5025 new Block { 5026 Id = "MiniCartFooter", 5027 Template = RenderMiniCartFooter(), 5028 SortId = 50, 5029 SkipRenderBlocksList = true, 5030 BlocksList = new List<Block> 5031 { 5032 new Block { 5033 Id = "MiniCartFees", 5034 Template = RenderMiniCartFees(), 5035 SortId = 30 5036 }, 5037 new Block { 5038 Id = "MiniCartPoints", 5039 Template = RenderMiniCartPoints(), 5040 SortId = 40 5041 }, 5042 new Block { 5043 Id = "MiniCartTotal", 5044 Template = RenderMiniCartTotal(), 5045 SortId = 50 5046 }, 5047 new Block { 5048 Id = "MiniCartActions", 5049 Template = RenderMiniCartActions(), 5050 SortId = 60 5051 } 5052 } 5053 } 5054 } 5055 }; 5056 5057 miniCartBlocksPage.Add("MasterBottomSnippets", miniCartScriptTemplates); 5058 } 5059 5060 @helper RenderMiniCartScriptsTableTemplates() 5061 { 5062 <script id="MiniCartOrderline" type="text/x-template"> 5063 {{#unless isEmpty}} 5064 <tr> 5065 <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> 5066 <td class="u-va-middle"> 5067 <a href="{{link}}" class="mini-cart-orderline__name" title="{{name}}">{{name}}</a> 5068 {{#if variantname}} 5069 <a href="{{link}}" class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{variantname}}</a> 5070 {{/if}} 5071 {{#if unitname}} 5072 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{unitname}}</div> 5073 {{/if}} 5074 </td> 5075 <td class="u-ta-right u-va-middle">{{quantity}}</td> 5076 <td class="u-ta-right u-va-middle"> 5077 {{#if pointsTotal}} 5078 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 5079 {{else}} 5080 {{totalprice}} 5081 {{/if}} 5082 </td> 5083 </tr> 5084 5085 {{#OrderLineChildren}} 5086 <tr class="table__row--no-border"> 5087 <!--CS NT Do not show the XDO NOT LET USER REMOVE ProductDiscount--> 5088 <td>&nbsp;</td> 5089 <td colspan="2">{{nameCS}} </td> 5090 <td class="cart-table__price u-ta-right dw-mod">{{totalpriceCS}}</td> 5091 </tr> 5092 {{/OrderLineChildren}} 5093 5094 {{/unless}} 5095 </script> 5096 5097 @*TODO CS NT Comment out and move further below with different html OR add seperator *@ 5098 5099 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 5100 {{#unless isEmpty}} 5101 5102 {{#if parentId}} 5103 {{else}} 5104 <tr class="table__row--no-border"> 5105 <td colspan="3">{{name}}</td> 5106 @*<td class="u-w60px">&nbsp;</td>*@ 5107 @*<td><div class="mini-cart-orderline__name dw-mod">{{name}}</div></td>*@ 5108 @*<td class="u-ta-right">&nbsp;</td>*@ 5109 <td class="u-ta-right">{{totalprice}}</td> 5110 </tr> 5111 {{/if}} 5112 {{/unless}} 5113 </script> 5114 } 5115 5116 @helper RenderMiniCartScriptsListTemplates() 5117 { 5118 int cartOrderlinesFeedPageId = GetPageIdByNavigationTag("CartOrderlinesFeed"); 5119 <script id="MiniCartOrderline" type="text/x-template"> 5120 {{#unless isEmpty}} 5121 <div class="mini-cart-orderline grid dw-mod"> 5122 <div class="grid__col-4"> 5123 <a href="{{link}}" class="{{hideimage}}"> 5124 <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}}"> 5125 </a> 5126 </div> 5127 <div class="grid__col-8"> 5128 <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> 5129 {{#if variantname}} 5130 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Variant"): {{variantname}}</div> 5131 {{/if}} 5132 {{#if unitname}} 5133 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Unit"): {{unitname}}</div> 5134 {{/if}} 5135 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Qty"): {{quantity}}</div> 5136 5137 <div class="grid__cell-footer"> 5138 <div class="grid__cell"> 5139 <div class="u-pull--left mini-cart-orderline__price dw-mod"> 5140 {{#if pointsTotal}} 5141 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 5142 {{else}} 5143 {{totalprice}} 5144 {{/if}} 5145 </div> 5146 <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") <i class="fas fa-times"></i></button> 5147 </div> 5148 </div> 5149 </div> 5150 </div> 5151 5152 {{#OrderLineChildren}} 5153 <div class="mini-cart-orderline mini-cart-orderline--discount grid dw-mod"> 5154 <div class="grid__col-4"><!--CS NT Mini cart (not table) product discount lines--> 5155 <div class="mini-cart-orderline__name mini-cart-orderline__name dw-mod">{{nameCS}}</div> 5156 </div> 5157 <div class="grid__col-8">{{totalpriceCS}}</div> 5158 </div> 5159 {{/OrderLineChildren}} 5160 5161 {{/unless}} 5162 </script> 5163 5164 @*TODO CS NT Comment out and move further below with different html OR add seperator *@ 5165 5166 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 5167 {{#unless isEmpty}} 5168 5169 {{#if parentId}} 5170 {{else}} 5171 <div class="mini-cart-orderline mini-cart-orderline--discount grid dw-mod"> 5172 <div class="grid__col-4"> 5173 <div class="mini-cart-orderline__name mini-cart-orderline__name dw-mod">{{name}}</div> 5174 </div> 5175 <div class="grid__col-8">{{totalprice}}</div> 5176 </div> 5177 {{/if}} 5178 {{/unless}} 5179 </script> 5180 } 5181 5182 @helper RenderMiniCartScriptTemplates() 5183 { 5184 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMiniCartTemplates").OrderBy(item => item.SortId).ToList(); 5185 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 5186 string cartPageLink = string.Concat("/Default.aspx?ID=", GetPageIdByNavigationTag("CartPage")); 5187 5188 <script id="MiniCartContent" type="text/x-template"> 5189 {{#.}} 5190 {{#unless isEmpty}} 5191 @if (useGoogleTagManager) 5192 { 5193 <text>{{{googleEnchantImpressionEmptyCart OrderLines}}}</text> 5194 } 5195 @RenderBlockList(subBlocks) 5196 {{/unless}} 5197 {{#if isEmpty}} 5198 {{{locationReload '@cartPageLink'}}} 5199 {{/if}} 5200 {{/.}} 5201 </script> 5202 } 5203 5204 @helper RenderMiniCartOrderLinesTable() 5205 { 5206 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList(); 5207 5208 <div class="u-overflow-auto"> 5209 <table class="table mini-cart-table dw-mod"> 5210 @RenderBlockList(subBlocks) 5211 </table> 5212 </div> 5213 } 5214 5215 @helper RenderMiniCartOrderLinesBlocks() 5216 { 5217 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList(); 5218 5219 <div class="u-overflow-auto"> 5220 @RenderBlockList(subBlocks) 5221 </div> 5222 } 5223 5224 @helper RenderMiniCartOrderLinesHeader() 5225 { 5226 <thead> 5227 <tr> 5228 <td>&nbsp;</td> 5229 <td>@Translate("Product")</td> 5230 <td class="u-ta-right">@Translate("Qty")</td> 5231 <td class="u-ta-right" width="120">@Translate("Price")</td> 5232 </tr> 5233 </thead> 5234 } 5235 5236 @helper RenderMiniCartOrderLinesList() 5237 { 5238 <text> 5239 {{#OrderLines}} 5240 {{#ifCond template "===" "CartOrderline"}} 5241 {{>MiniCartOrderline}} 5242 {{/ifCond}} 5243 {{#ifCond template "===" "CartOrderlineMobile"}} 5244 {{>MiniCartOrderline}} 5245 {{/ifCond}} 5246 {{#ifCond template "===" "CartOrderlineDiscount"}} 5247 {{>MiniCartOrderlineDiscount}} 5248 {{/ifCond}} 5249 {{/OrderLines}} 5250 </text> 5251 } 5252 5253 @helper RenderMiniCartFees() 5254 { 5255 @*CS NT Hide Payment 5256 <div class="grid u-border-top grid--external-bleed-bottom"> 5257 <div class="grid__col-6"> 5258 {{paymentmethod}} 5259 </div> 5260 <div class="grid__col-6 grid--align-end">{{paymentfee}}</div> 5261 </div> 5262 *@ 5263 <div class="grid grid--external-bleed-bottom"> 5264 <div class="grid__col-6"> 5265 {{shippingmethod}} 5266 </div> 5267 <div class="grid__col-6 grid--align-end">{{shippingfee}}</div> 5268 </div> 5269 } 5270 5271 @helper RenderMiniCartFooter() 5272 { 5273 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartFooter").OrderBy(item => item.SortId).ToList(); 5274 5275 <div class="mini-cart__footer dw-mod"> 5276 @RenderBlockList(subBlocks) 5277 </div> 5278 } 5279 5280 @helper RenderMiniCartActions() 5281 { 5282 int cartPageId = GetPageIdByNavigationTag("CartPage"); 5283 5284 <!-- 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>--> 5285 <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> 5286 } 5287 5288 @helper RenderMiniCartPoints() 5289 { 5290 <text> 5291 {{#if earnings}} 5292 <div class="grid grid--external-bleed-bottom"> 5293 <div class="grid__col-6">@Translate("Earnings")</div> 5294 <div class="grid__col-6 grid--align-end"> 5295 <div> 5296 <span class="u-color--loyalty-points">{{earnings}}</span> @Translate("points") 5297 </div> 5298 </div> 5299 </div> 5300 {{/if}} 5301 </text> 5302 } 5303 5304 @helper RenderMiniCartTotal() 5305 { 5306 <div class="mini-cart-totals grid u-margin-bottom dw-mod"> 5307 <div class="grid__col-6">@Translate("Total")</div> 5308 <div class="grid__col-6 grid--align-end">{{totalprice}}</div> 5309 </div> 5310 } 5311 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5312 5313 @using Dynamicweb.Rapido.Blocks.Extensibility 5314 @using Dynamicweb.Rapido.Blocks 5315 5316 @{ 5317 bool addToCartNotificationOnlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 5318 string addToCartNotificationType = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType").SelectedValue : ""; 5319 bool addToCartHideCartIcon = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 5320 5321 if (!addToCartNotificationOnlyPreview && !string.IsNullOrEmpty(addToCartNotificationType)) { 5322 if (addToCartNotificationType == "modal") 5323 { 5324 Block addToCartNotificationModal = new Block 5325 { 5326 Id = "AddToCartNotificationModal", 5327 Template = RenderAddToCartNotificationModal() 5328 }; 5329 5330 Block addToCartNotificationScript = new Block 5331 { 5332 Id = "AddToCartNotificationScript", 5333 Template = RenderAddToCartNotificationModalScript() 5334 }; 5335 BlocksPage.GetBlockPage("Master").Add("MasterTopSnippets", addToCartNotificationModal); 5336 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript); 5337 } 5338 else if (addToCartNotificationType == "toggle" && !addToCartHideCartIcon && Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 5339 { 5340 Block addToCartNotificationScript = new Block 5341 { 5342 Id = "AddToCartNotificationScript", 5343 Template = RenderAddToCartNotificationToggleScript() 5344 }; 5345 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript); 5346 } 5347 } 5348 } 5349 5350 @helper RenderAddToCartNotificationModal() 5351 { 5352 <div id="LastAddedProductModal" data-template="LastAddedProductTemplate"></div> 5353 } 5354 5355 @helper RenderAddToCartNotificationModalScript() 5356 { 5357 int cartPageId = GetPageIdByNavigationTag("CartPage"); 5358 5359 <script id="LastAddedProductTemplate" type="text/x-template"> 5360 <!-- Trigger for the login modal --> 5361 <input type="checkbox" id="LastAddedProductModalTrigger" class="modal-trigger" /> 5362 5363 <!-- Login modal --> 5364 <div class="modal-container"> 5365 <label for="LastAddedProductModalTrigger" class="modal-overlay"></label> 5366 <div class="modal modal--md"> 5367 <div class="modal__header"> 5368 <h2>@Translate("Product is added to the cart")</h2> 5369 </div> 5370 <div class="modal__body"> 5371 <div class="grid"> 5372 <div class="grid__col-2"> 5373 <a href="{{productInfo.link}}"> 5374 <img src="{{productInfo.image}}" alt="{{productInfo.name}}" class="dw-mod" /> 5375 </a> 5376 </div> 5377 <div class="u-padding grid--align-self-center"> 5378 <span>{{quantity}}</span> x 5379 </div> 5380 <div class="grid__col-auto grid--align-self-center"> 5381 <div>{{productInfo.name}}</div> 5382 {{#if productInfo.variantName}} 5383 <small class="u-margin-bottom-5px">{{productInfo.variantName}}</small> 5384 {{/if}} 5385 {{#if productInfo.unitName}} 5386 <small class="u-margin-bottom-5px">{{productInfo.unitName}}</small> 5387 {{/if}} 5388 </div> 5389 </div> 5390 <div class="modal__footer u-margin-top--lg"> 5391 <label class="btn btn--secondary u-pull--left u-no-margin dw-mod btn--sm" for="LastAddedProductModalTrigger">@Translate("Continue shopping")</label> 5392 <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> 5393 </div> 5394 </div> 5395 <label class="modal__close-btn" for="LastAddedProductModalTrigger"></label> 5396 </div> 5397 </div> 5398 </script> 5399 <script> 5400 document.addEventListener('addToCart', function (event) { 5401 Cart.ShowLastAddedProductModal(event.detail); 5402 }); 5403 </script> 5404 } 5405 5406 @helper RenderAddToCartNotificationToggleScript() 5407 { 5408 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 5409 5410 <script> 5411 document.addEventListener('addToCart', function () { 5412 Cart.ToggleMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '@miniCartFeedPageId'); 5413 }); 5414 </script> 5415 } 5416 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5417 5418 @using System 5419 @using System.Web 5420 @using System.Collections.Generic 5421 @using Dynamicweb.Rapido.Blocks.Extensibility 5422 @using Dynamicweb.Rapido.Blocks 5423 5424 @functions { 5425 BlocksPage footerBlocksPage = BlocksPage.GetBlockPage("Master"); 5426 } 5427 5428 @{ 5429 string footerColumnOneContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Content"); 5430 string footerColumnTwoContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Content"); 5431 string footerColumnThreeContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Content"); 5432 string footerColumnOneHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Header"); 5433 string footerColumnTwoHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Header"); 5434 string footerColumnThreeHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Header"); 5435 5436 Block masterFooterContent = new Block() 5437 { 5438 Id = "MasterFooterContent", 5439 SortId = 10, 5440 Template = RenderFooter(), 5441 SkipRenderBlocksList = true 5442 }; 5443 footerBlocksPage.Add(MasterBlockId.MasterFooter, masterFooterContent); 5444 5445 if (!string.IsNullOrEmpty(footerColumnOneContent) || !string.IsNullOrEmpty(footerColumnOneHeader)) 5446 { 5447 Block masterFooterColumnOne = new Block 5448 { 5449 Id = "MasterFooterColumnOne", 5450 SortId = 10, 5451 Template = RenderFooterColumn(footerColumnOneHeader, footerColumnOneContent), 5452 Design = new Design { 5453 Size = "auto", 5454 RenderType = RenderType.Column 5455 } 5456 }; 5457 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnOne); 5458 } 5459 5460 if (!string.IsNullOrEmpty(footerColumnTwoContent) || !string.IsNullOrEmpty(footerColumnTwoHeader)) 5461 { 5462 Block masterFooterColumnTwo = new Block 5463 { 5464 Id = "MasterFooterColumnTwo", 5465 SortId = 20, 5466 Template = RenderFooterColumn(footerColumnTwoHeader, footerColumnTwoContent), 5467 Design = new Design 5468 { 5469 Size = "auto", 5470 RenderType = RenderType.Column 5471 } 5472 }; 5473 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnTwo); 5474 } 5475 5476 if (!string.IsNullOrEmpty(footerColumnThreeContent) || !string.IsNullOrEmpty(footerColumnThreeHeader)) 5477 { 5478 Block masterFooterColumnThree = new Block 5479 { 5480 Id = "MasterFooterColumnThree", 5481 SortId = 30, 5482 Template = RenderFooterColumn(footerColumnThreeHeader, footerColumnThreeContent), 5483 Design = new Design 5484 { 5485 Size = "auto", 5486 RenderType = RenderType.Column 5487 } 5488 }; 5489 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnThree); 5490 } 5491 5492 if (Model.Area.Item.GetItem("Layout").GetBoolean("FooterNewsletterSignUp")) 5493 { 5494 Block masterFooterNewsletterSignUp = new Block 5495 { 5496 Id = "MasterFooterNewsletterSignUp", 5497 SortId = 40, 5498 Template = RenderFooterNewsletterSignUp(), 5499 Design = new Design 5500 { 5501 Size = "auto", 5502 RenderType = RenderType.Column 5503 } 5504 }; 5505 footerBlocksPage.Add("MasterFooterContent", masterFooterNewsletterSignUp); 5506 } 5507 5508 if (Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks").Count > 0) 5509 { 5510 Block masterFooterSocialLinks = new Block 5511 { 5512 Id = "MasterFooterSocialLinks", 5513 SortId = 50, 5514 Template = RenderFooterSocialLinks(), 5515 Design = new Design 5516 { 5517 Size = "auto", 5518 RenderType = RenderType.Column 5519 } 5520 }; 5521 footerBlocksPage.Add("MasterFooterContent", masterFooterSocialLinks); 5522 } 5523 5524 if (Model.Area.Item.GetItem("Layout").GetItems("FooterPayments") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterPayments").Count > 0) 5525 { 5526 Block masterFooterPayments = new Block 5527 { 5528 Id = "MasterFooterPayments", 5529 SortId = 60, 5530 Template = RenderFooterPayments(), 5531 Design = new Design 5532 { 5533 Size = "12", 5534 RenderType = RenderType.Column 5535 } 5536 }; 5537 footerBlocksPage.Add("MasterFooterContent", masterFooterPayments); 5538 } 5539 5540 Block masterFooterCopyright = new Block 5541 { 5542 Id = "MasterFooterCopyright", 5543 SortId = 70, 5544 Template = RenderFooterCopyright(), 5545 Design = new Design 5546 { 5547 Size = "12", 5548 RenderType = RenderType.Column 5549 } 5550 }; 5551 footerBlocksPage.Add("MasterFooterContent", masterFooterCopyright); 5552 } 5553 5554 @helper RenderFooter() { 5555 List<Block> subBlocks = this.footerBlocksPage.GetBlockListById("MasterFooterContent").OrderBy(item => item.SortId).ToList(); 5556 5557 <footer class="footer dw-mod"> 5558 <div class="center-container u-padding dw-mod" id="productPageDeliveryBenefitsAdvice"> 5559 <div class="grid productPage-Delivery-Benefits-Advice"> 5560 <div class="grid__col-lg-4 grid__col-md-4 grid__col-sm-12 grid__col-xs-12 oneThirdDiv"> 5561 <p> 5562 <a href="/"> 5563 <img src="Files/Images/General/delivery_icon.svg" /> 5564 </a> 5565 </p> 5566 <div> 5567 <p><strong>Free Standard Delivery when you </strong></p> 5568 5569 <p><strong>spend &euro;15 or more</strong></p> 5570 5571 <p>Delivery will take 3-5 working days</p> 5572 </div> 5573 </div> 5574 5575 <div class="grid__col-lg-4 grid__col-md-4 grid__col-sm-12 grid__col-xs-12 oneThirdDiv"> 5576 <p> 5577 <a href="/createecommerceaccount"> 5578 <img src="Files/Images/General/loyalty_icon.svg" /> 5579 </a> 5580 </p> 5581 <div> 5582 <p> 5583 <a href="/createecommerceaccount"><strong>Join our &lsquo;Benefits&rsquo; Loyalty Scheme</strong></a> 5584 </p> 5585 <p>Join our loyalty scheme today. Every &euro;1 of purchases adds 1 point to your account</p> 5586 <p>&nbsp;</p> 5587 </div> 5588 </div> 5589 5590 <div class="grid__col-lg-4 grid__col-md-4 grid__col-sm-12 grid__col-xs-12 oneThirdDiv"> 5591 <p> 5592 <a href="/qualified-to-advise"> 5593 <img src="Files/Images/General/qualified_to_advise.png" style="width: 55px; height: 45px;" /> 5594 </a> 5595 </p> 5596 <div> 5597 <p> 5598 <a href="/qualified-to-advise"><strong>Qualified to Advise</strong></a> 5599 </p> 5600 <p>Our associated are qualified to advise. Visit us in-store or online for qualified advices</p> 5601 <p>&nbsp;</p> 5602 </div> 5603 </div> 5604 </div> 5605 </div> 5606 <div class="center-container top-container__center-container dw-mod"> 5607 5608 <!-- CS NT add Payments-Social and Lines Start..--> 5609 <div class="fullSoftLine"></div> 5610 <div class="grid" style="padding: 1rem 0;"> 5611 <!--<div class="oneHalfDiv_Payments"><img src="Files/Images/General/payment-options.svg" /></div> 5612 <div class="oneHalfDiv_Social"><img src="Files/Images/General/social-instagram.svg" /> <img src="Files/Images/General/social-facebook.svg" /></div>--> 5613 <div class="oneDiv_Payments"><img src="Files/Images/General/payments options.png" /></div> 5614 </div> 5615 <div class="fullThickLine"></div> 5616 <!-- CS NT add Payments-Social and Lines ..End--> 5617 5618 <div class="grid grid--external-bleed-x"> 5619 @RenderBlockList(subBlocks) 5620 </div> 5621 </div> 5622 </footer> 5623 } 5624 5625 @helper RenderFooterColumn(string header, string content) { 5626 <h3 class="footer__heading dw-mod">@header</h3> 5627 <div class="footer__content dw-mod"> 5628 @content 5629 </div> 5630 } 5631 5632 @helper RenderFooterNewsletterSignUp() { 5633 string newsletterSignUpPageId = GetPageIdByNavigationTag("NewsletterSignUp").ToString(); 5634 5635 <h3 class="footer__heading dw-mod">@Translate("Mailing list")</h3> 5636 <div class="footer__content dw-mod"> 5637 <form class="form dw-mod" name="NewsletterRedirect" action='/Default.aspx' method="get" enctype="multipart/form-data"> 5638 <input name="ID" value="@newsletterSignUpPageId" type="hidden" /> 5639 <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> 5640 <div class="form__field-combi"> 5641 <input name="NewsletterEmail" id="NewsletterEmail" type="text" placeholder='@Translate("Your email address", "Your email address")' class="u-full-width use-btn-primary-height" /> 5642 <input class="btn btn--primary btn--condensed dw-mod" type="submit" id="Submitter" value='@Translate("Go", "Go")' /> 5643 </div> 5644 </form> 5645 </div> 5646 } 5647 5648 @helper RenderFooterSocialLinks() { 5649 <h3 class="footer__heading dw-mod">@Translate("Social links")</h3> 5650 <div class="footer__content dw-mod"> 5651 <div class="collection dw-mod"> 5652 @foreach (var socialitem in Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks")) 5653 { 5654 var socialIcon = socialitem.GetValue("Icon") as Dynamicweb.Frontend.ListViewModel; 5655 string socialIconClass = socialIcon.SelectedValue; 5656 string socialIconTitle = socialIcon.SelectedName; 5657 string socialLink = socialitem.GetString("Link"); 5658 5659 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px" rel="noopener"><i class="@socialIconClass fa-2x"></i></a> 5660 } 5661 </div> 5662 </div> 5663 } 5664 5665 @helper RenderFooterPayments() { 5666 <div class="footer__content dw-mod"> 5667 <div class="collection dw-mod"> 5668 @foreach (var payment in Model.Area.Item.GetItem("Layout").GetItems("FooterPayments")) 5669 { 5670 var paymentItem = payment.GetValue("CardTypeOrVerifiedPayment") as Dynamicweb.Frontend.ListViewModel; 5671 string paymentImage = null; 5672 string paymentTitle = paymentItem.SelectedName; 5673 ListOptionViewModel selected = paymentItem.SelectedOptions.FirstOrDefault(); 5674 if (selected != null) 5675 { 5676 paymentImage = selected.Icon; 5677 } 5678 5679 <div class="footer__card-type"> 5680 <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" /> 5681 </div> 5682 } 5683 </div> 5684 </div> 5685 } 5686 5687 @helper RenderFooterCopyright() { 5688 <div class="grid__col-12 footer__copyright dw-mod"> 5689 <p>@Model.Area.Item.GetItem("Layout").GetString("FooterCopyrightText")</p> 5690 </div> 5691 } 5692 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 5693 5694 @using System 5695 @using System.Web 5696 @using System.Collections.Generic 5697 @using Dynamicweb.Rapido.Blocks.Extensibility 5698 @using Dynamicweb.Rapido.Blocks 5699 @using Dynamicweb.Ecommerce.Common 5700 5701 @{ 5702 BlocksPage referencesBlocksPage = BlocksPage.GetBlockPage("Master"); 5703 5704 Block masterScriptReferences = new Block() 5705 { 5706 Id = "MasterScriptReferences", 5707 SortId = 1, 5708 Template = RenderMasterScriptReferences() 5709 }; 5710 referencesBlocksPage.Add(MasterBlockId.MasterReferences, masterScriptReferences); 5711 } 5712 5713 @helper RenderMasterScriptReferences() 5714 { 5715 5716 5717 <script src="/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js"></script> 5718 <!--CS NT Use ticks <script src="/Files/Templates/Designs/Rapido/js/master.min.js"></script>--> 5719 //CS NT Ticks for files 5720 var masterMinJSfileInfo = new System.IO.FileInfo(System.Web.HttpContext.Current.Server.MapPath("/Files/Templates/Designs/Rapido/js/master.min.js")); 5721 <script type="text/javascript" src="/Files/Templates/Designs/Rapido/js/master.min.js?ticks=@masterMinJSfileInfo.LastWriteTime.Ticks.ToString()"></script> 5722 5723 if (Model.Area.Item.GetItem("Custom").GetBoolean("UseCustomJavascript")) 5724 { 5725 <script src="/Files/Templates/Designs/Rapido/js/custom.min.js"></script> 5726 PushPromise("/Files/Templates/Designs/Rapido/js/custom.min.js"); 5727 } 5728 5729 PushPromise("/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js"); 5730 PushPromise("/Files/Templates/Designs/Rapido/js/master.min.js"); 5731 } 5732 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5733 5734 @using System 5735 @using System.Web 5736 @using System.Collections.Generic 5737 @using Dynamicweb.Rapido.Blocks.Extensibility 5738 @using Dynamicweb.Rapido.Blocks 5739 5740 @{ 5741 BlocksPage searchBlocksPage = BlocksPage.GetBlockPage("Master"); 5742 bool navigationItemsHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 5743 bool isFavoriteList = !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("ListID")); 5744 5745 if (!navigationItemsHideSearch || isFavoriteList) 5746 { 5747 Block masterSearchScriptTemplates = new Block() 5748 { 5749 Id = "MasterSearchScriptTemplates", 5750 SortId = 1, 5751 Template = RenderSearchScriptTemplates() 5752 }; 5753 5754 searchBlocksPage.Add(MasterBlockId.MasterBottomSnippets, masterSearchScriptTemplates); 5755 } 5756 } 5757 5758 @helper RenderSearchScriptTemplates() 5759 { 5760 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 5761 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 5762 bool useFacebookPixel = !string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID")); 5763 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 5764 bool useGoogleTagManager = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID")); 5765 bool showPrice = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HidePriceInSearchResults"); 5766 bool showAddToCartButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideAddToCartButton"); 5767 bool showViewButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideViewButton"); 5768 bool showAddToDownloadButton = Pageview.AreaSettings.GetItem("Layout").GetBoolean("ShowAddToDownloadButton"); 5769 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 5770 5771 <script id="SearchGroupsTemplate" type="text/x-template"> 5772 {{#.}} 5773 <li class="dropdown__item dw-mod" onclick="Search.UpdateGroupSelection(this)" data-group-id="{{id}}">{{name}}</li> 5774 {{/.}} 5775 </script> 5776 5777 <script id="SearchProductsTemplate" type="text/x-template"> 5778 {{#each .}} 5779 {{#Product}} 5780 {{#ifCond template "!==" "SearchMore"}} 5781 <li class="dropdown__item dropdown__item--seperator dw-mod"> 5782 @if (useFacebookPixel) 5783 { 5784 <text>{{{facebookPixelSearch name number priceDouble currency searchParameter}}}</text> 5785 } 5786 @if (useGoogleTagManager) 5787 { 5788 <text>{{{googleEnchantImpression 'Search results' currency googleImpression}}}</text> 5789 } 5790 <div> 5791 <a href="{{link}}" class="js-typeahead-link u-color-inherit u-pull--left" onclick="{{googleImpressionClick}}" title="{{name}}"> 5792 <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> 5793 <div class="u-pull--left"> 5794 <div class="u-bold u-max-w220px u-truncate-text js-typeahead-name">{{name}}</div> 5795 @if (showPrice && !onlyPreview) 5796 { 5797 if (pointShopOnly) 5798 { 5799 <text> 5800 {{#if havePointPrice}} 5801 <div> 5802 <span class="u-color--loyalty-points">{{points}}</span> @Translate("points") 5803 </div> 5804 {{else}} 5805 <small class="help-text u-no-margin">@Translate("Not available")</small> 5806 {{/if}} 5807 {{#unless canBePurchasedWithPoints}} 5808 {{#if havePointPrice}} 5809 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small> 5810 {{/if}} 5811 {{/unless}} 5812 </text> 5813 } 5814 else 5815 { 5816 <div>{{price}}</div> 5817 } 5818 } 5819 </div> 5820 </a> 5821 <div class="u-margin-left u-pull--right"> 5822 @if (showAddToCartButton && !onlyPreview) { 5823 if (pointShopOnly) 5824 { 5825 <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" 5826 onclick="Cart.AddToCart(event, { 5827 id: '{{productId}}', 5828 quantity: 1, 5829 buyForPoints: true, 5830 productInfo: {{productInfo}} 5831 }); {{facebookPixelAction}}" {{disabledBuyButton}}> 5832 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue js-ignore-click-outside"></i> 5833 </button> 5834 } else { 5835 @* CS NT Comment out for onClick.. 5836 <button type="button" class="btn btn--primary btn--condensed btn--full u-no-margin dw-mod {{hideBuyOptions}} js-ignore-click-outside" 5837 onclick="Cart.AddToCart(event, { 5838 id: '{{productId}}', 5839 quantity: 1, 5840 productInfo: {{productInfo}} 5841 }); {{facebookPixelAction}}"> 5842 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue js-ignore-click-outside"></i> 5843 </button> 5844 .. CS NT Comment out for onClick*@ 5845 <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}}"> 5846 <button type="button" id="CartButton_{{id}}" class="btn btn--primary btn--condensed btn--full u-no-margin dw-mod {{hideBuyOptions}} js-ignore-click-outside" 5847 onclick="ProductAddToCart(event, {{id}}, { 5848 id: '{{productId}}', 5849 variantId: '{{variantid}}', 5850 unitId: '{{unitId}}', 5851 quantity: 1, 5852 productInfo: {{productInfo}} 5853 }); {{facebookPixelAction}}" > 5854 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue js-ignore-click-outside"></i> 5855 </button> 5856 } 5857 <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> 5858 } 5859 else if (showViewButton) 5860 { 5861 <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> 5862 } 5863 @if (showAddToDownloadButton) 5864 { 5865 <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}}"> 5866 <i class="fas fa-plus js-button-icon"></i> 5867 </button> 5868 } 5869 </div> 5870 5871 <div class="error-message" style="display:none" id="error-message{{id}}"> 5872 <br /> 5873 <div class="error-block-nextech">@Translate("Available stock is") <span id="stockSpan{{id}}"></span></div> 5874 </div> 5875 5876 </div> 5877 </li> 5878 {{/ifCond}} 5879 {{#ifCond template "===" "SearchMore"}} 5880 {{>SearchMoreProducts}} 5881 {{/ifCond}} 5882 {{/Product}} 5883 {{else}} 5884 <li class="dropdown__item dropdown__item--seperator dw-mod"> 5885 @Translate("Your search gave 0 results") 5886 </li> 5887 {{/each}} 5888 </script> 5889 5890 <script id="SearchMoreProducts" type="text/x-template"> 5891 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 5892 <a href="/Default.aspx?ID=@productsPageId&Search={{searchParameter}}&GroupID={{groupId}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 5893 @Translate("View all") 5894 </a> 5895 </li> 5896 </script> 5897 5898 <script id="SearchMorePages" type="text/x-template"> 5899 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 5900 <a href="/Default.aspx?ID=@contentSearchPageLink&Search={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 5901 @Translate("View all") 5902 </a> 5903 </li> 5904 </script> 5905 5906 <script id="SearchPagesTemplate" type="text/x-template"> 5907 {{#each .}} 5908 {{#ifCond template "!==" "SearchMore"}} 5909 <li class="dropdown__item dropdown__item--seperator dw-mod"> 5910 <div> 5911 <a href="/Default.aspx?ID={{id}}" class="js-typeahead-link u-pull--left u-color-inherit"> 5912 <div class="u-margin-right u-pull--left"><i class="fa {{icon}} u-w20px u-ta-center"></i></div> 5913 <div class="u-pull--left"> 5914 <div class="u-bold u-truncate-text u-max-w220px js-typeahead-name">{{name}}</div> 5915 </div> 5916 </a> 5917 </div> 5918 </li> 5919 {{/ifCond}} 5920 {{#ifCond template "===" "SearchMore"}} 5921 {{>SearchMorePages}} 5922 {{/ifCond}} 5923 {{else}} 5924 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable dw-mod"> 5925 @Translate("Your search gave 0 results") 5926 </li> 5927 {{/each}} 5928 </script> 5929 5930 <script id="SearchPagesTemplateWrap" type="text/x-template"> 5931 <div class="dropdown__column-header">@Translate("Pages")</div> 5932 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom dw-mod"> 5933 {{>SearchPagesTemplate}} 5934 </ul> 5935 </script> 5936 5937 <script id="SearchProductsTemplateWrap" type="text/x-template"> 5938 <div class="dropdown__column-header">@Translate("Products")</div> 5939 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom dw-mod"> 5940 {{>SearchProductsTemplate}} 5941 </ul> 5942 </script> 5943 } 5944 5945 5946 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 5947 5948 @using System 5949 @using System.Web 5950 @using System.Collections.Generic 5951 @using Dynamicweb.Rapido.Blocks.Extensibility 5952 @using Dynamicweb.Rapido.Blocks 5953 5954 @{ 5955 BlocksPage bottomSnippetsBlocksPage = BlocksPage.GetBlockPage("Master"); 5956 5957 Block primaryBottomSnippets = new Block() 5958 { 5959 Id = "MasterJavascriptInitializers", 5960 SortId = 100, 5961 Template = RenderPrimaryBottomSnippets() 5962 }; 5963 bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, primaryBottomSnippets); 5964 } 5965 5966 @helper RenderPrimaryBottomSnippets() { 5967 bool isWireframeMode = Model.Area.Item.GetItem("Settings").GetBoolean("WireframeMode"); 5968 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 5969 5970 if (isWireframeMode) 5971 { 5972 <script> 5973 Wireframe.Init(true); 5974 </script> 5975 } 5976 5977 5978 if (useGoogleTagManager) 5979 { 5980 <script> 5981 document.addEventListener('addToCart', function(event) { 5982 var googleImpression = event.detail.productInfo.googleImpression; 5983 dataLayer.push({ 5984 'event': 'addToCart', 5985 'ecommerce': { 5986 'currencyCode': '@Dynamicweb.Ecommerce.Services.Currencies.GetDefaultCurrency().Code', 5987 'add': { 5988 'products': [{ 5989 'name': googleImpression.name, 5990 'id': googleImpression.id, 5991 'price': googleImpression.price, 5992 'brand': googleImpression.brand, 5993 'category': googleImpression.category, 5994 'variant': googleImpression.variant, 5995 'quantity': event.detail.quantity 5996 }] 5997 } 5998 } 5999 }); 6000 }); 6001 </script> 6002 } 6003 6004 //if digitalwarehouse 6005 if (Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart")) 6006 { 6007 string cartContextId = Converter.ToString(HttpContext.Current.Application["DownloadCartContext"]); 6008 6009 if (string.IsNullOrEmpty(cartContextId)) { 6010 var moduleProps = Dynamicweb.Modules.Properties.GetParagraphModuleSettings(GetPageIdByNavigationTag("DownloadCart"), "eCom_CartV2"); 6011 var cartSettings = new Dynamicweb.Ecommerce.Cart.ModuleSettings(moduleProps); 6012 cartContextId = cartSettings.OrderContextID; 6013 HttpContext.Current.Application["DownloadCartContext"] = cartContextId; 6014 } 6015 6016 <script> 6017 let downloadCart = new DownloadCart({ 6018 cartPageId: @GetPageIdByNavigationTag("MiniCartFeed"), 6019 contextId: "@cartContextId", 6020 addButtonText: "@Translate("Add")", 6021 removeButtonText: "@Translate("Remove")" 6022 }); 6023 </script> 6024 } 6025 6026 <!--@Javascripts--> 6027 } 6028 @if (File.Exists(HttpContext.Current.Server.MapPath("/MasterBlocks/Custom__Blocks.cshtml"))) 6029 { 6030 <text>@inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 6031 6032 @using System 6033 @using System.Web 6034 @using System.Collections.Generic 6035 @using Dynamicweb.Rapido.Blocks 6036 6037 @{ 6038 BlocksPage masterCustomBlocksPage = BlocksPage.GetBlockPage("Master"); 6039 6040 }</text> 6041 } 6042 6043 6044 @functions { 6045 public class ManifestIcon 6046 { 6047 public string src { get; set; } 6048 public string type { get; set; } 6049 public string sizes { get; set; } 6050 } 6051 6052 public class Manifest 6053 { 6054 public string name { get; set; } 6055 public string short_name { get; set; } 6056 public string start_url { get; set; } 6057 public string display { get; set; } 6058 public string background_color { get; set; } 6059 public string theme_color { get; set; } 6060 public List<ManifestIcon> icons { get; set; } 6061 } 6062 } 6063 @{ 6064 if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName")) && Model.Area.Item.GetItem("Settings").GetFile("AppIcon") != null) { 6065 Manifest manifest = new Manifest 6066 { 6067 name = Model.Area.Item.GetItem("Settings").GetString("AppName"), 6068 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"), 6069 start_url = "/", 6070 display = "standalone", 6071 background_color = Model.Area.Item.GetItem("Settings").GetString("AppBackgroundColor"), 6072 theme_color = Model.Area.Item.GetItem("Settings").GetString("AppThemeColor") 6073 }; 6074 6075 manifest.icons = new List<ManifestIcon> { 6076 new ManifestIcon { 6077 src = "/Admin/Public/GetImage.ashx?width=192&height=192&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 6078 sizes = "192x192", 6079 type = "image/png" 6080 }, 6081 new ManifestIcon { 6082 src = "/Admin/Public/GetImage.ashx?width=512&height=512&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 6083 sizes = "512x512", 6084 type = "image/png" 6085 }, 6086 new ManifestIcon { 6087 src = "/Admin/Public/GetImage.ashx?width=1024&height=1024&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 6088 sizes = "1024x1024", 6089 type = "image/png" 6090 } 6091 }; 6092 6093 string manifestFilePath = HttpContext.Current.Request.MapPath("/Files/Templates/Designs/Rapido/manifest.json"); 6094 string manifestJSON = Newtonsoft.Json.JsonConvert.SerializeObject(manifest); 6095 string currentManifest = File.ReadAllText(manifestFilePath); 6096 6097 if (manifestJSON != currentManifest) 6098 { 6099 File.WriteAllText(manifestFilePath, manifestJSON); 6100 } 6101 } 6102 } 6103 6104 @{ 6105 var swatches = new Dynamicweb.Content.Items.ColorSwatchService(); 6106 var brandColors = swatches.GetColorSwatch(1); 6107 string brandColorOne = brandColors.Palette["BrandColor1"]; 6108 6109 //CS NT Ticks for files 6110 var customJSfileInfo = new System.IO.FileInfo(System.Web.HttpContext.Current.Server.MapPath("/Files/Templates/Designs/Rapido/js/source/Custom.js")); 6111 var nextechCSSfileInfo = new System.IO.FileInfo(System.Web.HttpContext.Current.Server.MapPath("/Files/Templates/Designs/Rapido/css/nextech.css")); 6112 6113 string addId_FB = ""; 6114 string url_FB = HttpContext.Current.Request.Url.AbsoluteUri; 6115 string imageURL_FB_path = ""; 6116 string imageURL_FB = ""; 6117 string imageExtension_FB ="png"; 6118 string title_FB = ""; 6119 string description_FB = ""; 6120 if(Model != null && Model.Item != null && Model.Item.GetFile("Image") != null )//&& !string.IsNullOrWhiteSpace(Model.Item.GetFile("Image").Path)) 6121 { 6122 imageURL_FB_path = Model.Item.GetFile("Image").ToString(); 6123 imageURL_FB = string.Format("{0}://{1}{2}", Dynamicweb.Context.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, imageURL_FB_path); 6124 title_FB = Model.Item.GetString("Title"); 6125 description_FB = Model.Item.GetString("Summary"); 6126 imageExtension_FB = Model.Item.GetFile("Image").Extension.Replace(".",""); 6127 6128 }else{ 6129 imageURL_FB = "https://staging.hollandandbarrett.com.cy/Files/Images/FeaturedImageForURLs.png"; 6130 title_FB = "Holland & Barrett Cyprus"; 6131 description_FB = "Holland And Barrett Cyprus"; 6132 } 6133 imageExtension_FB = "image/" + imageExtension_FB; 6134 6135 if (!string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID"))) 6136 { 6137 //addId_FB = Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID"); 6138 } 6139 6140 } 6141 6142 <!DOCTYPE html> 6143 6144 <html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName"> 6145 <head> 6146 <!-- Rapido version 3.1.1 --> 6147 <meta charset="utf-8" /> 6148 <title>@Model.Title</title> 6149 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 6150 <meta name="robots" content="index, follow"> 6151 <meta name="theme-color" content="@brandColorOne" /> 6152 <!--FACEBOOK--> 6153 <meta property="fb:app_id" content="@addId_FB"> 6154 <meta property="og:image" content="@imageURL_FB"> 6155 <meta property="og:image:type" content="image/png"> 6156 <meta property="og:image:width" content="1024"> 6157 <meta property="og:image:height" content="1024"> 6158 <meta property="og:type" content="website" /> 6159 <!--CS NT This redirects all pages <meta property="og:url" content="https://staging.hollandandbarrett.com.cy"/>--> 6160 <meta property="og:url" content="@url_FB"/> 6161 <meta property="og:title" content="@title_FB" /> 6162 <meta property="og:description" content="@description_FB" /> 6163 6164 @Model.MetaTags 6165 6166 <!-- CS NT JQuery Library--> 6167 <script type="text/javascript" src="/Files/Templates/Designs/Rapido/js/jquery.min.js"></script> 6168 6169 <!-- CS NT Slick.js Library--> 6170 <script type="text/javascript" src="/Files/Templates/Designs/Rapido/js/slick.js"></script> 6171 6172 <!-- CS NT Jquery Mask.js Library UNUSED --> 6173 <!--<script type="text/javascript" src="/Files/Templates/Designs/Rapido/js/jquery.mask.min.js"></script>--> 6174 6175 <!-- CS NT Custom.js from DW--> 6176 <script type="text/javascript" src="/Files/Templates/Designs/Rapido/js/source/Custom.js?ticks=@customJSfileInfo.LastWriteTime.Ticks.ToString()"></script> 6177 6178 <!-- Favicon --> 6179 <link href="@favicon" rel="icon" type="image/png"> 6180 6181 <!-- Base (Default, wireframe) styles --> 6182 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/base/base.min.css" type="text/css"> 6183 6184 <!-- Rapido Css from Website Settings --> 6185 <link rel="stylesheet" id="rapidoCss" href="@autoCssLink" type="text/css"> 6186 6187 <!-- Ignite Css (Custom site specific styles) --> 6188 <link rel="stylesheet" id="igniteCss" type="text/css" href="/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css"> 6189 6190 <!-- Font awesome --> 6191 <link rel="stylesheet" href="@fontAwesomeCssLink" type="text/css"> 6192 6193 <!-- Flag icon --> 6194 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css" type="text/css"> 6195 6196 <!-- CS NT Custom nextech.css--> 6197 <link rel="stylesheet" type="text/css" href="/Files/Templates/Designs/Rapido/css/nextech.css?ticks=@nextechCSSfileInfo.LastWriteTime.Ticks.ToString()"> 6198 6199 <!-- CS NT Custom slick.css--> 6200 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/slick.css" type="text/css"> 6201 6202 <!-- CS NT Custom slick-theme.css--> 6203 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/slick-theme.css" type="text/css"> 6204 6205 <!-- Google fonts --> 6206 @{ 6207 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))); 6208 } 6209 <link href="https://fonts.googleapis.com/css?family=@family" rel="stylesheet"> 6210 @{ 6211 PushPromise(favicon); 6212 PushPromise(fontAwesomeCssLink); 6213 PushPromise("/Files/Templates/Designs/Rapido/css/base/base.min.css"); 6214 PushPromise(autoCssLink); 6215 PushPromise("/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css"); 6216 PushPromise("/Files/Images/placeholder.gif"); 6217 PushPromise("/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css"); 6218 } 6219 6220 @if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName"))) 6221 { 6222 <link rel="manifest" href="/Files/Templates/Designs/Rapido/manifest.json"> 6223 PushPromise("/Files/Templates/Designs/Rapido/manifest.json"); 6224 } 6225 </head> 6226 6227 <body> 6228 6229 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 6230 @RenderBlockList(masterPage.BlocksRoot.BlocksList) 6231 6232 6233 @helper RenderMasterHeader() 6234 { 6235 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterHeader").OrderBy(item => item.SortId).ToList(); 6236 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 6237 string stickyTop = isNavigationStickyMenu ? "top-container--sticky" : ""; 6238 6239 <header class="top-container @stickyTop dw-mod" id="Top"> 6240 @RenderBlockList(subBlocks) 6241 </header> 6242 } 6243 6244 @helper RenderMain() 6245 { 6246 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMain").OrderBy(item => item.SortId).ToList(); 6247 6248 <main class="site dw-mod"> 6249 @RenderBlockList(subBlocks) 6250 </main> 6251 } 6252 6253 @helper RenderPageContent() 6254 { 6255 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 6256 string pagePos = isNavigationStickyMenu ? "js-page-pos" : ""; 6257 6258 <div id="Page" class="page @pagePos"> 6259 <section class="center-container content-container dw-mod" id="content"> 6260 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 6261 6262 6263 @using Dynamicweb.Rapido.Blocks.Components 6264 @using Dynamicweb.Rapido.Blocks.Components.Articles 6265 @using Dynamicweb.Rapido.Blocks.Components.General 6266 @using Dynamicweb.Rapido.Blocks 6267 6268 @functions { 6269 BlocksPage articlePage = BlocksPage.GetBlockPage("BlogArticle"); 6270 } 6271 6272 @{ 6273 string image = !String.IsNullOrEmpty(Model.Item.GetString("Image")) ? Model.Item.GetFile("Image").PathUrlEncoded : ""; 6274 6275 ArticleHeader topBanner = new ArticleHeader 6276 { 6277 Layout = ArticleHeaderLayout.Banner, 6278 Image = new Image { Path = image }, 6279 Heading = Model.Item.GetString("Title"), 6280 Subheading = Model.Item.GetString("Summary"), 6281 TextColor = "#fff", 6282 Category = Model.Item.GetString("Author"), 6283 Date = Model.Item.GetString("Date"), 6284 ButtonLayout = ButtonLayout.Primary, 6285 TextLayout = ArticleHeaderTextLayout.Full 6286 }; 6287 6288 ButtonLayout buttonDesign; 6289 Enum.TryParse<ButtonLayout>(Model.Item.GetString("ButtonDesign"), out buttonDesign); 6290 if (Enum.GetName(typeof(ButtonLayout), buttonDesign).ToLower() == "none") 6291 { 6292 buttonDesign = ButtonLayout.Primary; 6293 } 6294 6295 Block articleContainer = new Block 6296 { 6297 Id = "ArticleContainer", 6298 SortId = 10, 6299 Design = new Design 6300 { 6301 RenderType = RenderType.Row 6302 }, 6303 BlocksList = new List<Block> { 6304 new Block { 6305 Id = "ArticleHeader", 6306 SortId = 20, 6307 Component = topBanner, 6308 Design = new Design { 6309 RenderType = RenderType.Column, 6310 Size = "12", 6311 HidePadding = true, 6312 CssClass = "article-head" 6313 } 6314 }, 6315 new Block { 6316 Id = "ArticleBody", 6317 SortId = 30, 6318 Design = new Design { 6319 RenderType = RenderType.Column, 6320 Size = "8" 6321 }, 6322 BlocksList = new List<Block> { 6323 new Block { 6324 Id = "ArticleBodyRow", 6325 SortId = 10, 6326 Design = new Design { 6327 RenderType = RenderType.Row 6328 }, 6329 BlocksList = new List<Block> { 6330 new Block { 6331 Id = "ArticleText", 6332 SortId = 10, 6333 Component = new ArticleText { Text = Model.Item.GetString("Text") }, 6334 Design = new Design { 6335 RenderType = RenderType.Column, 6336 Size = "12", 6337 CssClass = "u-padding--lg" 6338 } 6339 }, 6340 new Block { 6341 Id = "ArticleLink", 6342 SortId = 20, 6343 Component = new ArticleLink { Link = Model.Item.GetString("Link"), Title = Model.Item.GetString("LinkText"), ButtonLayout = buttonDesign }, 6344 Design = new Design { 6345 RenderType = RenderType.Column, 6346 Size = "12", 6347 CssClass = "u-padding--lg u-ta-right" 6348 } 6349 } 6350 } 6351 } 6352 } 6353 } 6354 } 6355 }; 6356 articlePage.Add(articleContainer); 6357 6358 if (Model.PropertyItem.GetList("ShowBreadcrumb").SelectedValue == "True") 6359 { 6360 Block breadcrumb = new Block 6361 { 6362 Id = "ArticleBreadcrumb", 6363 SortId = 10, 6364 Component = new BreadcrumbNavigation { }, 6365 Design = new Design 6366 { 6367 RenderType = RenderType.Column, 6368 Size = "12" 6369 } 6370 }; 6371 articlePage.Add("ArticleContainer", breadcrumb); 6372 } 6373 } 6374 6375 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 6376 @RenderBlockList(articlePage.BlocksRoot.BlocksList) 6377 6378 </section> 6379 </div> 6380 } 6381 6382 <script> 6383 $(document).ready(function(){ 6384 //CS NT Not used now.. Maybe used in the future to displaying and error anywhere as an alert or a modal 6385 let searchParams = new URLSearchParams(window.location.search); 6386 if (searchParams.has('StockError')) 6387 { 6388 let stockErrorPar = searchParams.get('StockError'); 6389 alert(stockErrorPar); 6390 } 6391 }); 6392 </script> 6393 </body> 6394 </html> 6395 6396