Error executing template "Designs/Rapido/_parsed/DynamicArticle.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_df8ebf89c98d4fea80fbde497dd24f88.b__177_0(TextWriter __razor_helper_writer)
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_df8ebf89c98d4fea80fbde497dd24f88.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer)
   at CompiledRazorTemplates.Dynamic.RazorEngine_df8ebf89c98d4fea80fbde497dd24f88.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer)
   at CompiledRazorTemplates.Dynamic.RazorEngine_df8ebf89c98d4fea80fbde497dd24f88.b__172_0(TextWriter __razor_helper_writer)
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_df8ebf89c98d4fea80fbde497dd24f88.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer)
   at CompiledRazorTemplates.Dynamic.RazorEngine_df8ebf89c98d4fea80fbde497dd24f88.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer)
   at CompiledRazorTemplates.Dynamic.RazorEngine_df8ebf89c98d4fea80fbde497dd24f88.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer)
   at CompiledRazorTemplates.Dynamic.RazorEngine_df8ebf89c98d4fea80fbde497dd24f88.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer)
   at CompiledRazorTemplates.Dynamic.RazorEngine_df8ebf89c98d4fea80fbde497dd24f88.Execute()
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

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