Error executing template "Designs/Rapido/_parsed/NewsArticle.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_d1efb7153f2f41b085ada2f629ed4ce0.Execute() in E:\Domains\Sites\lorenz.com\Files\Templates\Designs\Rapido\_parsed\NewsArticle.parsed.cshtml:line 9244
   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.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   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 @functions { 18 BlocksPage masterPage = BlocksPage.GetBlockPage("Master"); 19 20 string getFontFamily(params string[] items) 21 { 22 var itemParent = Pageview.AreaSettings; 23 foreach (var item in items) 24 { 25 itemParent = itemParent.GetItem(item); 26 if (itemParent == null) 27 { 28 return null; 29 } 30 } 31 32 var googleFont = itemParent.GetGoogleFont("FontFamily"); 33 if (googleFont == null) 34 { 35 return null; 36 } 37 return googleFont.Family.Replace(" ", "+"); 38 } 39 } 40 41 @{ 42 Block root = new Block 43 { 44 Id = "Root", 45 SortId = 10, 46 BlocksList = new List<Block> 47 { 48 new Block { 49 Id = "Head", 50 SortId = 10, 51 SkipRenderBlocksList = true, 52 Template = RenderMasterHead(), 53 BlocksList = new List<Block> 54 { 55 new Block { 56 Id = "HeadMetadata", 57 SortId = 10, 58 Template = RenderMasterMetadata(), 59 }, 60 new Block { 61 Id = "HeadCss", 62 SortId = 20, 63 Template = RenderMasterCss(), 64 }, 65 new Block { 66 Id = "HeadManifest", 67 SortId = 30, 68 Template = RenderMasterManifest(), 69 } 70 } 71 }, 72 new Block { 73 Id = "Body", 74 SortId = 20, 75 SkipRenderBlocksList = true, 76 Template = RenderMasterBody(), 77 BlocksList = new List<Block> 78 { 79 new Block() 80 { 81 Id = "Master", 82 SortId = 10, 83 BlocksList = new List<Block> { 84 new Block { 85 Id = "MasterTopSnippets", 86 SortId = 10 87 }, 88 new Block { 89 Id = "MasterMain", 90 SortId = 20, 91 Template = RenderMain(), 92 SkipRenderBlocksList = true, 93 BlocksList = new List<Block> { 94 new Block { 95 Id = "MasterHeader", 96 SortId = 10, 97 Template = RenderMasterHeader(), 98 SkipRenderBlocksList = true 99 }, 100 new Block { 101 Id = "MasterPageContent", 102 SortId = 20, 103 Template = RenderPageContent() 104 } 105 } 106 }, 107 new Block { 108 Id = "MasterFooter", 109 SortId = 30 110 }, 111 new Block { 112 Id = "MasterReferences", 113 SortId = 40 114 }, 115 new Block { 116 Id = "MasterBottomSnippets", 117 SortId = 50 118 } 119 } 120 } 121 } 122 } 123 } 124 }; 125 126 masterPage.Add(root); 127 } 128 129 @* Include the required Grid builder (Contains the methods @RenderBlockList and @RenderBlock) *@ 130 @using System.Text.RegularExpressions 131 @using System.Collections.Generic 132 @using System.Reflection 133 @using System.Web 134 @using System.Web.UI.HtmlControls 135 @using Dynamicweb.Rapido.Blocks.Components 136 @using Dynamicweb.Rapido.Blocks.Components.Articles 137 @using Dynamicweb.Rapido.Blocks.Components.Documentation 138 @using Dynamicweb.Rapido.Blocks 139 140 141 @*--- START: Base block renderers ---*@ 142 143 @helper RenderBlockList(List<Block> blocks) 144 { 145 bool debug = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("debug")) ? Convert.ToBoolean(HttpContext.Current.Request.QueryString.Get("debug")) : false; 146 blocks = blocks.OrderBy(item => item.SortId).ToList(); 147 148 foreach (Block item in blocks) 149 { 150 if (debug) { 151 <!-- Block START: @item.Id --> 152 } 153 154 if (item.Design == null) 155 { 156 @RenderBlock(item) 157 } 158 else if (item.Design.RenderType == RenderType.None) { 159 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : ""; 160 161 <div class="@cssClass dw-mod"> 162 @RenderBlock(item) 163 </div> 164 } 165 else if (item.Design.RenderType != RenderType.Hide) 166 { 167 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : ""; 168 169 if (!item.SkipRenderBlocksList) { 170 if (item.Design.RenderType == RenderType.Row) 171 { 172 <div class="grid grid--align-content-start @cssClass dw-mod" id="Block__@item.Id"> 173 @RenderBlock(item) 174 </div> 175 } 176 177 if (item.Design.RenderType == RenderType.Column) 178 { 179 string hidePadding = item.Design.HidePadding ? "u-no-padding" : ""; 180 string size = item.Design.Size ?? "12"; 181 size = Regex.IsMatch(size, @"\d") ? "md-" + item.Design.Size : item.Design.Size; 182 183 <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"> 184 @RenderBlock(item) 185 </div> 186 } 187 188 if (item.Design.RenderType == RenderType.Table) 189 { 190 <table class="table @cssClass dw-mod" id="Block__@item.Id"> 191 @RenderBlock(item) 192 </table> 193 } 194 195 if (item.Design.RenderType == RenderType.TableRow) 196 { 197 <tr class="@cssClass dw-mod" id="Block__@item.Id"> 198 @RenderBlock(item) 199 </tr> 200 } 201 202 if (item.Design.RenderType == RenderType.TableColumn) 203 { 204 <td class="@cssClass dw-mod" id="Block__@item.Id"> 205 @RenderBlock(item) 206 </td> 207 } 208 209 if (item.Design.RenderType == RenderType.CardHeader) 210 { 211 <div class="card-header @cssClass dw-mod"> 212 @RenderBlock(item) 213 </div> 214 } 215 216 if (item.Design.RenderType == RenderType.CardBody) 217 { 218 <div class="card @cssClass dw-mod"> 219 @RenderBlock(item) 220 </div> 221 } 222 223 if (item.Design.RenderType == RenderType.CardFooter) 224 { 225 <div class="card-footer @cssClass dw-mod"> 226 @RenderBlock(item) 227 </div> 228 } 229 } 230 else 231 { 232 @RenderBlock(item) 233 } 234 } 235 236 if (debug) { 237 <!-- Block END: @item.Id --> 238 } 239 } 240 } 241 242 @helper RenderBlock(Block item) 243 { 244 bool debug = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("debug")) ? Convert.ToBoolean(HttpContext.Current.Request.QueryString.Get("debug")) : false; 245 246 if (item.Template != null) 247 { 248 @BlocksPage.RenderTemplate(item.Template) 249 } 250 251 if (item.Component != null) 252 { 253 string customSufix = "Custom"; 254 string methodName = item.Component.HelperName; 255 256 ComponentBase[] methodParameters = new ComponentBase[1]; 257 methodParameters[0] = item.Component; 258 Type methodType = this.GetType(); 259 260 MethodInfo customMethod = methodType.GetMethod(methodName + customSufix); 261 MethodInfo generalMethod = methodType.GetMethod(methodName); 262 263 try { 264 if (debug) { 265 <!-- Component: @methodName.Replace("Render", "") --> 266 } 267 @customMethod.Invoke(this, methodParameters).ToString(); 268 } catch { 269 try { 270 @generalMethod.Invoke(this, methodParameters).ToString(); 271 } catch(Exception ex) { 272 throw new Exception(item.Component.GetType().Name + " method '" + methodName +"' could not be invoked", ex); 273 } 274 } 275 } 276 277 if (item.BlocksList.Count > 0 && !item.SkipRenderBlocksList) 278 { 279 @RenderBlockList(item.BlocksList) 280 } 281 } 282 283 @*--- END: Base block renderers ---*@ 284 285 286 @* Include the components *@ 287 @using Dynamicweb.Rapido.Blocks.Components 288 @using Dynamicweb.Rapido.Blocks.Components.General 289 @using Dynamicweb.Rapido.Blocks 290 @using System.IO 291 292 @* Required *@ 293 @using Dynamicweb.Rapido.Blocks.Components 294 @using Dynamicweb.Rapido.Blocks.Components.General 295 @using Dynamicweb.Rapido.Blocks 296 297 298 @helper Render(ComponentBase component) 299 { 300 if (component != null) 301 { 302 @component.Render(this) 303 } 304 } 305 306 307 @* Components *@ 308 @using System.Reflection 309 @using Dynamicweb.Rapido.Blocks.Components.General 310 311 312 @* Component *@ 313 314 @helper RenderIcon(Icon settings) 315 { 316 if (settings != null) 317 { 318 string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : ""; 319 320 if (settings.Name != null) 321 { 322 if (string.IsNullOrEmpty(settings.Label)) 323 { 324 <i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i> 325 } 326 else 327 { 328 if (settings.LabelPosition == IconLabelPosition.Before) 329 { 330 <span>@settings.Label <i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i></span> 331 } 332 else 333 { 334 <span><i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i> @settings.Label</span> 335 } 336 } 337 } 338 else if (!string.IsNullOrEmpty(settings.Label)) 339 { 340 @settings.Label 341 } 342 } 343 } 344 @using System.Reflection 345 @using Dynamicweb.Rapido.Blocks.Components.General 346 @using Dynamicweb.Rapido.Blocks.Components 347 @using Dynamicweb.Core 348 349 @* Component *@ 350 351 @helper RenderButton(Button settings) 352 { 353 if (settings != null && (!string.IsNullOrEmpty(settings.Title) || settings.Icon != null)) 354 { 355 Dictionary<string, string> attributes = new Dictionary<string, string>(); 356 List<string> classList = settings.CssClass != null ? settings.CssClass.Split(' ').ToList() : new List<string>(); 357 if (settings.Disabled) { 358 attributes.Add("disabled", "true"); 359 classList.Add("disabled"); 360 } 361 362 if (!string.IsNullOrEmpty(settings.ConfirmText) || !string.IsNullOrEmpty(settings.ConfirmTitle)) 363 { 364 settings.Id = !string.IsNullOrEmpty(settings.Id) ? settings.Id : Guid.NewGuid().ToString("N"); 365 @RenderConfirmDialog(settings); 366 settings.OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = true"; 367 } 368 369 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 370 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 371 if (!string.IsNullOrEmpty(settings.AltText)) 372 { 373 attributes.Add("title", settings.AltText); 374 } 375 376 var onClickEvents = new List<string>(); 377 if (!string.IsNullOrEmpty(settings.OnClick)) 378 { 379 onClickEvents.Add(settings.OnClick); 380 } 381 if (!string.IsNullOrEmpty(settings.Href)) 382 { 383 onClickEvents.Add("location.href='" + settings.Href + "'"); 384 } 385 if (onClickEvents.Count > 0) 386 { 387 attributes.Add("onClick", string.Join(";", onClickEvents)); 388 } 389 390 if (settings.ButtonLayout != ButtonLayout.None) 391 { 392 classList.Add("btn"); 393 string btnLayout = Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower(); 394 if (btnLayout == "linkclean") 395 { 396 btnLayout = "link-clean"; //fix 397 } 398 classList.Add("btn--" + btnLayout); 399 } 400 401 if (settings.Icon == null) 402 { 403 settings.Icon = new Icon(); 404 } 405 settings.Icon.Label = settings.Title; 406 407 attributes.Add("type", Enum.GetName(typeof(ButtonType), settings.ButtonType).ToLower()); 408 409 <button class="@string.Join(" ", classList) dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@Render(settings.Icon)</button> 410 } 411 } 412 413 @helper RenderConfirmDialog(Button settings) 414 { 415 Modal confirmDialog = new Modal { 416 Id = settings.Id, 417 Width = ModalWidth.Sm, 418 Heading = new Heading 419 { 420 Level = 2, 421 Title = settings.ConfirmTitle 422 }, 423 BodyText = settings.ConfirmText 424 }; 425 426 confirmDialog.AddAction(new Button { Title = Translate("Cancel"), ButtonLayout = ButtonLayout.Secondary, OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = false"}); 427 confirmDialog.AddAction(new Button { Title = Translate("OK"), ButtonLayout = ButtonLayout.Primary, OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = false;" + settings.OnClick }); 428 429 @Render(confirmDialog) 430 } 431 @using Dynamicweb.Rapido.Blocks.Components.General 432 @using Dynamicweb.Rapido.Blocks.Components 433 @using Dynamicweb.Core 434 435 @helper RenderDashboard(Dashboard settings) 436 { 437 var widgets = settings.GetWidgets(); 438 439 if (!string.IsNullOrEmpty(settings.WidgetsBaseBackgroundColor)) 440 { 441 //set bg color for them 442 443 System.Drawing.Color color = System.Drawing.ColorTranslator.FromHtml(settings.WidgetsBaseBackgroundColor); 444 int r = Convert.ToInt16(color.R); 445 int g = Convert.ToInt16(color.G); 446 int b = Convert.ToInt16(color.B); 447 448 var count = widgets.Length; 449 var max = Math.Max(r, Math.Max(g, b)); 450 double step = 255.0 / (max * count); 451 var i = 0; 452 foreach (var widget in widgets) 453 { 454 i++; 455 456 var shade = "rgb(" + Converter.ToString(r * step * i).Replace(",", ".") + ", " + Converter.ToString(g * step * i).Replace(",", ".") + ", " + Converter.ToString(b * step * i).Replace(",", ".") + ")"; 457 widget.BackgroundColor = shade; 458 } 459 } 460 461 <div class="dashboard @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 462 @foreach (var widget in widgets) 463 { 464 <div class="dashboard__widget"> 465 @Render(widget) 466 </div> 467 } 468 </div> 469 } 470 @using Dynamicweb.Rapido.Blocks.Components.General 471 @using Dynamicweb.Rapido.Blocks.Components 472 473 @helper RenderDashboardWidgetLink(DashboardWidgetLink settings) 474 { 475 if (!string.IsNullOrEmpty(settings.Link)) 476 { 477 var backgroundStyles = ""; 478 if (!string.IsNullOrEmpty(settings.BackgroundColor)) 479 { 480 backgroundStyles = "style=\"background-color:" + settings.BackgroundColor + "\""; 481 } 482 483 <a href="@settings.Link" class="widget widget--link @settings.CssClass dw-mod" @backgroundStyles title="@settings.Title" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 484 <div class="u-center-middle u-color-light"> 485 @if (settings.Icon != null) 486 { 487 settings.Icon.CssClass += "widget__icon"; 488 @Render(settings.Icon) 489 } 490 <div class="widget__title">@settings.Title</div> 491 </div> 492 </a> 493 } 494 } 495 @using Dynamicweb.Rapido.Blocks.Components.General 496 @using Dynamicweb.Rapido.Blocks.Components 497 498 @helper RenderDashboardWidgetCounter(DashboardWidgetCounter settings) 499 { 500 var backgroundStyles = ""; 501 if (!string.IsNullOrEmpty(settings.BackgroundColor)) 502 { 503 backgroundStyles = "style='background-color:" + settings.BackgroundColor + "'"; 504 } 505 506 <div class="widget @settings.CssClass dw-mod" @backgroundStyles @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 507 <div class="u-center-middle u-color-light"> 508 @if (settings.Icon != null) 509 { 510 settings.Icon.CssClass += "widget__icon"; 511 @Render(settings.Icon) 512 } 513 <div class="widget__counter">@settings.Count</div> 514 <div class="widget__title">@settings.Title</div> 515 </div> 516 </div> 517 } 518 @using System.Reflection 519 @using Dynamicweb.Rapido.Blocks.Components.General 520 @using Dynamicweb.Rapido.Blocks.Components 521 @using Dynamicweb.Core 522 523 @* Component *@ 524 525 @helper RenderLink(Link settings) 526 { 527 if (settings != null && !string.IsNullOrEmpty(settings.Href) && (!string.IsNullOrEmpty(settings.Title) || settings.Icon != null)) 528 { 529 Dictionary<string, string> attributes = new Dictionary<string, string>(); 530 List<string> classList = settings.CssClass != null ? settings.CssClass.Split(' ').ToList() : new List<string>(); 531 if (settings.Disabled) 532 { 533 attributes.Add("disabled", "true"); 534 classList.Add("disabled"); 535 } 536 537 if (!string.IsNullOrEmpty(settings.AltText)) 538 { 539 attributes.Add("title", settings.AltText); 540 } 541 else if (!string.IsNullOrEmpty(settings.Title)) 542 { 543 attributes.Add("title", settings.Title); 544 } 545 546 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 547 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 548 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onClick", settings.OnClick); } 549 attributes.Add("href", settings.Href); 550 551 if (settings.ButtonLayout != ButtonLayout.None) 552 { 553 classList.Add("btn"); 554 string btnLayout = Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower(); 555 if (btnLayout == "linkclean") 556 { 557 btnLayout = "link-clean"; //fix 558 } 559 classList.Add("btn--" + btnLayout); 560 } 561 562 if (settings.Icon == null) 563 { 564 settings.Icon = new Icon(); 565 } 566 settings.Icon.Label = settings.Title; 567 568 if (settings.Target == LinkTargetType.Blank && settings.Rel == LinkRelType.None) 569 { 570 settings.Rel = LinkRelType.Noopener; 571 } 572 if (settings.Target != LinkTargetType.None) 573 { 574 attributes.Add("target", "_" + Enum.GetName(typeof(LinkTargetType), settings.Target).ToLower()); 575 } 576 if (settings.Download) 577 { 578 attributes.Add("download", "true"); 579 } 580 if (settings.Rel != LinkRelType.None) 581 { 582 attributes.Add("rel", Enum.GetName(typeof(LinkRelType), settings.Rel).ToLower()); 583 } 584 585 <a class="@string.Join(" ", classList) dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@Render(settings.Icon)</a> 586 } 587 } 588 @using System.Reflection 589 @using Dynamicweb.Rapido.Blocks.Components 590 @using Dynamicweb.Rapido.Blocks.Components.General 591 @using Dynamicweb.Rapido.Blocks 592 593 594 @* Component *@ 595 596 @helper RenderRating(Rating settings) 597 { 598 if (settings.Score > 0) 599 { 600 int rating = settings.Score; 601 string iconType = "fa-star"; 602 603 switch (settings.Type.ToString()) { 604 case "Stars": 605 iconType = "fa-star"; 606 break; 607 case "Hearts": 608 iconType = "fa-heart"; 609 break; 610 case "Lemons": 611 iconType = "fa-lemon"; 612 break; 613 case "Bombs": 614 iconType = "fa-bomb"; 615 break; 616 } 617 618 <div class="u-ta-right"> 619 @for (int i = 0; i < settings.OutOf; i++) 620 { 621 <i class="@(rating > i ? "fas" : "far") @iconType"></i> 622 } 623 </div> 624 } 625 } 626 @using System.Reflection 627 @using Dynamicweb.Rapido.Blocks.Components.General 628 @using Dynamicweb.Rapido.Blocks.Components 629 630 631 @* Component *@ 632 633 @helper RenderSelectFieldOption(SelectFieldOption settings) 634 { 635 Dictionary<string, string> attributes = new Dictionary<string, string>(); 636 if (settings.Checked) { attributes.Add("selected", "true"); } 637 if (settings.Disabled) { attributes.Add("disabled", "true"); } 638 if (settings.Value != null) { attributes.Add("value", settings.Value); } 639 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 640 641 <option @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Label</option> 642 } 643 @using System.Reflection 644 @using Dynamicweb.Rapido.Blocks.Components.General 645 @using Dynamicweb.Rapido.Blocks.Components 646 647 648 @* Component *@ 649 650 @helper RenderNavigation(Navigation settings) { 651 @RenderNavigation(new 652 { 653 id = settings.Id, 654 cssclass = settings.CssClass, 655 startLevel = settings.StartLevel, 656 endlevel = settings.EndLevel, 657 expandmode = settings.Expandmode, 658 sitemapmode = settings.SitemapMode, 659 template = settings.Template 660 }) 661 } 662 @using Dynamicweb.Rapido.Blocks.Components.General 663 @using Dynamicweb.Rapido.Blocks.Components 664 665 666 @* Component *@ 667 668 @helper RenderBreadcrumbNavigation(BreadcrumbNavigation settings) { 669 settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id; 670 settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template; 671 settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel; 672 settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel; 673 settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode; 674 settings.SitemapMode = false; 675 676 @RenderNavigation(settings) 677 } 678 @using Dynamicweb.Rapido.Blocks.Components.General 679 @using Dynamicweb.Rapido.Blocks.Components 680 681 682 @* Component *@ 683 684 @helper RenderLeftNavigation(LeftNavigation settings) { 685 settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id; 686 settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template; 687 settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel; 688 settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel; 689 settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode; 690 691 <div class="grid__cell"> 692 @RenderNavigation(settings) 693 </div> 694 } 695 @using System.Reflection 696 @using Dynamicweb.Rapido.Blocks.Components.General 697 @using Dynamicweb.Core 698 699 @* Component *@ 700 701 @helper RenderHeading(Heading settings) 702 { 703 if (settings != null && !string.IsNullOrEmpty(settings.Title)) 704 { 705 string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : ""; 706 string tagName = settings.Level != 0 ? "h" + settings.Level.ToString() : "div"; 707 708 @("<" + tagName + " class=\"" + settings.CssClass + " dw-mod\" " + color + ">") 709 if (!string.IsNullOrEmpty(settings.Link)) 710 { 711 @Render(new Link { Href = settings.Link, Icon = settings.Icon, Title = settings.Title, ButtonLayout = ButtonLayout.None }) 712 } 713 else 714 { 715 if (settings.Icon == null) 716 { 717 settings.Icon = new Icon(); 718 } 719 settings.Icon.Label = settings.Title; 720 @Render(settings.Icon) 721 } 722 @("</" + tagName + ">"); 723 } 724 } 725 @using Dynamicweb.Rapido.Blocks.Components 726 @using Dynamicweb.Rapido.Blocks.Components.General 727 @using Dynamicweb.Rapido.Blocks 728 729 730 @* Component *@ 731 732 @helper RenderImage(Image settings) 733 { 734 if (settings.FilterPrimary != ImageFilter.None || settings.FilterSecondary != ImageFilter.None) 735 { 736 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>(); 737 if (!string.IsNullOrEmpty(settings.FilterColor)) { optionalAttributes.Add("style", "background-color: " + settings.FilterColor); } 738 739 if (settings.Caption != null) 740 { 741 @:<div> 742 } 743 744 var primaryFilterClass = settings.FilterPrimary.ToString().ToLower(); 745 var secondaryFilterClass = settings.FilterSecondary.ToString().ToLower(); 746 747 <div class="image-filter image-filter--@primaryFilterClass u-position-relative dw-mod" @ComponentMethods.AddAttributes(optionalAttributes)> 748 <div class="image-filter image-filter--@secondaryFilterClass dw-mod"> 749 @if (settings.Link != null) 750 { 751 <a href="@settings.Link"> 752 @RenderTheImage(settings) 753 </a> 754 } 755 else 756 { 757 @RenderTheImage(settings) 758 } 759 </div> 760 </div> 761 762 if (settings.Caption != null) 763 { 764 <span class="image-caption dw-mod">@settings.Caption</span> 765 @:</div> 766 } 767 } 768 else 769 { 770 if (settings.Caption != null) 771 { 772 @:<div> 773 } 774 if (!string.IsNullOrEmpty(settings.Link)) 775 { 776 <a href="@settings.Link"> 777 @RenderTheImage(settings) 778 </a> 779 } 780 else 781 { 782 @RenderTheImage(settings) 783 } 784 785 if (settings.Caption != null) 786 { 787 <span class="image-caption dw-mod">@settings.Caption</span> 788 @:</div> 789 } 790 } 791 } 792 793 @helper RenderTheImage(Image settings) 794 { 795 if (settings != null) 796 { 797 string placeholderImage = "/Files/Images/placeholder.gif"; 798 string imageEngine = "/Admin/Public/GetImage.ashx?"; 799 800 string imageStyle = ""; 801 802 switch (settings.Style) 803 { 804 case ImageStyle.Ball: 805 imageStyle = "grid__cell-img--ball"; 806 break; 807 } 808 809 if (settings.Style == ImageStyle.Ball || settings.Style == ImageStyle.Circle) 810 { 811 if (settings.ImageDefault != null) 812 { 813 settings.ImageDefault.Height = settings.ImageDefault.Width; 814 } 815 if (settings.ImageMedium != null) 816 { 817 settings.ImageMedium.Height = settings.ImageMedium.Width; 818 } 819 if (settings.ImageSmall != null) 820 { 821 settings.ImageSmall.Height = settings.ImageSmall.Width; 822 } 823 } 824 825 string defaultImage = imageEngine; 826 string imageSmall = ""; 827 string imageMedium = ""; 828 829 if (settings.DisableImageEngine) 830 { 831 defaultImage = settings.Path; 832 } 833 else 834 { 835 if (settings.ImageDefault != null) 836 { 837 if (settings.ImageDefault.Format == ImageFormat.Default) { settings.ImageDefault.Format = ImageFormat.WebP; } 838 defaultImage += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageDefault); 839 840 if (settings.Path.GetType() != typeof(string)) 841 { 842 defaultImage += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 843 defaultImage += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 844 } 845 else 846 { 847 defaultImage += settings.Path != null ? "Image=" + settings.Path : ""; 848 } 849 } 850 851 if (settings.ImageSmall != null) 852 { 853 if (settings.ImageSmall.Format == ImageFormat.Default) { settings.ImageSmall.Format = ImageFormat.WebP; } 854 imageSmall = "data-src-small=\"" + imageEngine; 855 imageSmall += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageSmall); 856 857 if (settings.Path.GetType() != typeof(string)) 858 { 859 imageSmall += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 860 imageSmall += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 861 } 862 else 863 { 864 imageSmall += settings.Path != null ? "Image=" + settings.Path : ""; 865 } 866 867 imageSmall += "\""; 868 } 869 870 if (settings.ImageMedium != null) 871 { 872 if (settings.ImageMedium.Format == ImageFormat.Default) { settings.ImageMedium.Format = ImageFormat.WebP; } 873 imageMedium = "data-src-medium=\"" + imageEngine; 874 imageMedium += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageMedium); 875 876 if (settings.Path.GetType() != typeof(string)) 877 { 878 imageMedium += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 879 imageMedium += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 880 } 881 else 882 { 883 imageMedium += settings.Path != null ? "Image=" + settings.Path : ""; 884 } 885 886 imageMedium += "\""; 887 } 888 } 889 890 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>(); 891 if (!string.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick); } 892 if (!string.IsNullOrEmpty(settings.Title)) 893 { 894 optionalAttributes.Add("alt", settings.Title); 895 optionalAttributes.Add("title", settings.Title); 896 } 897 898 if (settings.DisableLazyLoad) 899 { 900 <img id="@settings.Id" class="@imageStyle @settings.CssClass dw-mod" src="@defaultImage" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 901 } 902 else 903 { 904 <img id="@settings.Id" class="b-lazy @imageStyle @settings.CssClass dw-mod" src="@placeholderImage" data-src="@defaultImage" @imageSmall @imageMedium @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 905 } 906 } 907 } 908 @using System.Reflection 909 @using Dynamicweb.Rapido.Blocks.Components.General 910 @using Dynamicweb.Rapido.Blocks.Components 911 912 @* Component *@ 913 914 @helper RenderFileField(FileField settings) 915 { 916 var attributes = new Dictionary<string, string>(); 917 if (string.IsNullOrEmpty(settings.Id)) 918 { 919 settings.Id = Guid.NewGuid().ToString("N"); 920 } 921 922 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 923 if (settings.Disabled) { attributes.Add("disabled", "true"); } 924 if (settings.Required) { attributes.Add("required", "true"); } 925 if (settings.Multiple) { attributes.Add("multiple", "true"); } 926 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 927 if (string.IsNullOrEmpty(settings.ChooseFileText)) 928 { 929 settings.ChooseFileText = Translate("Choose file"); 930 } 931 if (string.IsNullOrEmpty(settings.NoFilesChosenText)) 932 { 933 settings.NoFilesChosenText = Translate("No files chosen..."); 934 } 935 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 936 937 string setValueToFakeInput = "FileUpload.setValueToFakeInput(this)"; 938 attributes.Add("onchange", setValueToFakeInput + (!string.IsNullOrEmpty(settings.OnChange) ? settings.OnChange : "")); 939 940 attributes.Add("type", "file"); 941 if (!string.IsNullOrEmpty(settings.Value)) { attributes.Add("value", settings.Value); } 942 settings.CssClass = "u-full-width " + settings.CssClass; 943 944 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 945 946 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod"> 947 @if (!string.IsNullOrEmpty(settings.Label)) 948 { 949 <label for="@settings.Id">@settings.Label</label> 950 } 951 @if (!string.IsNullOrEmpty(settings.HelpText)) 952 { 953 <small class="form__help-text">@settings.HelpText</small> 954 } 955 956 <div class="form__field-combi file-input u-no-margin dw-mod"> 957 <input @ComponentMethods.AddAttributes(resultAttributes) class="file-input__real-input" data-no-files-text="@settings.NoFilesChosenText" data-many-files-text="@Translate("files")" /> 958 <label for="@settings.Id" class="file-input__btn btn--secondary btn dw-mod">@settings.ChooseFileText</label> 959 <label for="@settings.Id" class="@settings.CssClass file-input__fake-input js-fake-input dw-mod">@settings.NoFilesChosenText</label> 960 @if (settings.UploadButton != null) 961 { 962 settings.UploadButton.CssClass += " btn--condensed u-no-margin"; 963 @Render(settings.UploadButton) 964 } 965 </div> 966 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 967 </div> 968 } 969 @using System.Reflection 970 @using Dynamicweb.Rapido.Blocks.Components.General 971 @using Dynamicweb.Rapido.Blocks.Components 972 @using Dynamicweb.Core 973 @using System.Linq 974 975 @* Component *@ 976 977 @helper RenderDateTimeField(DateTimeField settings) 978 { 979 if (string.IsNullOrEmpty(settings.Id)) 980 { 981 settings.Id = Guid.NewGuid().ToString("N"); 982 } 983 984 var textField = new TextField { 985 Name = settings.Name, 986 Id = settings.Id, 987 Label = settings.Label, 988 HelpText = settings.HelpText, 989 Value = settings.Value, 990 Disabled = settings.Disabled, 991 Required = settings.Required, 992 ErrorMessage = settings.ErrorMessage, 993 CssClass = settings.CssClass, 994 WrapperCssClass = settings.WrapperCssClass, 995 OnChange = settings.OnChange, 996 OnClick = settings.OnClick, 997 ExtraAttributes = settings.ExtraAttributes, 998 // 999 Placeholder = settings.Placeholder 1000 }; 1001 1002 @Render(textField) 1003 1004 List<string> jsAttributes = new List<string>(); 1005 1006 jsAttributes.Add("mode: '" + Enum.GetName(typeof(DateTimeFieldMode), settings.Mode).ToLower() + "'"); 1007 1008 if (!string.IsNullOrEmpty(settings.DateFormat)) 1009 { 1010 jsAttributes.Add("dateFormat: '" + settings.DateFormat + "'"); 1011 } 1012 if (!string.IsNullOrEmpty(settings.MinDate)) 1013 { 1014 jsAttributes.Add("minDate: '" + settings.MinDate + "'"); 1015 } 1016 if (!string.IsNullOrEmpty(settings.MaxDate)) 1017 { 1018 jsAttributes.Add("maxDate: '" + settings.MaxDate + "'"); 1019 } 1020 if (settings.IsInline) 1021 { 1022 jsAttributes.Add("inline: " + Converter.ToString(settings.IsInline).ToLower()); 1023 } 1024 if (settings.EnableTime) 1025 { 1026 jsAttributes.Add("enableTime: " + Converter.ToString(settings.EnableTime).ToLower()); 1027 } 1028 if (settings.EnableWeekNumbers) 1029 { 1030 jsAttributes.Add("weekNumbers: " + Converter.ToString(settings.EnableWeekNumbers).ToLower()); 1031 } 1032 1033 jsAttributes.AddRange(settings.GetFlatPickrOptions().Select(x => x.Key + ": " + x.Value)); 1034 1035 <script> 1036 document.addEventListener("DOMContentLoaded", function () { 1037 flatpickr("#@textField.Id", { 1038 @string.Join(",", jsAttributes) 1039 }); 1040 }); 1041 </script> 1042 } 1043 @using System.Reflection 1044 @using Dynamicweb.Rapido.Blocks.Components.General 1045 @using Dynamicweb.Rapido.Blocks.Components 1046 1047 @* Component *@ 1048 1049 @helper RenderTextField(TextField settings) 1050 { 1051 var attributes = new Dictionary<string, string>(); 1052 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1053 { 1054 settings.Id = Guid.NewGuid().ToString("N"); 1055 } 1056 1057 /*base settings*/ 1058 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1059 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1060 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1061 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1062 if (settings.Required) { attributes.Add("required", "true"); } 1063 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1064 /*end*/ 1065 1066 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 1067 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 1068 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 1069 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 1070 if (settings.MaxLength != 0) { attributes.Add("maxlength", settings.MaxLength.ToString()); } 1071 if (!string.IsNullOrEmpty(settings.Placeholder)) { attributes.Add("placeholder", settings.Placeholder); } 1072 attributes.Add("type", Enum.GetName(typeof(TextFieldType), settings.Type).ToLower()); 1073 if (settings.Type == TextFieldType.Password) { attributes.Add("autocomplete", "off"); }; 1074 if (!string.IsNullOrEmpty(settings.Value)) { attributes.Add("value", settings.Value); } 1075 settings.CssClass = "u-full-width " + settings.CssClass; 1076 1077 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1078 1079 string noMargin = "u-no-margin"; 1080 if (!settings.ReadOnly) { 1081 noMargin = ""; 1082 } 1083 1084 <div class="form__field-group u-full-width @noMargin @settings.WrapperCssClass dw-mod"> 1085 @if (!string.IsNullOrEmpty(settings.Label)) 1086 { 1087 <label for="@settings.Id">@settings.Label</label> 1088 } 1089 @if (!string.IsNullOrEmpty(settings.HelpText)) 1090 { 1091 <small class="form__help-text">@settings.HelpText</small> 1092 } 1093 1094 @if (settings.ActionButton != null) 1095 { 1096 settings.ActionButton.CssClass += " btn--condensed u-no-margin"; 1097 <div class="form__field-combi u-no-margin dw-mod"> 1098 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1099 @Render(settings.ActionButton) 1100 </div> 1101 } 1102 else 1103 { 1104 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1105 } 1106 1107 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1108 </div> 1109 } 1110 @using System.Reflection 1111 @using Dynamicweb.Rapido.Blocks.Components.General 1112 @using Dynamicweb.Rapido.Blocks.Components 1113 1114 @* Component *@ 1115 1116 @helper RenderNumberField(NumberField settings) 1117 { 1118 var attributes = new Dictionary<string, string>(); 1119 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1120 { 1121 settings.Id = Guid.NewGuid().ToString("N"); 1122 } 1123 1124 /*base settings*/ 1125 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1126 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1127 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1128 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1129 if (settings.Required) { attributes.Add("required", "true"); } 1130 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1131 /*end*/ 1132 1133 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 1134 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 1135 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 1136 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 1137 if (settings.Max != null) { attributes.Add("max", settings.Max.ToString()); } 1138 if (settings.Min != null) { attributes.Add("min", settings.Min.ToString()); } 1139 if (settings.Step != 0) { attributes.Add("step", settings.Step.ToString()); } 1140 if (settings.Value != null && !string.IsNullOrEmpty(settings.Value.ToString())) { attributes.Add("value", settings.Value.ToString()); } 1141 attributes.Add("type", "number"); 1142 1143 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1144 1145 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod"> 1146 @if (!string.IsNullOrEmpty(settings.Label)) 1147 { 1148 <label for="@settings.Id">@settings.Label</label> 1149 } 1150 @if (!string.IsNullOrEmpty(settings.HelpText)) 1151 { 1152 <small class="form__help-text">@settings.HelpText</small> 1153 } 1154 1155 @if (settings.ActionButton != null) 1156 { 1157 settings.ActionButton.CssClass += " btn--condensed u-no-margin"; 1158 <div class="form__field-combi u-no-margin dw-mod"> 1159 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1160 @Render(settings.ActionButton) 1161 </div> 1162 } 1163 else 1164 { 1165 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1166 } 1167 1168 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1169 </div> 1170 } 1171 @using System.Reflection 1172 @using Dynamicweb.Rapido.Blocks.Components.General 1173 @using Dynamicweb.Rapido.Blocks.Components 1174 1175 1176 @* Component *@ 1177 1178 @helper RenderTextareaField(TextareaField settings) 1179 { 1180 Dictionary<string, string> attributes = new Dictionary<string, string>(); 1181 string id = settings.Id; 1182 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(id)) 1183 { 1184 id = Guid.NewGuid().ToString("N"); 1185 } 1186 1187 if (!string.IsNullOrEmpty(id)) { attributes.Add("id", id); } 1188 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1189 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 1190 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 1191 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 1192 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1193 if (!string.IsNullOrEmpty(settings.Placeholder)) { attributes.Add("placeholder", settings.Placeholder); } 1194 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1195 if (settings.Required) { attributes.Add("required", "true"); } 1196 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 1197 if (settings.MaxLength != 0) { attributes.Add("maxlength", settings.MaxLength.ToString()); } 1198 if (settings.Rows != 0) { attributes.Add("rows", settings.Rows.ToString()); } 1199 attributes.Add("name", settings.Name); 1200 1201 <div class="form__field-group @settings.WrapperCssClass dw-mod"> 1202 @if (!string.IsNullOrEmpty(settings.Label)) 1203 { 1204 <label for="@id">@settings.Label</label> 1205 } 1206 @if (!string.IsNullOrEmpty(settings.HelpText)) 1207 { 1208 <small class="form__help-text">@settings.HelpText</small> 1209 } 1210 1211 <textarea class="u-full-width @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Value</textarea> 1212 1213 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1214 </div> 1215 } 1216 @using System.Reflection 1217 @using Dynamicweb.Rapido.Blocks.Components.General 1218 @using Dynamicweb.Rapido.Blocks.Components 1219 1220 1221 @* Component *@ 1222 1223 @helper RenderHiddenField(HiddenField settings) { 1224 var attributes = new Dictionary<string, string>(); 1225 attributes.Add("type", "hidden"); 1226 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1227 if (!string.IsNullOrEmpty(settings.Value)) { attributes.Add("value", settings.Value); } 1228 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1229 1230 <input @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)/> 1231 } 1232 @using System.Reflection 1233 @using Dynamicweb.Rapido.Blocks.Components.General 1234 @using Dynamicweb.Rapido.Blocks.Components 1235 1236 @* Component *@ 1237 1238 @helper RenderCheckboxField(CheckboxField settings) 1239 { 1240 var attributes = new Dictionary<string, string>(); 1241 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1242 { 1243 settings.Id = Guid.NewGuid().ToString("N"); 1244 } 1245 1246 /*base settings*/ 1247 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1248 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1249 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1250 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1251 if (settings.Required) { attributes.Add("required", "true"); } 1252 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1253 /*end*/ 1254 1255 attributes.Add("type", "checkbox"); 1256 if (settings.Checked) { attributes.Add("checked", "true"); } 1257 settings.CssClass = "form__control " + settings.CssClass; 1258 if (!string.IsNullOrEmpty(settings.Value)) { attributes.Add("value", settings.Value); } 1259 1260 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1261 1262 <div class="form__field-group @settings.WrapperCssClass dw-mod"> 1263 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1264 @if (!string.IsNullOrEmpty(settings.Label)) 1265 { 1266 <label for="@settings.Id" class="dw-mod">@settings.Label</label> 1267 } 1268 @if (!string.IsNullOrEmpty(settings.HelpText)) 1269 { 1270 <small class="form__help-text">@settings.HelpText</small> 1271 } 1272 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1273 </div> 1274 } 1275 @using System.Reflection 1276 @using Dynamicweb.Rapido.Blocks.Components.General 1277 @using Dynamicweb.Rapido.Blocks.Components 1278 1279 1280 @* Component *@ 1281 1282 @helper RenderCheckboxListField(CheckboxListField settings) 1283 { 1284 <div class="form__field-group @settings.WrapperCssClass u-margin-bottom dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1285 @if (!string.IsNullOrEmpty(settings.Label)) 1286 { 1287 <label>@settings.Label</label> 1288 } 1289 @if (!string.IsNullOrEmpty(settings.HelpText)) 1290 { 1291 <small class="form__help-text">@settings.HelpText</small> 1292 } 1293 1294 @foreach (var item in settings.Options) 1295 { 1296 if (settings.Required) 1297 { 1298 item.Required = true; 1299 } 1300 if (settings.Disabled) 1301 { 1302 item.Disabled = true; 1303 } 1304 if (!string.IsNullOrEmpty(settings.Name)) 1305 { 1306 item.Name = settings.Name; 1307 } 1308 if (!string.IsNullOrEmpty(settings.CssClass)) 1309 { 1310 item.CssClass += settings.CssClass; 1311 } 1312 1313 /* value is not supported */ 1314 1315 if (!string.IsNullOrEmpty(settings.OnClick)) 1316 { 1317 item.OnClick += settings.OnClick; 1318 } 1319 if (!string.IsNullOrEmpty(settings.OnChange)) 1320 { 1321 item.OnChange += settings.OnChange; 1322 } 1323 @Render(item) 1324 } 1325 1326 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1327 </div> 1328 } 1329 @using System.Reflection 1330 @using Dynamicweb.Rapido.Blocks.Components.General 1331 @using Dynamicweb.Rapido.Blocks.Components 1332 1333 1334 @* Component *@ 1335 1336 @helper RenderSelectField(SelectField settings) 1337 { 1338 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1339 { 1340 settings.Id = Guid.NewGuid().ToString("N"); 1341 } 1342 1343 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod"> 1344 @if (!string.IsNullOrEmpty(settings.Label)) 1345 { 1346 <label for="@settings.Id">@settings.Label</label> 1347 } 1348 @if (!string.IsNullOrEmpty(settings.HelpText)) 1349 { 1350 <small class="form__help-text">@settings.HelpText</small> 1351 } 1352 1353 @if (settings.ActionButton != null) 1354 { 1355 settings.ActionButton.CssClass += " btn--condensed u-no-margin"; 1356 <div class="form__field-combi u-no-margin dw-mod"> 1357 @RenderSelectBase(settings) 1358 @Render(settings.ActionButton) 1359 </div> 1360 } 1361 else 1362 { 1363 @RenderSelectBase(settings) 1364 } 1365 1366 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1367 </div> 1368 } 1369 1370 @helper RenderSelectBase(SelectField settings) 1371 { 1372 var attributes = new Dictionary<string, string>(); 1373 1374 /*base settings*/ 1375 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1376 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1377 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1378 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1379 if (settings.Required) { attributes.Add("required", "true"); } 1380 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1381 /*end*/ 1382 1383 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1384 1385 <select @ComponentMethods.AddAttributes(resultAttributes) class="u-full-width @settings.CssClass dw-mod"> 1386 @if (settings.Default != null) 1387 { 1388 @Render(settings.Default) 1389 } 1390 1391 @foreach (var item in settings.Options) 1392 { 1393 if (!string.IsNullOrEmpty(settings.Value)) { 1394 item.Checked = item.Value == settings.Value; 1395 } 1396 @Render(item) 1397 } 1398 </select> 1399 } 1400 @using System.Reflection 1401 @using Dynamicweb.Rapido.Blocks.Components.General 1402 @using Dynamicweb.Rapido.Blocks.Components 1403 1404 @* Component *@ 1405 1406 @helper RenderRadioButtonField(RadioButtonField settings) 1407 { 1408 var attributes = new Dictionary<string, string>(); 1409 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1410 { 1411 settings.Id = Guid.NewGuid().ToString("N"); 1412 } 1413 1414 /*base settings*/ 1415 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1416 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1417 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1418 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1419 if (settings.Required) { attributes.Add("required", "true"); } 1420 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1421 /*end*/ 1422 1423 attributes.Add("type", "radio"); 1424 if (settings.Checked) { attributes.Add("checked", "true"); } 1425 settings.CssClass = "form__control " + settings.CssClass; 1426 if (!string.IsNullOrEmpty(settings.Value)) { attributes.Add("value", settings.Value); } 1427 1428 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1429 1430 <div class="form__field-group @settings.WrapperCssClass dw-mod"> 1431 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1432 @if (!string.IsNullOrEmpty(settings.Label)) 1433 { 1434 <label for="@settings.Id" class="dw-mod">@settings.Label</label> 1435 } 1436 @if (!string.IsNullOrEmpty(settings.HelpText)) 1437 { 1438 <small class="form__help-text">@settings.HelpText</small> 1439 } 1440 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1441 </div> 1442 } 1443 @using System.Reflection 1444 @using Dynamicweb.Rapido.Blocks.Components.General 1445 @using Dynamicweb.Rapido.Blocks.Components 1446 1447 1448 @* Component *@ 1449 1450 @helper RenderRadioButtonListField(RadioButtonListField settings) 1451 { 1452 <div class="form__field-group @settings.WrapperCssClass u-margin-bottom dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1453 @if (!string.IsNullOrEmpty(settings.Label)) 1454 { 1455 <label>@settings.Label</label> 1456 } 1457 @if (!string.IsNullOrEmpty(settings.HelpText)) 1458 { 1459 <small class="form__help-text">@settings.HelpText</small> 1460 } 1461 1462 @foreach (var item in settings.Options) 1463 { 1464 if (settings.Required) 1465 { 1466 item.Required = true; 1467 } 1468 if (settings.Disabled) 1469 { 1470 item.Disabled = true; 1471 } 1472 if (!string.IsNullOrEmpty(settings.Name)) 1473 { 1474 item.Name = settings.Name; 1475 } 1476 if (!string.IsNullOrEmpty(settings.Value) && settings.Value == item.Value) 1477 { 1478 item.Checked = true; 1479 } 1480 if (!string.IsNullOrEmpty(settings.OnClick)) 1481 { 1482 item.OnClick += settings.OnClick; 1483 } 1484 if (!string.IsNullOrEmpty(settings.OnChange)) 1485 { 1486 item.OnChange += settings.OnChange; 1487 } 1488 if (!string.IsNullOrEmpty(settings.CssClass)) 1489 { 1490 item.CssClass += settings.CssClass; 1491 } 1492 @Render(item) 1493 } 1494 1495 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1496 </div> 1497 } 1498 @using System.Reflection 1499 @using Dynamicweb.Rapido.Blocks.Components.General 1500 @using Dynamicweb.Rapido.Blocks.Components 1501 1502 1503 @* Component *@ 1504 1505 @helper RenderNotificationMessage(NotificationMessage settings) 1506 { 1507 if (!string.IsNullOrEmpty(settings.Message)) 1508 { 1509 var attributes = new Dictionary<string, string>(); 1510 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1511 1512 string messageTypeClass = Enum.GetName(typeof(NotificationMessageType), settings.MessageType).ToLower(); 1513 <div class="field-@messageTypeClass @settings.CssClass u-full-width dw-mod" @ComponentMethods.AddAttributes(attributes)>@settings.Message</div> 1514 } 1515 } 1516 @using Dynamicweb.Rapido.Blocks.Components.General 1517 1518 1519 @* Component *@ 1520 1521 @helper RenderHandlebarsRoot(HandlebarsRoot settings) { 1522 string preRender = !String.IsNullOrEmpty(settings.PreRenderScriptTemplate) ? "data-pre-render-template=\"" + settings.PreRenderScriptTemplate + "\"" : ""; 1523 1524 <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> 1525 @if (settings.SubBlocks != null) { 1526 @RenderBlockList(settings.SubBlocks) 1527 } 1528 </div> 1529 } 1530 @using System.Reflection 1531 @using Dynamicweb.Rapido.Blocks.Components.General 1532 @using Dynamicweb.Rapido.Blocks.Components 1533 @using System.Text.RegularExpressions 1534 1535 1536 @* Component *@ 1537 1538 @helper RenderSticker(Sticker settings) { 1539 if (!String.IsNullOrEmpty(settings.Title)) { 1540 string size = settings.Size.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Size.ToString().ToLower() : ""; 1541 string style = settings.Style.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Style.ToString().ToLower() : ""; 1542 1543 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>(); 1544 if (!String.IsNullOrEmpty(settings.Color) || !String.IsNullOrEmpty(settings.BackgroundColor)) { 1545 string styleTag = !String.IsNullOrEmpty(settings.Color) ? "color: " + settings.Color + "; " : ""; 1546 styleTag += !String.IsNullOrEmpty(settings.BackgroundColor) ? "background-color: " + settings.BackgroundColor + "; " : ""; 1547 optionalAttributes.Add("style", styleTag); 1548 } 1549 1550 <div class="stickers-container__tag @size @style @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Title</div> 1551 } 1552 } 1553 1554 @using System.Reflection 1555 @using Dynamicweb.Rapido.Blocks.Components.General 1556 @using Dynamicweb.Rapido.Blocks.Components 1557 1558 1559 @* Component *@ 1560 1561 @helper RenderStickersCollection(StickersCollection settings) 1562 { 1563 if (settings.Stickers.Count > 0) 1564 { 1565 string position = "stickers-container--" + Regex.Replace(settings.Position.ToString(), "([a-z])([A-Z])", "$1-$2").ToLower(); 1566 1567 <div class="stickers-container @position @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1568 @foreach (Sticker sticker in settings.Stickers) 1569 { 1570 @Render(sticker) 1571 } 1572 </div> 1573 } 1574 } 1575 1576 @using Dynamicweb.Rapido.Blocks.Components.General 1577 1578 1579 @* Component *@ 1580 1581 @helper RenderForm(Form settings) { 1582 if (settings != null) 1583 { 1584 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>(); 1585 if (!string.IsNullOrEmpty(settings.Action)) { optionalAttributes.Add("action", settings.Action); }; 1586 if (!string.IsNullOrEmpty(settings.Name)) { optionalAttributes.Add("name", settings.Name); }; 1587 if (!string.IsNullOrEmpty(settings.OnSubmit)) { optionalAttributes.Add("onsubmit", settings.OnSubmit); }; 1588 var enctypes = new Dictionary<string, string> 1589 { 1590 { "multipart", "multipart/form-data" }, 1591 { "text", "text/plain" }, 1592 { "application", "application/x-www-form-urlencoded" } 1593 }; 1594 if (settings.Enctype != FormEnctype.none) { optionalAttributes.Add("enctype", enctypes[Enum.GetName(typeof(FormEnctype), settings.Enctype).ToLower()]); }; 1595 optionalAttributes.Add("method", settings.Method.ToString()); 1596 1597 if (!string.IsNullOrEmpty(settings.FormStartMarkup)) 1598 { 1599 @settings.FormStartMarkup 1600 } 1601 else 1602 { 1603 @:<form class="@settings.CssClass u-no-margin dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1604 } 1605 1606 foreach (var field in settings.GetFields()) 1607 { 1608 @Render(field) 1609 } 1610 1611 @:</form> 1612 } 1613 } 1614 @using System.Reflection 1615 @using Dynamicweb.Rapido.Blocks.Components.General 1616 @using Dynamicweb.Rapido.Blocks.Components 1617 1618 1619 @* Component *@ 1620 1621 @helper RenderText(Text settings) 1622 { 1623 @settings.Content 1624 } 1625 @using System.Reflection 1626 @using Dynamicweb.Rapido.Blocks.Components.General 1627 @using Dynamicweb.Rapido.Blocks.Components 1628 1629 1630 @* Component *@ 1631 1632 @helper RenderContentModule(ContentModule settings) { 1633 if (!string.IsNullOrEmpty(settings.Content)) 1634 { 1635 @settings.Content 1636 } 1637 } 1638 @using System.Reflection 1639 @using Dynamicweb.Rapido.Blocks.Components.General 1640 @using Dynamicweb.Rapido.Blocks.Components 1641 1642 1643 @* Component *@ 1644 1645 @helper RenderModal(Modal settings) { 1646 if (settings != null) 1647 { 1648 string modalId = !string.IsNullOrEmpty(settings.Id) ? settings.Id : Guid.NewGuid().ToString("N"); 1649 1650 string onchange = !string.IsNullOrEmpty(settings.OnClose) ? "onchange=\"if(!this.checked){" + settings.OnClose + "}\"" : ""; 1651 1652 <input type="checkbox" id="@(modalId)ModalTrigger" class="modal-trigger" @onchange /> 1653 1654 <div class="modal-container"> 1655 @if (!settings.DisableDarkOverlay) 1656 { 1657 <label for="@(modalId)ModalTrigger" id="@(modalId)ModalOverlay" class="modal-overlay"></label> 1658 } 1659 <div class="modal modal--@settings.Width.ToString().ToLower() modal-height--@settings.Height.ToString().ToLower()" id="@(modalId)Modal"> 1660 @if (settings.Heading != null) 1661 { 1662 if (!string.IsNullOrEmpty(settings.Heading.Title)) 1663 { 1664 <div class="modal__header"> 1665 @Render(settings.Heading) 1666 </div> 1667 } 1668 } 1669 <div class="modal__body @(settings.Width.ToString().ToLower() == "full" ? "modal__body--full" : "")"> 1670 @if (!string.IsNullOrEmpty(settings.BodyText)) 1671 { 1672 @settings.BodyText 1673 } 1674 @if (settings.BodyTemplate != null) 1675 { 1676 @settings.BodyTemplate 1677 } 1678 @{ 1679 var actions = settings.GetActions(); 1680 } 1681 </div> 1682 @if (actions.Length > 0) 1683 { 1684 <div class="modal__footer"> 1685 @foreach (var action in actions) 1686 { 1687 action.CssClass += " u-no-margin"; 1688 @Render(action) 1689 } 1690 </div> 1691 } 1692 <label class="modal__close-btn" for="@(modalId)ModalTrigger"></label> 1693 </div> 1694 </div> 1695 } 1696 } 1697 @using Dynamicweb.Rapido.Blocks.Components.General 1698 1699 @* Component *@ 1700 1701 @helper RenderMediaListItem(MediaListItem settings) 1702 { 1703 <div class="media-list-item @settings.CssClass dw-mod" @(!string.IsNullOrEmpty(settings.Id) ? "id=\"" + settings.Id + "\"" : "")> 1704 @if (!string.IsNullOrEmpty(settings.Label)) 1705 { 1706 if (!string.IsNullOrEmpty(settings.Link)) 1707 { 1708 @Render(new Link 1709 { 1710 Href = settings.Link, 1711 CssClass = "media-list-item__sticker dw-mod", 1712 ButtonLayout = ButtonLayout.None, 1713 Title = settings.Label, 1714 OnClick = !string.IsNullOrEmpty(settings.OnClick) ? settings.OnClick : "" 1715 }) 1716 } 1717 else if (!string.IsNullOrEmpty(settings.OnClick)) 1718 { 1719 <span class="media-list-item__sticker dw-mod" onclick="@(settings.OnClick)"> 1720 <span class="u-uppercase">@settings.Label</span> 1721 </span> 1722 } 1723 else 1724 { 1725 <span class="media-list-item__sticker media-list-item__sticker--no-link dw-mod"> 1726 <span class="u-uppercase">@settings.Label</span> 1727 </span> 1728 } 1729 } 1730 <div class="media-list-item__wrap"> 1731 <div class="media-list-item__info dw-mod"> 1732 <div class="media-list-item__header dw-mod"> 1733 @if (!string.IsNullOrEmpty(settings.Title)) 1734 { 1735 if (!string.IsNullOrEmpty(settings.Link)) 1736 { 1737 @Render(new Link 1738 { 1739 Href = settings.Link, 1740 CssClass = "media-list-item__name dw-mod", 1741 ButtonLayout = ButtonLayout.None, 1742 Title = settings.Title, 1743 OnClick = !string.IsNullOrEmpty(settings.OnClick) ? settings.OnClick : "" 1744 }) 1745 } 1746 else if (!string.IsNullOrEmpty(settings.OnClick)) 1747 { 1748 <span class="media-list-item__name dw-mod" onclick="@(settings.OnClick)">@settings.Title</span> 1749 } 1750 else 1751 { 1752 <span class="media-list-item__name media-list-item__name--no-link dw-mod">@settings.Title</span> 1753 } 1754 } 1755 1756 @if (!string.IsNullOrEmpty(settings.Status)) 1757 { 1758 <div class="media-list-item__state dw-mod">@settings.Status</div> 1759 } 1760 </div> 1761 @{ 1762 settings.InfoTable.CssClass += " media-list-item__parameters-table"; 1763 } 1764 1765 @Render(settings.InfoTable) 1766 </div> 1767 <div class="media-list-item__actions dw-mod"> 1768 <div class="media-list-item__actions-list dw-mod"> 1769 @{ 1770 var actions = settings.GetActions(); 1771 1772 foreach (ButtonBase action in actions) 1773 { 1774 action.ButtonLayout = ButtonLayout.None; 1775 action.CssClass += " media-list-item__action link"; 1776 1777 @Render(action) 1778 } 1779 } 1780 </div> 1781 1782 @if (settings.SelectButton != null && !string.IsNullOrEmpty(settings.SelectButton.Title)) 1783 { 1784 settings.SelectButton.CssClass += " u-no-margin"; 1785 1786 <div class="media-list-item__action-button"> 1787 @Render(settings.SelectButton) 1788 </div> 1789 } 1790 </div> 1791 </div> 1792 </div> 1793 } 1794 @using Dynamicweb.Rapido.Blocks.Components.General 1795 @using Dynamicweb.Rapido.Blocks.Components 1796 1797 @helper RenderTable(Table settings) 1798 { 1799 Dictionary<string, string> attributes = new Dictionary<string, string>(); 1800 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1801 1802 var enumToClasses = new Dictionary<TableDesign, string> 1803 { 1804 { TableDesign.Clean, "table--clean" }, 1805 { TableDesign.Bordered, "table--bordered" }, 1806 { TableDesign.Striped, "table--striped" }, 1807 { TableDesign.Hover, "table--hover" }, 1808 { TableDesign.Compact, "table--compact" }, 1809 { TableDesign.Condensed, "table--condensed" }, 1810 { TableDesign.NoTopBorder, "table--no-top-border" } 1811 }; 1812 string tableDesignClass = ""; 1813 if (settings.Design != TableDesign.None) 1814 { 1815 tableDesignClass = enumToClasses[settings.Design]; 1816 } 1817 1818 if (!string.IsNullOrEmpty(settings.CssClass) || settings.Design != TableDesign.None) { attributes.Add("class", "table " + tableDesignClass + " " + settings.CssClass + " dw-mod"); } 1819 1820 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value); 1821 1822 <table @ComponentMethods.AddAttributes(resultAttributes)> 1823 @if (settings.Header != null) 1824 { 1825 <thead> 1826 @Render(settings.Header) 1827 </thead> 1828 } 1829 <tbody> 1830 @foreach (var row in settings.Rows) 1831 { 1832 @Render(row) 1833 } 1834 </tbody> 1835 @if (settings.Footer != null) 1836 { 1837 <tfoot> 1838 @Render(settings.Footer) 1839 </tfoot> 1840 } 1841 </table> 1842 } 1843 @using Dynamicweb.Rapido.Blocks.Components.General 1844 @using Dynamicweb.Rapido.Blocks.Components 1845 1846 @helper RenderTableRow(TableRow settings) 1847 { 1848 Dictionary<string, string> attributes = new Dictionary<string, string>(); 1849 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1850 1851 var enumToClasses = new Dictionary<TableRowDesign, string> 1852 { 1853 { TableRowDesign.NoBorder, "table__row--no-border" }, 1854 { TableRowDesign.Border, "table__row--border" }, 1855 { TableRowDesign.TopBorder, "table__row--top-line" }, 1856 { TableRowDesign.BottomBorder, "table__row--bottom-line" }, 1857 { TableRowDesign.Solid, "table__row--solid" } 1858 }; 1859 1860 string tableRowDesignClass = ""; 1861 if (settings.Design != TableRowDesign.None) 1862 { 1863 tableRowDesignClass = enumToClasses[settings.Design]; 1864 } 1865 1866 if (!string.IsNullOrEmpty(settings.CssClass) || settings.Design != TableRowDesign.None) { attributes.Add("class", "table__row " + tableRowDesignClass + " " + settings.CssClass + " dw-mod"); } 1867 1868 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value); 1869 1870 <tr @ComponentMethods.AddAttributes(resultAttributes)> 1871 @foreach (var cell in settings.Cells) 1872 { 1873 if (settings.IsHeaderRow) 1874 { 1875 cell.IsHeader = true; 1876 } 1877 @Render(cell) 1878 } 1879 </tr> 1880 } 1881 @using Dynamicweb.Rapido.Blocks.Components.General 1882 @using Dynamicweb.Rapido.Blocks.Components 1883 @using Dynamicweb.Core 1884 1885 @helper RenderTableCell(TableCell settings) 1886 { 1887 Dictionary<string, string> attributes = new Dictionary<string, string>(); 1888 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1889 if (settings.Colspan != 0) { attributes.Add("colspan", Converter.ToString(settings.Colspan)); } 1890 if (settings.Rowspan != 0) { attributes.Add("rowspan", Converter.ToString(settings.Rowspan)); } 1891 if (!string.IsNullOrEmpty(settings.CssClass)) { attributes.Add("class", settings.CssClass + " dw-mod"); } 1892 1893 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value); 1894 1895 string tagName = settings.IsHeader ? "th" : "td"; 1896 1897 @("<" + tagName + " " + ComponentMethods.AddAttributes(resultAttributes) + ">") 1898 @settings.Content 1899 @("</" + tagName + ">"); 1900 } 1901 @using System.Linq 1902 @using Dynamicweb.Rapido.Blocks.Components.General 1903 1904 @* Component *@ 1905 1906 @helper RenderPagination(Dynamicweb.Rapido.Blocks.Components.General.Pagination settings) 1907 { 1908 var pageNumberQueryStringName = Dynamicweb.Rapido.Services.Pagination.GetPageNumberQueryStringName(settings); // Get the proper 'page number' query string parameter 1909 var queryParameters = Dynamicweb.Rapido.Services.Url.GetQueryParameters(pageNumberQueryStringName); // Get the NameValueCollection from the querystring 1910 1911 if (settings.NumberOfPages > 1) 1912 { 1913 string url = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + "/Default.aspx"; 1914 string ariaLabel = !string.IsNullOrWhiteSpace(settings.AriaLabel) ? settings.AriaLabel : Translate("Page navigation"); 1915 Dictionary<string, int> startAndEndPageNumber = Dynamicweb.Rapido.Services.Pagination.GetStartAndEndPageNumber(settings); 1916 1917 <div class="pager u-margin-top dw-mod @settings.CssClass" aria-label="@ariaLabel"> 1918 @if (settings.ShowPagingInfo) 1919 { 1920 <div class="pager__info dw-mod"> 1921 @Translate("Page") @settings.CurrentPageNumber @Translate("of") @settings.NumberOfPages 1922 </div> 1923 } 1924 <ul class="pager__list dw-mod"> 1925 @if (!string.IsNullOrWhiteSpace(settings.FirstPageUrl) && settings.ShowFirstAndLastControls) 1926 { 1927 @Render(new PaginationItem { Link = settings.FirstPageUrl, Icon = settings.FirstIcon }) 1928 } 1929 @if (!string.IsNullOrWhiteSpace(settings.PreviousPageUrl) && settings.ShowNextAndPrevControls) 1930 { 1931 @Render(new PaginationItem { Link = settings.PreviousPageUrl, Icon = settings.PrevIcon }) 1932 } 1933 @if (settings.GetPages().Any()) 1934 { 1935 foreach (var page in settings.GetPages()) 1936 { 1937 @Render(page) 1938 } 1939 } 1940 else 1941 { 1942 for (var page = startAndEndPageNumber["StartPage"]; page <= startAndEndPageNumber["EndPage"]; page++) 1943 { 1944 queryParameters = Dynamicweb.Rapido.Services.Url.UpdateQueryStringParameter(queryParameters, pageNumberQueryStringName, page.ToString()); 1945 @Render(new PaginationItem { Label = page.ToString(), Link = Dynamicweb.Rapido.Services.Url.BuildUri(url, queryParameters).PathAndQuery, IsActive = (settings.CurrentPageNumber == page) }); 1946 } 1947 } 1948 @if (!string.IsNullOrWhiteSpace(settings.NextPageUrl) && settings.ShowNextAndPrevControls) 1949 { 1950 @Render(new PaginationItem { Link = settings.NextPageUrl, Icon = settings.NextIcon }) 1951 } 1952 @if (!string.IsNullOrWhiteSpace(settings.LastPageUrl) && settings.ShowFirstAndLastControls) 1953 { 1954 @Render(new PaginationItem { Link = settings.LastPageUrl, Icon = settings.LastIcon }) 1955 } 1956 </ul> 1957 </div> 1958 } 1959 } 1960 1961 @helper RenderPaginationItem(PaginationItem settings) 1962 { 1963 if (settings.Icon == null) 1964 { 1965 settings.Icon = new Icon(); 1966 } 1967 1968 settings.Icon.Label = settings.Label; 1969 <li class="pager__btn dw-mod"> 1970 @if (settings.IsActive) 1971 { 1972 <span class="pager__num pager__num--current dw-mod"> 1973 @Render(settings.Icon) 1974 </span> 1975 } 1976 else 1977 { 1978 <a href="@settings.Link" class="pager__num dw-mod"> 1979 @Render(settings.Icon) 1980 </a> 1981 } 1982 </li> 1983 } 1984 1985 1986 @using Dynamicweb.Rapido.Blocks.Components.General 1987 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 1988 @using System.Linq 1989 @using Dynamicweb.Core 1990 1991 @* Component *@ 1992 1993 @helper RenderAlertNotification(Dna.Rizzo.Components.AlertNotification settings) 1994 { 1995 if (settings != null && (!string.IsNullOrEmpty(settings.Title) || !string.IsNullOrEmpty(settings.Message))) 1996 { 1997 @(string.Format("AlertNotification.ShowNotification('{0}','{1}'{2})", Converter.ToString(settings.Title), Converter.ToString(settings.Message), GetAlertNotificationConfiguration(settings))) 1998 } 1999 } 2000 2001 @functions 2002 { 2003 private string GetAlertNotificationConfiguration(Dna.Rizzo.Components.AlertNotification settings) 2004 { 2005 string[] configuration = 2006 { 2007 AppendProperty("closeOnClick", settings.CloseOnClick), 2008 AppendProperty("displayCloseButton", settings.DisplayCloseButton), 2009 AppendProperty("onClick", settings.OnClick), 2010 AppendProperty("showDuration", settings.ShowDuration), 2011 AppendProperty("positionClass", settings.Position), 2012 AppendProperty("theme", settings.Theme) 2013 }; 2014 2015 configuration = configuration.Where(c => !string.IsNullOrEmpty(c)).ToArray(); 2016 2017 if (!configuration.Any()) 2018 { 2019 return string.Empty; 2020 } 2021 2022 return string.Concat(",{", string.Join(",", configuration), "}"); 2023 } 2024 2025 private static string AppendProperty(string propertyName, bool? propertyValue) 2026 { 2027 return propertyValue != null ? string.Format("{0}: {1}",propertyName, propertyValue.ToString().ToLowerInvariant()) : null; 2028 } 2029 2030 private static string AppendProperty(string propertyName, int? propertyValue) 2031 { 2032 return propertyValue != null ? string.Format("{0}: {1}",propertyName, propertyValue.ToString().ToLowerInvariant()) : null; 2033 } 2034 2035 private static string AppendProperty(string propertyName, Dna.Rizzo.Components.AlertNotificationPosition.Position? propertyValue) 2036 { 2037 return propertyValue != null ? string.Format("{0}: positionConfig.{1}",propertyName, propertyValue) : null; 2038 } 2039 2040 private static string AppendProperty(string propertyName, Dna.Rizzo.Components.AlertNotificationTheme.Theme? propertyValue) 2041 { 2042 return propertyValue != null ? string.Format("{0}: themeConfig.{1}",propertyName, propertyValue) : null; 2043 } 2044 } 2045 2046 2047 @using Dynamicweb.Frontend 2048 @using System.Reflection 2049 @using Dynamicweb.Content.Items 2050 @using System.Web.UI.HtmlControls 2051 @using Dynamicweb.Rapido.Blocks.Components 2052 @using Dynamicweb.Rapido.Blocks 2053 @using Dynamicweb.Rapido.Blocks.Components.Articles 2054 2055 @* Components for the articles *@ 2056 @using System.Reflection 2057 @using Dynamicweb.Rapido.Blocks.Components.Articles 2058 2059 2060 @* Component for the articles *@ 2061 2062 @helper RenderArticleBanner(dynamic settings) { 2063 string filterClasses = "image-filter image-filter--darken"; 2064 settings.Layout = ArticleHeaderLayout.Banner; 2065 2066 if (settings.Image != null) 2067 { 2068 if (settings.Image.Path != null) 2069 { 2070 <section class="multiple-paragraphs-container u-color-light paragraph-container--full-width"> 2071 <div class="background-image @filterClasses dw-mod"> 2072 <div class="background-image__wrapper @filterClasses dw-mod"> 2073 @{ 2074 settings.Image.CssClass += "background-image__cover dw-mod"; 2075 } 2076 @Render(settings.Image) 2077 </div> 2078 </div> 2079 <div class="center-container dw-mod"> 2080 <div class="grid"> 2081 <div class="grid__col-md-8 grid__col-xs-12 paragraph-container paragraph-container--height-lg"> 2082 <div class="u-left-middle"> 2083 <div> 2084 @if (!String.IsNullOrEmpty(settings.Heading)) 2085 { 2086 <h1 class="article__header article__header--giant dw-mod" style="color: @settings.TextColor">@settings.Heading</h1> 2087 } 2088 @if (!String.IsNullOrEmpty(settings.Subheading)) 2089 { 2090 <div class="article__leadtext dw-mod" style="color: @settings.TextColor">@settings.Subheading</div> 2091 } 2092 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 2093 { 2094 <small class="article__post-info u-margin-bottom--lg dw-mod" style="color: @settings.TextColor">@settings.Author @settings.Date</small> 2095 } 2096 @if (!String.IsNullOrEmpty(settings.Link)) { 2097 <div class="grid__cell"> 2098 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 2099 </div> 2100 } 2101 </div> 2102 </div> 2103 </div> 2104 @if (settings.ExternalParagraphId != 0) 2105 { 2106 <div class="grid__col-md-4 grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-auto dw-mod"> 2107 <div class="u-color-light-gray--bg u-color-dark dw-mod"> 2108 @RenderParagraphContent(settings.ExternalParagraphId) 2109 </div> 2110 </div> 2111 } 2112 2113 </div> 2114 </div> 2115 </section> 2116 if (!String.IsNullOrEmpty(settings.Image.Caption)) { 2117 <div class="image-caption dw-mod">@settings.Image.Caption</div> 2118 } 2119 } 2120 else 2121 { 2122 settings.Layout = ArticleHeaderLayout.Clean; 2123 @RenderArticleCleanHeader(settings); 2124 } 2125 } 2126 else 2127 { 2128 settings.Layout = ArticleHeaderLayout.Clean; 2129 @RenderArticleCleanHeader(settings); 2130 } 2131 } 2132 @using System.Reflection 2133 @using Dynamicweb.Rapido.Blocks.Components 2134 @using Dynamicweb.Rapido.Blocks.Components.General 2135 @using Dynamicweb.Rapido.Blocks.Components.Articles 2136 @using Dynamicweb.Rapido.Blocks 2137 2138 2139 @* Component for the articles *@ 2140 2141 @helper RenderArticleHeader(ArticleHeader settings) { 2142 dynamic[] methodParameters = new dynamic[1]; 2143 methodParameters[0] = settings; 2144 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleHeaderCustom"); 2145 2146 if (customMethod != null) 2147 { 2148 @customMethod.Invoke(this, methodParameters).ToString(); 2149 } else { 2150 switch (settings.Layout) 2151 { 2152 case ArticleHeaderLayout.Clean: 2153 @RenderArticleCleanHeader(settings); 2154 break; 2155 case ArticleHeaderLayout.Split: 2156 @RenderArticleSplitHeader(settings); 2157 break; 2158 case ArticleHeaderLayout.Banner: 2159 @RenderArticleBannerHeader(settings); 2160 break; 2161 case ArticleHeaderLayout.Overlay: 2162 @RenderArticleOverlayHeader(settings); 2163 break; 2164 default: 2165 @RenderArticleCleanHeader(settings); 2166 break; 2167 } 2168 } 2169 } 2170 2171 @helper RenderArticleCleanHeader(ArticleHeader settings) { 2172 dynamic[] methodParameters = new dynamic[1]; 2173 methodParameters[0] = settings; 2174 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleCleanHeaderCustom"); 2175 2176 if (customMethod != null) 2177 { 2178 @customMethod.Invoke(this, methodParameters).ToString(); 2179 } 2180 else 2181 { 2182 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12"; 2183 2184 <div class="grid grid--align-content-start grid--justify-start"> 2185 <div class="grid__col-md-@contentColumns grid__col-sm-12 u-padding--lg dw-mod"> 2186 @if (!String.IsNullOrEmpty(settings.Category) || !String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date) || settings.RatingOutOf != 0) 2187 { 2188 <div class="u-border-bottom u-padding-bottom"> 2189 @if (!String.IsNullOrEmpty(settings.Category)) 2190 { 2191 <div class="u-pull--left"> 2192 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div> 2193 </div> 2194 } 2195 <div class="u-pull--right"> 2196 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 2197 { 2198 <small class="article__post-info dw-mod">@settings.Author @settings.Date</small> 2199 } 2200 @if (settings.RatingOutOf != 0) 2201 { 2202 @Render(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) 2203 } 2204 </div> 2205 </div> 2206 } 2207 2208 <div class="grid__cell"> 2209 @if (!String.IsNullOrEmpty(settings.Heading)) 2210 { 2211 <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1> 2212 } 2213 @if (settings.Image != null) 2214 { 2215 if (settings.Image.Path != null) 2216 { 2217 <div class="u-padding-bottom--lg"> 2218 @Render(settings.Image) 2219 </div> 2220 } 2221 } 2222 @if (!String.IsNullOrEmpty(settings.Subheading)) 2223 { 2224 <div class="article__leadtext dw-mod">@settings.Subheading</div> 2225 } 2226 @if (!String.IsNullOrEmpty(settings.Link)) 2227 { 2228 <div class="grid__cell"> 2229 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 2230 </div> 2231 } 2232 </div> 2233 </div> 2234 @if (settings.ExternalParagraphId != 0) 2235 { 2236 <div class="grid__col-md-4 grid__col-sm-12 u-padding--lg u-color-light-gray--bg dw-mod"> 2237 @RenderParagraphContent(settings.ExternalParagraphId) 2238 </div> 2239 } 2240 </div> 2241 } 2242 } 2243 2244 @helper RenderArticleSplitHeader(ArticleHeader settings) { 2245 dynamic[] methodParameters = new dynamic[1]; 2246 methodParameters[0] = settings; 2247 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSplitHeaderCustom"); 2248 2249 if (customMethod != null) 2250 { 2251 @customMethod.Invoke(this, methodParameters).ToString(); 2252 } 2253 else 2254 { 2255 string headerColumnWidth = settings.ExternalParagraphId != 0 ? "4" : "6"; 2256 2257 if (settings.Image != null) 2258 { 2259 if (settings.Image.Path != null) 2260 { 2261 <section class="multiple-paragraphs-container paragraph-container--full-width"> 2262 <div class="grid"> 2263 <div class="grid__col-md-@headerColumnWidth grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-xl dw-mod"> 2264 <div class="u-left-middle u-padding--lg"> 2265 <div> 2266 @if (!String.IsNullOrEmpty(settings.Category)) 2267 { 2268 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div> 2269 } 2270 @if (!String.IsNullOrEmpty(settings.Heading)) 2271 { 2272 <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1> 2273 } 2274 @if (!String.IsNullOrEmpty(settings.Subheading)) 2275 { 2276 <div class="article__leadtext dw-mod">@settings.Subheading</div> 2277 } 2278 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 2279 { 2280 <small class="article__post-info u-pull--left dw-mod">@settings.Author @settings.Date</small> 2281 } 2282 @if (settings.RatingOutOf != 0) 2283 { 2284 <div class="u-pull--right"> 2285 @Render(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) 2286 </div> 2287 } 2288 @if (!String.IsNullOrEmpty(settings.Link)) { 2289 <div class="u-full-width u-pull--left u-margin-top"> 2290 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 2291 </div> 2292 } 2293 </div> 2294 </div> 2295 </div> 2296 <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> 2297 @if (settings.ExternalParagraphId != 0) 2298 { 2299 <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"> 2300 @RenderParagraphContent(settings.ExternalParagraphId) 2301 </div> 2302 } 2303 </div> 2304 </section> 2305 } 2306 } 2307 else 2308 { 2309 @RenderArticleCleanHeader(settings); 2310 } 2311 } 2312 } 2313 2314 @helper RenderArticleOverlayHeader(ArticleHeader settings) { 2315 dynamic[] methodParameters = new dynamic[1]; 2316 methodParameters[0] = settings; 2317 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleOverlayHeaderCustom"); 2318 2319 if (customMethod != null) 2320 { 2321 @customMethod.Invoke(this, methodParameters).ToString(); 2322 } 2323 else 2324 { 2325 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12"; 2326 string contentAlignment = settings.TextLayout == ArticleHeaderTextLayout.Center ? "grid--justify-center" : ""; 2327 2328 if (settings.Image != null) 2329 { 2330 if (settings.Image.Path != null) 2331 { 2332 if (settings.ExternalParagraphId == 0) 2333 { 2334 <section class="multiple-paragraphs-container u-color-light paragraph-container--full-width"> 2335 <div class="background-image image-filter image-filter--darken dw-mod"> 2336 <div class="background-image__wrapper image-filter image-filter--darken dw-mod"> 2337 @{ 2338 settings.Image.CssClass += "background-image__cover dw-mod"; 2339 } 2340 @Render(settings.Image) 2341 </div> 2342 </div> 2343 <div class="center-container dw-mod"> 2344 <div class="grid @contentAlignment"> 2345 <div class="grid__col-md-@contentColumns grid__col-xs-12 paragraph-container paragraph-container--height-xl u-no-padding dw-mod"> 2346 @if (!String.IsNullOrEmpty(settings.Heading)) 2347 { 2348 <h1 class="article__header article__header--giant u-padding-top--lg dw-mod" style="color: @settings.TextColor">@settings.Heading</h1> 2349 } 2350 @if (!String.IsNullOrEmpty(settings.Subheading)) 2351 { 2352 <div class="article__leadtext dw-mod" style="color: @settings.TextColor">@settings.Subheading</div> 2353 } 2354 <div class="u-margin-top"> 2355 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 2356 { 2357 <small class="article__post-info u-pull--left dw-mod" style="color: @settings.TextColor">@settings.Author @settings.Date</small> 2358 } 2359 @if (settings.RatingOutOf != 0) 2360 { 2361 <div class="u-pull--right"> 2362 @Render(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) 2363 </div> 2364 } 2365 </div> 2366 @if (!String.IsNullOrEmpty(settings.Link)) 2367 { 2368 <div class="grid__cell"> 2369 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 2370 </div> 2371 } 2372 </div> 2373 </div> 2374 </div> 2375 </section> 2376 } 2377 else 2378 { 2379 @RenderArticleBanner(settings); 2380 } 2381 } 2382 } 2383 else 2384 { 2385 @RenderArticleCleanHeader(settings); 2386 } 2387 } 2388 } 2389 2390 @helper RenderArticleBannerHeader(dynamic settings) { 2391 dynamic[] methodParameters = new dynamic[1]; 2392 methodParameters[0] = settings; 2393 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleBannerHeaderCustom"); 2394 2395 if (customMethod != null) 2396 { 2397 @customMethod.Invoke(this, methodParameters).ToString(); 2398 } 2399 else 2400 { 2401 @RenderArticleBanner(settings); 2402 } 2403 } 2404 @using System.Reflection 2405 @using System.Text.RegularExpressions; 2406 @using Dynamicweb.Frontend 2407 @using Dynamicweb.Content.Items 2408 @using Dynamicweb.Rapido.Blocks.Components 2409 @using Dynamicweb.Rapido.Blocks.Components.Articles 2410 @using Dynamicweb.Rapido.Blocks 2411 2412 @* Component for the articles *@ 2413 2414 @helper RenderArticleBodyRow(ArticleBodyRow settings) 2415 { 2416 string position = settings.TopLayout == "overlay" ? "article__overlay-offset" : ""; 2417 string contentAlignment = settings.TextLayout == "center" ? "grid--justify-center" : ""; 2418 2419 <div class="grid grid--align-content-start @contentAlignment @position dw-mod"> 2420 @RenderBlockList(settings.SubBlocks) 2421 </div> 2422 } 2423 @using System.Reflection 2424 @using Dynamicweb.Rapido.Blocks.Components 2425 @using Dynamicweb.Rapido.Blocks.Components.General 2426 @using Dynamicweb.Rapido.Blocks.Components.Articles 2427 @using Dynamicweb.Rapido.Blocks 2428 2429 @* Component for the articles *@ 2430 2431 @helper RenderArticleImage(ArticleImage settings) 2432 { 2433 if (settings.Image != null) 2434 { 2435 if (settings.Image.Path != null) 2436 { 2437 <div class="u-margin-bottom--lg"> 2438 @Render(settings.Image) 2439 </div> 2440 } 2441 } 2442 } 2443 @using System.Reflection 2444 @using Dynamicweb.Rapido.Blocks.Components 2445 @using Dynamicweb.Rapido.Blocks.Components.Articles 2446 2447 2448 @* Component for the articles *@ 2449 2450 @helper RenderArticleSubHeader(ArticleSubHeader settings) 2451 { 2452 if (!String.IsNullOrEmpty(settings.Title)) 2453 { 2454 <h2 class="article__header">@settings.Title</h2> 2455 } 2456 } 2457 @using System.Reflection 2458 @using Dynamicweb.Rapido.Blocks.Components 2459 @using Dynamicweb.Rapido.Blocks.Components.Articles 2460 @using Dynamicweb.Rapido.Blocks 2461 2462 2463 @* Component for the articles *@ 2464 2465 @helper RenderArticleText(ArticleText settings) 2466 { 2467 if (!String.IsNullOrEmpty(settings.Text)) 2468 { 2469 string greatTextClass = settings.EnableLargeText == true ? "article__paragraph--great-text" : ""; 2470 2471 <div class="article__paragraph @greatTextClass"> 2472 @settings.Text 2473 </div> 2474 } 2475 } 2476 @using System.Reflection 2477 @using Dynamicweb.Rapido.Blocks.Components 2478 @using Dynamicweb.Rapido.Blocks.Components.Articles 2479 @using Dynamicweb.Rapido.Blocks 2480 2481 2482 @* Component for the articles *@ 2483 2484 @helper RenderArticleQuote(ArticleQuote settings) 2485 { 2486 string text = Regex.Replace(settings.Text, "<.*?>", String.Empty); 2487 2488 <div class="grid u-padding-bottom--lg"> 2489 @if (settings.Image != null) 2490 { 2491 if (settings.Image.Path != null) { 2492 <div class="grid__col-3"> 2493 <div class="grid__cell-img"> 2494 @{ 2495 settings.Image.Title = !String.IsNullOrEmpty(settings.Image.Title) ? settings.Image.Title : settings.Author; 2496 settings.Image.CssClass += " article__image article__image--ball"; 2497 settings.Image.ImageDefault.Width = 200; 2498 settings.Image.ImageDefault.Height = 200; 2499 } 2500 @Render(settings.Image) 2501 </div> 2502 </div> 2503 } 2504 } 2505 <div class="grid__col-auto"> 2506 @if (!String.IsNullOrEmpty(settings.Text)) 2507 { 2508 <div class="article__quote dw-mod"> 2509 <i class="fas fa-quote-right u-margin-bottom--lg"></i> 2510 @settings.Text 2511 <i class="fas fa-quote-right"></i> 2512 </div> 2513 } 2514 @if (!String.IsNullOrEmpty(settings.Author)) 2515 { 2516 <div class="article__quote-author dw-mod"> 2517 - @settings.Author 2518 </div> 2519 } 2520 </div> 2521 </div> 2522 } 2523 @using System.Reflection 2524 @using Dynamicweb.Rapido.Blocks.Components 2525 @using Dynamicweb.Rapido.Blocks.Components.Articles 2526 @using Dynamicweb.Rapido.Blocks 2527 2528 @* Component for the articles *@ 2529 2530 @helper RenderArticleInfoTable(ArticleInfoTable settings) 2531 { 2532 <table class="table table--clean"> 2533 @foreach (var row in settings.Rows) 2534 { 2535 string iconColor = row.IconColor != null ? row.IconColor : "u-brand-color-two"; 2536 2537 <tr> 2538 @if (!String.IsNullOrEmpty(row.Icon)) 2539 { 2540 <td class="u-w32px"><i class="@row.Icon fa-2x @row.IconColor"></i></td> 2541 } 2542 <td class="u-no-margin-on-p-elements"> 2543 <div class="u-bold">@row.Title</div> 2544 @if (!String.IsNullOrEmpty(row.SubTitle)) 2545 { 2546 if (row.Link == null) 2547 { 2548 <div>@row.SubTitle</div> 2549 } 2550 else 2551 { 2552 <a href="@row.Link" class="u-color-inherit">@row.SubTitle</a> 2553 } 2554 } 2555 </td> 2556 </tr> 2557 } 2558 </table> 2559 } 2560 @using System.Reflection 2561 @using Dynamicweb.Rapido.Blocks.Components 2562 @using Dynamicweb.Rapido.Blocks.Components.General 2563 @using Dynamicweb.Rapido.Blocks.Components.Articles 2564 @using Dynamicweb.Rapido.Blocks 2565 2566 @* Component for the articles *@ 2567 2568 @helper RenderArticleGalleryModal(ArticleGalleryModal settings) 2569 { 2570 Modal galleryModal = new Modal 2571 { 2572 Id = "ParagraphGallery", 2573 Width = ModalWidth.Full, 2574 BodyTemplate = RenderArticleGalleryModalContent() 2575 }; 2576 2577 @Render(galleryModal) 2578 } 2579 2580 @helper RenderArticleGalleryModalContent() { 2581 <div class="modal__image-min-size-wrapper"> 2582 @Render(new Image { 2583 Id = "ParagraphGallery", 2584 Path = "#", 2585 CssClass = "modal--full__img", 2586 DisableLazyLoad = true, 2587 DisableImageEngine = true 2588 }) 2589 </div> 2590 2591 <div class="modal__images-counter" id="ParagraphGallery_counter"></div> 2592 2593 @Render(new Button { 2594 Id = "ParagraphGallery_prev", 2595 ButtonType = ButtonType.Button, 2596 ButtonLayout = ButtonLayout.None, 2597 CssClass = "modal__prev-btn", 2598 Icon = new Icon { Prefix = "far", Name = "fa-angle-left", LabelPosition = IconLabelPosition.After }, 2599 OnClick = "Gallery.prevImage('ParagraphGallery')" 2600 }) 2601 2602 @Render(new Button { 2603 Id = "ParagraphGallery_next", 2604 ButtonType = ButtonType.Button, 2605 ButtonLayout = ButtonLayout.None, 2606 CssClass = "modal__next-btn", 2607 Icon = new Icon { Prefix = "far", Name = "fa-angle-right", LabelPosition = IconLabelPosition.After }, 2608 OnClick = "Gallery.nextImage('ParagraphGallery')" 2609 }) 2610 } 2611 @using System.Reflection 2612 @using Dynamicweb.Rapido.Blocks.Components 2613 @using Dynamicweb.Rapido.Blocks.Components.Articles 2614 @using Dynamicweb.Rapido.Blocks 2615 2616 2617 @* Component for the articles *@ 2618 2619 @helper RenderArticleRelated(ArticleRelated settings) 2620 { 2621 string cardClass = Pageview.Device.ToString() != "Tablet" ? "card u-color-light--bg u-full-height" : ""; 2622 string cardFooterClass = Pageview.Device.ToString() != "Tablet" ? "card-footer u-color-light--bg" : ""; 2623 2624 <section class="multiple-paragraphs-container u-color-light-gray--bg paragraph-container--full-width"> 2625 <div class="center-container dw-mod"> 2626 <div class="grid u-padding"> 2627 <div class="grid__col-md-12 grid__col-xs-12"> 2628 <h2 class="article__header u-no-margin u-margin-top">@settings.Title</h2> 2629 </div> 2630 </div> 2631 2632 <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> 2633 2634 <script id="RelatedSimpleTemplate" type="text/x-template"> 2635 {{#.}} 2636 <div class="grid u-padding-bottom--lg"> 2637 {{#Cases}} 2638 <div class="grid__col-3 image-hover--zoom dw-mod"> 2639 <a href="{{link}}" class="u-full-height u-color-light--bg"> 2640 {{#if image}} 2641 <div class="u-color-light--bg u-no-padding dw-mod"> 2642 <div class="flex-img image-hover__wrapper"> 2643 <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}}" /> 2644 </div> 2645 </div> 2646 {{/if}} 2647 2648 <div class="card u-color-light--bg dw-mod"> 2649 <h3 class="article-list__item-header u-truncate-text dw-mod">{{title}}</h3> 2650 <p class="article__short-summary dw-mod">{{summary}}</p> 2651 </div> 2652 </a> 2653 </div> 2654 {{/Cases}} 2655 </div> 2656 {{/.}} 2657 </script> 2658 </div> 2659 </section> 2660 } 2661 @using System.Reflection 2662 @using Dynamicweb.Rapido.Blocks.Components 2663 @using Dynamicweb.Rapido.Blocks.Components.Articles 2664 @using Dynamicweb.Rapido.Blocks 2665 2666 2667 @* Component for the articles *@ 2668 2669 @helper RenderArticleMenu(ArticleMenu settings) 2670 { 2671 if (!String.IsNullOrEmpty(settings.Title)) { 2672 <div class="u-margin u-border-bottom"> 2673 <h3 class="u-no-margin">@settings.Title</h3> 2674 </div> 2675 } 2676 2677 <ul class="menu-left u-margin-bottom dw-mod"> 2678 @foreach (var item in settings.Items) 2679 { 2680 @Render(item) 2681 } 2682 </ul> 2683 } 2684 2685 @helper RenderArticleMenuItem(ArticleMenuItem settings) 2686 { 2687 string link = !String.IsNullOrEmpty(settings.Link) ? settings.Link : "#"; 2688 2689 if (!String.IsNullOrEmpty(settings.Title)) { 2690 <li class="menu-left__item dw-mod"> 2691 <a href="@link" onclick="@settings.OnClick" class="menu-left__link dw-mod">@settings.Title</a> 2692 </li> 2693 } 2694 } 2695 @using System.Reflection 2696 @using Dynamicweb.Rapido.Blocks.Components 2697 @using Dynamicweb.Rapido.Blocks.Components.Articles 2698 @using Dynamicweb.Rapido.Blocks 2699 2700 @* Component for the articles *@ 2701 2702 @helper RenderArticleList(ArticleList settings) 2703 { 2704 if (Pageview != null) 2705 { 2706 bool isParagraph = Pageview.CurrentParagraph != null ? true : false; 2707 string[] sortArticlesListBy = new string[2]; 2708 2709 if (isParagraph) { 2710 sortArticlesListBy = Pageview.CurrentParagraph.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString()) ? Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" }; 2711 } 2712 else { 2713 sortArticlesListBy = Pageview.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.Item["SortArticlesListBy"].ToString()) ? Pageview.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" }; 2714 } 2715 2716 string sourcePage = settings.SourcePage != null ? settings.SourcePage : Pageview.ID.ToString(); 2717 2718 if (!settings.DisablePagination) { 2719 @RenderItemList(new 2720 { 2721 ItemType = !String.IsNullOrEmpty(settings.ItemType) ? settings.ItemType : "DynamicArticle", 2722 ListSourceType = settings.SourceType, 2723 ListSourcePage = sourcePage, 2724 ItemFieldsList = "*", 2725 Filter = settings.Filter, 2726 ListOrderBy = sortArticlesListBy[0], 2727 ListOrderByDirection = sortArticlesListBy[1], 2728 ListSecondOrderBy = sortArticlesListBy[0] == "Date" ? "InFocusSortId" : "Date", 2729 ListSecondOrderByDirection = "ASC", 2730 IncludeAllChildItems = true, 2731 ListTemplate = settings.Template, 2732 ListPageSize = settings.PageSize.ToString() 2733 }); 2734 } else { 2735 @RenderItemList(new 2736 { 2737 ItemType = !String.IsNullOrEmpty(settings.ItemType) ? settings.ItemType : "DynamicArticle", 2738 ListSourceType = settings.SourceType, 2739 ListSourcePage = sourcePage, 2740 ItemFieldsList = "*", 2741 Filter = settings.Filter, 2742 ListOrderBy = sortArticlesListBy[0], 2743 ListOrderByDirection = sortArticlesListBy[1], 2744 ListSecondOrderBy = sortArticlesListBy[0] == "Date" ? "InFocusSortId" : "Date", 2745 ListSecondOrderByDirection = "ASC", 2746 IncludeAllChildItems = true, 2747 ListTemplate = settings.Template, 2748 ListPageSize = settings.PageSize.ToString(), 2749 ListViewMode = "Partial", 2750 ListShowTo = settings.PageSize + 1 2751 }); 2752 } 2753 } 2754 } 2755 @using System.Reflection 2756 @using Dynamicweb.Rapido.Blocks.Components.Articles 2757 2758 2759 @* Component for the articles *@ 2760 2761 @helper RenderArticleSummary(ArticleSummary settings) 2762 { 2763 if (!String.IsNullOrEmpty(settings.Text)) 2764 { 2765 <div class="article__summary dw-mod">@settings.Text</div> 2766 } 2767 } 2768 @using System.Reflection 2769 @using Dynamicweb.Rapido.Blocks.Components 2770 @using Dynamicweb.Rapido.Blocks.Components.Articles 2771 @using Dynamicweb.Rapido.Blocks 2772 2773 @* Component for the articles *@ 2774 2775 @helper RenderArticleListCategoryFilter(ArticleListCategoryFilter settings) 2776 { 2777 string pageId = Pageview.ID.ToString(); 2778 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("sourcePage")) ? HttpContext.Current.Request.QueryString.Get("sourcePage") : Translate("All"); 2779 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString()); 2780 2781 foreach (var option in settings.Categories) 2782 { 2783 selectedFilter = selectedFilter == option.Value ? option.Key : selectedFilter; 2784 } 2785 2786 if (selectedFilter == pageId) 2787 { 2788 selectedFilter = Translate("All"); 2789 } 2790 2791 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 2792 { 2793 <div class="u-pull--right u-margin-left"> 2794 <div class="collection u-no-margin"> 2795 <h5>@Translate("Category")</h5> 2796 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" /> 2797 <div class="dropdown u-w180px dw-mod"> 2798 <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label> 2799 <div class="dropdown__content dw-mod"> 2800 @foreach (var option in settings.Categories) 2801 { 2802 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div> 2803 } 2804 </div> 2805 <label class="dropdown-trigger-off" for="CategorySelector"></label> 2806 </div> 2807 </div> 2808 </div> 2809 } 2810 else 2811 { 2812 <div class="u-full-width u-margin-bottom"> 2813 <h5 class="u-no-margin">@Translate("Category")</h5> 2814 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" /> 2815 <div class="dropdown u-full-width dw-mod"> 2816 <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label> 2817 <div class="dropdown__content dw-mod"> 2818 @foreach (var option in settings.Categories) 2819 { 2820 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div> 2821 } 2822 </div> 2823 <label class="dropdown-trigger-off" for="CategorySelector"></label> 2824 </div> 2825 </div> 2826 } 2827 } 2828 @using System.Reflection 2829 @using Dynamicweb.Rapido.Blocks.Components 2830 @using Dynamicweb.Rapido.Blocks.Components.Articles 2831 @using Dynamicweb.Rapido.Blocks 2832 @using System.Collections.Generic 2833 2834 @* Component for the articles *@ 2835 2836 @helper RenderArticleListFilter(ArticleListFilter settings) 2837 { 2838 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get(settings.SystemName)) ? HttpContext.Current.Request.QueryString.Get(settings.SystemName) : Translate("All"); 2839 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString()); 2840 2841 if (settings.Options != null) 2842 { 2843 if (settings.Options is IEnumerable<dynamic>) 2844 { 2845 var options = (IEnumerable<dynamic>) settings.Options; 2846 settings.Options = options.OrderBy(item => item.Name); 2847 } 2848 2849 foreach (var option in settings.Options) 2850 { 2851 selectedFilter = selectedFilter == option.Value ? option.Name : selectedFilter; 2852 } 2853 2854 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 2855 { 2856 <div class="u-pull--right u-margin-left"> 2857 <div class="collection u-no-margin"> 2858 <h5>@settings.Label</h5> 2859 <input type="checkbox" id="@(settings.SystemName)Selector" class="dropdown-trigger" /> 2860 <div class="dropdown u-w180px dw-mod"> 2861 <label class="dropdown__header dropdown__btn dw-mod" for="@(settings.SystemName)Selector">@Translate(selectedFilter)</label> 2862 <div class="dropdown__content dw-mod"> 2863 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')">@Translate("All")</div> 2864 @foreach (var option in settings.Options) 2865 { 2866 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')">@Translate(option.Name)</div> 2867 } 2868 </div> 2869 <label class="dropdown-trigger-off" for="@(settings.SystemName)Selector"></label> 2870 </div> 2871 </div> 2872 </div> 2873 } 2874 else 2875 { 2876 <div class="u-full-width u-margin-bottom"> 2877 <h5 class="u-no-margin">@settings.Label</h5> 2878 <input type="checkbox" id="@(settings.SystemName)Selector" class="dropdown-trigger" /> 2879 <div class="dropdown u-full-width w-mod"> 2880 <label class="dropdown__header dropdown__btn dw-mod" for="@(settings.SystemName)Selector">@Translate(selectedFilter)</label> 2881 <div class="dropdown__content dw-mod"> 2882 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')">@Translate("All")</div> 2883 @foreach (var option in settings.Options) 2884 { 2885 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')">@Translate(option.Name)</div> 2886 } 2887 </div> 2888 <label class="dropdown-trigger-off" for="@(settings.SystemName)Selector"></label> 2889 </div> 2890 </div> 2891 } 2892 } 2893 } 2894 @using System.Reflection 2895 @using Dynamicweb.Rapido.Blocks.Components 2896 @using Dynamicweb.Rapido.Blocks.Components.Articles 2897 @using Dynamicweb.Rapido.Blocks 2898 2899 @* Component for the articles *@ 2900 2901 @helper RenderArticleListSearch(ArticleListSearch settings) 2902 { 2903 string searchParameter = !string.IsNullOrEmpty(settings.SearchParameter) ? settings.SearchParameter : "Title"; 2904 string searchWord = HttpContext.Current.Request.QueryString.Get(searchParameter); 2905 string searchString = !string.IsNullOrEmpty(searchWord) ? searchWord.Trim('*') : ""; 2906 string className = "u-w340px u-pull--right u-margin-left"; 2907 2908 if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet") 2909 { 2910 className = "u-full-width"; 2911 } 2912 2913 <div class="typeahead u-color-inherit u-margin-bottom dw-mod @className"> 2914 <input type="text" class="typeahead-search-field u-no-margin dw-mod" placeholder="@Translate("Search in list")" value="@searchString" id="ArticleListSearchInput" onchange="QueryArray.setParameterInCurrentURL('@searchParameter', '*' + document.getElementById('ArticleListSearchInput').value + '*')"> 2915 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod"><i class="fas fa-search"></i></button> 2916 </div> 2917 } 2918 @using System.Reflection 2919 @using Dynamicweb.Rapido.Blocks.Components 2920 @using Dynamicweb.Rapido.Blocks.Components.Articles 2921 @using Dynamicweb.Rapido.Blocks 2922 2923 @* Component for the articles *@ 2924 2925 @helper RenderArticleListNoResultsInfo(ArticleListNoResultsInfo settings) 2926 { 2927 <div class="u-margin-top--lg u-bold u-ta-center u-bold">@Translate(settings.Message)</div> 2928 } 2929 @using System.Reflection 2930 @using Dynamicweb.Rapido.Blocks.Components 2931 @using Dynamicweb.Rapido.Blocks.Components.General 2932 @using Dynamicweb.Rapido.Blocks.Components.Articles 2933 @using Dynamicweb.Rapido.Blocks 2934 @using System.Text.RegularExpressions 2935 2936 @* Component for the articles *@ 2937 2938 @helper RenderArticleListItem(ArticleListItem settings) 2939 { 2940 switch (settings.Type) { 2941 case ArticleListItemType.Card: 2942 @RenderArticleListItemCard(settings); 2943 break; 2944 case ArticleListItemType.List: 2945 @RenderArticleListItemList(settings); 2946 break; 2947 case ArticleListItemType.Simple: 2948 @RenderArticleListItemSimple(settings); 2949 break; 2950 default: 2951 @RenderArticleListItemCard(settings); 2952 break; 2953 } 2954 } 2955 2956 @helper RenderArticleListItemCard(ArticleListItem settings) { 2957 <a href="@settings.Link" class="u-full-height u-color-light--bg"> 2958 <div class="u-color-light--bg u-no-padding dw-mod"> 2959 @if (settings.Logo != null) 2960 { 2961 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;" : ""; 2962 settings.Logo.ImageDefault.Crop = 5; 2963 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width; 2964 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height; 2965 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage"> 2966 @if (settings.Stickers != null) 2967 { 2968 if (settings.Stickers.Position != StickersListPosition.Custom) 2969 { 2970 @Render(settings.Stickers); 2971 } 2972 } 2973 @RenderImage(settings.Logo) 2974 </div> 2975 } else if (settings.Image != null) 2976 { 2977 <div class="flex-img image-hover__wrapper u-position-relative dw-mod"> 2978 @if (settings.Stickers != null) 2979 { 2980 if (settings.Stickers.Position != StickersListPosition.Custom) 2981 { 2982 @Render(settings.Stickers); 2983 } 2984 } 2985 @Render(settings.Image) 2986 </div> 2987 } 2988 </div> 2989 2990 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary)) 2991 { 2992 <div class="card u-color-light--bg dw-mod"> 2993 @if (settings.Stickers != null) 2994 { 2995 if (settings.Stickers.Position == StickersListPosition.Custom) 2996 { 2997 @Render(settings.Stickers); 2998 } 2999 } 3000 @if (!String.IsNullOrEmpty(settings.Title)) 3001 { 3002 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3> 3003 } 3004 @if (!String.IsNullOrEmpty(settings.SubTitle)) 3005 { 3006 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 3007 } 3008 @if (!String.IsNullOrEmpty(settings.Summary)) 3009 { 3010 <p class="article__short-summary dw-mod">@settings.Summary</p> 3011 } 3012 </div> 3013 } 3014 </a> 3015 } 3016 3017 @helper RenderArticleListItemList(ArticleListItem settings) { 3018 <a href="@settings.Link"> 3019 <div class="grid u-color-light--bg u-no-padding dw-mod"> 3020 <div class="grid__col-md-3"> 3021 <div class="u-color-light--bg u-no-padding dw-mod"> 3022 @if (settings.Logo != null) 3023 { 3024 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;" : ""; 3025 settings.Logo.ImageDefault.Crop = 5; 3026 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width; 3027 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height; 3028 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage"> 3029 @if (settings.Stickers != null) 3030 { 3031 if (settings.Stickers.Position != StickersListPosition.Custom) 3032 { 3033 @Render(settings.Stickers); 3034 } 3035 } 3036 @RenderImage(settings.Logo) 3037 </div> 3038 } else if (settings.Image != null) 3039 { 3040 <div class="flex-img image-hover__wrapper dw-mod"> 3041 @if (settings.Stickers != null) 3042 { 3043 if (settings.Stickers.Position != StickersListPosition.Custom) 3044 { 3045 @Render(settings.Stickers); 3046 } 3047 } 3048 @Render(settings.Image) 3049 </div> 3050 } 3051 </div> 3052 </div> 3053 3054 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary)) 3055 { 3056 <div class="grid__col-md-9"> 3057 @if (!String.IsNullOrEmpty(settings.Title)) 3058 { 3059 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3> 3060 } 3061 @if (settings.Stickers != null) 3062 { 3063 if (settings.Stickers.Position == StickersListPosition.Custom) 3064 { 3065 @Render(settings.Stickers); 3066 } 3067 } 3068 @if (!String.IsNullOrEmpty(settings.SubTitle)) 3069 { 3070 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 3071 } 3072 @if (!String.IsNullOrEmpty(settings.Summary)) 3073 { 3074 <p class="article__short-summary dw-mod">@settings.Summary</p> 3075 } 3076 </div> 3077 } 3078 </div> 3079 </a> 3080 } 3081 3082 @helper RenderArticleListItemSimple(ArticleListItem settings) { 3083 <a href="@settings.Link" class="u-color-inherit"> 3084 <div class="grid u-color-light--bg u-no-padding dw-mod"> 3085 <div class="grid__col-md-12"> 3086 @if (!String.IsNullOrEmpty(settings.Title)) 3087 { 3088 <div class="article-list-item__header u-truncate-text u-no-margin dw-mod">@settings.Title</div> 3089 } 3090 @if (!String.IsNullOrEmpty(settings.SubTitle)) 3091 { 3092 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 3093 } 3094 </div> 3095 </div> 3096 </a> 3097 } 3098 @using System.Reflection 3099 @using Dynamicweb.Rapido.Blocks.Components.Articles 3100 3101 3102 @* Component for the articles *@ 3103 3104 @helper RenderArticleAuthorAndDate(ArticleAuthorAndDate settings) 3105 { 3106 <small class="article__subscription"> 3107 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date))) 3108 { 3109 <text>@Translate("Written")</text> 3110 } 3111 @if (!string.IsNullOrWhiteSpace(settings.Author)) 3112 { 3113 <text>@Translate("by") @settings.Author</text> 3114 } 3115 @if (!string.IsNullOrWhiteSpace(settings.Date)) 3116 { 3117 <text>@Translate("on") @settings.Date</text> 3118 } 3119 </small> 3120 } 3121 @using System.Reflection 3122 @using Dynamicweb.Rapido.Blocks.Components.Articles 3123 @using Dynamicweb.Rapido.Blocks.Components.General 3124 3125 3126 @* Component for the articles *@ 3127 3128 @helper RenderArticleLink(ArticleLink settings) 3129 { 3130 if (!string.IsNullOrEmpty(settings.Title)) 3131 { 3132 Button link = new Button { 3133 ConfirmText = settings.ConfirmText, 3134 ConfirmTitle = settings.ConfirmTitle, 3135 ButtonType = settings.ButtonType, 3136 Id = settings.Id, 3137 Title = settings.Title, 3138 AltText = settings.AltText, 3139 OnClick = settings.OnClick, 3140 CssClass = settings.CssClass, 3141 Disabled = settings.Disabled, 3142 Icon = settings.Icon, 3143 Name = settings.Name, 3144 Href = settings.Href, 3145 ButtonLayout = settings.ButtonLayout, 3146 ExtraAttributes = settings.ExtraAttributes 3147 }; 3148 <div class="grid__cell"> 3149 @Render(link) 3150 </div> 3151 } 3152 } 3153 @using System.Reflection 3154 @using Dynamicweb.Rapido.Blocks 3155 @using Dynamicweb.Rapido.Blocks.Components.Articles 3156 @using Dynamicweb.Rapido.Blocks.Components.General 3157 3158 3159 @* Component for the articles *@ 3160 3161 @helper RenderArticleCarousel(ArticleCarousel settings) 3162 { 3163 <div class="grid"> 3164 <div class="grid__col-12"> 3165 <div class="carousel" id="carousel_@settings.Id"> 3166 <div class="carousel__container js-carousel-slides dw-mod"> 3167 @RenderBlockList(settings.SubBlocks) 3168 </div> 3169 </div> 3170 </div> 3171 </div> 3172 3173 <script> 3174 document.addEventListener("DOMContentLoaded", function () { 3175 new CarouselModule("#carousel_@settings.Id", { 3176 slideTime: 0, 3177 dots: true 3178 }); 3179 }); 3180 </script> 3181 } 3182 3183 @helper RenderArticleCarouselSlide(ArticleCarouselSlide settings) 3184 { 3185 string imageEngine = "/Admin/Public/GetImage.ashx?"; 3186 3187 string defaultImage = settings.ImageSettings != null ? imageEngine : settings.Image; 3188 if (settings.ImageSettings != null) 3189 { 3190 defaultImage += settings.ImageSettings.Width != 0 ? "Width=" + settings.ImageSettings.Width + "&" : ""; 3191 defaultImage += settings.ImageSettings.Height != 0 ? "Height=" + settings.ImageSettings.Height + "&" : ""; 3192 defaultImage += "Crop=" + settings.ImageSettings.Crop + "&"; 3193 defaultImage += "Compression=" + settings.ImageSettings.Compression + "&"; 3194 defaultImage += "DoNotUpscale=" + settings.ImageSettings.DoNotUpscale.ToString() + "&"; 3195 defaultImage += "FillCanvas=" + settings.ImageSettings.FillCanvas.ToString() + "&"; 3196 } 3197 defaultImage += "&Image=" + settings.Image; 3198 3199 <div class="carousel__slide u-min-h300px u-flex dw-mod" style="background-size:cover; background-image:url('@defaultImage')"> 3200 <a class="article-carousel-item__wrap" href="@settings.Link" title="@settings.Title"> 3201 <h2 class="article-list__item-header u-truncate-text u-color-light dw-mod">@settings.Title</h2> 3202 <div class="article-list__item-info"> 3203 @if (settings.Stickers != null) 3204 { 3205 settings.Stickers.Position = StickersListPosition.Custom; 3206 @Render(settings.Stickers); 3207 } 3208 3209 <small class="u-margin-top--lg u-color-light"> 3210 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date))) 3211 { 3212 <text>@Translate("Written")</text> 3213 } 3214 @if (!string.IsNullOrWhiteSpace(settings.Author)) 3215 { 3216 <text>@Translate("by") @settings.Author</text> 3217 } 3218 @if (!string.IsNullOrWhiteSpace(settings.Date)) 3219 { 3220 <text>@Translate("on") @settings.Date</text> 3221 } 3222 </small> 3223 </div> 3224 3225 <h3 class="article__short-summary u-color-light">@settings.Summary</h3> 3226 </a> 3227 @if (settings.UseFilters == true) 3228 { 3229 <div class="background-image image-filter image-filter--darken dw-mod"></div> 3230 } 3231 </div> 3232 } 3233 @using System.Text.RegularExpressions 3234 @using Dynamicweb.Rapido.Blocks.Components 3235 @using Dynamicweb.Rapido.Blocks.Components.General 3236 @using Dynamicweb.Rapido.Blocks.Components.Articles 3237 @using Dynamicweb.Rapido.Blocks 3238 3239 @* Component for the articles *@ 3240 3241 @helper RenderArticleVideo(ArticleVideo settings) 3242 { 3243 if (settings.Url != null) 3244 { 3245 //getting video ID from youtube URL 3246 string videoCode = settings.Url; 3247 Regex regex = new Regex(@".be\/(.[^?]*)"); 3248 Match match = regex.Match(videoCode); 3249 string videoId = ""; 3250 if (match.Success) 3251 { 3252 videoId = match.Groups[1].Value; 3253 } 3254 else 3255 { 3256 regex = new Regex(@"v=([^&]+)"); 3257 match = regex.Match(videoCode); 3258 if (match.Success) 3259 { 3260 videoId = match.Groups[1].Value; 3261 } 3262 } 3263 3264 int autoPlay = settings.AutoPlay == "true" ? 1 : 0; 3265 3266 <div class="video-wrapper"> 3267 <div class="js-youtube-video" data-video="@videoId" id="ytPlayer@(Guid.NewGuid().ToString("N"))" data-auto-play="@autoPlay" data-enable-controls="1"></div> 3268 </div> 3269 } 3270 } 3271 3272 3273 3274 @* Simple helpers *@ 3275 3276 @*Requires the Gallery ItemType that comes with Rapido*@ 3277 @helper RenderArticleItemGallery(IList<ItemViewModel> gallery) { 3278 if (gallery != null && gallery.Count > 0) 3279 { 3280 int count = 1; 3281 3282 foreach (var item in gallery) 3283 { 3284 if (item.GetFile("ImagePath") != null) 3285 { 3286 string image = item.GetFile("ImagePath").PathUrlEncoded; 3287 string imagePrefix = "/Admin/Public/GetImage.ashx?width=1200&amp;height=820&amp;crop=5&amp;Compression=75&amp;DoNotUpscale=1&amp;image="; 3288 int imagesCount = gallery.Count; 3289 3290 if (count == 1) 3291 { 3292 <label class="gallery" for="ParagraphGalleryModalTrigger" onclick="Gallery.openImage(this.querySelector('.js-gallery'))"> 3293 <span class="gallery__main-image"> 3294 <img src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=992&amp;height=760&amp;crop=0&amp;Compression=75&amp;DoNotUpscale=1&amp;image=@image" class="b-lazy flex-img js-gallery" alt="" data-for="ParagraphGallery" data-image="@imagePrefix@image" /> 3295 </span> 3296 <span class="gallery__image-counter"> 3297 <i class="fas fa-camera fa-2x"></i> <span class="gallery__image-counter__number">@imagesCount</span> 3298 <span class="gallery__image-counter__text">@Translate("See all") <i class="fas fa-angle-right"></i></span> 3299 </span> 3300 </label> 3301 } 3302 else 3303 { 3304 <div class="u-hidden js-gallery" data-for="ParagraphGallery" data-image="@imagePrefix@image"></div> 3305 } 3306 3307 count++; 3308 } 3309 } 3310 3311 @Render(new ArticleGalleryModal()) 3312 } 3313 } 3314 3315 @helper RenderMobileFilters(List<Block> subBlocks) 3316 { 3317 if (subBlocks.Count > 0) 3318 { 3319 <div class="grid__col-12"> 3320 <input type="checkbox" id="CheckFilters" class="js-remember-state u-hidden" data-expand="CheckFilters" /> 3321 <div class="grid u-margin-bottom dw-mod" data-trigger="CheckFilters"> 3322 @RenderBlockList(subBlocks) 3323 </div> 3324 <label for="CheckFilters" class="btn btn--secondary btn--full dw-mod js-expand-hide" data-trigger="CheckFilters">@Translate("Select filters")</label> 3325 <label for="CheckFilters" class="btn btn--secondary btn--full dw-mod expandable--collapsed" data-trigger="CheckFilters">@Translate("Close filters")</label> 3326 </div> 3327 } 3328 } 3329 3330 3331 @* Include the Blocks for the page *@ 3332 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 3333 3334 @using System 3335 @using System.Web 3336 @using System.Collections.Generic 3337 @using Dynamicweb.Rapido.Blocks.Extensibility 3338 @using Dynamicweb.Rapido.Blocks 3339 3340 @{ 3341 BlocksPage topSnippetsBlocksPage = BlocksPage.GetBlockPage("Master"); 3342 3343 Block tagManager = new Block() 3344 { 3345 Id = "TagManager", 3346 SortId = 1, 3347 Template = RenderGoogleTagManager() 3348 }; 3349 3350 Block facebookPixel = new Block() 3351 { 3352 Id = "FacebookPixel", 3353 SortId = 2, 3354 Template = RenderFacebookPixel() 3355 }; 3356 3357 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, tagManager); 3358 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, facebookPixel); 3359 } 3360 3361 @helper RenderGoogleTagManager() { 3362 string GoogleTagManagerID = Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID"); 3363 3364 if (!string.IsNullOrWhiteSpace(GoogleTagManagerID)) 3365 { 3366 <script> 3367 (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': 3368 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], 3369 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 3370 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); 3371 })(window,document,'script','dataLayer','@GoogleTagManagerID'); 3372 </script> 3373 <!-- Google Tag Manager (noscript) --> 3374 <noscript> 3375 <iframe src="https://www.googletagmanager.com/ns.html?id=@GoogleTagManagerID" 3376 height="0" width="0" style="display:none;visibility:hidden"></iframe> 3377 </noscript> 3378 <!-- End Google Tag Manager (noscript) --> 3379 } 3380 } 3381 3382 @helper RenderFacebookPixel() { 3383 string FacebookPixelID = Model.Area.Item.GetItem("Settings").GetString("FacebookPixelID"); 3384 3385 if (!string.IsNullOrWhiteSpace(FacebookPixelID)) 3386 { 3387 <!-- Facebook Pixel Code --> 3388 <script> 3389 !function(f,b,e,v,n,t,s) 3390 {if(f.fbq)return;n=f.fbq=function(){n.callMethod? 3391 n.callMethod.apply(n,arguments):n.queue.push(arguments)}; 3392 if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0'; 3393 n.queue=[];t=b.createElement(e);t.async=!0; 3394 t.src=v;s=b.getElementsByTagName(e)[0]; 3395 s.parentNode.insertBefore(t,s)}(window, document,'script', 3396 'https://connect.facebook.net/en_US/fbevents.js'); 3397 fbq('init', '@FacebookPixelID'); 3398 fbq('track', 'PageView'); 3399 </script> 3400 <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=@FacebookPixelID&ev=PageView&noscript=1" alt="" /></noscript> 3401 } 3402 } 3403 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 3404 3405 @using System 3406 @using System.Web 3407 @using System.Collections.Generic 3408 @using Dynamicweb.Rapido.Blocks 3409 @using Dynamicweb.Rapido.Blocks.Extensibility 3410 @using Dynamicweb.Security.UserManagement 3411 @using Dynamicweb.Security.UserManagement.ExternalAuthentication 3412 @using Dynamicweb.Rapido.Blocks.Components.General 3413 3414 @{ 3415 BlocksPage loginBlocksPage = BlocksPage.GetBlockPage("Master"); 3416 3417 Block loginModal = new Block() 3418 { 3419 Id = "LoginModal", 3420 SortId = 10, 3421 Component = new Modal 3422 { 3423 Id = "SignIn", 3424 Heading = new Heading 3425 { 3426 Level = 0, 3427 Title = Translate("Sign in") 3428 }, 3429 Width = ModalWidth.Xs, 3430 BodyTemplate = RenderLoginForm() 3431 } 3432 }; 3433 3434 loginBlocksPage.Add(MasterBlockId.MasterTopSnippets, loginModal); 3435 } 3436 3437 @helper RenderLoginForm() 3438 { 3439 int pageId = Model.TopPage.ID; 3440 string userSignedInErrorText = ""; 3441 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 3442 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; 3443 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 3444 bool showModalOnStart = pageId != GetPageIdByNavigationTag("CustomerCenter") && Model.LogOnFailed; 3445 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); 3446 bool hideForgotPasswordLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideForgotPasswordLink"); 3447 3448 ProviderCollection providers = Provider.GetActiveProviders(); 3449 3450 if (Model.LogOnFailed) 3451 { 3452 switch (Model.LogOnFailedReason) 3453 { 3454 case LogOnFailedReason.PasswordLengthInvalid: 3455 userSignedInErrorText = Translate("Password length is invalid"); 3456 break; 3457 case LogOnFailedReason.IncorrectLogin: 3458 userSignedInErrorText = Translate("Invalid email or password"); 3459 break; 3460 case LogOnFailedReason.ExceededFailedLogOnLimit: 3461 userSignedInErrorText = Translate("You have exceeded the limit of allowed login attempts. The user account is temporarily locked"); 3462 break; 3463 case LogOnFailedReason.LoginLocked: 3464 userSignedInErrorText = Translate("The user account is temporarily locked"); 3465 break; 3466 case LogOnFailedReason.PasswordExpired: 3467 userSignedInErrorText = Translate("The password has expired and needs to be renewed"); 3468 break; 3469 default: 3470 userSignedInErrorText = Translate("An unknown error occured"); 3471 break; 3472 } 3473 } 3474 3475 Form form = new Form { Method = FormMethod.Post, Name = "LoginModalForm" }; 3476 3477 form.Add(new HiddenField { Name = "ID", Value = Converter.ToString(pageId) }); 3478 form.Add(new HiddenField { Name = "DWExtranetUsernameRemember", Value = "True" }); 3479 form.Add(new HiddenField { Name = "DWExtranetPasswordRemember", Value = "True" }); 3480 form.Add(new HiddenField { Name = "LoginAction", Value = "Login" }); 3481 form.Add(new TextField { Id = "LoginUsername", Name = "username", Label = Translate("Email"), CssClass = "u-full-width", Required = true }); 3482 form.Add(new TextField { Id = "LoginPassword", Name = "password", Type = TextFieldType.Password, Label = Translate("Password"), CssClass = "u-full-width", Required = true }); 3483 form.Add(new NotificationMessage { Message = userSignedInErrorText, MessageType = NotificationMessageType.Error }); 3484 form.Add(new CheckboxField { Id = "LoginRememberMe", Value = "True", Name = "Autologin", Label = Translate("Remember me") }); 3485 form.Add(new Button { ButtonType = ButtonType.Submit, Title = Translate("Sign in"), CssClass = "btn--full", OnClick = "Buttons.LockButton(event)" }); 3486 3487 foreach (Provider LoginProvider in providers) 3488 { 3489 var ProviderName = LoginProvider.Name.ToLower(); 3490 form.Add(new Link { 3491 Href = "/Admin/Public/Social/ExternalLogin.aspx?action=login&providerID=" + LoginProvider.ID, 3492 Icon = new Icon { Prefix = "fab", Name = "fa-" + ProviderName, CssClass = "fa-1_5x", LabelPosition = IconLabelPosition.After }, 3493 ButtonLayout = ButtonLayout.LinkClean, 3494 CssClass = "btn--condensed u-margin-bottom u-margin-right u-inline-block u-color-" + ProviderName, 3495 AltText = ProviderName 3496 }); 3497 } 3498 3499 if (!hideCreateAccountLink) { 3500 form.Add(new Link { Href = "/default.aspx?ID=" + createAccountPageId, Title = Translate("Create account?"), ButtonLayout = ButtonLayout.None, CssClass = "u-block u-padding-bottom" }); 3501 } 3502 3503 if (!hideForgotPasswordLink) { 3504 form.Add(new Link { Href = forgotPasswordPageLink, Title = Translate("Forgot your password?"), ButtonLayout = ButtonLayout.None, CssClass = "u-block u-padding-bottom" }); 3505 } 3506 3507 @Render(form) 3508 3509 if (showModalOnStart) 3510 { 3511 <script> 3512 document.getElementById("SignInModalTrigger").checked = true; 3513 </script> 3514 } 3515 } 3516 3517 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3518 3519 @using System 3520 @using System.Web 3521 @using System.Collections.Generic 3522 @using Dynamicweb.Rapido.Blocks.Extensibility 3523 @using Dynamicweb.Rapido.Blocks 3524 @using Dynamicweb.Rapido.Services 3525 3526 3527 @functions { 3528 BlocksPage mobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master"); 3529 } 3530 3531 @{ 3532 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"; 3533 bool mobileHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 3534 bool mobileHideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart") || !Dynamicweb.Rapido.Services.User.IsBuyingAllowed(); 3535 3536 Block mobileHeader = new Block() 3537 { 3538 Id = "MobileTop", 3539 SortId = 10, 3540 Template = RenderMobileTop(), 3541 SkipRenderBlocksList = true 3542 }; 3543 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeader); 3544 3545 Block mobileHeaderNavigation = new Block() 3546 { 3547 Id = "MobileHeaderNavigation", 3548 SortId = 10, 3549 Template = RenderMobileHeaderNavigation(), 3550 SkipRenderBlocksList = true, 3551 BlocksList = new List<Block> { 3552 new Block { 3553 Id = "MobileHeaderNavigationTrigger", 3554 SortId = 10, 3555 Template = RenderMobileHeaderNavigationTrigger() 3556 } 3557 } 3558 }; 3559 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderNavigation); 3560 3561 Block mobileHeaderLogo = new Block() 3562 { 3563 Id = "MobileHeaderLogo", 3564 SortId = 20, 3565 Template = RenderMobileHeaderLogo(), 3566 SkipRenderBlocksList = true 3567 }; 3568 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderLogo); 3569 3570 Block mobileHeaderActions = new Block() 3571 { 3572 Id = "MobileHeaderActions", 3573 SortId = 30, 3574 Template = RenderMobileTopActions(), 3575 SkipRenderBlocksList = true 3576 }; 3577 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderActions); 3578 3579 if (!mobileHideSearch) 3580 { 3581 Block mobileHeaderSearch = new Block 3582 { 3583 Id = "MobileHeaderSearch", 3584 SortId = 10, 3585 Template = RenderMobileTopSearch() 3586 }; 3587 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderSearch); 3588 } 3589 3590 Block mobileHeaderMiniCart; 3591 3592 if (!mobileHideCart) 3593 { 3594 mobileHeaderMiniCart = new Block 3595 { 3596 Id = "MobileHeaderMiniCart", 3597 SortId = 20, 3598 Template = RenderMobileTopMiniCart() 3599 }; 3600 3601 Block miniCartCounterScriptTemplate = new Block 3602 { 3603 Id = "MiniCartCounterScriptTemplate", 3604 Template = RenderMobileMiniCartCounterContent() 3605 }; 3606 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate); 3607 } 3608 else 3609 { 3610 mobileHeaderMiniCart = new Block 3611 { 3612 Id = "MobileHeaderMiniCart", 3613 SortId = 20 3614 }; 3615 } 3616 3617 if (!mobileHideSearch) 3618 { 3619 Block mobileHeaderSearchBar = new Block() 3620 { 3621 Id = "MobileHeaderSearchBar", 3622 SortId = 30, 3623 Template = RenderMobileTopSearchBar() 3624 }; 3625 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeaderSearchBar); 3626 } 3627 3628 switch (mobileTopLayout) 3629 { 3630 case "nav-left": 3631 mobileHeaderNavigation.SortId = 10; 3632 mobileHeaderLogo.SortId = 20; 3633 mobileHeaderActions.SortId = 30; 3634 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart); 3635 break; 3636 case "nav-right": 3637 mobileHeaderLogo.SortId = 10; 3638 mobileHeaderActions.SortId = 20; 3639 mobileHeaderNavigation.SortId = 30; 3640 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart); 3641 break; 3642 case "nav-search-left": 3643 mobileHeaderNavigation.SortId = 10; 3644 mobileHeaderLogo.SortId = 20; 3645 mobileHeaderActions.SortId = 30; 3646 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart); 3647 break; 3648 case "search-left": 3649 mobileHeaderActions.SortId = 10; 3650 mobileHeaderLogo.SortId = 20; 3651 mobileHeaderNavigation.SortId = 30; 3652 mobileHeaderMiniCart.SortId = 0; 3653 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart); 3654 break; 3655 } 3656 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed()) 3657 { 3658 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", new Block { 3659 Id = "CartInitialization", 3660 Template = RenderMobileCartInitialization() 3661 }); 3662 } 3663 } 3664 3665 3666 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3667 3668 @using System 3669 @using System.Web 3670 @using Dynamicweb.Rapido.Blocks.Extensibility 3671 @using Dynamicweb.Rapido.Blocks 3672 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 3673 @using Dynamicweb.Rapido.Blocks 3674 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 3675 @using Dynamicweb.Rapido.Blocks 3676 @using System 3677 @using Dynamicweb.Rapido.Blocks 3678 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3679 3680 @{ 3681 var mobileUserPoints = Pageview.User?.PointBalance; 3682 var mobileLoyaltyPointsEnabled = Pageview.User != null && Dynamicweb.Security.Licensing.LicenseManager.LicenseHasFeature("LoyaltyPoints"); 3683 3684 if (mobileUserPoints != null && mobileUserPoints > 0 && mobileLoyaltyPointsEnabled) 3685 { 3686 var loyaltyService = new Dynamicweb.Ecommerce.Loyalty.LoyaltyService(); 3687 var userTransactions = loyaltyService.GetUserTransactions(Pageview.User.ID); 3688 var expirationDate = userTransactions.OrderBy(t => t.ExpirationDate).First().ExpirationDate; 3689 3690 var loyaltyPoints = new Block 3691 { 3692 Id = "LoyaltyPointsMobile", 3693 SortId = 30, 3694 Template = RenderMobileLoyaltyPoints(mobileUserPoints, expirationDate), 3695 Design = new Design 3696 { 3697 Size = "auto-width", 3698 HidePadding = true, 3699 RenderType = RenderType.Column, 3700 CssClass = "grid--align-self-center u-pull--left u-no-margin" 3701 } 3702 }; 3703 BlocksPage.GetBlockPage("Master").Add("MobileHeaderNavigation", loyaltyPoints); 3704 } 3705 } 3706 @helper RenderMobileLoyaltyPoints(double? userPoints, DateTime expirationDate) 3707 { 3708 var cart = Dynamicweb.Ecommerce.Common.Context.Cart; 3709 var pointsUsedInCart = cart?.TotalPoints ?? 0; 3710 userPoints -= pointsUsedInCart; 3711 <div class="u-color-light"> 3712 <p class="u-margin u-margin">@Translate("Points"): @userPoints</p> 3713 </div> 3714 } 3715 @{ 3716 BlocksPage customMobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master"); 3717 } 3718 3719 3720 3721 @helper RenderMobileCartInitialization() 3722 { 3723 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 3724 <script> 3725 window.cartId = "@miniCartFeedPageId"; 3726 </script> 3727 } 3728 3729 @helper RenderMobileTop() { 3730 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileTop").OrderBy(item => item.SortId).ToList(); 3731 3732 <nav class="main-navigation-mobile dw-mod"> 3733 <div class="center-container top-container__center-container dw-mod"> 3734 <div class="grid grid--align-center"> 3735 @RenderBlockList(subBlocks) 3736 </div> 3737 </div> 3738 </nav> 3739 } 3740 3741 @helper RenderMobileHeaderNavigation() { 3742 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderNavigation").OrderBy(item => item.SortId).ToList(); 3743 3744 <div class="grid__col-auto-width"> 3745 <ul class="menu dw-mod"> 3746 @RenderBlockList(subBlocks) 3747 </ul> 3748 </div> 3749 } 3750 3751 @helper RenderMobileHeaderNavigationTrigger() { 3752 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 3753 <label for="MobileNavTrigger" class="mobile-nav-trigger-button menu__link menu__link--icon menu__link--mobile dw-mod"></label> 3754 </li> 3755 } 3756 3757 @helper RenderMobileHeaderLogo() { 3758 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderLogo").OrderBy(item => item.SortId).ToList(); 3759 3760 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"; 3761 string centeredLogo = mobileTopLayout != "nav-right" ? "u-ta-center" : ""; 3762 string firstPageId = Model.Area.FirstActivePage.ID.ToString(); 3763 string businessName = Model.Area.Item.GetItem("Settings").GetString("BusinessName"); 3764 3765 string mobileLogo = "/Files/Images/logo-dynamicweb.png"; 3766 if (Model.Area.Item.GetItem("Layout").GetItem("MobileTop") != null && Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo") != null) 3767 { 3768 mobileLogo = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo").PathUrlEncoded; 3769 } 3770 3771 if (Path.GetExtension(mobileLogo).ToLower() != ".svg") 3772 { 3773 mobileLogo = "/Admin/Public/GetImage.ashx?height=40&amp;width=100&amp;crop=5&amp;Compression=75&amp;image=" + mobileLogo; 3774 } 3775 else 3776 { 3777 mobileLogo = HttpUtility.UrlDecode(mobileLogo); 3778 } 3779 3780 <div class="grid__col-auto grid__col--bleed"> 3781 <div class="grid__cell @centeredLogo"> 3782 <a href="/Default.aspx?ID=@firstPageId" class="logo logo--mobile u-inline-block dw-mod"> 3783 <img class="grid__cell-img logo__img logo__img--mobile dw-mod" src="@mobileLogo" alt="@businessName" /> 3784 </a> 3785 </div> 3786 3787 @RenderBlockList(subBlocks) 3788 </div> 3789 } 3790 3791 @helper RenderMobileTopActions() { 3792 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderActions").OrderBy(item => item.SortId).ToList(); 3793 3794 <div class="grid__col-auto-width"> 3795 <ul class="menu dw-mod"> 3796 @RenderBlockList(subBlocks) 3797 </ul> 3798 </div> 3799 } 3800 3801 @helper RenderMobileTopSearch() { 3802 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 3803 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> 3804 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> 3805 </label> 3806 </li> 3807 } 3808 3809 @helper RenderMobileTopMiniCart() { 3810 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 3811 int cartPageId = GetPageIdByNavigationTag("CartPage"); 3812 double cartProductsCount = Model.Cart.TotalProductsCount; 3813 3814 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod" id="miniCartWrapper"> 3815 <div class="mini-cart dw-mod"> 3816 <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"> 3817 <div class="u-inline u-position-relative"> 3818 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue fa-1_5x"></i> 3819 <div class="mini-cart__counter dw-mod"> 3820 <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"> 3821 <div class="js-mini-cart-counter-content" data-count="@cartProductsCount"> 3822 @cartProductsCount 3823 </div> 3824 </div> 3825 </div> 3826 </div> 3827 </a> 3828 </div> 3829 </li> 3830 } 3831 3832 @helper RenderMobileTopSearchBar() 3833 { 3834 string searchFeedId = ""; 3835 string searchSecondFeedId = ""; 3836 int groupsFeedId; 3837 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 3838 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 3839 string resultPageLink; 3840 string searchPlaceholder; 3841 string searchType = "product-search"; 3842 string searchTemplate; 3843 string searchContentTemplate = ""; 3844 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; 3845 bool showGroups = true; 3846 3847 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch") 3848 { 3849 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 3850 resultPageLink = contentSearchPageLink; 3851 searchPlaceholder = Translate("Search page"); 3852 groupsFeedId = 0; 3853 searchType = "content-search"; 3854 searchTemplate = "SearchPagesTemplate"; 3855 showGroups = false; 3856 } 3857 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch") 3858 { 3859 searchFeedId = productsPageId + "&feed=true"; 3860 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 3861 resultPageLink = Converter.ToString(productsPageId); 3862 searchPlaceholder = Translate("Search products or pages"); 3863 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 3864 searchType = "combined-search"; 3865 searchTemplate = "SearchProductsTemplateWrap"; 3866 searchContentTemplate = "SearchPagesTemplateWrap"; 3867 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 3868 } 3869 else 3870 { 3871 resultPageLink = Converter.ToString(productsPageId); 3872 searchFeedId = productsPageId + "&feed=true"; 3873 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 3874 searchPlaceholder = Translate("Search products"); 3875 searchTemplate = "SearchProductsTemplate"; 3876 searchType = "product-search"; 3877 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 3878 } 3879 3880 <input type="checkbox" id="MobileSearchTrigger" class="mobile-search-trigger" /> 3881 3882 <div class="main-navigation-mobile typeahead-mobile dw-mod"> 3883 <div class="center-container top-container__center-container dw-mod"> 3884 <div class="grid"> 3885 <div class="grid__col-auto"> 3886 <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"> 3887 <input type="text" class="js-typeahead-search-field u-w160px u-no-margin" placeholder="@searchPlaceholder" value="@searchValue"> 3888 @if (string.IsNullOrEmpty(searchSecondFeedId)) 3889 { 3890 <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> 3891 } 3892 else 3893 { 3894 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--combined-mobile grid"> 3895 <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> 3896 <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> 3897 </div> 3898 } 3899 <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> 3900 </div> 3901 </div> 3902 <div class="grid__col-auto-width"> 3903 <ul class="menu dw-mod"> 3904 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 3905 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> 3906 <i class="fas fa-times fa-1_5x"></i> 3907 </label> 3908 </li> 3909 </ul> 3910 </div> 3911 </div> 3912 </div> 3913 </div> 3914 } 3915 3916 @helper RenderMobileMiniCartCounterContent() 3917 { 3918 <script id="MiniCartCounterContent" type="text/x-template"> 3919 {{#.}} 3920 <div class="js-mini-cart-counter-content dw-mod" data-count="{{numberofproducts}}"> 3921 {{numberofproducts}} 3922 </div> 3923 {{/.}} 3924 </script> 3925 } 3926 3927 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3928 3929 @using System 3930 @using System.Web 3931 @using System.Collections.Generic 3932 @using Dynamicweb.Rapido.Blocks.Extensibility 3933 @using Dynamicweb.Rapido.Blocks 3934 3935 @functions { 3936 BlocksPage mobileNavigationBlocksPage = BlocksPage.GetBlockPage("Master"); 3937 } 3938 3939 @{ 3940 bool mobileNavigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 3941 bool mobileHideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); 3942 bool mobileHideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); 3943 bool mobileHideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); 3944 bool mobileHideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); 3945 bool mobileHideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); 3946 3947 Block mobileNavigation = new Block() 3948 { 3949 Id = "MobileNavigation", 3950 SortId = 10, 3951 Template = MobileNavigation(), 3952 SkipRenderBlocksList = true 3953 }; 3954 mobileNavigationBlocksPage.Add(MasterBlockId.MasterTopSnippets, mobileNavigation); 3955 3956 if (Model.CurrentUser.ID > 0 && !mobileHideMyProfileLink) 3957 { 3958 Block mobileNavigationSignIn = new Block 3959 { 3960 Id = "MobileNavigationSignIn", 3961 SortId = 10, 3962 Template = RenderMobileNavigationSignIn() 3963 }; 3964 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationSignIn); 3965 } 3966 3967 Block mobileNavigationMenu = new Block 3968 { 3969 Id = "MobileNavigationMenu", 3970 SortId = 20, 3971 Template = RenderMobileNavigationMenu() 3972 }; 3973 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationMenu); 3974 3975 Block mobileNavigationActions = new Block 3976 { 3977 Id = "MobileNavigationActions", 3978 SortId = 30, 3979 Template = RenderMobileNavigationActions(), 3980 SkipRenderBlocksList = true 3981 }; 3982 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationActions); 3983 3984 if (!mobileNavigationItemsHideSignIn) 3985 { 3986 if (Model.CurrentUser.ID <= 0) 3987 { 3988 Block mobileNavigationSignInAction = new Block 3989 { 3990 Id = "MobileNavigationSignInAction", 3991 SortId = 10, 3992 Template = RenderMobileNavigationSignInAction() 3993 }; 3994 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignInAction); 3995 3996 if (!mobileHideCreateAccountLink) 3997 { 3998 Block mobileNavigationCreateAccountAction = new Block 3999 { 4000 Id = "MobileNavigationCreateAccountAction", 4001 SortId = 20, 4002 Template = RenderMobileNavigationCreateAccountAction() 4003 }; 4004 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationCreateAccountAction); 4005 } 4006 } 4007 else 4008 { 4009 if (!mobileHideMyOrdersLink) 4010 { 4011 Block mobileNavigationOrdersAction = new Block 4012 { 4013 Id = "MobileNavigationOrdersAction", 4014 SortId = 20, 4015 Template = RenderMobileNavigationOrdersAction() 4016 }; 4017 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationOrdersAction); 4018 } 4019 if (!mobileHideMyFavoritesLink) 4020 { 4021 Block mobileNavigationFavoritesAction = new Block 4022 { 4023 Id = "MobileNavigationFavoritesAction", 4024 SortId = 30, 4025 Template = RenderMobileNavigationFavoritesAction() 4026 }; 4027 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationFavoritesAction); 4028 } 4029 if (!mobileHideMySavedCardsLink) 4030 { 4031 Block mobileNavigationSavedCardsAction = new Block 4032 { 4033 Id = "MobileNavigationFavoritesAction", 4034 SortId = 30, 4035 Template = RenderMobileNavigationSavedCardsAction() 4036 }; 4037 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSavedCardsAction); 4038 } 4039 4040 Block mobileNavigationSignOutAction = new Block 4041 { 4042 Id = "MobileNavigationSignOutAction", 4043 SortId = 40, 4044 Template = RenderMobileNavigationSignOutAction() 4045 }; 4046 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignOutAction); 4047 } 4048 } 4049 4050 if (Model.Languages.Count > 1) 4051 { 4052 Block mobileNavigationLanguagesAction = new Block 4053 { 4054 Id = "MobileNavigationLanguagesAction", 4055 SortId = 50, 4056 Template = RenderMobileNavigationLanguagesAction() 4057 }; 4058 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationLanguagesAction); 4059 } 4060 } 4061 4062 4063 @helper MobileNavigation() 4064 { 4065 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigation").OrderBy(item => item.SortId).ToList(); 4066 string mobileTopDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design") != null ? Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design").SelectedValue : "nav-left"; 4067 string position = mobileTopDesign == "nav-left" || mobileTopDesign == "nav-search-left" ? "left" : "right"; 4068 4069 <!-- Trigger for mobile navigation --> 4070 <input type="checkbox" id="MobileNavTrigger" class="mobile-nav-trigger mobile-nav-trigger--@position" autocomplete="off" /> 4071 4072 <!-- Mobile navigation --> 4073 <nav class="mobile-navigation mobile-navigation--@position dw-mod"> 4074 <div class="mobile-navigation__wrapper" id="mobileNavigationWrapper"> 4075 @RenderBlockList(subBlocks) 4076 </div> 4077 </nav> 4078 4079 <label class="mobile-nav-trigger-off" for="MobileNavTrigger"></label> 4080 } 4081 4082 @helper RenderMobileNavigationSignIn() 4083 { 4084 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 4085 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 4086 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 4087 string myProfilePageLink = linkStart + myProfilePageId; 4088 string userName = Model.CurrentUser.FirstName ?? ""; 4089 userName += " " + (Model.CurrentUser.LastName ?? ""); 4090 userName += userName == "" && Model.CurrentUser.UserName != null ? Model.CurrentUser.UserName : ""; 4091 4092 <ul class="menu menu-mobile"> 4093 <li class="menu-mobile__item"> 4094 <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> 4095 </li> 4096 </ul> 4097 } 4098 4099 @helper RenderMobileNavigationMenu() 4100 { 4101 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides"; 4102 string menuTemplate = isSlidesDesign ? "BaseMenuForMobileSlides.xslt" : "BaseMenuForMobileExpandable.xslt"; 4103 string levels = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels") : "3"; 4104 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 4105 int startLevel = renderPagesInToolBar ? 1 : 0; 4106 4107 @RenderNavigation(new 4108 { 4109 id = "mobilenavigation", 4110 cssclass = "menu menu-mobile dwnavigation", 4111 startLevel = @startLevel, 4112 ecomStartLevel = @startLevel + 1, 4113 endlevel = @levels, 4114 expandmode = "all", 4115 template = @menuTemplate 4116 }) 4117 4118 if (isSlidesDesign) 4119 { 4120 <script> 4121 function goToLevel(level) { 4122 document.getElementById('mobileNavigationWrapper').style.left = -(level * 100) + "%"; 4123 } 4124 4125 document.addEventListener('DOMContentLoaded', function () { 4126 goToLevel(document.getElementById('mobileNavigationWrapper').querySelectorAll('input[type=radio]:checked').length); 4127 }); 4128 </script> 4129 } 4130 4131 if (renderPagesInToolBar) 4132 { 4133 @RenderNavigation(new 4134 { 4135 id = "topToolsMobileNavigation", 4136 cssclass = "menu menu-mobile dwnavigation", 4137 template = "ToolsMenuForMobile.xslt" 4138 }) 4139 } 4140 } 4141 4142 @helper RenderMobileNavigationActions() 4143 { 4144 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigationActions").OrderBy(item => item.SortId).ToList(); ; 4145 4146 <ul class="menu menu-mobile"> 4147 @RenderBlockList(subBlocks) 4148 </ul> 4149 } 4150 4151 @helper RenderMobileNavigationSignInAction() 4152 { 4153 <li class="menu-mobile__item"> 4154 <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> 4155 </li> 4156 } 4157 4158 @helper RenderMobileNavigationCreateAccountAction() 4159 { 4160 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 4161 4162 <li class="menu-mobile__item"> 4163 <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> 4164 </li> 4165 } 4166 4167 @helper RenderMobileNavigationProfileAction() 4168 { 4169 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 4170 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 4171 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 4172 string myProfilePageLink = linkStart + myProfilePageId; 4173 4174 <li class="menu-mobile__item"> 4175 <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> 4176 </li> 4177 } 4178 4179 @helper RenderMobileNavigationOrdersAction() 4180 { 4181 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 4182 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 4183 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); 4184 string myOrdersPageLink = linkStart + myOrdersPageId; 4185 string ordersIcon = "fas fa-list"; 4186 4187 <li class="menu-mobile__item"> 4188 <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> 4189 </li> 4190 } 4191 4192 @helper RenderMobileNavigationFavoritesAction() 4193 { 4194 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 4195 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 4196 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 4197 string myFavoritesPageLink = linkStart + myFavoritesPageId; 4198 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"; 4199 4200 4201 <li class="menu-mobile__item"> 4202 <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> 4203 </li> 4204 } 4205 4206 @helper RenderMobileNavigationSavedCardsAction() 4207 { 4208 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 4209 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 4210 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards"); 4211 string mySavedCardsPageLink = linkStart + mySavedCardsPageId; 4212 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"; 4213 4214 <li class="menu-mobile__item"> 4215 <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> 4216 </li> 4217 } 4218 4219 @helper RenderMobileNavigationSignOutAction() 4220 { 4221 int pageId = Model.TopPage.ID; 4222 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"; 4223 4224 <li class="menu-mobile__item"> 4225 <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> 4226 </li> 4227 } 4228 4229 @helper RenderMobileNavigationLanguagesAction() 4230 { 4231 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides"; 4232 4233 string selectedLanguage = ""; 4234 foreach (var lang in Model.Languages) 4235 { 4236 if (lang.IsCurrent) 4237 { 4238 selectedLanguage = lang.Name; 4239 } 4240 } 4241 4242 <li class="menu-mobile__item dw-mod"> 4243 @if (isSlidesDesign) 4244 { 4245 <input id="MobileMenuCheck_Language" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(1);"> 4246 } 4247 else 4248 { 4249 <input id="MobileMenuCheck_Language" type="checkbox" class="expand-trigger"> 4250 } 4251 <div class="menu-mobile__link__wrap"> 4252 <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> 4253 <label for="MobileMenuCheck_Language" class="menu-mobile__trigger"></label> 4254 </div> 4255 <ul class="menu-mobile menu-mobile__submenu expand-menu"> 4256 @if (isSlidesDesign) 4257 { 4258 <li class="menu-mobile__item dw-mod"> 4259 <div class="menu-mobile__link__wrap"> 4260 <input id="MobileMenuCheck_Language_back" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(0);" /> 4261 <label for="MobileMenuCheck_Language_back" class="menu-mobile__trigger menu-mobile__trigger--back"></label> 4262 <label for="MobileMenuCheck_Language_back" class="menu-mobile__link dw-mod ">@Translate("Back")</label> 4263 </div> 4264 </li> 4265 } 4266 @foreach (var lang in Model.Languages) 4267 { 4268 <li class="menu-mobile__item dw-mod"> 4269 <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> 4270 </li> 4271 } 4272 </ul> 4273 </li> 4274 } 4275 @if (Pageview.Device.ToString() != "Mobile") 4276 { 4277 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4278 4279 @using System 4280 @using System.Web 4281 @using System.Collections.Generic 4282 @using Dynamicweb.Rapido.Blocks.Extensibility 4283 @using Dynamicweb.Rapido.Blocks 4284 4285 @functions { 4286 BlocksPage headerBlocksPage = BlocksPage.GetBlockPage("Master"); 4287 } 4288 4289 @{ 4290 Block masterTools = new Block() 4291 { 4292 Id = "MasterDesktopTools", 4293 SortId = 10, 4294 Template = RenderDesktopTools(), 4295 SkipRenderBlocksList = true, 4296 BlocksList = new List<Block> 4297 { 4298 new Block { 4299 Id = "MasterDesktopToolsText", 4300 SortId = 10, 4301 Template = RenderDesktopToolsText(), 4302 Design = new Design 4303 { 4304 Size = "auto", 4305 HidePadding = true, 4306 RenderType = RenderType.Column 4307 } 4308 }, 4309 new Block { 4310 Id = "MasterDesktopToolsNavigation", 4311 SortId = 20, 4312 Template = RenderDesktopToolsNavigation(), 4313 Design = new Design 4314 { 4315 Size = "auto-width", 4316 HidePadding = true, 4317 RenderType = RenderType.Column 4318 } 4319 } 4320 } 4321 }; 4322 headerBlocksPage.Add("MasterHeader", masterTools); 4323 4324 Block masterDesktopExtra = new Block() 4325 { 4326 Id = "MasterDesktopExtra", 4327 SortId = 10, 4328 Template = RenderDesktopExtra(), 4329 SkipRenderBlocksList = true 4330 }; 4331 headerBlocksPage.Add("MasterHeader", masterDesktopExtra); 4332 4333 Block masterDesktopNavigation = new Block() 4334 { 4335 Id = "MasterDesktopNavigation", 4336 SortId = 20, 4337 Template = RenderDesktopNavigation(), 4338 SkipRenderBlocksList = true 4339 }; 4340 headerBlocksPage.Add("MasterHeader", masterDesktopNavigation); 4341 } 4342 4343 @* Include the Blocks for the page *@ 4344 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4345 4346 @using System 4347 @using System.Web 4348 @using Dynamicweb.Rapido.Blocks.Extensibility 4349 @using Dynamicweb.Rapido.Blocks 4350 4351 @{ 4352 Block masterDesktopLogo = new Block 4353 { 4354 Id = "MasterDesktopLogo", 4355 SortId = 10, 4356 Template = RenderDesktopLogo(), 4357 Design = new Design 4358 { 4359 Size = "auto-width", 4360 HidePadding = true, 4361 RenderType = RenderType.Column, 4362 CssClass = "grid--align-self-center" 4363 } 4364 }; 4365 4366 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopLogo); 4367 } 4368 4369 4370 @helper RenderDesktopLogo() 4371 { 4372 string firstPageId = Model.Area.FirstActivePage.ID.ToString(); 4373 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4374 string alignClass = topLayout == "two-lines-centered" || topLayout == "two-lines" ? "grid--align-self-center" : ""; 4375 string logo = Model.Area.Item.GetItem("Layout").GetFile("LogoImage") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoImage").PathUrlEncoded : "/Files/Images/logo-dynamicweb.png"; 4376 if (Path.GetExtension(logo).ToLower() != ".svg") 4377 { 4378 int logoHeight = Model.Area.Item.GetItem("Layout").GetInt32("LogoHeight"); 4379 logoHeight = logoHeight > 0 && Pageview.Device.ToString() != "Mobile" ? logoHeight : 40; 4380 logo = "/Admin/Public/GetImage.ashx?height=" + Converter.ToString(logoHeight) + "&amp;crop=5&amp;Compression=75&amp;image=" + logo; 4381 } 4382 else 4383 { 4384 logo = HttpUtility.UrlDecode(logo); 4385 } 4386 4387 <div class="logo @alignClass dw-mod"> 4388 <a href="/Default.aspx?ID=@firstPageId" class="logo__img dw-mod u-block"> 4389 <img class="grid__cell-img logo__img dw-mod" src="@logo" alt="@Translate("Logo")" /> 4390 </a> 4391 </div> 4392 } 4393 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4394 4395 @using System 4396 @using System.Web 4397 @using Dynamicweb.Rapido.Blocks.Extensibility 4398 @using Dynamicweb.Rapido.Blocks 4399 4400 @functions { 4401 bool isMegaMenu; 4402 } 4403 4404 @{ 4405 isMegaMenu = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu") != null ? Converter.ToBoolean(Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu").SelectedValue) : false; 4406 Block masterDesktopMenu = new Block 4407 { 4408 Id = "MasterDesktopMenu", 4409 SortId = 10, 4410 Template = RenderDesktopMenu(), 4411 Design = new Design 4412 { 4413 Size = "auto", 4414 HidePadding = true, 4415 RenderType = RenderType.Column 4416 } 4417 }; 4418 4419 if (isMegaMenu) 4420 { 4421 masterDesktopMenu.Design.CssClass = "u-reset-position"; 4422 } 4423 4424 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopMenu); 4425 } 4426 4427 @helper RenderDesktopMenu() 4428 { 4429 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4430 string menuAlignment = topLayout == "minimal-right" ? "grid--align-self-end" : ""; 4431 string megamenuPromotionImage = Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage").PathUrlEncoded : ""; 4432 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 4433 bool showOnlyHeaders = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowOnlyHeaders"); 4434 int startLevel = renderPagesInToolBar ? 1 : 0; 4435 4436 string promotionLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("MegamenuPromotionLink"); 4437 4438 <div class="grid__cell u-flex @(isMegaMenu ? "u-reset-position" : "") @menuAlignment"> 4439 @if (!isMegaMenu) 4440 { 4441 @RenderNavigation(new 4442 { 4443 id = "topnavigation", 4444 cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap", 4445 startLevel = startLevel, 4446 ecomStartLevel = startLevel + 1, 4447 endlevel = 5, 4448 expandmode = "all", 4449 template = "BaseMenuWithDropdown.xslt" 4450 }); 4451 } 4452 else 4453 { 4454 @RenderNavigation(new 4455 { 4456 id = "topnavigation", 4457 cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap", 4458 startLevel = startLevel, 4459 ecomStartLevel = startLevel + 1, 4460 endlevel = 5, 4461 promotionImage = megamenuPromotionImage, 4462 promotionLink = promotionLink, 4463 expandmode = "all", 4464 showOnlyHeaders = showOnlyHeaders.ToString().ToLower(), 4465 template = "BaseMegaMenu.xslt" 4466 }); 4467 } 4468 </div> 4469 } 4470 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4471 4472 @using System 4473 @using System.Web 4474 @using Dynamicweb.Rapido.Blocks.Extensibility 4475 @using Dynamicweb.Rapido.Blocks 4476 4477 @{ 4478 Block masterDesktopActionsMenu = new Block 4479 { 4480 Id = "MasterDesktopActionsMenu", 4481 SortId = 10, 4482 Template = RenderDesktopActionsMenu(), 4483 Design = new Design 4484 { 4485 CssClass = "u-flex" 4486 }, 4487 SkipRenderBlocksList = true 4488 4489 }; 4490 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopActionsMenu); 4491 4492 if (!string.IsNullOrWhiteSpace(Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink"))) 4493 { 4494 Block masterDesktopActionsHeaderButton = new Block 4495 { 4496 Id = "MasterDesktopActionsHeaderButton", 4497 SortId = 60, 4498 Template = RenderHeaderButton() 4499 }; 4500 masterDesktopActionsMenu.Add(masterDesktopActionsHeaderButton); 4501 } 4502 } 4503 4504 @helper RenderDesktopActionsMenu() 4505 { 4506 List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopActionsMenu").OrderBy(item => item.SortId).ToList(); 4507 4508 <ul class="menu u-flex dw-mod"> 4509 @RenderBlockList(subBlocks) 4510 </ul> 4511 } 4512 4513 @helper RenderHeaderButton() 4514 { 4515 string headerButtonText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonText"); 4516 string headerButtonLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink"); 4517 string headerButtonType = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType") != null ? "btn--" + Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType").SelectedName.ToLower() : ""; 4518 4519 <li class="menu__item menu__item--horizontal menu--clean dw-mod"> 4520 <a class="btn @headerButtonType dw-mod u-no-margin u-margin-top u-margin-left" href="@headerButtonLink">@headerButtonText</a> 4521 </li> 4522 } 4523 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4524 4525 @using System 4526 @using System.Web 4527 @using Dynamicweb.Core; 4528 @using System.Text.RegularExpressions 4529 @using Dynamicweb.Rapido.Blocks.Extensibility 4530 @using Dynamicweb.Rapido.Blocks 4531 4532 @{ 4533 Block masterDesktopActionsMenuLanguageSelector = new Block 4534 { 4535 Id = "MasterDesktopActionsMenuLanguageSelector", 4536 SortId = 40, 4537 Template = RenderLanguageSelector() 4538 }; 4539 4540 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuLanguageSelector); 4541 } 4542 4543 @helper RenderLanguageSelector() 4544 { 4545 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4546 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 4547 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4548 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() : ""; 4549 4550 if (Model.Languages.Count > 1) 4551 { 4552 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon is-dropdown is-dropdown--no-icon dw-mod"> 4553 <div class="@menuLinkClass dw-mod" title="@Translate("Language")"> 4554 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue fa-1_5x"></i> 4555 </div> 4556 <div class="menu menu--dropdown menu--dropdown-right languages-dropdown dw-mod grid__cell"> 4557 @foreach (var lang in Model.Languages) 4558 { 4559 string widthClass = "menu__item--fixed-width"; 4560 string langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " u-margin-right\"></span>" + lang.Name; 4561 string cultureName = Regex.Replace(Dynamicweb.Services.Areas.GetArea(lang.ID).CultureInfo.NativeName, @" ?\(.*?\)", string.Empty); 4562 cultureName = char.ToUpper(cultureName[0]) + cultureName.Substring(1); 4563 4564 if (languageViewType == "flag-culture") 4565 { 4566 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span> " + cultureName; 4567 } 4568 4569 if (languageViewType == "flag") 4570 { 4571 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span>"; 4572 widthClass = ""; 4573 } 4574 4575 if (languageViewType == "name") 4576 { 4577 langInfo = lang.Name; 4578 } 4579 4580 if (languageViewType == "culture") 4581 { 4582 langInfo = cultureName; 4583 widthClass = ""; 4584 } 4585 4586 <div class="menu__item dw-mod @widthClass"> 4587 <a href="/Default.aspx?AreaID=@Dynamicweb.Services.Pages.GetPage(lang.Page.ID).Area.ID" class="menu-dropdown__link dw-mod">@langInfo</a> 4588 </div> 4589 } 4590 </div> 4591 </li> 4592 } 4593 } 4594 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4595 4596 @using System 4597 @using System.Web 4598 @using Dynamicweb.Rapido.Blocks.Extensibility 4599 @using Dynamicweb.Rapido.Blocks 4600 @using Dynamicweb.Frontend.Navigation 4601 4602 @{ 4603 Block masterDesktopActionsMenuSignIn = new Block 4604 { 4605 Id = "MasterDesktopActionsMenuSignIn", 4606 SortId = 20, 4607 Template = RenderSignIn() 4608 }; 4609 4610 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuSignIn); 4611 } 4612 4613 @helper RenderSignIn() 4614 { 4615 bool navigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 4616 string userInitials = ""; 4617 int pageId = Model.TopPage.ID; 4618 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 4619 int myDashboardPageId = GetPageIdByNavigationTag("CustomerDashboard"); 4620 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 4621 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); 4622 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 4623 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards"); 4624 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 4625 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); 4626 bool hideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); 4627 bool hideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); 4628 bool hideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); 4629 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); 4630 bool hideForgotPasswordLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideForgotPasswordLink"); 4631 4632 string linkStart = "/Default.aspx?ID="; 4633 if (Model.CurrentUser.ID <= 0) 4634 { 4635 linkStart += signInProfilePageId + "&RedirectPageId="; 4636 } 4637 4638 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; 4639 string myProfilePageLink = linkStart + myProfilePageId; 4640 string myOrdersPageLink = linkStart + myOrdersPageId; 4641 string myFavoritesPageLink = linkStart + myFavoritesPageId; 4642 string mySavedCardsPageLink = linkStart + mySavedCardsPageId; 4643 4644 string profileIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue : "fa fa-user"; 4645 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"; 4646 string rootNavigationPageId = Pageview.AreaSettings.GetItem("Rizzo").GetString("RootNavigationPage"); 4647 4648 if (Model.CurrentUser.ID != 0) 4649 { 4650 userInitials = Dynamicweb.Rapido.Services.User.GetInitials(Model.CurrentUser.Name, Model.CurrentUser.FirstName, Model.CurrentUser.LastName, Model.CurrentUser.Email, Model.CurrentUser.UserName); 4651 } 4652 4653 if (!navigationItemsHideSignIn) 4654 { 4655 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4656 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu__item--clean"; 4657 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4658 4659 <li class="menu__item menu__item--horizontal menu__item menu__item--icon @liClasses is-dropdown is-dropdown--no-icon dw-mod"> 4660 <div class="@menuLinkClass dw-mod"> 4661 @if (Model.CurrentUser.ID <= 0) 4662 { 4663 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue fa-1_5x" title="@Translate("Sign in")"></i> 4664 } 4665 else 4666 { 4667 <a href="/default.aspx?ID=@myDashboardPageId" class="u-color-inherit" title="@Translate("Customer center")"><div class="circle-icon-btn">@userInitials.ToUpper()</div></a> 4668 } 4669 </div> 4670 <div class="menu menu--dropdown menu--dropdown-right menu--sign-in grid__cell dw-mod"> 4671 <ul class="list list--clean dw-mod"> 4672 @if (Model.CurrentUser.ID <= 0) 4673 { 4674 <li> 4675 <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> 4676 </li> 4677 4678 if (!hideCreateAccountLink) 4679 { 4680 @RenderListItem("/default.aspx?ID=" + createAccountPageId, Translate("Create account")); 4681 } 4682 if (!hideForgotPasswordLink) 4683 { 4684 @RenderListItem(forgotPasswordPageLink, Translate("Forgot your password?")) 4685 } 4686 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) 4687 { 4688 @RenderSeparator() 4689 } 4690 } 4691 @if (Pageview.AreaSettings.GetItem("Rizzo").GetBoolean("EnableCustomSignInDropdown") && !string.IsNullOrEmpty(rootNavigationPageId)) 4692 { 4693 @RenderDynamicSignInMenu(rootNavigationPageId) 4694 } 4695 else 4696 { 4697 if (!hideMyProfileLink) 4698 { 4699 @RenderListItem(myProfilePageLink, Translate("My Profile"), profileIcon) 4700 } 4701 if (!hideMyOrdersLink) 4702 { 4703 @RenderListItem(myOrdersPageLink, Translate("My Orders"), "fas fa-list") 4704 } 4705 if (!hideMyFavoritesLink) 4706 { 4707 @RenderListItem(myFavoritesPageLink, Translate("My Favorites"), favoritesIcon) 4708 } 4709 if (!hideMySavedCardsLink) 4710 { 4711 @RenderListItem(mySavedCardsPageLink, Translate("My Saved cards"), "fas fa-credit-card") 4712 } 4713 } 4714 4715 @if (Model.CurrentUser.ID > 0) 4716 { 4717 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) 4718 { 4719 @RenderSeparator() 4720 } 4721 4722 @RenderListItem("/Admin/Public/ExtranetLogoff.aspx?ID=" + pageId, Translate("Sign out")) 4723 } 4724 </ul> 4725 </div> 4726 </li> 4727 } 4728 } 4729 4730 @helper RenderListItem(string link, string text, string icon = null) { 4731 <li> 4732 <a href="@link" class="list__link dw-mod"> 4733 @if (!string.IsNullOrEmpty(icon)){<i class="@icon u-margin-right"></i>}@text 4734 </a> 4735 </li> 4736 } 4737 4738 @helper RenderSeparator() 4739 { 4740 <li class="list__seperator dw-mod"></li> 4741 } 4742 4743 @helper RenderDynamicSignInMenu(string rootNavigationPageId) { 4744 var navigationSettings = new NavigationSettings 4745 { 4746 StopLevel = 1, 4747 RootPageId = Dynamicweb.Core.Converter.ToInt32(rootNavigationPageId) 4748 }; 4749 @Navigation.RenderNavigation("Navigation/RizzoDynamicSignInNavigation.cshtml", navigationSettings) 4750 } 4751 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4752 4753 @using System 4754 @using System.Web 4755 @using Dynamicweb.Rapido.Blocks.Extensibility 4756 @using Dynamicweb.Rapido.Blocks 4757 4758 @{ 4759 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideFavorites"); 4760 4761 Block masterDesktopActionsMenuFavorites = new Block 4762 { 4763 Id = "MasterDesktopActionsMenuFavorites", 4764 SortId = 30, 4765 Template = RenderFavorites() 4766 }; 4767 4768 if (!hideMyFavoritesLink && Model.CurrentUser.ID > 0) 4769 { 4770 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuFavorites); 4771 } 4772 } 4773 4774 @helper RenderFavorites() 4775 { 4776 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 4777 string myFavoritesPageLink = "/Default.aspx?ID=" + myFavoritesPageId; 4778 4779 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4780 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 4781 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4782 4783 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod"> 4784 <a href="@myFavoritesPageLink" class="@menuLinkClass dw-mod" title="@Translate("Favorites")"> 4785 <i class="fas fa-@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue fa-1_5x"></i> 4786 </a> 4787 </li> 4788 } 4789 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4790 4791 @using System 4792 @using System.Web 4793 @using Dynamicweb.Rapido.Blocks.Extensibility 4794 @using Dynamicweb.Rapido.Blocks 4795 @using Dynamicweb.Rapido.Services 4796 4797 @{ 4798 bool hideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 4799 string miniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown"; 4800 4801 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed() && !hideCart) 4802 { 4803 Block masterDesktopActionsMenuMiniCart = new Block 4804 { 4805 Id = "MasterDesktopActionsMenuMiniCart", 4806 SortId = 50, 4807 Template = RenderMiniCart(miniCartLayout == "dropdown"), 4808 SkipRenderBlocksList = true, 4809 BlocksList = new List<Block>() 4810 }; 4811 4812 Block miniCartCounterScriptTemplate = new Block 4813 { 4814 Id = "MiniCartCounterScriptTemplate", 4815 Template = RenderMiniCartCounterContent() 4816 }; 4817 4818 //dropdown layout is default 4819 RazorEngine.Templating.TemplateWriter layoutTemplate; 4820 RazorEngine.Templating.TemplateWriter miniCartTriggerTemplate; 4821 4822 switch (miniCartLayout) 4823 { 4824 case "dropdown": 4825 layoutTemplate = RenderMiniCartDropdownLayout(); 4826 miniCartTriggerTemplate = RenderMiniCartTriggerLink(); 4827 break; 4828 case "panel": 4829 layoutTemplate = RenderMiniCartPanelLayout(); 4830 miniCartTriggerTemplate = RenderMiniCartTriggerLabel(); 4831 break; 4832 case "modal": 4833 layoutTemplate = RenderMiniCartModalLayout(); 4834 miniCartTriggerTemplate = RenderMiniCartTriggerLabel(); 4835 break; 4836 case "none": 4837 default: 4838 layoutTemplate = RenderNoLayoutMiniCart(); 4839 miniCartTriggerTemplate = RenderMiniCartTriggerLink(); 4840 break; 4841 } 4842 4843 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block 4844 { 4845 Id = "MiniCartTrigger", 4846 Template = miniCartTriggerTemplate 4847 }); 4848 4849 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 4850 { 4851 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block 4852 { 4853 Id = "MiniCartLayout", 4854 Template = layoutTemplate 4855 }); 4856 } 4857 4858 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuMiniCart); 4859 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate); 4860 } 4861 4862 if (hideCart && Dynamicweb.Rapido.Services.User.IsBuyingAllowed()) 4863 { 4864 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", new Block { 4865 Id = "CartInitialization", 4866 Template = RenderNoLayoutMiniCart() 4867 }); 4868 } 4869 } 4870 4871 @helper RenderMiniCart(bool hasMouseEnterEvent) 4872 { 4873 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterDesktopActionsMenuMiniCart").OrderBy(item => item.SortId).ToList(); 4874 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4875 string liClasses = topLayout != "normal" ? "menu__item--top-level" : "menu--clean"; 4876 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4877 string mouseEvent = ""; 4878 string id = "MiniCart"; 4879 if (hasMouseEnterEvent) 4880 { 4881 mouseEvent = "onmouseenter=\"Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=" + miniCartFeedPageId + "&feedType=MiniCart')\""; 4882 id = "miniCartTrigger"; 4883 } 4884 <li class="menu__item menu__item--horizontal menu__item--icon @liClasses dw-mod" id="@id" @mouseEvent> 4885 @RenderBlockList(subBlocks) 4886 </li> 4887 } 4888 4889 @helper RenderNoLayoutMiniCart() 4890 { 4891 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4892 <script> 4893 window.cartId = "@miniCartFeedPageId"; 4894 </script> 4895 } 4896 4897 @helper RenderMiniCartTriggerLabel() 4898 { 4899 int cartPageId = GetPageIdByNavigationTag("CartPage"); 4900 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart"; 4901 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4902 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4903 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4904 4905 <div class="@menuLinkClass dw-mod js-mini-cart-button" onclick="Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart')"> 4906 <div class="u-inline u-position-relative" title="@Translate("Cart")"> 4907 <i class="@cartIcon fa-1_5x"></i> 4908 @RenderMiniCartCounter() 4909 </div> 4910 </div> 4911 } 4912 4913 @helper RenderMiniCartTriggerLink() 4914 { 4915 int cartPageId = GetPageIdByNavigationTag("CartPage"); 4916 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart"; 4917 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4918 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4919 4920 <a href="/Default.aspx?ID=@cartPageId&Purge=True" class="@menuLinkClass menu__item--icon dw-mod js-mini-cart-button"> 4921 <div class="u-inline u-position-relative" title="@Translate("Cart")"> 4922 <i class="@cartIcon fa-1_5x"></i> 4923 @RenderMiniCartCounter() 4924 </div> 4925 </a> 4926 } 4927 4928 @helper RenderMiniCartCounter() 4929 { 4930 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4931 string cartProductsCount = Model.Cart.TotalProductsCount.ToString(); 4932 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right"; 4933 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 4934 string cartProductsTotalPrice = showPrice && Model.Cart.TotalPrice != null ? Model.Cart.TotalPrice.Price.Formatted : ""; 4935 cartProductsTotalPrice = counterPosition == "right" ? cartProductsTotalPrice : ""; 4936 4937 if (showPrice && counterPosition == "right") 4938 { 4939 cartProductsCount = Translate("Cart") + "(" + cartProductsCount + ")"; 4940 } 4941 4942 <div class="mini-cart__counter @(counterPosition == "right" ? "mini-cart__counter--inline" : "") dw-mod"> 4943 <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"> 4944 <div class="js-mini-cart-counter-content" data-count="@Model.Cart.TotalProductsCount.ToString()"> 4945 @cartProductsCount 4946 @cartProductsTotalPrice 4947 </div> 4948 </div> 4949 </div> 4950 } 4951 4952 @helper RenderMiniCartCounterContent() 4953 { 4954 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 4955 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right"; 4956 bool showPriceInMiniCartCounter = Pageview.Device.ToString() != "Mobile" && counterPosition == "right" && showPrice; 4957 4958 <script id="MiniCartCounterContent" type="text/x-template"> 4959 {{#.}} 4960 <div class="js-mini-cart-counter-content dw-mod" data-count="{{numberofproducts}}"> 4961 @if (showPriceInMiniCartCounter) 4962 { 4963 @Translate("Cart")<text>({{numberofproducts}}) {{totalprice}}</text> 4964 } 4965 else 4966 { 4967 <text>{{numberofproducts}}</text> 4968 } 4969 </div> 4970 {{/.}} 4971 </script> 4972 } 4973 4974 @helper RenderMiniCartDropdownLayout() 4975 { 4976 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4977 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage"); 4978 4979 <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"> 4980 <div class="mini-cart-dropdown__inner dw-mod"> 4981 <h3 class="u-ta-center dw-mod">@Translate("Shopping cart")</h3> 4982 <div class="mini-cart-dropdown__body u-flex dw-mod"> 4983 <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> 4984 </div> 4985 </div> 4986 </div> 4987 } 4988 4989 @helper RenderMiniCartPanelLayout() 4990 { 4991 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4992 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage"); 4993 4994 <div class="mini-cart grid__cell dw-mod"> 4995 <input type="checkbox" id="miniCartTrigger" class="panel-trigger" /> 4996 <div class="panel panel--right panel--with-close-btn dw-mod js-mini-cart" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="block" data-cart-page-link="@cartPageLink"> 4997 <label for="miniCartTrigger" class="panel__close-btn" title="@Translate("Close panel")"><i class="fas fa-times"></i></label> 4998 <div class="panel__content u-full-width dw-mod"> 4999 <h3 class="panel__header dw-mod u-margin-bottom u-ta-center">@Translate("Shopping cart")</h3> 5000 <div class="panel__content-body panel__content-body--cart dw-mod"> 5001 <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> 5002 </div> 5003 </div> 5004 </div> 5005 </div> 5006 } 5007 5008 @helper RenderMiniCartModalLayout() 5009 { 5010 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 5011 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage"); 5012 5013 <div class="mini-cart grid__cell dw-mod"> 5014 <input type="checkbox" id="miniCartTrigger" class="modal-trigger" autocomplete="off" /> 5015 <div class="modal-container dw-mod js-mini-cart" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="block" data-cart-page-link="@cartPageLink"> 5016 <label for="miniCartTrigger" class="modal-overlay"></label> 5017 <div class="modal modal--md modal--top-right dw-mod"> 5018 <div class="modal__body u-flex grid--direction-column dw-mod"> 5019 <h3 class="dw-mod u-ta-center">@Translate("Shopping cart")</h3> 5020 <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> 5021 </div> 5022 <label class="modal__close-btn modal__close-btn--clean dw-mod" for="miniCartTrigger" title="@Translate("Close modal")"></label> 5023 </div> 5024 </div> 5025 </div> 5026 } 5027 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5028 5029 @using System 5030 @using System.Web 5031 @using Dynamicweb.Rapido.Blocks.Extensibility 5032 @using Dynamicweb.Rapido.Blocks 5033 5034 @{ 5035 bool showDownloadCartLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart"); 5036 5037 Block masterDesktopActionsMenuDownloadCart = new Block 5038 { 5039 Id = "MasterDesktopActionsMenuDownloadCart", 5040 SortId = 35, 5041 Template = RenderDownloadCart() 5042 }; 5043 5044 if (showDownloadCartLink && Model.CurrentUser.ID > 0) 5045 { 5046 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuDownloadCart); 5047 } 5048 } 5049 5050 @helper RenderDownloadCart() 5051 { 5052 int downloadCartPageId = GetPageIdByNavigationTag("DownloadCart"); 5053 string downloadCartPageLink = "/Default.aspx?ID=" + downloadCartPageId; 5054 5055 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5056 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 5057 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 5058 5059 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod"> 5060 <a href="@downloadCartPageLink" class="@menuLinkClass dw-mod" title="@Translate("Download cart")"> 5061 <i class="fas fa-cart-arrow-down fa-1_5x"></i> 5062 </a> 5063 </li> 5064 } 5065 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5066 5067 @using System 5068 @using System.Web 5069 @using Dynamicweb.Rapido.Blocks.Extensibility 5070 @using Dynamicweb.Rapido.Blocks 5071 5072 @functions { 5073 public class SearchConfiguration 5074 { 5075 public string searchFeedId { get; set; } 5076 public string searchSecondFeedId { get; set; } 5077 public int groupsFeedId { get; set; } 5078 public string resultPageLink { get; set; } 5079 public string searchPlaceholder { get; set; } 5080 public string searchType { get; set; } 5081 public string searchTemplate { get; set; } 5082 public string searchContentTemplate { get; set; } 5083 public string searchValue { get; set; } 5084 public bool showGroups { get; set; } 5085 5086 public SearchConfiguration() 5087 { 5088 searchFeedId = ""; 5089 searchSecondFeedId = ""; 5090 searchType = "product-search"; 5091 searchContentTemplate = ""; 5092 showGroups = true; 5093 } 5094 } 5095 } 5096 @{ 5097 Block masterSearchBar = new Block 5098 { 5099 Id = "MasterSearchBar", 5100 SortId = 40, 5101 Template = RenderSearch("bar"), 5102 Design = new Design 5103 { 5104 Size = "auto", 5105 HidePadding = true, 5106 RenderType = RenderType.Column 5107 } 5108 }; 5109 5110 Block masterSearchAction = new Block 5111 { 5112 Id = "MasterDesktopActionsMenuSearch", 5113 SortId = 10, 5114 Template = RenderSearch() 5115 }; 5116 5117 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterSearchBar); 5118 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterSearchAction); 5119 } 5120 5121 @helper RenderSearch(string type = "mini-search") 5122 { 5123 string productsPageId = Converter.ToString(GetPageIdByNavigationTag("ProductsPage")); 5124 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 5125 string searchType = Model.Area.Item.GetItem("Layout").GetList("TopSearch") != null ? Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue : "productSearch"; 5126 5127 SearchConfiguration searchConfiguration = null; 5128 5129 switch (searchType) { 5130 case "contentSearch": 5131 searchConfiguration = new SearchConfiguration() { 5132 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true", 5133 resultPageLink = contentSearchPageLink, 5134 searchPlaceholder = Translate("Search page"), 5135 groupsFeedId = 0, 5136 searchType = "content-search", 5137 searchTemplate = "SearchPagesTemplate", 5138 showGroups = false 5139 }; 5140 break; 5141 case "combinedSearch": 5142 searchConfiguration = new SearchConfiguration() { 5143 searchFeedId = productsPageId + "&feed=true", 5144 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true", 5145 resultPageLink = Converter.ToString(productsPageId), 5146 searchPlaceholder = Translate("Search products or pages"), 5147 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"), 5148 searchType = "combined-search", 5149 searchTemplate = "SearchProductsTemplateWrap", 5150 searchContentTemplate = "SearchPagesTemplateWrap", 5151 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector") 5152 }; 5153 break; 5154 default: //productSearch 5155 searchConfiguration = new SearchConfiguration() { 5156 resultPageLink = Converter.ToString(productsPageId), 5157 searchFeedId = productsPageId + "&feed=true", 5158 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"), 5159 searchPlaceholder = Translate("Search products"), 5160 searchTemplate = "SearchProductsTemplate", 5161 searchType = "product-search", 5162 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector") 5163 }; 5164 break; 5165 } 5166 searchConfiguration.searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; 5167 5168 if (type == "mini-search") { 5169 @RenderMiniSearch(searchConfiguration) 5170 } else { 5171 @RenderSearchBar(searchConfiguration) 5172 } 5173 } 5174 5175 @helper RenderSearchBar(SearchConfiguration options) 5176 { 5177 bool isLiveProductInfoActive = Dynamicweb.Core.Converter.ToBoolean(Pageview.GlobalTags.GetTagByName("Global:LiveIntegration.IsLazyLoadingForProductInfoEnabled")?.Value ?? string.Empty); 5178 5179 <div class="typeahead typeahead--centered u-color-inherit js-typeahead dw-mod" id="ProductSearchBar" 5180 data-page-size="7" 5181 data-search-feed-id="@options.searchFeedId" 5182 data-search-second-feed-id="@options.searchSecondFeedId" 5183 data-result-page-id="@options.resultPageLink" 5184 data-groups-page-id="@options.groupsFeedId" 5185 data-search-type="@options.searchType" 5186 data-live-price="@(isLiveProductInfoActive.ToString().ToLowerInvariant())"> 5187 @if (options.showGroups) 5188 { 5189 <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> 5190 <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> 5191 } 5192 <div class="typeahead-search-field"> 5193 <input type="text" class="u-no-margin u-full-width u-full-height js-typeahead-search-field" placeholder="@options.searchPlaceholder" value="@options.searchValue"> 5194 @if (string.IsNullOrEmpty(options.searchSecondFeedId)) 5195 { 5196 <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> 5197 } 5198 else 5199 { 5200 <div class="dropdown dropdown--absolute-position dropdown--combined grid"> 5201 <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> 5202 <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> 5203 </div> 5204 } 5205 </div> 5206 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod js-typeahead-enter-btn" title="@Translate("Search")"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue"></i></button> 5207 </div> 5208 } 5209 5210 @helper RenderMiniSearch(SearchConfiguration options) 5211 { 5212 bool isLiveProductInfoActive = Dynamicweb.Core.Converter.ToBoolean(Pageview.GlobalTags.GetTagByName("Global:LiveIntegration.IsLazyLoadingForProductInfoEnabled")?.Value ?? string.Empty); 5213 5214 <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" id="miniSearch"> 5215 <div class="menu__link menu__link--icon dw-mod" title="@Translate("Search")"> 5216 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> 5217 </div> 5218 <div class="menu menu--dropdown menu--dropdown-right u-no-padding u-w380px grid__cell dw-mod"> 5219 <div class="typeahead js-typeahead" id="ProductSearchBar" 5220 data-page-size="7" 5221 data-search-feed-id="@options.searchFeedId" 5222 data-search-second-feed-id="@options.searchSecondFeedId" 5223 data-result-page-id="@options.resultPageLink" 5224 data-search-type="@options.searchType" 5225 data-live-price="@(isLiveProductInfoActive.ToString().ToLowerInvariant())"> 5226 <div class="typeahead-search-field"> 5227 <input type="text" class="u-no-margin u-full-width js-typeahead-search-field" id="headerSearch" placeholder="@options.searchPlaceholder" value="@options.searchValue"> 5228 @if (string.IsNullOrEmpty(options.searchSecondFeedId)) 5229 { 5230 <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> 5231 } 5232 else 5233 { 5234 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--right-aligned"> 5235 <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> 5236 <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> 5237 </div> 5238 } 5239 </div> 5240 </div> 5241 </div> 5242 </li> 5243 } 5244 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5245 5246 @using System 5247 @using System.Web 5248 @using Dynamicweb.Rapido.Blocks.Extensibility 5249 @using Dynamicweb.Rapido.Blocks 5250 5251 @{ 5252 string headerConfigurationTopLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5253 bool headerConfigurationHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 5254 5255 BlocksPage headerConfigurationPage = BlocksPage.GetBlockPage("Master"); 5256 5257 Block configDesktopLogo = headerConfigurationPage.GetBlockById("MasterDesktopLogo"); 5258 headerConfigurationPage.RemoveBlock(configDesktopLogo); 5259 5260 Block configDesktopMenu = headerConfigurationPage.GetBlockById("MasterDesktopMenu"); 5261 headerConfigurationPage.RemoveBlock(configDesktopMenu); 5262 5263 Block configSearchBar = headerConfigurationPage.GetBlockById("MasterSearchBar"); 5264 headerConfigurationPage.RemoveBlock(configSearchBar); 5265 5266 Block configSearchAction = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenuSearch"); 5267 headerConfigurationPage.RemoveBlock(configSearchAction); 5268 5269 Block configDesktopActionsMenu = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenu"); 5270 headerConfigurationPage.RemoveBlock(configDesktopActionsMenu); 5271 5272 Block configDesktopExtra = headerConfigurationPage.GetBlockById("MasterDesktopExtra"); 5273 5274 switch (headerConfigurationTopLayout) 5275 { 5276 case "condensed": //2 5277 configDesktopLogo.Design.Size = "auto-width"; 5278 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); 5279 5280 configDesktopMenu.SortId = 20; 5281 configDesktopMenu.Design.Size = "auto"; 5282 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5283 5284 configDesktopActionsMenu.SortId = 30; 5285 configDesktopActionsMenu.Design.Size = "auto-width"; 5286 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 5287 5288 if (!headerConfigurationHideSearch) 5289 { 5290 configSearchBar.SortId = 40; 5291 configSearchBar.Design.Size = "12"; 5292 configDesktopExtra.SortId = 50; 5293 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); 5294 } 5295 break; 5296 case "splitted": //3 5297 configDesktopLogo.Design.Size = "auto"; 5298 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 5299 5300 if (!headerConfigurationHideSearch) 5301 { 5302 configSearchBar.SortId = 20; 5303 configSearchBar.Design.Size = "auto"; 5304 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); 5305 } 5306 5307 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5308 5309 configDesktopActionsMenu.SortId = 20; 5310 configDesktopActionsMenu.Design.Size = "auto-width"; 5311 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 5312 break; 5313 case "minimal": //4 5314 configDesktopLogo.Design.Size = "auto-width"; 5315 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); 5316 5317 configDesktopMenu.Design.Size = "auto"; 5318 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5319 5320 configDesktopActionsMenu.SortId = 20; 5321 configDesktopActionsMenu.Design.Size = "auto-width"; 5322 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 5323 5324 if (!headerConfigurationHideSearch) 5325 { 5326 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 5327 } 5328 break; 5329 case "minimal-right": //5 5330 configDesktopLogo.Design.Size = "auto-width"; 5331 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); 5332 5333 configDesktopMenu.Design.Size = "auto"; 5334 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5335 5336 configDesktopActionsMenu.SortId = 20; 5337 configDesktopActionsMenu.Design.Size = "auto-width"; 5338 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 5339 5340 if (!headerConfigurationHideSearch) 5341 { 5342 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 5343 } 5344 break; 5345 case "two-lines": //6 5346 configDesktopLogo.Design.Size = "auto"; 5347 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 5348 5349 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5350 5351 configDesktopActionsMenu.SortId = 20; 5352 configDesktopActionsMenu.Design.Size = "auto-width"; 5353 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 5354 5355 if (!headerConfigurationHideSearch) 5356 { 5357 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 5358 } 5359 break; 5360 case "two-lines-centered": //7 5361 configDesktopLogo.Design.Size = "auto"; 5362 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 5363 5364 configDesktopMenu.Design.Size = "auto-width"; 5365 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5366 5367 configDesktopActionsMenu.SortId = 20; 5368 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 5369 5370 if (!headerConfigurationHideSearch) 5371 { 5372 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 5373 } 5374 break; 5375 case "normal": //1 5376 default: 5377 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 5378 5379 if (!headerConfigurationHideSearch) 5380 { 5381 configSearchBar.SortId = 20; 5382 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); 5383 } 5384 5385 configDesktopActionsMenu.SortId = 30; 5386 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopActionsMenu); 5387 5388 configDesktopActionsMenu.Design.Size = "auto-width"; 5389 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5390 break; 5391 } 5392 } 5393 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5394 @using System 5395 @using System.Web 5396 @using Dynamicweb.Rapido.Blocks.Extensibility 5397 @using Dynamicweb.Rapido.Blocks 5398 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5399 @using Dynamicweb.Rapido.Blocks 5400 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5401 @using Dynamicweb.Rapido.Blocks 5402 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5403 @using System.Web 5404 @using Dynamicweb.Rapido.Blocks 5405 @using Dynamicweb.Rapido.Blocks.Components.General 5406 @{ 5407 BlocksPage.GetBlockPage("Master").GetBlockById("MasterDesktopActionsMenuSignIn").Template = RenderCustomSignIn(); 5408 } 5409 5410 @helper RenderCustomSignIn() 5411 { 5412 bool navigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 5413 string userInitials = ""; 5414 /*START CUSTOM CODE*/ 5415 int pageId = Pageview.Page.ID; 5416 /*END CUSTOM CODE*/ 5417 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 5418 int myDashboardPageId = GetPageIdByNavigationTag("CustomerDashboard"); 5419 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 5420 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); 5421 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 5422 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards"); 5423 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 5424 /*START CUSTOM CODE*/ 5425 var addressesPageId = GetPageIdByNavigationTag("CustomerAddresses"); 5426 var myDownloadsPageId = GetPageIdByNavigationTag("MyDownloadsList"); 5427 var emailPreferencesPageId = GetPageIdByNavigationTag("ManageSubscriptions"); 5428 var mySubscriptionsPageId = GetPageIdByNavigationTag("MySubscriptions"); 5429 /*END CUSTOM CODE*/ 5430 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); 5431 bool hideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); 5432 bool hideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); 5433 bool hideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); 5434 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); 5435 bool hideForgotPasswordLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideForgotPasswordLink"); 5436 5437 string linkStart = "/Default.aspx?ID="; 5438 if (Model.CurrentUser.ID <= 0) 5439 { 5440 linkStart += signInProfilePageId + "&RedirectPageId="; 5441 } 5442 5443 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; 5444 string myProfilePageLink = linkStart + myProfilePageId; 5445 string myOrdersPageLink = linkStart + myOrdersPageId; 5446 string myFavoritesPageLink = linkStart + myFavoritesPageId; 5447 string mySavedCardsPageLink = linkStart + mySavedCardsPageId; 5448 /*START CUSTOM CODE*/ 5449 var addressesPageLink = linkStart + addressesPageId; 5450 var myDownloadsPageLink = linkStart + myDownloadsPageId; 5451 var emailPreferencesPageLink = linkStart + emailPreferencesPageId; 5452 var mySubscriptionsPageLink = linkStart + mySubscriptionsPageId; 5453 /*END CUSTOM CODE*/ 5454 5455 string profileIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue : "fa fa-user"; 5456 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"; 5457 string rootNavigationPageId = Pageview.AreaSettings.GetItem("Rizzo").GetString("RootNavigationPage"); 5458 5459 if (Model.CurrentUser.ID != 0) 5460 { 5461 userInitials = Dynamicweb.Rapido.Services.User.GetInitials(Model.CurrentUser.Name, Model.CurrentUser.FirstName, Model.CurrentUser.LastName, Model.CurrentUser.Email, Model.CurrentUser.UserName); 5462 } 5463 5464 if (!navigationItemsHideSignIn) 5465 { 5466 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5467 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu__item--clean"; 5468 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 5469 5470 <li class="menu__item menu__item--horizontal menu__item menu__item--icon @liClasses is-dropdown is-dropdown--no-icon dw-mod"> 5471 <div class="@menuLinkClass dw-mod"> 5472 @if (Model.CurrentUser.ID <= 0) 5473 { 5474 @*START CUSTOM CODE*@ 5475 @Render(new Icon { 5476 Prefix = "fas", 5477 Name = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue, 5478 CssClass = "fa-1_5x", 5479 Label = Translate("Account"), 5480 LabelPosition = IconLabelPosition.After 5481 }) 5482 @*END CUSTOM CODE*@ 5483 } 5484 else 5485 { 5486 @*START CUSTOM CODE*@ 5487 <a href="/default.aspx?ID=@myDashboardPageId" class="u-color-inherit" title="@Translate("Account")"> 5488 <div class="circle-icon-btn">@userInitials.ToUpper()</div> 5489 </a> 5490 @Translate("Account") 5491 @*END CUSTOM CODE*@ 5492 } 5493 </div> 5494 5495 <div class="menu menu--dropdown menu--dropdown-right menu--sign-in grid__cell dw-mod"> 5496 <ul class="list list--clean dw-mod"> 5497 @if (Model.CurrentUser.ID <= 0) 5498 { 5499 <li> 5500 <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> 5501 </li> 5502 5503 if (!hideCreateAccountLink) 5504 { 5505 @RenderListItem("/default.aspx?ID=" + createAccountPageId, Translate("Create account")); 5506 } 5507 if (!hideForgotPasswordLink) 5508 { 5509 @RenderListItem(forgotPasswordPageLink, Translate("Forgot your password?")) 5510 } 5511 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) 5512 { 5513 @RenderSeparator() 5514 } 5515 } 5516 @if (Pageview.AreaSettings.GetItem("Rizzo").GetBoolean("EnableCustomSignInDropdown") && !string.IsNullOrEmpty(rootNavigationPageId)) 5517 { 5518 @RenderDynamicSignInMenu(rootNavigationPageId) 5519 } 5520 else 5521 { 5522 if (Model.CurrentUser.ID > 0) 5523 { 5524 if (!hideMyProfileLink) 5525 { 5526 @RenderListItem(myProfilePageLink, Translate("My Profile"), profileIcon) 5527 } 5528 /*START CUSTOM CODE*/ 5529 @RenderListItem(addressesPageLink, Translate("Addresses"), "fal fa-address-book") 5530 /*END CUSTOM CODE*/ 5531 if (!hideMyOrdersLink) 5532 { 5533 @RenderListItem(myOrdersPageLink, Translate("My Orders"), "fas fa-list") 5534 } 5535 if (!hideMyFavoritesLink) 5536 { 5537 @RenderListItem(myFavoritesPageLink, Translate("My Favorites"), favoritesIcon) 5538 } 5539 /*START CUSTOM CODE*/ 5540 @RenderListItem(myDownloadsPageLink, Translate("My Downloads"), "fas fa-download") 5541 /*END CUSTOM CODE*/ 5542 if (!hideMySavedCardsLink) 5543 { 5544 @RenderListItem(mySavedCardsPageLink, Translate("My Saved cards"), "fas fa-credit-card") 5545 } 5546 /*START CUSTOM CODE*/ 5547 @RenderListItem(emailPreferencesPageLink, Translate("Email Preferences"), "fas fa-envelope") 5548 @RenderListItem(mySubscriptionsPageLink, Translate("My Subscriptions"), "fas fa-calendar") 5549 /*END CUSTOM CODE*/ 5550 } 5551 } 5552 5553 @if (Model.CurrentUser.ID > 0) 5554 { 5555 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) 5556 { 5557 @RenderSeparator() 5558 } 5559 5560 @RenderListItem("/Admin/Public/ExtranetLogoff.aspx?ID=" + pageId, Translate("Sign out")) 5561 } 5562 </ul> 5563 </div> 5564 </li> 5565 } 5566 } 5567 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5568 @using Dynamicweb.Rapido.Blocks 5569 @using Dynamicweb.Rapido.Blocks.Components.General 5570 @{ 5571 var favoritesBlock = BlocksPage.GetBlockPage("Master").GetBlockById("MasterDesktopActionsMenuFavorites"); 5572 if (favoritesBlock != null) 5573 { 5574 favoritesBlock.Template = RenderCustomFavorites(); 5575 } 5576 } 5577 5578 @helper RenderCustomFavorites() 5579 { 5580 var myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 5581 var myFavoritesPageLink = "/Default.aspx?ID=" + myFavoritesPageId; 5582 5583 var topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5584 var liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 5585 var menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 5586 5587 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod"> 5588 @*START CUSTOM CODE*@ 5589 @Render(new Link 5590 { 5591 ButtonLayout = ButtonLayout.Clean, Href = myFavoritesPageLink, CssClass = menuLinkClass, Title = Translate("Wish List"), 5592 Icon = new Icon 5593 { 5594 Prefix = "fas", 5595 Name = "fa-"+Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue, 5596 CssClass = "fa-1_5x", 5597 LabelPosition = IconLabelPosition.After 5598 } 5599 }) 5600 @*END CUSTOM CODE*@ 5601 </li> 5602 } 5603 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5604 @using Dynamicweb.Rapido.Blocks 5605 @using Dynamicweb.Rapido.Blocks.Components.General 5606 @{ 5607 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed() && !hideCart) 5608 { 5609 //dropdown layout is default 5610 RazorEngine.Templating.TemplateWriter layoutTemplate; 5611 RazorEngine.Templating.TemplateWriter miniCartTriggerTemplate; 5612 5613 switch (miniCartLayout) 5614 { 5615 case "dropdown": 5616 layoutTemplate = RenderMiniCartDropdownLayout(); 5617 miniCartTriggerTemplate = RenderCustomMiniCartTriggerLink(); 5618 break; 5619 case "panel": 5620 layoutTemplate = RenderMiniCartPanelLayout(); 5621 miniCartTriggerTemplate = RenderCustomMiniCartTriggerLabel(); 5622 break; 5623 case "modal": 5624 layoutTemplate = RenderMiniCartModalLayout(); 5625 miniCartTriggerTemplate = RenderCustomMiniCartTriggerLabel(); 5626 break; 5627 case "none": 5628 default: 5629 layoutTemplate = RenderNoLayoutMiniCart(); 5630 miniCartTriggerTemplate = RenderCustomMiniCartTriggerLink(); 5631 break; 5632 } 5633 5634 BlocksPage.GetBlockPage("Master").GetBlockById("MiniCartTrigger").Template = miniCartTriggerTemplate; 5635 } 5636 } 5637 5638 @helper RenderCustomMiniCartTriggerLabel() 5639 { 5640 var cartPageId = GetPageIdByNavigationTag("CartPage"); 5641 var cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart"; 5642 var topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5643 var menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 5644 var miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 5645 5646 <div class="@menuLinkClass dw-mod js-mini-cart-button" onclick="Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart')"> 5647 <div class="u-inline u-position-relative" title="@Translate("Cart")"> 5648 @*START CUSTOM CODE*@ 5649 @Render(new Icon {Prefix = "fas", Name = cartIcon, CssClass = "fa-1_5x"}) 5650 @RenderCustomMiniCartCounter() 5651 @Translate("Cart") 5652 @*END CUSTOM CODE*@ 5653 </div> 5654 </div> 5655 } 5656 5657 @helper RenderCustomMiniCartTriggerLink() 5658 { 5659 var cartPageId = GetPageIdByNavigationTag("CartPage"); 5660 var cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart"; 5661 var topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5662 var menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 5663 5664 <a href="/Default.aspx?ID=@cartPageId&Purge=True" class="@menuLinkClass menu__item--icon dw-mod js-mini-cart-button"> 5665 <div class="u-inline u-position-relative" title="@Translate("Cart")"> 5666 @*START CUSTOM CODE*@ 5667 @Render(new Icon {Prefix = "fas", Name = cartIcon, CssClass = "fa-1_5x"}) 5668 @RenderCustomMiniCartCounter() 5669 @Translate("Cart") 5670 @*END CUSTOM CODE*@ 5671 </div> 5672 </a> 5673 } 5674 5675 @helper RenderCustomMiniCartCounter() 5676 { 5677 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 5678 /*START CUSTOM CODE*/ 5679 var subscriptionCartContext = PageView.Current().AreaSettings.GetItem("Custom").GetItem("CustomSettings").GetList("EventsCartContext").SelectedValue; 5680 foreach (var context in Dynamicweb.Ecommerce.Orders.OrderContext.GetOrderContexts().Where(x=>x.Id != subscriptionCartContext)) 5681 { 5682 Dynamicweb.Ecommerce.Common.Context.CartContext = context; 5683 } 5684 string cartProductsCount = Dynamicweb.Ecommerce.Common.Context.Cart?.get_ParentProductLineQuantityCount(Dynamicweb.Ecommerce.Common.Context.Cart?.ProductOrderLines).ToString(); 5685 /*END CUSTOM CODE*/ 5686 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right"; 5687 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 5688 string cartProductsTotalPrice = showPrice && Model.Cart.TotalPrice != null ? Model.Cart.TotalPrice.Price.Formatted : ""; 5689 cartProductsTotalPrice = counterPosition == "right" ? cartProductsTotalPrice : ""; 5690 5691 if (showPrice && counterPosition == "right") 5692 { 5693 cartProductsCount = Translate("Cart") + "(" + cartProductsCount + ")"; 5694 } 5695 5696 <div class="mini-cart__counter @(counterPosition == "right" ? "mini-cart__counter--inline" : "") dw-mod"> 5697 <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"> 5698 <div class="js-mini-cart-counter-content" data-count="@Model.Cart.TotalProductsCount.ToString()"> 5699 @cartProductsCount 5700 @cartProductsTotalPrice 5701 </div> 5702 </div> 5703 </div> 5704 } 5705 5706 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5707 @using System.Linq 5708 @using Dynamicweb.Core 5709 @using Dynamicweb.Frontend.Navigation 5710 @using Dynamicweb.Rapido.Blocks 5711 @using Dynamicweb.Rapido.Blocks.Components.General 5712 5713 @functions{ 5714 5715 bool _showOnlyHeaders; 5716 string _promotionImage; 5717 string _promotionLink; 5718 string[] _lorenzOnlineGroupIds; 5719 5720 private static bool ShowSubPages(NavigationTreeNodeViewModel node) 5721 { 5722 var pages= Dynamicweb.Services.Pages.GetPagesByParentID(node.PageId).ToList(); 5723 return node.Nodes.Any() && (pages.Any(p => p.ItemType != "Composer") || !pages.Any()); 5724 } 5725 5726 private Dynamicweb.Ecommerce.Products.Group GetGroupByName(string groupName) 5727 { 5728 var groups = Dynamicweb.Ecommerce.Services.ProductGroups.GetGroups().ToList(); 5729 return groups.FirstOrDefault(g => g.Name.Equals(groupName)); 5730 } 5731 5732 private bool IsShowInMenu(string groupName) 5733 { 5734 var group = GetGroupByName(groupName); 5735 return group != null && group.NavigationShowInMenu; 5736 } 5737 5738 private bool IsMegaMenu(NavigationTreeNodeViewModel node) 5739 { 5740 var page = Dynamicweb.Services.Pages.GetPage(node.PageId); 5741 var pageCustomSettings = page.PropertyItem?["CustomSettings"] != null ? Dynamicweb.Services.Items.GetItem("PagePropertiesCustom", Converter.ToString(page.PropertyItem["CustomSettings"])) : null; 5742 5743 return pageCustomSettings?["SubpagesAsMegaMenu"] != null && Convert.ToBoolean(pageCustomSettings["SubpagesAsMegaMenu"]); 5744 } 5745 5746 private LinkTargetType GetLinkTarget(string link) 5747 { 5748 return link.StartsWith("http") || link.StartsWith("www") ? LinkTargetType.Blank : LinkTargetType.None; 5749 } 5750 5751 private string GetMenuItemCssClass(NavigationTreeNodeViewModel node, bool isStartLevel) 5752 { 5753 string menuItemCssClass = "menu__item dw-mod"; 5754 5755 if (isStartLevel) 5756 { 5757 menuItemCssClass += " menu__item--horizontal menu__item--top-level dw-navbar-button"; 5758 5759 if (node.Nodes.Any()) 5760 { 5761 menuItemCssClass += IsMegaMenu(node) ? " is-mega" : " is-dropdown"; 5762 } 5763 } 5764 else if (!IsMegaMenu(node)) 5765 { 5766 menuItemCssClass += ShowSubPages(node) ? " is-dropleft" : ""; 5767 menuItemCssClass += " menu__item--fixed-width u-margin-left"; 5768 } 5769 5770 menuItemCssClass += IsMegaMenu(node) ? " menu__item--mega" : ""; 5771 menuItemCssClass += !node.IsClickable ? " menu__item--disabled" : ""; 5772 menuItemCssClass += node.IsActive || node.InPath ? " menu__item--active" : ""; 5773 5774 return menuItemCssClass; 5775 } 5776 5777 private string GetMenuLinkCssClass(NavigationTreeNodeViewModel node, bool isStartLevel) 5778 { 5779 string menuLinkCssClass = ""; 5780 if (isStartLevel) 5781 { 5782 menuLinkCssClass += "menu__link"; 5783 menuLinkCssClass += node.IsActive || node.InPath ? " menu__link--active" : ""; 5784 } 5785 else 5786 { 5787 if (IsMegaMenu(node)) 5788 { 5789 menuLinkCssClass += "mega-menu__link"; 5790 menuLinkCssClass += node.IsActive || node.InPath ? " mega-menu__link--active" : ""; 5791 } 5792 else 5793 { 5794 menuLinkCssClass += "menu-dropdown__link"; 5795 menuLinkCssClass += node.IsActive || node.InPath ? " menu-dropdown__link--active" : ""; 5796 } 5797 } 5798 5799 menuLinkCssClass += !node.IsClickable ? " menu__link--disabled" : ""; 5800 5801 return menuLinkCssClass + " dw-mod"; 5802 } 5803 5804 private string GetMegaMenuGridCssClass() 5805 { 5806 string megaMenuGridCssClasses = "grid__col-sm-4 grid__col-xs-12 mega-menu__col dw-mod"; 5807 megaMenuGridCssClasses = string.IsNullOrEmpty(_promotionImage) ? "grid__col-xlg-auto grid__col-lg-2 grid__col-md-3 " + megaMenuGridCssClasses : "grid__col-lg-auto grid__col-md-4 " + megaMenuGridCssClasses; 5808 megaMenuGridCssClasses = _showOnlyHeaders ? megaMenuGridCssClasses + " grid__col--bleed" : megaMenuGridCssClasses + " grid__col--bleed-x"; 5809 5810 return megaMenuGridCssClasses; 5811 } 5812 5813 private string GetMegaMenuHeaderCssClass(NavigationTreeNodeViewModel node) 5814 { 5815 string megaMenuHeaderCssClass = "mega-menu__header-container__text dw-mod"; 5816 megaMenuHeaderCssClass += node.IsClickable ? " mega-menu__header-container__text--link" : ""; 5817 megaMenuHeaderCssClass += node.IsActive || node.InPath ? " mega-menu__header-container__text--active" : ""; 5818 return megaMenuHeaderCssClass; 5819 } 5820 } 5821 5822 @{ 5823 _showOnlyHeaders = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowOnlyHeaders"); 5824 _promotionImage = Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage").PathUrlEncoded : ""; 5825 _promotionLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("MegamenuPromotionLink"); 5826 5827 var navigationSettings = new NavigationSettings() 5828 { 5829 StartLevel = 1, 5830 StopLevel = 5, 5831 ExpandMode = ExpandMode.All, 5832 Parameters = {{"id", "topnavigation"} } 5833 }; 5834 5835 var masterDesktopMenuCustom = BlocksPage.GetBlockPage("Master").GetBlockById("MasterDesktopMenu"); 5836 if (masterDesktopMenuCustom != null) 5837 { 5838 masterDesktopMenuCustom.Template = RenderNavigationMenu(navigationSettings); 5839 } 5840 5841 _lorenzOnlineGroupIds = Pageview.AreaSettings.GetItem("Custom").GetItem("CustomSettings") 5842 .GetRawValueString("DoNotShowOnlineTitlesMessageOnGroups") 5843 .Split(new []{','}, StringSplitOptions.RemoveEmptyEntries) 5844 .Select(g => g.Trim()) 5845 .ToArray(); 5846 } 5847 5848 @helper RenderNavigationMenu(NavigationSettings navigationSettings) 5849 { 5850 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5851 string menuAlignment = topLayout == "minimal-right" ? "grid--align-self-end" : ""; 5852 5853 <div class="grid__cell u-flex u-reset-position @menuAlignment"> 5854 @RenderNavigationNodes(navigationSettings) 5855 </div> 5856 } 5857 5858 @helper RenderNavigationNodes(NavigationSettings navigationSettings = null) 5859 { 5860 var nodes = GetNavigation(navigationSettings).Nodes; 5861 string id = ""; 5862 int startLevel = 1; 5863 5864 if (navigationSettings != null) 5865 { 5866 id = navigationSettings.Parameters["id"].ToString(); 5867 startLevel = navigationSettings.StartLevel; 5868 } 5869 5870 <ul class="menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap" @(!string.IsNullOrEmpty(id) ? "id=" + id : string.Empty)> 5871 @foreach (NavigationTreeNodeViewModel node in nodes) 5872 { 5873 var isStartLevel = node.Level == startLevel; 5874 5875 <li class="@GetMenuItemCssClass(node, isStartLevel)"> 5876 @RenderMenuLink(node, GetMenuLinkCssClass(node, isStartLevel)) 5877 5878 @if (node.Nodes.Any()) 5879 { 5880 if (IsMegaMenu(node)) 5881 { 5882 <div class="menu mega-menu dw-mod"> 5883 <div class="grid grid--align-content-start mega-menu__grid dw-mod"> 5884 @RenderMegaMenu(node.Nodes) 5885 </div> 5886 </div> 5887 } 5888 else 5889 { 5890 <ul class="menu dw-mod menu--dropdown"> 5891 @RenderList(node.Nodes) 5892 </ul> 5893 } 5894 } 5895 </li> 5896 } 5897 </ul> 5898 } 5899 5900 @helper RenderMegaMenu(IEnumerable<NavigationTreeNodeViewModel> nodes) 5901 { 5902 if (!string.IsNullOrEmpty(_promotionImage)) 5903 { 5904 <div class="grid__col-9 grid__col--bleed"> 5905 <div class="grid grid--align-content-start"> 5906 @foreach (NavigationTreeNodeViewModel node in nodes) 5907 { 5908 @RenderMegaMenuGrid(node) 5909 } 5910 </div> 5911 </div> 5912 <div class="grid__col-3 mega-menu__promotion-image"> 5913 @Render(new Image 5914 { 5915 Link = _promotionLink, 5916 Path = _promotionImage, 5917 DisableLazyLoad = true 5918 }) 5919 </div> 5920 } 5921 else 5922 { 5923 foreach (NavigationTreeNodeViewModel node in nodes) 5924 { 5925 @RenderMegaMenuGrid(node) 5926 } 5927 } 5928 } 5929 5930 @helper RenderMegaMenuGrid(NavigationTreeNodeViewModel node) 5931 { 5932 if (IsShowInMenu(node.Name)) { 5933 var smallImage = GetGroupByName(node.Name).SmallImage; 5934 5935 <div class="@GetMegaMenuGridCssClass()"> 5936 <div class="mega-menu__list-wrap dw-mod"> 5937 <div class="mega-menu__header-container dw-mod"> 5938 @if (!string.IsNullOrEmpty(smallImage)) 5939 { 5940 @Render(new Image() 5941 { 5942 DisableLazyLoad = true, 5943 Path = smallImage, 5944 Link = node.Link 5945 }) 5946 } 5947 @RenderMenuLink(node, GetMegaMenuHeaderCssClass(node)) 5948 </div> 5949 @if (!_showOnlyHeaders) 5950 { 5951 <ul class="menu dw-mod"> 5952 @RenderList(node.Nodes) 5953 </ul> 5954 } 5955 </div> 5956 </div> 5957 } 5958 } 5959 5960 @helper RenderList(IEnumerable<NavigationTreeNodeViewModel> nodes) 5961 { 5962 foreach (NavigationTreeNodeViewModel node in nodes) 5963 { 5964 var smallImage = GetGroupByName(node.Name)?.SmallImage; 5965 5966 <li class="@GetMenuItemCssClass(node, false)"> 5967 @if (IsMegaMenu(node) && !string.IsNullOrEmpty(smallImage)) 5968 { 5969 @Render(new Image() 5970 { 5971 DisableLazyLoad = true, 5972 Path = smallImage, 5973 Link = node.Link 5974 }) 5975 } 5976 else 5977 { 5978 @RenderMenuLink(node, GetMenuLinkCssClass(node, false)) 5979 } 5980 5981 @if (!IsMegaMenu(node) && ShowSubPages(node)) 5982 { 5983 <ul class="menu menu--dropleft dw-mod"> 5984 @RenderList(node.Nodes) 5985 </ul> 5986 } 5987 </li> 5988 } 5989 } 5990 5991 @helper RenderMenuLink(NavigationTreeNodeViewModel node, string cssClass) 5992 { 5993 if (_lorenzOnlineGroupIds.Contains(node.GroupId)) 5994 { 5995 var separator = node.Link.Contains("?") ? "&" : "?"; 5996 node.Link = node.Link + separator + "LOGroupIds=none"; 5997 } 5998 5999 if (node.IsClickable) 6000 { 6001 @Render(new Link() 6002 { 6003 Href = node.Link, 6004 CssClass = cssClass, 6005 Target = GetLinkTarget(node.Link), 6006 Title = node.Name, 6007 ButtonLayout = ButtonLayout.None 6008 }) 6009 } 6010 else 6011 { 6012 <span class="@cssClass">@node.Name</span> 6013 } 6014 } 6015 @using System 6016 @using Dynamicweb.Rapido.Blocks 6017 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 6018 6019 @{ 6020 6021 var loyaltyService = new Dynamicweb.Ecommerce.Loyalty.LoyaltyService(); 6022 var userPoints = Pageview.User != null ? loyaltyService.GetPointsBalance(Pageview.User) : 0; 6023 userPoints = Math.Abs(userPoints); 6024 userPoints = Math.Round(userPoints, 0); 6025 var loyaltyPointsEnabled = Pageview.User != null && Dynamicweb.Security.Licensing.LicenseManager.LicenseHasFeature("LoyaltyPoints"); 6026 6027 if (userPoints > 0 && loyaltyPointsEnabled) 6028 { 6029 var userTransactions = loyaltyService.GetUserTransactions(Pageview.User.ID); 6030 var expirationDate = userTransactions.OrderBy(t => t.ExpirationDate).First().ExpirationDate; 6031 6032 Block loyaltyPoints = new Block 6033 { 6034 Id = "LoyaltyPoints", 6035 SortId = 30, 6036 Template = RenderLoyaltyPoints(userPoints, expirationDate), 6037 Design = new Design 6038 { 6039 Size = "auto-width", 6040 HidePadding = true, 6041 RenderType = RenderType.Column, 6042 CssClass = "grid--align-self-center u-margin-left--lg" 6043 } 6044 }; 6045 BlocksPage.GetBlockPage("Master").Add("MasterDesktopNavigation", loyaltyPoints); 6046 } 6047 } 6048 @helper RenderLoyaltyPoints(double? userPoints, DateTime expirationDate) 6049 { 6050 var cart = Dynamicweb.Ecommerce.Common.Context.Cart; 6051 var pointsUsedInCart = cart?.TotalPoints ?? 0; 6052 userPoints -= pointsUsedInCart; 6053 <div class="u-color-light"> 6054 <p class="u-margin u-margin">@Translate("Points"): @userPoints</p> 6055 </div> 6056 } 6057 6058 6059 @helper RenderDesktopTools() 6060 { 6061 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopTools").OrderBy(item => item.SortId).ToList(); 6062 6063 <div class="tools-navigation dw-mod"> 6064 <div class="center-container grid top-container__center-container dw-mod"> 6065 @RenderBlockList(subBlocks) 6066 </div> 6067 </div> 6068 } 6069 6070 @helper RenderDesktopToolsText() 6071 { 6072 string toolsText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("ToolsText"); 6073 if (!string.IsNullOrEmpty(toolsText)) 6074 { 6075 <div class="u-margin-top u-margin-bottom">@toolsText</div> 6076 } 6077 } 6078 6079 @helper RenderDesktopToolsNavigation() 6080 { 6081 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 6082 6083 if (renderPagesInToolBar) 6084 { 6085 @RenderNavigation(new 6086 { 6087 id = "topToolsNavigation", 6088 cssclass = "menu menu-tools dw-mod dwnavigation", 6089 template = "TopMenu.xslt" 6090 }) 6091 } 6092 } 6093 6094 @helper RenderDesktopNavigation() 6095 { 6096 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopNavigation").OrderBy(item => item.SortId).ToList(); 6097 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 6098 string alignClass = topLayout == "two-lines-centered" ? "grid--justify-center" : ""; 6099 <nav class="main-navigation dw-mod"> 6100 <div class="center-container top-container__center-container grid @alignClass dw-mod"> 6101 @RenderBlockList(subBlocks) 6102 </div> 6103 </nav> 6104 } 6105 6106 @helper RenderDesktopExtra() 6107 { 6108 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopExtra").OrderBy(item => item.SortId).ToList(); 6109 6110 if (subBlocks.Count > 0) 6111 { 6112 <div class="header header-top dw-mod"> 6113 <div class="center-container top-container__center-container grid--justify-space-between grid grid--align-center dw-mod"> 6114 @RenderBlockList(subBlocks) 6115 </div> 6116 </div> 6117 } 6118 }</text> 6119 } 6120 6121 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 6122 6123 @using System 6124 @using System.Web 6125 @using Dynamicweb.Rapido.Blocks.Extensibility 6126 @using Dynamicweb.Rapido.Blocks 6127 @using Dynamicweb.Rapido.Blocks.Components.General 6128 @using Dynamicweb.Frontend 6129 6130 @functions { 6131 int impersonationPageId; 6132 string impersonationLayout; 6133 int impersonationFeed; 6134 Block impersonationBar; 6135 6136 string getUserNameFromParams(string firstName, string middleName, string lastName, string name, string email, string userName) 6137 { 6138 string username = ""; 6139 6140 if (!string.IsNullOrEmpty(firstName) && !string.IsNullOrEmpty(lastName)) 6141 { 6142 username = firstName + " " + (!string.IsNullOrEmpty(middleName) ? middleName + " " : "") + lastName; 6143 } 6144 else if (!string.IsNullOrEmpty(name)) 6145 { 6146 username = name; 6147 } 6148 else if (!string.IsNullOrEmpty(email)) 6149 { 6150 username = email; 6151 } 6152 else 6153 { 6154 username = userName; 6155 } 6156 return username; 6157 } 6158 6159 string getUserName(UserViewModel user) 6160 { 6161 return getUserNameFromParams(user.FirstName, user.MiddleName, user.LastName, user.Name, user.Email, user.UserName); 6162 } 6163 6164 string getUserName(Dynamicweb.Security.UserManagement.User user) 6165 { 6166 return getUserNameFromParams(user.FirstName, user.MiddleName, user.LastName, user.Name, user.Email, user.UserName); 6167 } 6168 } 6169 6170 @{ 6171 impersonationPageId = GetPageIdByNavigationTag("Impersonation"); 6172 impersonationLayout = Model.Area.Item.GetItem("Ecommerce").GetList("ImpersonationLayout") != null ? Model.Area.Item.GetItem("Ecommerce").GetList("ImpersonationLayout").SelectedValue : "bar"; 6173 impersonationFeed = GetPageIdByNavigationTag("UsersFeed"); 6174 6175 if (Model.CurrentUser.ID > 0 && Model.SecondaryUsers.Count > 0) 6176 { 6177 impersonationBar = new Block 6178 { 6179 Id = "ImpersonationBar", 6180 SortId = 50, 6181 Template = RenderImpersonation(), 6182 SkipRenderBlocksList = true, 6183 Design = new Design 6184 { 6185 Size = "auto-width", 6186 HidePadding = true, 6187 RenderType = RenderType.Column 6188 } 6189 }; 6190 6191 Block impersonationContent = new Block 6192 { 6193 Id = "ImpersonationContent", 6194 SortId = 10 6195 }; 6196 6197 if (Model.CurrentSecondaryUser != null && Model.CurrentSecondaryUser.ID > 0) 6198 { 6199 //Render stop impersonation view 6200 impersonationContent.Template = RenderStopImpersonationView(); 6201 } 6202 else 6203 { 6204 //Render main view 6205 switch (impersonationLayout) 6206 { 6207 case "right-lower-box": 6208 impersonationContent.BlocksList.Add( 6209 new Block { 6210 Id = "RightLowerBoxHeader", 6211 SortId = 10, 6212 Component = new Heading { 6213 Level = 5, 6214 Title = Translate("View the list of users you can impersonate"), 6215 CssClass = "impersonation-text" 6216 } 6217 } 6218 ); 6219 impersonationContent.BlocksList.Add( 6220 new Block { 6221 Id = "RightLowerBoxContent", 6222 SortId = 20, 6223 Template = RenderImpersonationControls() 6224 } 6225 ); 6226 break; 6227 case "right-lower-bar": 6228 impersonationContent.BlocksList.Add( 6229 new Block { 6230 Id = "RightLowerBarContent", 6231 SortId = 10, 6232 Template = RenderImpersonationControls() 6233 } 6234 ); 6235 break; 6236 case "bar": 6237 default: 6238 impersonationContent.BlocksList.Add( 6239 new Block { 6240 Id = "ViewListLink", 6241 SortId = 20, 6242 Template = RenderViewListLink() 6243 } 6244 ); 6245 impersonationContent.BlocksList.Add( 6246 new Block { 6247 Id = "BarTypeaheadSearch", 6248 SortId = 30, 6249 Template = RenderTypeaheadSearch() 6250 } 6251 ); 6252 break; 6253 } 6254 } 6255 impersonationBar.BlocksList.Add(impersonationContent); 6256 6257 impersonationBar.BlocksList.Add( 6258 new Block 6259 { 6260 Id = "ImpersonationSearchTemplates", 6261 SortId = 20, 6262 Template = RenderSearchResultTemplate() 6263 } 6264 ); 6265 if (impersonationLayout != "bar") 6266 { 6267 impersonationBar.BlocksList.Add( 6268 new Block 6269 { 6270 Id = "ImpersonationSearchScripts", 6271 SortId = 30, 6272 Template = RenderSearchScripts() 6273 } 6274 ); 6275 } 6276 BlocksPage.GetBlockPage("Master").Add("MasterHeader", impersonationBar); 6277 } 6278 } 6279 6280 @helper RenderImpersonation() 6281 { 6282 List<Block> subBlocks = impersonationBar.BlocksList.OrderBy(item => item.SortId).ToList(); 6283 <input type="checkbox" class="impersonation-trigger js-remember-state" id="ImpersonationMinimizeTrigger" /> 6284 <div class="impersonation impersonation--@(impersonationLayout)-layout dw-mod" id="Impersonation"> 6285 @if (impersonationLayout == "right-lower-box") 6286 { 6287 @RenderRightLowerBoxHeader() 6288 } 6289 <div class="center-container top-container__center-container u-padding--lg impersonation__container @(impersonationLayout != "bar" ? "impersonation__container--box" : "") dw-mod"> 6290 @*Impersonation*@ 6291 @RenderBlockList(subBlocks) 6292 </div> 6293 </div> 6294 } 6295 6296 @helper RenderRightLowerBoxHeader() 6297 { 6298 <div class="impersonation__header dw-mod"> 6299 <div class="impersonation__title">@Translate("Impersonation")</div> 6300 <label for="ImpersonationMinimizeTrigger" class="btn btn--impersonation impersonation__minimize-btn dw-mod" onclick="this.blur();"> 6301 @Render(new Icon 6302 { 6303 Prefix = "fas", 6304 Name = "fa-window-minimize" 6305 }) 6306 </label> 6307 </div> 6308 } 6309 6310 @helper RenderStopImpersonationView() 6311 { 6312 string secondaryUserName = getUserName(Model.CurrentSecondaryUser); 6313 string userName = getUserName(Pageview.User); 6314 string impersonationText = "<b>" + userName + "</b> " + Translate("is impersonating") + " <b>" + secondaryUserName + "</b>"; 6315 impersonationText = Dynamicweb.Security.UserManagement.User.ImpersonationMode == Dynamicweb.Security.UserManagement.UserImpersonation.Full ? "<b>" + secondaryUserName + "</b> " + Translate("is impersonating") + " <b>" + userName + "</b>" : impersonationText; 6316 6317 if (impersonationLayout == "right-lower-box") 6318 { 6319 <div class="u-margin-bottom--lg u-ta-center"> 6320 @impersonationText 6321 </div> 6322 @RenderStopImpersonationForm() 6323 } 6324 else 6325 { 6326 <div class="grid grid--align-center grid--justify-space-between impersonation__stop-wrap"> 6327 <div class="u-margin-right--lg impersonation__stop-text"> 6328 <i class="fas fa-user-secret"></i> 6329 @impersonationText 6330 </div> 6331 @RenderStopImpersonationForm() 6332 </div> 6333 } 6334 } 6335 6336 @helper RenderStopImpersonationForm() 6337 { 6338 <form method="post" class="u-no-margin"> 6339 @Render(new Button 6340 { 6341 ButtonType = ButtonType.Submit, 6342 ButtonLayout = ButtonLayout.None, 6343 Title = Translate("Stop impersonation"), 6344 Href = "/Default.aspx?ID=" + impersonationPageId, 6345 CssClass = "impersonation__button btn btn--impersonation", 6346 Name = "DwExtranetRemoveSecondaryUser" 6347 }) 6348 </form> 6349 } 6350 6351 @helper RenderImpersonationControls() 6352 { 6353 <div class="impersonation__controls"> 6354 @RenderViewListLink() 6355 @RenderSearchBox() 6356 </div> 6357 @RenderResultsList() 6358 } 6359 6360 @helper RenderViewListLink() 6361 { 6362 string title = impersonationLayout == "right-lower-box" ? Translate("View the list") : Translate("View the list of users you can impersonate"); 6363 string buttonClasses = impersonationLayout == "right-lower-box" ? "impersonation__button btn btn--impersonation" : "impersonation__link impersonation__link"; 6364 6365 @Render(new Link { 6366 ButtonLayout = ButtonLayout.None, 6367 Title = title, 6368 Href = "/Default.aspx?ID=" + impersonationPageId, 6369 CssClass = buttonClasses 6370 }) 6371 } 6372 6373 @helper RenderSearchBox() 6374 { 6375 <div class="impersonation__search-wrap"> 6376 <input placeholder="@Translate("Search users")" type="text" class="impersonation__search-field dw-mod" onkeyup="searchKeyUpHandler(event)" id="ImpersonationBoxSearchField"> 6377 <div id="ImpersonationBoxSearchFind" class="impersonation__search-icon dw-mod" onclick="updateResults(document.getElementById('ImpersonationBoxSearchField').value)"> 6378 <i class="fal fa-search"></i> 6379 </div> 6380 <div id="ImpersonationBoxSearchClear" class="impersonation__search-icon u-hidden dw-mod" onclick="clearResults();"> 6381 <i class="fal fa-times"></i> 6382 </div> 6383 </div> 6384 } 6385 6386 @helper RenderTypeaheadSearch() 6387 { 6388 <div class="typeahead u-ta-right impersonation__typeahead js-typeahead dw-mod" id="ImpersonationSearchBar" 6389 data-page-size="5" 6390 data-search-feed-id="@impersonationFeed" 6391 data-result-page-id="@impersonationPageId" 6392 data-search-type="user-search" 6393 data-search-parameter-name="userSearch"> 6394 6395 <div class="typeahead-search-field"> 6396 <input type="text" class="u-no-margin js-typeahead-search-field" placeholder="@Translate("Search users")"> 6397 <ul class="dropdown dropdown--absolute-position u-min-w220px u-full-width js-handlebars-root js-typeahead-search-content dw-mod" id="ImpersonationSearchBarContent" data-template="ImpersonationSearchResult" data-json-feed="/Default.aspx?ID=@impersonationFeed" data-init-onload="false"></ul> 6398 </div> 6399 </div> 6400 } 6401 6402 @helper RenderResultsList() 6403 { 6404 <ul id="ImpersonationBoxSearchResults" class="impersonation__search-results js-handlebars-root dw-mod" data-template="ImpersonationSearchResult" data-json-feed="/Default.aspx?ID=@impersonationFeed" data-init-onload="false" data-preloader="minimal"></ul> 6405 } 6406 6407 @helper RenderSearchResultTemplate() 6408 { 6409 <script id="ImpersonationSearchResult" type="text/x-template"> 6410 {{#.}} 6411 {{#Users}} 6412 <li class="impersonation__search-results-item impersonation-user"> 6413 <form method="post" class="impersonation-user__form" name="account{{id}}"> 6414 <input type="hidden" id="DWExtranetSecondaryUserSelector" name="DWExtranetSecondaryUserSelector" value="{{id}}"> 6415 <div class="impersonation-user__info"> 6416 <div class="impersonation-user__name">{{userName}}</div> 6417 <div class="impersonation-user__number">{{customerNumber}}</div> 6418 </div> 6419 @Render(new Button 6420 { 6421 ButtonType = ButtonType.Submit, 6422 ButtonLayout = ButtonLayout.Secondary, 6423 Title = Translate("Sign in as"), 6424 CssClass = "impersonation-user__sign-in-btn" + (impersonationLayout != "bar" ? " btn--impersonation" : "") 6425 }) 6426 </form> 6427 </li> 6428 {{/Users}} 6429 {{#unless Users}} 6430 <li class="impersonation__search-results-item impersonation__search-results-item--not-found"> 6431 @Translate("Your search gave 0 results") 6432 </li> 6433 {{/unless}} 6434 {{/.}} 6435 </script> 6436 } 6437 6438 @helper RenderSearchScripts() 6439 { 6440 <script> 6441 let inputDelayTimer; 6442 function searchKeyUpHandler(e) { 6443 clearTimeout(inputDelayTimer); 6444 let value = e.target.value; 6445 if (value != "") { 6446 inputDelayTimer = setTimeout(function () { 6447 updateResults(value); 6448 }, 500); 6449 } else { 6450 clearResults(); 6451 } 6452 }; 6453 6454 function updateResults(value) { 6455 if (value == "") { 6456 return null; 6457 } 6458 HandlebarsBolt.UpdateContent("ImpersonationBoxSearchResults", "/Default.aspx?ID=@impersonationFeed&q=" + value); 6459 document.getElementById("ImpersonationBoxSearchFind").classList.add("u-hidden"); 6460 document.getElementById("ImpersonationBoxSearchClear").classList.remove("u-hidden"); 6461 } 6462 6463 function clearResults() { 6464 document.getElementById("ImpersonationBoxSearchField").value = ""; 6465 HandlebarsBolt.CleanContainer("ImpersonationBoxSearchResults"); 6466 document.getElementById("ImpersonationBoxSearchFind").classList.remove("u-hidden"); 6467 document.getElementById("ImpersonationBoxSearchClear").classList.add("u-hidden"); 6468 } 6469 </script> 6470 } 6471 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 6472 6473 @using System 6474 @using System.Web 6475 @using System.Collections.Generic 6476 @using Dynamicweb.Rapido.Blocks.Extensibility 6477 @using Dynamicweb.Rapido.Blocks 6478 6479 @{ 6480 BlocksPage miniCartBlocksPage = BlocksPage.GetBlockPage("Master"); 6481 string orderlinesView = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView").SelectedValue : "table"; 6482 6483 Block orderLines = new Block 6484 { 6485 Id = "MiniCartOrderLines", 6486 SkipRenderBlocksList = true, 6487 BlocksList = new List<Block> 6488 { 6489 new Block { 6490 Id = "MiniCartOrderLinesList", 6491 SortId = 20, 6492 Template = RenderMiniCartOrderLinesList() 6493 } 6494 } 6495 }; 6496 6497 Block orderlinesScriptTemplates = new Block 6498 { 6499 Id = "OrderlinesScriptTemplates" 6500 }; 6501 6502 if (orderlinesView == "table") 6503 { 6504 orderLines.Template = RenderMiniCartOrderLinesTable(); 6505 orderLines.BlocksList.Add( 6506 new Block 6507 { 6508 Id = "MiniCartOrderlinesTableHeader", 6509 SortId = 10, 6510 Template = RenderMiniCartOrderLinesHeader() 6511 } 6512 ); 6513 6514 orderlinesScriptTemplates.Template = RenderMiniCartScriptsTableTemplates(); 6515 } 6516 else 6517 { 6518 orderLines.Template = RenderMiniCartOrderLinesBlocks(); 6519 orderlinesScriptTemplates.Template = RenderMiniCartScriptsListTemplates(); 6520 } 6521 6522 miniCartBlocksPage.Add("MasterBottomSnippets", orderlinesScriptTemplates); 6523 6524 Block miniCartScriptTemplates = new Block() 6525 { 6526 Id = "MasterMiniCartTemplates", 6527 SortId = 1, 6528 Template = RenderMiniCartScriptTemplates(), 6529 SkipRenderBlocksList = true, 6530 BlocksList = new List<Block> 6531 { 6532 orderLines, 6533 new Block { 6534 Id = "MiniCartFooter", 6535 Template = RenderMiniCartFooter(), 6536 SortId = 50, 6537 SkipRenderBlocksList = true, 6538 BlocksList = new List<Block> 6539 { 6540 new Block { 6541 Id = "MiniCartSubTotal", 6542 Template = RenderMiniCartSubTotal(), 6543 SortId = 30 6544 }, 6545 new Block { 6546 Id = "MiniCartFees", 6547 Template = RenderMiniCartFees(), 6548 SortId = 40 6549 }, 6550 new Block { 6551 Id = "MiniCartPoints", 6552 Template = RenderMiniCartPoints(), 6553 SortId = 50 6554 }, 6555 new Block { 6556 Id = "MiniCartTotal", 6557 Template = RenderMiniCartTotal(), 6558 SortId = 60 6559 }, 6560 new Block { 6561 Id = "MiniCartDisclaimer", 6562 Template = RenderMiniCartDisclaimer(), 6563 SortId = 70 6564 }, 6565 new Block { 6566 Id = "MiniCartActions", 6567 Template = RenderMiniCartActions(), 6568 SortId = 80 6569 } 6570 } 6571 } 6572 } 6573 }; 6574 6575 miniCartBlocksPage.Add("MasterBottomSnippets", miniCartScriptTemplates); 6576 } 6577 6578 @helper RenderMiniCartScriptsTableTemplates() 6579 { 6580 <script id="MiniCartOrderline" type="text/x-template"> 6581 {{#unless isEmpty}} 6582 <tr> 6583 <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> 6584 <td class="u-va-middle"> 6585 <a href="{{link}}" class="mini-cart-orderline__name" title="{{name}}">{{name}}</a> 6586 {{#if variantname}} 6587 <a href="{{link}}" class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{variantname}}</a> 6588 {{/if}} 6589 {{#if unitname}} 6590 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{unitname}}</div> 6591 {{/if}} 6592 </td> 6593 <td class="u-ta-right u-va-middle">{{quantity}}</td> 6594 <td class="u-ta-right u-va-middle"> 6595 {{#if pointsTotal}} 6596 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 6597 {{else}} 6598 {{totalprice}} 6599 {{/if}} 6600 </td> 6601 </tr> 6602 {{/unless}} 6603 </script> 6604 6605 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 6606 {{#unless isEmpty}} 6607 <tr class="table__row--no-border"> 6608 <td class="u-w60px">&nbsp;</td> 6609 <td><div class="mini-cart-orderline__name dw-mod">{{name}}</div></td> 6610 <td class="u-ta-right">&nbsp;</td> 6611 <td class="u-ta-right">{{totalprice}}</td> 6612 </tr> 6613 {{/unless}} 6614 </script> 6615 } 6616 6617 @helper RenderMiniCartScriptsListTemplates() 6618 { 6619 int cartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 6620 6621 <script id="MiniCartOrderline" type="text/x-template"> 6622 {{#unless isEmpty}} 6623 <div class="mini-cart-orderline grid dw-mod"> 6624 <div class="grid__col-4"> 6625 <a href="{{link}}" class="{{hideimage}}"> 6626 <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}}"> 6627 </a> 6628 </div> 6629 <div class="grid__col-8"> 6630 <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> 6631 {{#if variantname}} 6632 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Variant"): {{variantname}}</div> 6633 {{/if}} 6634 {{#if unitname}} 6635 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Unit"): {{unitname}}</div> 6636 {{/if}} 6637 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Qty"): {{quantity}}</div> 6638 6639 <div class="grid__cell-footer"> 6640 <div class="grid__cell"> 6641 <div class="u-pull--left mini-cart-orderline__price dw-mod"> 6642 {{#if pointsTotal}} 6643 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 6644 {{else}} 6645 {{totalprice}} 6646 {{/if}} 6647 </div> 6648 <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> 6649 </div> 6650 </div> 6651 </div> 6652 </div> 6653 {{/unless}} 6654 </script> 6655 6656 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 6657 {{#unless isEmpty}} 6658 <div class="mini-cart-orderline mini-cart-orderline--discount grid dw-mod"> 6659 <div class="grid__col-4"> 6660 <div class="mini-cart-orderline__name mini-cart-orderline__name dw-mod">{{name}}</div> 6661 </div> 6662 <div class="grid__col-8">{{totalprice}}</div> 6663 </div> 6664 {{/unless}} 6665 </script> 6666 } 6667 6668 @helper RenderMiniCartScriptTemplates() 6669 { 6670 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMiniCartTemplates").OrderBy(item => item.SortId).ToList(); 6671 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 6672 string cartPageLink = string.Concat("/Default.aspx?ID=", GetPageIdByNavigationTag("CartPage")); 6673 6674 <script id="MiniCartContent" type="text/x-template"> 6675 {{#.}} 6676 {{#unless isEmpty}} 6677 @RenderBlockList(subBlocks) 6678 {{/unless}} 6679 {{/.}} 6680 </script> 6681 } 6682 6683 @helper RenderMiniCartOrderLinesTable() 6684 { 6685 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList(); 6686 6687 <div class="u-overflow-auto"> 6688 <table class="table mini-cart-table dw-mod"> 6689 @RenderBlockList(subBlocks) 6690 </table> 6691 </div> 6692 } 6693 6694 @helper RenderMiniCartOrderLinesBlocks() 6695 { 6696 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList(); 6697 6698 <div class="u-overflow-auto"> 6699 @RenderBlockList(subBlocks) 6700 </div> 6701 } 6702 6703 @helper RenderMiniCartOrderLinesHeader() 6704 { 6705 <thead> 6706 <tr> 6707 <td>&nbsp;</td> 6708 <td>@Translate("Product")</td> 6709 <td class="u-ta-right">@Translate("Qty")</td> 6710 <td class="u-ta-right" width="120">@Translate("Price")</td> 6711 </tr> 6712 </thead> 6713 } 6714 6715 @helper RenderMiniCartOrderLinesList() 6716 { 6717 <text> 6718 {{#OrderLines}} 6719 {{#ifCond template "===" "CartOrderline"}} 6720 {{>MiniCartOrderline}} 6721 {{/ifCond}} 6722 {{#ifCond template "===" "CartOrderlineMobile"}} 6723 {{>MiniCartOrderline}} 6724 {{/ifCond}} 6725 {{#ifCond template "===" "CartOrderlineDiscount"}} 6726 {{>MiniCartOrderlineDiscount}} 6727 {{/ifCond}} 6728 {{/OrderLines}} 6729 </text> 6730 } 6731 6732 @helper RenderMiniCartFees() 6733 { 6734 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 6735 if (!pointShop) 6736 { 6737 <text> 6738 {{#unless hidePaymentfee}} 6739 <div class="grid"> 6740 <div class="grid__col-6 grid__col--bleed-y"> 6741 {{paymentmethod}} 6742 </div> 6743 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{paymentfee}}</div> 6744 </div> 6745 {{/unless}} 6746 </text> 6747 } 6748 <text> 6749 {{#unless hideShippingfee}} 6750 <div class="grid"> 6751 <div class="grid__col-6 grid__col--bleed-y"> 6752 {{shippingmethod}} 6753 </div> 6754 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{shippingfee}}</div> 6755 </div> 6756 {{/unless}} 6757 </text> 6758 <text> 6759 {{#if hasTaxSettings}} 6760 <div class="grid"> 6761 <div class="grid__col-6 grid__col--bleed-y">@Translate("Sales Tax")</div> 6762 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{totaltaxes}}</div> 6763 </div> 6764 {{/if}} 6765 </text> 6766 } 6767 6768 @helper RenderMiniCartFooter() 6769 { 6770 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartFooter").OrderBy(item => item.SortId).ToList(); 6771 6772 <div class="mini-cart__footer u-border-top u-padding-top dw-mod"> 6773 @RenderBlockList(subBlocks) 6774 </div> 6775 } 6776 6777 @helper RenderMiniCartActions() 6778 { 6779 int cartPageId = GetPageIdByNavigationTag("CartPage"); 6780 6781 <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> 6782 <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> 6783 } 6784 6785 @helper RenderMiniCartPoints() 6786 { 6787 <text> 6788 {{#if earnings}} 6789 <div class="grid"> 6790 <div class="grid__col-6 grid__col--bleed-y">@Translate("Earnings")</div> 6791 <div class="grid__col-6 grid__col--bleed-y grid--align-end"> 6792 <div> 6793 <span class="u-color--loyalty-points">{{earnings}}</span> @Translate("points") 6794 </div> 6795 </div> 6796 </div> 6797 {{/if}} 6798 </text> 6799 } 6800 6801 @helper RenderMiniCartSubTotal() 6802 { 6803 bool hasTaxSettings = Dynamicweb.Rapido.Services.Countries.HasTaxSettings(Model.Cart.ID); 6804 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 6805 if (!pointShop) 6806 { 6807 <text> 6808 {{#unless hideSubTotal}} 6809 <div class="grid dw-mod u-bold"> 6810 <div class="grid__col-6 grid__col--bleed-y">@Translate("Subtotal")</div> 6811 <div class="grid__col-6 grid__col--bleed-y grid--align-end"> 6812 @if (hasTaxSettings) 6813 { 6814 <text>{{subtotalpricewithouttaxes}}</text> 6815 } 6816 else 6817 { 6818 <text>{{subtotalprice}}</text> 6819 } 6820 </div> 6821 </div> 6822 {{/unless}} 6823 </text> 6824 } 6825 } 6826 6827 @helper RenderMiniCartTotal() 6828 { 6829 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 6830 6831 <div class="mini-cart-totals grid u-border-top u-margin-top dw-mod"> 6832 <div class="grid__col-6">@Translate("Total")</div> 6833 <div class="grid__col-6 grid--align-end"> 6834 <div> 6835 @if (pointShop) 6836 { 6837 <span class="u-color--loyalty-points">{{pointsUsedInCart}}</span> @Translate("points") 6838 } 6839 else 6840 { 6841 <text>{{totalprice}}</text> 6842 } 6843 </div> 6844 </div> 6845 </div> 6846 } 6847 6848 @helper RenderMiniCartDisclaimer() 6849 { 6850 <text> 6851 {{#if showCheckoutDisclaimer}} 6852 <div class="grid u-margin-bottom u-ta-right"> 6853 <small class="grid__col-12">{{checkoutDisclaimer}}</small> 6854 </div> 6855 {{/if}} 6856 </text> 6857 } 6858 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 6859 6860 @using Dynamicweb.Rapido.Blocks.Extensibility 6861 @using Dynamicweb.Rapido.Blocks 6862 @using Dynamicweb.Rapido.Blocks.Components.General 6863 @using Dynamicweb.Rapido.Blocks.Components 6864 @using Dynamicweb.Rapido.Services 6865 6866 @{ 6867 string addToCartNotificationType = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType").SelectedValue : ""; 6868 string addToCartNotificationMiniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown"; 6869 bool addToCartHideCartIcon = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 6870 6871 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed() && !string.IsNullOrEmpty(addToCartNotificationType)) 6872 { 6873 if (addToCartNotificationType == "modal") 6874 { 6875 Block addToCartNotificationModal = new Block 6876 { 6877 Id = "AddToCartNotificationModal", 6878 Template = RenderAddToCartNotificationModal() 6879 }; 6880 6881 Block addToCartNotificationScript = new Block 6882 { 6883 Id = "AddToCartNotificationScript", 6884 Template = RenderAddToCartNotificationModalScript() 6885 }; 6886 BlocksPage.GetBlockPage("Master").Add("MasterTopSnippets", addToCartNotificationModal); 6887 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript); 6888 } 6889 else if (addToCartNotificationType == "toggle" && addToCartNotificationMiniCartLayout != "none" && !addToCartHideCartIcon && Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 6890 { 6891 Block addToCartNotificationScript = new Block 6892 { 6893 Id = "AddToCartNotificationScript", 6894 Template = RenderAddToCartNotificationToggleScript() 6895 }; 6896 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript); 6897 } 6898 } 6899 } 6900 6901 @helper RenderAddToCartNotificationModal() 6902 { 6903 <div id="LastAddedProductModal" data-template="LastAddedProductTemplate"></div> 6904 } 6905 6906 @helper RenderAddToCartNotificationModalScript() 6907 { 6908 int cartPageId = GetPageIdByNavigationTag("CartPage"); 6909 6910 <script id="LastAddedProductTemplate" type="text/x-template"> 6911 @{ 6912 6913 Modal lastAddedProduct = new Modal 6914 { 6915 Id = "LastAddedProduct", 6916 Heading = new Heading 6917 { 6918 Level = 2, 6919 Title = Translate("Product is added to the cart") 6920 }, 6921 Width = ModalWidth.Md, 6922 BodyTemplate = RenderModalContent() 6923 }; 6924 6925 lastAddedProduct.AddActions( 6926 new Button 6927 { 6928 ButtonType = ButtonType.Button, 6929 ButtonLayout = ButtonLayout.Secondary, 6930 Title = Translate("Continue shopping"), 6931 CssClass = "u-pull--left u-no-margin btn--sm", 6932 OnClick = "document.getElementById('LastAddedProductModalTrigger').checked = false" 6933 }, 6934 new Link 6935 { 6936 Href = "/Default.aspx?ID=" + cartPageId, 6937 ButtonLayout = ButtonLayout.Secondary, 6938 CssClass = "u-pull--right u-no-margin btn--sm", 6939 Title = Translate("Proceed to checkout") 6940 } 6941 ); 6942 6943 @Render(lastAddedProduct) 6944 } 6945 </script> 6946 <script> 6947 document.addEventListener('addToCart', function (event) { 6948 Cart.ShowLastAddedProductModal(event.detail); 6949 }); 6950 </script> 6951 } 6952 6953 @helper RenderModalContent() 6954 { 6955 <div class="grid"> 6956 <div class="grid__col-2"> 6957 @Render(new Image { Path = "{{ productInfo.image }}", Link = "{{ productInfo.link }}", Title = "{{ productInfo.name }}", DisableImageEngine = true }) 6958 </div> 6959 <div class="u-padding grid--align-self-center"> 6960 <span>{{quantity}}</span> x 6961 </div> 6962 <div class="grid__col-auto grid--align-self-center"> 6963 <div>{{productInfo.name}}</div> 6964 {{#if productInfo.variantName}} 6965 <small class="u-margin-bottom-5px">{{productInfo.variantName}}</small> 6966 {{/if}} 6967 {{#if productInfo.unitName}} 6968 <small class="u-margin-bottom-5px">{{productInfo.unitName}}</small> 6969 {{/if}} 6970 </div> 6971 </div> 6972 } 6973 6974 @helper RenderAddToCartNotificationToggleScript() 6975 { 6976 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 6977 6978 <script> 6979 document.addEventListener('addToCart', function () { 6980 Cart.ToggleMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '@miniCartFeedPageId'); 6981 }); 6982 </script> 6983 } 6984 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 6985 6986 @using System 6987 @using System.Web 6988 @using System.Collections.Generic 6989 @using Dynamicweb.Rapido.Blocks.Extensibility 6990 @using Dynamicweb.Rapido.Blocks 6991 @using Dynamicweb.Rapido.Blocks.Components.General 6992 6993 @functions { 6994 BlocksPage footerBlocksPage = BlocksPage.GetBlockPage("Master"); 6995 } 6996 6997 @{ 6998 string footerColumnOneContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Content"); 6999 string footerColumnTwoContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Content"); 7000 string footerColumnThreeContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Content"); 7001 string footerColumnOneHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Header"); 7002 string footerColumnTwoHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Header"); 7003 string footerColumnThreeHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Header"); 7004 7005 Block masterFooterContent = new Block() 7006 { 7007 Id = "MasterFooterContent", 7008 SortId = 10, 7009 Template = RenderFooter(), 7010 SkipRenderBlocksList = true 7011 }; 7012 footerBlocksPage.Add(MasterBlockId.MasterFooter, masterFooterContent); 7013 7014 if (!string.IsNullOrEmpty(footerColumnOneContent) || !string.IsNullOrEmpty(footerColumnOneHeader)) 7015 { 7016 Block masterFooterColumnOne = new Block 7017 { 7018 Id = "MasterFooterColumnOne", 7019 SortId = 10, 7020 Template = RenderFooterColumn(footerColumnOneHeader, footerColumnOneContent), 7021 Design = new Design 7022 { 7023 Size = "auto", 7024 RenderType = RenderType.Column 7025 } 7026 }; 7027 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnOne); 7028 } 7029 7030 if (!string.IsNullOrEmpty(footerColumnTwoContent) || !string.IsNullOrEmpty(footerColumnTwoHeader)) 7031 { 7032 Block masterFooterColumnTwo = new Block 7033 { 7034 Id = "MasterFooterColumnTwo", 7035 SortId = 20, 7036 Template = RenderFooterColumn(footerColumnTwoHeader, footerColumnTwoContent), 7037 Design = new Design 7038 { 7039 Size = "auto", 7040 RenderType = RenderType.Column 7041 } 7042 }; 7043 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnTwo); 7044 } 7045 7046 if (!string.IsNullOrEmpty(footerColumnThreeContent) || !string.IsNullOrEmpty(footerColumnThreeHeader)) 7047 { 7048 Block masterFooterColumnThree = new Block 7049 { 7050 Id = "MasterFooterColumnThree", 7051 SortId = 30, 7052 Template = RenderFooterColumn(footerColumnThreeHeader, footerColumnThreeContent), 7053 Design = new Design 7054 { 7055 Size = "auto", 7056 RenderType = RenderType.Column 7057 } 7058 }; 7059 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnThree); 7060 } 7061 7062 if (Model.Area.Item.GetItem("Layout").GetBoolean("FooterNewsletterSignUp")) 7063 { 7064 Block masterFooterNewsletterSignUp = new Block 7065 { 7066 Id = "MasterFooterNewsletterSignUp", 7067 SortId = 40, 7068 Template = RenderFooterNewsletterSignUp(), 7069 Design = new Design 7070 { 7071 Size = "auto", 7072 RenderType = RenderType.Column 7073 } 7074 }; 7075 footerBlocksPage.Add("MasterFooterContent", masterFooterNewsletterSignUp); 7076 } 7077 7078 var _lorenzLinks = Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks"); 7079 var _heritageLinks = Model.Area.Item.GetItem("Layout").GetItems("HeritageSocialLinks"); 7080 7081 if ( (_lorenzLinks != null && _lorenzLinks.Count > 0) || (_heritageLinks != null && _heritageLinks.Count > 0) ) 7082 { 7083 Block masterFooterSocialLinks = new Block 7084 { 7085 Id = "MasterFooterSocialLinks", 7086 SortId = 50, 7087 Template = RenderFooterSocialLinks(), 7088 Design = new Design 7089 { 7090 Size = "auto", 7091 RenderType = RenderType.Column 7092 } 7093 }; 7094 footerBlocksPage.Add("MasterFooterContent", masterFooterSocialLinks); 7095 } 7096 7097 7098 if (Model.Area.Item.GetItem("Layout").GetItems("FooterPayments") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterPayments").Count > 0) 7099 { 7100 Block masterFooterPayments = new Block 7101 { 7102 Id = "MasterFooterPayments", 7103 SortId = 60, 7104 Template = RenderFooterPayments(), 7105 Design = new Design 7106 { 7107 Size = "12", 7108 RenderType = RenderType.Column 7109 } 7110 }; 7111 footerBlocksPage.Add("MasterFooterContent", masterFooterPayments); 7112 } 7113 7114 Block masterFooterCopyright = new Block 7115 { 7116 Id = "MasterFooterCopyright", 7117 SortId = 70, 7118 Template = RenderFooterCopyright(), 7119 Design = new Design 7120 { 7121 Size = "12", 7122 RenderType = RenderType.Column 7123 } 7124 }; 7125 footerBlocksPage.Add("MasterFooterContent", masterFooterCopyright); 7126 } 7127 7128 @helper RenderFooter() 7129 { 7130 List<Block> subBlocks = this.footerBlocksPage.GetBlockListById("MasterFooterContent").OrderBy(item => item.SortId).ToList(); 7131 7132 <footer class="footer dw-mod"> 7133 <div class="center-container top-container__center-container dw-mod"> 7134 <div class="grid grid--external-bleed-x"> 7135 @RenderBlockList(subBlocks) 7136 </div> 7137 </div> 7138 </footer> 7139 } 7140 7141 @helper RenderFooterColumn(string header, string content) 7142 { 7143 <h3 class="footer__heading dw-mod">@header</h3> 7144 <div class="footer__content dw-mod"> 7145 @content 7146 </div> 7147 } 7148 7149 @helper RenderFooterNewsletterSignUp() 7150 { 7151 string newsletterSignUpPageId = GetPageIdByNavigationTag("NewsletterSignUp").ToString(); 7152 Form form = new Form { Action = "/Default.aspx", Method = FormMethod.Get, Enctype = FormEnctype.multipart }; 7153 7154 form.Add(new HiddenField { Name = "ID", Value = newsletterSignUpPageId }); 7155 form.Add(new Text { Content = "<p>" + Translate("Sign up if you would like to receive occasional treats from us") + "</p>" }); 7156 form.Add(new TextField { 7157 Id = "NewsletterEmail", Name = "NewsletterEmail", Placeholder = Translate("Your email address"), 7158 Type = TextFieldType.Email, 7159 ActionButton = new Button { 7160 ButtonType = ButtonType.Submit, Id="Submitter", Title = Translate("Go"), OnClick = "Buttons.LockButton(event)", CssClass = "btn--condensed" 7161 } 7162 }); 7163 7164 <h3 class="footer__heading dw-mod">@Translate("Mailing list")</h3> 7165 <div class="footer__content dw-mod"> 7166 @Render(form) 7167 </div> 7168 } 7169 7170 @helper RenderFooterSocialLinks() 7171 { 7172 var lorenzList = Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks"); 7173 var heritageList = Model.Area.Item.GetItem("Layout").GetItems("HeritageSocialLinks"); 7174 7175 // Follow Lorenz 7176 if (lorenzList != null && lorenzList.Count > 0) 7177 { 7178 <h3 class="footer__heading dw-mod">Follow Lorenz</h3> 7179 <div class="footer__content dw-mod"> 7180 <div class="collection dw-mod"> 7181 @foreach (var socialitem in lorenzList) 7182 { 7183 var vm = socialitem.GetValue("Icon") as Dynamicweb.Frontend.ListViewModel; 7184 string iconClass = vm != null ? vm.SelectedValue : ""; 7185 string title = vm != null ? vm.SelectedName : ""; 7186 string href = socialitem.GetString("Link"); 7187 7188 <a href="@href" target="_blank" title="@title" class="u-margin-bottom-5px" rel="noopener"> 7189 <i class="@(iconClass) fa-2x"></i> 7190 </a> 7191 } 7192 </div> 7193 </div> 7194 } 7195 7196 // Follow Heritage 7197 if (heritageList != null && heritageList.Count > 0) 7198 { 7199 <h3 class="footer__heading dw-mod">Follow Heritage</h3> 7200 <div class="footer__content dw-mod"> 7201 <div class="collection dw-mod"> 7202 @foreach (var socialitem in heritageList) 7203 { 7204 var vm = socialitem.GetValue("Icon") as Dynamicweb.Frontend.ListViewModel; 7205 string iconClass = vm != null ? vm.SelectedValue : ""; 7206 string title = vm != null ? vm.SelectedName : ""; 7207 string href = socialitem.GetString("Link"); 7208 7209 <a href="@href" target="_blank" title="@title" class="u-margin-bottom-5px" rel="noopener"> 7210 <i class="@(iconClass) fa-2x"></i> 7211 </a> 7212 } 7213 </div> 7214 </div> 7215 } 7216 } 7217 7218 7219 @helper RenderFooterPayments() 7220 { 7221 <div class="footer__content dw-mod"> 7222 <div class="collection dw-mod"> 7223 @foreach (var payment in Model.Area.Item.GetItem("Layout").GetItems("FooterPayments")) 7224 { 7225 var paymentItem = payment.GetValue("CardTypeOrVerifiedPayment") as Dynamicweb.Frontend.ListViewModel; 7226 string paymentImage = null; 7227 string paymentTitle = paymentItem.SelectedName; 7228 ListOptionViewModel selected = paymentItem.SelectedOptions.FirstOrDefault(); 7229 if (selected != null) 7230 { 7231 paymentImage = selected.Icon; 7232 } 7233 7234 <div class="footer__card-type"> 7235 <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" /> 7236 </div> 7237 } 7238 </div> 7239 </div> 7240 } 7241 7242 @helper RenderFooterCopyright() 7243 { 7244 <div class="grid__col-12 footer__copyright dw-mod"> 7245 <p>@Model.Area.Item.GetItem("Layout").GetString("FooterCopyrightText")</p> 7246 </div> 7247 } 7248 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 7249 7250 @using System 7251 @using System.Web 7252 @using System.Collections.Generic 7253 @using Dynamicweb.Rapido.Blocks.Extensibility 7254 @using Dynamicweb.Rapido.Blocks 7255 @using Dynamicweb.Ecommerce.Common 7256 7257 @{ 7258 BlocksPage referencesBlocksPage = BlocksPage.GetBlockPage("Master"); 7259 7260 Block masterScriptReferences = new Block() 7261 { 7262 Id = "MasterScriptReferences", 7263 SortId = 1, 7264 Template = RenderMasterScriptReferences() 7265 }; 7266 referencesBlocksPage.Add(MasterBlockId.MasterReferences, masterScriptReferences); 7267 7268 Block masterCustomScriptReferences = new Block() 7269 { 7270 Id = "MasterScriptReferences", 7271 SortId = 10, 7272 Template = RenderMasterCustomScriptReferences() 7273 }; 7274 referencesBlocksPage.Add(MasterBlockId.MasterReferences, masterCustomScriptReferences); 7275 } 7276 7277 @helper RenderMasterScriptReferences() { 7278 <script src="/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js"></script> 7279 <script src="/Files/Templates/Designs/Rapido/js/master.min.js"></script> 7280 } 7281 7282 @helper RenderMasterCustomScriptReferences() { 7283 if (Model.Area.Item.GetItem("Custom").GetBoolean("UseCustomJavascript")) 7284 { 7285 var minify = Model.Area.Item.GetItem("Rizzo").GetBoolean("MinifyJavascript"); 7286 const string folderName = "custom"; 7287 var customBundle = Dna.Optimizer.Renderer.RenderScripts($"/Files/Templates/Designs/Rapido/js/{folderName}", $"-{folderName}-scripts", new List<string>(), new List<string>(), minify, false, false); 7288 <script src="@customBundle"></script> 7289 } 7290 } 7291 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 7292 7293 @using System 7294 @using System.Web 7295 @using System.Collections.Generic 7296 @using Dynamicweb.Rapido.Blocks.Extensibility 7297 @using Dynamicweb.Rapido.Blocks 7298 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 7299 @using Dynamicweb.Rapido.Services 7300 7301 @{ 7302 BlocksPage searchBlocksPage = BlocksPage.GetBlockPage("Master"); 7303 bool navigationItemsHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 7304 bool isFavoriteList = !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("ListID")); 7305 7306 if (!navigationItemsHideSearch || isFavoriteList) 7307 { 7308 Block masterSearchScriptTemplates = new Block() 7309 { 7310 Id = "MasterSearchScriptTemplates", 7311 SortId = 1, 7312 Template = RenderSearchScriptTemplates() 7313 }; 7314 7315 searchBlocksPage.Add(MasterBlockId.MasterBottomSnippets, masterSearchScriptTemplates); 7316 } 7317 } 7318 7319 @helper RenderSearchScriptTemplates() 7320 { 7321 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 7322 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 7323 bool useFacebookPixel = !string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID")); 7324 bool useGoogleTagManager = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID")); 7325 bool showPrice = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HidePriceInSearchResults"); 7326 bool showAddToCartButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideAddToCartButton"); 7327 bool showViewButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideViewButton"); 7328 bool showAddToDownloadButton = Pageview.AreaSettings.GetItem("Layout").GetBoolean("ShowAddToDownloadButton"); 7329 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 7330 7331 <script id="SearchGroupsTemplate" type="text/x-template"> 7332 {{#.}} 7333 <li class="dropdown__item dw-mod" onclick="Search.UpdateGroupSelection(this)" data-group-id="{{id}}">{{name}}</li> 7334 {{/.}} 7335 </script> 7336 7337 <script id="SearchProductsTemplate" type="text/x-template"> 7338 {{#each .}} 7339 {{#Product}} 7340 {{#ifCond template "!==" "SearchMore"}} 7341 <li class="dropdown__item dropdown__item--seperator dw-mod"> 7342 @if (useFacebookPixel) 7343 { 7344 <text>{{{facebookPixelSearch name number priceDouble currency searchParameter}}}</text> 7345 } 7346 @if (useGoogleTagManager) 7347 { 7348 <text>{{{googleEnchantImpression 'Search results' currency googleImpression}}}</text> 7349 } 7350 <div> 7351 <a href="{{link}}" class="js-typeahead-link u-color-inherit u-pull--left" onclick="{{googleImpressionClick}}" title="{{name}}{{#if variantName}}, {{variantName}}{{/if}}"> 7352 <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}}{{#if variantName}}, {{variantName}}{{/if}}"></div> 7353 <div class="u-pull--left"> 7354 <div class="u-bold u-max-w220px u-truncate-text js-typeahead-name">{{name}}{{#if variantName}}, {{variantName}}{{/if}}</div> 7355 @if (showPrice && Dynamicweb.Rapido.Services.User.IsPricesAllowed()) 7356 { 7357 if (pointShopOnly) 7358 { 7359 <text> 7360 {{#if havePointPrice}} 7361 <div> 7362 <span class="u-color--loyalty-points">{{points}}</span> @Translate("points") 7363 </div> 7364 {{else}} 7365 <small class="help-text u-no-margin">@Translate("Not available")</small> 7366 {{/if}} 7367 {{#unless canBePurchasedWithPoints}} 7368 {{#if havePointPrice}} 7369 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small> 7370 {{/if}} 7371 {{/unless}} 7372 </text> 7373 } 7374 else 7375 { 7376 <div>{{price}}</div> 7377 } 7378 } 7379 </div> 7380 </a> 7381 <div class="u-margin-left u-pull--right"> 7382 @{ 7383 var viewBtn = new Link 7384 { 7385 Href = "{{link}}", 7386 OnClick = "{{googleImpressionClick}}", 7387 ButtonLayout = ButtonLayout.Secondary, 7388 CssClass = "btn--condensed u-no-margin u-w80px js-ignore-click-outside", 7389 Title = Translate("View") 7390 }; 7391 } 7392 @if (showAddToCartButton && Dynamicweb.Rapido.Services.User.IsBuyingAllowed()) 7393 { 7394 <text>{{#if hideAddToCartButton}}</text> 7395 @Render(viewBtn) 7396 <text>{{else}}</text> 7397 @Render(new AddToCartButton 7398 { 7399 HideTitle = true, 7400 ProductId = "{{productId}}", 7401 ProductInfo = "{{productInfo}}", 7402 BuyForPoints = pointShopOnly, 7403 OnClick = "{{facebookPixelAction}}", 7404 CssClass = "u-w80px js-ignore-click-outside", 7405 Icon = new Icon { 7406 CssClass = "js-ignore-click-outside" 7407 }, 7408 ExtraAttributes = new Dictionary<string, string> 7409 { 7410 { "{{disabledBuyButton}}", "" } 7411 } 7412 }) 7413 <text>{{/if}}</text> 7414 } 7415 else if (showViewButton) 7416 { 7417 @Render(viewBtn) 7418 } 7419 @if (showAddToDownloadButton) 7420 { 7421 <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}}"> 7422 <i class="fas fa-plus js-button-icon"></i> 7423 </button> 7424 } 7425 </div> 7426 </div> 7427 </li> 7428 {{/ifCond}} 7429 {{#ifCond template "===" "SearchMore"}} 7430 {{>SearchMoreProducts}} 7431 {{/ifCond}} 7432 {{/Product}} 7433 {{else}} 7434 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod"> 7435 @Translate("Your search gave 0 results") 7436 </li> 7437 {{/each}} 7438 </script> 7439 7440 <script id="SearchMoreProducts" type="text/x-template"> 7441 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 7442 <a href="/Default.aspx?ID=@productsPageId&Search={{searchParameter}}&GroupID={{groupId}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 7443 @Translate("View all") 7444 </a> 7445 </li> 7446 </script> 7447 7448 <script id="SearchMorePages" type="text/x-template"> 7449 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 7450 <a href="/Default.aspx?ID=@contentSearchPageLink&Search={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 7451 @Translate("View all") 7452 </a> 7453 </li> 7454 </script> 7455 7456 <script id="SearchPagesTemplate" type="text/x-template"> 7457 {{#each .}} 7458 {{#ifCond template "!==" "SearchMore"}} 7459 <li class="dropdown__item dropdown__item--seperator dw-mod"> 7460 <div> 7461 <a href="/Default.aspx?ID={{id}}" class="js-typeahead-link u-pull--left u-color-inherit"> 7462 <div class="u-margin-right u-pull--left"><i class="fa {{icon}} u-w20px u-ta-center"></i></div> 7463 <div class="u-pull--left"> 7464 <div class="u-bold u-truncate-text u-max-w220px js-typeahead-name">{{name}}</div> 7465 </div> 7466 </a> 7467 </div> 7468 </li> 7469 {{/ifCond}} 7470 {{#ifCond template "===" "SearchMore"}} 7471 {{>SearchMorePages}} 7472 {{/ifCond}} 7473 {{else}} 7474 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod"> 7475 @Translate("Your search gave 0 results") 7476 </li> 7477 {{/each}} 7478 </script> 7479 7480 <script id="SearchPagesTemplateWrap" type="text/x-template"> 7481 <div class="dropdown__column-header">@Translate("Pages")</div> 7482 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod"> 7483 {{>SearchPagesTemplate}} 7484 </ul> 7485 </script> 7486 7487 <script id="SearchProductsTemplateWrap" type="text/x-template"> 7488 <div class="dropdown__column-header">@Translate("Products")</div> 7489 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod"> 7490 {{>SearchProductsTemplate}} 7491 </ul> 7492 </script> 7493 } 7494 7495 @using Dynamicweb.Rapido.Blocks.Components 7496 @using Dynamicweb.Rapido.Blocks.Components.General 7497 @using Dynamicweb.Rapido.Blocks 7498 @using System.IO 7499 7500 7501 @using Dynamicweb.Rapido.Blocks.Components.General 7502 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 7503 7504 7505 @* Component *@ 7506 7507 @helper RenderVariantMatrix(VariantMatrix settings) { 7508 if (settings != null) 7509 { 7510 int productLoopCounter = 0; 7511 int groupCount = 0; 7512 List<VariantOption> firstDimension = new List<VariantOption>(); 7513 List<VariantOption> secondDimension = new List<VariantOption>(); 7514 List<VariantOption> thirdDimension = new List<VariantOption>(); 7515 7516 foreach (VariantGroup variantGroup in settings.GetVariantGroups()) 7517 { 7518 foreach (VariantOption variantOptions in variantGroup.GetVariantOptions()) 7519 { 7520 if (groupCount == 0) { 7521 firstDimension.Add(variantOptions); 7522 } 7523 if (groupCount == 1) 7524 { 7525 secondDimension.Add(variantOptions); 7526 } 7527 if (groupCount == 2) 7528 { 7529 thirdDimension.Add(variantOptions); 7530 } 7531 } 7532 groupCount++; 7533 } 7534 7535 int rowCount = 0; 7536 int columnCount = 0; 7537 7538 <script> 7539 var variantsCollection = []; 7540 </script> 7541 7542 <table class="table table--compact js-variants-matrix dw-mod" id="VariantMatrixTable_@settings.ProductId"> 7543 @if (groupCount == 1) 7544 { 7545 <tbody> 7546 @foreach (VariantOption firstVariantOption in firstDimension) 7547 { 7548 var variantId = firstVariantOption.Id; 7549 <tr> 7550 <td class="u-bold"> 7551 @firstVariantOption.Name 7552 </td> 7553 <td> 7554 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount) 7555 </td> 7556 </tr> 7557 productLoopCounter++; 7558 } 7559 7560 <tr> 7561 <td>&nbsp;</td> 7562 <td> 7563 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div> 7564 </td> 7565 </tr> 7566 </tbody> 7567 } 7568 @if (groupCount == 2) 7569 { 7570 <thead> 7571 <tr> 7572 <td>&nbsp;</td> 7573 @foreach (VariantOption variant in secondDimension) 7574 { 7575 <td>@variant.Name</td> 7576 } 7577 </tr> 7578 </thead> 7579 <tbody> 7580 @foreach (VariantOption firstVariantOption in firstDimension) 7581 { 7582 string variantId = ""; 7583 columnCount = 0; 7584 7585 <tr> 7586 <td class="u-min-w120px">@firstVariantOption.Name</td> 7587 7588 @foreach (VariantOption secondVariantOption in secondDimension) 7589 { 7590 variantId = firstVariantOption.Id + "." + secondVariantOption.Id; 7591 <td> 7592 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount) 7593 </td> 7594 7595 columnCount++; 7596 7597 productLoopCounter++; 7598 } 7599 7600 <td> 7601 <div class="qty-field js-total-qty-row-@rowCount dw-mod">0</div> 7602 </td> 7603 </tr> 7604 7605 rowCount++; 7606 } 7607 7608 @{ 7609 columnCount = 0; 7610 } 7611 7612 <tr> 7613 <td>&nbsp;</td> 7614 @foreach (VariantOption secondVariantOption in secondDimension) 7615 { 7616 <td> 7617 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div> 7618 </td> 7619 7620 columnCount++; 7621 } 7622 <td>&nbsp;</td> 7623 </tr> 7624 </tbody> 7625 } 7626 @if (groupCount == 3) 7627 { 7628 <thead> 7629 <tr> 7630 <td>&nbsp;</td> 7631 @foreach (VariantOption thirdVariantOption in thirdDimension) 7632 { 7633 <td>@thirdVariantOption.Name</td> 7634 } 7635 </tr> 7636 </thead> 7637 <tbody> 7638 @foreach (VariantOption firstVariantOption in firstDimension) 7639 { 7640 int colspan = (thirdDimension.Count + 1); 7641 7642 <tr> 7643 <td colspan="@colspan" class="u-color-light-gray--bg u-bold">@firstVariantOption.Name</td> 7644 </tr> 7645 7646 foreach (VariantOption secondVariantOption in secondDimension) 7647 { 7648 string variantId = ""; 7649 columnCount = 0; 7650 7651 <tr> 7652 <td class="u-min-w120px">@secondVariantOption.Name</td> 7653 7654 @foreach (VariantOption thirdVariantOption in thirdDimension) 7655 { 7656 variantId = firstVariantOption.Id + "." + secondVariantOption.Id + "." + thirdVariantOption.Id; 7657 7658 <td> 7659 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount) 7660 </td> 7661 7662 columnCount++; 7663 productLoopCounter++; 7664 } 7665 7666 <td> 7667 <div class="qty-field js-total-qty-row-@rowCount dw-mod">0</div> 7668 </td> 7669 </tr> 7670 rowCount++; 7671 } 7672 } 7673 7674 @{ 7675 columnCount = 0; 7676 } 7677 7678 <tr> 7679 <td>&nbsp;</td> 7680 @foreach (VariantOption thirdVariantOption in thirdDimension) 7681 { 7682 <td> 7683 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div> 7684 </td> 7685 7686 columnCount++; 7687 } 7688 <td>&nbsp;</td> 7689 </tr> 7690 </tbody> 7691 } 7692 </table> 7693 7694 <script> 7695 document.addEventListener("DOMContentLoaded", function (event) { 7696 MatrixUpdateQuantity("@settings.ProductId"); 7697 }); 7698 7699 MatrixUpdateQuantity = function (productId) { 7700 var currentMatrix = document.getElementById("VariantMatrixTable_" + productId); 7701 var allQtyFields = currentMatrix.getElementsByClassName("js-qty"); 7702 7703 var qtyRowArr = []; 7704 var qtyColumnArr = []; 7705 7706 var totalQty = 0; 7707 7708 for (var i = 0; i < allQtyFields.length; i++) { 7709 qtyRowArr[allQtyFields[i].getAttribute("data-qty-row-group")] = 0; 7710 qtyColumnArr[allQtyFields[i].getAttribute("data-qty-column-group")] = 0; 7711 } 7712 7713 for (var i = 0; i < allQtyFields.length; i++) { 7714 qtyRowArr[allQtyFields[i].getAttribute("data-qty-row-group")] += parseFloat(allQtyFields[i].value); 7715 qtyColumnArr[allQtyFields[i].getAttribute("data-qty-column-group")] += parseFloat(allQtyFields[i].value); 7716 totalQty += parseFloat(allQtyFields[i].value); 7717 } 7718 7719 //Update row counters 7720 for (var i = 0; i < qtyRowArr.length; i++) { 7721 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-row-" + i)[0]; 7722 7723 if (qtyRowArr[i] != undefined && qtyCounter != null) { 7724 var currentCount = qtyCounter.innerHTML; 7725 qtyCounter.innerHTML = qtyRowArr[i]; 7726 7727 if (currentCount != qtyCounter.innerHTML) { 7728 qtyCounter.classList.add("qty-field--active"); 7729 } 7730 } 7731 7732 } 7733 7734 //Update column counters 7735 for (var i = 0; i < qtyColumnArr.length; i++) { 7736 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-column-" + i)[0]; 7737 7738 if (qtyColumnArr[i] != undefined && qtyCounter != null) { 7739 var currentCount = qtyCounter.innerHTML; 7740 qtyCounter.innerHTML = qtyColumnArr[i]; 7741 7742 if (currentCount != qtyCounter.innerHTML) { 7743 qtyCounter.classList.add("qty-field--active"); 7744 } 7745 } 7746 } 7747 7748 if (document.getElementById("TotalQtyCount_" + productId)) { 7749 document.getElementById("TotalQtyCount_" + productId).innerHTML = totalQty; 7750 } 7751 7752 //Clean up animations 7753 setTimeout(function () { 7754 for (var i = 0; i < qtyRowArr.length; i++) { 7755 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-row-" + i)[0]; 7756 if (qtyCounter != null) { 7757 qtyCounter.classList.remove("qty-field--active"); 7758 } 7759 } 7760 for (var i = 0; i < qtyColumnArr.length; i++) { 7761 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-column-" + i)[0]; 7762 if (qtyCounter != null) { 7763 qtyCounter.classList.remove("qty-field--active"); 7764 } 7765 } 7766 }, 1000); 7767 } 7768 </script> 7769 } 7770 } 7771 7772 @helper RenderVariantMatrixQuantityField(string variantId, VariantMatrix settings, int productLoopCounter, int rowCount, int columnCount) 7773 { 7774 string loopCount = productLoopCounter.ToString(); 7775 7776 bool combinationFound = false; 7777 double stock = 0; 7778 double quantityValue = 0; 7779 string note = ""; 7780 7781 VariantProduct variantProduct = null; 7782 7783 if (settings.GetVariantProducts().TryGetValue(variantId, out variantProduct)) 7784 { 7785 stock = variantProduct.Stock; 7786 quantityValue = variantProduct.Quantity; 7787 combinationFound = true; 7788 } 7789 7790 if (combinationFound) 7791 { 7792 <input type="hidden" name="ProductLoopCounter@(loopCount)" value="@loopCount" /> 7793 <input type="hidden" name="ProductID@(loopCount)" value="@settings.ProductId" /> 7794 <input type="hidden" name="VariantID@(loopCount)" value="@variantId" /> 7795 <input type="hidden" name="CurrentNote@(loopCount)" id="CurrentNote_@(settings.ProductId)_@variantId" value="@note" /> 7796 <input type="number" name="Quantity@(loopCount)" id="Quantity_@(settings.ProductId)_@variantId" value="@quantityValue" min="0" class="js-qty u-no-margin u-full-max-width" style="width: 100%; max-width: 100%" onkeyup="MatrixUpdateQuantity('@settings.ProductId')" onmouseup="MatrixUpdateQuantity('@settings.ProductId')" data-qty-row-group="@rowCount" data-qty-column-group="@columnCount"> 7797 7798 if (stock != 0) 7799 { 7800 <small>@Translate("Stock") @stock</small> 7801 } 7802 7803 <script> 7804 var variants = '{ "ProductId" :' + '"@settings.ProductId"' + ', "VariantId": ' + '"@variantId"' +'}'; 7805 variantsCollection.push(variants); 7806 document.getElementById("Quantity_@(settings.ProductId)_@variantId").closest(".js-variants-matrix").setAttribute("data-variants-collection", "[" + variantsCollection + "]" ); 7807 </script> 7808 } 7809 else 7810 { 7811 <div class="use-btn-height" style="background-color: #a8a8a8"></div> 7812 } 7813 } 7814 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 7815 7816 @* Component *@ 7817 7818 @helper RenderAddToCart(AddToCart settings) 7819 { 7820 //set Id for quantity selector to get it's value from button 7821 if (settings.QuantitySelector != null) 7822 { 7823 if (string.IsNullOrEmpty(settings.QuantitySelector.Id)) 7824 { 7825 settings.QuantitySelector.Id = Guid.NewGuid().ToString("N"); 7826 } 7827 7828 settings.AddButton.QuantitySelectorId = settings.QuantitySelector.Id; 7829 7830 if (settings.Disabled) 7831 { 7832 settings.QuantitySelector.Disabled = true; 7833 } 7834 7835 if (string.IsNullOrEmpty(settings.QuantitySelector.Name)) 7836 { 7837 settings.QuantitySelector.Name = settings.QuantitySelector.Id; 7838 } 7839 } 7840 7841 if (settings.Disabled) 7842 { 7843 settings.AddButton.Disabled = true; 7844 } 7845 7846 settings.AddButton.CssClass += " btn--condensed"; 7847 7848 //unitsSelector 7849 if (settings.UnitSelector != null) 7850 { 7851 if (settings.Disabled) 7852 { 7853 settings.QuantitySelector.Disabled = true; 7854 } 7855 } 7856 7857 <div class="buttons-collection @settings.WrapperCssClass" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 7858 @if (settings.UnitSelector != null) 7859 { 7860 @Render(settings.UnitSelector) 7861 } 7862 @if (settings.QuantitySelector != null) 7863 { 7864 @Render(settings.QuantitySelector) 7865 } 7866 @Render(settings.AddButton) 7867 </div> 7868 } 7869 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 7870 7871 @* Component *@ 7872 7873 @helper RenderAddToCartButton(AddToCartButton settings) 7874 { 7875 if (!settings.HideTitle) 7876 { 7877 if (string.IsNullOrEmpty(settings.Title)) 7878 { 7879 if (settings.BuyForPoints) 7880 { 7881 settings.Title = Translate("Buy with points"); 7882 } 7883 else 7884 { 7885 settings.Title = Translate("Add to cart"); 7886 } 7887 } 7888 } 7889 else 7890 { 7891 settings.Title = ""; 7892 } 7893 7894 if (settings.Icon == null) 7895 { 7896 settings.Icon = new Icon(); 7897 settings.Icon.LabelPosition = Dynamicweb.Rapido.Blocks.Components.General.IconLabelPosition.After; 7898 } 7899 7900 if (string.IsNullOrEmpty(settings.Icon.Name)) 7901 { 7902 settings.Icon.Name = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue; 7903 } 7904 7905 string cartArgs = "{ " + 7906 "id: '" + settings.ProductId + "'," + 7907 (!string.IsNullOrEmpty(settings.VariantId) ? "variantId: '" + settings.VariantId + "'," : "") + 7908 (!string.IsNullOrEmpty(settings.UnitId) ? "unitId: '" + settings.UnitId + "'," : "") + 7909 (settings.BuyForPoints ? "buyForPoints: true," : "") + 7910 (!string.IsNullOrEmpty(settings.ProductInfo) ? "productInfo: " + settings.ProductInfo + "," : "") + 7911 "quantity: " + (string.IsNullOrEmpty(settings.QuantitySelectorId) ? "1" : "parseFloat(document.getElementById('" + settings.QuantitySelectorId + "').value)") + 7912 "}"; 7913 string stockValidationUrl = Dna.StockValidation.Product.GetValidationUrl(GetPageIdByNavigationTag("StockValidation"), settings.ProductId, settings.VariantId, settings.UnitId, Pageview.Area.EcomLanguageId); 7914 7915 settings.OnClick = "StockValidation.AddToCartValidation(event, " + cartArgs + ", '" + stockValidationUrl + "');" + settings.OnClick; 7916 7917 @RenderButton(settings) 7918 } 7919 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 7920 7921 @* Component *@ 7922 7923 @helper RenderUnitSelector(UnitSelector settings) 7924 { 7925 var id = settings.Id; 7926 var disabledClass = settings.Disabled ? "disabled" : ""; 7927 7928 <input type="checkbox" id="@id" class="dropdown-trigger" /> 7929 <div class="dropdown unit-selector @settings.CssClass @disabledClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 7930 <label class="dropdown__header dropdown__btn dropdown__btn--unit-selector dw-mod" for="@id">@settings.SelectedOption</label> 7931 <div class="dropdown__content dw-mod"> 7932 @settings.OptionsContent 7933 </div> 7934 <label class="dropdown-trigger-off" for="@id"></label> 7935 </div> 7936 } 7937 @using System.Reflection 7938 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 7939 7940 @* Component *@ 7941 7942 @helper RenderQuantitySelector(QuantitySelector settings) 7943 { 7944 var attributes = new Dictionary<string, string>(); 7945 7946 /*base settings*/ 7947 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 7948 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 7949 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 7950 if (settings.Disabled) { attributes.Add("disabled", "true"); } 7951 if (settings.Required) { attributes.Add("required", "true"); } 7952 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 7953 /*end*/ 7954 7955 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 7956 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 7957 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 7958 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 7959 if (settings.Max != null) { attributes.Add("max", settings.Max.ToString()); } 7960 if (settings.Min == null) { settings.Min = 1; } 7961 attributes.Add("min", settings.Min.ToString()); 7962 if (settings.Step != null && !string.IsNullOrEmpty(settings.Step.ToString())) { attributes.Add("step", settings.Step.ToString()); } 7963 if (settings.Value == null) { settings.Value = 1; } 7964 attributes.Add("value", settings.Value.ToString()); 7965 attributes.Add("type", "number"); 7966 7967 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 7968 7969 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 7970 } 7971 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 7972 7973 @using System 7974 @using System.Web 7975 @using System.Collections.Generic 7976 @using Dynamicweb.Rapido.Blocks.Extensibility 7977 @using Dynamicweb.Rapido.Blocks 7978 7979 @{ 7980 BlocksPage bottomSnippetsBlocksPage = BlocksPage.GetBlockPage("Master"); 7981 7982 Block primaryBottomSnippets = new Block() 7983 { 7984 Id = "MasterJavascriptInitializers", 7985 SortId = 100, 7986 Template = RenderPrimaryBottomSnippets() 7987 }; 7988 bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, primaryBottomSnippets); 7989 } 7990 7991 @helper RenderPrimaryBottomSnippets() { 7992 bool isWireframeMode = Model.Area.Item.GetItem("Settings").GetBoolean("WireframeMode"); 7993 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 7994 7995 if (isWireframeMode) 7996 { 7997 <script> 7998 Wireframe.Init(true); 7999 </script> 8000 } 8001 8002 8003 if (useGoogleTagManager) 8004 { 8005 <script> 8006 document.addEventListener('addToCart', function(event) { 8007 var googleImpression = event.detail.productInfo.googleImpression; 8008 dataLayer.push({ 8009 'event': 'addToCart', 8010 'ecommerce': { 8011 'currencyCode': '@Dynamicweb.Ecommerce.Services.Currencies.GetDefaultCurrency().Code', 8012 'add': { 8013 'products': [{ 8014 'name': googleImpression.name, 8015 'id': googleImpression.id, 8016 'price': googleImpression.price, 8017 'brand': googleImpression.brand, 8018 'category': googleImpression.category, 8019 'variant': googleImpression.variant, 8020 'quantity': event.detail.quantity 8021 }] 8022 } 8023 } 8024 }); 8025 }); 8026 </script> 8027 } 8028 8029 //if digitalwarehouse 8030 if (Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart")) 8031 { 8032 string cartContextId = Converter.ToString(HttpContext.Current.Application["DownloadCartContext"]); 8033 8034 if (string.IsNullOrEmpty(cartContextId)) { 8035 var moduleProps = Dynamicweb.Modules.Properties.GetParagraphModuleSettings(GetPageIdByNavigationTag("DownloadCart"), "eCom_CartV2"); 8036 var cartSettings = new Dynamicweb.Ecommerce.Cart.ModuleSettings(moduleProps); 8037 cartContextId = cartSettings.OrderContextID; 8038 HttpContext.Current.Application["DownloadCartContext"] = cartContextId; 8039 } 8040 8041 <script> 8042 let downloadCart = new DownloadCart({ 8043 cartPageId: @GetPageIdByNavigationTag("MiniCartFeed"), 8044 contextId: "@cartContextId", 8045 addButtonText: "@Translate("Add")", 8046 removeButtonText: "@Translate("Remove")" 8047 }); 8048 </script> 8049 } 8050 8051 <!--$$Javascripts--> 8052 } 8053 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 8054 @using System 8055 @using System.Web 8056 @using System.Collections.Generic 8057 @using Dynamicweb.Rapido.Blocks 8058 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 8059 @using Dynamicweb.Rapido.Blocks 8060 @using Dynamicweb.Rapido.Blocks.Extensibility 8061 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 8062 @using System.Collections.Generic 8063 @using Dynamicweb.Core 8064 @using Dynamicweb.Rapido.Blocks 8065 @using Dynamicweb.Rapido.Blocks.Components.General 8066 @using Dynamicweb.Rapido.Blocks.Extensibility 8067 @{ 8068 BlocksPage masterBlockPage = BlocksPage.GetBlockPage("Master"); 8069 masterBlockPage.RemoveBlockById("ImpersonationBar"); 8070 8071 if (Model.CurrentUser.ID > 0 && Dna.AutoImpersonate.Helpers.AmountOfUserICanSetAsSecondary > 1) 8072 { 8073 masterBlockPage.Add(MasterBlockId.MasterHeader, new Block() 8074 { 8075 Id = "RizzoImpersonationBarContainer", 8076 SortId = 5, 8077 Design = new Design() 8078 { 8079 CssClass = "center-container", 8080 RenderType = RenderType.None 8081 }, 8082 BlocksList = new List<Block>() 8083 { 8084 new Block() 8085 { 8086 Id = "RizzoImpersonationBar", 8087 SortId = 5, 8088 Design = new Design() 8089 { 8090 Size = "12", 8091 CssClass = "grid--justify-end", 8092 RenderType = RenderType.Column 8093 }, 8094 Template = RenderRizzoImpersonationBar() 8095 } 8096 } 8097 }); 8098 8099 if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request[Dna.AutoImpersonate.Constants.Parameters.RequireManaging])) 8100 { 8101 masterBlockPage.Add(MasterBlockId.MasterMain, new Block() 8102 { 8103 Id = "RizzoRequireManageAccount", 8104 SortId = 15, 8105 Design = new Design() 8106 { 8107 Size = "width-auto", 8108 HidePadding = true, 8109 CssClass = "u-color-warning--bg", 8110 RenderType = RenderType.Column 8111 }, 8112 Template = RenderRizzoRequireManageAccount() 8113 }); 8114 } 8115 } 8116 } 8117 @helper RenderRizzoImpersonationBar() 8118 { 8119 bool isManagingAccount = Model.CurrentSecondaryUser.ID > 0; 8120 string switchAccountUrl = string.Format("Default.aspx?Id={0}", GetPageIdByNavigationTag(Dna.AutoImpersonate.Constants.PageProperties.NavigationTags.Impersonation)); 8121 string userName = Model.CurrentUser.Name.IsNotNullOrEmpty() ? Model.CurrentUser.Name : Model.CurrentUser.FirstName.IsNotNullOrEmpty() || Model.CurrentUser.LastName.IsNotNullOrEmpty() ? string.Format("{0}{1}", Model.CurrentUser.FirstName, Model.CurrentUser.LastName) : Model.CurrentUser.UserName; 8122 8123 <div class="u-font-size--sm"> 8124 @string.Format("{0}: {1}", isManagingAccount ? Translate("Managing Account") : Translate("Welcome Back"), userName) 8125 @Render(new Link() 8126 { 8127 Href = switchAccountUrl, 8128 CssClass = "u-margin-left", 8129 ButtonLayout = ButtonLayout.None, 8130 Title = Translate("Manage Account"), 8131 Icon = new Icon() 8132 { 8133 Prefix = "fas", 8134 Name = "fa-address-book", 8135 LabelPosition = IconLabelPosition.After 8136 } 8137 }) 8138 @Render(new Link() 8139 { 8140 Href = "/Admin/Public/ExtranetLogoff.aspx", 8141 CssClass = "u-margin-left", 8142 ButtonLayout = ButtonLayout.None, 8143 Title = Translate("Logout"), 8144 Icon = new Icon() 8145 { 8146 Prefix = "fas", 8147 Name = "fa-sign-out", 8148 LabelPosition = IconLabelPosition.After 8149 } 8150 }) 8151 </div> 8152 } 8153 8154 @helper RenderRizzoRequireManageAccount() 8155 { 8156 <div class="center-container"> 8157 <div class="grid"> 8158 <div class="grid--align-self-center grid__col-x"> 8159 <div class="grid-cell u-bold"> 8160 @Render(new Icon 8161 { 8162 Prefix = "fas", 8163 Name = "fa-exclamation-triangle", 8164 Label = Translate("Please select an account to manage before continuing"), 8165 LabelPosition = IconLabelPosition.After 8166 }) 8167 </div> 8168 </div> 8169 </div> 8170 </div> 8171 } 8172 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 8173 @using Dynamicweb.Rapido.Blocks 8174 8175 @{ 8176 BlocksPage.GetBlockPage("Master").GetBlockById("MiniCartOrderLinesList").Template = RenderRizzoMiniCartOrderLinesList(); 8177 } 8178 8179 @helper RenderRizzoMiniCartOrderLinesList() 8180 { 8181 <text> 8182 {{#OrderLines}} 8183 {{#ifCond template "===" "CartOrderline"}} 8184 {{>MiniCartOrderline}} 8185 {{/ifCond}} 8186 {{#ifCond template "===" "CartOrderlineMobile"}} 8187 {{>MiniCartOrderline}}t 8188 {{/ifCond}} 8189 {{#ifCond template "===" "CartOrderlineDiscount"}} 8190 {{>MiniCartOrderlineDiscount}} 8191 {{/ifCond}} 8192 {{/OrderLines}} 8193 {{#OrderLinesOutOfStock}} 8194 {{#ifCond template "===" "CartOrderline"}} 8195 {{>MiniCartOrderline}} 8196 {{/ifCond}} 8197 {{#ifCond template "===" "CartOrderlineMobile"}} 8198 {{>MiniCartOrderline}} 8199 {{/ifCond}} 8200 {{#ifCond template "===" "CartOrderlineDiscount"}} 8201 {{>MiniCartOrderlineDiscount}} 8202 {{/ifCond}} 8203 {{/OrderLinesOutOfStock}} 8204 </text> 8205 } 8206 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 8207 @using System.Collections.Generic 8208 @using Dynamicweb.Rapido.Blocks.Components.General 8209 @using Dynamicweb.Rapido.Blocks.Extensibility 8210 @using Dynamicweb.Rapido.Blocks 8211 @using Dynamicweb.Core 8212 @functions{ 8213 BlocksPage rizzoErpConnectionBlocksPage = BlocksPage.GetBlockPage("Master"); 8214 } 8215 @{ 8216 var webServiceConnectionAvailableTag = Pageview.GlobalTags.GetTagByName("Global:LiveIntegration.IsWebServiceConnectionAvailable"); 8217 if (webServiceConnectionAvailableTag != null && !Converter.ToBoolean(webServiceConnectionAvailableTag.Value)) 8218 { 8219 rizzoErpConnectionBlocksPage.Add(MasterBlockId.MasterBottomSnippets, new Block() 8220 { 8221 Id = "RizzoNoErpConnection", 8222 SortId = 0, 8223 Template = RenderErpDownAlertNotification() 8224 }); 8225 } 8226 } 8227 @helper RenderErpDownAlertNotification() 8228 { 8229 <script> 8230 document.addEventListener("DOMContentLoaded", function () { 8231 @Render(new Dna.Rizzo.Components.AlertNotification 8232 { 8233 Title = Translate("Connection down"), 8234 Message = Translate("We are experiencing some connectivity issues. Not all features may be available to you."), 8235 Theme = Dna.Rizzo.Components.AlertNotificationTheme.Theme.Warning, 8236 Position = Dna.Rizzo.Components.AlertNotificationPosition.Position.TopLeft, 8237 ShowDuration = 0, 8238 DisplayCloseButton = true, 8239 CloseOnClick = true 8240 }) 8241 }); 8242 </script> 8243 } 8244 8245 @{ 8246 var rizzoReferencesBlocksPage = BlocksPage.GetBlockPage("Master"); 8247 var masterScriptRizzoReferences = new Block() 8248 { 8249 Id = "MasterScriptRizzoReferences", 8250 SortId = 2, 8251 Template = RenderMasterScriptRizzoReferences() 8252 }; 8253 rizzoReferencesBlocksPage.Add(MasterBlockId.MasterReferences, masterScriptRizzoReferences); 8254 } 8255 @helper RenderMasterScriptRizzoReferences() { 8256 if (Model.Area.Item.GetItem("Rizzo").GetBoolean("UseRizzoJavascript")) 8257 { 8258 var minify = Model.Area.Item.GetItem("Rizzo").GetBoolean("MinifyJavascript");; 8259 const string folderName = "rizzo"; 8260 var rizzoBundle = Dna.Optimizer.Renderer.RenderScripts($"/Files/Templates/Designs/Rapido/js/{folderName}", $"-{folderName}-scripts", new List<string>(), new List<string>(), minify, false, false); 8261 <script src="@rizzoBundle"></script> 8262 } 8263 } 8264 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 8265 @using Dynamicweb.Rapido.Blocks 8266 @using Dynamicweb.Rapido.Blocks.Extensibility 8267 @{ 8268 var rizzoPackagesReferencesBlocksPage = BlocksPage.GetBlockPage("Master"); 8269 var masterScriptRizzoPackagesReferences = new Block() 8270 { 8271 Id = "MasterScriptRizzoPackagesReferences", 8272 SortId = 3, 8273 Template = RenderMasterScriptRizzoPackagesReferences() 8274 }; 8275 rizzoPackagesReferencesBlocksPage.Add(MasterBlockId.MasterReferences, masterScriptRizzoPackagesReferences); 8276 } 8277 @helper RenderMasterScriptRizzoPackagesReferences() { 8278 if (Model.Area.Item.GetItem("RizzoPackages").GetBoolean("UseRizzoJavascript")) 8279 { 8280 var minify = Model.Area.Item.GetItem("Rizzo").GetBoolean("MinifyJavascript");; 8281 const string folderName = "rizzoPackages"; 8282 var rizzoPackagesBundle = Dna.Optimizer.Renderer.RenderScripts($"/Files/Templates/Designs/Rapido/js/{folderName}", $"-{folderName}-scripts", new List<string>(), new List<string>(), minify, false, false); 8283 <script src="@rizzoPackagesBundle"></script> 8284 } 8285 } 8286 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 8287 @using Dynamicweb.Rapido.Blocks 8288 8289 @{ 8290 var miniCartBlocksPageCustom = BlocksPage.GetBlockPage("Master"); 8291 miniCartBlocksPageCustom.GetBlockById("MiniCartOrderLinesList").Template = RenderCustomMiniCartOrderLinesList(); 8292 miniCartBlocksPageCustom.GetBlockById("MiniCartTotal").Template = RenderCustomMiniCartTotal(); 8293 8294 if (orderlinesView == "table") 8295 { 8296 miniCartBlocksPageCustom.GetBlockById("OrderlinesScriptTemplates").Template = RenderCustomMiniCartScriptsTableTemplates(); 8297 } 8298 } 8299 8300 @helper RenderCustomMiniCartOrderLinesList() 8301 { 8302 <text> 8303 @*START CUSTOM CODE*@ 8304 {{#OrderLines}} 8305 {{#ifCond template "===" "CartOrderline"}} 8306 {{>CustomMiniCartOrderline}} 8307 {{/ifCond}} 8308 {{#ifCond template "===" "CartOrderlineMobile"}} 8309 {{>CustomMiniCartOrderline}} 8310 {{/ifCond}} 8311 {{/OrderLines}} 8312 {{>CustomMiniCartOrderDiscount}} 8313 @*END CUSTOM CODE*@ 8314 </text> 8315 } 8316 8317 @helper RenderCustomMiniCartScriptsTableTemplates() 8318 { 8319 var googleAnalyticsKeys = Pageview.AreaSettings.GetItem("Custom").GetItem("CustomSettings").GetString("GoogleAnalyticsKey"); 8320 8321 <script id="CustomMiniCartOrderline" type="text/x-template"> 8322 {{#unless isEmpty}} 8323 <tr onload="{{addToCartGoogleAnalytics}};"> 8324 <td class="u-w60px"><a href="{{link}}" class="u-no-padding {{hideimage}}"><img src="/Admin/Public/GetImage.ashx?width=50&height=50&crop=5&Compression=75&image={{image}}" alt="{{name}}" title="{{name}}"></a></td> 8325 <td class="u-va-middle"> 8326 <a href="{{link}}" class="mini-cart-orderline__name" title="{{name}}">{{name}}</a> 8327 {{#if variantname}} 8328 <a href="{{link}}" class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{variantname}}</a> 8329 {{/if}} 8330 {{#if unitname}} 8331 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{unitname}}</div> 8332 {{/if}} 8333 </td> 8334 <td class="u-ta-right u-va-middle">{{quantity}}</td> 8335 <td class="u-ta-right u-va-middle"> 8336 {{#if pointsTotal}} 8337 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 8338 {{else}} 8339 {{totalprice}} 8340 {{/if}} 8341 </td> 8342 </tr> 8343 {{/unless}} 8344 </script> 8345 8346 /*START CUSTOM CODE*/ 8347 <script id="CustomMiniCartOrderDiscount" type="text/x-template"> 8348 {{#if totalOrderLineDiscount}} 8349 <tr class="table__row--no-border"> 8350 <td class="u-w60px">&nbsp;</td> 8351 <td><div class="mini-cart-orderline__name dw-mod">@Translate("Total discount")</div></td> 8352 <td class="u-ta-right">&nbsp;</td> 8353 <td class="u-ta-right">{{totalOrderLineDiscount}}</td> 8354 </tr> 8355 {{/if}} 8356 </script> 8357 /*END CUSTOM CODE*/ 8358 } 8359 8360 @helper RenderCustomMiniCartTotal() 8361 { 8362 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 8363 8364 <div class="mini-cart-totals grid u-border-top u-margin-top dw-mod"> 8365 <div class="grid__col-6">@Translate("Total")</div> 8366 <div class="grid__col-6 grid--align-end"> 8367 <div> 8368 @if (pointShop) 8369 { 8370 <span class="u-color--loyalty-points">{{pointsUsedInCart}}</span> 8371 @Translate("points") 8372 } 8373 else 8374 { 8375 <text>{{totalprice}}</text> 8376 } 8377 </div> 8378 </div> 8379 </div> 8380 8381 @*START CUSTOM CODE*@ 8382 <div class="dw-mod grid__col-12 u-no-margin u-margin-bottom"> 8383 {{#if totalCCDiscount}} 8384 <div class="dw-mod">@Translate("As a Choral Club member, you saved "){{totalCCDiscount}}</div> 8385 {{else}} 8386 <div class="dw-mod">@Translate("Become a subscriber and get up to 10% discount on all purchases ")</div> 8387 {{/if}} 8388 </div> 8389 @*END CUSTOM CODE*@ 8390 } 8391 8392 8393 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 8394 8395 @using System 8396 @using System.Web 8397 @using Dynamicweb.Rapido.Blocks.Extensibility 8398 @using Dynamicweb.Rapido.Blocks 8399 @using System.Reflection 8400 @using Dynamicweb.Frontend.Devices 8401 @functions { 8402 public class LorenzSearchConfiguration : SearchConfiguration 8403 { 8404 public string recommendedFeedId { get; set; } 8405 public string composersFeedId { get; set; } 8406 public string composersSearchMoreId { get; set; } 8407 8408 public LorenzSearchConfiguration() 8409 { 8410 recommendedFeedId = ""; 8411 composersFeedId = ""; 8412 composersSearchMoreId = ""; 8413 } 8414 } 8415 } 8416 @{ 8417 var customSearchMasterBlock = BlocksPage.GetBlockPage("Master"); 8418 8419 if (customSearchMasterBlock.GetBlockById("MasterSearchBar") != null) 8420 { 8421 customSearchMasterBlock.GetBlockById("MasterSearchBar").Template = CustomRenderSearch("bar"); 8422 } 8423 if (customSearchMasterBlock.GetBlockById("MasterDesktopActionsMenuSearch") != null) 8424 { 8425 customSearchMasterBlock.GetBlockById("MasterDesktopActionsMenuSearch").Template = CustomRenderSearch(); 8426 } 8427 if (customSearchMasterBlock.GetBlockById("MobileHeaderSearchBar") != null) 8428 { 8429 customSearchMasterBlock.GetBlockById("MobileHeaderSearchBar").Template = CustomRenderMobileTopSearchBar(); 8430 } 8431 8432 customSearchMasterBlock.Add(MasterBlockId.MasterBottomSnippets, new Block() 8433 { 8434 Id = "CustomMasterSearchScriptTemplates", 8435 SortId = 2, 8436 Template = CustomRenderSearchScriptTemplates() 8437 }); 8438 8439 } 8440 8441 @helper CustomRenderSearchScriptTemplates() 8442 { 8443 var maxWidth = Pageview.Device == DeviceType.Desktop ? "u-max-w180px" : "u-max-w220px"; 8444 <script id="ProductsSearchTemplate" type="text/x-template"> 8445 {{#each .}} 8446 {{#Product}} 8447 {{#ifCond template "!==" "SearchMore"}} 8448 <li class="dropdown__item dropdown__item--seperator dw-mod"> 8449 <div> 8450 <a href="{{#if link}}{{link}}{{else}}/Default.aspx?ID={{id}}{{/if}}" class="js-typeahead-link u-pull--left u-color-inherit"> 8451 <div class="u-margin-right u-pull--left"><i class="{{icon}} u-w20px u-ta-center"></i></div> 8452 <div class="u-pull--left"> 8453 <div class="u-bold u-truncate-text @maxWidth js-typeahead-name">{{name}}</div> 8454 </div> 8455 </a> 8456 </div> 8457 </li> 8458 {{/ifCond}} 8459 {{#ifCond template "===" "SearchMore"}} 8460 {{>SearchMoreProducts}} 8461 {{/ifCond}} 8462 {{/Product}} 8463 {{else}} 8464 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod"> 8465 @Translate("Your search gave 0 results") 8466 </li> 8467 {{/each}} 8468 </script> 8469 8470 <script id="CustomSearchTemplate" type="text/x-template"> 8471 {{#each .}} 8472 {{#ifCond template "!==" "SearchMore"}} 8473 <li class="dropdown__item dropdown__item--seperator dw-mod"> 8474 <div> 8475 <a href="{{#if url}}{{url}}{{else}}/Default.aspx?ID={{id}}{{/if}}" class="js-typeahead-link u-pull--left u-color-inherit"> 8476 <div class="u-margin-right u-pull--left"><i class="{{icon}} u-w20px u-ta-center"></i></div> 8477 <div class="u-pull--left"> 8478 <div class="u-bold u-truncate-text @maxWidth js-typeahead-name">{{name}}</div> 8479 </div> 8480 </a> 8481 </div> 8482 </li> 8483 {{/ifCond}} 8484 {{#ifCond template "===" "SearchMore"}} 8485 {{>CustomSearchMorePages}} 8486 {{/ifCond}} 8487 {{else}} 8488 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod"> 8489 @Translate("Your search gave 0 results") 8490 </li> 8491 {{/each}} 8492 </script> 8493 8494 <script id="ProductsTemplate" type="text/x-template"> 8495 @if (Pageview.Device == DeviceType.Desktop) { 8496 <div class="dropdown__column-header">@Translate("Products")</div> 8497 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod"> 8498 {{>ProductsSearchTemplate}} 8499 </ul> 8500 } 8501 else 8502 { 8503 <input type="checkbox" id="productsContentTrigger" class="expand-trigger js-remember-state" checked data-expand="productsContentTrigger" /> 8504 <div class="expand-container"> 8505 <label class="dropdown__column-header expand-container__btn" for="productsContentTrigger">@Translate("Products")</label> 8506 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod" data-trigger="productsContentTrigger"> 8507 {{>ProductsSearchTemplate}} 8508 </ul> 8509 </div> 8510 } 8511 </script> 8512 8513 <script id="RecommendedSearchTemplateWrap" type="text/x-template"> 8514 @if (Pageview.Device != DeviceType.Mobile) 8515 { 8516 <div class="dropdown__column-header">@Translate("Recommended")</div> 8517 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod"> 8518 {{>CustomSearchTemplate}} 8519 </ul> 8520 } 8521 else 8522 { 8523 <input type="checkbox" id="recommendedContentTrigger" class="expand-trigger js-remember-state" data-expand="recommendedContentTrigger" /> 8524 <div class="expand-container"> 8525 <label class="dropdown__column-header expand-container__btn" for="recommendedContentTrigger">@Translate("Recommended")</label> 8526 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod" data-trigger="recommendedContentTrigger"> 8527 {{>CustomSearchTemplate}} 8528 </ul> 8529 </div> 8530 } 8531 </script> 8532 8533 <script id="ComposersSearchTemplateWrap" type="text/x-template"> 8534 @if (Pageview.Device != DeviceType.Mobile) 8535 { 8536 <div class="dropdown__column-header">@Translate("Composers")</div> 8537 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod"> 8538 {{>CustomSearchTemplate}} 8539 </ul> 8540 } 8541 else 8542 { 8543 <input type="checkbox" id="composersContentTrigger" class="expand-trigger js-remember-state" data-expand="composersContentTrigger" /> 8544 <div class="expand-container"> 8545 <label class="dropdown__column-header expand-container__btn" for="composersContentTrigger">@Translate("Composers")</label> 8546 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod" data-trigger="composersContentTrigger"> 8547 {{>CustomSearchTemplate}} 8548 </ul> 8549 </div> 8550 } 8551 </script> 8552 8553 <script id="PagesSearchTemplateWrap" type="text/x-template"> 8554 <div class="dropdown__column-header">@Translate("Pages")</div> 8555 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod"> 8556 {{>CustomSearchTemplate}} 8557 </ul> 8558 </script> 8559 8560 <script id="CustomSearchMorePages" type="text/x-template"> 8561 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 8562 <a href="/Default.aspx?ID={{id}}&{{searchParameterFilter}}={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 8563 @Translate("View all") 8564 </a> 8565 </li> 8566 </script> 8567 8568 // Expand.js bug fix 8569 <script> 8570 var ajaxContainer = document.getElementsByClassName("js-handlebars-root"); 8571 if (ajaxContainer.length > 0) { 8572 for (var i = 0; i < ajaxContainer.length; i++) { 8573 ajaxContainer[i].addEventListener('contentLoaded', function (e) { 8574 Expand.initExpandTriggers(this); 8575 }, false); 8576 } 8577 } 8578 </script> 8579 8580 } 8581 8582 @helper CustomRenderSearch(string type = "mini-search") 8583 { 8584 string productsPageId = Converter.ToString(GetPageIdByNavigationTag("ProductsPageSearchFeed")); 8585 string contentSearchPageLink = GetPageIdByNavigationTag("ProductsPage") + "&Areaid=" + Model.Area.ID; 8586 string searchType = Model.Area.Item.GetItem("Layout").GetList("TopSearch") != null ? Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue : "productSearch"; 8587 8588 LorenzSearchConfiguration lorenzSearchConfiguration = null; 8589 8590 switch (searchType) { 8591 case "contentSearch": 8592 lorenzSearchConfiguration = new LorenzSearchConfiguration() { 8593 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true", 8594 resultPageLink = contentSearchPageLink, 8595 searchPlaceholder = Translate("Search page"), 8596 groupsFeedId = 0, 8597 searchType = "content-search", 8598 searchTemplate = "SearchPagesTemplate", 8599 showGroups = false 8600 }; 8601 break; 8602 case "combinedSearch": 8603 lorenzSearchConfiguration = new LorenzSearchConfiguration() { 8604 searchFeedId = productsPageId + "&feed=true", 8605 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true", 8606 resultPageLink = contentSearchPageLink, 8607 searchPlaceholder = Translate("Search products or pages"), 8608 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"), 8609 searchType = "combined-search", 8610 searchTemplate = "SearchProductsTemplateWrap", 8611 searchContentTemplate = "SearchPagesTemplateWrap", 8612 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector") 8613 }; 8614 break; 8615 default: //productSearch 8616 lorenzSearchConfiguration = new LorenzSearchConfiguration() { 8617 resultPageLink = contentSearchPageLink, 8618 searchFeedId = productsPageId + "&feed=true", 8619 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"), 8620 searchPlaceholder = Translate("Search products"), 8621 searchTemplate = "SearchProductsTemplate", 8622 searchType = "product-search", 8623 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector") 8624 }; 8625 break; 8626 } 8627 lorenzSearchConfiguration.searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; 8628 lorenzSearchConfiguration.recommendedFeedId = GetPageIdByNavigationTag("RecommendedSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 8629 lorenzSearchConfiguration.composersFeedId = GetPageIdByNavigationTag("ComposersSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 8630 lorenzSearchConfiguration.composersSearchMoreId = GetPageIdByNavigationTag("Composers").ToString(); 8631 8632 if (type == "mini-search") { 8633 @CustomRenderMiniSearch(lorenzSearchConfiguration) 8634 } else { 8635 @CustomRenderSearchBar(lorenzSearchConfiguration) 8636 } 8637 } 8638 8639 @helper CustomRenderSearchBar(LorenzSearchConfiguration options) 8640 { 8641 bool isLiveProductInfoActive = Dynamicweb.Core.Converter.ToBoolean(Pageview.GlobalTags.GetTagByName("Global:LiveIntegration.IsLazyLoadingForProductInfoEnabled")?.Value ?? string.Empty); 8642 8643 <div class="typeahead typeahead--centered u-color-inherit js-typeahead dw-mod" id="ProductSearchBar" 8644 data-page-size="7" 8645 data-search-feed-id="@options.searchFeedId" 8646 data-search-second-feed-id="@options.searchSecondFeedId" 8647 data-result-page-id="@options.resultPageLink" 8648 data-groups-page-id="@options.groupsFeedId" 8649 data-search-type="@options.searchType" 8650 data-live-price="@(isLiveProductInfoActive.ToString().ToLowerInvariant())" 8651 data-recommended-search-feed-id="@options.recommendedFeedId" 8652 data-composers-search-feed-id="@options.composersFeedId" 8653 data-composers-search-more-id="@options.composersSearchMoreId"> 8654 @if (options.showGroups) 8655 { 8656 <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> 8657 <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> 8658 } 8659 <div class="typeahead-search-field"> 8660 <input type="text" class="u-no-margin u-full-width u-full-height js-typeahead-search-field" placeholder="@options.searchPlaceholder" value="@options.searchValue"> 8661 8662 <div class="dropdown dropdown--absolute-position dropdown--combined grid"> 8663 <div class="js-typeahead-search-content grid__col-sm-3 grid__col--bleed-y js-typeahead-results-wrapper" id="ProductSearchBarContent" data-template="ProductsTemplate" data-init-onload="false"></div> 8664 <div class="js-typeahead-additional-search-content grid__col-sm-3 grid__col--bleed-y js-typeahead-results-wrapper" id="ContentSearchBarContent" data-template="PagesSearchTemplateWrap" data-init-onload="false"></div> 8665 <div class="js-typeahead-recommended-search-content grid__col-sm-3 grid__col--bleed-y js-typeahead-results-wrapper" id="RecommendedSearchBarContent" data-template="RecommendedSearchTemplateWrap" data-init-onload="false"></div> 8666 <div class="js-typeahead-composers-search-content grid__col-sm-3 grid__col--bleed-y js-typeahead-results-wrapper" id="ComposersSearchBarContent" data-template="ComposersSearchTemplateWrap" data-init-onload="false"></div> 8667 </div> 8668 </div> 8669 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod js-typeahead-enter-btn" title="@Translate("Search")"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue"></i></button> 8670 </div> 8671 } 8672 8673 @helper CustomRenderMiniSearch(LorenzSearchConfiguration options) 8674 { 8675 // We don't want to customize Mobile typeahed 8676 // So we create a new instance of base (SearchConfiguration) and populate it's properties with the ones from LorenzSearchConfiguration 8677 var baseOptions = new SearchConfiguration(); 8678 8679 foreach (PropertyInfo propertyInfo in baseOptions.GetType().GetProperties()) 8680 { 8681 propertyInfo.SetValue(baseOptions, propertyInfo.GetValue(options)); 8682 } 8683 8684 @RenderMiniSearch(baseOptions) 8685 } 8686 8687 @helper CustomRenderMobileTopSearchBar() 8688 { 8689 string searchFeedId = ""; 8690 string searchSecondFeedId = ""; 8691 int groupsFeedId; 8692 int productsPageId = GetPageIdByNavigationTag("ProductsPageSearchFeed"); 8693 string contentSearchPageLink = GetPageIdByNavigationTag("ProductsPage") + "&Areaid=" + Model.Area.ID; 8694 string resultPageLink; 8695 string searchPlaceholder; 8696 string searchType = "product-search"; 8697 string searchTemplate; 8698 string searchContentTemplate = ""; 8699 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; 8700 bool showGroups = true; 8701 8702 LorenzSearchConfiguration lorenzSearchConfiguration = null; 8703 8704 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch") 8705 { 8706 lorenzSearchConfiguration = new LorenzSearchConfiguration() 8707 { 8708 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true", 8709 resultPageLink = contentSearchPageLink, 8710 searchPlaceholder = Translate("Search page"), 8711 groupsFeedId = 0, 8712 searchType = "content-search", 8713 searchTemplate = "SearchPagesTemplate", 8714 showGroups = false 8715 }; 8716 } 8717 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch") 8718 { 8719 lorenzSearchConfiguration = new LorenzSearchConfiguration() 8720 { 8721 searchFeedId = productsPageId + "&feed=true", 8722 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true", 8723 resultPageLink = contentSearchPageLink, 8724 searchPlaceholder = Translate("Search products or pages"), 8725 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"), 8726 searchType = "combined-search", 8727 searchTemplate = "SearchProductsTemplateWrap", 8728 searchContentTemplate = "SearchPagesTemplateWrap", 8729 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector") 8730 }; 8731 } 8732 else 8733 { 8734 lorenzSearchConfiguration = new LorenzSearchConfiguration() 8735 { 8736 resultPageLink = contentSearchPageLink, 8737 searchFeedId = productsPageId + "&feed=true", 8738 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"), 8739 searchPlaceholder = Translate("Search products"), 8740 searchTemplate = "SearchProductsTemplate", 8741 searchType = "product-search", 8742 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector") 8743 }; 8744 } 8745 lorenzSearchConfiguration.searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; 8746 lorenzSearchConfiguration.recommendedFeedId = GetPageIdByNavigationTag("RecommendedSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 8747 lorenzSearchConfiguration.composersFeedId = GetPageIdByNavigationTag("ComposersSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 8748 lorenzSearchConfiguration.composersSearchMoreId = GetPageIdByNavigationTag("Composers").ToString(); 8749 8750 @CustomRenderMobileSearch(lorenzSearchConfiguration) 8751 } 8752 8753 @helper CustomRenderMobileSearch(LorenzSearchConfiguration options) 8754 { 8755 bool isLiveProductInfoActive = Dynamicweb.Core.Converter.ToBoolean(Pageview.GlobalTags.GetTagByName("Global:LiveIntegration.IsLazyLoadingForProductInfoEnabled")?.Value ?? string.Empty); 8756 8757 <input type="checkbox" id="MobileSearchTrigger" class="mobile-search-trigger" /> 8758 <div class="main-navigation-mobile typeahead-mobile dw-mod"> 8759 <div class="center-container top-container__center-container dw-mod"> 8760 <div class="grid"> 8761 <div class="grid__col-auto"> 8762 <div class="typeahead-mobile__search-field dw-mod js-typeahead" id="MobileProductSearch" 8763 data-page-size="@(options.searchType == "combined-search" ? 4 : 8)" 8764 data-search-feed-id="@options.searchFeedId" 8765 data-search-second-feed-id="@options.searchSecondFeedId" 8766 data-result-page-id="@options.resultPageLink" 8767 data-groups-page-id="@options.groupsFeedId" 8768 data-search-type="@options.searchType" 8769 data-live-price="@(isLiveProductInfoActive.ToString().ToLowerInvariant())" 8770 data-recommended-search-feed-id="@options.recommendedFeedId" 8771 data-composers-search-feed-id="@options.composersFeedId" 8772 data-composers-search-more-id="@options.composersSearchMoreId"> 8773 <input type="text" class="js-typeahead-search-field u-w160px u-no-margin" placeholder="@options.searchPlaceholder" value="@options.searchValue"> 8774 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--combined-mobile grid"> 8775 <div class="js-handlebars-root js-typeahead-search-content grid__col-sm-3 grid__col--bleed-y js-typeahead-results-wrapper" id="ProductSearchBarContent" data-template="ProductsTemplate" data-init-onload="false"></div> 8776 <div class="js-handlebars-root js-typeahead-recommended-search-content grid__col-sm-3 grid__col--bleed-y js-typeahead-results-wrapper" id="RecommendedSearchBarContent" data-template="RecommendedSearchTemplateWrap" data-init-onload="false"></div> 8777 <div class="js-handlebars-root js-typeahead-composers-search-content grid__col-sm-3 grid__col--bleed-y js-typeahead-results-wrapper" id="ComposersSearchBarContent" data-template="ComposersSearchTemplateWrap" data-init-onload="false"></div> 8778 </div> 8779 <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> 8780 </div> 8781 </div> 8782 <div class="grid__col-auto-width"> 8783 <ul class="menu dw-mod"> 8784 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 8785 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> 8786 <i class="fas fa-times fa-1_5x"></i> 8787 </label> 8788 </li> 8789 </ul> 8790 </div> 8791 </div> 8792 </div> 8793 </div> 8794 } 8795 8796 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 8797 @using System 8798 @using System.Collections.Generic 8799 @using Dynamicweb.Rapido.Blocks 8800 @using Dynamicweb.Rapido.Blocks.Components.General 8801 8802 @functions { 8803 BlocksPage footerBlocksCustomPage = BlocksPage.GetBlockPage("Master"); 8804 } 8805 8806 @{ 8807 footerBlocksCustomPage.GetBlockById("MasterFooterNewsletterSignUp").Template = RenderCustomFooterNewsletterSignUp(); 8808 footerBlocksCustomPage.GetBlockById("MasterTopSnippets")?.Add(new Block 8809 { 8810 Id = "NewsletterModal", 8811 SortId = 20, 8812 Component = new Modal 8813 { 8814 Id = "SubscribeToNewsletter", 8815 Width = ModalWidth.Lg, 8816 BodyText = Convert.ToString(Render(new Icon {Prefix = "fas", Name = "fa-circle-notch fa-spin"})) 8817 }, 8818 Template = RenderCustomScripts() 8819 }); 8820 } 8821 8822 @helper RenderCustomFooterNewsletterSignUp() 8823 { 8824 string newsletterSignUpPageId = GetPageIdByNavigationTag("NewsletterSignUp").ToString(); 8825 string manageSubscriptionsPageId = GetPageIdByNavigationTag("ManageSubscriptions").ToString(); 8826 Form form = new Form { Action = "/Default.aspx", Method = FormMethod.Get, Enctype = FormEnctype.multipart }; 8827 8828 form.Add(new HiddenField { Name = "ID", Value = Pageview.User != null ? manageSubscriptionsPageId : newsletterSignUpPageId }); 8829 form.Add(new Text { Content = "<p>" + Translate("Sign up if you would like to receive occasional treats from us") + "</p>" }); 8830 form.Add(new TextField { 8831 /*START CUSTOM CODE*/ 8832 Id = "UserManagement_Form_Email", Name = "UserManagement_Form_Email", Placeholder = Translate("Your email address"), 8833 Type = TextFieldType.Email, 8834 ActionButton = new Button { 8835 ButtonType = ButtonType.Submit, Id="Submitter", Title = Translate 8836 ("Go"), OnClick = "Buttons.LockButton(event)", CssClass = "btn--condensed newsletter--submitter" 8837 } 8838 /*END CUSTOM CODE*/ 8839 }); 8840 8841 <h3 class="footer__heading dw-mod">@Translate("Mailing list")</h3> 8842 <div class="footer__content dw-mod"> 8843 @Render(form) 8844 </div> 8845 } 8846 8847 @helper RenderCustomScripts() 8848 { 8849 var emailErrorField = Translate("Email cannot be empty"); 8850 var optionsErrorField = Translate("Select at least one option"); 8851 8852 <script> 8853 var emailErrorField = "@emailErrorField"; 8854 var optionsErrorField = "@optionsErrorField"; 8855 </script> 8856 } 8857 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 8858 @using Dynamicweb.Rapido.Blocks 8859 @{ 8860 Block formsInfoScript = new Block 8861 { 8862 Id = "FormsInfoScript", 8863 Template = RenderFormsInfoScript() 8864 }; 8865 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", formsInfoScript); 8866 } 8867 8868 @helper RenderFormsInfoScript() 8869 { 8870 var requiredFieldsTranslate = Translate("All required fields are marked with *"); 8871 var ecomCountryCode = Pageview.Area.EcomCountryCode; 8872 var nothingSelectedTranslate = Translate("Nothing selected"); 8873 8874 <script> 8875 document.addEventListener('DOMContentLoaded', function () { 8876 Forms.Init('@requiredFieldsTranslate', '@ecomCountryCode', '@nothingSelectedTranslate'); 8877 8878 const manageAddressModal = document.querySelector("#ManageAddressModal .modal__body"); 8879 if (isElementNotNull(manageAddressModal)) { 8880 manageAddressModal.addEventListener('DOMNodeInserted', function () { 8881 if (isElementNotNull(manageAddressModal)) { 8882 Forms.Init('@requiredFieldsTranslate', '@ecomCountryCode', '@nothingSelectedTranslate'); 8883 } 8884 }) 8885 } 8886 }); 8887 </script> 8888 } 8889 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 8890 @using Dynamicweb.Rapido.Blocks 8891 @using Dynamicweb.Rapido.Blocks.Components.General 8892 @{ 8893 BlocksPage videoModalBlocksPage = BlocksPage.GetBlockPage("Master"); 8894 8895 videoModalBlocksPage.GetBlockById("MasterTopSnippets")?.Add(new Block 8896 { 8897 Id = "ViewVideoModal", 8898 SortId = 20, 8899 Component = new Modal 8900 { 8901 Id = "Video", 8902 Width = ModalWidth.Lg, 8903 Height = ModalHeight.Md, 8904 BodyTemplate = RenderVideoModal() 8905 } 8906 }); 8907 } 8908 8909 @helper RenderVideoModal() 8910 { 8911 <div id="player"></div> 8912 } 8913 8914 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 8915 @using System 8916 @using Dynamicweb.Rapido.Blocks 8917 @using Dynamicweb.Rapido.Blocks.Components.General 8918 @{ 8919 var passwordProtectedModalBlocksPage = BlocksPage.GetBlockPage("Master"); 8920 var password = Dynamicweb.Context.Current.Request["password"]; 8921 password = password != null ? password : string.Empty; 8922 8923 if (Pageview.Page.Protect && !password.Equals(Pageview.Page.Password,StringComparison.InvariantCulture)) 8924 { 8925 passwordProtectedModalBlocksPage.GetBlockById("MasterTopSnippets")?.Add(new Block 8926 { 8927 Id = "PasswordProtectedModal", 8928 SortId = 30, 8929 Component = new Modal 8930 { 8931 Id = "PasswordProtected", 8932 Width = ModalWidth.Md, 8933 BodyTemplate = RenderPasswordProtectedModal() 8934 } 8935 }); 8936 } 8937 } 8938 8939 @helper RenderPasswordProtectedModal() 8940 { 8941 var pageUrl = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(Pageview.Page.ID); 8942 var form = new Form { Action = pageUrl, Method = FormMethod.Get}; 8943 form.Add(new TextField {Id = "password", Name = "password", Required = true, Label = Translate("Password")}); 8944 form.Add(new Button {ButtonType = ButtonType.Submit, Title = Translate("Submit")}); 8945 @Render(form); 8946 } 8947 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 8948 @using Dynamicweb.Rapido.Blocks.Extensibility 8949 @using Dynamicweb.Rapido.Blocks 8950 8951 @{ 8952 var topSnippetsBlocksPageCustom = BlocksPage.GetBlockPage("Master"); 8953 8954 var googleAnalytics = new Block() 8955 { 8956 Id = "GoogleAnalytics", 8957 SortId = 3, 8958 Template = RenderGoogleAnalytics() 8959 }; 8960 8961 topSnippetsBlocksPageCustom.Add(MasterBlockId.MasterTopSnippets, googleAnalytics); 8962 } 8963 8964 @helper RenderGoogleAnalytics() { 8965 var googleAnalyticsKeys = Pageview.AreaSettings.GetItem("Custom").GetItem("CustomSettings").GetString("GoogleAnalyticsKey"); 8966 8967 if (!string.IsNullOrWhiteSpace(googleAnalyticsKeys)) 8968 { 8969 <script async src="https://www.googletagmanager.com/gtag/js?id=@googleAnalyticsKeys"></script> 8970 <script> 8971 window.dataLayer = window.dataLayer || []; 8972 function gtag(){dataLayer.push(arguments);} 8973 gtag('js', new Date()); 8974 8975 gtag('config', '@googleAnalyticsKeys'); 8976 </script> 8977 } 8978 } 8979 8980 @{ 8981 BlocksPage masterCustomBlocksPage = BlocksPage.GetBlockPage("Master"); 8982 } 8983 8984 8985 @functions { 8986 public class ManifestIcon 8987 { 8988 public string src { get; set; } 8989 public string type { get; set; } 8990 public string sizes { get; set; } 8991 } 8992 8993 public class Manifest 8994 { 8995 public string name { get; set; } 8996 public string short_name { get; set; } 8997 public string start_url { get; set; } 8998 public string display { get; set; } 8999 public string background_color { get; set; } 9000 public string theme_color { get; set; } 9001 public List<ManifestIcon> icons { get; set; } 9002 } 9003 } 9004 9005 <!DOCTYPE html> 9006 9007 <html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName"> 9008 9009 9010 9011 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 9012 @RenderBlockList(masterPage.BlocksRoot.BlocksList) 9013 9014 9015 9016 @helper RenderMasterHead() { 9017 List<Block> subBlocks = this.masterPage.GetBlockListById("Head").OrderBy(item => item.SortId).ToList(); 9018 9019 <head> 9020 <!-- Rapido version 3.2 --> 9021 9022 @RenderBlockList(subBlocks) 9023 </head> 9024 } 9025 9026 @helper RenderMasterMetadata() { 9027 var swatches = new Dynamicweb.Content.Items.ColorSwatchService(); 9028 var brandColors = swatches.GetColorSwatch(1); 9029 string brandColorOne = brandColors.Palette["BrandColor1"]; 9030 9031 if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName")) && Model.Area.Item.GetItem("Settings").GetFile("AppIcon") != null) { 9032 Manifest manifest = new Manifest 9033 { 9034 name = Model.Area.Item.GetItem("Settings").GetString("AppName"), 9035 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"), 9036 start_url = "/", 9037 display = "standalone", 9038 background_color = Model.Area.Item.GetItem("Settings").GetString("AppBackgroundColor"), 9039 theme_color = Model.Area.Item.GetItem("Settings").GetString("AppThemeColor") 9040 }; 9041 9042 manifest.icons = new List<ManifestIcon> { 9043 new ManifestIcon { 9044 src = "/Admin/Public/GetImage.ashx?width=192&height=192&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 9045 sizes = "192x192", 9046 type = "image/png" 9047 }, 9048 new ManifestIcon { 9049 src = "/Admin/Public/GetImage.ashx?width=512&height=512&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 9050 sizes = "512x512", 9051 type = "image/png" 9052 }, 9053 new ManifestIcon { 9054 src = "/Admin/Public/GetImage.ashx?width=1024&height=1024&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 9055 sizes = "1024x1024", 9056 type = "image/png" 9057 } 9058 }; 9059 9060 string manifestFilePath = HttpContext.Current.Request.MapPath("/Files/Templates/Designs/Rapido/manifest.json"); 9061 string manifestJSON = Newtonsoft.Json.JsonConvert.SerializeObject(manifest); 9062 string currentManifest = File.ReadAllText(manifestFilePath); 9063 9064 if (manifestJSON != currentManifest) 9065 { 9066 File.WriteAllText(manifestFilePath, manifestJSON); 9067 } 9068 } 9069 9070 <meta charset="utf-8" /> 9071 <title>@Model.Title</title> 9072 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 9073 <meta name="robots" content="index, follow"> 9074 <meta name="theme-color" content="@brandColorOne" /> 9075 9076 if (!Model.MetaTags.Contains("og:image") && Model.PropertyItem != null) { 9077 Pageview.Meta.AddTag("og:image", string.Format("{0}://{1}{2}", Dynamicweb.Context.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, Model.PropertyItem.GetFile("OpenGraphImage"))); 9078 } 9079 9080 if (!Model.MetaTags.Contains("og:description")) { 9081 Pageview.Meta.AddTag("og:description", Model.Description); 9082 } 9083 9084 Pageview.Meta.AddTag("og:title", Model.Title); 9085 Pageview.Meta.AddTag("og:site_name", Model.Name); 9086 Pageview.Meta.AddTag("og:url", HttpContext.Current.Request.Url.ToString()); 9087 Pageview.Meta.AddTag("og:type", "Website"); 9088 Pageview.Meta.AddTag("fb:page_id", Model.ID.ToString()); 9089 9090 @Model.MetaTags 9091 } 9092 9093 @helper RenderMasterCss() { 9094 var fonts = new string[] { 9095 getFontFamily("Layout", "HeaderFont"), 9096 getFontFamily("Layout", "SubheaderFont"), 9097 getFontFamily("Layout", "TertiaryHeaderFont"), 9098 getFontFamily("Layout", "BodyText"), 9099 getFontFamily("Layout", "Header", "ToolsFont"), 9100 getFontFamily("Layout", "Header", "NavigationFont"), 9101 getFontFamily("Layout", "MobileNavigation", "Font"), 9102 getFontFamily("ProductList", "Facets", "HeaderFont"), 9103 getFontFamily("ProductPage", "PriceFontDesign"), 9104 getFontFamily("Ecommerce", "SaleSticker", "Font"), 9105 getFontFamily("Ecommerce", "NewSticker", "Font"), 9106 getFontFamily("Ecommerce", "CustomSticker", "Font") 9107 }; 9108 9109 string autoCssLink = "/Files/Templates/Designs/Rapido/css/rapido/rapido_" + Model.Area.ID.ToString() + ".min.css?ticks=" + Model.Area.UpdatedDate.Ticks; 9110 string favicon = Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon").Path : "/Files/Images/favicon.png"; 9111 bool useFontAwesomePro = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetBoolean("UseFontAwesomePro"); 9112 string fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomeFree/css/fontawesome-all.min.css"; 9113 string fa7CoreCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesome7/css/fontawesome.min.css"; 9114 string fa7BrandsCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesome7/css/brands.min.css"; 9115 9116 if (useFontAwesomePro) 9117 { 9118 fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomePro/css/fontawesome-all.min.css"; 9119 } 9120 9121 /* Optimizer variables */ 9122 var minify = Model.Area.Item.GetItem("Rizzo").GetBoolean("MinifyCss");; 9123 var folderName = string.Empty; 9124 var rizzoBundle = string.Empty; 9125 var rizzoPackagesBundle = string.Empty; 9126 var igniteBundle = string.Empty; 9127 var variablesFile = "/Files/Templates/Designs/Rapido/css/rapido/_variables_" + Model.Area.ID + ".auto.less"; 9128 9129 //Favicon 9130 <link href="@favicon" rel="icon" type="image/png"> 9131 9132 //Base (Default, wireframe) styles 9133 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/base/base.min.css" type="text/css"> 9134 9135 //Rapido Css from Website Settings 9136 <link rel="stylesheet" id="rapidoCss" href="@autoCssLink" type="text/css"> 9137 9138 if (Model.Area.Item.GetItem("Rizzo").GetBoolean("UseRizzoCss")) 9139 { 9140 <!-- Rizzo Css (DWNA specific styles) --> 9141 folderName = "rizzo"; 9142 rizzoBundle = Dna.Optimizer.Renderer.RenderStyles($"/Files/Templates/Designs/Rapido/css/{folderName}", $"-{folderName}-styles", new [] {variablesFile}, new[] { $"{folderName}.css", $"{folderName}.min.css" }, minify, false, false); 9143 <link id="rizzoCss" type="text/css" rel="stylesheet" href="@rizzoBundle" /> 9144 } 9145 if (Model.Area.Item.GetItem("RizzoPackages").GetBoolean("UseRizzoCss")) 9146 { 9147 <!-- Rizzo Packages Css (DWNA packages specific styles) --> 9148 folderName = "rizzoPackages"; 9149 rizzoPackagesBundle = Dna.Optimizer.Renderer.RenderStyles($"/Files/Templates/Designs/Rapido/css/{folderName}", $"-{folderName}-styles", new [] {variablesFile}, new[] { $"{folderName}.css", $"{folderName}.min.css" }, minify, false, false); 9150 <link id="rizzoPackagesCss" type="text/css" rel="stylesheet" href="@rizzoPackagesBundle" /> 9151 } 9152 9153 //Ignite Css (Custom site specific styles) 9154 folderName = "ignite"; 9155 igniteBundle = Dna.Optimizer.Renderer.RenderStyles($"/Files/Templates/Designs/Rapido/css/{folderName}", $"-{folderName}-styles", new [] {variablesFile}, new[] { $"{folderName}.css", $"{folderName}.min.css" }, minify, false, false); 9156 <link id="igniteCss" type="text/css" rel="stylesheet" href="@igniteBundle" /> 9157 9158 //Font awesome 9159 <link rel="stylesheet" href="@fa7CoreCssLink" type="text/css"> 9160 <link rel="stylesheet" href="@fa7BrandsCssLink" type="text/css"> 9161 <link rel="stylesheet" href="@fontAwesomeCssLink" type="text/css"> 9162 9163 //Flag icon 9164 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css" type="text/css"> 9165 9166 //Google fonts 9167 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))); 9168 9169 <link href="https://fonts.googleapis.com/css?family=@family" rel="stylesheet"> 9170 } 9171 9172 @helper RenderMasterManifest() { 9173 if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName"))) 9174 { 9175 <link rel="manifest" href="/Files/Templates/Designs/Rapido/manifest.json"> 9176 } 9177 } 9178 9179 @helper RenderMasterBody() { 9180 List<Block> subBlocks = this.masterPage.GetBlockListById("Body").OrderBy(item => item.SortId).ToList(); 9181 string designLayout = Model.PropertyItem != null && Model.PropertyItem.GetItem("CustomSettings") != null ? Model.PropertyItem.GetItem("CustomSettings").GetString("DesignLayout") != null ? Model.PropertyItem.GetItem("CustomSettings").GetList("DesignLayout").SelectedValue : "" : ""; 9182 if (!String.IsNullOrEmpty(designLayout)) { 9183 designLayout = "class=\"" + designLayout + "\""; 9184 } 9185 9186 <body @designLayout> 9187 @RenderBlockList(subBlocks) 9188 9189 <!--$$If Defined(Ecom:Product.ID)--> 9190 <!-- product JSON-LD now comes from Product.cshtml --> 9191 <!--$$EndIf--> 9192 </body> 9193 } 9194 9195 9196 @helper RenderMasterHeader() 9197 { 9198 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterHeader").OrderBy(item => item.SortId).ToList(); 9199 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 9200 string stickyTop = isNavigationStickyMenu ? "top-container--sticky" : ""; 9201 9202 <header class="top-container @stickyTop dw-mod" id="Top"> 9203 @RenderBlockList(subBlocks) 9204 </header> 9205 } 9206 9207 @helper RenderMain() 9208 { 9209 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMain").OrderBy(item => item.SortId).ToList(); 9210 9211 <main class="site dw-mod"> 9212 @RenderBlockList(subBlocks) 9213 </main> 9214 } 9215 9216 @helper RenderPageContent() 9217 { 9218 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 9219 string pagePos = isNavigationStickyMenu ? "js-page-pos" : ""; 9220 9221 <div id="Page" class="page @pagePos"> 9222 <section class="center-container content-container dw-mod" id="content"> 9223 9224 @RenderSnippet("Content") 9225 </section> 9226 </div> 9227 } 9228 9229 @* Hack to support nested helpers *@ 9230 @SnippetStart("Content") 9231 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 9232 9233 9234 @using Dynamicweb.Rapido.Blocks.Components 9235 @using Dynamicweb.Rapido.Blocks.Components.Articles 9236 @using Dynamicweb.Rapido.Blocks.Components.General 9237 @using Dynamicweb.Rapido.Blocks 9238 9239 @functions { 9240 BlocksPage articlePage = BlocksPage.GetBlockPage("NewsArticle"); 9241 } 9242 9243 @{ 9244 string image = !String.IsNullOrEmpty(Model.Item.GetString("Image")) ? Model.Item.GetFile("Image").PathUrlEncoded : ""; 9245 9246 ArticleHeader topBanner = new ArticleHeader 9247 { 9248 Layout = ArticleHeaderLayout.Clean, 9249 Image = new Image { Path = image }, 9250 Heading = Model.Item.GetString("Title"), 9251 Subheading = Model.Item.GetString("Summary"), 9252 TextColor = "#fff", 9253 Category = Model.Item.GetString("Author"), 9254 Date = Model.Item.GetString("Date"), 9255 ButtonLayout = ButtonLayout.Primary, 9256 TextLayout = ArticleHeaderTextLayout.Full 9257 }; 9258 9259 ButtonLayout buttonDesign; 9260 Enum.TryParse<ButtonLayout>(Model.Item.GetString("ButtonDesign"), out buttonDesign); 9261 if (buttonDesign == ButtonLayout.None) 9262 { 9263 buttonDesign = ButtonLayout.Primary; 9264 } 9265 9266 Block articleContainer = new Block 9267 { 9268 Id = "ArticleContainer", 9269 SortId = 10, 9270 Design = new Design 9271 { 9272 RenderType = RenderType.Row 9273 }, 9274 BlocksList = new List<Block> { 9275 new Block { 9276 Id = "ArticleBody", 9277 SortId = 20, 9278 Design = new Design { 9279 RenderType = RenderType.Column, 9280 Size = "8" 9281 }, 9282 BlocksList = new List<Block> { 9283 new Block { 9284 Id = "ArticleBodyRow", 9285 SortId = 10, 9286 Design = new Design { 9287 RenderType = RenderType.Row 9288 }, 9289 BlocksList = new List<Block> { 9290 new Block { 9291 Id = "ArticleHeader", 9292 SortId = 10, 9293 Component = topBanner, 9294 Design = new Design { 9295 RenderType = RenderType.Column, 9296 Size = "12", 9297 HidePadding = true, 9298 CssClass = "article-head" 9299 } 9300 }, 9301 new Block { 9302 Id = "ArticleText", 9303 SortId = 20, 9304 Component = new ArticleText { Text = Model.Item.GetString("Text") }, 9305 Design = new Design { 9306 RenderType = RenderType.Column, 9307 Size = "12", 9308 CssClass = "u-padding--lg" 9309 } 9310 }, 9311 new Block { 9312 Id = "ArticleLink", 9313 SortId = 30, 9314 Component = new ArticleLink { Href = Model.Item.GetString("Link"), Title = Model.Item.GetString("LinkText"), ButtonLayout = buttonDesign }, 9315 Design = new Design { 9316 RenderType = RenderType.Column, 9317 Size = "12", 9318 CssClass = "u-padding--lg u-ta-right" 9319 } 9320 } 9321 } 9322 } 9323 } 9324 } 9325 } 9326 }; 9327 9328 articlePage.Add(articleContainer); 9329 9330 if (Model.PropertyItem.GetList("ShowBreadcrumb").SelectedValue == "True") 9331 { 9332 Block breadcrumb = new Block 9333 { 9334 Id = "ArticleBreadcrumb", 9335 SortId = 10, 9336 Component = new BreadcrumbNavigation { }, 9337 Design = new Design 9338 { 9339 RenderType = RenderType.Column, 9340 Size = "12" 9341 } 9342 }; 9343 articlePage.Add("ArticleContainer", breadcrumb); 9344 } 9345 } 9346 9347 9348 @using System 9349 @using System.Web 9350 @using System.Collections.Generic 9351 @using Dynamicweb.Rapido.Blocks 9352 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 9353 @using Dynamicweb.Rapido.Blocks 9354 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 9355 @using Dynamicweb.Rapido.Blocks 9356 @{ 9357 BlocksPage newsArticleCustomBlocksPage = BlocksPage.GetBlockPage("NewsArticle"); 9358 9359 } 9360 9361 9362 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 9363 @RenderBlockList(articlePage.BlocksRoot.BlocksList) 9364 9365 @SnippetEnd("Content") 9366 9367 </html> 9368 9369