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