Error executing template "Designs/Rapido/_parsed/Page.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_57433c6bd7f84b098d9989dbb05d3ebe.Execute() in e:\Domains\Sites\lorenz.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 9175
   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 5719 private static bool ShowSubPages(NavigationTreeNodeViewModel node) 5720 { 5721 var pages= Dynamicweb.Services.Pages.GetPagesByParentID(node.PageId).ToList(); 5722 return node.Nodes.Any() && (pages.Any(p => p.ItemType != "Composer") || !pages.Any()); 5723 } 5724 5725 private Dynamicweb.Ecommerce.Products.Group GetGroupByName(string groupName) 5726 { 5727 var groups = Dynamicweb.Ecommerce.Services.ProductGroups.GetGroups().ToList(); 5728 return groups.FirstOrDefault(g => g.Name.Equals(groupName)); 5729 } 5730 5731 private bool IsShowInMenu(string groupName) 5732 { 5733 var group = GetGroupByName(groupName); 5734 return group != null && group.NavigationShowInMenu; 5735 } 5736 5737 private bool IsMegaMenu(NavigationTreeNodeViewModel node) 5738 { 5739 var page = Dynamicweb.Services.Pages.GetPage(node.PageId); 5740 var pageCustomSettings = page.PropertyItem?["CustomSettings"] != null ? Dynamicweb.Services.Items.GetItem("PagePropertiesCustom", Converter.ToString(page.PropertyItem["CustomSettings"])) : null; 5741 5742 return pageCustomSettings?["SubpagesAsMegaMenu"] != null && Convert.ToBoolean(pageCustomSettings["SubpagesAsMegaMenu"]); 5743 } 5744 5745 private LinkTargetType GetLinkTarget(string link) 5746 { 5747 return link.StartsWith("http") || link.StartsWith("www") ? LinkTargetType.Blank : LinkTargetType.None; 5748 } 5749 5750 private string GetMenuItemCssClass(NavigationTreeNodeViewModel node, bool isStartLevel) 5751 { 5752 string menuItemCssClass = "menu__item dw-mod"; 5753 5754 if (isStartLevel) 5755 { 5756 menuItemCssClass += " menu__item--horizontal menu__item--top-level dw-navbar-button"; 5757 5758 if (node.Nodes.Any()) 5759 { 5760 menuItemCssClass += IsMegaMenu(node) ? " is-mega" : " is-dropdown"; 5761 } 5762 } 5763 else if (!IsMegaMenu(node)) 5764 { 5765 menuItemCssClass += ShowSubPages(node) ? " is-dropleft" : ""; 5766 menuItemCssClass += " menu__item--fixed-width u-margin-left"; 5767 } 5768 5769 menuItemCssClass += IsMegaMenu(node) ? " menu__item--mega" : ""; 5770 menuItemCssClass += !node.IsClickable ? " menu__item--disabled" : ""; 5771 menuItemCssClass += node.IsActive || node.InPath ? " menu__item--active" : ""; 5772 5773 return menuItemCssClass; 5774 } 5775 5776 private string GetMenuLinkCssClass(NavigationTreeNodeViewModel node, bool isStartLevel) 5777 { 5778 string menuLinkCssClass = ""; 5779 if (isStartLevel) 5780 { 5781 menuLinkCssClass += "menu__link"; 5782 menuLinkCssClass += node.IsActive || node.InPath ? " menu__link--active" : ""; 5783 } 5784 else 5785 { 5786 if (IsMegaMenu(node)) 5787 { 5788 menuLinkCssClass += "mega-menu__link"; 5789 menuLinkCssClass += node.IsActive || node.InPath ? " mega-menu__link--active" : ""; 5790 } 5791 else 5792 { 5793 menuLinkCssClass += "menu-dropdown__link"; 5794 menuLinkCssClass += node.IsActive || node.InPath ? " menu-dropdown__link--active" : ""; 5795 } 5796 } 5797 5798 menuLinkCssClass += !node.IsClickable ? " menu__link--disabled" : ""; 5799 5800 return menuLinkCssClass + " dw-mod"; 5801 } 5802 5803 private string GetMegaMenuGridCssClass() 5804 { 5805 string megaMenuGridCssClasses = "grid__col-sm-4 grid__col-xs-12 mega-menu__col dw-mod"; 5806 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; 5807 megaMenuGridCssClasses = _showOnlyHeaders ? megaMenuGridCssClasses + " grid__col--bleed" : megaMenuGridCssClasses + " grid__col--bleed-x"; 5808 5809 return megaMenuGridCssClasses; 5810 } 5811 5812 private string GetMegaMenuHeaderCssClass(NavigationTreeNodeViewModel node) 5813 { 5814 string megaMenuHeaderCssClass = "mega-menu__header-container__text dw-mod"; 5815 megaMenuHeaderCssClass += node.IsClickable ? " mega-menu__header-container__text--link" : ""; 5816 megaMenuHeaderCssClass += node.IsActive || node.InPath ? " mega-menu__header-container__text--active" : ""; 5817 return megaMenuHeaderCssClass; 5818 } 5819 } 5820 5821 @{ 5822 _showOnlyHeaders = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowOnlyHeaders"); 5823 _promotionImage = Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage").PathUrlEncoded : ""; 5824 _promotionLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("MegamenuPromotionLink"); 5825 5826 var navigationSettings = new NavigationSettings() 5827 { 5828 StartLevel = 1, 5829 StopLevel = 5, 5830 ExpandMode = ExpandMode.All, 5831 Parameters = {{"id", "topnavigation"} } 5832 }; 5833 5834 var masterDesktopMenuCustom = BlocksPage.GetBlockPage("Master").GetBlockById("MasterDesktopMenu"); 5835 if (masterDesktopMenuCustom != null) 5836 { 5837 masterDesktopMenuCustom.Template = RenderNavigationMenu(navigationSettings); 5838 } 5839 } 5840 5841 @helper RenderNavigationMenu(NavigationSettings navigationSettings) 5842 { 5843 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5844 string menuAlignment = topLayout == "minimal-right" ? "grid--align-self-end" : ""; 5845 5846 <div class="grid__cell u-flex u-reset-position @menuAlignment"> 5847 @RenderNavigationNodes(navigationSettings) 5848 </div> 5849 } 5850 5851 @helper RenderNavigationNodes(NavigationSettings navigationSettings = null) 5852 { 5853 var nodes = GetNavigation(navigationSettings).Nodes; 5854 string id = ""; 5855 int startLevel = 1; 5856 5857 if (navigationSettings != null) 5858 { 5859 id = navigationSettings.Parameters["id"].ToString(); 5860 startLevel = navigationSettings.StartLevel; 5861 } 5862 5863 <ul class="menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap" @(!string.IsNullOrEmpty(id) ? "id=" + id : string.Empty)> 5864 @foreach (NavigationTreeNodeViewModel node in nodes) 5865 { 5866 var isStartLevel = node.Level == startLevel; 5867 5868 <li class="@GetMenuItemCssClass(node, isStartLevel)"> 5869 @RenderMenuLink(node, GetMenuLinkCssClass(node, isStartLevel)) 5870 5871 @if (node.Nodes.Any()) 5872 { 5873 if (IsMegaMenu(node)) 5874 { 5875 <div class="menu mega-menu dw-mod"> 5876 <div class="grid grid--align-content-start mega-menu__grid dw-mod"> 5877 @RenderMegaMenu(node.Nodes) 5878 </div> 5879 </div> 5880 } 5881 else 5882 { 5883 <ul class="menu dw-mod menu--dropdown"> 5884 @RenderList(node.Nodes) 5885 </ul> 5886 } 5887 } 5888 </li> 5889 } 5890 </ul> 5891 } 5892 5893 @helper RenderMegaMenu(IEnumerable<NavigationTreeNodeViewModel> nodes) 5894 { 5895 if (!string.IsNullOrEmpty(_promotionImage)) 5896 { 5897 <div class="grid__col-9 grid__col--bleed"> 5898 <div class="grid grid--align-content-start"> 5899 @foreach (NavigationTreeNodeViewModel node in nodes) 5900 { 5901 @RenderMegaMenuGrid(node) 5902 } 5903 </div> 5904 </div> 5905 <div class="grid__col-3 mega-menu__promotion-image"> 5906 @Render(new Image 5907 { 5908 Link = _promotionLink, 5909 Path = _promotionImage, 5910 DisableLazyLoad = true 5911 }) 5912 </div> 5913 } 5914 else 5915 { 5916 foreach (NavigationTreeNodeViewModel node in nodes) 5917 { 5918 @RenderMegaMenuGrid(node) 5919 } 5920 } 5921 } 5922 5923 @helper RenderMegaMenuGrid(NavigationTreeNodeViewModel node) 5924 { 5925 if (IsShowInMenu(node.Name)) { 5926 var smallImage = GetGroupByName(node.Name).SmallImage; 5927 5928 <div class="@GetMegaMenuGridCssClass()"> 5929 <div class="mega-menu__list-wrap dw-mod"> 5930 <div class="mega-menu__header-container dw-mod"> 5931 @if (!string.IsNullOrEmpty(smallImage)) 5932 { 5933 @Render(new Image() 5934 { 5935 DisableLazyLoad = true, 5936 Path = smallImage, 5937 Link = node.Link 5938 }) 5939 } 5940 @RenderMenuLink(node, GetMegaMenuHeaderCssClass(node)) 5941 </div> 5942 @if (!_showOnlyHeaders) 5943 { 5944 <ul class="menu dw-mod"> 5945 @RenderList(node.Nodes) 5946 </ul> 5947 } 5948 </div> 5949 </div> 5950 } 5951 } 5952 5953 @helper RenderList(IEnumerable<NavigationTreeNodeViewModel> nodes) 5954 { 5955 foreach (NavigationTreeNodeViewModel node in nodes) 5956 { 5957 var smallImage = GetGroupByName(node.Name)?.SmallImage; 5958 5959 <li class="@GetMenuItemCssClass(node, false)"> 5960 @if (IsMegaMenu(node) && !string.IsNullOrEmpty(smallImage)) 5961 { 5962 @Render(new Image() 5963 { 5964 DisableLazyLoad = true, 5965 Path = smallImage, 5966 Link = node.Link 5967 }) 5968 } 5969 else 5970 { 5971 @RenderMenuLink(node, GetMenuLinkCssClass(node, false)) 5972 } 5973 5974 @if (!IsMegaMenu(node) && ShowSubPages(node)) 5975 { 5976 <ul class="menu menu--dropleft dw-mod"> 5977 @RenderList(node.Nodes) 5978 </ul> 5979 } 5980 </li> 5981 } 5982 } 5983 5984 @helper RenderMenuLink(NavigationTreeNodeViewModel node, string cssClass) 5985 { 5986 if (node.IsClickable) 5987 { 5988 @Render(new Link() 5989 { 5990 Href = node.Link, 5991 CssClass = cssClass, 5992 Target = GetLinkTarget(node.Link), 5993 Title = node.Name, 5994 ButtonLayout = ButtonLayout.None 5995 }) 5996 } 5997 else 5998 { 5999 <span class="@cssClass">@node.Name</span> 6000 } 6001 } 6002 @using System 6003 @using Dynamicweb.Rapido.Blocks 6004 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 6005 6006 @{ 6007 6008 var loyaltyService = new Dynamicweb.Ecommerce.Loyalty.LoyaltyService(); 6009 var userPoints = Pageview.User != null ? loyaltyService.GetPointsBalance(Pageview.User) : 0; 6010 userPoints = Math.Abs(userPoints); 6011 userPoints = Math.Round(userPoints, 0); 6012 var loyaltyPointsEnabled = Pageview.User != null && Dynamicweb.Security.Licensing.LicenseManager.LicenseHasFeature("LoyaltyPoints"); 6013 6014 if (userPoints > 0 && loyaltyPointsEnabled) 6015 { 6016 var userTransactions = loyaltyService.GetUserTransactions(Pageview.User.ID); 6017 var expirationDate = userTransactions.OrderBy(t => t.ExpirationDate).First().ExpirationDate; 6018 6019 Block loyaltyPoints = new Block 6020 { 6021 Id = "LoyaltyPoints", 6022 SortId = 30, 6023 Template = RenderLoyaltyPoints(userPoints, expirationDate), 6024 Design = new Design 6025 { 6026 Size = "auto-width", 6027 HidePadding = true, 6028 RenderType = RenderType.Column, 6029 CssClass = "grid--align-self-center u-margin-left--lg" 6030 } 6031 }; 6032 BlocksPage.GetBlockPage("Master").Add("MasterDesktopNavigation", loyaltyPoints); 6033 } 6034 } 6035 @helper RenderLoyaltyPoints(double? userPoints, DateTime expirationDate) 6036 { 6037 var cart = Dynamicweb.Ecommerce.Common.Context.Cart; 6038 var pointsUsedInCart = cart?.TotalPoints ?? 0; 6039 userPoints -= pointsUsedInCart; 6040 <div class="u-color-light"> 6041 <p class="u-margin u-margin">@Translate("Points"): @userPoints</p> 6042 </div> 6043 } 6044 6045 6046 @helper RenderDesktopTools() 6047 { 6048 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopTools").OrderBy(item => item.SortId).ToList(); 6049 6050 <div class="tools-navigation dw-mod"> 6051 <div class="center-container grid top-container__center-container dw-mod"> 6052 @RenderBlockList(subBlocks) 6053 </div> 6054 </div> 6055 } 6056 6057 @helper RenderDesktopToolsText() 6058 { 6059 string toolsText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("ToolsText"); 6060 if (!string.IsNullOrEmpty(toolsText)) 6061 { 6062 <div class="u-margin-top u-margin-bottom">@toolsText</div> 6063 } 6064 } 6065 6066 @helper RenderDesktopToolsNavigation() 6067 { 6068 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 6069 6070 if (renderPagesInToolBar) 6071 { 6072 @RenderNavigation(new 6073 { 6074 id = "topToolsNavigation", 6075 cssclass = "menu menu-tools dw-mod dwnavigation", 6076 template = "TopMenu.xslt" 6077 }) 6078 } 6079 } 6080 6081 @helper RenderDesktopNavigation() 6082 { 6083 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopNavigation").OrderBy(item => item.SortId).ToList(); 6084 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 6085 string alignClass = topLayout == "two-lines-centered" ? "grid--justify-center" : ""; 6086 <nav class="main-navigation dw-mod"> 6087 <div class="center-container top-container__center-container grid @alignClass dw-mod"> 6088 @RenderBlockList(subBlocks) 6089 </div> 6090 </nav> 6091 } 6092 6093 @helper RenderDesktopExtra() 6094 { 6095 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopExtra").OrderBy(item => item.SortId).ToList(); 6096 6097 if (subBlocks.Count > 0) 6098 { 6099 <div class="header header-top dw-mod"> 6100 <div class="center-container top-container__center-container grid--justify-space-between grid grid--align-center dw-mod"> 6101 @RenderBlockList(subBlocks) 6102 </div> 6103 </div> 6104 } 6105 }</text> 6106 } 6107 6108 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 6109 6110 @using System 6111 @using System.Web 6112 @using Dynamicweb.Rapido.Blocks.Extensibility 6113 @using Dynamicweb.Rapido.Blocks 6114 @using Dynamicweb.Rapido.Blocks.Components.General 6115 @using Dynamicweb.Frontend 6116 6117 @functions { 6118 int impersonationPageId; 6119 string impersonationLayout; 6120 int impersonationFeed; 6121 Block impersonationBar; 6122 6123 string getUserNameFromParams(string firstName, string middleName, string lastName, string name, string email, string userName) 6124 { 6125 string username = ""; 6126 6127 if (!string.IsNullOrEmpty(firstName) && !string.IsNullOrEmpty(lastName)) 6128 { 6129 username = firstName + " " + (!string.IsNullOrEmpty(middleName) ? middleName + " " : "") + lastName; 6130 } 6131 else if (!string.IsNullOrEmpty(name)) 6132 { 6133 username = name; 6134 } 6135 else if (!string.IsNullOrEmpty(email)) 6136 { 6137 username = email; 6138 } 6139 else 6140 { 6141 username = userName; 6142 } 6143 return username; 6144 } 6145 6146 string getUserName(UserViewModel user) 6147 { 6148 return getUserNameFromParams(user.FirstName, user.MiddleName, user.LastName, user.Name, user.Email, user.UserName); 6149 } 6150 6151 string getUserName(Dynamicweb.Security.UserManagement.User user) 6152 { 6153 return getUserNameFromParams(user.FirstName, user.MiddleName, user.LastName, user.Name, user.Email, user.UserName); 6154 } 6155 } 6156 6157 @{ 6158 impersonationPageId = GetPageIdByNavigationTag("Impersonation"); 6159 impersonationLayout = Model.Area.Item.GetItem("Ecommerce").GetList("ImpersonationLayout") != null ? Model.Area.Item.GetItem("Ecommerce").GetList("ImpersonationLayout").SelectedValue : "bar"; 6160 impersonationFeed = GetPageIdByNavigationTag("UsersFeed"); 6161 6162 if (Model.CurrentUser.ID > 0 && Model.SecondaryUsers.Count > 0) 6163 { 6164 impersonationBar = new Block 6165 { 6166 Id = "ImpersonationBar", 6167 SortId = 50, 6168 Template = RenderImpersonation(), 6169 SkipRenderBlocksList = true, 6170 Design = new Design 6171 { 6172 Size = "auto-width", 6173 HidePadding = true, 6174 RenderType = RenderType.Column 6175 } 6176 }; 6177 6178 Block impersonationContent = new Block 6179 { 6180 Id = "ImpersonationContent", 6181 SortId = 10 6182 }; 6183 6184 if (Model.CurrentSecondaryUser != null && Model.CurrentSecondaryUser.ID > 0) 6185 { 6186 //Render stop impersonation view 6187 impersonationContent.Template = RenderStopImpersonationView(); 6188 } 6189 else 6190 { 6191 //Render main view 6192 switch (impersonationLayout) 6193 { 6194 case "right-lower-box": 6195 impersonationContent.BlocksList.Add( 6196 new Block { 6197 Id = "RightLowerBoxHeader", 6198 SortId = 10, 6199 Component = new Heading { 6200 Level = 5, 6201 Title = Translate("View the list of users you can impersonate"), 6202 CssClass = "impersonation-text" 6203 } 6204 } 6205 ); 6206 impersonationContent.BlocksList.Add( 6207 new Block { 6208 Id = "RightLowerBoxContent", 6209 SortId = 20, 6210 Template = RenderImpersonationControls() 6211 } 6212 ); 6213 break; 6214 case "right-lower-bar": 6215 impersonationContent.BlocksList.Add( 6216 new Block { 6217 Id = "RightLowerBarContent", 6218 SortId = 10, 6219 Template = RenderImpersonationControls() 6220 } 6221 ); 6222 break; 6223 case "bar": 6224 default: 6225 impersonationContent.BlocksList.Add( 6226 new Block { 6227 Id = "ViewListLink", 6228 SortId = 20, 6229 Template = RenderViewListLink() 6230 } 6231 ); 6232 impersonationContent.BlocksList.Add( 6233 new Block { 6234 Id = "BarTypeaheadSearch", 6235 SortId = 30, 6236 Template = RenderTypeaheadSearch() 6237 } 6238 ); 6239 break; 6240 } 6241 } 6242 impersonationBar.BlocksList.Add(impersonationContent); 6243 6244 impersonationBar.BlocksList.Add( 6245 new Block 6246 { 6247 Id = "ImpersonationSearchTemplates", 6248 SortId = 20, 6249 Template = RenderSearchResultTemplate() 6250 } 6251 ); 6252 if (impersonationLayout != "bar") 6253 { 6254 impersonationBar.BlocksList.Add( 6255 new Block 6256 { 6257 Id = "ImpersonationSearchScripts", 6258 SortId = 30, 6259 Template = RenderSearchScripts() 6260 } 6261 ); 6262 } 6263 BlocksPage.GetBlockPage("Master").Add("MasterHeader", impersonationBar); 6264 } 6265 } 6266 6267 @helper RenderImpersonation() 6268 { 6269 List<Block> subBlocks = impersonationBar.BlocksList.OrderBy(item => item.SortId).ToList(); 6270 <input type="checkbox" class="impersonation-trigger js-remember-state" id="ImpersonationMinimizeTrigger" /> 6271 <div class="impersonation impersonation--@(impersonationLayout)-layout dw-mod" id="Impersonation"> 6272 @if (impersonationLayout == "right-lower-box") 6273 { 6274 @RenderRightLowerBoxHeader() 6275 } 6276 <div class="center-container top-container__center-container u-padding--lg impersonation__container @(impersonationLayout != "bar" ? "impersonation__container--box" : "") dw-mod"> 6277 @*Impersonation*@ 6278 @RenderBlockList(subBlocks) 6279 </div> 6280 </div> 6281 } 6282 6283 @helper RenderRightLowerBoxHeader() 6284 { 6285 <div class="impersonation__header dw-mod"> 6286 <div class="impersonation__title">@Translate("Impersonation")</div> 6287 <label for="ImpersonationMinimizeTrigger" class="btn btn--impersonation impersonation__minimize-btn dw-mod" onclick="this.blur();"> 6288 @Render(new Icon 6289 { 6290 Prefix = "fas", 6291 Name = "fa-window-minimize" 6292 }) 6293 </label> 6294 </div> 6295 } 6296 6297 @helper RenderStopImpersonationView() 6298 { 6299 string secondaryUserName = getUserName(Model.CurrentSecondaryUser); 6300 string userName = getUserName(Pageview.User); 6301 string impersonationText = "<b>" + userName + "</b> " + Translate("is impersonating") + " <b>" + secondaryUserName + "</b>"; 6302 impersonationText = Dynamicweb.Security.UserManagement.User.ImpersonationMode == Dynamicweb.Security.UserManagement.UserImpersonation.Full ? "<b>" + secondaryUserName + "</b> " + Translate("is impersonating") + " <b>" + userName + "</b>" : impersonationText; 6303 6304 if (impersonationLayout == "right-lower-box") 6305 { 6306 <div class="u-margin-bottom--lg u-ta-center"> 6307 @impersonationText 6308 </div> 6309 @RenderStopImpersonationForm() 6310 } 6311 else 6312 { 6313 <div class="grid grid--align-center grid--justify-space-between impersonation__stop-wrap"> 6314 <div class="u-margin-right--lg impersonation__stop-text"> 6315 <i class="fas fa-user-secret"></i> 6316 @impersonationText 6317 </div> 6318 @RenderStopImpersonationForm() 6319 </div> 6320 } 6321 } 6322 6323 @helper RenderStopImpersonationForm() 6324 { 6325 <form method="post" class="u-no-margin"> 6326 @Render(new Button 6327 { 6328 ButtonType = ButtonType.Submit, 6329 ButtonLayout = ButtonLayout.None, 6330 Title = Translate("Stop impersonation"), 6331 Href = "/Default.aspx?ID=" + impersonationPageId, 6332 CssClass = "impersonation__button btn btn--impersonation", 6333 Name = "DwExtranetRemoveSecondaryUser" 6334 }) 6335 </form> 6336 } 6337 6338 @helper RenderImpersonationControls() 6339 { 6340 <div class="impersonation__controls"> 6341 @RenderViewListLink() 6342 @RenderSearchBox() 6343 </div> 6344 @RenderResultsList() 6345 } 6346 6347 @helper RenderViewListLink() 6348 { 6349 string title = impersonationLayout == "right-lower-box" ? Translate("View the list") : Translate("View the list of users you can impersonate"); 6350 string buttonClasses = impersonationLayout == "right-lower-box" ? "impersonation__button btn btn--impersonation" : "impersonation__link impersonation__link"; 6351 6352 @Render(new Link { 6353 ButtonLayout = ButtonLayout.None, 6354 Title = title, 6355 Href = "/Default.aspx?ID=" + impersonationPageId, 6356 CssClass = buttonClasses 6357 }) 6358 } 6359 6360 @helper RenderSearchBox() 6361 { 6362 <div class="impersonation__search-wrap"> 6363 <input placeholder="@Translate("Search users")" type="text" class="impersonation__search-field dw-mod" onkeyup="searchKeyUpHandler(event)" id="ImpersonationBoxSearchField"> 6364 <div id="ImpersonationBoxSearchFind" class="impersonation__search-icon dw-mod" onclick="updateResults(document.getElementById('ImpersonationBoxSearchField').value)"> 6365 <i class="fal fa-search"></i> 6366 </div> 6367 <div id="ImpersonationBoxSearchClear" class="impersonation__search-icon u-hidden dw-mod" onclick="clearResults();"> 6368 <i class="fal fa-times"></i> 6369 </div> 6370 </div> 6371 } 6372 6373 @helper RenderTypeaheadSearch() 6374 { 6375 <div class="typeahead u-ta-right impersonation__typeahead js-typeahead dw-mod" id="ImpersonationSearchBar" 6376 data-page-size="5" 6377 data-search-feed-id="@impersonationFeed" 6378 data-result-page-id="@impersonationPageId" 6379 data-search-type="user-search" 6380 data-search-parameter-name="userSearch"> 6381 6382 <div class="typeahead-search-field"> 6383 <input type="text" class="u-no-margin js-typeahead-search-field" placeholder="@Translate("Search users")"> 6384 <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> 6385 </div> 6386 </div> 6387 } 6388 6389 @helper RenderResultsList() 6390 { 6391 <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> 6392 } 6393 6394 @helper RenderSearchResultTemplate() 6395 { 6396 <script id="ImpersonationSearchResult" type="text/x-template"> 6397 {{#.}} 6398 {{#Users}} 6399 <li class="impersonation__search-results-item impersonation-user"> 6400 <form method="post" class="impersonation-user__form" name="account{{id}}"> 6401 <input type="hidden" id="DWExtranetSecondaryUserSelector" name="DWExtranetSecondaryUserSelector" value="{{id}}"> 6402 <div class="impersonation-user__info"> 6403 <div class="impersonation-user__name">{{userName}}</div> 6404 <div class="impersonation-user__number">{{customerNumber}}</div> 6405 </div> 6406 @Render(new Button 6407 { 6408 ButtonType = ButtonType.Submit, 6409 ButtonLayout = ButtonLayout.Secondary, 6410 Title = Translate("Sign in as"), 6411 CssClass = "impersonation-user__sign-in-btn" + (impersonationLayout != "bar" ? " btn--impersonation" : "") 6412 }) 6413 </form> 6414 </li> 6415 {{/Users}} 6416 {{#unless Users}} 6417 <li class="impersonation__search-results-item impersonation__search-results-item--not-found"> 6418 @Translate("Your search gave 0 results") 6419 </li> 6420 {{/unless}} 6421 {{/.}} 6422 </script> 6423 } 6424 6425 @helper RenderSearchScripts() 6426 { 6427 <script> 6428 let inputDelayTimer; 6429 function searchKeyUpHandler(e) { 6430 clearTimeout(inputDelayTimer); 6431 let value = e.target.value; 6432 if (value != "") { 6433 inputDelayTimer = setTimeout(function () { 6434 updateResults(value); 6435 }, 500); 6436 } else { 6437 clearResults(); 6438 } 6439 }; 6440 6441 function updateResults(value) { 6442 if (value == "") { 6443 return null; 6444 } 6445 HandlebarsBolt.UpdateContent("ImpersonationBoxSearchResults", "/Default.aspx?ID=@impersonationFeed&q=" + value); 6446 document.getElementById("ImpersonationBoxSearchFind").classList.add("u-hidden"); 6447 document.getElementById("ImpersonationBoxSearchClear").classList.remove("u-hidden"); 6448 } 6449 6450 function clearResults() { 6451 document.getElementById("ImpersonationBoxSearchField").value = ""; 6452 HandlebarsBolt.CleanContainer("ImpersonationBoxSearchResults"); 6453 document.getElementById("ImpersonationBoxSearchFind").classList.remove("u-hidden"); 6454 document.getElementById("ImpersonationBoxSearchClear").classList.add("u-hidden"); 6455 } 6456 </script> 6457 } 6458 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 6459 6460 @using System 6461 @using System.Web 6462 @using System.Collections.Generic 6463 @using Dynamicweb.Rapido.Blocks.Extensibility 6464 @using Dynamicweb.Rapido.Blocks 6465 6466 @{ 6467 BlocksPage miniCartBlocksPage = BlocksPage.GetBlockPage("Master"); 6468 string orderlinesView = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView").SelectedValue : "table"; 6469 6470 Block orderLines = new Block 6471 { 6472 Id = "MiniCartOrderLines", 6473 SkipRenderBlocksList = true, 6474 BlocksList = new List<Block> 6475 { 6476 new Block { 6477 Id = "MiniCartOrderLinesList", 6478 SortId = 20, 6479 Template = RenderMiniCartOrderLinesList() 6480 } 6481 } 6482 }; 6483 6484 Block orderlinesScriptTemplates = new Block 6485 { 6486 Id = "OrderlinesScriptTemplates" 6487 }; 6488 6489 if (orderlinesView == "table") 6490 { 6491 orderLines.Template = RenderMiniCartOrderLinesTable(); 6492 orderLines.BlocksList.Add( 6493 new Block 6494 { 6495 Id = "MiniCartOrderlinesTableHeader", 6496 SortId = 10, 6497 Template = RenderMiniCartOrderLinesHeader() 6498 } 6499 ); 6500 6501 orderlinesScriptTemplates.Template = RenderMiniCartScriptsTableTemplates(); 6502 } 6503 else 6504 { 6505 orderLines.Template = RenderMiniCartOrderLinesBlocks(); 6506 orderlinesScriptTemplates.Template = RenderMiniCartScriptsListTemplates(); 6507 } 6508 6509 miniCartBlocksPage.Add("MasterBottomSnippets", orderlinesScriptTemplates); 6510 6511 Block miniCartScriptTemplates = new Block() 6512 { 6513 Id = "MasterMiniCartTemplates", 6514 SortId = 1, 6515 Template = RenderMiniCartScriptTemplates(), 6516 SkipRenderBlocksList = true, 6517 BlocksList = new List<Block> 6518 { 6519 orderLines, 6520 new Block { 6521 Id = "MiniCartFooter", 6522 Template = RenderMiniCartFooter(), 6523 SortId = 50, 6524 SkipRenderBlocksList = true, 6525 BlocksList = new List<Block> 6526 { 6527 new Block { 6528 Id = "MiniCartSubTotal", 6529 Template = RenderMiniCartSubTotal(), 6530 SortId = 30 6531 }, 6532 new Block { 6533 Id = "MiniCartFees", 6534 Template = RenderMiniCartFees(), 6535 SortId = 40 6536 }, 6537 new Block { 6538 Id = "MiniCartPoints", 6539 Template = RenderMiniCartPoints(), 6540 SortId = 50 6541 }, 6542 new Block { 6543 Id = "MiniCartTotal", 6544 Template = RenderMiniCartTotal(), 6545 SortId = 60 6546 }, 6547 new Block { 6548 Id = "MiniCartDisclaimer", 6549 Template = RenderMiniCartDisclaimer(), 6550 SortId = 70 6551 }, 6552 new Block { 6553 Id = "MiniCartActions", 6554 Template = RenderMiniCartActions(), 6555 SortId = 80 6556 } 6557 } 6558 } 6559 } 6560 }; 6561 6562 miniCartBlocksPage.Add("MasterBottomSnippets", miniCartScriptTemplates); 6563 } 6564 6565 @helper RenderMiniCartScriptsTableTemplates() 6566 { 6567 <script id="MiniCartOrderline" type="text/x-template"> 6568 {{#unless isEmpty}} 6569 <tr> 6570 <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> 6571 <td class="u-va-middle"> 6572 <a href="{{link}}" class="mini-cart-orderline__name" title="{{name}}">{{name}}</a> 6573 {{#if variantname}} 6574 <a href="{{link}}" class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{variantname}}</a> 6575 {{/if}} 6576 {{#if unitname}} 6577 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{unitname}}</div> 6578 {{/if}} 6579 </td> 6580 <td class="u-ta-right u-va-middle">{{quantity}}</td> 6581 <td class="u-ta-right u-va-middle"> 6582 {{#if pointsTotal}} 6583 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 6584 {{else}} 6585 {{totalprice}} 6586 {{/if}} 6587 </td> 6588 </tr> 6589 {{/unless}} 6590 </script> 6591 6592 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 6593 {{#unless isEmpty}} 6594 <tr class="table__row--no-border"> 6595 <td class="u-w60px">&nbsp;</td> 6596 <td><div class="mini-cart-orderline__name dw-mod">{{name}}</div></td> 6597 <td class="u-ta-right">&nbsp;</td> 6598 <td class="u-ta-right">{{totalprice}}</td> 6599 </tr> 6600 {{/unless}} 6601 </script> 6602 } 6603 6604 @helper RenderMiniCartScriptsListTemplates() 6605 { 6606 int cartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 6607 6608 <script id="MiniCartOrderline" type="text/x-template"> 6609 {{#unless isEmpty}} 6610 <div class="mini-cart-orderline grid dw-mod"> 6611 <div class="grid__col-4"> 6612 <a href="{{link}}" class="{{hideimage}}"> 6613 <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}}"> 6614 </a> 6615 </div> 6616 <div class="grid__col-8"> 6617 <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> 6618 {{#if variantname}} 6619 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Variant"): {{variantname}}</div> 6620 {{/if}} 6621 {{#if unitname}} 6622 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Unit"): {{unitname}}</div> 6623 {{/if}} 6624 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Qty"): {{quantity}}</div> 6625 6626 <div class="grid__cell-footer"> 6627 <div class="grid__cell"> 6628 <div class="u-pull--left mini-cart-orderline__price dw-mod"> 6629 {{#if pointsTotal}} 6630 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 6631 {{else}} 6632 {{totalprice}} 6633 {{/if}} 6634 </div> 6635 <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> 6636 </div> 6637 </div> 6638 </div> 6639 </div> 6640 {{/unless}} 6641 </script> 6642 6643 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 6644 {{#unless isEmpty}} 6645 <div class="mini-cart-orderline mini-cart-orderline--discount grid dw-mod"> 6646 <div class="grid__col-4"> 6647 <div class="mini-cart-orderline__name mini-cart-orderline__name dw-mod">{{name}}</div> 6648 </div> 6649 <div class="grid__col-8">{{totalprice}}</div> 6650 </div> 6651 {{/unless}} 6652 </script> 6653 } 6654 6655 @helper RenderMiniCartScriptTemplates() 6656 { 6657 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMiniCartTemplates").OrderBy(item => item.SortId).ToList(); 6658 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 6659 string cartPageLink = string.Concat("/Default.aspx?ID=", GetPageIdByNavigationTag("CartPage")); 6660 6661 <script id="MiniCartContent" type="text/x-template"> 6662 {{#.}} 6663 {{#unless isEmpty}} 6664 @RenderBlockList(subBlocks) 6665 {{/unless}} 6666 {{/.}} 6667 </script> 6668 } 6669 6670 @helper RenderMiniCartOrderLinesTable() 6671 { 6672 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList(); 6673 6674 <div class="u-overflow-auto"> 6675 <table class="table mini-cart-table dw-mod"> 6676 @RenderBlockList(subBlocks) 6677 </table> 6678 </div> 6679 } 6680 6681 @helper RenderMiniCartOrderLinesBlocks() 6682 { 6683 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList(); 6684 6685 <div class="u-overflow-auto"> 6686 @RenderBlockList(subBlocks) 6687 </div> 6688 } 6689 6690 @helper RenderMiniCartOrderLinesHeader() 6691 { 6692 <thead> 6693 <tr> 6694 <td>&nbsp;</td> 6695 <td>@Translate("Product")</td> 6696 <td class="u-ta-right">@Translate("Qty")</td> 6697 <td class="u-ta-right" width="120">@Translate("Price")</td> 6698 </tr> 6699 </thead> 6700 } 6701 6702 @helper RenderMiniCartOrderLinesList() 6703 { 6704 <text> 6705 {{#OrderLines}} 6706 {{#ifCond template "===" "CartOrderline"}} 6707 {{>MiniCartOrderline}} 6708 {{/ifCond}} 6709 {{#ifCond template "===" "CartOrderlineMobile"}} 6710 {{>MiniCartOrderline}} 6711 {{/ifCond}} 6712 {{#ifCond template "===" "CartOrderlineDiscount"}} 6713 {{>MiniCartOrderlineDiscount}} 6714 {{/ifCond}} 6715 {{/OrderLines}} 6716 </text> 6717 } 6718 6719 @helper RenderMiniCartFees() 6720 { 6721 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 6722 if (!pointShop) 6723 { 6724 <text> 6725 {{#unless hidePaymentfee}} 6726 <div class="grid"> 6727 <div class="grid__col-6 grid__col--bleed-y"> 6728 {{paymentmethod}} 6729 </div> 6730 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{paymentfee}}</div> 6731 </div> 6732 {{/unless}} 6733 </text> 6734 } 6735 <text> 6736 {{#unless hideShippingfee}} 6737 <div class="grid"> 6738 <div class="grid__col-6 grid__col--bleed-y"> 6739 {{shippingmethod}} 6740 </div> 6741 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{shippingfee}}</div> 6742 </div> 6743 {{/unless}} 6744 </text> 6745 <text> 6746 {{#if hasTaxSettings}} 6747 <div class="grid"> 6748 <div class="grid__col-6 grid__col--bleed-y">@Translate("Sales Tax")</div> 6749 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{totaltaxes}}</div> 6750 </div> 6751 {{/if}} 6752 </text> 6753 } 6754 6755 @helper RenderMiniCartFooter() 6756 { 6757 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartFooter").OrderBy(item => item.SortId).ToList(); 6758 6759 <div class="mini-cart__footer u-border-top u-padding-top dw-mod"> 6760 @RenderBlockList(subBlocks) 6761 </div> 6762 } 6763 6764 @helper RenderMiniCartActions() 6765 { 6766 int cartPageId = GetPageIdByNavigationTag("CartPage"); 6767 6768 <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> 6769 <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> 6770 } 6771 6772 @helper RenderMiniCartPoints() 6773 { 6774 <text> 6775 {{#if earnings}} 6776 <div class="grid"> 6777 <div class="grid__col-6 grid__col--bleed-y">@Translate("Earnings")</div> 6778 <div class="grid__col-6 grid__col--bleed-y grid--align-end"> 6779 <div> 6780 <span class="u-color--loyalty-points">{{earnings}}</span> @Translate("points") 6781 </div> 6782 </div> 6783 </div> 6784 {{/if}} 6785 </text> 6786 } 6787 6788 @helper RenderMiniCartSubTotal() 6789 { 6790 bool hasTaxSettings = Dynamicweb.Rapido.Services.Countries.HasTaxSettings(Model.Cart.ID); 6791 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 6792 if (!pointShop) 6793 { 6794 <text> 6795 {{#unless hideSubTotal}} 6796 <div class="grid dw-mod u-bold"> 6797 <div class="grid__col-6 grid__col--bleed-y">@Translate("Subtotal")</div> 6798 <div class="grid__col-6 grid__col--bleed-y grid--align-end"> 6799 @if (hasTaxSettings) 6800 { 6801 <text>{{subtotalpricewithouttaxes}}</text> 6802 } 6803 else 6804 { 6805 <text>{{subtotalprice}}</text> 6806 } 6807 </div> 6808 </div> 6809 {{/unless}} 6810 </text> 6811 } 6812 } 6813 6814 @helper RenderMiniCartTotal() 6815 { 6816 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 6817 6818 <div class="mini-cart-totals grid u-border-top u-margin-top dw-mod"> 6819 <div class="grid__col-6">@Translate("Total")</div> 6820 <div class="grid__col-6 grid--align-end"> 6821 <div> 6822 @if (pointShop) 6823 { 6824 <span class="u-color--loyalty-points">{{pointsUsedInCart}}</span> @Translate("points") 6825 } 6826 else 6827 { 6828 <text>{{totalprice}}</text> 6829 } 6830 </div> 6831 </div> 6832 </div> 6833 } 6834 6835 @helper RenderMiniCartDisclaimer() 6836 { 6837 <text> 6838 {{#if showCheckoutDisclaimer}} 6839 <div class="grid u-margin-bottom u-ta-right"> 6840 <small class="grid__col-12">{{checkoutDisclaimer}}</small> 6841 </div> 6842 {{/if}} 6843 </text> 6844 } 6845 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 6846 6847 @using Dynamicweb.Rapido.Blocks.Extensibility 6848 @using Dynamicweb.Rapido.Blocks 6849 @using Dynamicweb.Rapido.Blocks.Components.General 6850 @using Dynamicweb.Rapido.Blocks.Components 6851 @using Dynamicweb.Rapido.Services 6852 6853 @{ 6854 string addToCartNotificationType = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType").SelectedValue : ""; 6855 string addToCartNotificationMiniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown"; 6856 bool addToCartHideCartIcon = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 6857 6858 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed() && !string.IsNullOrEmpty(addToCartNotificationType)) 6859 { 6860 if (addToCartNotificationType == "modal") 6861 { 6862 Block addToCartNotificationModal = new Block 6863 { 6864 Id = "AddToCartNotificationModal", 6865 Template = RenderAddToCartNotificationModal() 6866 }; 6867 6868 Block addToCartNotificationScript = new Block 6869 { 6870 Id = "AddToCartNotificationScript", 6871 Template = RenderAddToCartNotificationModalScript() 6872 }; 6873 BlocksPage.GetBlockPage("Master").Add("MasterTopSnippets", addToCartNotificationModal); 6874 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript); 6875 } 6876 else if (addToCartNotificationType == "toggle" && addToCartNotificationMiniCartLayout != "none" && !addToCartHideCartIcon && Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 6877 { 6878 Block addToCartNotificationScript = new Block 6879 { 6880 Id = "AddToCartNotificationScript", 6881 Template = RenderAddToCartNotificationToggleScript() 6882 }; 6883 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript); 6884 } 6885 } 6886 } 6887 6888 @helper RenderAddToCartNotificationModal() 6889 { 6890 <div id="LastAddedProductModal" data-template="LastAddedProductTemplate"></div> 6891 } 6892 6893 @helper RenderAddToCartNotificationModalScript() 6894 { 6895 int cartPageId = GetPageIdByNavigationTag("CartPage"); 6896 6897 <script id="LastAddedProductTemplate" type="text/x-template"> 6898 @{ 6899 6900 Modal lastAddedProduct = new Modal 6901 { 6902 Id = "LastAddedProduct", 6903 Heading = new Heading 6904 { 6905 Level = 2, 6906 Title = Translate("Product is added to the cart") 6907 }, 6908 Width = ModalWidth.Md, 6909 BodyTemplate = RenderModalContent() 6910 }; 6911 6912 lastAddedProduct.AddActions( 6913 new Button 6914 { 6915 ButtonType = ButtonType.Button, 6916 ButtonLayout = ButtonLayout.Secondary, 6917 Title = Translate("Continue shopping"), 6918 CssClass = "u-pull--left u-no-margin btn--sm", 6919 OnClick = "document.getElementById('LastAddedProductModalTrigger').checked = false" 6920 }, 6921 new Link 6922 { 6923 Href = "/Default.aspx?ID=" + cartPageId, 6924 ButtonLayout = ButtonLayout.Secondary, 6925 CssClass = "u-pull--right u-no-margin btn--sm", 6926 Title = Translate("Proceed to checkout") 6927 } 6928 ); 6929 6930 @Render(lastAddedProduct) 6931 } 6932 </script> 6933 <script> 6934 document.addEventListener('addToCart', function (event) { 6935 Cart.ShowLastAddedProductModal(event.detail); 6936 }); 6937 </script> 6938 } 6939 6940 @helper RenderModalContent() 6941 { 6942 <div class="grid"> 6943 <div class="grid__col-2"> 6944 @Render(new Image { Path = "{{ productInfo.image }}", Link = "{{ productInfo.link }}", Title = "{{ productInfo.name }}", DisableImageEngine = true }) 6945 </div> 6946 <div class="u-padding grid--align-self-center"> 6947 <span>{{quantity}}</span> x 6948 </div> 6949 <div class="grid__col-auto grid--align-self-center"> 6950 <div>{{productInfo.name}}</div> 6951 {{#if productInfo.variantName}} 6952 <small class="u-margin-bottom-5px">{{productInfo.variantName}}</small> 6953 {{/if}} 6954 {{#if productInfo.unitName}} 6955 <small class="u-margin-bottom-5px">{{productInfo.unitName}}</small> 6956 {{/if}} 6957 </div> 6958 </div> 6959 } 6960 6961 @helper RenderAddToCartNotificationToggleScript() 6962 { 6963 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 6964 6965 <script> 6966 document.addEventListener('addToCart', function () { 6967 Cart.ToggleMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '@miniCartFeedPageId'); 6968 }); 6969 </script> 6970 } 6971 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 6972 6973 @using System 6974 @using System.Web 6975 @using System.Collections.Generic 6976 @using Dynamicweb.Rapido.Blocks.Extensibility 6977 @using Dynamicweb.Rapido.Blocks 6978 @using Dynamicweb.Rapido.Blocks.Components.General 6979 6980 @functions { 6981 BlocksPage footerBlocksPage = BlocksPage.GetBlockPage("Master"); 6982 } 6983 6984 @{ 6985 string footerColumnOneContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Content"); 6986 string footerColumnTwoContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Content"); 6987 string footerColumnThreeContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Content"); 6988 string footerColumnOneHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Header"); 6989 string footerColumnTwoHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Header"); 6990 string footerColumnThreeHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Header"); 6991 6992 Block masterFooterContent = new Block() 6993 { 6994 Id = "MasterFooterContent", 6995 SortId = 10, 6996 Template = RenderFooter(), 6997 SkipRenderBlocksList = true 6998 }; 6999 footerBlocksPage.Add(MasterBlockId.MasterFooter, masterFooterContent); 7000 7001 if (!string.IsNullOrEmpty(footerColumnOneContent) || !string.IsNullOrEmpty(footerColumnOneHeader)) 7002 { 7003 Block masterFooterColumnOne = new Block 7004 { 7005 Id = "MasterFooterColumnOne", 7006 SortId = 10, 7007 Template = RenderFooterColumn(footerColumnOneHeader, footerColumnOneContent), 7008 Design = new Design 7009 { 7010 Size = "auto", 7011 RenderType = RenderType.Column 7012 } 7013 }; 7014 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnOne); 7015 } 7016 7017 if (!string.IsNullOrEmpty(footerColumnTwoContent) || !string.IsNullOrEmpty(footerColumnTwoHeader)) 7018 { 7019 Block masterFooterColumnTwo = new Block 7020 { 7021 Id = "MasterFooterColumnTwo", 7022 SortId = 20, 7023 Template = RenderFooterColumn(footerColumnTwoHeader, footerColumnTwoContent), 7024 Design = new Design 7025 { 7026 Size = "auto", 7027 RenderType = RenderType.Column 7028 } 7029 }; 7030 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnTwo); 7031 } 7032 7033 if (!string.IsNullOrEmpty(footerColumnThreeContent) || !string.IsNullOrEmpty(footerColumnThreeHeader)) 7034 { 7035 Block masterFooterColumnThree = new Block 7036 { 7037 Id = "MasterFooterColumnThree", 7038 SortId = 30, 7039 Template = RenderFooterColumn(footerColumnThreeHeader, footerColumnThreeContent), 7040 Design = new Design 7041 { 7042 Size = "auto", 7043 RenderType = RenderType.Column 7044 } 7045 }; 7046 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnThree); 7047 } 7048 7049 if (Model.Area.Item.GetItem("Layout").GetBoolean("FooterNewsletterSignUp")) 7050 { 7051 Block masterFooterNewsletterSignUp = new Block 7052 { 7053 Id = "MasterFooterNewsletterSignUp", 7054 SortId = 40, 7055 Template = RenderFooterNewsletterSignUp(), 7056 Design = new Design 7057 { 7058 Size = "auto", 7059 RenderType = RenderType.Column 7060 } 7061 }; 7062 footerBlocksPage.Add("MasterFooterContent", masterFooterNewsletterSignUp); 7063 } 7064 7065 if (Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks").Count > 0) 7066 { 7067 Block masterFooterSocialLinks = new Block 7068 { 7069 Id = "MasterFooterSocialLinks", 7070 SortId = 50, 7071 Template = RenderFooterSocialLinks(), 7072 Design = new Design 7073 { 7074 Size = "auto", 7075 RenderType = RenderType.Column 7076 } 7077 }; 7078 footerBlocksPage.Add("MasterFooterContent", masterFooterSocialLinks); 7079 } 7080 7081 if (Model.Area.Item.GetItem("Layout").GetItems("FooterPayments") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterPayments").Count > 0) 7082 { 7083 Block masterFooterPayments = new Block 7084 { 7085 Id = "MasterFooterPayments", 7086 SortId = 60, 7087 Template = RenderFooterPayments(), 7088 Design = new Design 7089 { 7090 Size = "12", 7091 RenderType = RenderType.Column 7092 } 7093 }; 7094 footerBlocksPage.Add("MasterFooterContent", masterFooterPayments); 7095 } 7096 7097 Block masterFooterCopyright = new Block 7098 { 7099 Id = "MasterFooterCopyright", 7100 SortId = 70, 7101 Template = RenderFooterCopyright(), 7102 Design = new Design 7103 { 7104 Size = "12", 7105 RenderType = RenderType.Column 7106 } 7107 }; 7108 footerBlocksPage.Add("MasterFooterContent", masterFooterCopyright); 7109 } 7110 7111 @helper RenderFooter() 7112 { 7113 List<Block> subBlocks = this.footerBlocksPage.GetBlockListById("MasterFooterContent").OrderBy(item => item.SortId).ToList(); 7114 7115 <footer class="footer dw-mod"> 7116 <div class="center-container top-container__center-container dw-mod"> 7117 <div class="grid grid--external-bleed-x"> 7118 @RenderBlockList(subBlocks) 7119 </div> 7120 </div> 7121 </footer> 7122 } 7123 7124 @helper RenderFooterColumn(string header, string content) 7125 { 7126 <h3 class="footer__heading dw-mod">@header</h3> 7127 <div class="footer__content dw-mod"> 7128 @content 7129 </div> 7130 } 7131 7132 @helper RenderFooterNewsletterSignUp() 7133 { 7134 string newsletterSignUpPageId = GetPageIdByNavigationTag("NewsletterSignUp").ToString(); 7135 Form form = new Form { Action = "/Default.aspx", Method = FormMethod.Get, Enctype = FormEnctype.multipart }; 7136 7137 form.Add(new HiddenField { Name = "ID", Value = newsletterSignUpPageId }); 7138 form.Add(new Text { Content = "<p>" + Translate("Sign up if you would like to receive occasional treats from us") + "</p>" }); 7139 form.Add(new TextField { 7140 Id = "NewsletterEmail", Name = "NewsletterEmail", Placeholder = Translate("Your email address"), 7141 Type = TextFieldType.Email, 7142 ActionButton = new Button { 7143 ButtonType = ButtonType.Submit, Id="Submitter", Title = Translate("Go"), OnClick = "Buttons.LockButton(event)", CssClass = "btn--condensed" 7144 } 7145 }); 7146 7147 <h3 class="footer__heading dw-mod">@Translate("Mailing list")</h3> 7148 <div class="footer__content dw-mod"> 7149 @Render(form) 7150 </div> 7151 } 7152 7153 @helper RenderFooterSocialLinks() 7154 { 7155 <h3 class="footer__heading dw-mod">@Translate("Social links")</h3> 7156 <div class="footer__content dw-mod"> 7157 <div class="collection dw-mod"> 7158 @foreach (var socialitem in Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks")) 7159 { 7160 var socialIcon = socialitem.GetValue("Icon") as Dynamicweb.Frontend.ListViewModel; 7161 string socialIconClass = socialIcon.SelectedValue; 7162 string socialIconTitle = socialIcon.SelectedName; 7163 string socialLink = socialitem.GetString("Link"); 7164 7165 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px" rel="noopener"><i class="@socialIconClass fa-2x"></i></a> 7166 } 7167 </div> 7168 </div> 7169 } 7170 7171 @helper RenderFooterPayments() 7172 { 7173 <div class="footer__content dw-mod"> 7174 <div class="collection dw-mod"> 7175 @foreach (var payment in Model.Area.Item.GetItem("Layout").GetItems("FooterPayments")) 7176 { 7177 var paymentItem = payment.GetValue("CardTypeOrVerifiedPayment") as Dynamicweb.Frontend.ListViewModel; 7178 string paymentImage = null; 7179 string paymentTitle = paymentItem.SelectedName; 7180 ListOptionViewModel selected = paymentItem.SelectedOptions.FirstOrDefault(); 7181 if (selected != null) 7182 { 7183 paymentImage = selected.Icon; 7184 } 7185 7186 <div class="footer__card-type"> 7187 <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" /> 7188 </div> 7189 } 7190 </div> 7191 </div> 7192 } 7193 7194 @helper RenderFooterCopyright() 7195 { 7196 <div class="grid__col-12 footer__copyright dw-mod"> 7197 <p>@Model.Area.Item.GetItem("Layout").GetString("FooterCopyrightText")</p> 7198 </div> 7199 } 7200 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 7201 7202 @using System 7203 @using System.Web 7204 @using System.Collections.Generic 7205 @using Dynamicweb.Rapido.Blocks.Extensibility 7206 @using Dynamicweb.Rapido.Blocks 7207 @using Dynamicweb.Ecommerce.Common 7208 7209 @{ 7210 BlocksPage referencesBlocksPage = BlocksPage.GetBlockPage("Master"); 7211 7212 Block masterScriptReferences = new Block() 7213 { 7214 Id = "MasterScriptReferences", 7215 SortId = 1, 7216 Template = RenderMasterScriptReferences() 7217 }; 7218 referencesBlocksPage.Add(MasterBlockId.MasterReferences, masterScriptReferences); 7219 7220 Block masterCustomScriptReferences = new Block() 7221 { 7222 Id = "MasterScriptReferences", 7223 SortId = 10, 7224 Template = RenderMasterCustomScriptReferences() 7225 }; 7226 referencesBlocksPage.Add(MasterBlockId.MasterReferences, masterCustomScriptReferences); 7227 } 7228 7229 @helper RenderMasterScriptReferences() { 7230 <script src="/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js"></script> 7231 <script src="/Files/Templates/Designs/Rapido/js/master.min.js"></script> 7232 PushPromise("/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js"); 7233 PushPromise("/Files/Templates/Designs/Rapido/js/master.min.js"); 7234 } 7235 7236 @helper RenderMasterCustomScriptReferences() { 7237 if (Model.Area.Item.GetItem("Custom").GetBoolean("UseCustomJavascript")) 7238 { 7239 var minify = Model.Area.Item.GetItem("Rizzo").GetBoolean("MinifyJavascript"); 7240 const string folderName = "custom"; 7241 var customBundle = Dna.Optimizer.Renderer.RenderScripts($"/Files/Templates/Designs/Rapido/js/{folderName}", $"-{folderName}-scripts", new List<string>(), new List<string>(), minify, false, false); 7242 <script src="@customBundle"></script> 7243 PushPromise(customBundle); 7244 } 7245 } 7246 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 7247 7248 @using System 7249 @using System.Web 7250 @using System.Collections.Generic 7251 @using Dynamicweb.Rapido.Blocks.Extensibility 7252 @using Dynamicweb.Rapido.Blocks 7253 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 7254 @using Dynamicweb.Rapido.Services 7255 7256 @{ 7257 BlocksPage searchBlocksPage = BlocksPage.GetBlockPage("Master"); 7258 bool navigationItemsHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 7259 bool isFavoriteList = !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("ListID")); 7260 7261 if (!navigationItemsHideSearch || isFavoriteList) 7262 { 7263 Block masterSearchScriptTemplates = new Block() 7264 { 7265 Id = "MasterSearchScriptTemplates", 7266 SortId = 1, 7267 Template = RenderSearchScriptTemplates() 7268 }; 7269 7270 searchBlocksPage.Add(MasterBlockId.MasterBottomSnippets, masterSearchScriptTemplates); 7271 } 7272 } 7273 7274 @helper RenderSearchScriptTemplates() 7275 { 7276 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 7277 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 7278 bool useFacebookPixel = !string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID")); 7279 bool useGoogleTagManager = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID")); 7280 bool showPrice = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HidePriceInSearchResults"); 7281 bool showAddToCartButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideAddToCartButton"); 7282 bool showViewButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideViewButton"); 7283 bool showAddToDownloadButton = Pageview.AreaSettings.GetItem("Layout").GetBoolean("ShowAddToDownloadButton"); 7284 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 7285 7286 <script id="SearchGroupsTemplate" type="text/x-template"> 7287 {{#.}} 7288 <li class="dropdown__item dw-mod" onclick="Search.UpdateGroupSelection(this)" data-group-id="{{id}}">{{name}}</li> 7289 {{/.}} 7290 </script> 7291 7292 <script id="SearchProductsTemplate" type="text/x-template"> 7293 {{#each .}} 7294 {{#Product}} 7295 {{#ifCond template "!==" "SearchMore"}} 7296 <li class="dropdown__item dropdown__item--seperator dw-mod"> 7297 @if (useFacebookPixel) 7298 { 7299 <text>{{{facebookPixelSearch name number priceDouble currency searchParameter}}}</text> 7300 } 7301 @if (useGoogleTagManager) 7302 { 7303 <text>{{{googleEnchantImpression 'Search results' currency googleImpression}}}</text> 7304 } 7305 <div> 7306 <a href="{{link}}" class="js-typeahead-link u-color-inherit u-pull--left" onclick="{{googleImpressionClick}}" title="{{name}}{{#if variantName}}, {{variantName}}{{/if}}"> 7307 <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> 7308 <div class="u-pull--left"> 7309 <div class="u-bold u-max-w220px u-truncate-text js-typeahead-name">{{name}}{{#if variantName}}, {{variantName}}{{/if}}</div> 7310 @if (showPrice && Dynamicweb.Rapido.Services.User.IsPricesAllowed()) 7311 { 7312 if (pointShopOnly) 7313 { 7314 <text> 7315 {{#if havePointPrice}} 7316 <div> 7317 <span class="u-color--loyalty-points">{{points}}</span> @Translate("points") 7318 </div> 7319 {{else}} 7320 <small class="help-text u-no-margin">@Translate("Not available")</small> 7321 {{/if}} 7322 {{#unless canBePurchasedWithPoints}} 7323 {{#if havePointPrice}} 7324 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small> 7325 {{/if}} 7326 {{/unless}} 7327 </text> 7328 } 7329 else 7330 { 7331 <div>{{price}}</div> 7332 } 7333 } 7334 </div> 7335 </a> 7336 <div class="u-margin-left u-pull--right"> 7337 @{ 7338 var viewBtn = new Link 7339 { 7340 Href = "{{link}}", 7341 OnClick = "{{googleImpressionClick}}", 7342 ButtonLayout = ButtonLayout.Secondary, 7343 CssClass = "btn--condensed u-no-margin u-w80px js-ignore-click-outside", 7344 Title = Translate("View") 7345 }; 7346 } 7347 @if (showAddToCartButton && Dynamicweb.Rapido.Services.User.IsBuyingAllowed()) 7348 { 7349 <text>{{#if hideAddToCartButton}}</text> 7350 @Render(viewBtn) 7351 <text>{{else}}</text> 7352 @Render(new AddToCartButton 7353 { 7354 HideTitle = true, 7355 ProductId = "{{productId}}", 7356 ProductInfo = "{{productInfo}}", 7357 BuyForPoints = pointShopOnly, 7358 OnClick = "{{facebookPixelAction}}", 7359 CssClass = "u-w80px js-ignore-click-outside", 7360 Icon = new Icon { 7361 CssClass = "js-ignore-click-outside" 7362 }, 7363 ExtraAttributes = new Dictionary<string, string> 7364 { 7365 { "{{disabledBuyButton}}", "" } 7366 } 7367 }) 7368 <text>{{/if}}</text> 7369 } 7370 else if (showViewButton) 7371 { 7372 @Render(viewBtn) 7373 } 7374 @if (showAddToDownloadButton) 7375 { 7376 <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}}"> 7377 <i class="fas fa-plus js-button-icon"></i> 7378 </button> 7379 } 7380 </div> 7381 </div> 7382 </li> 7383 {{/ifCond}} 7384 {{#ifCond template "===" "SearchMore"}} 7385 {{>SearchMoreProducts}} 7386 {{/ifCond}} 7387 {{/Product}} 7388 {{else}} 7389 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod"> 7390 @Translate("Your search gave 0 results") 7391 </li> 7392 {{/each}} 7393 </script> 7394 7395 <script id="SearchMoreProducts" type="text/x-template"> 7396 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 7397 <a href="/Default.aspx?ID=@productsPageId&Search={{searchParameter}}&GroupID={{groupId}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 7398 @Translate("View all") 7399 </a> 7400 </li> 7401 </script> 7402 7403 <script id="SearchMorePages" type="text/x-template"> 7404 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 7405 <a href="/Default.aspx?ID=@contentSearchPageLink&Search={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 7406 @Translate("View all") 7407 </a> 7408 </li> 7409 </script> 7410 7411 <script id="SearchPagesTemplate" type="text/x-template"> 7412 {{#each .}} 7413 {{#ifCond template "!==" "SearchMore"}} 7414 <li class="dropdown__item dropdown__item--seperator dw-mod"> 7415 <div> 7416 <a href="/Default.aspx?ID={{id}}" class="js-typeahead-link u-pull--left u-color-inherit"> 7417 <div class="u-margin-right u-pull--left"><i class="fa {{icon}} u-w20px u-ta-center"></i></div> 7418 <div class="u-pull--left"> 7419 <div class="u-bold u-truncate-text u-max-w220px js-typeahead-name">{{name}}</div> 7420 </div> 7421 </a> 7422 </div> 7423 </li> 7424 {{/ifCond}} 7425 {{#ifCond template "===" "SearchMore"}} 7426 {{>SearchMorePages}} 7427 {{/ifCond}} 7428 {{else}} 7429 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod"> 7430 @Translate("Your search gave 0 results") 7431 </li> 7432 {{/each}} 7433 </script> 7434 7435 <script id="SearchPagesTemplateWrap" type="text/x-template"> 7436 <div class="dropdown__column-header">@Translate("Pages")</div> 7437 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod"> 7438 {{>SearchPagesTemplate}} 7439 </ul> 7440 </script> 7441 7442 <script id="SearchProductsTemplateWrap" type="text/x-template"> 7443 <div class="dropdown__column-header">@Translate("Products")</div> 7444 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod"> 7445 {{>SearchProductsTemplate}} 7446 </ul> 7447 </script> 7448 } 7449 7450 @using Dynamicweb.Rapido.Blocks.Components 7451 @using Dynamicweb.Rapido.Blocks.Components.General 7452 @using Dynamicweb.Rapido.Blocks 7453 @using System.IO 7454 7455 7456 @using Dynamicweb.Rapido.Blocks.Components.General 7457 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 7458 7459 7460 @* Component *@ 7461 7462 @helper RenderVariantMatrix(VariantMatrix settings) { 7463 if (settings != null) 7464 { 7465 int productLoopCounter = 0; 7466 int groupCount = 0; 7467 List<VariantOption> firstDimension = new List<VariantOption>(); 7468 List<VariantOption> secondDimension = new List<VariantOption>(); 7469 List<VariantOption> thirdDimension = new List<VariantOption>(); 7470 7471 foreach (VariantGroup variantGroup in settings.GetVariantGroups()) 7472 { 7473 foreach (VariantOption variantOptions in variantGroup.GetVariantOptions()) 7474 { 7475 if (groupCount == 0) { 7476 firstDimension.Add(variantOptions); 7477 } 7478 if (groupCount == 1) 7479 { 7480 secondDimension.Add(variantOptions); 7481 } 7482 if (groupCount == 2) 7483 { 7484 thirdDimension.Add(variantOptions); 7485 } 7486 } 7487 groupCount++; 7488 } 7489 7490 int rowCount = 0; 7491 int columnCount = 0; 7492 7493 <script> 7494 var variantsCollection = []; 7495 </script> 7496 7497 <table class="table table--compact js-variants-matrix dw-mod" id="VariantMatrixTable_@settings.ProductId"> 7498 @if (groupCount == 1) 7499 { 7500 <tbody> 7501 @foreach (VariantOption firstVariantOption in firstDimension) 7502 { 7503 var variantId = firstVariantOption.Id; 7504 <tr> 7505 <td class="u-bold"> 7506 @firstVariantOption.Name 7507 </td> 7508 <td> 7509 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount) 7510 </td> 7511 </tr> 7512 productLoopCounter++; 7513 } 7514 7515 <tr> 7516 <td>&nbsp;</td> 7517 <td> 7518 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div> 7519 </td> 7520 </tr> 7521 </tbody> 7522 } 7523 @if (groupCount == 2) 7524 { 7525 <thead> 7526 <tr> 7527 <td>&nbsp;</td> 7528 @foreach (VariantOption variant in secondDimension) 7529 { 7530 <td>@variant.Name</td> 7531 } 7532 </tr> 7533 </thead> 7534 <tbody> 7535 @foreach (VariantOption firstVariantOption in firstDimension) 7536 { 7537 string variantId = ""; 7538 columnCount = 0; 7539 7540 <tr> 7541 <td class="u-min-w120px">@firstVariantOption.Name</td> 7542 7543 @foreach (VariantOption secondVariantOption in secondDimension) 7544 { 7545 variantId = firstVariantOption.Id + "." + secondVariantOption.Id; 7546 <td> 7547 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount) 7548 </td> 7549 7550 columnCount++; 7551 7552 productLoopCounter++; 7553 } 7554 7555 <td> 7556 <div class="qty-field js-total-qty-row-@rowCount dw-mod">0</div> 7557 </td> 7558 </tr> 7559 7560 rowCount++; 7561 } 7562 7563 @{ 7564 columnCount = 0; 7565 } 7566 7567 <tr> 7568 <td>&nbsp;</td> 7569 @foreach (VariantOption secondVariantOption in secondDimension) 7570 { 7571 <td> 7572 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div> 7573 </td> 7574 7575 columnCount++; 7576 } 7577 <td>&nbsp;</td> 7578 </tr> 7579 </tbody> 7580 } 7581 @if (groupCount == 3) 7582 { 7583 <thead> 7584 <tr> 7585 <td>&nbsp;</td> 7586 @foreach (VariantOption thirdVariantOption in thirdDimension) 7587 { 7588 <td>@thirdVariantOption.Name</td> 7589 } 7590 </tr> 7591 </thead> 7592 <tbody> 7593 @foreach (VariantOption firstVariantOption in firstDimension) 7594 { 7595 int colspan = (thirdDimension.Count + 1); 7596 7597 <tr> 7598 <td colspan="@colspan" class="u-color-light-gray--bg u-bold">@firstVariantOption.Name</td> 7599 </tr> 7600 7601 foreach (VariantOption secondVariantOption in secondDimension) 7602 { 7603 string variantId = ""; 7604 columnCount = 0; 7605 7606 <tr> 7607 <td class="u-min-w120px">@secondVariantOption.Name</td> 7608 7609 @foreach (VariantOption thirdVariantOption in thirdDimension) 7610 { 7611 variantId = firstVariantOption.Id + "." + secondVariantOption.Id + "." + thirdVariantOption.Id; 7612 7613 <td> 7614 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount) 7615 </td> 7616 7617 columnCount++; 7618 productLoopCounter++; 7619 } 7620 7621 <td> 7622 <div class="qty-field js-total-qty-row-@rowCount dw-mod">0</div> 7623 </td> 7624 </tr> 7625 rowCount++; 7626 } 7627 } 7628 7629 @{ 7630 columnCount = 0; 7631 } 7632 7633 <tr> 7634 <td>&nbsp;</td> 7635 @foreach (VariantOption thirdVariantOption in thirdDimension) 7636 { 7637 <td> 7638 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div> 7639 </td> 7640 7641 columnCount++; 7642 } 7643 <td>&nbsp;</td> 7644 </tr> 7645 </tbody> 7646 } 7647 </table> 7648 7649 <script> 7650 document.addEventListener("DOMContentLoaded", function (event) { 7651 MatrixUpdateQuantity("@settings.ProductId"); 7652 }); 7653 7654 MatrixUpdateQuantity = function (productId) { 7655 var currentMatrix = document.getElementById("VariantMatrixTable_" + productId); 7656 var allQtyFields = currentMatrix.getElementsByClassName("js-qty"); 7657 7658 var qtyRowArr = []; 7659 var qtyColumnArr = []; 7660 7661 var totalQty = 0; 7662 7663 for (var i = 0; i < allQtyFields.length; i++) { 7664 qtyRowArr[allQtyFields[i].getAttribute("data-qty-row-group")] = 0; 7665 qtyColumnArr[allQtyFields[i].getAttribute("data-qty-column-group")] = 0; 7666 } 7667 7668 for (var i = 0; i < allQtyFields.length; i++) { 7669 qtyRowArr[allQtyFields[i].getAttribute("data-qty-row-group")] += parseFloat(allQtyFields[i].value); 7670 qtyColumnArr[allQtyFields[i].getAttribute("data-qty-column-group")] += parseFloat(allQtyFields[i].value); 7671 totalQty += parseFloat(allQtyFields[i].value); 7672 } 7673 7674 //Update row counters 7675 for (var i = 0; i < qtyRowArr.length; i++) { 7676 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-row-" + i)[0]; 7677 7678 if (qtyRowArr[i] != undefined && qtyCounter != null) { 7679 var currentCount = qtyCounter.innerHTML; 7680 qtyCounter.innerHTML = qtyRowArr[i]; 7681 7682 if (currentCount != qtyCounter.innerHTML) { 7683 qtyCounter.classList.add("qty-field--active"); 7684 } 7685 } 7686 7687 } 7688 7689 //Update column counters 7690 for (var i = 0; i < qtyColumnArr.length; i++) { 7691 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-column-" + i)[0]; 7692 7693 if (qtyColumnArr[i] != undefined && qtyCounter != null) { 7694 var currentCount = qtyCounter.innerHTML; 7695 qtyCounter.innerHTML = qtyColumnArr[i]; 7696 7697 if (currentCount != qtyCounter.innerHTML) { 7698 qtyCounter.classList.add("qty-field--active"); 7699 } 7700 } 7701 } 7702 7703 if (document.getElementById("TotalQtyCount_" + productId)) { 7704 document.getElementById("TotalQtyCount_" + productId).innerHTML = totalQty; 7705 } 7706 7707 //Clean up animations 7708 setTimeout(function () { 7709 for (var i = 0; i < qtyRowArr.length; i++) { 7710 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-row-" + i)[0]; 7711 if (qtyCounter != null) { 7712 qtyCounter.classList.remove("qty-field--active"); 7713 } 7714 } 7715 for (var i = 0; i < qtyColumnArr.length; i++) { 7716 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-column-" + i)[0]; 7717 if (qtyCounter != null) { 7718 qtyCounter.classList.remove("qty-field--active"); 7719 } 7720 } 7721 }, 1000); 7722 } 7723 </script> 7724 } 7725 } 7726 7727 @helper RenderVariantMatrixQuantityField(string variantId, VariantMatrix settings, int productLoopCounter, int rowCount, int columnCount) 7728 { 7729 string loopCount = productLoopCounter.ToString(); 7730 7731 bool combinationFound = false; 7732 double stock = 0; 7733 double quantityValue = 0; 7734 string note = ""; 7735 7736 VariantProduct variantProduct = null; 7737 7738 if (settings.GetVariantProducts().TryGetValue(variantId, out variantProduct)) 7739 { 7740 stock = variantProduct.Stock; 7741 quantityValue = variantProduct.Quantity; 7742 combinationFound = true; 7743 } 7744 7745 if (combinationFound) 7746 { 7747 <input type="hidden" name="ProductLoopCounter@(loopCount)" value="@loopCount" /> 7748 <input type="hidden" name="ProductID@(loopCount)" value="@settings.ProductId" /> 7749 <input type="hidden" name="VariantID@(loopCount)" value="@variantId" /> 7750 <input type="hidden" name="CurrentNote@(loopCount)" id="CurrentNote_@(settings.ProductId)_@variantId" value="@note" /> 7751 <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"> 7752 7753 if (stock != 0) 7754 { 7755 <small>@Translate("Stock") @stock</small> 7756 } 7757 7758 <script> 7759 var variants = '{ "ProductId" :' + '"@settings.ProductId"' + ', "VariantId": ' + '"@variantId"' +'}'; 7760 variantsCollection.push(variants); 7761 document.getElementById("Quantity_@(settings.ProductId)_@variantId").closest(".js-variants-matrix").setAttribute("data-variants-collection", "[" + variantsCollection + "]" ); 7762 </script> 7763 } 7764 else 7765 { 7766 <div class="use-btn-height" style="background-color: #a8a8a8"></div> 7767 } 7768 } 7769 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 7770 7771 @* Component *@ 7772 7773 @helper RenderAddToCart(AddToCart settings) 7774 { 7775 //set Id for quantity selector to get it's value from button 7776 if (settings.QuantitySelector != null) 7777 { 7778 if (string.IsNullOrEmpty(settings.QuantitySelector.Id)) 7779 { 7780 settings.QuantitySelector.Id = Guid.NewGuid().ToString("N"); 7781 } 7782 7783 settings.AddButton.QuantitySelectorId = settings.QuantitySelector.Id; 7784 7785 if (settings.Disabled) 7786 { 7787 settings.QuantitySelector.Disabled = true; 7788 } 7789 7790 if (string.IsNullOrEmpty(settings.QuantitySelector.Name)) 7791 { 7792 settings.QuantitySelector.Name = settings.QuantitySelector.Id; 7793 } 7794 } 7795 7796 if (settings.Disabled) 7797 { 7798 settings.AddButton.Disabled = true; 7799 } 7800 7801 settings.AddButton.CssClass += " btn--condensed"; 7802 7803 //unitsSelector 7804 if (settings.UnitSelector != null) 7805 { 7806 if (settings.Disabled) 7807 { 7808 settings.QuantitySelector.Disabled = true; 7809 } 7810 } 7811 7812 <div class="buttons-collection @settings.WrapperCssClass" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 7813 @if (settings.UnitSelector != null) 7814 { 7815 @Render(settings.UnitSelector) 7816 } 7817 @if (settings.QuantitySelector != null) 7818 { 7819 @Render(settings.QuantitySelector) 7820 } 7821 @Render(settings.AddButton) 7822 </div> 7823 } 7824 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 7825 7826 @* Component *@ 7827 7828 @helper RenderAddToCartButton(AddToCartButton settings) 7829 { 7830 if (!settings.HideTitle) 7831 { 7832 if (string.IsNullOrEmpty(settings.Title)) 7833 { 7834 if (settings.BuyForPoints) 7835 { 7836 settings.Title = Translate("Buy with points"); 7837 } 7838 else 7839 { 7840 settings.Title = Translate("Add to cart"); 7841 } 7842 } 7843 } 7844 else 7845 { 7846 settings.Title = ""; 7847 } 7848 7849 if (settings.Icon == null) 7850 { 7851 settings.Icon = new Icon(); 7852 settings.Icon.LabelPosition = Dynamicweb.Rapido.Blocks.Components.General.IconLabelPosition.After; 7853 } 7854 7855 if (string.IsNullOrEmpty(settings.Icon.Name)) 7856 { 7857 settings.Icon.Name = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue; 7858 } 7859 7860 string cartArgs = "{ " + 7861 "id: '" + settings.ProductId + "'," + 7862 (!string.IsNullOrEmpty(settings.VariantId) ? "variantId: '" + settings.VariantId + "'," : "") + 7863 (!string.IsNullOrEmpty(settings.UnitId) ? "unitId: '" + settings.UnitId + "'," : "") + 7864 (settings.BuyForPoints ? "buyForPoints: true," : "") + 7865 (!string.IsNullOrEmpty(settings.ProductInfo) ? "productInfo: " + settings.ProductInfo + "," : "") + 7866 "quantity: " + (string.IsNullOrEmpty(settings.QuantitySelectorId) ? "1" : "parseFloat(document.getElementById('" + settings.QuantitySelectorId + "').value)") + 7867 "}"; 7868 string stockValidationUrl = Dna.StockValidation.Product.GetValidationUrl(GetPageIdByNavigationTag("StockValidation"), settings.ProductId, settings.VariantId, settings.UnitId, Pageview.Area.EcomLanguageId); 7869 7870 settings.OnClick = "StockValidation.AddToCartValidation(event, " + cartArgs + ", '" + stockValidationUrl + "');" + settings.OnClick; 7871 7872 @RenderButton(settings) 7873 } 7874 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 7875 7876 @* Component *@ 7877 7878 @helper RenderUnitSelector(UnitSelector settings) 7879 { 7880 var id = settings.Id; 7881 var disabledClass = settings.Disabled ? "disabled" : ""; 7882 7883 <input type="checkbox" id="@id" class="dropdown-trigger" /> 7884 <div class="dropdown unit-selector @settings.CssClass @disabledClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 7885 <label class="dropdown__header dropdown__btn dropdown__btn--unit-selector dw-mod" for="@id">@settings.SelectedOption</label> 7886 <div class="dropdown__content dw-mod"> 7887 @settings.OptionsContent 7888 </div> 7889 <label class="dropdown-trigger-off" for="@id"></label> 7890 </div> 7891 } 7892 @using System.Reflection 7893 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 7894 7895 @* Component *@ 7896 7897 @helper RenderQuantitySelector(QuantitySelector settings) 7898 { 7899 var attributes = new Dictionary<string, string>(); 7900 7901 /*base settings*/ 7902 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 7903 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 7904 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 7905 if (settings.Disabled) { attributes.Add("disabled", "true"); } 7906 if (settings.Required) { attributes.Add("required", "true"); } 7907 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 7908 /*end*/ 7909 7910 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 7911 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 7912 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 7913 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 7914 if (settings.Max != null) { attributes.Add("max", settings.Max.ToString()); } 7915 if (settings.Min == null) { settings.Min = 1; } 7916 attributes.Add("min", settings.Min.ToString()); 7917 if (settings.Step != null && !string.IsNullOrEmpty(settings.Step.ToString())) { attributes.Add("step", settings.Step.ToString()); } 7918 if (settings.Value == null) { settings.Value = 1; } 7919 attributes.Add("value", settings.Value.ToString()); 7920 attributes.Add("type", "number"); 7921 7922 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 7923 7924 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 7925 } 7926 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 7927 7928 @using System 7929 @using System.Web 7930 @using System.Collections.Generic 7931 @using Dynamicweb.Rapido.Blocks.Extensibility 7932 @using Dynamicweb.Rapido.Blocks 7933 7934 @{ 7935 BlocksPage bottomSnippetsBlocksPage = BlocksPage.GetBlockPage("Master"); 7936 7937 Block primaryBottomSnippets = new Block() 7938 { 7939 Id = "MasterJavascriptInitializers", 7940 SortId = 100, 7941 Template = RenderPrimaryBottomSnippets() 7942 }; 7943 bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, primaryBottomSnippets); 7944 } 7945 7946 @helper RenderPrimaryBottomSnippets() { 7947 bool isWireframeMode = Model.Area.Item.GetItem("Settings").GetBoolean("WireframeMode"); 7948 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 7949 7950 if (isWireframeMode) 7951 { 7952 <script> 7953 Wireframe.Init(true); 7954 </script> 7955 } 7956 7957 7958 if (useGoogleTagManager) 7959 { 7960 <script> 7961 document.addEventListener('addToCart', function(event) { 7962 var googleImpression = event.detail.productInfo.googleImpression; 7963 dataLayer.push({ 7964 'event': 'addToCart', 7965 'ecommerce': { 7966 'currencyCode': '@Dynamicweb.Ecommerce.Services.Currencies.GetDefaultCurrency().Code', 7967 'add': { 7968 'products': [{ 7969 'name': googleImpression.name, 7970 'id': googleImpression.id, 7971 'price': googleImpression.price, 7972 'brand': googleImpression.brand, 7973 'category': googleImpression.category, 7974 'variant': googleImpression.variant, 7975 'quantity': event.detail.quantity 7976 }] 7977 } 7978 } 7979 }); 7980 }); 7981 </script> 7982 } 7983 7984 //if digitalwarehouse 7985 if (Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart")) 7986 { 7987 string cartContextId = Converter.ToString(HttpContext.Current.Application["DownloadCartContext"]); 7988 7989 if (string.IsNullOrEmpty(cartContextId)) { 7990 var moduleProps = Dynamicweb.Modules.Properties.GetParagraphModuleSettings(GetPageIdByNavigationTag("DownloadCart"), "eCom_CartV2"); 7991 var cartSettings = new Dynamicweb.Ecommerce.Cart.ModuleSettings(moduleProps); 7992 cartContextId = cartSettings.OrderContextID; 7993 HttpContext.Current.Application["DownloadCartContext"] = cartContextId; 7994 } 7995 7996 <script> 7997 let downloadCart = new DownloadCart({ 7998 cartPageId: @GetPageIdByNavigationTag("MiniCartFeed"), 7999 contextId: "@cartContextId", 8000 addButtonText: "@Translate("Add")", 8001 removeButtonText: "@Translate("Remove")" 8002 }); 8003 </script> 8004 } 8005 8006 <!--$$Javascripts--> 8007 } 8008 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 8009 @using System 8010 @using System.Web 8011 @using System.Collections.Generic 8012 @using Dynamicweb.Rapido.Blocks 8013 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 8014 @using Dynamicweb.Rapido.Blocks 8015 @using Dynamicweb.Rapido.Blocks.Extensibility 8016 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 8017 @using System.Collections.Generic 8018 @using Dynamicweb.Core 8019 @using Dynamicweb.Rapido.Blocks 8020 @using Dynamicweb.Rapido.Blocks.Components.General 8021 @using Dynamicweb.Rapido.Blocks.Extensibility 8022 @{ 8023 BlocksPage masterBlockPage = BlocksPage.GetBlockPage("Master"); 8024 masterBlockPage.RemoveBlockById("ImpersonationBar"); 8025 8026 if (Model.CurrentUser.ID > 0 && Dna.AutoImpersonate.Helpers.AmountOfUserICanSetAsSecondary > 1) 8027 { 8028 masterBlockPage.Add(MasterBlockId.MasterHeader, new Block() 8029 { 8030 Id = "RizzoImpersonationBarContainer", 8031 SortId = 5, 8032 Design = new Design() 8033 { 8034 CssClass = "center-container", 8035 RenderType = RenderType.None 8036 }, 8037 BlocksList = new List<Block>() 8038 { 8039 new Block() 8040 { 8041 Id = "RizzoImpersonationBar", 8042 SortId = 5, 8043 Design = new Design() 8044 { 8045 Size = "12", 8046 CssClass = "grid--justify-end", 8047 RenderType = RenderType.Column 8048 }, 8049 Template = RenderRizzoImpersonationBar() 8050 } 8051 } 8052 }); 8053 8054 if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request[Dna.AutoImpersonate.Constants.Parameters.RequireManaging])) 8055 { 8056 masterBlockPage.Add(MasterBlockId.MasterMain, new Block() 8057 { 8058 Id = "RizzoRequireManageAccount", 8059 SortId = 15, 8060 Design = new Design() 8061 { 8062 Size = "width-auto", 8063 HidePadding = true, 8064 CssClass = "u-color-warning--bg", 8065 RenderType = RenderType.Column 8066 }, 8067 Template = RenderRizzoRequireManageAccount() 8068 }); 8069 } 8070 } 8071 } 8072 @helper RenderRizzoImpersonationBar() 8073 { 8074 bool isManagingAccount = Model.CurrentSecondaryUser.ID > 0; 8075 string switchAccountUrl = string.Format("Default.aspx?Id={0}", GetPageIdByNavigationTag(Dna.AutoImpersonate.Constants.PageProperties.NavigationTags.Impersonation)); 8076 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; 8077 8078 <div class="u-font-size--sm"> 8079 @string.Format("{0}: {1}", isManagingAccount ? Translate("Managing Account") : Translate("Welcome Back"), userName) 8080 @Render(new Link() 8081 { 8082 Href = switchAccountUrl, 8083 CssClass = "u-margin-left", 8084 ButtonLayout = ButtonLayout.None, 8085 Title = Translate("Manage Account"), 8086 Icon = new Icon() 8087 { 8088 Prefix = "fas", 8089 Name = "fa-address-book", 8090 LabelPosition = IconLabelPosition.After 8091 } 8092 }) 8093 @Render(new Link() 8094 { 8095 Href = "/Admin/Public/ExtranetLogoff.aspx", 8096 CssClass = "u-margin-left", 8097 ButtonLayout = ButtonLayout.None, 8098 Title = Translate("Logout"), 8099 Icon = new Icon() 8100 { 8101 Prefix = "fas", 8102 Name = "fa-sign-out", 8103 LabelPosition = IconLabelPosition.After 8104 } 8105 }) 8106 </div> 8107 } 8108 8109 @helper RenderRizzoRequireManageAccount() 8110 { 8111 <div class="center-container"> 8112 <div class="grid"> 8113 <div class="grid--align-self-center grid__col-x"> 8114 <div class="grid-cell u-bold"> 8115 @Render(new Icon 8116 { 8117 Prefix = "fas", 8118 Name = "fa-exclamation-triangle", 8119 Label = Translate("Please select an account to manage before continuing"), 8120 LabelPosition = IconLabelPosition.After 8121 }) 8122 </div> 8123 </div> 8124 </div> 8125 </div> 8126 } 8127 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 8128 @using Dynamicweb.Rapido.Blocks 8129 8130 @{ 8131 BlocksPage.GetBlockPage("Master").GetBlockById("MiniCartOrderLinesList").Template = RenderRizzoMiniCartOrderLinesList(); 8132 } 8133 8134 @helper RenderRizzoMiniCartOrderLinesList() 8135 { 8136 <text> 8137 {{#OrderLines}} 8138 {{#ifCond template "===" "CartOrderline"}} 8139 {{>MiniCartOrderline}} 8140 {{/ifCond}} 8141 {{#ifCond template "===" "CartOrderlineMobile"}} 8142 {{>MiniCartOrderline}}t 8143 {{/ifCond}} 8144 {{#ifCond template "===" "CartOrderlineDiscount"}} 8145 {{>MiniCartOrderlineDiscount}} 8146 {{/ifCond}} 8147 {{/OrderLines}} 8148 {{#OrderLinesOutOfStock}} 8149 {{#ifCond template "===" "CartOrderline"}} 8150 {{>MiniCartOrderline}} 8151 {{/ifCond}} 8152 {{#ifCond template "===" "CartOrderlineMobile"}} 8153 {{>MiniCartOrderline}} 8154 {{/ifCond}} 8155 {{#ifCond template "===" "CartOrderlineDiscount"}} 8156 {{>MiniCartOrderlineDiscount}} 8157 {{/ifCond}} 8158 {{/OrderLinesOutOfStock}} 8159 </text> 8160 } 8161 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 8162 @using System.Collections.Generic 8163 @using Dynamicweb.Rapido.Blocks.Components.General 8164 @using Dynamicweb.Rapido.Blocks.Extensibility 8165 @using Dynamicweb.Rapido.Blocks 8166 @using Dynamicweb.Core 8167 @functions{ 8168 BlocksPage rizzoErpConnectionBlocksPage = BlocksPage.GetBlockPage("Master"); 8169 } 8170 @{ 8171 var webServiceConnectionAvailableTag = Pageview.GlobalTags.GetTagByName("Global:LiveIntegration.IsWebServiceConnectionAvailable"); 8172 if (webServiceConnectionAvailableTag != null && !Converter.ToBoolean(webServiceConnectionAvailableTag.Value)) 8173 { 8174 rizzoErpConnectionBlocksPage.Add(MasterBlockId.MasterBottomSnippets, new Block() 8175 { 8176 Id = "RizzoNoErpConnection", 8177 SortId = 0, 8178 Template = RenderErpDownAlertNotification() 8179 }); 8180 } 8181 } 8182 @helper RenderErpDownAlertNotification() 8183 { 8184 <script> 8185 document.addEventListener("DOMContentLoaded", function () { 8186 @Render(new Dna.Rizzo.Components.AlertNotification 8187 { 8188 Title = Translate("Connection down"), 8189 Message = Translate("We are experiencing some connectivity issues. Not all features may be available to you."), 8190 Theme = Dna.Rizzo.Components.AlertNotificationTheme.Theme.Warning, 8191 Position = Dna.Rizzo.Components.AlertNotificationPosition.Position.TopLeft, 8192 ShowDuration = 0, 8193 DisplayCloseButton = true, 8194 CloseOnClick = true 8195 }) 8196 }); 8197 </script> 8198 } 8199 8200 @{ 8201 var rizzoReferencesBlocksPage = BlocksPage.GetBlockPage("Master"); 8202 var masterScriptRizzoReferences = new Block() 8203 { 8204 Id = "MasterScriptRizzoReferences", 8205 SortId = 2, 8206 Template = RenderMasterScriptRizzoReferences() 8207 }; 8208 rizzoReferencesBlocksPage.Add(MasterBlockId.MasterReferences, masterScriptRizzoReferences); 8209 } 8210 @helper RenderMasterScriptRizzoReferences() { 8211 if (Model.Area.Item.GetItem("Rizzo").GetBoolean("UseRizzoJavascript")) 8212 { 8213 var minify = Model.Area.Item.GetItem("Rizzo").GetBoolean("MinifyJavascript");; 8214 const string folderName = "rizzo"; 8215 var rizzoBundle = Dna.Optimizer.Renderer.RenderScripts($"/Files/Templates/Designs/Rapido/js/{folderName}", $"-{folderName}-scripts", new List<string>(), new List<string>(), minify, false, false); 8216 <script src="@rizzoBundle"></script> 8217 PushPromise(rizzoBundle); 8218 } 8219 } 8220 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 8221 @using Dynamicweb.Rapido.Blocks 8222 @using Dynamicweb.Rapido.Blocks.Extensibility 8223 @{ 8224 var rizzoPackagesReferencesBlocksPage = BlocksPage.GetBlockPage("Master"); 8225 var masterScriptRizzoPackagesReferences = new Block() 8226 { 8227 Id = "MasterScriptRizzoPackagesReferences", 8228 SortId = 3, 8229 Template = RenderMasterScriptRizzoPackagesReferences() 8230 }; 8231 rizzoPackagesReferencesBlocksPage.Add(MasterBlockId.MasterReferences, masterScriptRizzoPackagesReferences); 8232 } 8233 @helper RenderMasterScriptRizzoPackagesReferences() { 8234 if (Model.Area.Item.GetItem("RizzoPackages").GetBoolean("UseRizzoJavascript")) 8235 { 8236 var minify = Model.Area.Item.GetItem("Rizzo").GetBoolean("MinifyJavascript");; 8237 const string folderName = "rizzoPackages"; 8238 var rizzoPackagesBundle = Dna.Optimizer.Renderer.RenderScripts($"/Files/Templates/Designs/Rapido/js/{folderName}", $"-{folderName}-scripts", new List<string>(), new List<string>(), minify, false, false); 8239 <script src="@rizzoPackagesBundle"></script> 8240 PushPromise(rizzoPackagesBundle); 8241 } 8242 } 8243 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 8244 @using Dynamicweb.Rapido.Blocks 8245 8246 @{ 8247 var miniCartBlocksPageCustom = BlocksPage.GetBlockPage("Master"); 8248 miniCartBlocksPageCustom.GetBlockById("MiniCartOrderLinesList").Template = RenderCustomMiniCartOrderLinesList(); 8249 miniCartBlocksPageCustom.GetBlockById("MiniCartTotal").Template = RenderCustomMiniCartTotal(); 8250 8251 if (orderlinesView == "table") 8252 { 8253 miniCartBlocksPageCustom.GetBlockById("OrderlinesScriptTemplates").Template = RenderCustomMiniCartScriptsTableTemplates(); 8254 } 8255 } 8256 8257 @helper RenderCustomMiniCartOrderLinesList() 8258 { 8259 <text> 8260 @*START CUSTOM CODE*@ 8261 {{#OrderLines}} 8262 {{#ifCond template "===" "CartOrderline"}} 8263 {{>CustomMiniCartOrderline}} 8264 {{/ifCond}} 8265 {{#ifCond template "===" "CartOrderlineMobile"}} 8266 {{>CustomMiniCartOrderline}} 8267 {{/ifCond}} 8268 {{/OrderLines}} 8269 {{>CustomMiniCartOrderDiscount}} 8270 @*END CUSTOM CODE*@ 8271 </text> 8272 } 8273 8274 @helper RenderCustomMiniCartScriptsTableTemplates() 8275 { 8276 <script id="CustomMiniCartOrderline" type="text/x-template"> 8277 {{#unless isEmpty}} 8278 <tr> 8279 <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> 8280 <td class="u-va-middle"> 8281 <a href="{{link}}" class="mini-cart-orderline__name" title="{{name}}">{{name}}</a> 8282 {{#if variantname}} 8283 <a href="{{link}}" class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{variantname}}</a> 8284 {{/if}} 8285 {{#if unitname}} 8286 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{unitname}}</div> 8287 {{/if}} 8288 </td> 8289 <td class="u-ta-right u-va-middle">{{quantity}}</td> 8290 <td class="u-ta-right u-va-middle"> 8291 {{#if pointsTotal}} 8292 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 8293 {{else}} 8294 {{totalprice}} 8295 {{/if}} 8296 </td> 8297 </tr> 8298 {{/unless}} 8299 </script> 8300 8301 /*START CUSTOM CODE*/ 8302 <script id="CustomMiniCartOrderDiscount" type="text/x-template"> 8303 {{#if totalOrderLineDiscount}} 8304 <tr class="table__row--no-border"> 8305 <td class="u-w60px">&nbsp;</td> 8306 <td><div class="mini-cart-orderline__name dw-mod">@Translate("Total discount")</div></td> 8307 <td class="u-ta-right">&nbsp;</td> 8308 <td class="u-ta-right">{{totalOrderLineDiscount}}</td> 8309 </tr> 8310 {{/if}} 8311 </script> 8312 /*END CUSTOM CODE*/ 8313 } 8314 8315 @helper RenderCustomMiniCartTotal() 8316 { 8317 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 8318 8319 <div class="mini-cart-totals grid u-border-top u-margin-top dw-mod"> 8320 <div class="grid__col-6">@Translate("Total")</div> 8321 <div class="grid__col-6 grid--align-end"> 8322 <div> 8323 @if (pointShop) 8324 { 8325 <span class="u-color--loyalty-points">{{pointsUsedInCart}}</span> 8326 @Translate("points") 8327 } 8328 else 8329 { 8330 <text>{{totalprice}}</text> 8331 } 8332 </div> 8333 </div> 8334 </div> 8335 8336 @*START CUSTOM CODE*@ 8337 <div class="dw-mod grid__col-12 u-no-margin u-margin-bottom"> 8338 {{#if totalCCDiscount}} 8339 <div class="dw-mod">@Translate("As a Choral Club member, you saved "){{totalCCDiscount}}</div> 8340 {{else}} 8341 <div class="dw-mod">@Translate("Become a subscriber and get up to 10% discount on all purchases ")</div> 8342 {{/if}} 8343 </div> 8344 @*END CUSTOM CODE*@ 8345 } 8346 8347 8348 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 8349 8350 @using System 8351 @using System.Web 8352 @using Dynamicweb.Rapido.Blocks.Extensibility 8353 @using Dynamicweb.Rapido.Blocks 8354 @using System.Reflection 8355 @using Dynamicweb.Frontend.Devices 8356 @functions { 8357 public class LorenzSearchConfiguration : SearchConfiguration 8358 { 8359 public string recommendedFeedId { get; set; } 8360 public string composersFeedId { get; set; } 8361 public string composersSearchMoreId { get; set; } 8362 8363 public LorenzSearchConfiguration() 8364 { 8365 recommendedFeedId = ""; 8366 composersFeedId = ""; 8367 composersSearchMoreId = ""; 8368 } 8369 } 8370 } 8371 @{ 8372 var customSearchMasterBlock = BlocksPage.GetBlockPage("Master"); 8373 8374 if (customSearchMasterBlock.GetBlockById("MasterSearchBar") != null) 8375 { 8376 customSearchMasterBlock.GetBlockById("MasterSearchBar").Template = CustomRenderSearch("bar"); 8377 } 8378 if (customSearchMasterBlock.GetBlockById("MasterDesktopActionsMenuSearch") != null) 8379 { 8380 customSearchMasterBlock.GetBlockById("MasterDesktopActionsMenuSearch").Template = CustomRenderSearch(); 8381 } 8382 if (customSearchMasterBlock.GetBlockById("MobileHeaderSearchBar") != null) 8383 { 8384 customSearchMasterBlock.GetBlockById("MobileHeaderSearchBar").Template = CustomRenderMobileTopSearchBar(); 8385 } 8386 8387 customSearchMasterBlock.Add(MasterBlockId.MasterBottomSnippets, new Block() 8388 { 8389 Id = "CustomMasterSearchScriptTemplates", 8390 SortId = 2, 8391 Template = CustomRenderSearchScriptTemplates() 8392 }); 8393 8394 } 8395 8396 @helper CustomRenderSearchScriptTemplates() 8397 { 8398 var maxWidth = Pageview.Device == DeviceType.Desktop ? "u-max-w180px" : "u-max-w220px"; 8399 <script id="ProductsSearchTemplate" type="text/x-template"> 8400 {{#each .}} 8401 {{#Product}} 8402 {{#ifCond template "!==" "SearchMore"}} 8403 <li class="dropdown__item dropdown__item--seperator dw-mod"> 8404 <div> 8405 <a href="{{#if link}}{{link}}{{else}}/Default.aspx?ID={{id}}{{/if}}" class="js-typeahead-link u-pull--left u-color-inherit"> 8406 <div class="u-margin-right u-pull--left"><i class="{{icon}} u-w20px u-ta-center"></i></div> 8407 <div class="u-pull--left"> 8408 <div class="u-bold u-truncate-text @maxWidth js-typeahead-name">{{name}}</div> 8409 </div> 8410 </a> 8411 </div> 8412 </li> 8413 {{/ifCond}} 8414 {{#ifCond template "===" "SearchMore"}} 8415 {{>SearchMoreProducts}} 8416 {{/ifCond}} 8417 {{/Product}} 8418 {{else}} 8419 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod"> 8420 @Translate("Your search gave 0 results") 8421 </li> 8422 {{/each}} 8423 </script> 8424 8425 <script id="CustomSearchTemplate" type="text/x-template"> 8426 {{#each .}} 8427 {{#ifCond template "!==" "SearchMore"}} 8428 <li class="dropdown__item dropdown__item--seperator dw-mod"> 8429 <div> 8430 <a href="{{#if url}}{{url}}{{else}}/Default.aspx?ID={{id}}{{/if}}" class="js-typeahead-link u-pull--left u-color-inherit"> 8431 <div class="u-margin-right u-pull--left"><i class="{{icon}} u-w20px u-ta-center"></i></div> 8432 <div class="u-pull--left"> 8433 <div class="u-bold u-truncate-text @maxWidth js-typeahead-name">{{name}}</div> 8434 </div> 8435 </a> 8436 </div> 8437 </li> 8438 {{/ifCond}} 8439 {{#ifCond template "===" "SearchMore"}} 8440 {{>CustomSearchMorePages}} 8441 {{/ifCond}} 8442 {{else}} 8443 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod"> 8444 @Translate("Your search gave 0 results") 8445 </li> 8446 {{/each}} 8447 </script> 8448 8449 <script id="ProductsTemplate" type="text/x-template"> 8450 @if (Pageview.Device == DeviceType.Desktop) { 8451 <div class="dropdown__column-header">@Translate("Products")</div> 8452 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod"> 8453 {{>ProductsSearchTemplate}} 8454 </ul> 8455 } 8456 else 8457 { 8458 <input type="checkbox" id="productsContentTrigger" class="expand-trigger js-remember-state" checked data-expand="productsContentTrigger" /> 8459 <div class="expand-container"> 8460 <label class="dropdown__column-header expand-container__btn" for="productsContentTrigger">@Translate("Products")</label> 8461 <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"> 8462 {{>ProductsSearchTemplate}} 8463 </ul> 8464 </div> 8465 } 8466 </script> 8467 8468 <script id="RecommendedSearchTemplateWrap" type="text/x-template"> 8469 @if (Pageview.Device != DeviceType.Mobile) 8470 { 8471 <div class="dropdown__column-header">@Translate("Recommended")</div> 8472 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod"> 8473 {{>CustomSearchTemplate}} 8474 </ul> 8475 } 8476 else 8477 { 8478 <input type="checkbox" id="recommendedContentTrigger" class="expand-trigger js-remember-state" data-expand="recommendedContentTrigger" /> 8479 <div class="expand-container"> 8480 <label class="dropdown__column-header expand-container__btn" for="recommendedContentTrigger">@Translate("Recommended")</label> 8481 <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"> 8482 {{>CustomSearchTemplate}} 8483 </ul> 8484 </div> 8485 } 8486 </script> 8487 8488 <script id="ComposersSearchTemplateWrap" type="text/x-template"> 8489 @if (Pageview.Device != DeviceType.Mobile) 8490 { 8491 <div class="dropdown__column-header">@Translate("Composers")</div> 8492 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod"> 8493 {{>CustomSearchTemplate}} 8494 </ul> 8495 } 8496 else 8497 { 8498 <input type="checkbox" id="composersContentTrigger" class="expand-trigger js-remember-state" data-expand="composersContentTrigger" /> 8499 <div class="expand-container"> 8500 <label class="dropdown__column-header expand-container__btn" for="composersContentTrigger">@Translate("Composers")</label> 8501 <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"> 8502 {{>CustomSearchTemplate}} 8503 </ul> 8504 </div> 8505 } 8506 </script> 8507 8508 <script id="PagesSearchTemplateWrap" type="text/x-template"> 8509 <div class="dropdown__column-header">@Translate("Pages")</div> 8510 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod"> 8511 {{>CustomSearchTemplate}} 8512 </ul> 8513 </script> 8514 8515 <script id="CustomSearchMorePages" type="text/x-template"> 8516 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 8517 <a href="/Default.aspx?ID={{id}}&{{searchParameterFilter}}={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 8518 @Translate("View all") 8519 </a> 8520 </li> 8521 </script> 8522 8523 // Expand.js bug fix 8524 <script> 8525 var ajaxContainer = document.getElementsByClassName("js-handlebars-root"); 8526 if (ajaxContainer.length > 0) { 8527 for (var i = 0; i < ajaxContainer.length; i++) { 8528 ajaxContainer[i].addEventListener('contentLoaded', function (e) { 8529 Expand.initExpandTriggers(this); 8530 }, false); 8531 } 8532 } 8533 </script> 8534 8535 } 8536 8537 @helper CustomRenderSearch(string type = "mini-search") 8538 { 8539 string productsPageId = Converter.ToString(GetPageIdByNavigationTag("ProductsPageSearchFeed")); 8540 string contentSearchPageLink = GetPageIdByNavigationTag("ProductsPage") + "&Areaid=" + Model.Area.ID; 8541 string searchType = Model.Area.Item.GetItem("Layout").GetList("TopSearch") != null ? Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue : "productSearch"; 8542 8543 LorenzSearchConfiguration lorenzSearchConfiguration = null; 8544 8545 switch (searchType) { 8546 case "contentSearch": 8547 lorenzSearchConfiguration = new LorenzSearchConfiguration() { 8548 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true", 8549 resultPageLink = contentSearchPageLink, 8550 searchPlaceholder = Translate("Search page"), 8551 groupsFeedId = 0, 8552 searchType = "content-search", 8553 searchTemplate = "SearchPagesTemplate", 8554 showGroups = false 8555 }; 8556 break; 8557 case "combinedSearch": 8558 lorenzSearchConfiguration = new LorenzSearchConfiguration() { 8559 searchFeedId = productsPageId + "&feed=true", 8560 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true", 8561 resultPageLink = contentSearchPageLink, 8562 searchPlaceholder = Translate("Search products or pages"), 8563 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"), 8564 searchType = "combined-search", 8565 searchTemplate = "SearchProductsTemplateWrap", 8566 searchContentTemplate = "SearchPagesTemplateWrap", 8567 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector") 8568 }; 8569 break; 8570 default: //productSearch 8571 lorenzSearchConfiguration = new LorenzSearchConfiguration() { 8572 resultPageLink = contentSearchPageLink, 8573 searchFeedId = productsPageId + "&feed=true", 8574 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"), 8575 searchPlaceholder = Translate("Search products"), 8576 searchTemplate = "SearchProductsTemplate", 8577 searchType = "product-search", 8578 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector") 8579 }; 8580 break; 8581 } 8582 lorenzSearchConfiguration.searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; 8583 lorenzSearchConfiguration.recommendedFeedId = GetPageIdByNavigationTag("RecommendedSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 8584 lorenzSearchConfiguration.composersFeedId = GetPageIdByNavigationTag("ComposersSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 8585 lorenzSearchConfiguration.composersSearchMoreId = GetPageIdByNavigationTag("Composers").ToString(); 8586 8587 if (type == "mini-search") { 8588 @CustomRenderMiniSearch(lorenzSearchConfiguration) 8589 } else { 8590 @CustomRenderSearchBar(lorenzSearchConfiguration) 8591 } 8592 } 8593 8594 @helper CustomRenderSearchBar(LorenzSearchConfiguration options) 8595 { 8596 bool isLiveProductInfoActive = Dynamicweb.Core.Converter.ToBoolean(Pageview.GlobalTags.GetTagByName("Global:LiveIntegration.IsLazyLoadingForProductInfoEnabled")?.Value ?? string.Empty); 8597 8598 <div class="typeahead typeahead--centered u-color-inherit js-typeahead dw-mod" id="ProductSearchBar" 8599 data-page-size="7" 8600 data-search-feed-id="@options.searchFeedId" 8601 data-search-second-feed-id="@options.searchSecondFeedId" 8602 data-result-page-id="@options.resultPageLink" 8603 data-groups-page-id="@options.groupsFeedId" 8604 data-search-type="@options.searchType" 8605 data-live-price="@(isLiveProductInfoActive.ToString().ToLowerInvariant())" 8606 data-recommended-search-feed-id="@options.recommendedFeedId" 8607 data-composers-search-feed-id="@options.composersFeedId" 8608 data-composers-search-more-id="@options.composersSearchMoreId"> 8609 @if (options.showGroups) 8610 { 8611 <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> 8612 <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> 8613 } 8614 <div class="typeahead-search-field"> 8615 <input type="text" class="u-no-margin u-full-width u-full-height js-typeahead-search-field" placeholder="@options.searchPlaceholder" value="@options.searchValue"> 8616 8617 <div class="dropdown dropdown--absolute-position dropdown--combined grid"> 8618 <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> 8619 <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> 8620 <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> 8621 <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> 8622 </div> 8623 </div> 8624 <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> 8625 </div> 8626 } 8627 8628 @helper CustomRenderMiniSearch(LorenzSearchConfiguration options) 8629 { 8630 // We don't want to customize Mobile typeahed 8631 // So we create a new instance of base (SearchConfiguration) and populate it's properties with the ones from LorenzSearchConfiguration 8632 var baseOptions = new SearchConfiguration(); 8633 8634 foreach (PropertyInfo propertyInfo in baseOptions.GetType().GetProperties()) 8635 { 8636 propertyInfo.SetValue(baseOptions, propertyInfo.GetValue(options)); 8637 } 8638 8639 @RenderMiniSearch(baseOptions) 8640 } 8641 8642 @helper CustomRenderMobileTopSearchBar() 8643 { 8644 string searchFeedId = ""; 8645 string searchSecondFeedId = ""; 8646 int groupsFeedId; 8647 int productsPageId = GetPageIdByNavigationTag("ProductsPageSearchFeed"); 8648 string contentSearchPageLink = GetPageIdByNavigationTag("ProductsPage") + "&Areaid=" + Model.Area.ID; 8649 string resultPageLink; 8650 string searchPlaceholder; 8651 string searchType = "product-search"; 8652 string searchTemplate; 8653 string searchContentTemplate = ""; 8654 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; 8655 bool showGroups = true; 8656 8657 LorenzSearchConfiguration lorenzSearchConfiguration = null; 8658 8659 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch") 8660 { 8661 lorenzSearchConfiguration = new LorenzSearchConfiguration() 8662 { 8663 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true", 8664 resultPageLink = contentSearchPageLink, 8665 searchPlaceholder = Translate("Search page"), 8666 groupsFeedId = 0, 8667 searchType = "content-search", 8668 searchTemplate = "SearchPagesTemplate", 8669 showGroups = false 8670 }; 8671 } 8672 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch") 8673 { 8674 lorenzSearchConfiguration = new LorenzSearchConfiguration() 8675 { 8676 searchFeedId = productsPageId + "&feed=true", 8677 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true", 8678 resultPageLink = contentSearchPageLink, 8679 searchPlaceholder = Translate("Search products or pages"), 8680 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"), 8681 searchType = "combined-search", 8682 searchTemplate = "SearchProductsTemplateWrap", 8683 searchContentTemplate = "SearchPagesTemplateWrap", 8684 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector") 8685 }; 8686 } 8687 else 8688 { 8689 lorenzSearchConfiguration = new LorenzSearchConfiguration() 8690 { 8691 resultPageLink = contentSearchPageLink, 8692 searchFeedId = productsPageId + "&feed=true", 8693 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"), 8694 searchPlaceholder = Translate("Search products"), 8695 searchTemplate = "SearchProductsTemplate", 8696 searchType = "product-search", 8697 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector") 8698 }; 8699 } 8700 lorenzSearchConfiguration.searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; 8701 lorenzSearchConfiguration.recommendedFeedId = GetPageIdByNavigationTag("RecommendedSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 8702 lorenzSearchConfiguration.composersFeedId = GetPageIdByNavigationTag("ComposersSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 8703 lorenzSearchConfiguration.composersSearchMoreId = GetPageIdByNavigationTag("Composers").ToString(); 8704 8705 @CustomRenderMobileSearch(lorenzSearchConfiguration) 8706 } 8707 8708 @helper CustomRenderMobileSearch(LorenzSearchConfiguration options) 8709 { 8710 bool isLiveProductInfoActive = Dynamicweb.Core.Converter.ToBoolean(Pageview.GlobalTags.GetTagByName("Global:LiveIntegration.IsLazyLoadingForProductInfoEnabled")?.Value ?? string.Empty); 8711 8712 <input type="checkbox" id="MobileSearchTrigger" class="mobile-search-trigger" /> 8713 <div class="main-navigation-mobile typeahead-mobile dw-mod"> 8714 <div class="center-container top-container__center-container dw-mod"> 8715 <div class="grid"> 8716 <div class="grid__col-auto"> 8717 <div class="typeahead-mobile__search-field dw-mod js-typeahead" id="MobileProductSearch" 8718 data-page-size="@(options.searchType == "combined-search" ? 4 : 8)" 8719 data-search-feed-id="@options.searchFeedId" 8720 data-search-second-feed-id="@options.searchSecondFeedId" 8721 data-result-page-id="@options.resultPageLink" 8722 data-groups-page-id="@options.groupsFeedId" 8723 data-search-type="@options.searchType" 8724 data-live-price="@(isLiveProductInfoActive.ToString().ToLowerInvariant())" 8725 data-recommended-search-feed-id="@options.recommendedFeedId" 8726 data-composers-search-feed-id="@options.composersFeedId" 8727 data-composers-search-more-id="@options.composersSearchMoreId"> 8728 <input type="text" class="js-typeahead-search-field u-w160px u-no-margin" placeholder="@options.searchPlaceholder" value="@options.searchValue"> 8729 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--combined-mobile grid"> 8730 <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> 8731 <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> 8732 <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> 8733 </div> 8734 <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> 8735 </div> 8736 </div> 8737 <div class="grid__col-auto-width"> 8738 <ul class="menu dw-mod"> 8739 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 8740 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> 8741 <i class="fas fa-times fa-1_5x"></i> 8742 </label> 8743 </li> 8744 </ul> 8745 </div> 8746 </div> 8747 </div> 8748 </div> 8749 } 8750 8751 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 8752 @using System 8753 @using System.Collections.Generic 8754 @using Dynamicweb.Rapido.Blocks 8755 @using Dynamicweb.Rapido.Blocks.Components.General 8756 8757 @functions { 8758 BlocksPage footerBlocksCustomPage = BlocksPage.GetBlockPage("Master"); 8759 } 8760 8761 @{ 8762 footerBlocksCustomPage.GetBlockById("MasterFooterNewsletterSignUp").Template = RenderCustomFooterNewsletterSignUp(); 8763 footerBlocksCustomPage.GetBlockById("MasterTopSnippets")?.Add(new Block 8764 { 8765 Id = "NewsletterModal", 8766 SortId = 20, 8767 Component = new Modal 8768 { 8769 Id = "SubscribeToNewsletter", 8770 Width = ModalWidth.Lg, 8771 BodyText = Convert.ToString(Render(new Icon {Prefix = "fas", Name = "fa-circle-notch fa-spin"})) 8772 }, 8773 Template = RenderCustomScripts() 8774 }); 8775 } 8776 8777 @helper RenderCustomFooterNewsletterSignUp() 8778 { 8779 string newsletterSignUpPageId = GetPageIdByNavigationTag("NewsletterSignUp").ToString(); 8780 string manageSubscriptionsPageId = GetPageIdByNavigationTag("ManageSubscriptions").ToString(); 8781 Form form = new Form { Action = "/Default.aspx", Method = FormMethod.Get, Enctype = FormEnctype.multipart }; 8782 8783 form.Add(new HiddenField { Name = "ID", Value = Pageview.User != null ? manageSubscriptionsPageId : newsletterSignUpPageId }); 8784 form.Add(new Text { Content = "<p>" + Translate("Sign up if you would like to receive occasional treats from us") + "</p>" }); 8785 form.Add(new TextField { 8786 /*START CUSTOM CODE*/ 8787 Id = "UserManagement_Form_Email", Name = "UserManagement_Form_Email", Placeholder = Translate("Your email address"), 8788 Type = TextFieldType.Email, 8789 ActionButton = new Button { 8790 ButtonType = ButtonType.Submit, Id="Submitter", Title = Translate 8791 ("Go"), OnClick = "Buttons.LockButton(event)", CssClass = "btn--condensed newsletter--submitter" 8792 } 8793 /*END CUSTOM CODE*/ 8794 }); 8795 8796 <h3 class="footer__heading dw-mod">@Translate("Mailing list")</h3> 8797 <div class="footer__content dw-mod"> 8798 @Render(form) 8799 </div> 8800 } 8801 8802 @helper RenderCustomScripts() 8803 { 8804 var emailErrorField = Translate("Email cannot be empty"); 8805 var optionsErrorField = Translate("Select at least one option"); 8806 8807 <script> 8808 var emailErrorField = "@emailErrorField"; 8809 var optionsErrorField = "@optionsErrorField"; 8810 </script> 8811 } 8812 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 8813 @using Dynamicweb.Rapido.Blocks 8814 @{ 8815 Block formsInfoScript = new Block 8816 { 8817 Id = "FormsInfoScript", 8818 Template = RenderFormsInfoScript() 8819 }; 8820 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", formsInfoScript); 8821 } 8822 8823 @helper RenderFormsInfoScript() 8824 { 8825 var requiredFieldsTranslate = Translate("All required fields are marked with *"); 8826 var ecomCountryCode = Pageview.Area.EcomCountryCode; 8827 var nothingSelectedTranslate = Translate("Nothing selected"); 8828 8829 <script> 8830 document.addEventListener('DOMContentLoaded', function () { 8831 Forms.Init('@requiredFieldsTranslate', '@ecomCountryCode', '@nothingSelectedTranslate'); 8832 8833 const manageAddressModal = document.querySelector("#ManageAddressModal .modal__body"); 8834 if (isElementNotNull(manageAddressModal)) { 8835 manageAddressModal.addEventListener('DOMNodeInserted', function () { 8836 if (isElementNotNull(manageAddressModal)) { 8837 Forms.Init('@requiredFieldsTranslate', '@ecomCountryCode', '@nothingSelectedTranslate'); 8838 } 8839 }) 8840 } 8841 }); 8842 </script> 8843 } 8844 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 8845 @using Dynamicweb.Rapido.Blocks 8846 @using Dynamicweb.Rapido.Blocks.Components.General 8847 @{ 8848 BlocksPage videoModalBlocksPage = BlocksPage.GetBlockPage("Master"); 8849 8850 videoModalBlocksPage.GetBlockById("MasterTopSnippets")?.Add(new Block 8851 { 8852 Id = "ViewVideoModal", 8853 SortId = 20, 8854 Component = new Modal 8855 { 8856 Id = "Video", 8857 Width = ModalWidth.Lg, 8858 Height = ModalHeight.Md, 8859 BodyTemplate = RenderVideoModal() 8860 } 8861 }); 8862 } 8863 8864 @helper RenderVideoModal() 8865 { 8866 <div id="player"></div> 8867 } 8868 8869 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 8870 @using System 8871 @using Dynamicweb.Rapido.Blocks 8872 @using Dynamicweb.Rapido.Blocks.Components.General 8873 @{ 8874 var passwordProtectedModalBlocksPage = BlocksPage.GetBlockPage("Master"); 8875 var password = Dynamicweb.Context.Current.Request["password"]; 8876 password = password != null ? password : string.Empty; 8877 8878 if (Pageview.Page.Protect && !password.Equals(Pageview.Page.Password,StringComparison.InvariantCulture)) 8879 { 8880 passwordProtectedModalBlocksPage.GetBlockById("MasterTopSnippets")?.Add(new Block 8881 { 8882 Id = "PasswordProtectedModal", 8883 SortId = 30, 8884 Component = new Modal 8885 { 8886 Id = "PasswordProtected", 8887 Width = ModalWidth.Md, 8888 BodyTemplate = RenderPasswordProtectedModal() 8889 } 8890 }); 8891 } 8892 } 8893 8894 @helper RenderPasswordProtectedModal() 8895 { 8896 var pageUrl = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(Pageview.Page.ID); 8897 var form = new Form { Action = pageUrl, Method = FormMethod.Get}; 8898 form.Add(new TextField {Id = "password", Name = "password", Required = true, Label = Translate("Password")}); 8899 form.Add(new Button {ButtonType = ButtonType.Submit, Title = Translate("Submit")}); 8900 @Render(form); 8901 } 8902 8903 @{ 8904 BlocksPage masterCustomBlocksPage = BlocksPage.GetBlockPage("Master"); 8905 } 8906 8907 8908 @functions { 8909 public class ManifestIcon 8910 { 8911 public string src { get; set; } 8912 public string type { get; set; } 8913 public string sizes { get; set; } 8914 } 8915 8916 public class Manifest 8917 { 8918 public string name { get; set; } 8919 public string short_name { get; set; } 8920 public string start_url { get; set; } 8921 public string display { get; set; } 8922 public string background_color { get; set; } 8923 public string theme_color { get; set; } 8924 public List<ManifestIcon> icons { get; set; } 8925 } 8926 } 8927 8928 <!DOCTYPE html> 8929 8930 <html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName"> 8931 8932 8933 8934 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 8935 @RenderBlockList(masterPage.BlocksRoot.BlocksList) 8936 8937 8938 8939 @helper RenderMasterHead() { 8940 List<Block> subBlocks = this.masterPage.GetBlockListById("Head").OrderBy(item => item.SortId).ToList(); 8941 8942 <head> 8943 <!-- Rapido version 3.2 --> 8944 8945 @RenderBlockList(subBlocks) 8946 </head> 8947 } 8948 8949 @helper RenderMasterMetadata() { 8950 var swatches = new Dynamicweb.Content.Items.ColorSwatchService(); 8951 var brandColors = swatches.GetColorSwatch(1); 8952 string brandColorOne = brandColors.Palette["BrandColor1"]; 8953 8954 if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName")) && Model.Area.Item.GetItem("Settings").GetFile("AppIcon") != null) { 8955 Manifest manifest = new Manifest 8956 { 8957 name = Model.Area.Item.GetItem("Settings").GetString("AppName"), 8958 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"), 8959 start_url = "/", 8960 display = "standalone", 8961 background_color = Model.Area.Item.GetItem("Settings").GetString("AppBackgroundColor"), 8962 theme_color = Model.Area.Item.GetItem("Settings").GetString("AppThemeColor") 8963 }; 8964 8965 manifest.icons = new List<ManifestIcon> { 8966 new ManifestIcon { 8967 src = "/Admin/Public/GetImage.ashx?width=192&height=192&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 8968 sizes = "192x192", 8969 type = "image/png" 8970 }, 8971 new ManifestIcon { 8972 src = "/Admin/Public/GetImage.ashx?width=512&height=512&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 8973 sizes = "512x512", 8974 type = "image/png" 8975 }, 8976 new ManifestIcon { 8977 src = "/Admin/Public/GetImage.ashx?width=1024&height=1024&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 8978 sizes = "1024x1024", 8979 type = "image/png" 8980 } 8981 }; 8982 8983 string manifestFilePath = HttpContext.Current.Request.MapPath("/Files/Templates/Designs/Rapido/manifest.json"); 8984 string manifestJSON = Newtonsoft.Json.JsonConvert.SerializeObject(manifest); 8985 string currentManifest = File.ReadAllText(manifestFilePath); 8986 8987 if (manifestJSON != currentManifest) 8988 { 8989 File.WriteAllText(manifestFilePath, manifestJSON); 8990 } 8991 } 8992 8993 <meta charset="utf-8" /> 8994 <title>@Model.Title</title> 8995 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 8996 <meta name="robots" content="index, follow"> 8997 <meta name="theme-color" content="@brandColorOne" /> 8998 8999 if (!Model.MetaTags.Contains("og:image") && Model.PropertyItem != null) { 9000 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"))); 9001 } 9002 9003 if (!Model.MetaTags.Contains("og:description")) { 9004 Pageview.Meta.AddTag("og:description", Model.Description); 9005 } 9006 9007 Pageview.Meta.AddTag("og:title", Model.Title); 9008 Pageview.Meta.AddTag("og:site_name", Model.Name); 9009 Pageview.Meta.AddTag("og:url", HttpContext.Current.Request.Url.ToString()); 9010 Pageview.Meta.AddTag("og:type", "Website"); 9011 Pageview.Meta.AddTag("fb:page_id", Model.ID.ToString()); 9012 9013 @Model.MetaTags 9014 } 9015 9016 @helper RenderMasterCss() { 9017 var fonts = new string[] { 9018 getFontFamily("Layout", "HeaderFont"), 9019 getFontFamily("Layout", "SubheaderFont"), 9020 getFontFamily("Layout", "TertiaryHeaderFont"), 9021 getFontFamily("Layout", "BodyText"), 9022 getFontFamily("Layout", "Header", "ToolsFont"), 9023 getFontFamily("Layout", "Header", "NavigationFont"), 9024 getFontFamily("Layout", "MobileNavigation", "Font"), 9025 getFontFamily("ProductList", "Facets", "HeaderFont"), 9026 getFontFamily("ProductPage", "PriceFontDesign"), 9027 getFontFamily("Ecommerce", "SaleSticker", "Font"), 9028 getFontFamily("Ecommerce", "NewSticker", "Font"), 9029 getFontFamily("Ecommerce", "CustomSticker", "Font") 9030 }; 9031 9032 string autoCssLink = "/Files/Templates/Designs/Rapido/css/rapido/rapido_" + Model.Area.ID.ToString() + ".min.css?ticks=" + Model.Area.UpdatedDate.Ticks; 9033 string favicon = Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon").Path : "/Files/Images/favicon.png"; 9034 bool useFontAwesomePro = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetBoolean("UseFontAwesomePro"); 9035 string fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomeFree/css/fontawesome-all.min.css"; 9036 if (useFontAwesomePro) 9037 { 9038 fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomePro/css/fontawesome-all.min.css"; 9039 } 9040 9041 /* Optimizer variables */ 9042 var minify = Model.Area.Item.GetItem("Rizzo").GetBoolean("MinifyCss");; 9043 var folderName = string.Empty; 9044 var rizzoBundle = string.Empty; 9045 var rizzoPackagesBundle = string.Empty; 9046 var igniteBundle = string.Empty; 9047 var variablesFile = "/Files/Templates/Designs/Rapido/css/rapido/_variables_" + Model.Area.ID + ".auto.less"; 9048 9049 //Favicon 9050 <link href="@favicon" rel="icon" type="image/png"> 9051 9052 //Base (Default, wireframe) styles 9053 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/base/base.min.css" type="text/css"> 9054 9055 //Rapido Css from Website Settings 9056 <link rel="stylesheet" id="rapidoCss" href="@autoCssLink" type="text/css"> 9057 9058 if (Model.Area.Item.GetItem("Rizzo").GetBoolean("UseRizzoCss")) 9059 { 9060 <!-- Rizzo Css (DWNA specific styles) --> 9061 folderName = "rizzo"; 9062 rizzoBundle = Dna.Optimizer.Renderer.RenderStyles($"/Files/Templates/Designs/Rapido/css/{folderName}", $"-{folderName}-styles", new [] {variablesFile}, new[] { $"{folderName}.css", $"{folderName}.min.css" }, minify, false, false); 9063 <link id="rizzoCss" type="text/css" rel="stylesheet" href="@rizzoBundle" /> 9064 } 9065 if (Model.Area.Item.GetItem("RizzoPackages").GetBoolean("UseRizzoCss")) 9066 { 9067 <!-- Rizzo Packages Css (DWNA packages specific styles) --> 9068 folderName = "rizzoPackages"; 9069 rizzoPackagesBundle = Dna.Optimizer.Renderer.RenderStyles($"/Files/Templates/Designs/Rapido/css/{folderName}", $"-{folderName}-styles", new [] {variablesFile}, new[] { $"{folderName}.css", $"{folderName}.min.css" }, minify, false, false); 9070 <link id="rizzoPackagesCss" type="text/css" rel="stylesheet" href="@rizzoPackagesBundle" /> 9071 } 9072 9073 //Ignite Css (Custom site specific styles) 9074 folderName = "ignite"; 9075 igniteBundle = Dna.Optimizer.Renderer.RenderStyles($"/Files/Templates/Designs/Rapido/css/{folderName}", $"-{folderName}-styles", new [] {variablesFile}, new[] { $"{folderName}.css", $"{folderName}.min.css" }, minify, false, false); 9076 <link id="igniteCss" type="text/css" rel="stylesheet" href="@igniteBundle" /> 9077 9078 //Font awesome 9079 <link rel="stylesheet" href="@fontAwesomeCssLink" type="text/css"> 9080 9081 //Flag icon 9082 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css" type="text/css"> 9083 9084 //Google fonts 9085 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))); 9086 9087 <link href="https://fonts.googleapis.com/css?family=@family" rel="stylesheet"> 9088 9089 PushPromise(favicon); 9090 PushPromise(fontAwesomeCssLink); 9091 PushPromise("/Files/Templates/Designs/Rapido/css/base/base.min.css"); 9092 PushPromise(autoCssLink); 9093 if (Model.Area.Item.GetItem("Rizzo").GetBoolean("UseRizzoCss")) 9094 { 9095 PushPromise(rizzoBundle); 9096 } 9097 if (Model.Area.Item.GetItem("RizzoPackages").GetBoolean("UseRizzoCss")) 9098 { 9099 PushPromise(rizzoPackagesBundle); 9100 } 9101 PushPromise(igniteBundle); 9102 PushPromise("/Files/Images/placeholder.gif"); 9103 PushPromise("/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css"); 9104 } 9105 9106 @helper RenderMasterManifest() { 9107 if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName"))) 9108 { 9109 <link rel="manifest" href="/Files/Templates/Designs/Rapido/manifest.json"> 9110 PushPromise("/Files/Templates/Designs/Rapido/manifest.json"); 9111 } 9112 } 9113 9114 @helper RenderMasterBody() { 9115 List<Block> subBlocks = this.masterPage.GetBlockListById("Body").OrderBy(item => item.SortId).ToList(); 9116 string designLayout = Model.PropertyItem != null && Model.PropertyItem.GetItem("CustomSettings") != null ? Model.PropertyItem.GetItem("CustomSettings").GetString("DesignLayout") != null ? Model.PropertyItem.GetItem("CustomSettings").GetList("DesignLayout").SelectedValue : "" : ""; 9117 if (!String.IsNullOrEmpty(designLayout)) { 9118 designLayout = "class=\"" + designLayout + "\""; 9119 } 9120 9121 <body @designLayout> 9122 @RenderBlockList(subBlocks) 9123 </body> 9124 9125 } 9126 9127 @helper RenderMasterHeader() 9128 { 9129 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterHeader").OrderBy(item => item.SortId).ToList(); 9130 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 9131 string stickyTop = isNavigationStickyMenu ? "top-container--sticky" : ""; 9132 9133 <header class="top-container @stickyTop dw-mod" id="Top"> 9134 @RenderBlockList(subBlocks) 9135 </header> 9136 } 9137 9138 @helper RenderMain() 9139 { 9140 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMain").OrderBy(item => item.SortId).ToList(); 9141 9142 <main class="site dw-mod"> 9143 @RenderBlockList(subBlocks) 9144 </main> 9145 } 9146 9147 @helper RenderPageContent() 9148 { 9149 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 9150 string pagePos = isNavigationStickyMenu ? "js-page-pos" : ""; 9151 9152 <div id="Page" class="page @pagePos"> 9153 <section class="center-container content-container dw-mod" id="content"> 9154 9155 @RenderSnippet("Content") 9156 </section> 9157 </div> 9158 } 9159 9160 @* Hack to support nested helpers *@ 9161 @SnippetStart("Content") 9162 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 9163 9164 9165 9166 @using Dynamicweb.Rapido.Blocks.Components.General 9167 @using Dynamicweb.Rapido.Blocks 9168 9169 @functions { 9170 BlocksPage page = BlocksPage.GetBlockPage("Page"); 9171 } 9172 9173 @{ 9174 bool isProductPage = HttpContext.Current.Request.QueryString.Get("ProductID") != null; 9175 string backgroundColorClass = Model.PropertyItem.GetList("BackgroundColor") != null && !isProductPage ? "u-" + Model.PropertyItem.GetList("BackgroundColor").SelectedValue + "--bg" : ""; 9176 string navigationMarkup = ""; 9177 9178 Block pageContainer = new Block 9179 { 9180 Id = "PageContainer", 9181 SortId = 10, 9182 BlocksList = new List<Block> { 9183 new Block { 9184 Id = "PageRow", 9185 SortId = 20, 9186 Design = new Design { 9187 RenderType = RenderType.Row 9188 } 9189 } 9190 } 9191 }; 9192 page.Add(pageContainer); 9193 9194 if (Model.PropertyItem.GetList("ShowBreadcrumb") != null && Model.PropertyItem.GetList("ShowBreadcrumb").SelectedValue == "True") 9195 { 9196 Block breadcrumbNavigation = new Block 9197 { 9198 Id = "PageBreadcrumbNavigation", 9199 SortId = 10, 9200 Component = new BreadcrumbNavigation { Id = "breadcrumb", Template = "Breadcrumb.xslt", SitemapMode = true } 9201 }; 9202 page.Add("PageContainer", breadcrumbNavigation); 9203 } 9204 9205 if (Model.PropertyItem.GetList("LeftMenu") != null && Model.PropertyItem.GetList("LeftMenu").SelectedValue == "True" && (Pageview.Page.NavigationSettings == null || !Pageview.Page.NavigationSettings.UseEcomGroups)) 9206 { 9207 navigationMarkup = RenderNavigation(new 9208 { 9209 id = "leftnav", 9210 cssclass = "dwnavigation", 9211 startLevel = 2, 9212 expandmode = "all", 9213 endlevel = 5, 9214 template = "LeftNavigation.xslt" 9215 }); 9216 9217 if (!string.IsNullOrEmpty(navigationMarkup)) 9218 { 9219 Block leftNavigation = new Block 9220 { 9221 Id = "PageLeftNavigation", 9222 SortId = 10, 9223 Component = new LeftNavigation { Id = "leftnav", CssClass = "dwnavigation", StartLevel = 2, EndLevel = 5, Expandmode = "all", Template = "LeftNavigation.xslt" }, 9224 Design = new Design 9225 { 9226 RenderType = RenderType.Column, 9227 Size = "3" 9228 } 9229 }; 9230 page.Add("PageRow", leftNavigation); 9231 } 9232 } 9233 9234 string contentColumnSize = !string.IsNullOrEmpty(navigationMarkup) ? "9" : "12"; 9235 9236 Block pageContent = new Block 9237 { 9238 Id = "PageContent", 9239 SortId = 20, 9240 Design = new Design 9241 { 9242 RenderType = RenderType.Column, 9243 Size = contentColumnSize, 9244 CssClass = "grid__col--bleed" 9245 }, 9246 BlocksList = new List<Block> { 9247 new Block { 9248 Id = "PageContentRow", 9249 SortId = 10, 9250 Component = new Text { Content = @Model.Placeholder("dwcontent", "content", "default:true;sort:1") }, 9251 Design = new Design { 9252 RenderType = RenderType.Row 9253 } 9254 } 9255 } 9256 }; 9257 page.Add("PageRow", pageContent); 9258 } 9259 9260 @using System 9261 @using System.Web 9262 @using System.Collections.Generic 9263 @using Dynamicweb.Rapido.Blocks 9264 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 9265 @using Dynamicweb.Rapido.Blocks 9266 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 9267 @using Dynamicweb.Rapido.Blocks 9268 @{ 9269 BlocksPage pageCustomBlocksPage = BlocksPage.GetBlockPage("Page"); 9270 9271 } 9272 9273 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 9274 @RenderBlockList(page.BlocksRoot.BlocksList) 9275 9276 9277 @* Very small hack to make it cleanly, and easily possible to change the background color on a single page *@ 9278 @if (backgroundColorClass != "") 9279 { 9280 <script> 9281 document.getElementById("Page").classList.add("@backgroundColorClass"); 9282 </script> 9283 } 9284 @SnippetEnd("Content") 9285 9286 </html> 9287 9288