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_55a728176f294e16bb2f8ccdfdee1dcc.Execute() in D:\dynamicweb.net\Solutions\FlexMedia\HDamKaergaard.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\DynamicArticle.parsed.cshtml:line 8310
at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 2 3 @using System.Web; 4 @using Dynamicweb.Frontend 5 @using Dynamicweb.Frontend.Devices 6 @using Dynamicweb.Extensibility 7 @using Dynamicweb.Content 8 @using Dynamicweb.Security 9 @using Dynamicweb.Core 10 @using System 11 @using System.Web 12 @using System.IO 13 @using Dynamicweb.Rapido.Blocks 14 @using System.Net 15 16 17 @functions { 18 BlocksPage masterPage = BlocksPage.GetBlockPage("Master"); 19 20 string getFontFamily(params string[] items) 21 { 22 var itemParent = Pageview.AreaSettings; 23 foreach (var item in items) 24 { 25 itemParent = itemParent.GetItem(item); 26 if (itemParent == null) 27 { 28 return null; 29 } 30 } 31 32 var googleFont = itemParent.GetGoogleFont("FontFamily"); 33 if (googleFont == null) 34 { 35 return null; 36 } 37 return googleFont.Family.Replace(" ", "+"); 38 } 39 } 40 41 @{ 42 Block root = new Block 43 { 44 Id = "Root", 45 SortId = 10, 46 BlocksList = new List<Block> 47 { 48 new Block { 49 Id = "Head", 50 SortId = 10, 51 SkipRenderBlocksList = true, 52 Template = RenderMasterHead(), 53 BlocksList = new List<Block> 54 { 55 new Block { 56 Id = "HeadMetadata", 57 SortId = 10, 58 Template = RenderMasterMetadata(), 59 }, 60 new Block { 61 Id = "HeadCss", 62 SortId = 20, 63 Template = RenderMasterCss(), 64 }, 65 new Block { 66 Id = "HeadManifest", 67 SortId = 30, 68 Template = RenderMasterManifest(), 69 } 70 } 71 }, 72 new Block { 73 Id = "Body", 74 SortId = 20, 75 SkipRenderBlocksList = true, 76 Template = RenderMasterBody(), 77 BlocksList = new List<Block> 78 { 79 new Block() 80 { 81 Id = "Master", 82 SortId = 10, 83 BlocksList = new List<Block> { 84 new Block { 85 Id = "MasterTopSnippets", 86 SortId = 10 87 }, 88 new Block { 89 Id = "MasterMain", 90 SortId = 20, 91 Template = RenderMain(), 92 SkipRenderBlocksList = true, 93 BlocksList = new List<Block> { 94 new Block { 95 Id = "MasterHeader", 96 SortId = 10, 97 Template = RenderMasterHeader(), 98 SkipRenderBlocksList = true 99 }, 100 new Block { 101 Id = "MasterPageContent", 102 SortId = 20, 103 Template = RenderPageContent() 104 } 105 } 106 }, 107 new Block { 108 Id = "MasterFooter", 109 SortId = 30 110 }, 111 new Block { 112 Id = "MasterReferences", 113 SortId = 40 114 }, 115 new Block { 116 Id = "MasterBottomSnippets", 117 SortId = 50, 118 BlocksList = new List<Block> { 119 new Block { 120 Id = "iOsTabletFix", 121 SortId = 10, 122 Template = RenderIosTabletFix() 123 } 124 } 125 } 126 } 127 } 128 } 129 } 130 } 131 }; 132133 masterPage.Add(root); 134 } 135136 @* Include the required Grid builder (Contains the methods @RenderBlockList and @RenderBlock) *@ 137 @using System.Text.RegularExpressions 138 @using System.Collections.Generic 139 @using System.Reflection 140 @using System.Web 141 @using System.Web.UI.HtmlControls 142 @using Dynamicweb.Rapido.Blocks.Components 143 @using Dynamicweb.Rapido.Blocks.Components.Articles 144 @using Dynamicweb.Rapido.Blocks.Components.Documentation 145 @using Dynamicweb.Rapido.Blocks 146147148 @*--- START: Base block renderers ---*@ 149150 @helper RenderBlockList(List<Block> blocks) 151 { 152 bool debug = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("debug")) ? Convert.ToBoolean(HttpContext.Current.Request.QueryString.Get("debug")) : false; 153 blocks = blocks.OrderBy(item => item.SortId).ToList(); 154155 foreach (Block item in blocks) 156 { 157 if (debug) { 158 <!-- Block START: @item.Id --> 159 } 160161 if (item.Design == null) 162 { 163 @RenderBlock(item) 164 } 165 else if (item.Design.RenderType == RenderType.None) { 166 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : ""; 167168 <div class="@cssClass dw-mod"> 169 @RenderBlock(item) 170 </div> 171 } 172 else if (item.Design.RenderType != RenderType.Hide) 173 { 174 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : ""; 175176 if (!item.SkipRenderBlocksList) { 177 if (item.Design.RenderType == RenderType.Row) 178 { 179 <div class="grid grid--align-content-start @cssClass dw-mod" id="Block__@item.Id"> 180 @RenderBlock(item) 181 </div> 182 } 183184 if (item.Design.RenderType == RenderType.Column) 185 { 186 string hidePadding = item.Design.HidePadding ? "u-no-padding" : ""; 187 string size = item.Design.Size ?? "12"; 188 size = Regex.IsMatch(size, @"\d") ? "md-" + item.Design.Size : item.Design.Size; 189190 <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"> 191 @RenderBlock(item) 192 </div> 193 } 194195 if (item.Design.RenderType == RenderType.Table) 196 { 197 <table class="table @cssClass dw-mod" id="Block__@item.Id"> 198 @RenderBlock(item) 199 </table> 200 } 201202 if (item.Design.RenderType == RenderType.TableRow) 203 { 204 <tr class="@cssClass dw-mod" id="Block__@item.Id"> 205 @RenderBlock(item) 206 </tr> 207 } 208209 if (item.Design.RenderType == RenderType.TableColumn) 210 { 211 <td class="@cssClass dw-mod" id="Block__@item.Id"> 212 @RenderBlock(item) 213 </td> 214 } 215216 if (item.Design.RenderType == RenderType.CardHeader) 217 { 218 <div class="card-header @cssClass dw-mod"> 219 @RenderBlock(item) 220 </div> 221 } 222223 if (item.Design.RenderType == RenderType.CardBody) 224 { 225 <div class="card @cssClass dw-mod"> 226 @RenderBlock(item) 227 </div> 228 } 229230 if (item.Design.RenderType == RenderType.CardFooter) 231 { 232 <div class="card-footer @cssClass dw-mod"> 233 @RenderBlock(item) 234 </div> 235 } 236 } 237 else 238 { 239 @RenderBlock(item) 240 } 241 } 242243 if (debug) { 244 <!-- Block END: @item.Id --> 245 } 246 } 247 } 248249 @helper RenderBlock(Block item) 250 { 251 bool debug = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("debug")) ? Convert.ToBoolean(HttpContext.Current.Request.QueryString.Get("debug")) : false; 252253 if (item.Template != null) 254 { 255 @BlocksPage.RenderTemplate(item.Template) 256 } 257258 if (item.Component != null) 259 { 260 string customSufix = "Custom"; 261 string methodName = item.Component.HelperName; 262263 ComponentBase[] methodParameters = new ComponentBase[1]; 264 methodParameters[0] = item.Component; 265 Type methodType = this.GetType(); 266267 MethodInfo customMethod = methodType.GetMethod(methodName + customSufix); 268 MethodInfo generalMethod = methodType.GetMethod(methodName); 269270 try { 271 if (debug) { 272 <!-- Component: @methodName.Replace("Render", "") --> 273 } 274 @customMethod.Invoke(this, methodParameters).ToString(); 275 } catch { 276 try { 277 @generalMethod.Invoke(this, methodParameters).ToString(); 278 } catch(Exception ex) { 279 throw new Exception(item.Component.GetType().Name + " method '" + methodName +"' could not be invoked", ex); 280 } 281 } 282 } 283284 if (item.BlocksList.Count > 0 && !item.SkipRenderBlocksList) 285 { 286 @RenderBlockList(item.BlocksList) 287 } 288 } 289290 @*--- END: Base block renderers ---*@ 291292293 @* Include the components *@ 294 @using Dynamicweb.Rapido.Blocks.Components 295 @using Dynamicweb.Rapido.Blocks.Components.General 296 @using Dynamicweb.Rapido.Blocks 297 @using System.IO 298299 @* Required *@ 300 @using Dynamicweb.Rapido.Blocks.Components 301 @using Dynamicweb.Rapido.Blocks.Components.General 302 @using Dynamicweb.Rapido.Blocks 303304305 @helper Render(ComponentBase component) 306 { 307 if (component != null) 308 { 309 @component.Render(this) 310 } 311 } 312313 @* Components *@ 314 @using System.Reflection 315 @using Dynamicweb.Rapido.Blocks.Components.General 316317318 @* Component *@ 319320 @helper RenderIcon(Icon settings) 321 { 322 if (settings != null) 323 { 324 string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : ""; 325326 if (settings.Name != null) 327 { 328 if (string.IsNullOrEmpty(settings.Label)) 329 { 330 <i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i> 331 } 332 else 333 { 334 if (settings.LabelPosition == IconLabelPosition.Before) 335 { 336 <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> 337 } 338 else 339 { 340 <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> 341 } 342 } 343 } 344 else if (!string.IsNullOrEmpty(settings.Label)) 345 { 346 @settings.Label 347 } 348 } 349 } 350 @using System.Reflection 351 @using Dynamicweb.Rapido.Blocks.Components.General 352 @using Dynamicweb.Rapido.Blocks.Components 353 @using Dynamicweb.Core 354355 @* Component *@ 356357 @helper RenderButton(Button settings) 358 { 359 if (settings != null && (!string.IsNullOrEmpty(settings.Title) || settings.Icon != null)) 360 { 361 Dictionary<string, string> attributes = new Dictionary<string, string>(); 362 List<string> classList = settings.CssClass != null ? settings.CssClass.Split(' ').ToList() : new List<string>(); 363 if (settings.Disabled) { 364 attributes.Add("disabled", "true"); 365 classList.Add("disabled"); 366 } 367368 if (!string.IsNullOrEmpty(settings.ConfirmText) || !string.IsNullOrEmpty(settings.ConfirmTitle)) 369 { 370 settings.Id = !string.IsNullOrEmpty(settings.Id) ? settings.Id : Guid.NewGuid().ToString("N"); 371 @RenderConfirmDialog(settings); 372 settings.OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = true"; 373 } 374375 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 376 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 377 if (!string.IsNullOrEmpty(settings.AltText)) 378 { 379 attributes.Add("title", settings.AltText); 380 } 381 else if (!string.IsNullOrEmpty(settings.Title)) 382 { 383 string cleanTitle = Regex.Replace(settings.Title, "<.*?>", String.Empty); 384 cleanTitle = cleanTitle.Replace("&nbsp;", " "); 385 attributes.Add("title", cleanTitle); 386 } 387388 var onClickEvents = new List<string>(); 389 if (!string.IsNullOrEmpty(settings.OnClick)) 390 { 391 onClickEvents.Add(settings.OnClick); 392 } 393 if (!string.IsNullOrEmpty(settings.Href)) 394 { 395 onClickEvents.Add("location.href='" + settings.Href + "'"); 396 } 397 if (onClickEvents.Count > 0) 398 { 399 attributes.Add("onClick", string.Join(";", onClickEvents)); 400 } 401402 if (settings.ButtonLayout != ButtonLayout.None) 403 { 404 classList.Add("btn"); 405 string btnLayout = Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower(); 406 if (btnLayout == "linkclean") 407 { 408 btnLayout = "link-clean"; //fix 409 } 410 classList.Add("btn--" + btnLayout); 411 } 412413 if (settings.Icon == null) 414 { 415 settings.Icon = new Icon(); 416 } 417418 settings.Icon.CssClass += Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower() != "linkclean" ? " u-flex--align-center" : ""; 419 settings.Icon.Label = settings.Title; 420421 attributes.Add("type", Enum.GetName(typeof(ButtonType), settings.ButtonType).ToLower()); 422423 <button class="@string.Join(" ", classList) dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@Render(settings.Icon)</button> 424 } 425 } 426427 @helper RenderConfirmDialog(Button settings) 428 { 429 Modal confirmDialog = new Modal { 430 Id = settings.Id, 431 Width = ModalWidth.Sm, 432 Heading = new Heading 433 { 434 Level = 2, 435 Title = settings.ConfirmTitle 436 }, 437 BodyText = settings.ConfirmText 438 }; 439440 confirmDialog.AddAction(new Button { Title = Translate("Cancel"), ButtonLayout = ButtonLayout.Secondary, OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = false"}); 441 confirmDialog.AddAction(new Button { Title = Translate("OK"), ButtonLayout = ButtonLayout.Primary, OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = false;" + settings.OnClick }); 442443 @Render(confirmDialog) 444 } 445 @using Dynamicweb.Rapido.Blocks.Components.General 446 @using Dynamicweb.Rapido.Blocks.Components 447 @using Dynamicweb.Core 448449 @helper RenderDashboard(Dashboard settings) 450 { 451 var widgets = settings.GetWidgets(); 452453 if (!string.IsNullOrEmpty(settings.WidgetsBaseBackgroundColor)) 454 { 455 //set bg color for them 456457 System.Drawing.Color color = System.Drawing.ColorTranslator.FromHtml(settings.WidgetsBaseBackgroundColor); 458 int r = Convert.ToInt16(color.R); 459 int g = Convert.ToInt16(color.G); 460 int b = Convert.ToInt16(color.B); 461462 var count = widgets.Length; 463 var max = Math.Max(r, Math.Max(g, b)); 464 double step = 255.0 / (max * count); 465 var i = 0; 466 foreach (var widget in widgets) 467 { 468 i++; 469470 var shade = "rgb(" + Converter.ToString(r * step * i).Replace(",", ".") + ", " + Converter.ToString(g * step * i).Replace(",", ".") + ", " + Converter.ToString(b * step * i).Replace(",", ".") + ")"; 471 widget.BackgroundColor = shade; 472 } 473 } 474475 <div class="dashboard @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 476 @foreach (var widget in widgets) 477 { 478 <div class="dashboard__widget"> 479 @Render(widget) 480 </div> 481 } 482 </div> 483 } 484 @using Dynamicweb.Rapido.Blocks.Components.General 485 @using Dynamicweb.Rapido.Blocks.Components 486487 @helper RenderDashboardWidgetLink(DashboardWidgetLink settings) 488 { 489 if (!string.IsNullOrEmpty(settings.Link)) 490 { 491 var backgroundStyles = ""; 492 if (!string.IsNullOrEmpty(settings.BackgroundColor)) 493 { 494 backgroundStyles = "style=\"background-color:" + settings.BackgroundColor + "\""; 495 } 496497 <a href="@settings.Link" class="widget widget--link @settings.CssClass dw-mod" @backgroundStyles title="@settings.Title" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 498 <div class="u-center-middle u-color-light"> 499 @if (settings.Icon != null) 500 { 501 settings.Icon.CssClass += "widget__icon"; 502 @Render(settings.Icon) 503 } 504 <div class="widget__title">@settings.Title</div> 505 </div> 506 </a> 507 } 508 } 509 @using Dynamicweb.Rapido.Blocks.Components.General 510 @using Dynamicweb.Rapido.Blocks.Components 511512 @helper RenderDashboardWidgetCounter(DashboardWidgetCounter settings) 513 { 514 var backgroundStyles = ""; 515 if (!string.IsNullOrEmpty(settings.BackgroundColor)) 516 { 517 backgroundStyles = "style='background-color:" + settings.BackgroundColor + "'"; 518 } 519520 <div class="widget @settings.CssClass dw-mod" @backgroundStyles @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 521 <div class="u-center-middle u-color-light"> 522 @if (settings.Icon != null) 523 { 524 settings.Icon.CssClass += "widget__icon"; 525 @Render(settings.Icon) 526 } 527 <div class="widget__counter">@settings.Count</div> 528 <div class="widget__title">@settings.Title</div> 529 </div> 530 </div> 531 } 532 @using System.Reflection 533 @using Dynamicweb.Rapido.Blocks.Components.General 534 @using Dynamicweb.Rapido.Blocks.Components 535 @using Dynamicweb.Core 536537 @* Component *@ 538539 @helper RenderLink(Link settings) 540 { 541 if (settings != null && !string.IsNullOrEmpty(settings.Href) && (!string.IsNullOrEmpty(settings.Title) || settings.Icon != null)) 542 { 543 Dictionary<string, string> attributes = new Dictionary<string, string>(); 544 List<string> classList = settings.CssClass != null ? settings.CssClass.Split(' ').ToList() : new List<string>(); 545 if (settings.Disabled) 546 { 547 attributes.Add("disabled", "true"); 548 classList.Add("disabled"); 549 } 550551 if (!string.IsNullOrEmpty(settings.AltText)) 552 { 553 attributes.Add("title", settings.AltText); 554 } 555 else if (!string.IsNullOrEmpty(settings.Title)) 556 { 557 attributes.Add("title", settings.Title); 558 } 559560 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 561 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 562 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onClick", settings.OnClick); } 563 attributes.Add("href", settings.Href); 564565 if (settings.ButtonLayout != ButtonLayout.None) 566 { 567 classList.Add("btn"); 568 string btnLayout = Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower(); 569 if (btnLayout == "linkclean") 570 { 571 btnLayout = "link-clean"; //fix 572 } 573 classList.Add("btn--" + btnLayout); 574 } 575576 if (settings.Icon == null) 577 { 578 settings.Icon = new Icon(); 579 } 580 settings.Icon.Label = settings.Title; 581582 if (settings.Target == LinkTargetType.Blank && settings.Rel == LinkRelType.None) 583 { 584 settings.Rel = LinkRelType.Noopener; 585 } 586 if (settings.Target != LinkTargetType.None) 587 { 588 attributes.Add("target", "_" + Enum.GetName(typeof(LinkTargetType), settings.Target).ToLower()); 589 } 590 if (settings.Download) 591 { 592 attributes.Add("download", "true"); 593 } 594 if (settings.Rel != LinkRelType.None) 595 { 596 attributes.Add("rel", Enum.GetName(typeof(LinkRelType), settings.Rel).ToLower()); 597 } 598599 <a class="@string.Join(" ", classList) dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@Render(settings.Icon)</a> 600 } 601 } 602 @using System.Reflection 603 @using Dynamicweb.Rapido.Blocks.Components 604 @using Dynamicweb.Rapido.Blocks.Components.General 605 @using Dynamicweb.Rapido.Blocks 606607608 @* Component *@ 609610 @helper RenderRating(Rating settings) 611 { 612 if (settings.Score > 0) 613 { 614 int rating = settings.Score; 615 string iconType = "fa-star"; 616617 switch (settings.Type.ToString()) { 618 case "Stars": 619 iconType = "fa-star"; 620 break; 621 case "Hearts": 622 iconType = "fa-heart"; 623 break; 624 case "Lemons": 625 iconType = "fa-lemon"; 626 break; 627 case "Bombs": 628 iconType = "fa-bomb"; 629 break; 630 } 631632 <div class="u-ta-right"> 633 @for (int i = 0; i < settings.OutOf; i++) 634 { 635 <i class="@(rating > i ? "fas" : "far") @iconType"></i> 636 } 637 </div> 638 } 639 } 640 @using System.Reflection 641 @using Dynamicweb.Rapido.Blocks.Components.General 642 @using Dynamicweb.Rapido.Blocks.Components 643644645 @* Component *@ 646647 @helper RenderSelectFieldOption(SelectFieldOption settings) 648 { 649 Dictionary<string, string> attributes = new Dictionary<string, string>(); 650 if (settings.Checked) { attributes.Add("selected", "true"); } 651 if (settings.Disabled) { attributes.Add("disabled", "true"); } 652 if (settings.Value != null) { attributes.Add("value", settings.Value); } 653 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 654655 <option @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Label</option> 656 } 657 @using System.Reflection 658 @using Dynamicweb.Rapido.Blocks.Components.General 659 @using Dynamicweb.Rapido.Blocks.Components 660661662 @* Component *@ 663664 @helper RenderNavigation(Navigation settings) { 665 @RenderNavigation(new 666 { 667 id = settings.Id, 668 cssclass = settings.CssClass, 669 startLevel = settings.StartLevel, 670 endlevel = settings.EndLevel, 671 expandmode = settings.Expandmode, 672 sitemapmode = settings.SitemapMode, 673 template = settings.Template 674 }) 675 } 676 @using Dynamicweb.Rapido.Blocks.Components.General 677 @using Dynamicweb.Rapido.Blocks.Components 678679680 @* Component *@ 681682 @helper RenderBreadcrumbNavigation(BreadcrumbNavigation settings) { 683 settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id; 684 settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template; 685 settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel; 686 settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel; 687 settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode; 688 settings.SitemapMode = false; 689690 @RenderNavigation(settings) 691 } 692 @using Dynamicweb.Rapido.Blocks.Components.General 693 @using Dynamicweb.Rapido.Blocks.Components 694695696 @* Component *@ 697698 @helper RenderLeftNavigation(LeftNavigation settings) { 699 settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id; 700 settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template; 701 settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel; 702 settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel; 703 settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode; 704705 <div class="grid__cell"> 706 @RenderNavigation(settings) 707 </div> 708 } 709 @using System.Reflection 710 @using Dynamicweb.Rapido.Blocks.Components.General 711 @using Dynamicweb.Core 712713 @* Component *@ 714715 @helper RenderHeading(Heading settings) 716 { 717 if (settings != null && !string.IsNullOrEmpty(settings.Title)) 718 { 719 string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : ""; 720 string tagName = settings.Level != 0 ? "h" + settings.Level.ToString() : "div"; 721722 @("<" + tagName + " class=\"" + settings.CssClass + " dw-mod\" " + color + ">") 723 if (!string.IsNullOrEmpty(settings.Link)) 724 { 725 @Render(new Link { Href = settings.Link, Icon = settings.Icon, Title = settings.Title, ButtonLayout = ButtonLayout.None }) 726 } 727 else 728 { 729 if (settings.Icon == null) 730 { 731 settings.Icon = new Icon(); 732 } 733 settings.Icon.Label = settings.Title; 734 @Render(settings.Icon) 735 } 736 @("</" + tagName + ">"); 737 } 738 } 739 @using Dynamicweb.Rapido.Blocks.Components 740 @using Dynamicweb.Rapido.Blocks.Components.General 741 @using Dynamicweb.Rapido.Blocks 742743744 @* Component *@ 745746 @helper RenderImage(Image settings) 747 { 748 if (settings.FilterPrimary != ImageFilter.None || settings.FilterSecondary != ImageFilter.None) 749 { 750 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>(); 751 if (!string.IsNullOrEmpty(settings.FilterColor)) { optionalAttributes.Add("style", "background-color: " + settings.FilterColor); } 752753 if (settings.Caption != null) 754 { 755 @:<div> 756 } 757758 var primaryFilterClass = settings.FilterPrimary.ToString().ToLower(); 759 var secondaryFilterClass = settings.FilterSecondary.ToString().ToLower(); 760761 <div class="image-filter image-filter--@primaryFilterClass u-position-relative dw-mod" @ComponentMethods.AddAttributes(optionalAttributes)> 762 <div class="image-filter image-filter--@secondaryFilterClass dw-mod"> 763 @if (settings.Link != null) 764 { 765 <a href="@settings.Link"> 766 @RenderTheImage(settings) 767 </a> 768 } 769 else 770 { 771 @RenderTheImage(settings) 772 } 773 </div> 774 </div> 775776 if (settings.Caption != null) 777 { 778 <span class="image-caption dw-mod">@settings.Caption</span> 779 @:</div> 780 } 781 } 782 else 783 { 784 if (settings.Caption != null) 785 { 786 @:<div> 787 } 788 if (!string.IsNullOrEmpty(settings.Link)) 789 { 790 <a href="@settings.Link"> 791 @RenderTheImage(settings) 792 </a> 793 } 794 else 795 { 796 @RenderTheImage(settings) 797 } 798799 if (settings.Caption != null) 800 { 801 <span class="image-caption dw-mod">@settings.Caption</span> 802 @:</div> 803 } 804 } 805 } 806807 @helper RenderTheImage(Image settings) 808 { 809 if (settings != null) 810 { 811 string alternativeImage = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("AlternativeImage")) ? Pageview.AreaSettings.GetItem("Settings").GetFile("AlternativeImage").PathUrlEncoded : "/Images/missing_image.jpg"; 812 string placeholderImage = "/Files/Images/placeholder.gif"; 813 string imageEngine = "/Admin/Public/GetImage.ashx?"; 814815 string imageStyle = ""; 816817 switch (settings.Style) 818 { 819 case ImageStyle.Ball: 820 imageStyle = "grid__cell-img--ball"; 821 break; 822823 case ImageStyle.Triangle: 824 imageStyle = "grid__cell-img--triangle"; 825 break; 826 } 827828 if (settings.Style == ImageStyle.Ball || settings.Style == ImageStyle.Circle || settings.Style == ImageStyle.Triangle) 829 { 830 settings.ImageDefault.Crop = settings.ImageDefault.Crop == 5 ? settings.ImageDefault.Crop = 0 : settings.ImageDefault.Crop; 831832 if (settings.ImageDefault != null) 833 { 834 settings.ImageDefault.Height = settings.ImageDefault.Width; 835 } 836 if (settings.ImageMedium != null) 837 { 838 settings.ImageMedium.Height = settings.ImageMedium.Width; 839 } 840 if (settings.ImageSmall != null) 841 { 842 settings.ImageSmall.Height = settings.ImageSmall.Width; 843 } 844 } 845846 string defaultImage = imageEngine; 847 string imageSmall = ""; 848 string imageMedium = ""; 849850851 /* Stop changing svg images into jpg images */ 852853854 string SVGimg = settings.Path.ToString(); 855856 if(SVGimg.EndsWith(".svg")){ 857 settings.DisableImageEngine = true; 858 imageStyle += " svg-image"; 859 } 860861862 if (settings.DisableImageEngine) 863 { 864 defaultImage = settings.Path; 865 } 866 else 867 { 868 if (settings.ImageDefault != null) 869 { 870 defaultImage += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageDefault); 871872 if (settings.Path.GetType() != typeof(string)) 873 { 874 defaultImage += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 875 defaultImage += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 876 } 877 else 878 { 879 defaultImage += settings.Path != null ? "Image=" + settings.Path : ""; 880 } 881882 defaultImage += "&AlternativeImage=" + alternativeImage; 883 } 884885 if (settings.ImageSmall != null) 886 { 887 imageSmall = "data-src-small=\"" + imageEngine; 888 imageSmall += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageSmall); 889890 if (settings.Path.GetType() != typeof(string)) 891 { 892 imageSmall += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 893 imageSmall += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 894 } 895 else 896 { 897 imageSmall += settings.Path != null ? "Image=" + settings.Path : ""; 898 } 899900 imageSmall += "&alternativeImage=" + alternativeImage; 901902 imageSmall += "\""; 903 } 904905 if (settings.ImageMedium != null) 906 { 907 imageMedium = "data-src-medium=\"" + imageEngine; 908 imageMedium += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageMedium); 909910 if (settings.Path.GetType() != typeof(string)) 911 { 912 imageMedium += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 913 imageMedium += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 914 } 915 else 916 { 917 imageMedium += settings.Path != null ? "Image=" + settings.Path : ""; 918 } 919920 imageMedium += "&alternativeImage=" + alternativeImage; 921922 imageMedium += "\""; 923 } 924 } 925926 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>(); 927 if (!string.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick); } 928 if (!string.IsNullOrEmpty(settings.Title)) 929 { 930 optionalAttributes.Add("alt", settings.Title); 931 optionalAttributes.Add("title", settings.Title); 932 } 933934 if (settings.DisableLazyLoad) 935 { 936 <img id="@settings.Id" class="@imageStyle @settings.CssClass dw-mod" src="@defaultImage" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 937 } 938 else 939 { 940 <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) /> 941 } 942 } 943 } 944 @using System.Reflection 945 @using Dynamicweb.Rapido.Blocks.Components.General 946 @using Dynamicweb.Rapido.Blocks.Components 947948 @* Component *@ 949950 @helper RenderFileField(FileField settings) 951 { 952 var attributes = new Dictionary<string, string>(); 953 if (string.IsNullOrEmpty(settings.Id)) 954 { 955 settings.Id = Guid.NewGuid().ToString("N"); 956 } 957958 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 959 if (settings.Disabled) { attributes.Add("disabled", "true"); } 960 if (settings.Required) { attributes.Add("required", "true"); } 961 if (settings.Multiple) { attributes.Add("multiple", "true"); } 962 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 963 if (string.IsNullOrEmpty(settings.ChooseFileText)) 964 { 965 settings.ChooseFileText = Translate("Choose file"); 966 } 967 if (string.IsNullOrEmpty(settings.NoFilesChosenText)) 968 { 969 settings.NoFilesChosenText = Translate("No files chosen..."); 970 } 971 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 972973 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; } 974975 string setValueToFakeInput = "FileUpload.setValueToFakeInput(this)"; 976 attributes.Add("onchange", setValueToFakeInput + (!string.IsNullOrEmpty(settings.OnChange) ? settings.OnChange : "")); 977978 attributes.Add("type", "file"); 979 if (settings.Value != null) { attributes.Add("value", settings.Value); } 980 settings.CssClass = "u-full-width " + settings.CssClass; 981982 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 983984 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod"> 985 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null ) 986 { 987 <div class="u-full-width"> 988 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } 989 @if (settings.Link != null) { 990 <div class="u-pull--right"> 991 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } 992 @Render(settings.Link) 993 </div> 994 } 995 </div> 996997 } 998999 @if (!string.IsNullOrEmpty(settings.HelpText)) 1000 { 1001 <small class="form__help-text">@settings.HelpText</small> 1002 } 10031004 <div class="form__field-combi file-input u-no-margin dw-mod"> 1005 <input @ComponentMethods.AddAttributes(resultAttributes) class="file-input__real-input" data-no-files-text="@settings.NoFilesChosenText" data-many-files-text="@Translate("files")" /> 1006 <label for="@settings.Id" class="file-input__btn btn--secondary btn dw-mod">@settings.ChooseFileText</label> 1007 <label for="@settings.Id" class="@settings.CssClass file-input__fake-input js-fake-input dw-mod">@settings.NoFilesChosenText</label> 1008 @if (settings.UploadButton != null) 1009 { 1010 settings.UploadButton.CssClass += " btn--condensed u-no-margin"; 1011 @Render(settings.UploadButton) 1012 } 1013 </div> 1014 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1015 </div> 1016 } 1017 @using System.Reflection 1018 @using Dynamicweb.Rapido.Blocks.Components.General 1019 @using Dynamicweb.Rapido.Blocks.Components 1020 @using Dynamicweb.Core 1021 @using System.Linq 10221023 @* Component *@ 10241025 @helper RenderDateTimeField(DateTimeField settings) 1026 { 1027 if (string.IsNullOrEmpty(settings.Id)) 1028 { 1029 settings.Id = Guid.NewGuid().ToString("N"); 1030 } 10311032 var textField = new TextField { 1033 Name = settings.Name, 1034 Id = settings.Id, 1035 Label = settings.Label, 1036 HelpText = settings.HelpText, 1037 Value = settings.Value, 1038 Disabled = settings.Disabled, 1039 Required = settings.Required, 1040 ErrorMessage = settings.ErrorMessage, 1041 CssClass = settings.CssClass, 1042 WrapperCssClass = settings.WrapperCssClass, 1043 OnChange = settings.OnChange, 1044 OnClick = settings.OnClick, 1045 Link = settings.Link, 1046 ExtraAttributes = settings.ExtraAttributes, 1047 // 1048 Placeholder = settings.Placeholder 1049 }; 10501051 @Render(textField) 10521053 List<string> jsAttributes = new List<string>(); 10541055 jsAttributes.Add("mode: '" + Enum.GetName(typeof(DateTimeFieldMode), settings.Mode).ToLower() + "'"); 10561057 if (!string.IsNullOrEmpty(settings.DateFormat)) 1058 { 1059 jsAttributes.Add("dateFormat: '" + settings.DateFormat + "'"); 1060 } 1061 if (!string.IsNullOrEmpty(settings.MinDate)) 1062 { 1063 jsAttributes.Add("minDate: '" + settings.MinDate + "'"); 1064 } 1065 if (!string.IsNullOrEmpty(settings.MaxDate)) 1066 { 1067 jsAttributes.Add("maxDate: '" + settings.MaxDate + "'"); 1068 } 1069 if (settings.IsInline) 1070 { 1071 jsAttributes.Add("inline: " + Converter.ToString(settings.IsInline).ToLower()); 1072 } 1073 if (settings.EnableTime) 1074 { 1075 jsAttributes.Add("enableTime: " + Converter.ToString(settings.EnableTime).ToLower()); 1076 } 1077 if (settings.EnableWeekNumbers) 1078 { 1079 jsAttributes.Add("weekNumbers: " + Converter.ToString(settings.EnableWeekNumbers).ToLower()); 1080 } 10811082 jsAttributes.AddRange(settings.GetFlatPickrOptions().Select(x => x.Key + ": " + x.Value)); 10831084 <script> 1085 document.addEventListener("DOMContentLoaded", function () { 1086 flatpickr("#@textField.Id", { 1087 @string.Join(",", jsAttributes) 1088 }); 1089 }); 1090 </script> 1091 } 1092 @using System.Reflection 1093 @using Dynamicweb.Rapido.Blocks.Components.General 1094 @using Dynamicweb.Rapido.Blocks.Components 10951096 @* Component *@ 10971098 @helper RenderTextField(TextField settings) 1099 { 1100 var attributes = new Dictionary<string, string>(); 1101 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1102 { 1103 settings.Id = Guid.NewGuid().ToString("N"); 1104 } 11051106 /*base settings*/ 1107 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1108 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1109 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1110 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1111 if (settings.Required) { attributes.Add("required", "true"); } 1112 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1113 /*end*/ 11141115 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 1116 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 1117 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 1118 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 1119 if (settings.MaxLength != 0) { attributes.Add("maxlength", settings.MaxLength.ToString()); } 1120 if (!string.IsNullOrEmpty(settings.Placeholder)) { attributes.Add("placeholder", settings.Placeholder); } 1121 attributes.Add("type", Enum.GetName(typeof(TextFieldType), settings.Type).ToLower()); 1122 if (settings.Type == TextFieldType.Password) { attributes.Add("autocomplete", "off"); }; 1123 if (settings.Value != null) { attributes.Add("value", settings.Value); } 11241125 settings.CssClass = "u-full-width " + settings.CssClass; 11261127 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; } 11281129 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 11301131 string noMargin = "u-no-margin"; 1132 if (!settings.ReadOnly) { 1133 noMargin = ""; 1134 } 11351136 <div class="form__field-group u-full-width @noMargin @settings.WrapperCssClass dw-mod"> 1137 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null ) 1138 { 1139 <div class="u-full-width"> 1140 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } 1141 @if (settings.Link != null) { 1142 settings.Link.ButtonLayout = ButtonLayout.LinkClean; 11431144 <div class="u-pull--right"> 1145 @Render(settings.Link) 1146 </div> 1147 } 1148 </div> 11491150 } 11511152 @if (!string.IsNullOrEmpty(settings.HelpText)) 1153 { 1154 <small class="form__help-text">@settings.HelpText</small> 1155 } 11561157 @if (settings.ActionButton != null) 1158 { 1159 settings.ActionButton.CssClass += " btn--condensed u-no-margin"; 1160 <div class="form__field-combi u-no-margin dw-mod"> 1161 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1162 @Render(settings.ActionButton) 1163 </div> 1164 } 1165 else 1166 { 1167 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1168 } 11691170 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1171 </div> 1172 } 1173 @using System.Reflection 1174 @using Dynamicweb.Rapido.Blocks.Components.General 1175 @using Dynamicweb.Rapido.Blocks.Components 11761177 @* Component *@ 11781179 @helper RenderNumberField(NumberField settings) 1180 { 1181 var attributes = new Dictionary<string, string>(); 1182 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1183 { 1184 settings.Id = Guid.NewGuid().ToString("N"); 1185 } 11861187 /*base settings*/ 1188 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1189 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1190 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1191 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1192 if (settings.Required) { attributes.Add("required", "true"); } 1193 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1194 /*end*/ 11951196 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 1197 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 1198 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 1199 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 1200 if (settings.Max != null) { attributes.Add("max", settings.Max.ToString()); } 1201 if (settings.Min != null) { attributes.Add("min", settings.Min.ToString()); } 1202 if (settings.Step != 0) { attributes.Add("step", settings.Step.ToString()); } 1203 if (settings.Value != null && !string.IsNullOrEmpty(settings.Value.ToString())) { attributes.Add("value", settings.Value.ToString()); } 1204 attributes.Add("type", "number"); 12051206 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 12071208 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod"> 1209 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null ) 1210 { 1211 <div class="u-full-width"> 1212 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } 1213 @if (settings.Link != null) { 1214 <div class="u-pull--right"> 1215 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } 1216 @Render(settings.Link) 1217 </div> 1218 } 1219 </div> 12201221 } 12221223 @if (!string.IsNullOrEmpty(settings.HelpText)) 1224 { 1225 <small class="form__help-text">@settings.HelpText</small> 1226 } 12271228 @if (settings.ActionButton != null) 1229 { 1230 settings.ActionButton.CssClass += " btn--condensed u-no-margin"; 1231 <div class="form__field-combi u-no-margin dw-mod"> 1232 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1233 @Render(settings.ActionButton) 1234 </div> 1235 } 1236 else 1237 { 1238 <div class="form__field-combi u-no-margin dw-mod"> 1239 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1240 </div> 1241 } 12421243 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1244 </div> 1245 } 1246 @using System.Reflection 1247 @using Dynamicweb.Rapido.Blocks.Components.General 1248 @using Dynamicweb.Rapido.Blocks.Components 124912501251 @* Component *@ 12521253 @helper RenderTextareaField(TextareaField settings) 1254 { 1255 Dictionary<string, string> attributes = new Dictionary<string, string>(); 1256 string id = settings.Id; 1257 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(id)) 1258 { 1259 id = Guid.NewGuid().ToString("N"); 1260 } 12611262 if (!string.IsNullOrEmpty(id)) { attributes.Add("id", id); } 1263 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1264 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 1265 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 1266 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 1267 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1268 if (!string.IsNullOrEmpty(settings.Placeholder)) { attributes.Add("placeholder", settings.Placeholder); } 1269 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1270 if (settings.Required) { attributes.Add("required", "true"); } 1271 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 1272 if (settings.MaxLength != 0) { attributes.Add("maxlength", settings.MaxLength.ToString()); } 1273 if (settings.Rows != 0) { attributes.Add("rows", settings.Rows.ToString()); } 1274 attributes.Add("name", settings.Name); 12751276 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; } 12771278 <div class="form__field-group @settings.WrapperCssClass dw-mod"> 1279 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null ) 1280 { 1281 <div class="u-full-width"> 1282 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } 1283 @if (settings.Link != null) { 1284 <div class="u-pull--right"> 1285 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } 1286 @Render(settings.Link) 1287 </div> 1288 } 1289 </div> 1290 } 12911292 @if (!string.IsNullOrEmpty(settings.HelpText)) 1293 { 1294 <small class="form__help-text">@settings.HelpText</small> 1295 } 12961297 <textarea class="u-full-width @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Value</textarea> 12981299 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1300 </div> 1301 } 1302 @using System.Reflection 1303 @using Dynamicweb.Rapido.Blocks.Components.General 1304 @using Dynamicweb.Rapido.Blocks.Components 130513061307 @* Component *@ 13081309 @helper RenderHiddenField(HiddenField settings) { 1310 var attributes = new Dictionary<string, string>(); 1311 attributes.Add("type", "hidden"); 1312 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1313 if (settings.Value != null) { attributes.Add("value", settings.Value); } 1314 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 13151316 <input @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)/> 1317 } 1318 @using System.Reflection 1319 @using Dynamicweb.Rapido.Blocks.Components.General 1320 @using Dynamicweb.Rapido.Blocks.Components 13211322 @* Component *@ 13231324 @helper RenderCheckboxField(CheckboxField settings) 1325 { 1326 var attributes = new Dictionary<string, string>(); 1327 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1328 { 1329 settings.Id = Guid.NewGuid().ToString("N"); 1330 } 13311332 /*base settings*/ 1333 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1334 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1335 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1336 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1337 if (settings.Required) { attributes.Add("required", "true"); } 1338 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1339 /*end*/ 13401341 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; } 13421343 attributes.Add("type", "checkbox"); 1344 if (settings.Checked) { attributes.Add("checked", "true"); } 1345 settings.CssClass = "form__control " + settings.CssClass; 1346 if (settings.Value != null) { attributes.Add("value", settings.Value); } 13471348 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 13491350 <div class="form__field-group @settings.WrapperCssClass dw-mod"> 1351 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1352 @if (!string.IsNullOrEmpty(settings.Label)) 1353 { 1354 <label for="@settings.Id" class="dw-mod">@settings.Label</label> 1355 } 13561357 @if (settings.Link != null) { 1358 <span> 1359 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } 1360 @Render(settings.Link) 1361 </span> 1362 } 13631364 @if (!string.IsNullOrEmpty(settings.HelpText)) 1365 { 1366 <small class="form__help-text checkbox-help dw-mod">@settings.HelpText</small> 1367 } 1368 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1369 </div> 1370 } 1371 @using System.Reflection 1372 @using Dynamicweb.Rapido.Blocks.Components.General 1373 @using Dynamicweb.Rapido.Blocks.Components 137413751376 @* Component *@ 13771378 @helper RenderCheckboxListField(CheckboxListField settings) 1379 { 1380 <div class="form__field-group @settings.WrapperCssClass u-margin-bottom dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1381 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null ) 1382 { 1383 <div class="u-full-width"> 1384 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } 1385 @if (settings.Link != null) { 1386 <div class="u-pull--right"> 1387 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } 1388 @Render(settings.Link) 1389 </div> 1390 } 1391 </div> 13921393 } 13941395 <div class="u-pull--left"> 1396 @if (!string.IsNullOrEmpty(settings.HelpText)) 1397 { 1398 <small class="form__help-text">@settings.HelpText</small> 1399 } 14001401 @foreach (var item in settings.Options) 1402 { 1403 if (settings.Required) 1404 { 1405 item.Required = true; 1406 } 1407 if (settings.Disabled) 1408 { 1409 item.Disabled = true; 1410 } 1411 if (!string.IsNullOrEmpty(settings.Name)) 1412 { 1413 item.Name = settings.Name; 1414 } 1415 if (!string.IsNullOrEmpty(settings.CssClass)) 1416 { 1417 item.CssClass += settings.CssClass; 1418 } 14191420 /* value is not supported */ 14211422 if (!string.IsNullOrEmpty(settings.OnClick)) 1423 { 1424 item.OnClick += settings.OnClick; 1425 } 1426 if (!string.IsNullOrEmpty(settings.OnChange)) 1427 { 1428 item.OnChange += settings.OnChange; 1429 } 1430 @Render(item) 1431 } 14321433 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1434 </div> 14351436 </div> 1437 } 1438 @using Dynamicweb.Rapido.Blocks.Components.General 14391440 @* Component *@ 14411442 @helper RenderSearch(Search settings) 1443 { 1444 var searchValue = HttpContext.Current.Request.QueryString.Get(settings.SearchParameter) ?? ""; 1445 var groupValue = HttpContext.Current.Request.QueryString.Get(settings.GroupsParameter) ?? ""; 14461447 if (string.IsNullOrEmpty(settings.Id)) 1448 { 1449 settings.Id = Guid.NewGuid().ToString("N"); 1450 } 14511452 var resultAttributes = new Dictionary<string, string>(); 14531454 if (settings.PageSize != 0) 1455 { 1456 resultAttributes.Add("data-page-size", settings.PageSize.ToString()); 1457 } 1458 if (!string.IsNullOrEmpty(settings.GroupItemsFeedUrl)) 1459 { 1460 resultAttributes.Add("data-groups-feed-url", settings.GroupItemsFeedUrl); 1461 if (!string.IsNullOrEmpty(groupValue)) 1462 { 1463 resultAttributes.Add("data-selected-group", groupValue); 1464 } 1465 if (!string.IsNullOrEmpty(settings.GroupsParameter)) 1466 { 1467 resultAttributes.Add("data-groups-parameter", settings.GroupsParameter); 1468 } 1469 } 1470 resultAttributes.Add("data-force-init", "true"); 1471 if (settings.GoToFirstSearchResultOnEnter) 1472 { 1473 resultAttributes.Add("data-go-to-first-search-result-on-enter", settings.GoToFirstSearchResultOnEnter.ToString().ToLower()); 1474 } 1475 if (!string.IsNullOrEmpty(settings.SearchParameter)) 1476 { 1477 resultAttributes.Add("data-search-parameter", settings.SearchParameter); 1478 } 1479 resultAttributes.Add("data-search-feed-url", settings.SearchData.SearchFeedUrl); 1480 resultAttributes.Add("data-results-template-id", settings.SearchData.ResultsTemplateId); 14811482 if (settings.SecondSearchData != null) 1483 { 1484 resultAttributes.Add("data-second-search-feed-url", settings.SecondSearchData.SearchFeedUrl); 1485 resultAttributes.Add("data-second-results-template-id", settings.SecondSearchData.ResultsTemplateId); 1486 } 1487 if (!string.IsNullOrEmpty(settings.ResultsPageUrl)) 1488 { 1489 resultAttributes.Add("data-results-page-url", settings.ResultsPageUrl); 1490 } 14911492 resultAttributes = resultAttributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 14931494 string searchFieldCss = (settings.SearchButton == null) ? "search--with-icon" : ""; 14951496 <div class="search @settings.CssClass @searchFieldCss js-search-data-source dw-mod" id="@settings.Id" @ComponentMethods.AddAttributes(resultAttributes)> 1497 @if (!string.IsNullOrEmpty(settings.GroupItemsFeedUrl)) 1498 { 1499 <button type="button" class="search__groups-btn dw-mod js-search-groups-btn">@Translate("All")</button> 1500 <ul class="dropdown dropdown--absolute-position dw-mod search__groups-results js-search-groups-list"></ul> 1501 } 15021503 <input type="text" class="search__field dw-mod js-search-field" placeholder="@settings.Placeholder" value="@searchValue"> 15041505 <div class="dropdown dropdown--absolute-position search__results dw-mod js-search-results @(settings.SecondSearchData != null ? "search__results--combined" : "")"> 1506 @if (settings.SecondSearchData != null) 1507 { 1508 <div class="search__column search__column--products dw-mod"> 1509 <div class="search__column-header dw-mod">@Translate("Products")</div> 1510 <ul class="search__results-list dw-mod js-search-results-list" id="@(settings.Id)_ResultsList"></ul> 1511 @if (!string.IsNullOrEmpty(settings.SearchData.ResultsPageUrl)) 1512 { 1513 @Render(new Link { 1514 Title = Translate("View all"), 1515 CssClass = "js-view-all-button u-margin", 1516 Href = settings.SearchData.ResultsPageUrl 1517 }); 1518 } 1519 </div> 1520 <div class="search__column search__column--pages dw-mod"> 1521 <div class="search__column-header">@Translate("Pages")</div> 1522 <ul class="search__results-list dw-mod js-search-results-second-list" id="@(settings.Id)_SecondResultsList"></ul> 1523 @if (!string.IsNullOrEmpty(settings.SecondSearchData.ResultsPageUrl)) 1524 { 1525 @Render(new Link 1526 { 1527 Title = Translate("View all"), 1528 CssClass = "js-view-all-button u-margin", 1529 Href = settings.SecondSearchData.ResultsPageUrl 1530 }); 1531 } 1532 </div> 1533 } 1534 else 1535 { 1536 <div class="search__column search__column--only dw-mod"> 1537 <ul class="search__results-list dw-mod js-search-results-list" id="@(settings.Id)_ResultsList"></ul> 1538 @if (!string.IsNullOrEmpty(settings.SearchData.ResultsPageUrl)) 1539 { 1540 @Render(new Link { 1541 Title = Translate("View all"), 1542 CssClass = "js-view-all-button u-margin", 1543 Href = settings.SearchData.ResultsPageUrl 1544 }); 1545 } 1546 </div> 1547 } 1548 </div> 15491550 @if (settings.SearchButton != null) 1551 { 1552 settings.SearchButton.CssClass += " search__btn js-search-btn"; 1553 if (settings.RenderDefaultSearchIcon) 1554 { 1555 settings.SearchButton.Icon = new Icon { Name = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue }; 1556 } 1557 @Render(settings.SearchButton); 1558 } 1559 </div> 1560 } 1561 @using System.Reflection 1562 @using Dynamicweb.Rapido.Blocks.Components.General 1563 @using Dynamicweb.Rapido.Blocks.Components 156415651566 @* Component *@ 15671568 @helper RenderSelectField(SelectField settings) 1569 { 1570 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1571 { 1572 settings.Id = Guid.NewGuid().ToString("N"); 1573 } 15741575 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod"> 1576 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null ) 1577 { 1578 <div class="u-full-width"> 1579 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } 1580 @if (settings.Link != null) { 1581 <div class="u-pull--right"> 1582 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } 1583 @Render(settings.Link) 1584 </div> 1585 } 1586 </div> 1587 } 15881589 @if (!string.IsNullOrEmpty(settings.HelpText)) 1590 { 1591 <small class="form__help-text">@settings.HelpText</small> 1592 } 15931594 @if (settings.ActionButton != null) 1595 { 1596 settings.ActionButton.CssClass += " btn--condensed u-no-margin"; 1597 <div class="form__field-combi u-no-margin dw-mod"> 1598 @RenderSelectBase(settings) 1599 @Render(settings.ActionButton) 1600 </div> 1601 } 1602 else 1603 { 1604 @RenderSelectBase(settings) 1605 } 16061607 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1608 </div> 1609 } 16101611 @helper RenderSelectBase(SelectField settings) 1612 { 1613 var attributes = new Dictionary<string, string>(); 16141615 /*base settings*/ 1616 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1617 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1618 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1619 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1620 if (settings.Required) { attributes.Add("required", "true"); } 1621 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1622 /*end*/ 16231624 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 16251626 <select @ComponentMethods.AddAttributes(resultAttributes) class="u-full-width @settings.CssClass dw-mod"> 1627 @if (settings.Default != null) 1628 { 1629 @Render(settings.Default) 1630 } 16311632 @foreach (var item in settings.Options) 1633 { 1634 if (settings.Value != null) { 1635 item.Checked = item.Value == settings.Value; 1636 } 1637 @Render(item) 1638 } 1639 </select> 1640 } 1641 @using System.Reflection 1642 @using Dynamicweb.Rapido.Blocks.Components.General 1643 @using Dynamicweb.Rapido.Blocks.Components 16441645 @* Component *@ 16461647 @helper RenderRadioButtonField(RadioButtonField settings) 1648 { 1649 var attributes = new Dictionary<string, string>(); 1650 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1651 { 1652 settings.Id = Guid.NewGuid().ToString("N"); 1653 } 16541655 /*base settings*/ 1656 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1657 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1658 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1659 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1660 if (settings.Required) { attributes.Add("required", "true"); } 1661 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1662 /*end*/ 16631664 attributes.Add("type", "radio"); 1665 if (settings.Checked) { attributes.Add("checked", "true"); } 1666 settings.CssClass = "form__control " + settings.CssClass; 1667 if (settings.Value != null) { attributes.Add("value", settings.Value); } 16681669 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 16701671 <div class="form__field-group @settings.WrapperCssClass dw-mod"> 1672 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1673 @if (!string.IsNullOrEmpty(settings.Label)) 1674 { 1675 <label for="@settings.Id" class="dw-mod">@settings.Label</label> 1676 } 1677 @if (!string.IsNullOrEmpty(settings.HelpText)) 1678 { 1679 <small class="form__help-text">@settings.HelpText</small> 1680 } 1681 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1682 </div> 1683 } 1684 @using System.Reflection 1685 @using Dynamicweb.Rapido.Blocks.Components.General 1686 @using Dynamicweb.Rapido.Blocks.Components 168716881689 @* Component *@ 16901691 @helper RenderRadioButtonListField(RadioButtonListField settings) 1692 { 1693 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; } 16941695 <div class="form__field-group @settings.WrapperCssClass u-margin-bottom dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1696 @if (!string.IsNullOrEmpty(settings.Label)) 1697 { 1698 <label>@settings.Label</label> 1699 } 1700 @if (!string.IsNullOrEmpty(settings.HelpText)) 1701 { 1702 <small class="form__help-text">@settings.HelpText</small> 1703 } 17041705 @foreach (var item in settings.Options) 1706 { 1707 if (settings.Required) 1708 { 1709 item.Required = true; 1710 } 1711 if (settings.Disabled) 1712 { 1713 item.Disabled = true; 1714 } 1715 if (!string.IsNullOrEmpty(settings.Name)) 1716 { 1717 item.Name = settings.Name; 1718 } 1719 if (settings.Value != null && settings.Value == item.Value) 1720 { 1721 item.Checked = true; 1722 } 1723 if (!string.IsNullOrEmpty(settings.OnClick)) 1724 { 1725 item.OnClick += settings.OnClick; 1726 } 1727 if (!string.IsNullOrEmpty(settings.OnChange)) 1728 { 1729 item.OnChange += settings.OnChange; 1730 } 1731 if (!string.IsNullOrEmpty(settings.CssClass)) 1732 { 1733 item.CssClass += settings.CssClass; 1734 } 1735 @Render(item) 1736 } 17371738 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1739 </div> 1740 } 1741 @using System.Reflection 1742 @using Dynamicweb.Rapido.Blocks.Components.General 1743 @using Dynamicweb.Rapido.Blocks.Components 174417451746 @* Component *@ 17471748 @helper RenderNotificationMessage(NotificationMessage settings) 1749 { 1750 if (!string.IsNullOrEmpty(settings.Message)) 1751 { 1752 var attributes = new Dictionary<string, string>(); 1753 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 17541755 string messageTypeClass = Enum.GetName(typeof(NotificationMessageType), settings.MessageType).ToLower(); 1756 string messageLayoutClass = Enum.GetName(typeof(NotificationMessageLayout), settings.MessageLayout).ToLower(); 1757 string minHeightClass = settings.Icon != null ? "u-min-h70px" : ""; 17581759 <div class="notification-message-@messageTypeClass notification-message-@messageLayoutClass @messageLayoutClass @minHeightClass @settings.CssClass u-full-width dw-mod" @ComponentMethods.AddAttributes(attributes)> 1760 @if (settings.Icon != null) { 1761 settings.Icon.Label = !string.IsNullOrEmpty(settings.Icon.Label) ? settings.Message + settings.Icon.Label : settings.Message; 1762 @Render(settings.Icon) 1763 } else { 1764 @settings.Message 1765 } 1766 </div> 1767 } 1768 } 1769 @using Dynamicweb.Rapido.Blocks.Components.General 177017711772 @* Component *@ 17731774 @helper RenderHandlebarsRoot(HandlebarsRoot settings) { 1775 string preRender = !String.IsNullOrEmpty(settings.PreRenderScriptTemplate) ? "data-pre-render-template=\"" + settings.PreRenderScriptTemplate + "\"" : ""; 17761777 <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> 1778 @if (settings.SubBlocks != null) { 1779 @RenderBlockList(settings.SubBlocks) 1780 } 1781 </div> 1782 } 1783 @using System.Reflection 1784 @using Dynamicweb.Rapido.Blocks.Components.General 1785 @using Dynamicweb.Rapido.Blocks.Components 1786 @using System.Text.RegularExpressions 178717881789 @* Component *@ 17901791 @helper RenderSticker(Sticker settings) { 1792 if (!String.IsNullOrEmpty(settings.Title)) { 1793 string size = settings.Size.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Size.ToString().ToLower() : ""; 1794 string style = settings.Style.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Style.ToString().ToLower() : ""; 17951796 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>(); 1797 if (!String.IsNullOrEmpty(settings.Color) || !String.IsNullOrEmpty(settings.BackgroundColor)) { 1798 string styleTag = !String.IsNullOrEmpty(settings.Color) ? "color: " + settings.Color + "; " : ""; 1799 styleTag += !String.IsNullOrEmpty(settings.BackgroundColor) ? "background-color: " + settings.BackgroundColor + "; " : ""; 1800 optionalAttributes.Add("style", styleTag); 1801 } 18021803 <div class="stickers-container__tag @size @style @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Title</div> 1804 } 1805 } 18061807 @using System.Reflection 1808 @using Dynamicweb.Rapido.Blocks.Components.General 1809 @using Dynamicweb.Rapido.Blocks.Components 181018111812 @* Component *@ 18131814 @helper RenderStickersCollection(StickersCollection settings) 1815 { 1816 if (settings.Stickers.Count > 0) 1817 { 1818 string position = "stickers-container--" + Regex.Replace(settings.Position.ToString(), "([a-z])([A-Z])", "$1-$2").ToLower(); 18191820 <div class="stickers-container @position @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1821 @foreach (Sticker sticker in settings.Stickers) 1822 { 1823 @Render(sticker) 1824 } 1825 </div> 1826 } 1827 } 18281829 @using Dynamicweb.Rapido.Blocks.Components.General 183018311832 @* Component *@ 18331834 @helper RenderForm(Form settings) { 1835 if (settings != null) 1836 { 1837 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>(); 1838 if (!string.IsNullOrEmpty(settings.Action)) { optionalAttributes.Add("action", settings.Action); }; 1839 if (!string.IsNullOrEmpty(settings.Name)) { optionalAttributes.Add("name", settings.Name); }; 1840 if (!string.IsNullOrEmpty(settings.OnSubmit)) { optionalAttributes.Add("onsubmit", settings.OnSubmit); }; 1841 var enctypes = new Dictionary<string, string> 1842 { 1843 { "multipart", "multipart/form-data" }, 1844 { "text", "text/plain" }, 1845 { "application", "application/x-www-form-urlencoded" } 1846 }; 1847 if (settings.Enctype != FormEnctype.none) { optionalAttributes.Add("enctype", enctypes[Enum.GetName(typeof(FormEnctype), settings.Enctype).ToLower()]); }; 1848 optionalAttributes.Add("method", settings.Method.ToString()); 18491850 if (!string.IsNullOrEmpty(settings.FormStartMarkup)) 1851 { 1852 @settings.FormStartMarkup 1853 } 1854 else 1855 { 1856 @:<form class="@settings.CssClass u-no-margin dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1857 } 18581859 foreach (var field in settings.GetFields()) 1860 { 1861 @Render(field) 1862 } 18631864 @:</form> 1865 } 1866 } 1867 @using System.Reflection 1868 @using Dynamicweb.Rapido.Blocks.Components.General 1869 @using Dynamicweb.Rapido.Blocks.Components 187018711872 @* Component *@ 18731874 @helper RenderText(Text settings) 1875 { 1876 @settings.Content 1877 } 1878 @using System.Reflection 1879 @using Dynamicweb.Rapido.Blocks.Components.General 1880 @using Dynamicweb.Rapido.Blocks.Components 188118821883 @* Component *@ 18841885 @helper RenderContentModule(ContentModule settings) { 1886 if (!string.IsNullOrEmpty(settings.Content)) 1887 { 1888 @settings.Content 1889 } 1890 } 1891 @using System.Reflection 1892 @using Dynamicweb.Rapido.Blocks.Components.General 1893 @using Dynamicweb.Rapido.Blocks.Components 189418951896 @* Component *@ 18971898 @helper RenderModal(Modal settings) { 1899 if (settings != null) 1900 { 1901 string modalId = !string.IsNullOrEmpty(settings.Id) ? settings.Id : Guid.NewGuid().ToString("N"); 19021903 string onchange = !string.IsNullOrEmpty(settings.OnClose) ? "onchange=\"if(!this.checked){" + settings.OnClose + "}\"" : ""; 19041905 <input type="checkbox" id="@(modalId)ModalTrigger" class="modal-trigger" @onchange /> 19061907 <div class="modal-container"> 1908 @if (!settings.DisableDarkOverlay) 1909 { 1910 <label for="@(modalId)ModalTrigger" id="@(modalId)ModalOverlay" class="modal-overlay"></label> 1911 } 1912 <div class="modal modal--@settings.Width.ToString().ToLower() modal-height--@settings.Height.ToString().ToLower()" id="@(modalId)Modal"> 1913 @if (settings.Heading != null) 1914 { 1915 if (!string.IsNullOrEmpty(settings.Heading.Title)) 1916 { 1917 <div class="modal__header"> 1918 @Render(settings.Heading) 1919 </div> 1920 } 1921 } 1922 <div class="modal__body @(settings.Width.ToString().ToLower() == "full" ? "modal__body--full" : "")"> 1923 @if (!string.IsNullOrEmpty(settings.BodyText)) 1924 { 1925 @settings.BodyText 1926 } 1927 @if (settings.BodyTemplate != null) 1928 { 1929 @settings.BodyTemplate 1930 } 1931 @{ 1932 var actions = settings.GetActions(); 1933 } 1934 </div> 1935 @if (actions.Length > 0) 1936 { 1937 <div class="modal__footer"> 1938 @foreach (var action in actions) 1939 { 1940 if (Pageview.Device.ToString() != "Mobile") { 1941 action.CssClass += " u-no-margin"; 1942 } else { 1943 action.CssClass += " u-full-width u-margin-bottom"; 1944 } 19451946 @Render(action) 1947 } 1948 </div> 1949 } 1950 <label class="modal__close-btn" for="@(modalId)ModalTrigger"></label> 1951 </div> 1952 </div> 1953 } 1954 } 1955 @using Dynamicweb.Rapido.Blocks.Components.General 19561957 @* Component *@ 19581959 @helper RenderMediaListItem(MediaListItem settings) 1960 { 1961 <div class="media-list-item @settings.CssClass dw-mod" @(!string.IsNullOrEmpty(settings.Id) ? "id=\"" + settings.Id + "\"" : "")> 1962 @if (!string.IsNullOrEmpty(settings.Label)) 1963 { 1964 if (!string.IsNullOrEmpty(settings.Link)) 1965 { 1966 @Render(new Link 1967 { 1968 Href = settings.Link, 1969 CssClass = "media-list-item__sticker dw-mod", 1970 ButtonLayout = ButtonLayout.None, 1971 Title = settings.Label, 1972 OnClick = !string.IsNullOrEmpty(settings.OnClick) ? settings.OnClick : "" 1973 }) 1974 } 1975 else if (!string.IsNullOrEmpty(settings.OnClick)) 1976 { 1977 <span class="media-list-item__sticker dw-mod" onclick="@(settings.OnClick)"> 1978 <span class="u-uppercase">@settings.Label</span> 1979 </span> 1980 } 1981 else 1982 { 1983 <span class="media-list-item__sticker media-list-item__sticker--no-link dw-mod"> 1984 <span class="u-uppercase">@settings.Label</span> 1985 </span> 1986 } 1987 } 1988 <div class="media-list-item__wrap"> 1989 <div class="media-list-item__info dw-mod"> 1990 <div class="media-list-item__header dw-mod"> 1991 @if (!string.IsNullOrEmpty(settings.Title)) 1992 { 1993 if (!string.IsNullOrEmpty(settings.Link)) 1994 { 1995 @Render(new Link 1996 { 1997 Href = settings.Link, 1998 CssClass = "media-list-item__name dw-mod", 1999 ButtonLayout = ButtonLayout.None, 2000 Title = settings.Title, 2001 OnClick = !string.IsNullOrEmpty(settings.OnClick) ? settings.OnClick : "" 2002 }) 2003 } 2004 else if (!string.IsNullOrEmpty(settings.OnClick)) 2005 { 2006 <span class="media-list-item__name dw-mod" onclick="@(settings.OnClick)">@settings.Title</span> 2007 } 2008 else 2009 { 2010 <span class="media-list-item__name media-list-item__name--no-link dw-mod">@settings.Title</span> 2011 } 2012 } 20132014 @if (!string.IsNullOrEmpty(settings.Status)) 2015 { 2016 <div class="media-list-item__state dw-mod">@settings.Status</div> 2017 } 2018 </div> 2019 @{ 2020 settings.InfoTable.CssClass += " media-list-item__parameters-table"; 2021 } 20222023 @Render(settings.InfoTable) 2024 </div> 2025 <div class="media-list-item__actions dw-mod"> 2026 <div class="media-list-item__actions-list dw-mod"> 2027 @{ 2028 var actions = settings.GetActions(); 20292030 foreach (ButtonBase action in actions) 2031 { 2032 action.ButtonLayout = ButtonLayout.None; 2033 action.CssClass += " media-list-item__action link"; 20342035 @Render(action) 2036 } 2037 } 2038 </div> 20392040 @if (settings.SelectButton != null && !string.IsNullOrEmpty(settings.SelectButton.Title)) 2041 { 2042 settings.SelectButton.CssClass += " u-no-margin"; 20432044 <div class="media-list-item__action-button"> 2045 @Render(settings.SelectButton) 2046 </div> 2047 } 2048 </div> 2049 </div> 2050 </div> 2051 } 2052 @using Dynamicweb.Rapido.Blocks.Components.General 2053 @using Dynamicweb.Rapido.Blocks.Components 20542055 @helper RenderTable(Table settings) 2056 { 2057 Dictionary<string, string> attributes = new Dictionary<string, string>(); 2058 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 20592060 var enumToClasses = new Dictionary<TableDesign, string> 2061 { 2062 { TableDesign.Clean, "table--clean" }, 2063 { TableDesign.Bordered, "table--bordered" }, 2064 { TableDesign.Striped, "table--striped" }, 2065 { TableDesign.Hover, "table--hover" }, 2066 { TableDesign.Compact, "table--compact" }, 2067 { TableDesign.Condensed, "table--condensed" }, 2068 { TableDesign.NoTopBorder, "table--no-top-border" } 2069 }; 2070 string tableDesignClass = ""; 2071 if (settings.Design != TableDesign.None) 2072 { 2073 tableDesignClass = enumToClasses[settings.Design]; 2074 } 20752076 if (!string.IsNullOrEmpty(settings.CssClass) || settings.Design != TableDesign.None) { attributes.Add("class", "table " + tableDesignClass + " " + settings.CssClass + " dw-mod"); } 20772078 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value); 20792080 <table @ComponentMethods.AddAttributes(resultAttributes)> 2081 @if (settings.Header != null) 2082 { 2083 <thead> 2084 @Render(settings.Header) 2085 </thead> 2086 } 2087 <tbody> 2088 @foreach (var row in settings.Rows) 2089 { 2090 @Render(row) 2091 } 2092 </tbody> 2093 @if (settings.Footer != null) 2094 { 2095 <tfoot> 2096 @Render(settings.Footer) 2097 </tfoot> 2098 } 2099 </table> 2100 } 2101 @using Dynamicweb.Rapido.Blocks.Components.General 2102 @using Dynamicweb.Rapido.Blocks.Components 21032104 @helper RenderTableRow(TableRow settings) 2105 { 2106 Dictionary<string, string> attributes = new Dictionary<string, string>(); 2107 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 21082109 var enumToClasses = new Dictionary<TableRowDesign, string> 2110 { 2111 { TableRowDesign.NoBorder, "table__row--no-border" }, 2112 { TableRowDesign.Border, "table__row--border" }, 2113 { TableRowDesign.TopBorder, "table__row--top-line" }, 2114 { TableRowDesign.BottomBorder, "table__row--bottom-line" }, 2115 { TableRowDesign.Solid, "table__row--solid" } 2116 }; 21172118 string tableRowDesignClass = ""; 2119 if (settings.Design != TableRowDesign.None) 2120 { 2121 tableRowDesignClass = enumToClasses[settings.Design]; 2122 } 21232124 if (!string.IsNullOrEmpty(settings.CssClass) || settings.Design != TableRowDesign.None) { attributes.Add("class", "table__row " + tableRowDesignClass + " " + settings.CssClass + " dw-mod"); } 21252126 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value); 21272128 <tr @ComponentMethods.AddAttributes(resultAttributes)> 2129 @foreach (var cell in settings.Cells) 2130 { 2131 if (settings.IsHeaderRow) 2132 { 2133 cell.IsHeader = true; 2134 } 2135 @Render(cell) 2136 } 2137 </tr> 2138 } 2139 @using Dynamicweb.Rapido.Blocks.Components.General 2140 @using Dynamicweb.Rapido.Blocks.Components 2141 @using Dynamicweb.Core 21422143 @helper RenderTableCell(TableCell settings) 2144 { 2145 Dictionary<string, string> attributes = new Dictionary<string, string>(); 2146 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 2147 if (settings.Colspan != 0) { attributes.Add("colspan", Converter.ToString(settings.Colspan)); } 2148 if (settings.Rowspan != 0) { attributes.Add("rowspan", Converter.ToString(settings.Rowspan)); } 2149 if (!string.IsNullOrEmpty(settings.CssClass)) { attributes.Add("class", settings.CssClass + " dw-mod"); } 21502151 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value); 21522153 string tagName = settings.IsHeader ? "th" : "td"; 21542155 @("<" + tagName + " " + ComponentMethods.AddAttributes(resultAttributes) + ">") 2156 @settings.Content 2157 @("</" + tagName + ">"); 2158 } 2159 @using System.Linq 2160 @using Dynamicweb.Rapido.Blocks.Components.General 21612162 @* Component *@ 21632164 @helper RenderPagination(Dynamicweb.Rapido.Blocks.Components.General.Pagination settings) 2165 { 2166 var pageNumberQueryStringName = Dynamicweb.Rapido.Services.Pagination.GetPageNumberQueryStringName(settings); // Get the proper 'page number' query string parameter 2167 var queryParameters = Dynamicweb.Rapido.Services.Url.GetQueryParameters(pageNumberQueryStringName); // Get the NameValueCollection from the querystring 21682169 if (settings.NumberOfPages > 1) 2170 { 2171 string url = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + "/Default.aspx"; 2172 string ariaLabel = !string.IsNullOrWhiteSpace(settings.AriaLabel) ? settings.AriaLabel : Translate("Page navigation"); 2173 Dictionary<string, int> startAndEndPageNumber = Dynamicweb.Rapido.Services.Pagination.GetStartAndEndPageNumber(settings); 21742175 <div class="pager u-margin-top dw-mod @settings.CssClass" aria-label="@ariaLabel"> 2176 @if (settings.ShowPagingInfo) 2177 { 2178 <div class="pager__info dw-mod"> 2179 @Translate("Page") @settings.CurrentPageNumber @Translate("of") @settings.NumberOfPages 2180 </div> 2181 } 2182 <ul class="pager__list dw-mod"> 2183 @if (!string.IsNullOrWhiteSpace(settings.FirstPageUrl) && settings.ShowFirstAndLastControls) 2184 { 2185 @Render(new PaginationItem { Link = settings.FirstPageUrl, Icon = settings.FirstIcon }) 2186 } 2187 @if (!string.IsNullOrWhiteSpace(settings.PreviousPageUrl) && settings.ShowNextAndPrevControls) 2188 { 2189 @Render(new PaginationItem { Link = settings.PreviousPageUrl, Icon = settings.PrevIcon }) 2190 } 2191 @if (settings.GetPages().Any()) 2192 { 2193 foreach (var page in settings.GetPages()) 2194 { 2195 @Render(page) 2196 } 2197 } 2198 else 2199 { 2200 for (var page = startAndEndPageNumber["StartPage"]; page <= startAndEndPageNumber["EndPage"]; page++) 2201 { 2202 queryParameters = Dynamicweb.Rapido.Services.Url.UpdateQueryStringParameter(queryParameters, pageNumberQueryStringName, page.ToString()); 2203 @Render(new PaginationItem { Label = page.ToString(), Link = Dynamicweb.Rapido.Services.Url.BuildUri(url, queryParameters).PathAndQuery, IsActive = (settings.CurrentPageNumber == page) }); 2204 } 2205 } 2206 @if (!string.IsNullOrWhiteSpace(settings.NextPageUrl) && settings.ShowNextAndPrevControls) 2207 { 2208 @Render(new PaginationItem { Link = settings.NextPageUrl, Icon = settings.NextIcon }) 2209 } 2210 @if (!string.IsNullOrWhiteSpace(settings.LastPageUrl) && settings.ShowFirstAndLastControls) 2211 { 2212 @Render(new PaginationItem { Link = settings.LastPageUrl, Icon = settings.LastIcon }) 2213 } 2214 </ul> 2215 </div> 2216 } 2217 } 22182219 @helper RenderPaginationItem(PaginationItem settings) 2220 { 2221 if (settings.Icon == null) 2222 { 2223 settings.Icon = new Icon(); 2224 } 22252226 settings.Icon.Label = settings.Label; 2227 <li class="pager__btn dw-mod"> 2228 @if (settings.IsActive) 2229 { 2230 <span class="pager__num pager__num--current dw-mod"> 2231 @Render(settings.Icon) 2232 </span> 2233 } 2234 else 2235 { 2236 <a href="@settings.Link" class="pager__num dw-mod"> 2237 @Render(settings.Icon) 2238 </a> 2239 } 2240 </li> 2241 } 224222432244 @using Dynamicweb.Rapido.Blocks.Components.General 2245 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 224622472248 @using Dynamicweb.Frontend 2249 @using System.Reflection 2250 @using Dynamicweb.Content.Items 2251 @using System.Web.UI.HtmlControls 2252 @using Dynamicweb.Rapido.Blocks.Components 2253 @using Dynamicweb.Rapido.Blocks 2254 @using Dynamicweb.Rapido.Blocks.Components.Articles 22552256 @* Components for the articles *@ 2257 @using System.Reflection 2258 @using Dynamicweb.Rapido.Blocks.Components.Articles 225922602261 @* Component for the articles *@ 22622263 @helper RenderArticleBanner(dynamic settings) { 2264 string filterClasses = "image-filter image-filter--darken"; 2265 settings.Layout = ArticleHeaderLayout.Banner; 22662267 if (settings.Image != null) 2268 { 2269 if (settings.Image.Path != null) 2270 { 2271 <section class="multiple-paragraphs-container u-color-light paragraph-container--full-width"> 2272 <div class="background-image @filterClasses dw-mod"> 2273 <div class="background-image__wrapper @filterClasses dw-mod"> 2274 @{ 2275 settings.Image.CssClass += "background-image__cover dw-mod"; 2276 } 2277 @Render(settings.Image) 2278 </div> 2279 </div> 2280 <div class="center-container dw-mod"> 2281 <div class="grid"> 2282 <div class="grid__col-md-8 grid__col-xs-12 paragraph-container paragraph-container--height-lg"> 2283 <div class="u-left-middle"> 2284 <div> 2285 @if (!String.IsNullOrEmpty(settings.Heading)) 2286 { 2287 <h1 class="article__header article__header--giant dw-mod" style="color: @settings.TextColor">@settings.Heading</h1> 2288 } 2289 @if (!String.IsNullOrEmpty(settings.Subheading)) 2290 { 2291 <div class="article__leadtext dw-mod" style="color: @settings.TextColor">@settings.Subheading</div> 2292 } 2293 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 2294 { 2295 <small class="article__post-info u-margin-bottom--lg dw-mod" style="color: @settings.TextColor">@settings.Author @settings.Date</small> 2296 } 2297 @if (!String.IsNullOrEmpty(settings.Link)) { 2298 <div class="grid__cell"> 2299 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 2300 </div> 2301 } 2302 </div> 2303 </div> 2304 </div> 2305 @if (settings.ExternalParagraphId != 0) 2306 { 2307 <div class="grid__col-md-4 grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-auto dw-mod"> 2308 <div class="u-color-light-gray--bg u-color-dark dw-mod"> 2309 @RenderParagraphContent(settings.ExternalParagraphId) 2310 </div> 2311 </div> 2312 } 23132314 </div> 2315 </div> 2316 </section> 2317 if (!String.IsNullOrEmpty(settings.Image.Caption)) { 2318 <div class="image-caption dw-mod">@settings.Image.Caption</div> 2319 } 2320 } 2321 else 2322 { 2323 settings.Layout = ArticleHeaderLayout.Clean; 2324 @RenderArticleCleanHeader(settings); 2325 } 2326 } 2327 else 2328 { 2329 settings.Layout = ArticleHeaderLayout.Clean; 2330 @RenderArticleCleanHeader(settings); 2331 } 2332 } 2333 @using System.Reflection 2334 @using Dynamicweb.Rapido.Blocks.Components 2335 @using Dynamicweb.Rapido.Blocks.Components.General 2336 @using Dynamicweb.Rapido.Blocks.Components.Articles 2337 @using Dynamicweb.Rapido.Blocks 233823392340 @* Component for the articles *@ 23412342 @helper RenderArticleHeader(ArticleHeader settings) { 2343 dynamic[] methodParameters = new dynamic[1]; 2344 methodParameters[0] = settings; 2345 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleHeaderCustom"); 23462347 if (customMethod != null) 2348 { 2349 @customMethod.Invoke(this, methodParameters).ToString(); 2350 } else { 2351 switch (settings.Layout) 2352 { 2353 case ArticleHeaderLayout.Clean: 2354 @RenderArticleCleanHeader(settings); 2355 break; 2356 case ArticleHeaderLayout.Split: 2357 @RenderArticleSplitHeader(settings); 2358 break; 2359 case ArticleHeaderLayout.Banner: 2360 @RenderArticleBannerHeader(settings); 2361 break; 2362 case ArticleHeaderLayout.Overlay: 2363 @RenderArticleOverlayHeader(settings); 2364 break; 2365 default: 2366 @RenderArticleCleanHeader(settings); 2367 break; 2368 } 2369 } 2370 } 23712372 @helper RenderArticleCleanHeader(ArticleHeader settings) { 2373 dynamic[] methodParameters = new dynamic[1]; 2374 methodParameters[0] = settings; 2375 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleCleanHeaderCustom"); 23762377 if (customMethod != null) 2378 { 2379 @customMethod.Invoke(this, methodParameters).ToString(); 2380 } 2381 else 2382 { 2383 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12"; 23842385 <div class="grid grid--align-content-start grid--justify-start"> 2386 <div class="grid__col-md-@contentColumns grid__col-sm-12 u-padding--lg dw-mod"> 2387 @if (!String.IsNullOrEmpty(settings.Category) || !String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date) || settings.RatingOutOf != 0) 2388 { 2389 <div class="u-border-bottom u-padding-bottom"> 2390 @if (!String.IsNullOrEmpty(settings.Category)) 2391 { 2392 <div class="u-pull--left"> 2393 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div> 2394 </div> 2395 } 2396 <div class="u-pull--right"> 2397 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 2398 { 2399 <small class="article__post-info dw-mod">@settings.Author @settings.Date</small> 2400 } 2401 @if (settings.RatingOutOf != 0) 2402 { 2403 @Render(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) 2404 } 2405 </div> 2406 </div> 2407 } 24082409 <div class="grid__cell"> 2410 @if (!String.IsNullOrEmpty(settings.Heading)) 2411 { 2412 <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1> 2413 } 2414 @if (settings.Image != null) 2415 { 2416 if (settings.Image.Path != null) 2417 { 2418 <div class="u-padding-bottom--lg"> 2419 @Render(settings.Image) 2420 </div> 2421 } 2422 } 2423 @if (!String.IsNullOrEmpty(settings.Subheading)) 2424 { 2425 <div class="article__leadtext dw-mod">@settings.Subheading</div> 2426 } 2427 @if (!String.IsNullOrEmpty(settings.Link)) 2428 { 2429 <div class="grid__cell"> 2430 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 2431 </div> 2432 } 2433 </div> 2434 </div> 2435 @if (settings.ExternalParagraphId != 0) 2436 { 2437 <div class="grid__col-md-4 grid__col-sm-12 u-padding--lg u-color-light-gray--bg dw-mod"> 2438 @RenderParagraphContent(settings.ExternalParagraphId) 2439 </div> 2440 } 2441 </div> 2442 } 2443 } 24442445 @helper RenderArticleSplitHeader(ArticleHeader settings) { 2446 dynamic[] methodParameters = new dynamic[1]; 2447 methodParameters[0] = settings; 2448 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSplitHeaderCustom"); 24492450 if (customMethod != null) 2451 { 2452 @customMethod.Invoke(this, methodParameters).ToString(); 2453 } 2454 else 2455 { 2456 string headerColumnWidth = settings.ExternalParagraphId != 0 ? "4" : "6"; 24572458 if (settings.Image != null) 2459 { 2460 if (settings.Image.Path != null) 2461 { 2462 <section class="multiple-paragraphs-container paragraph-container--full-width"> 2463 <div class="grid"> 2464 <div class="grid__col-md-@headerColumnWidth grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-xl dw-mod"> 2465 <div class="u-left-middle u-padding--lg"> 2466 <div> 2467 @if (!String.IsNullOrEmpty(settings.Category)) 2468 { 2469 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div> 2470 } 2471 @if (!String.IsNullOrEmpty(settings.Heading)) 2472 { 2473 <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1> 2474 } 2475 @if (!String.IsNullOrEmpty(settings.Subheading)) 2476 { 2477 <div class="article__leadtext dw-mod">@settings.Subheading</div> 2478 } 2479 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 2480 { 2481 <small class="article__post-info u-pull--left dw-mod">@settings.Author @settings.Date</small> 2482 } 2483 @if (settings.RatingOutOf != 0) 2484 { 2485 <div class="u-pull--right"> 2486 @Render(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) 2487 </div> 2488 } 2489 @if (!String.IsNullOrEmpty(settings.Link)) { 2490 <div class="u-full-width u-pull--left u-margin-top"> 2491 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 2492 </div> 2493 } 2494 </div> 2495 </div> 2496 </div> 2497 <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> 2498 @if (settings.ExternalParagraphId != 0) 2499 { 2500 <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"> 2501 @RenderParagraphContent(settings.ExternalParagraphId) 2502 </div> 2503 } 2504 </div> 2505 </section> 2506 } 2507 } 2508 else 2509 { 2510 @RenderArticleCleanHeader(settings); 2511 } 2512 } 2513 } 25142515 @helper RenderArticleOverlayHeader(ArticleHeader settings) { 2516 dynamic[] methodParameters = new dynamic[1]; 2517 methodParameters[0] = settings; 2518 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleOverlayHeaderCustom"); 25192520 if (customMethod != null) 2521 { 2522 @customMethod.Invoke(this, methodParameters).ToString(); 2523 } 2524 else 2525 { 2526 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12"; 2527 string contentAlignment = settings.TextLayout == ArticleHeaderTextLayout.Center ? "grid--justify-center" : ""; 25282529 if (settings.Image != null) 2530 { 2531 if (settings.Image.Path != null) 2532 { 2533 if (settings.ExternalParagraphId == 0) 2534 { 2535 <section class="multiple-paragraphs-container u-color-light paragraph-container--full-width"> 2536 <div class="background-image image-filter image-filter--darken dw-mod"> 2537 <div class="background-image__wrapper image-filter image-filter--darken dw-mod"> 2538 @{ 2539 settings.Image.CssClass += "background-image__cover dw-mod"; 2540 } 2541 @Render(settings.Image) 2542 </div> 2543 </div> 2544 <div class="center-container dw-mod"> 2545 <div class="grid @contentAlignment"> 2546 <div class="grid__col-md-@contentColumns grid__col-xs-12 paragraph-container paragraph-container--height-xl dw-mod"> 2547 @if (!string.IsNullOrEmpty(settings.Heading)) 2548 { 2549 <h1 class="article__header article__header--giant u-padding-top--lg dw-mod" style="color: @settings.TextColor">@settings.Heading</h1> 2550 } 2551 @if (!String.IsNullOrEmpty(settings.Subheading)) 2552 { 2553 <div class="article__leadtext dw-mod" style="color: @settings.TextColor">@settings.Subheading</div> 2554 } 2555 <div class="u-margin-top"> 2556 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 2557 { 2558 <small class="article__post-info u-pull--left dw-mod" style="color: @settings.TextColor">@settings.Author @settings.Date</small> 2559 } 2560 @if (settings.RatingOutOf != 0) 2561 { 2562 <div class="u-pull--right"> 2563 @Render(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) 2564 </div> 2565 } 2566 </div> 2567 @if (!String.IsNullOrEmpty(settings.Link)) 2568 { 2569 <div class="grid__cell"> 2570 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 2571 </div> 2572 } 2573 </div> 2574 </div> 2575 </div> 2576 </section> 2577 } 2578 else 2579 { 2580 @RenderArticleBanner(settings); 2581 } 2582 } 2583 } 2584 else 2585 { 2586 @RenderArticleCleanHeader(settings); 2587 } 2588 } 2589 } 25902591 @helper RenderArticleBannerHeader(dynamic settings) { 2592 dynamic[] methodParameters = new dynamic[1]; 2593 methodParameters[0] = settings; 2594 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleBannerHeaderCustom"); 25952596 if (customMethod != null) 2597 { 2598 @customMethod.Invoke(this, methodParameters).ToString(); 2599 } 2600 else 2601 { 2602 @RenderArticleBanner(settings); 2603 } 2604 } 2605 @using System.Reflection 2606 @using System.Text.RegularExpressions; 2607 @using Dynamicweb.Frontend 2608 @using Dynamicweb.Content.Items 2609 @using Dynamicweb.Rapido.Blocks.Components 2610 @using Dynamicweb.Rapido.Blocks.Components.Articles 2611 @using Dynamicweb.Rapido.Blocks 26122613 @* Component for the articles *@ 26142615 @helper RenderArticleBodyRow(ArticleBodyRow settings) 2616 { 2617 string position = settings.TopLayout == "overlay" ? "article__overlay-offset" : ""; 2618 string contentAlignment = settings.TextLayout == "center" ? "grid--justify-center" : ""; 26192620 <div class="grid grid--align-content-start @contentAlignment @position dw-mod"> 2621 @RenderBlockList(settings.SubBlocks) 2622 </div> 2623 } 2624 @using System.Reflection 2625 @using Dynamicweb.Rapido.Blocks.Components 2626 @using Dynamicweb.Rapido.Blocks.Components.General 2627 @using Dynamicweb.Rapido.Blocks.Components.Articles 2628 @using Dynamicweb.Rapido.Blocks 26292630 @* Component for the articles *@ 26312632 @helper RenderArticleImage(ArticleImage settings) 2633 { 2634 if (settings.Image != null) 2635 { 2636 if (settings.Image.Path != null) 2637 { 2638 <div class="u-margin-bottom--lg"> 2639 @Render(settings.Image) 2640 </div> 2641 } 2642 } 2643 } 2644 @using System.Reflection 2645 @using Dynamicweb.Rapido.Blocks.Components 2646 @using Dynamicweb.Rapido.Blocks.Components.Articles 264726482649 @* Component for the articles *@ 26502651 @helper RenderArticleSubHeader(ArticleSubHeader settings) 2652 { 2653 if (!String.IsNullOrEmpty(settings.Title)) 2654 { 2655 <h2 class="article__header">@settings.Title</h2> 2656 } 2657 } 2658 @using System.Reflection 2659 @using Dynamicweb.Rapido.Blocks.Components 2660 @using Dynamicweb.Rapido.Blocks.Components.Articles 2661 @using Dynamicweb.Rapido.Blocks 266226632664 @* Component for the articles *@ 26652666 @helper RenderArticleText(ArticleText settings) 2667 { 2668 if (!String.IsNullOrEmpty(settings.Text)) 2669 { 2670 string greatTextClass = settings.EnableLargeText == true ? "article__paragraph--great-text" : ""; 26712672 <div class="article__paragraph @greatTextClass dw-mod"> 2673 @settings.Text 2674 </div> 2675 } 2676 } 2677 @using System.Reflection 2678 @using Dynamicweb.Rapido.Blocks.Components 2679 @using Dynamicweb.Rapido.Blocks.Components.Articles 2680 @using Dynamicweb.Rapido.Blocks 268126822683 @* Component for the articles *@ 26842685 @helper RenderArticleQuote(ArticleQuote settings) 2686 { 2687 string text = Regex.Replace(settings.Text, "<.*?>", String.Empty); 26882689 <div class="grid u-padding-bottom--lg"> 2690 @if (settings.Image != null) 2691 { 2692 if (settings.Image.Path != null) { 2693 <div class="grid__col-3"> 2694 <div class="grid__cell-img"> 2695 @{ 2696 settings.Image.Title = !String.IsNullOrEmpty(settings.Image.Title) ? settings.Image.Title : settings.Author; 2697 settings.Image.CssClass += " article__image article__image--ball"; 2698 settings.Image.ImageDefault.Width = 200; 2699 settings.Image.ImageDefault.Height = 200; 2700 } 2701 @Render(settings.Image) 2702 </div> 2703 </div> 2704 } 2705 } 2706 <div class="grid__col-auto"> 2707 @if (!String.IsNullOrEmpty(settings.Text)) 2708 { 2709 <div class="article__quote dw-mod"> 2710 <i class="fas fa-quote-right u-margin-bottom--lg"></i> 2711 @settings.Text 2712 <i class="fas fa-quote-right"></i> 2713 </div> 2714 } 2715 @if (!String.IsNullOrEmpty(settings.Author)) 2716 { 2717 <div class="article__quote-author dw-mod"> 2718 - @settings.Author 2719 </div> 2720 } 2721 </div> 2722 </div> 2723 } 2724 @using System.Reflection 2725 @using Dynamicweb.Rapido.Blocks.Components 2726 @using Dynamicweb.Rapido.Blocks.Components.Articles 2727 @using Dynamicweb.Rapido.Blocks 27282729 @* Component for the articles *@ 27302731 @helper RenderArticleInfoTable(ArticleInfoTable settings) 2732 { 2733 <table class="table table--clean"> 2734 @foreach (var row in settings.Rows) 2735 { 2736 string iconColor = row.IconColor != null ? row.IconColor : "u-brand-color-two"; 27372738 <tr> 2739 @if (!String.IsNullOrEmpty(row.Icon)) 2740 { 2741 <td class="u-w32px"><i class="@row.Icon fa-2x @row.IconColor"></i></td> 2742 } 2743 <td class="u-no-margin-on-p-elements"> 2744 <div class="u-bold">@row.Title</div> 2745 @if (!String.IsNullOrEmpty(row.SubTitle)) 2746 { 2747 if (row.Link == null) 2748 { 2749 <div>@row.SubTitle</div> 2750 } 2751 else 2752 { 2753 <a href="@row.Link" class="u-color-inherit">@row.SubTitle</a> 2754 } 2755 } 2756 </td> 2757 </tr> 2758 } 2759 </table> 2760 } 2761 @using System.Reflection 2762 @using Dynamicweb.Rapido.Blocks.Components 2763 @using Dynamicweb.Rapido.Blocks.Components.General 2764 @using Dynamicweb.Rapido.Blocks.Components.Articles 2765 @using Dynamicweb.Rapido.Blocks 27662767 @* Component for the articles *@ 27682769 @helper RenderArticleGalleryModal(ArticleGalleryModal settings) 2770 { 2771 Modal galleryModal = new Modal 2772 { 2773 Id = "ParagraphGallery", 2774 Width = ModalWidth.Full, 2775 BodyTemplate = RenderArticleGalleryModalContent() 2776 }; 27772778 @Render(galleryModal) 2779 } 27802781 @helper RenderArticleGalleryModalContent() { 2782 <div class="modal__image-min-size-wrapper"> 2783 @Render(new Image { 2784 Id = "ParagraphGallery", 2785 Path = "#", 2786 CssClass = "modal--full__img", 2787 DisableLazyLoad = true, 2788 DisableImageEngine = true 2789 }) 2790 </div> 27912792 <div class="modal__images-counter" id="ParagraphGallery_counter"></div> 27932794 @Render(new Button { 2795 Id = "ParagraphGallery_prev", 2796 ButtonType = ButtonType.Button, 2797 ButtonLayout = ButtonLayout.None, 2798 CssClass = "modal__prev-btn", 2799 Icon = new Icon { Prefix = "far", Name = "fa-angle-left", LabelPosition = IconLabelPosition.After }, 2800 OnClick = "Gallery.prevImage('ParagraphGallery')" 2801 }) 28022803 @Render(new Button { 2804 Id = "ParagraphGallery_next", 2805 ButtonType = ButtonType.Button, 2806 ButtonLayout = ButtonLayout.None, 2807 CssClass = "modal__next-btn", 2808 Icon = new Icon { Prefix = "far", Name = "fa-angle-right", LabelPosition = IconLabelPosition.After }, 2809 OnClick = "Gallery.nextImage('ParagraphGallery')" 2810 }) 2811 } 2812 @using System.Reflection 2813 @using Dynamicweb.Rapido.Blocks.Components 2814 @using Dynamicweb.Rapido.Blocks.Components.Articles 2815 @using Dynamicweb.Rapido.Blocks 281628172818 @* Component for the articles *@ 28192820 @helper RenderArticleRelated(ArticleRelated settings) 2821 { 2822 string cardClass = Pageview.Device.ToString() != "Tablet" ? "card u-color-light--bg u-full-height" : ""; 2823 string cardFooterClass = Pageview.Device.ToString() != "Tablet" ? "card-footer u-color-light--bg" : ""; 28242825 <section class="multiple-paragraphs-container u-color-light-gray--bg paragraph-container--full-width"> 2826 <div class="center-container dw-mod"> 2827 <div class="grid u-padding"> 2828 <div class="grid__col-md-12 grid__col-xs-12"> 2829 <h2 class="article__header u-no-margin u-margin-top">@settings.Title</h2> 2830 </div> 2831 </div> 28322833 <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> 28342835 <script id="RelatedSimpleTemplate" type="text/x-template"> 2836 {{#.}} 2837 <div class="grid u-padding-bottom--lg"> 2838 {{#Cases}} 2839 <div class="grid__col-lg-3 grid__col-sm-6 image-hover--zoom dw-mod"> 2840 <a href="{{link}}" class="u-full-height u-color-light--bg u-flex u-flex--column"> 2841 {{#if image}} 2842 <div class="u-color-light--bg u-no-padding dw-mod"> 2843 <div class="flex-img image-hover__wrapper"> 2844 <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}}" /> 2845 </div> 2846 </div> 2847 {{/if}} 28482849 <div class="card u-color-light--bg u-full-height dw-mod"> 2850 <h3 class="article-list__item-header u-truncate-text dw-mod">{{title}}</h3> 2851 <p class="article__short-summary dw-mod">{{summary}}</p> 2852 </div> 2853 </a> 2854 </div> 2855 {{/Cases}} 2856 </div> 2857 {{/.}} 2858 </script> 2859 </div> 2860 </section> 2861 } 2862 @using System.Reflection 2863 @using Dynamicweb.Rapido.Blocks.Components 2864 @using Dynamicweb.Rapido.Blocks.Components.Articles 2865 @using Dynamicweb.Rapido.Blocks 286628672868 @* Component for the articles *@ 28692870 @helper RenderArticleMenu(ArticleMenu settings) 2871 { 2872 if (!String.IsNullOrEmpty(settings.Title)) { 2873 <div class="u-margin u-border-bottom"> 2874 <h3 class="u-no-margin">@settings.Title</h3> 2875 </div> 2876 } 28772878 <ul class="menu-left u-margin-bottom dw-mod"> 2879 @foreach (var item in settings.Items) 2880 { 2881 @Render(item) 2882 } 2883 </ul> 2884 } 28852886 @helper RenderArticleMenuItem(ArticleMenuItem settings) 2887 { 2888 string link = !String.IsNullOrEmpty(settings.Link) ? settings.Link : "#"; 28892890 if (!String.IsNullOrEmpty(settings.Title)) { 2891 <li class="menu-left__item dw-mod"> 2892 <a href="@link" onclick="@settings.OnClick" class="menu-left__link dw-mod">@settings.Title</a> 2893 </li> 2894 } 2895 } 2896 @using System.Reflection 2897 @using Dynamicweb.Rapido.Blocks.Components 2898 @using Dynamicweb.Rapido.Blocks.Components.Articles 2899 @using Dynamicweb.Rapido.Blocks 29002901 @* Component for the articles *@ 29022903 @helper RenderArticleList(ArticleList settings) 2904 { 2905 if (Pageview != null) 2906 { 2907 bool isParagraph = Pageview.CurrentParagraph != null ? true : false; 2908 string[] sortArticlesListBy = new string[2]; 29092910 if (isParagraph) { 2911 sortArticlesListBy = Pageview.CurrentParagraph.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString()) ? Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" }; 2912 } 2913 else { 2914 sortArticlesListBy = Pageview.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.Item["SortArticlesListBy"].ToString()) ? Pageview.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" }; 2915 } 29162917 string sourcePage = settings.SourcePage != null ? settings.SourcePage : Pageview.ID.ToString(); 29182919 if (!settings.DisablePagination) { 2920 @RenderItemList(new 2921 { 2922 ItemType = !String.IsNullOrEmpty(settings.ItemType) ? settings.ItemType : "DynamicArticle", 2923 ListSourceType = settings.SourceType, 2924 ListSourcePage = sourcePage, 2925 ItemFieldsList = "*", 2926 Filter = settings.Filter, 2927 ListOrderBy = sortArticlesListBy[0], 2928 ListOrderByDirection = sortArticlesListBy[1], 2929 ListSecondOrderBy = sortArticlesListBy[0] == "Date" ? "InFocusSortId" : "Date", 2930 ListSecondOrderByDirection = "ASC", 2931 IncludeAllChildItems = true, 2932 ListTemplate = settings.Template, 2933 ListPageSize = settings.PageSize.ToString() 2934 }); 2935 } else { 2936 @RenderItemList(new 2937 { 2938 ItemType = !String.IsNullOrEmpty(settings.ItemType) ? settings.ItemType : "DynamicArticle", 2939 ListSourceType = settings.SourceType, 2940 ListSourcePage = sourcePage, 2941 ItemFieldsList = "*", 2942 Filter = settings.Filter, 2943 ListOrderBy = sortArticlesListBy[0], 2944 ListOrderByDirection = sortArticlesListBy[1], 2945 ListSecondOrderBy = sortArticlesListBy[0] == "Date" ? "InFocusSortId" : "Date", 2946 ListSecondOrderByDirection = "ASC", 2947 IncludeAllChildItems = true, 2948 ListTemplate = settings.Template, 2949 ListPageSize = settings.PageSize.ToString(), 2950 ListViewMode = "Partial", 2951 ListShowTo = settings.PageSize + 1 2952 }); 2953 } 2954 } 2955 } 2956 @using System.Reflection 2957 @using Dynamicweb.Rapido.Blocks.Components.Articles 295829592960 @* Component for the articles *@ 29612962 @helper RenderArticleSummary(ArticleSummary settings) 2963 { 2964 if (!String.IsNullOrEmpty(settings.Text)) 2965 { 2966 <div class="article__summary dw-mod">@settings.Text</div> 2967 } 2968 } 2969 @using System.Reflection 2970 @using Dynamicweb.Rapido.Blocks.Components 2971 @using Dynamicweb.Rapido.Blocks.Components.Articles 2972 @using Dynamicweb.Rapido.Blocks 29732974 @* Component for the articles *@ 29752976 @helper RenderArticleListCategoryFilter(ArticleListCategoryFilter settings) 2977 { 2978 string pageId = Pageview.ID.ToString(); 2979 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("sourcePage")) ? HttpContext.Current.Request.QueryString.Get("sourcePage") : Translate("All"); 2980 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString()); 29812982 foreach (var option in settings.Categories) 2983 { 2984 selectedFilter = selectedFilter == option.Value ? option.Key : selectedFilter; 2985 } 29862987 if (selectedFilter == pageId) 2988 { 2989 selectedFilter = Translate("All"); 2990 } 29912992 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 2993 { 2994 <div class="u-pull--right u-margin-left"> 2995 <div class="collection u-no-margin"> 2996 <h5>@Translate("Category")</h5> 2997 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" /> 2998 <div class="dropdown u-w180px dw-mod"> 2999 <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label> 3000 <div class="dropdown__content dw-mod"> 3001 @foreach (var option in settings.Categories) 3002 { 3003 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div> 3004 } 3005 </div> 3006 <label class="dropdown-trigger-off" for="CategorySelector"></label> 3007 </div> 3008 </div> 3009 </div> 3010 } 3011 else 3012 { 3013 <div class="u-full-width u-margin-bottom"> 3014 <h5 class="u-no-margin">@Translate("Category")</h5> 3015 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" /> 3016 <div class="dropdown u-full-width dw-mod"> 3017 <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label> 3018 <div class="dropdown__content dw-mod"> 3019 @foreach (var option in settings.Categories) 3020 { 3021 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div> 3022 } 3023 </div> 3024 <label class="dropdown-trigger-off" for="CategorySelector"></label> 3025 </div> 3026 </div> 3027 } 3028 } 3029 @using System.Reflection 3030 @using Dynamicweb.Rapido.Blocks.Components 3031 @using Dynamicweb.Rapido.Blocks.Components.Articles 3032 @using Dynamicweb.Rapido.Blocks 3033 @using System.Collections.Generic 30343035 @* Component for the articles *@ 30363037 @helper RenderArticleListFilter(ArticleListFilter settings) 3038 { 3039 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get(settings.SystemName)) ? HttpContext.Current.Request.QueryString.Get(settings.SystemName) : Translate("All"); 3040 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString()); 30413042 if (settings.Options != null) 3043 { 3044 if (settings.Options is IEnumerable<dynamic>) 3045 { 3046 var options = (IEnumerable<dynamic>) settings.Options; 3047 settings.Options = options.OrderBy(item => item.Name); 3048 } 30493050 foreach (var option in settings.Options) 3051 { 3052 selectedFilter = selectedFilter == option.Value ? option.Name : selectedFilter; 3053 } 30543055 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 3056 { 3057 <div class="u-pull--right u-margin-left"> 3058 <div class="collection u-no-margin"> 3059 <h5>@settings.Label</h5> 3060 <input type="checkbox" id="@(settings.SystemName)Selector" class="dropdown-trigger" /> 3061 <div class="dropdown u-w180px dw-mod"> 3062 <label class="dropdown__header dropdown__btn dw-mod" for="@(settings.SystemName)Selector">@Translate(selectedFilter)</label> 3063 <div class="dropdown__content dw-mod"> 3064 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')">@Translate("All")</div> 3065 @foreach (var option in settings.Options) 3066 { 3067 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')">@Translate(option.Name)</div> 3068 } 3069 </div> 3070 <label class="dropdown-trigger-off" for="@(settings.SystemName)Selector"></label> 3071 </div> 3072 </div> 3073 </div> 3074 } 3075 else 3076 { 3077 <div class="u-full-width u-margin-bottom"> 3078 <h5 class="u-no-margin">@settings.Label</h5> 3079 <input type="checkbox" id="@(settings.SystemName)Selector" class="dropdown-trigger" /> 3080 <div class="dropdown u-full-width w-mod"> 3081 <label class="dropdown__header dropdown__btn dw-mod" for="@(settings.SystemName)Selector">@Translate(selectedFilter)</label> 3082 <div class="dropdown__content dw-mod"> 3083 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')">@Translate("All")</div> 3084 @foreach (var option in settings.Options) 3085 { 3086 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')">@Translate(option.Name)</div> 3087 } 3088 </div> 3089 <label class="dropdown-trigger-off" for="@(settings.SystemName)Selector"></label> 3090 </div> 3091 </div> 3092 } 3093 } 3094 } 3095 @using System.Reflection 3096 @using Dynamicweb.Rapido.Blocks.Components 3097 @using Dynamicweb.Rapido.Blocks.Components.Articles 3098 @using Dynamicweb.Rapido.Blocks 30993100 @* Component for the articles *@ 31013102 @helper RenderArticleListSearch(ArticleListSearch settings) 3103 { 3104 string searchParameter = !string.IsNullOrEmpty(settings.SearchParameter) ? settings.SearchParameter : "Title"; 3105 string searchWord = HttpContext.Current.Request.QueryString.Get(searchParameter); 3106 string searchString = !string.IsNullOrEmpty(searchWord) ? searchWord.Trim('*') : ""; 3107 string className = "u-w340px u-pull--right u-margin-left"; 31083109 if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet") 3110 { 3111 className = "u-full-width"; 3112 } 31133114 <div class="typeahead u-color-inherit u-margin-bottom dw-mod @className"> 3115 <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 + '*')"> 3116 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod"><i class="fas fa-search"></i></button> 3117 </div> 3118 } 3119 @using System.Reflection 3120 @using Dynamicweb.Rapido.Blocks.Components 3121 @using Dynamicweb.Rapido.Blocks.Components.Articles 3122 @using Dynamicweb.Rapido.Blocks 31233124 @* Component for the articles *@ 31253126 @helper RenderArticleListNoResultsInfo(ArticleListNoResultsInfo settings) 3127 { 3128 <div class="u-margin-top--lg u-bold u-ta-center u-bold">@Translate(settings.Message)</div> 3129 } 3130 @using System.Reflection 3131 @using Dynamicweb.Rapido.Blocks.Components 3132 @using Dynamicweb.Rapido.Blocks.Components.General 3133 @using Dynamicweb.Rapido.Blocks.Components.Articles 3134 @using Dynamicweb.Rapido.Blocks 3135 @using System.Text.RegularExpressions 31363137 @* Component for the articles *@ 31383139 @helper RenderArticleListItem(ArticleListItem settings) 3140 { 3141 switch (settings.Type) { 3142 case ArticleListItemType.Card: 3143 @RenderArticleListItemCard(settings); 3144 break; 3145 case ArticleListItemType.List: 3146 @RenderArticleListItemList(settings); 3147 break; 3148 case ArticleListItemType.Simple: 3149 @RenderArticleListItemSimple(settings); 3150 break; 3151 default: 3152 @RenderArticleListItemCard(settings); 3153 break; 3154 } 3155 } 31563157 @helper RenderArticleListItemCard(ArticleListItem settings) { 3158 <a href="@settings.Link" class="u-full-height u-color-light--bg u-flex u-flex--column"> 3159 <div class="u-color-light--bg u-no-padding dw-mod"> 3160 @if (settings.Logo != null) 3161 { 3162 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;" : ""; 3163 settings.Logo.ImageDefault.Crop = 5; 3164 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width; 3165 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height; 3166 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage"> 3167 @if (settings.Stickers != null) 3168 { 3169 if (settings.Stickers.Position != StickersListPosition.Custom && settings.Stickers.Position != StickersListPosition.None) 3170 { 3171 @Render(settings.Stickers); 3172 } 3173 } 3174 @RenderImage(settings.Logo) 3175 </div> 3176 } else if (settings.Image != null) 3177 { 3178 <div class="flex-img image-hover__wrapper u-position-relative dw-mod"> 3179 @if (settings.Stickers != null) 3180 { 3181 if (settings.Stickers.Position != StickersListPosition.Custom && settings.Stickers.Position != StickersListPosition.None) 3182 { 3183 @Render(settings.Stickers); 3184 } 3185 } 3186 @Render(settings.Image) 3187 </div> 3188 } 3189 </div> 31903191 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary)) 3192 { 3193 <div class="card u-color-light--bg u-full-height dw-mod"> 3194 @if (settings.Stickers != null) 3195 { 3196 if (settings.Stickers.Position == StickersListPosition.Custom) 3197 { 3198 @Render(settings.Stickers); 3199 } 3200 } 3201 @if (!String.IsNullOrEmpty(settings.Title)) 3202 { 3203 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3> 3204 } 3205 @if (!String.IsNullOrEmpty(settings.SubTitle)) 3206 { 3207 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 3208 } 3209 @if (!String.IsNullOrEmpty(settings.Summary)) 3210 { 3211 <p class="article__short-summary dw-mod">@settings.Summary</p> 3212 } 3213 </div> 3214 } 3215 </a> 3216 } 32173218 @helper RenderArticleListItemList(ArticleListItem settings) { 3219 <a href="@settings.Link"> 3220 <div class="grid u-color-light--bg u-no-padding dw-mod"> 3221 <div class="grid__col-md-3"> 3222 <div class="u-color-light--bg u-no-padding dw-mod"> 3223 @if (settings.Logo != null) 3224 { 3225 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;" : ""; 3226 settings.Logo.ImageDefault.Crop = 5; 3227 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width; 3228 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height; 3229 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage"> 3230 @if (settings.Stickers != null) 3231 { 3232 if (settings.Stickers.Position != StickersListPosition.Custom) 3233 { 3234 @Render(settings.Stickers); 3235 } 3236 } 3237 @RenderImage(settings.Logo) 3238 </div> 3239 } else if (settings.Image != null) 3240 { 3241 <div class="flex-img image-hover__wrapper dw-mod"> 3242 @if (settings.Stickers != null) 3243 { 3244 if (settings.Stickers.Position != StickersListPosition.Custom) 3245 { 3246 @Render(settings.Stickers); 3247 } 3248 } 3249 @Render(settings.Image) 3250 </div> 3251 } 3252 </div> 3253 </div> 32543255 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary)) 3256 { 3257 <div class="grid__col-md-9"> 3258 @if (!String.IsNullOrEmpty(settings.Title)) 3259 { 3260 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3> 3261 } 3262 @if (settings.Stickers != null) 3263 { 3264 if (settings.Stickers.Position == StickersListPosition.Custom) 3265 { 3266 @Render(settings.Stickers); 3267 } 3268 } 3269 @if (!String.IsNullOrEmpty(settings.SubTitle)) 3270 { 3271 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 3272 } 3273 @if (!String.IsNullOrEmpty(settings.Summary)) 3274 { 3275 <p class="article__short-summary dw-mod">@settings.Summary</p> 3276 } 3277 </div> 3278 } 3279 </div> 3280 </a> 3281 } 32823283 @helper RenderArticleListItemSimple(ArticleListItem settings) { 3284 <a href="@settings.Link" class="u-color-inherit"> 3285 <div class="grid u-color-light--bg u-no-padding dw-mod"> 3286 <div class="grid__col-md-12"> 3287 @if (!String.IsNullOrEmpty(settings.Title)) 3288 { 3289 <div class="article-list-item__header u-truncate-text u-no-margin dw-mod">@settings.Title</div> 3290 } 3291 @if (!String.IsNullOrEmpty(settings.SubTitle)) 3292 { 3293 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 3294 } 3295 </div> 3296 </div> 3297 </a> 3298 } 3299 @using System.Reflection 3300 @using Dynamicweb.Rapido.Blocks.Components.Articles 330133023303 @* Component for the articles *@ 33043305 @helper RenderArticleAuthorAndDate(ArticleAuthorAndDate settings) 3306 { 3307 <small class="article__subscription"> 3308 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date))) 3309 { 3310 <text>@Translate("Written")</text> 3311 } 3312 @if (!string.IsNullOrWhiteSpace(settings.Author)) 3313 { 3314 <text>@Translate("by") @settings.Author</text> 3315 } 3316 @if (!string.IsNullOrWhiteSpace(settings.Date)) 3317 { 3318 <text>@Translate("on") @settings.Date</text> 3319 } 3320 </small> 3321 } 3322 @using System.Reflection 3323 @using Dynamicweb.Rapido.Blocks.Components.Articles 3324 @using Dynamicweb.Rapido.Blocks.Components.General 332533263327 @* Component for the articles *@ 33283329 @helper RenderArticleLink(ArticleLink settings) 3330 { 3331 if (!string.IsNullOrEmpty(settings.Title)) 3332 { 3333 Button link = new Button { 3334 ConfirmText = settings.ConfirmText, 3335 ConfirmTitle = settings.ConfirmTitle, 3336 ButtonType = settings.ButtonType, 3337 Id = settings.Id, 3338 Title = settings.Title, 3339 AltText = settings.AltText, 3340 OnClick = settings.OnClick, 3341 CssClass = settings.CssClass, 3342 Disabled = settings.Disabled, 3343 Icon = settings.Icon, 3344 Name = settings.Name, 3345 Href = settings.Href, 3346 ButtonLayout = settings.ButtonLayout, 3347 ExtraAttributes = settings.ExtraAttributes 3348 }; 3349 <div class="grid__cell"> 3350 @Render(link) 3351 </div> 3352 } 3353 } 3354 @using System.Reflection 3355 @using Dynamicweb.Rapido.Blocks 3356 @using Dynamicweb.Rapido.Blocks.Components.Articles 3357 @using Dynamicweb.Rapido.Blocks.Components.General 335833593360 @* Component for the articles *@ 33613362 @helper RenderArticleCarousel(ArticleCarousel settings) 3363 { 3364 <div class="grid"> 3365 <div class="grid__col-12 u-no-padding u-margin-bottom"> 3366 <div class="carousel" id="carousel_@settings.Id"> 3367 <div class="carousel__container js-carousel-slides dw-mod"> 3368 @RenderBlockList(settings.SubBlocks) 3369 </div> 3370 </div> 3371 </div> 3372 </div> 33733374 <script> 3375 document.addEventListener("DOMContentLoaded", function () { 3376 new CarouselModule("#carousel_@settings.Id", { 3377 slideTime: 0, 3378 dots: true 3379 }); 3380 }); 3381 </script> 3382 } 33833384 @helper RenderArticleCarouselSlide(ArticleCarouselSlide settings) 3385 { 3386 string imageEngine = "/Admin/Public/GetImage.ashx?"; 33873388 string defaultImage = settings.ImageSettings != null ? imageEngine : settings.Image; 3389 if (settings.ImageSettings != null) 3390 { 3391 defaultImage += settings.ImageSettings.Width != 0 ? "Width=" + settings.ImageSettings.Width + "&" : ""; 3392 defaultImage += settings.ImageSettings.Height != 0 ? "Height=" + settings.ImageSettings.Height + "&" : ""; 3393 defaultImage += "Crop=" + settings.ImageSettings.Crop + "&"; 3394 defaultImage += "Compression=" + settings.ImageSettings.Compression + "&"; 3395 defaultImage += "DoNotUpscale=" + settings.ImageSettings.DoNotUpscale.ToString() + "&"; 3396 defaultImage += "FillCanvas=" + settings.ImageSettings.FillCanvas.ToString() + "&"; 3397 } 3398 defaultImage += "&Image=" + settings.Image; 33993400 <div class="carousel__slide u-min-h300px u-flex dw-mod" style="background-size:cover; background-image:url('@defaultImage')"> 3401 <a class="article-carousel-item__wrap" href="@settings.Link" title="@settings.Title"> 3402 <h2 class="article-list__item-header u-truncate-text u-color-light dw-mod">@settings.Title</h2> 3403 <div class="article-list__item-info"> 3404 @if (settings.Stickers != null) 3405 { 3406 settings.Stickers.Position = StickersListPosition.Custom; 3407 @Render(settings.Stickers); 3408 } 34093410 <small class="u-margin-top--lg u-color-light"> 3411 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date))) 3412 { 3413 <text>@Translate("Written")</text> 3414 } 3415 @if (!string.IsNullOrWhiteSpace(settings.Author)) 3416 { 3417 <text>@Translate("by") @settings.Author</text> 3418 } 3419 @if (!string.IsNullOrWhiteSpace(settings.Date)) 3420 { 3421 <text>@Translate("on") @settings.Date</text> 3422 } 3423 </small> 3424 </div> 34253426 <h3 class="article__short-summary u-color-light">@settings.Summary</h3> 3427 </a> 3428 @if (settings.UseFilters == true) 3429 { 3430 <div class="background-image image-filter image-filter--darken dw-mod"></div> 3431 } 3432 </div> 3433 } 3434 @using System.Text.RegularExpressions 3435 @using Dynamicweb.Rapido.Blocks.Components 3436 @using Dynamicweb.Rapido.Blocks.Components.General 3437 @using Dynamicweb.Rapido.Blocks.Components.Articles 3438 @using Dynamicweb.Rapido.Blocks 34393440 @* Component for the articles *@ 34413442 @helper RenderArticleVideo(ArticleVideo settings) 3443 { 3444 if (settings.Url != null) 3445 { 3446 //getting video ID from youtube URL 3447 string videoCode = settings.Url; 3448 Regex regex = new Regex(@".be\/(.[^?]*)"); 3449 Match match = regex.Match(videoCode); 3450 string videoId = ""; 3451 if (match.Success) 3452 { 3453 videoId = match.Groups[1].Value; 3454 } 3455 else 3456 { 3457 regex = new Regex(@"v=([^&]+)"); 3458 match = regex.Match(videoCode); 3459 if (match.Success) 3460 { 3461 videoId = match.Groups[1].Value; 3462 } 3463 } 34643465 int autoPlay = settings.AutoPlay == "true" ? 1 : 0; 34663467 <div class="video-wrapper"> 3468 <div class="js-youtube-video" data-video="@videoId" id="ytPlayer@(Guid.NewGuid().ToString("N"))" data-auto-play="@autoPlay" data-enable-controls="1"></div> 3469 </div> 3470 } 3471 } 3472347334743475 @* Simple helpers *@ 34763477 @*Requires the Gallery ItemType that comes with Rapido*@ 3478 @helper RenderArticleItemGallery(IList<ItemViewModel> gallery) { 3479 if (gallery != null && gallery.Count > 0) 3480 { 3481 int count = 1; 34823483 foreach (var item in gallery) 3484 { 3485 if (item.GetFile("ImagePath") != null) 3486 { 3487 string image = item.GetFile("ImagePath").PathUrlEncoded; 3488 string imagePrefix = "/Admin/Public/GetImage.ashx?width=1200&amp;height=820&amp;crop=5&amp;Compression=75&amp;DoNotUpscale=1&amp;image="; 3489 int imagesCount = gallery.Count; 34903491 if (count == 1) 3492 { 3493 <label class="gallery" for="ParagraphGalleryModalTrigger" onclick="Gallery.openImage(this.querySelector('.js-gallery'))"> 3494 <span class="gallery__main-image"> 3495 <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" /> 3496 </span> 3497 <span class="gallery__image-counter"> 3498 <i class="fas fa-camera fa-2x"></i> <span class="gallery__image-counter__number">@imagesCount</span> 3499 <span class="gallery__image-counter__text">@Translate("See all") <i class="fas fa-angle-right"></i></span> 3500 </span> 3501 </label> 3502 } 3503 else 3504 { 3505 <div class="u-hidden js-gallery" data-for="ParagraphGallery" data-image="@imagePrefix@image"></div> 3506 } 35073508 count++; 3509 } 3510 } 35113512 @Render(new ArticleGalleryModal()) 3513 } 3514 } 35153516 @helper RenderMobileFilters(List<Block> subBlocks) 3517 { 3518 if (subBlocks.Count > 0) 3519 { 3520 <div class="grid__col-12"> 3521 <input type="checkbox" id="CheckFilters" class="js-remember-state u-hidden" data-expand="CheckFilters" /> 3522 <div class="grid u-margin-bottom dw-mod" data-trigger="CheckFilters"> 3523 @RenderBlockList(subBlocks) 3524 </div> 3525 <label for="CheckFilters" class="btn btn--secondary btn--full dw-mod js-expand-hide" data-trigger="CheckFilters">@Translate("Select filters")</label> 3526 <label for="CheckFilters" class="btn btn--secondary btn--full dw-mod expandable--collapsed" data-trigger="CheckFilters">@Translate("Close filters")</label> 3527 </div> 3528 } 3529 } 353035313532 @* Include the Blocks for the page *@ 3533 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 35343535 @using System 3536 @using System.Web 3537 @using System.Collections.Generic 3538 @using Dynamicweb.Rapido.Blocks.Extensibility 3539 @using Dynamicweb.Rapido.Blocks 35403541 @functions { 3542 string GoogleTagManagerID = ""; 3543 string GoogleAnalyticsID = ""; 3544 } 35453546 @{ 3547 GoogleTagManagerID = Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID"); 3548 GoogleAnalyticsID = Model.Area.Item.GetItem("Settings").GetString("GoogleAnalyticsTrackingID"); 35493550 BlocksPage topSnippetsBlocksPage = BlocksPage.GetBlockPage("Master"); 35513552 if (!string.IsNullOrWhiteSpace(GoogleAnalyticsID)) 3553 { 3554 Block tagManager = new Block() 3555 { 3556 Id = "GoogleAnalytics", 3557 SortId = 0, 3558 Template = RenderGoogleAnalyticsSnippet() 3559 }; 3560 topSnippetsBlocksPage.Add("Head", tagManager); 3561 } 35623563 if (!string.IsNullOrWhiteSpace(GoogleTagManagerID)) 3564 { 3565 Block tagManager = new Block() 3566 { 3567 Id = "TagManager", 3568 SortId = 1, 3569 Template = RenderGoogleTagManager() 3570 }; 3571 topSnippetsBlocksPage.Add("Head", tagManager); 35723573 Block tagManagerBodySnippet = new Block() 3574 { 3575 Id = "TagManagerBodySnippet", 3576 SortId = 1, 3577 Template = RenderGoogleTagManagerBodySnippet() 3578 }; 3579 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, tagManagerBodySnippet); 3580 } 35813582 Block facebookPixel = new Block() 3583 { 3584 Id = "FacebookPixel", 3585 SortId = 2, 3586 Template = RenderFacebookPixel() 3587 }; 35883589 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, facebookPixel); 3590 } 35913592 @helper RenderGoogleAnalyticsSnippet() 3593 { 3594 <!-- Global site tag (gtag.js) - Google Analytics --> 3595 <script async src="https://www.googletagmanager.com/gtag/js?id=@GoogleAnalyticsID"></script> 3596 <script> 3597 window.dataLayer = window.dataLayer || []; 3598 function gtag(){dataLayer.push(arguments);} 3599 gtag('js', new Date()); 36003601 gtag('config', '@GoogleAnalyticsID'); 3602 </script> 36033604 } 36053606 @helper RenderGoogleTagManager() 3607 { 3608 <script> 3609 (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': 3610 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], 3611 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 3612 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); 3613 })(window,document,'script','dataLayer','@GoogleTagManagerID'); 3614 </script> 3615 } 36163617 @helper RenderGoogleTagManagerBodySnippet() 3618 { 3619 <!-- Google Tag Manager (noscript) --> 3620 <noscript> 3621 <iframe src="https://www.googletagmanager.com/ns.html?id=@GoogleTagManagerID" 3622 height="0" width="0" style="display:none;visibility:hidden"></iframe> 3623 </noscript> 3624 <!-- End Google Tag Manager (noscript) --> 3625 } 36263627 @helper RenderFacebookPixel() 3628 { 3629 string FacebookPixelID = Model.Area.Item.GetItem("Settings").GetString("FacebookPixelID"); 36303631 if (!string.IsNullOrWhiteSpace(FacebookPixelID)) 3632 { 3633 <!-- Facebook Pixel Code --> 3634 <script> 3635 !function(f,b,e,v,n,t,s) 3636 {if(f.fbq)return;n=f.fbq=function(){n.callMethod? 3637 n.callMethod.apply(n,arguments):n.queue.push(arguments)}; 3638 if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0'; 3639 n.queue=[];t=b.createElement(e);t.async=!0; 3640 t.src=v;s=b.getElementsByTagName(e)[0]; 3641 s.parentNode.insertBefore(t,s)}(window, document,'script', 3642 'https://connect.facebook.net/en_US/fbevents.js'); 3643 fbq('init', '@FacebookPixelID'); 3644 fbq('track', 'PageView'); 3645 </script> 3646 <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=@FacebookPixelID&ev=PageView&noscript=1" alt="" /></noscript> 3647 } 3648 } 3649 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 36503651 @using System 3652 @using System.Web 3653 @using System.Collections.Generic 3654 @using Dynamicweb.Rapido.Blocks 3655 @using Dynamicweb.Rapido.Blocks.Extensibility 3656 @using Dynamicweb.Security.UserManagement 3657 @using Dynamicweb.Security.UserManagement.ExternalAuthentication 3658 @using Dynamicweb.Rapido.Blocks.Components.General 36593660 @{ 3661 BlocksPage loginBlocksPage = BlocksPage.GetBlockPage("Master"); 36623663 Block loginModal = new Block() 3664 { 3665 Id = "LoginModal", 3666 SortId = 10, 3667 Component = new Modal 3668 { 3669 Id = "SignIn", 3670 Heading = new Heading 3671 { 3672 Level = 0, 3673 Title = Translate("Sign in") 3674 }, 3675 Width = ModalWidth.Sm, 3676 BodyTemplate = RenderLoginForm() 3677 } 3678 }; 36793680 loginBlocksPage.Add(MasterBlockId.MasterTopSnippets, loginModal); 3681 } 36823683 @helper RenderLoginForm() 3684 { 3685 int pageId = Model.TopPage.ID; 3686 string userSignedInErrorText = ""; 3687 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 3688 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; 3689 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 3690 bool showModalOnStart = pageId != GetPageIdByNavigationTag("CustomerCenter") && Model.LogOnFailed; 3691 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); 3692 bool hideForgotPasswordLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideForgotPasswordLink"); 36933694 ProviderCollection providers = Provider.GetActiveProviders(); 36953696 if (Model.LogOnFailed) 3697 { 3698 switch (Model.LogOnFailedReason) 3699 { 3700 case LogOnFailedReason.PasswordLengthInvalid: 3701 userSignedInErrorText = Translate("Password length is invalid"); 3702 break; 3703 case LogOnFailedReason.IncorrectLogin: 3704 userSignedInErrorText = Translate("Invalid email or password"); 3705 break; 3706 case LogOnFailedReason.ExceededFailedLogOnLimit: 3707 userSignedInErrorText = Translate("You have exceeded the limit of allowed login attempts. The user account is temporarily locked"); 3708 break; 3709 case LogOnFailedReason.LoginLocked: 3710 userSignedInErrorText = Translate("The user account is temporarily locked"); 3711 break; 3712 case LogOnFailedReason.PasswordExpired: 3713 userSignedInErrorText = Translate("The password has expired and needs to be renewed"); 3714 break; 3715 default: 3716 userSignedInErrorText = Translate("An unknown error occured"); 3717 break; 3718 } 3719 } 37203721 Form form = new Form { Method = FormMethod.Post, Name = "LoginModalForm" }; 37223723 TextField passwordField = new TextField { Id = "login-password", Type = TextFieldType.Password, Name = "password", Label = Translate("Password"), Required = true }; 37243725 if (!hideForgotPasswordLink) { 3726 passwordField.Link = new Link { Title = Translate("Forgot password?"), Href = "/Default.aspx?id=" + signInProfilePageId + "&LoginAction=Recovery" }; 3727 } 37283729 form.Add(new HiddenField { Name = "ID", Value = Converter.ToString(pageId) }); 3730 form.Add(new HiddenField { Name = "DWExtranetUsernameRemember", Value = "True" }); 3731 form.Add(new HiddenField { Name = "DWExtranetPasswordRemember", Value = "True" }); 3732 form.Add(new HiddenField { Name = "LoginAction", Value = "Login" }); 3733 form.Add(new TextField { Id = "LoginUsername", Name = "username", Label = Translate("Email"), CssClass = "u-full-width", Required = true }); 3734 form.Add(passwordField); 3735 form.Add(new NotificationMessage { Message = userSignedInErrorText, MessageType = NotificationMessageType.Error }); 3736 form.Add(new CheckboxField { Id = "LoginRememberMe", Value = "True", Name = "Autologin", Label = Translate("Remember me") }); 3737 form.Add(new Button { ButtonType = ButtonType.Submit, Title = Translate("Sign in"), CssClass = "btn--full", OnClick = "Buttons.LockButton(event)" }); 37383739 foreach (Provider LoginProvider in providers) 3740 { 3741 var ProviderName = LoginProvider.Name.ToLower(); 3742 form.Add(new Link { 3743 Href = "/Admin/Public/Social/ExternalLogin.aspx?action=login&providerID=" + LoginProvider.ID, 3744 Icon = new Icon { Prefix = "fab", Name = "fa-" + ProviderName, CssClass = "fa-1_5x", LabelPosition = IconLabelPosition.After }, 3745 ButtonLayout = ButtonLayout.LinkClean, 3746 CssClass = "btn--condensed u-margin-bottom u-margin-right u-inline-block u-color-" + ProviderName, 3747 AltText = ProviderName 3748 }); 3749 } 37503751 if (!hideCreateAccountLink) { 3752 form.Add(new Text { Content = "<div class=\"u-border-top u-full-width u-margin-bottom--lg\"></div>" }); 3753 form.Add(new Link 3754 { 3755 Href = "/Default.aspx?id=" + createAccountPageId, 3756 ButtonLayout = ButtonLayout.LinkClean, 3757 Title = Translate("Create account"), 3758 CssClass = "u-full-width u-ta-center" 3759 }); 3760 } 37613762 @Render(form) 37633764 if (showModalOnStart) 3765 { 3766 <script> 3767 document.getElementById("SignInModalTrigger").checked = true; 3768 </script> 3769 } 3770 } 37713772 @if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet") 3773 { 3774 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 37753776 @using System 3777 @using System.Web 3778 @using System.Collections.Generic 3779 @using Dynamicweb.Rapido.Blocks.Extensibility 3780 @using Dynamicweb.Rapido.Blocks 3781 @using Dynamicweb.Rapido.Services 378237833784 @functions { 3785 BlocksPage mobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master"); 3786 } 37873788 @{ 3789 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"; 3790 bool mobileHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 3791 bool mobileHideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart") || !Dynamicweb.Rapido.Services.User.IsBuyingAllowed(); 37923793 Block mobileHeader = new Block() 3794 { 3795 Id = "MobileTop", 3796 SortId = 10, 3797 Template = RenderMobileTop(), 3798 SkipRenderBlocksList = true 3799 }; 3800 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeader); 38013802 Block mobileHeaderNavigation = new Block() 3803 { 3804 Id = "MobileHeaderNavigation", 3805 SortId = 10, 3806 Template = RenderMobileHeaderNavigation(), 3807 SkipRenderBlocksList = true, 3808 BlocksList = new List<Block> { 3809 new Block { 3810 Id = "MobileHeaderNavigationTrigger", 3811 SortId = 10, 3812 Template = RenderMobileHeaderNavigationTrigger() 3813 } 3814 } 3815 }; 3816 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderNavigation); 38173818 Block mobileHeaderLogo = new Block() 3819 { 3820 Id = "MobileHeaderLogo", 3821 SortId = 20, 3822 Template = RenderMobileHeaderLogo(), 3823 SkipRenderBlocksList = true 3824 }; 3825 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderLogo); 38263827 Block mobileHeaderActions = new Block() 3828 { 3829 Id = "MobileHeaderActions", 3830 SortId = 30, 3831 Template = RenderMobileTopActions(), 3832 SkipRenderBlocksList = true 3833 }; 3834 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderActions); 38353836 if (!mobileHideSearch) 3837 { 3838 Block mobileHeaderSearch = new Block 3839 { 3840 Id = "MobileHeaderSearch", 3841 SortId = 10, 3842 Template = RenderMobileTopSearch() 3843 }; 3844 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderSearch); 3845 } 38463847 Block mobileHeaderMiniCart; 38483849 if (!mobileHideCart) 3850 { 3851 mobileHeaderMiniCart = new Block 3852 { 3853 Id = "MobileHeaderMiniCart", 3854 SortId = 20, 3855 Template = RenderMobileTopMiniCart() 3856 }; 38573858 Block miniCartCounterScriptTemplate = new Block 3859 { 3860 Id = "MiniCartCounterScriptTemplate", 3861 Template = RenderMobileMiniCartCounterContent() 3862 }; 3863 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate); 3864 } 3865 else 3866 { 3867 mobileHeaderMiniCart = new Block 3868 { 3869 Id = "MobileHeaderMiniCart", 3870 SortId = 20 3871 }; 3872 } 38733874 if (!mobileHideSearch) 3875 { 3876 Block mobileHeaderSearchBar = new Block() 3877 { 3878 Id = "MobileHeaderSearchBar", 3879 SortId = 30, 3880 Template = RenderMobileTopSearchBar() 3881 }; 3882 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeaderSearchBar); 3883 } 38843885 switch (mobileTopLayout) 3886 { 3887 case "nav-left": 3888 mobileHeaderNavigation.SortId = 10; 3889 mobileHeaderLogo.SortId = 20; 3890 mobileHeaderActions.SortId = 30; 3891 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart); 3892 break; 3893 case "nav-right": 3894 mobileHeaderLogo.SortId = 10; 3895 mobileHeaderActions.SortId = 20; 3896 mobileHeaderNavigation.SortId = 30; 3897 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart); 3898 break; 3899 case "nav-search-left": 3900 mobileHeaderNavigation.SortId = 10; 3901 mobileHeaderLogo.SortId = 20; 3902 mobileHeaderActions.SortId = 30; 3903 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart); 3904 break; 3905 case "search-left": 3906 mobileHeaderActions.SortId = 10; 3907 mobileHeaderLogo.SortId = 20; 3908 mobileHeaderNavigation.SortId = 30; 3909 mobileHeaderMiniCart.SortId = 0; 3910 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart); 3911 break; 3912 } 3913 } 391439153916 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 39173918 @using System 3919 @using System.Web 3920 @using Dynamicweb.Rapido.Blocks.Extensibility 3921 @using Dynamicweb.Rapido.Blocks 39223923 @{ 3924 BlocksPage customMobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master"); 3925 } 39263927392839293930 @helper RenderMobileTop() { 3931 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileTop").OrderBy(item => item.SortId).ToList(); 39323933 <nav class="main-navigation-mobile dw-mod"> 3934 <div class="center-container top-container__center-container dw-mod"> 3935 <div class="grid grid--align-center"> 3936 @RenderBlockList(subBlocks) 3937 </div> 3938 </div> 3939 </nav> 3940 } 39413942 @helper RenderMobileHeaderNavigation() { 3943 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderNavigation").OrderBy(item => item.SortId).ToList(); 39443945 <div class="grid__col-auto-width"> 3946 <ul class="menu dw-mod"> 3947 @RenderBlockList(subBlocks) 3948 </ul> 3949 </div> 3950 } 39513952 @helper RenderMobileHeaderNavigationTrigger() { 3953 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 3954 <label for="MobileNavTrigger" class="mobile-nav-trigger-button menu__link menu__link--icon menu__link--mobile dw-mod"></label> 3955 </li> 3956 } 39573958 @helper RenderMobileHeaderLogo() { 3959 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderLogo").OrderBy(item => item.SortId).ToList(); 39603961 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"; 3962 string centeredLogo = mobileTopLayout != "nav-right" ? "u-ta-center" : ""; 3963 string firstPageId = Model.Area.FirstActivePage.ID.ToString(); 3964 string businessName = Model.Area.Item.GetItem("Settings").GetString("BusinessName"); 39653966 string mobileLogo = "/Files/Images/logo-dynamicweb.png"; 3967 if (Model.Area.Item.GetItem("Layout").GetItem("MobileTop") != null && Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo") != null) 3968 { 3969 mobileLogo = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo").PathUrlEncoded; 3970 } 39713972 if (Path.GetExtension(mobileLogo).ToLower() != ".svg") 3973 { 3974 mobileLogo = "/Admin/Public/GetImage.ashx?height=40&amp;width=100&amp;crop=5&amp;Compression=75&amp;image=" + mobileLogo; 3975 } 3976 else 3977 { 3978 mobileLogo = HttpUtility.UrlDecode(mobileLogo); 3979 } 39803981 <div class="grid__col-auto grid__col--bleed"> 3982 <div class="grid__cell @centeredLogo"> 3983 <a href="/Default.aspx?ID=@firstPageId" class="logo logo--mobile u-inline-block dw-mod"> 3984 <img class="grid__cell-img logo__img logo__img--mobile dw-mod" src="@mobileLogo" alt="@businessName" /> 3985 </a> 3986 </div> 39873988 @RenderBlockList(subBlocks) 3989 </div> 3990 } 39913992 @helper RenderMobileTopActions() { 3993 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderActions").OrderBy(item => item.SortId).ToList(); 39943995 <div class="grid__col-auto-width"> 3996 <ul class="menu dw-mod"> 3997 @RenderBlockList(subBlocks) 3998 </ul> 3999 </div> 4000 } 40014002 @helper RenderMobileTopSearch() { 4003 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 4004 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> 4005 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> 4006 </label> 4007 </li> 4008 } 40094010 @helper RenderMobileTopMiniCart() { 4011 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4012 int cartPageId = GetPageIdByNavigationTag("CartPage"); 4013 double cartProductsCount = Model.Cart.TotalProductsCount; 40144015 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod" id="miniCartWrapper"> 4016 <div class="mini-cart dw-mod"> 4017 <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"> 4018 <div class="u-inline u-position-relative"> 4019 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue fa-1_5x"></i> 4020 <div class="mini-cart__counter dw-mod"> 4021 <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"> 4022 <div class="js-mini-cart-counter-content" data-count="@cartProductsCount"> 4023 @cartProductsCount 4024 </div> 4025 </div> 4026 </div> 4027 </div> 4028 </a> 4029 </div> 4030 </li> 4031 } 40324033 @helper RenderMobileTopSearchBar() 4034 { 4035 string searchFeedId = ""; 4036 string searchSecondFeedId = ""; 4037 int groupsFeedId; 4038 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 4039 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 4040 string resultPageLink; 4041 string searchPlaceholder; 4042 string searchType = "product-search"; 4043 string searchTemplate; 4044 string searchContentTemplate = ""; 4045 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; 4046 bool showGroups = true; 40474048 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch") 4049 { 4050 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 4051 resultPageLink = contentSearchPageLink; 4052 searchPlaceholder = Translate("Search page"); 4053 groupsFeedId = 0; 4054 searchType = "content-search"; 4055 searchTemplate = "SearchPagesTemplate"; 4056 showGroups = false; 4057 } 4058 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch") 4059 { 4060 searchFeedId = productsPageId + "&feed=true"; 4061 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 4062 resultPageLink = Converter.ToString(productsPageId); 4063 searchPlaceholder = Translate("Search products or pages"); 4064 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 4065 searchType = "combined-search"; 4066 searchTemplate = "SearchProductsTemplateWrap"; 4067 searchContentTemplate = "SearchPagesTemplateWrap"; 4068 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 4069 } 4070 else 4071 { 4072 resultPageLink = Converter.ToString(productsPageId); 4073 searchFeedId = productsPageId + "&feed=true"; 4074 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 4075 searchPlaceholder = Translate("Search products"); 4076 searchTemplate = "SearchProductsTemplate"; 4077 searchType = "product-search"; 4078 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 4079 } 40804081 <input type="checkbox" id="MobileSearchTrigger" class="mobile-search-trigger" /> 40824083 <div class="main-navigation-mobile typeahead-mobile dw-mod"> 4084 <div class="center-container top-container__center-container dw-mod"> 4085 <div class="grid"> 4086 <div class="grid__col-auto"> 4087 <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"> 4088 <input type="text" class="js-typeahead-search-field u-w160px u-no-margin" placeholder="@searchPlaceholder" value="@searchValue"> 4089 @if (string.IsNullOrEmpty(searchSecondFeedId)) 4090 { 4091 <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> 4092 } 4093 else 4094 { 4095 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--combined-mobile grid"> 4096 <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> 4097 <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> 4098 </div> 4099 } 4100 <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> 4101 </div> 4102 </div> 4103 <div class="grid__col-auto-width"> 4104 <ul class="menu dw-mod"> 4105 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 4106 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> 4107 <i class="fas fa-times fa-1_5x"></i> 4108 </label> 4109 </li> 4110 </ul> 4111 </div> 4112 </div> 4113 </div> 4114 </div> 4115 } 41164117 @helper RenderMobileMiniCartCounterContent() 4118 { 4119 <script id="MiniCartCounterContent" type="text/x-template"> 4120 {{#.}} 4121 <div class="js-mini-cart-counter-content dw-mod" data-count="{{numberofproducts}}"> 4122 {{numberofproducts}} 4123 </div> 4124 {{/.}} 4125 </script> 4126 } 4127 </text> 4128 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 41294130 @using System 4131 @using System.Web 4132 @using System.Collections.Generic 4133 @using Dynamicweb.Rapido.Blocks.Extensibility 4134 @using Dynamicweb.Rapido.Blocks 41354136 @functions { 4137 BlocksPage mobileNavigationBlocksPage = BlocksPage.GetBlockPage("Master"); 4138 } 41394140 @{ 4141 bool mobileNavigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 4142 bool mobileHideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); 4143 bool mobileHideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); 4144 bool mobileHideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); 4145 bool mobileHideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); 4146 bool mobileHideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); 41474148 Block mobileNavigation = new Block() 4149 { 4150 Id = "MobileNavigation", 4151 SortId = 10, 4152 Template = MobileNavigation(), 4153 SkipRenderBlocksList = true 4154 }; 4155 mobileNavigationBlocksPage.Add(MasterBlockId.MasterTopSnippets, mobileNavigation); 41564157 if (Model.CurrentUser.ID > 0 && !mobileHideMyProfileLink) 4158 { 4159 Block mobileNavigationSignIn = new Block 4160 { 4161 Id = "MobileNavigationSignIn", 4162 SortId = 10, 4163 Template = RenderMobileNavigationSignIn() 4164 }; 4165 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationSignIn); 4166 } 41674168 Block mobileNavigationMenu = new Block 4169 { 4170 Id = "MobileNavigationMenu", 4171 SortId = 20, 4172 Template = RenderMobileNavigationMenu() 4173 }; 4174 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationMenu); 41754176 Block mobileNavigationActions = new Block 4177 { 4178 Id = "MobileNavigationActions", 4179 SortId = 30, 4180 Template = RenderMobileNavigationActions(), 4181 SkipRenderBlocksList = true 4182 }; 4183 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationActions); 41844185 if (!mobileNavigationItemsHideSignIn) 4186 { 4187 if (Model.CurrentUser.ID <= 0) 4188 { 4189 Block mobileNavigationSignInAction = new Block 4190 { 4191 Id = "MobileNavigationSignInAction", 4192 SortId = 10, 4193 Template = RenderMobileNavigationSignInAction() 4194 }; 4195 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignInAction); 41964197 if (!mobileHideCreateAccountLink) 4198 { 4199 Block mobileNavigationCreateAccountAction = new Block 4200 { 4201 Id = "MobileNavigationCreateAccountAction", 4202 SortId = 20, 4203 Template = RenderMobileNavigationCreateAccountAction() 4204 }; 4205 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationCreateAccountAction); 4206 } 4207 } 4208 else 4209 { 4210 if (!mobileHideMyOrdersLink) 4211 { 4212 Block mobileNavigationOrdersAction = new Block 4213 { 4214 Id = "MobileNavigationOrdersAction", 4215 SortId = 20, 4216 Template = RenderMobileNavigationOrdersAction() 4217 }; 4218 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationOrdersAction); 4219 } 4220 if (!mobileHideMyFavoritesLink) 4221 { 4222 Block mobileNavigationFavoritesAction = new Block 4223 { 4224 Id = "MobileNavigationFavoritesAction", 4225 SortId = 30, 4226 Template = RenderMobileNavigationFavoritesAction() 4227 }; 4228 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationFavoritesAction); 4229 } 4230 if (!mobileHideMySavedCardsLink) 4231 { 4232 Block mobileNavigationSavedCardsAction = new Block 4233 { 4234 Id = "MobileNavigationFavoritesAction", 4235 SortId = 30, 4236 Template = RenderMobileNavigationSavedCardsAction() 4237 }; 4238 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSavedCardsAction); 4239 } 42404241 Block mobileNavigationSignOutAction = new Block 4242 { 4243 Id = "MobileNavigationSignOutAction", 4244 SortId = 40, 4245 Template = RenderMobileNavigationSignOutAction() 4246 }; 4247 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignOutAction); 4248 } 4249 } 42504251 if (Model.Languages.Count > 1) 4252 { 4253 Block mobileNavigationLanguagesAction = new Block 4254 { 4255 Id = "MobileNavigationLanguagesAction", 4256 SortId = 50, 4257 Template = RenderMobileNavigationLanguagesAction() 4258 }; 4259 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationLanguagesAction); 4260 } 4261 } 426242634264 @helper MobileNavigation() 4265 { 4266 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigation").OrderBy(item => item.SortId).ToList(); 4267 string mobileTopDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design") != null ? Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design").SelectedValue : "nav-left"; 4268 string position = mobileTopDesign == "nav-left" || mobileTopDesign == "nav-search-left" ? "left" : "right"; 42694270 <!-- Trigger for mobile navigation --> 4271 <input type="checkbox" id="MobileNavTrigger" class="mobile-nav-trigger mobile-nav-trigger--@position" autocomplete="off" /> 42724273 <!-- Mobile navigation --> 4274 <nav class="mobile-navigation mobile-navigation--@position dw-mod"> 4275 <div class="mobile-navigation__wrapper" id="mobileNavigationWrapper"> 4276 @RenderBlockList(subBlocks) 4277 </div> 4278 </nav> 42794280 <label class="mobile-nav-trigger-off" for="MobileNavTrigger"></label> 4281 } 42824283 @helper RenderMobileNavigationSignIn() 4284 { 4285 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 4286 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 4287 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 4288 string myProfilePageLink = linkStart + myProfilePageId; 4289 string userName = Model.CurrentUser.FirstName; 4290 if (!string.IsNullOrEmpty(userName) && !string.IsNullOrEmpty(Model.CurrentUser.LastName)) 4291 { 4292 userName += " " + Model.CurrentUser.LastName; 4293 } 4294 if (string.IsNullOrEmpty(userName)) 4295 { 4296 userName = Model.CurrentUser.Name; 4297 } 4298 if (string.IsNullOrEmpty(userName)) 4299 { 4300 userName = Model.CurrentUser.UserName; 4301 } 4302 if (string.IsNullOrEmpty(userName)) 4303 { 4304 userName = Model.CurrentUser.Email; 4305 } 43064307 <ul class="menu menu-mobile"> 4308 <li class="menu-mobile__item"> 4309 <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> 4310 </li> 4311 </ul> 4312 } 43134314 @helper RenderMobileNavigationMenu() 4315 { 4316 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides"; 4317 string menuTemplate = isSlidesDesign ? "BaseMenuForMobileSlides.xslt" : "BaseMenuForMobileExpandable.xslt"; 4318 string levels = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels") : "3"; 4319 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 4320 int startLevel = 0; 43214322 @RenderNavigation(new 4323 { 4324 id = "mobilenavigation", 4325 cssclass = "menu menu-mobile dwnavigation", 4326 startLevel = @startLevel, 4327 ecomStartLevel = @startLevel + 1, 4328 endlevel = @levels, 4329 expandmode = "all", 4330 template = @menuTemplate 4331 }) 43324333 if (isSlidesDesign) 4334 { 4335 <script> 4336 function goToLevel(level) { 4337 document.getElementById('mobileNavigationWrapper').style.left = -(level * 100) + "%"; 4338 } 43394340 document.addEventListener('DOMContentLoaded', function () { 4341 goToLevel(document.getElementById('mobileNavigationWrapper').querySelectorAll('input[type=radio]:checked').length); 4342 }); 4343 </script> 4344 } 43454346 if (renderPagesInToolBar) 4347 { 4348 @RenderNavigation(new 4349 { 4350 id = "topToolsMobileNavigation", 4351 cssclass = "menu menu-mobile dwnavigation", 4352 template = "ToolsMenuForMobile.xslt" 4353 }) 4354 } 4355 } 43564357 @helper RenderMobileNavigationActions() 4358 { 4359 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigationActions").OrderBy(item => item.SortId).ToList(); ; 43604361 <ul class="menu menu-mobile"> 4362 @RenderBlockList(subBlocks) 4363 </ul> 4364 } 43654366 @helper RenderMobileNavigationSignInAction() 4367 { 4368 <li class="menu-mobile__item"> 4369 <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> 4370 </li> 4371 } 43724373 @helper RenderMobileNavigationCreateAccountAction() 4374 { 4375 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 43764377 <li class="menu-mobile__item"> 4378 <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> 4379 </li> 4380 } 43814382 @helper RenderMobileNavigationProfileAction() 4383 { 4384 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 4385 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 4386 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 4387 string myProfilePageLink = linkStart + myProfilePageId; 43884389 <li class="menu-mobile__item"> 4390 <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> 4391 </li> 4392 } 43934394 @helper RenderMobileNavigationOrdersAction() 4395 { 4396 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 4397 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 4398 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); 4399 string myOrdersPageLink = linkStart + myOrdersPageId; 4400 string ordersIcon = "fas fa-list"; 44014402 <li class="menu-mobile__item"> 4403 <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> 4404 </li> 4405 } 44064407 @helper RenderMobileNavigationFavoritesAction() 4408 { 4409 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 4410 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 4411 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 4412 string myFavoritesPageLink = linkStart + myFavoritesPageId; 4413 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"; 441444154416 <li class="menu-mobile__item"> 4417 <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> 4418 </li> 4419 } 44204421 @helper RenderMobileNavigationSavedCardsAction() 4422 { 4423 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 4424 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 4425 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards"); 4426 string mySavedCardsPageLink = linkStart + mySavedCardsPageId; 4427 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"; 44284429 <li class="menu-mobile__item"> 4430 <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> 4431 </li> 4432 } 44334434 @helper RenderMobileNavigationSignOutAction() 4435 { 4436 int topPageId = Model.Area.FirstActivePage.ID; 4437 int pageId = Model.TopPage.ID; 4438 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"; 44394440 <li class="menu-mobile__item"> 4441 <a class="menu-mobile__link menu-mobile__link--highlighted dw-mod" href="/Admin/Public/ExtranetLogoff.aspx?ID=@topPageId" onclick="RememberState.SetCookie('useAnotherAddress', false)"><i class="@signOutIcon menu-mobile__link-icon"></i> @Translate("Sign out")</a> 4442 </li> 4443 } 44444445 @helper RenderMobileNavigationLanguagesAction() 4446 { 4447 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides"; 44484449 string selectedLanguage = ""; 4450 foreach (var lang in Model.Languages) 4451 { 4452 if (lang.IsCurrent) 4453 { 4454 selectedLanguage = lang.Name; 4455 } 4456 } 44574458 <li class="menu-mobile__item dw-mod"> 4459 @if (isSlidesDesign) 4460 { 4461 <input id="MobileMenuCheck_Language" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(1);"> 4462 } 4463 else 4464 { 4465 <input id="MobileMenuCheck_Language" type="checkbox" class="expand-trigger"> 4466 } 4467 <div class="menu-mobile__link__wrap"> 4468 <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> 4469 <label for="MobileMenuCheck_Language" class="menu-mobile__trigger"></label> 4470 </div> 4471 <ul class="menu-mobile menu-mobile__submenu expand-menu"> 4472 @if (isSlidesDesign) 4473 { 4474 <li class="menu-mobile__item dw-mod"> 4475 <div class="menu-mobile__link__wrap"> 4476 <input id="MobileMenuCheck_Language_back" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(0);" /> 4477 <label for="MobileMenuCheck_Language_back" class="menu-mobile__trigger menu-mobile__trigger--back"></label> 4478 <label for="MobileMenuCheck_Language_back" class="menu-mobile__link dw-mod ">@Translate("Back")</label> 4479 </div> 4480 </li> 4481 } 4482 @foreach (var lang in Model.Languages) 4483 { 4484 <li class="menu-mobile__item dw-mod"> 4485 <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> 4486 </li> 4487 } 4488 </ul> 4489 </li> 4490 }</text> 4491 } 4492 else 4493 { 4494 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 44954496 @using System 4497 @using System.Web 4498 @using System.Collections.Generic 4499 @using Dynamicweb.Rapido.Blocks.Extensibility 4500 @using Dynamicweb.Rapido.Blocks 45014502 @functions { 4503 BlocksPage headerBlocksPage = BlocksPage.GetBlockPage("Master"); 4504 } 45054506 @{ 4507 Block masterTools = new Block() 4508 { 4509 Id = "MasterDesktopTools", 4510 SortId = 10, 4511 Template = RenderDesktopTools(), 4512 SkipRenderBlocksList = true, 4513 BlocksList = new List<Block> 4514 { 4515 new Block { 4516 Id = "MasterDesktopToolsText", 4517 SortId = 10, 4518 Template = RenderDesktopToolsText(), 4519 Design = new Design 4520 { 4521 Size = "auto", 4522 HidePadding = true, 4523 RenderType = RenderType.Column 4524 } 4525 }, 4526 new Block { 4527 Id = "MasterDesktopToolsNavigation", 4528 SortId = 20, 4529 Template = RenderDesktopToolsNavigation(), 4530 Design = new Design 4531 { 4532 Size = "auto-width", 4533 HidePadding = true, 4534 RenderType = RenderType.Column 4535 } 4536 } 4537 } 4538 }; 4539 headerBlocksPage.Add("MasterHeader", masterTools); 45404541 Block masterDesktopExtra = new Block() 4542 { 4543 Id = "MasterDesktopExtra", 4544 SortId = 10, 4545 Template = RenderDesktopExtra(), 4546 SkipRenderBlocksList = true 4547 }; 4548 headerBlocksPage.Add("MasterHeader", masterDesktopExtra); 45494550 Block masterDesktopNavigation = new Block() 4551 { 4552 Id = "MasterDesktopNavigation", 4553 SortId = 20, 4554 Template = RenderDesktopNavigation(), 4555 SkipRenderBlocksList = true 4556 }; 4557 headerBlocksPage.Add("MasterHeader", masterDesktopNavigation); 4558 } 45594560 @* Include the Blocks for the page *@ 4561 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 45624563 @using System 4564 @using System.Web 4565 @using Dynamicweb.Rapido.Blocks.Extensibility 4566 @using Dynamicweb.Rapido.Blocks 45674568 @{ 4569 Block masterDesktopLogo = new Block 4570 { 4571 Id = "MasterDesktopLogo", 4572 SortId = 10, 4573 Template = RenderDesktopLogo(), 4574 Design = new Design 4575 { 4576 Size = "auto-width", 4577 HidePadding = true, 4578 RenderType = RenderType.Column, 4579 CssClass = "grid--align-self-center" 4580 } 4581 }; 45824583 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopLogo); 4584 } 458545864587 @helper RenderDesktopLogo() 4588 { 4589 string firstPageId = Model.Area.FirstActivePage.ID.ToString(); 4590 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4591 string alignClass = topLayout == "two-lines-centered" || topLayout == "two-lines" ? "grid--align-self-center" : ""; 4592 alignClass = topLayout == "splitted-center" ? "u-middle" : alignClass; 4593 string logo = Model.Area.Item.GetItem("Layout").GetFile("LogoImage") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoImage").PathUrlEncoded : "/Files/Images/logo-dynamicweb.png"; 4594 if (Path.GetExtension(logo).ToLower() != ".svg") 4595 { 4596 int logoHeight = Model.Area.Item.GetItem("Layout").GetInt32("LogoHeight"); 4597 logoHeight = logoHeight > 0 && Pageview.Device.ToString() != "Mobile" ? logoHeight : 40; 4598 logo = "/Admin/Public/GetImage.ashx?height=" + Converter.ToString(logoHeight) + "&amp;crop=5&amp;Compression=75&amp;image=" + logo; 4599 } 4600 else 4601 { 4602 logo = HttpUtility.UrlDecode(logo); 4603 } 46044605 <div class="logo @alignClass dw-mod"> 4606 <a href="/Default.aspx?ID=@firstPageId" class="logo__img dw-mod u-block"> 4607 <img class="grid__cell-img logo__img dw-mod" src="@logo" alt="@Translate("Logo")" /> 4608 </a> 4609 </div> 4610 } 4611 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 46124613 @using System 4614 @using System.Web 4615 @using Dynamicweb.Rapido.Blocks.Extensibility 4616 @using Dynamicweb.Rapido.Blocks 46174618 @functions { 4619 bool isMegaMenu; 4620 } 46214622 @{ 4623 isMegaMenu = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu") != null ? Converter.ToBoolean(Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu").SelectedValue) : false; 4624 Block masterDesktopMenu = new Block 4625 { 4626 Id = "MasterDesktopMenu", 4627 SortId = 10, 4628 Template = RenderDesktopMenu(), 4629 Design = new Design 4630 { 4631 Size = "auto", 4632 HidePadding = true, 4633 RenderType = RenderType.Column 4634 } 4635 }; 46364637 if (isMegaMenu) 4638 { 4639 masterDesktopMenu.Design.CssClass = "u-reset-position"; 4640 } 46414642 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopMenu); 4643 } 46444645 @helper RenderDesktopMenu() 4646 { 4647 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4648 string menuAlignment = topLayout == "minimal-right" ? "grid--align-self-end" : ""; 4649 menuAlignment = topLayout == "minimal-center" ? "grid--align-self-center" : topLayout; 4650 string megamenuPromotionImage = Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage").PathUrlEncoded : ""; 4651 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 4652 bool showOnlyHeaders = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowOnlyHeaders"); 4653 int startLevel = renderPagesInToolBar ? 1 : 0; 46544655 string promotionLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("MegamenuPromotionLink"); 46564657 <div class="grid__cell u-align-right u-flex @(isMegaMenu ? "u-reset-position" : "") @menuAlignment"> 4658 @if (!isMegaMenu) 4659 { 4660 @RenderNavigation(new 4661 { 4662 id = "topnavigation", 4663 cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap", 4664 startLevel = startLevel, 4665 ecomStartLevel = startLevel + 1, 4666 endlevel = 5, 4667 expandmode = "all", 4668 template = "BaseMenuWithDropdown.xslt" 4669 }); 4670 } 4671 else 4672 { 4673 @RenderNavigation(new 4674 { 4675 id = "topnavigation", 4676 cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap", 4677 startLevel = startLevel, 4678 ecomStartLevel = startLevel + 1, 4679 endlevel = 5, 4680 promotionImage = megamenuPromotionImage, 4681 promotionLink = promotionLink, 4682 expandmode = "all", 4683 showOnlyHeaders = showOnlyHeaders.ToString().ToLower(), 4684 template = "BaseMegaMenu.xslt" 4685 }); 4686 } 4687 </div> 4688 } 4689 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 46904691 @using System 4692 @using System.Web 4693 @using Dynamicweb.Rapido.Blocks.Extensibility 4694 @using Dynamicweb.Rapido.Blocks 46954696 @{ 4697 Block masterDesktopActionsMenu = new Block 4698 { 4699 Id = "MasterDesktopActionsMenu", 4700 SortId = 10, 4701 Template = RenderDesktopActionsMenu(), 4702 Design = new Design 4703 { 4704 CssClass = "u-flex" 4705 }, 4706 SkipRenderBlocksList = true 47074708 }; 4709 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopActionsMenu); 47104711 if (!string.IsNullOrWhiteSpace(Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink"))) 4712 { 4713 Block masterDesktopActionsHeaderButton = new Block 4714 { 4715 Id = "MasterDesktopActionsHeaderButton", 4716 SortId = 60, 4717 Template = RenderHeaderButton() 4718 }; 4719 masterDesktopActionsMenu.Add(masterDesktopActionsHeaderButton); 4720 } 4721 } 47224723 @helper RenderDesktopActionsMenu() 4724 { 4725 List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopActionsMenu").OrderBy(item => item.SortId).ToList(); 47264727 <ul class="menu u-flex dw-mod"> 4728 @RenderBlockList(subBlocks) 4729 </ul> 4730 } 47314732 @helper RenderHeaderButton() 4733 { 4734 string headerButtonText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonText"); 4735 string headerButtonLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink"); 4736 string headerButtonType = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType") != null ? "btn--" + Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType").SelectedName.ToLower() : ""; 47374738 <li class="menu__item menu__item--horizontal menu--clean dw-mod"> 4739 <a class="btn @headerButtonType dw-mod u-no-margin u-margin-left" href="@headerButtonLink">@headerButtonText</a> 4740 </li> 4741 } 4742 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 47434744 @using System 4745 @using System.Web 4746 @using Dynamicweb.Core; 4747 @using System.Text.RegularExpressions 4748 @using Dynamicweb.Rapido.Blocks.Extensibility 4749 @using Dynamicweb.Rapido.Blocks 47504751 @{ 4752 Block masterDesktopActionsMenuLanguageSelector = new Block 4753 { 4754 Id = "MasterDesktopActionsMenuLanguageSelector", 4755 SortId = 40, 4756 Template = RenderLanguageSelector() 4757 }; 47584759 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuLanguageSelector); 4760 } 47614762 @helper RenderLanguageSelector() 4763 { 4764 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4765 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 4766 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4767 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() : ""; 47684769 if (Model.Languages.Count > 1) 4770 { 4771 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon is-dropdown is-dropdown--no-icon dw-mod"> 4772 <div class="@menuLinkClass dw-mod" title="@Translate("Language")"> 4773 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue fa-1_5x"></i> 4774 </div> 4775 <div class="menu menu--dropdown menu--dropdown-right languages-dropdown dw-mod grid__cell"> 4776 @foreach (var lang in Model.Languages) 4777 { 4778 string widthClass = "menu__item--fixed-width"; 4779 string langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " u-margin-right\"></span>" + lang.Name; 4780 string cultureName = Regex.Replace(Dynamicweb.Services.Areas.GetArea(lang.ID).CultureInfo.NativeName, @" ?\(.*?\)", string.Empty); 4781 cultureName = char.ToUpper(cultureName[0]) + cultureName.Substring(1); 47824783 if (languageViewType == "flag-culture") 4784 { 4785 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span> " + cultureName; 4786 } 47874788 if (languageViewType == "flag") 4789 { 4790 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span>"; 4791 widthClass = ""; 4792 } 47934794 if (languageViewType == "name") 4795 { 4796 langInfo = lang.Name; 4797 } 47984799 if (languageViewType == "culture") 4800 { 4801 langInfo = cultureName; 4802 widthClass = ""; 4803 } 48044805 <div class="menu__item dw-mod @widthClass"> 4806 <a href="/Default.aspx?AreaID=@Dynamicweb.Services.Pages.GetPage(lang.Page.ID).Area.ID" class="menu-dropdown__link dw-mod">@langInfo</a> 4807 </div> 4808 } 4809 </div> 4810 </li> 4811 } 4812 } 4813 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 48144815 @using System 4816 @using System.Web 4817 @using Dynamicweb.Rapido.Blocks.Extensibility 4818 @using Dynamicweb.Rapido.Blocks 48194820 @{ 4821 Block masterDesktopActionsMenuSignIn = new Block 4822 { 4823 Id = "MasterDesktopActionsMenuSignIn", 4824 SortId = 20, 4825 Template = RenderSignIn() 4826 }; 48274828 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuSignIn); 4829 } 48304831 @helper RenderSignIn() 4832 { 4833 bool navigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 4834 string userInitials = ""; 4835 int topPageId = Model.Area.FirstActivePage.ID; 4836 int pageId = Model.TopPage.ID; 4837 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 4838 int myDashboardPageId = GetPageIdByNavigationTag("CustomerDashboard"); 4839 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 4840 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); 4841 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 4842 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards"); 4843 int myOrderDraftsPageId = GetPageIdByNavigationTag("OrderDraft"); 4844 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 4845 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); 4846 bool hideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); 4847 bool hideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); 4848 bool hideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); 4849 bool hideMyOrderDraftsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrderDrafts"); 4850 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); 4851 bool hideForgotPasswordLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideForgotPasswordLink"); 48524853 string linkStart = "/Default.aspx?ID="; 4854 if (Model.CurrentUser.ID <= 0) 4855 { 4856 linkStart += signInProfilePageId + "&RedirectPageId="; 4857 } 48584859 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; 4860 string myProfilePageLink = linkStart + myProfilePageId; 4861 string myOrdersPageLink = linkStart + myOrdersPageId; 4862 string myFavoritesPageLink = linkStart + myFavoritesPageId; 4863 string mySavedCardsPageLink = linkStart + mySavedCardsPageId; 4864 string myOrderDraftsLink = linkStart + myOrderDraftsPageId; 48654866 string profileIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue : "fa fa-user"; 4867 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"; 4868 string orderDraftsIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("DraftIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("DraftIcon").SelectedValue : "fa fa-clipboard"; 48694870 if (Model.CurrentUser.ID != 0) 4871 { 4872 userInitials = Dynamicweb.Rapido.Services.User.GetInitials(Model.CurrentUser.Name, Model.CurrentUser.FirstName, Model.CurrentUser.LastName, Model.CurrentUser.Email, Model.CurrentUser.UserName); 4873 } 48744875 if (!navigationItemsHideSignIn) 4876 { 4877 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4878 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu__item--clean"; 4879 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 48804881 <li class="menu__item menu__item--horizontal menu__item menu__item--icon @liClasses is-dropdown is-dropdown--no-icon dw-mod"> 4882 <div class="@menuLinkClass dw-mod"> 4883 @if (Model.CurrentUser.ID <= 0) 4884 { 4885 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue fa-1_5x" title="@Translate("Sign in")"></i> 4886 } 4887 else 4888 { 4889 <a href="/default.aspx?ID=@myDashboardPageId" class="u-color-inherit" title="@Translate("Customer center")"><div class="circle-icon-btn">@userInitials.ToUpper()</div></a> 4890 } 4891 </div> 4892 <div class="menu menu--dropdown menu--dropdown-right menu--sign-in grid__cell dw-mod"> 4893 <ul class="list list--clean dw-mod"> 4894 @if (Model.CurrentUser.ID <= 0) 4895 { 4896 <li> 4897 <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> 4898 </li> 48994900 if (!hideCreateAccountLink) 4901 { 4902 @RenderListItem("/default.aspx?ID=" + createAccountPageId, Translate("Create account")); 4903 } 4904 if (!hideForgotPasswordLink) 4905 { 4906 @RenderListItem(forgotPasswordPageLink, Translate("Forgot your password?")) 4907 } 4908 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) 4909 { 4910 @RenderSeparator() 4911 } 4912 } 4913 @if (!hideMyProfileLink) 4914 { 4915 @RenderListItem(myProfilePageLink, Translate("My Profile"), profileIcon) 4916 } 4917 @if (!hideMyOrdersLink) 4918 { 4919 @RenderListItem(myOrdersPageLink, Translate("My Orders"), "fas fa-list") 4920 } 4921 @if (!hideMyFavoritesLink) 4922 { 4923 @RenderListItem(myFavoritesPageLink, Translate("My Favorites"), favoritesIcon) 4924 } 4925 @if (!hideMySavedCardsLink) 4926 { 4927 @RenderListItem(mySavedCardsPageLink, Translate("My Saved cards"), "fas fa-credit-card") 4928 } 4929 @if (!hideMyOrderDraftsLink) 4930 { 4931 @RenderListItem(myOrderDraftsLink, Translate("My Order drafts"), orderDraftsIcon) 4932 } 4933 @if (Model.CurrentUser.ID > 0) 4934 { 4935 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) 4936 { 4937 @RenderSeparator() 4938 } 49394940 //Check if impersonation is on 4941 if (Model.CurrentSecondaryUser != null && Model.CurrentSecondaryUser.ID > 0) 4942 { 4943 <li> 4944 <div class="list__link dw-mod" onclick="document.getElementById('StopImpersonationModalTrigger').checked = true;"> 4945 @Translate("Sign out") 4946 </div> 4947 </li> 4948 } else { 4949 @RenderListItem("/Admin/Public/ExtranetLogoff.aspx?ID=" + topPageId, Translate("Sign out")) 4950 } 4951 } 4952 </ul> 4953 </div> 4954 </li> 4955 } 4956 } 49574958 @helper RenderListItem(string link, string text, string icon = null) { 4959 <li> 4960 <a href="@link" class="list__link dw-mod" onclick="RememberState.SetCookie('useAnotherAddress', false)"> 4961 @if (!string.IsNullOrEmpty(icon)){<i class="@icon u-margin-right"></i>}@text 4962 </a> 4963 </li> 4964 } 49654966 @helper RenderSeparator() 4967 { 4968 <li class="list__seperator dw-mod"></li> 4969 } 4970 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 49714972 @using System 4973 @using System.Web 4974 @using Dynamicweb.Rapido.Blocks.Extensibility 4975 @using Dynamicweb.Rapido.Blocks 49764977 @{ 4978 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideFavorites"); 49794980 Block masterDesktopActionsMenuFavorites = new Block 4981 { 4982 Id = "MasterDesktopActionsMenuFavorites", 4983 SortId = 30, 4984 Template = RenderFavorites() 4985 }; 49864987 if (!hideMyFavoritesLink && Model.CurrentUser.ID > 0) 4988 { 4989 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuFavorites); 4990 } 4991 } 49924993 @helper RenderFavorites() 4994 { 4995 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 4996 string myFavoritesPageLink = "/Default.aspx?ID=" + myFavoritesPageId; 49974998 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4999 string liClasses = topLayout != "normal" && topLayout != "splitted-center" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 5000 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 50015002 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod"> 5003 <a href="@myFavoritesPageLink" class="@menuLinkClass dw-mod" title="@Translate("Favorites")"> 5004 <i class="fas fa-@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue fa-1_5x"></i> 5005 </a> 5006 </li> 5007 } 5008 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 50095010 @using System 5011 @using System.Web 5012 @using Dynamicweb.Rapido.Blocks.Extensibility 5013 @using Dynamicweb.Rapido.Blocks 5014 @using Dynamicweb.Rapido.Services 50155016 @{ 5017 bool hideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 5018 string miniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown"; 50195020 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed() && !hideCart) 5021 { 5022 Block masterDesktopActionsMenuMiniCart = new Block 5023 { 5024 Id = "MasterDesktopActionsMenuMiniCart", 5025 SortId = 60, 5026 Template = RenderMiniCart(miniCartLayout == "dropdown"), 5027 SkipRenderBlocksList = true, 5028 BlocksList = new List<Block>() 5029 }; 50305031 Block miniCartCounterScriptTemplate = new Block 5032 { 5033 Id = "MiniCartCounterScriptTemplate", 5034 Template = RenderMiniCartCounterContent() 5035 }; 50365037 //dropdown layout is default 5038 RazorEngine.Templating.TemplateWriter layoutTemplate; 5039 RazorEngine.Templating.TemplateWriter miniCartTriggerTemplate; 50405041 switch (miniCartLayout) 5042 { 5043 case "dropdown": 5044 layoutTemplate = RenderMiniCartDropdownLayout(); 5045 miniCartTriggerTemplate = RenderMiniCartTriggerLink(); 5046 break; 5047 case "panel": 5048 layoutTemplate = RenderMiniCartPanelLayout(); 5049 miniCartTriggerTemplate = RenderMiniCartTriggerLabel(); 5050 break; 5051 case "modal": 5052 layoutTemplate = RenderMiniCartModalLayout(); 5053 miniCartTriggerTemplate = RenderMiniCartTriggerLabel(); 5054 break; 5055 case "none": 5056 default: 5057 layoutTemplate = RenderMiniCartDropdownLayout(); 5058 miniCartTriggerTemplate = RenderMiniCartTriggerLink(); 5059 break; 5060 } 50615062 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block 5063 { 5064 Id = "MiniCartTrigger", 5065 Template = miniCartTriggerTemplate 5066 }); 50675068 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 5069 { 5070 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block 5071 { 5072 Id = "MiniCartLayout", 5073 Template = layoutTemplate 5074 }); 5075 } 50765077 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuMiniCart); 5078 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate); 5079 } 50805081 if (hideCart && Dynamicweb.Rapido.Services.User.IsBuyingAllowed()) 5082 { 5083 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", new Block { 5084 Id = "CartInitialization" 5085 }); 5086 } 5087 } 50885089 @helper RenderMiniCart(bool hasMouseEnterEvent) 5090 { 5091 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterDesktopActionsMenuMiniCart").OrderBy(item => item.SortId).ToList(); 5092 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5093 string liClasses = topLayout != "normal" ? "menu__item--top-level" : "menu--clean"; 5094 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 5095 string mouseEvent = ""; 5096 string id = "MiniCart"; 5097 if (hasMouseEnterEvent) 5098 { 5099 mouseEvent = "onmouseenter=\"Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=" + miniCartFeedPageId + "&feedType=MiniCart')\""; 5100 id = "miniCartTrigger"; 5101 } 5102 <li class="menu__item menu__item--horizontal menu__item--icon @liClasses dw-mod" id="@id" @mouseEvent> 5103 @RenderBlockList(subBlocks) 5104 </li> 5105 } 51065107 @helper RenderMiniCartTriggerLabel() 5108 { 5109 int cartPageId = GetPageIdByNavigationTag("CartPage"); 5110 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart"; 5111 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5112 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 5113 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 51145115 <div class="@menuLinkClass dw-mod js-mini-cart-button" onclick="Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart')" title="@Translate("Cart")"> 5116 <div class="u-inline u-position-relative"> 5117 <i class="@cartIcon fa-1_5x"></i> 5118 @RenderMiniCartCounter() 5119 </div> 5120 </div> 5121 } 51225123 @helper RenderMiniCartTriggerLink() 5124 { 5125 int cartPageId = GetPageIdByNavigationTag("CartPage"); 5126 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart"; 5127 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5128 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 51295130 <a href="/Default.aspx?ID=@cartPageId&Purge=True" class="@menuLinkClass menu__item--icon dw-mod js-mini-cart-button" title="@Translate("Cart")"> 5131 <span class="u-inline u-position-relative"> 5132 <i class="@cartIcon fa-1_5x"></i> 5133 @RenderMiniCartCounter() 5134 </span> 5135 </a> 5136 } 51375138 @helper RenderMiniCartCounter() 5139 { 5140 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 5141 string cartProductsCount = Model.Cart.TotalProductsCount.ToString(); 5142 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right"; 5143 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 5144 string cartProductsTotalPrice = showPrice && Model.Cart.TotalPrice != null ? Model.Cart.TotalPrice.Price.Formatted : ""; 5145 cartProductsTotalPrice = counterPosition == "right" ? cartProductsTotalPrice : ""; 51465147 if (showPrice && counterPosition == "right") 5148 { 5149 cartProductsCount = Translate("Cart") + " (" + cartProductsCount + ")"; 5150 } 51515152 <span class="mini-cart__counter @(counterPosition == "right" ? "mini-cart__counter--inline" : "") dw-mod"> 5153 <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"> 5154 <span class="js-mini-cart-counter-content" data-count="@Model.Cart.TotalProductsCount.ToString()"> 5155 @cartProductsCount @cartProductsTotalPrice 5156 </span> 5157 </span> 5158 </span> 5159 } 51605161 @helper RenderMiniCartCounterContent() 5162 { 5163 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 5164 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right"; 5165 bool showPriceInMiniCartCounter = Pageview.Device.ToString() != "Mobile" && counterPosition == "right" && showPrice; 51665167 <script id="MiniCartCounterContent" type="text/x-template"> 5168 {{#.}} 5169 <span class="js-mini-cart-counter-content dw-mod" data-count="{{numberofproducts}}"> 5170 @if (showPriceInMiniCartCounter) 5171 { 5172 @Translate("Cart")<text>({{numberofproducts}}) {{totalprice}}</text> 5173 } 5174 else 5175 { 5176 <text>{{numberofproducts}}</text> 5177 } 5178 </span> 5179 {{/.}} 5180 </script> 5181 } 51825183 @helper RenderMiniCartDropdownLayout() 5184 { 5185 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 5186 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage"); 51875188 <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"> 5189 <div class="mini-cart-dropdown__inner dw-mod"> 5190 <h3 class="u-ta-center dw-mod">@Translate("Shopping cart")</h3> 5191 <div class="mini-cart-dropdown__body u-flex dw-mod"> 5192 <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> 5193 </div> 5194 </div> 5195 </div> 5196 } 51975198 @helper RenderMiniCartPanelLayout() 5199 { 5200 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 5201 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage"); 52025203 <div class="mini-cart grid__cell dw-mod"> 5204 <input type="checkbox" id="miniCartTrigger" class="panel-trigger" /> 5205 <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"> 5206 <label for="miniCartTrigger" class="panel__close-btn" title="@Translate("Close panel")"><i class="fas fa-times"></i></label> 5207 <div class="panel__content u-full-width dw-mod"> 5208 <h3 class="panel__header dw-mod u-margin-bottom u-ta-center">@Translate("Shopping cart")</h3> 5209 <div class="panel__content-body panel__content-body--cart dw-mod"> 5210 <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> 5211 </div> 5212 </div> 5213 </div> 5214 </div> 5215 } 52165217 @helper RenderMiniCartModalLayout() 5218 { 5219 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 5220 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage"); 52215222 <div class="mini-cart grid__cell dw-mod"> 5223 <input type="checkbox" id="miniCartTrigger" class="modal-trigger" autocomplete="off" /> 5224 <div class="modal-container dw-mod js-mini-cart" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="block" data-cart-page-link="@cartPageLink"> 5225 <label for="miniCartTrigger" class="modal-overlay"></label> 5226 <div class="modal modal--md modal--top-right dw-mod"> 5227 <div class="modal__body u-flex grid--direction-column dw-mod"> 5228 <h3 class="dw-mod u-ta-center">@Translate("Shopping cart")</h3> 5229 <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> 5230 </div> 5231 <label class="modal__close-btn modal__close-btn--clean dw-mod" for="miniCartTrigger" title="@Translate("Close modal")"></label> 5232 </div> 5233 </div> 5234 </div> 5235 } 5236 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 52375238 @using System 5239 @using System.Web 5240 @using Dynamicweb.Rapido.Blocks.Extensibility 5241 @using Dynamicweb.Rapido.Blocks 52425243 @{ 5244 bool showOrderDraftLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowOrderDraftIcon"); 52455246 Block masterDesktopActionsMenuOrderDraft = new Block 5247 { 5248 Id = "MasterDesktopActionsMenuOrderDraft", 5249 SortId = 40, 5250 Template = RenderOrderDraft() 5251 }; 52525253 if (showOrderDraftLink && Model.CurrentUser.ID > 0) 5254 { 5255 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuOrderDraft); 5256 } 5257 } 52585259 @helper RenderOrderDraft() 5260 { 5261 int OrderDraftPageId = GetPageIdByNavigationTag("OrderDraft"); 5262 string OrderDraftPageLink = "/Default.aspx?ID=" + OrderDraftPageId; 5263 string draftIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("DraftIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("DraftIcon").SelectedValue : "fa fa-clipboard"; 526452655266 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5267 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 5268 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 52695270 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod"> 5271 <a href="@OrderDraftPageLink" class="@menuLinkClass dw-mod" title="@Translate("My order drafts")"> 5272 <span class="u-inline u-position-relative"> 5273 <i class="@draftIcon fa-1_5x"></i> 5274 </span> 5275 </a> 5276 </li> 5277 } 5278 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 52795280 @using System 5281 @using System.Web 5282 @using Dynamicweb.Rapido.Blocks.Extensibility 5283 @using Dynamicweb.Rapido.Blocks 52845285 @{ 5286 bool showDownloadCartLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart"); 52875288 Block masterDesktopActionsMenuDownloadCart = new Block 5289 { 5290 Id = "MasterDesktopActionsMenuDownloadCart", 5291 SortId = 50, 5292 Template = RenderDownloadCart() 5293 }; 52945295 if (showDownloadCartLink && Model.CurrentUser.ID > 0) 5296 { 5297 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuDownloadCart); 5298 } 5299 } 53005301 @helper RenderDownloadCart() 5302 { 5303 int downloadCartPageId = GetPageIdByNavigationTag("DownloadCart"); 5304 string downloadCartPageLink = "/Default.aspx?ID=" + downloadCartPageId; 53055306 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5307 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 5308 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 5309 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right"; 53105311 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod"> 5312 <a href="@downloadCartPageLink" class="@menuLinkClass dw-mod" title="@Translate("Download cart")"> 5313 <span class="u-inline u-position-relative"> 5314 <i class="fas fa-download fa-1_5x"></i> 5315 <span class="mini-cart__counter u-hidden @(counterPosition == "right" ? "mini-cart__counter--inline" : "") dw-mod js-download-cart-counter"></span> 5316 </span> 5317 </a> 5318 </li> 5319 } 5320 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 53215322 @using System 5323 @using System.Web 5324 @using Dynamicweb.Rapido.Blocks.Extensibility 5325 @using Dynamicweb.Rapido.Blocks 53265327 @functions { 5328 public class SearchConfiguration 5329 { 5330 public string searchFeedId { get; set; } 5331 public string searchSecondFeedId { get; set; } 5332 public int groupsFeedId { get; set; } 5333 public string resultPageLink { get; set; } 5334 public string searchPlaceholder { get; set; } 5335 public string searchType { get; set; } 5336 public string searchTemplate { get; set; } 5337 public string searchContentTemplate { get; set; } 5338 public string searchValue { get; set; } 5339 public bool showGroups { get; set; } 53405341 public SearchConfiguration() 5342 { 5343 searchFeedId = ""; 5344 searchSecondFeedId = ""; 5345 searchType = "product-search"; 5346 searchContentTemplate = ""; 5347 showGroups = true; 5348 } 5349 } 5350 } 5351 @{ 5352 Block masterSearchBar = new Block 5353 { 5354 Id = "MasterSearchBar", 5355 SortId = 40, 5356 Template = RenderSearch("bar"), 5357 Design = new Design 5358 { 5359 Size = "auto", 5360 HidePadding = true, 5361 RenderType = RenderType.Column 5362 } 5363 }; 53645365 Block masterSearchAction = new Block 5366 { 5367 Id = "MasterDesktopActionsMenuSearch", 5368 SortId = 10, 5369 Template = RenderSearch() 5370 }; 53715372 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterSearchBar); 5373 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterSearchAction); 53745375 } 53765377 @helper RenderSearch(string type = "mini-search") 5378 { 5379 string productsPageId = Converter.ToString(GetPageIdByNavigationTag("ProductsPage")); 5380 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 5381 string searchType = Model.Area.Item.GetItem("Layout").GetList("TopSearch") != null ? Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue : "productSearch"; 53825383 SearchConfiguration searchConfiguration = null; 53845385 switch (searchType) { 5386 case "contentSearch": 5387 searchConfiguration = new SearchConfiguration() { 5388 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true", 5389 resultPageLink = contentSearchPageLink, 5390 searchPlaceholder = Translate("Search page"), 5391 groupsFeedId = 0, 5392 searchType = "content-search", 5393 searchTemplate = "SearchPagesTemplate", 5394 showGroups = false 5395 }; 5396 break; 5397 case "combinedSearch": 5398 searchConfiguration = new SearchConfiguration() { 5399 searchFeedId = productsPageId + "&feed=true", 5400 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true", 5401 resultPageLink = Converter.ToString(productsPageId), 5402 searchPlaceholder = Translate("Search products or pages"), 5403 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"), 5404 searchType = "combined-search", 5405 searchTemplate = "SearchProductsTemplateWrap", 5406 searchContentTemplate = "SearchPagesTemplateWrap", 5407 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector") 5408 }; 5409 break; 5410 default: //productSearch 5411 searchConfiguration = new SearchConfiguration() { 5412 resultPageLink = Converter.ToString(productsPageId), 5413 searchFeedId = productsPageId + "&feed=true", 5414 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"), 5415 searchPlaceholder = Translate("Search products"), 5416 searchTemplate = "SearchProductsTemplate", 5417 searchType = "product-search", 5418 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector") 5419 }; 5420 break; 5421 } 5422 searchConfiguration.searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; 54235424 if (Pageview.User != null){ 5425 if (type == "mini-search") { 5426 @RenderMiniSearch(searchConfiguration) 5427 } else { 5428 @RenderSearchBar(searchConfiguration) 5429 } 5430 } 54315432 } 54335434 @helper RenderSearchBar(SearchConfiguration options) 5435 { 5436 <div class="typeahead typeahead--right u-color-inherit js-typeahead dw-mod" id="ProductSearchBar" 5437 data-page-size="7" 5438 data-search-feed-id="@options.searchFeedId" 5439 data-search-second-feed-id="@options.searchSecondFeedId" 5440 data-result-page-id="@options.resultPageLink" 5441 data-groups-page-id="@options.groupsFeedId" 5442 data-search-type="@options.searchType"> 5443 @if (options.showGroups) 5444 { 5445 <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> 5446 <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> 5447 } 5448 <div class="typeahead-search-field"> 5449 <input type="text" class="u-no-margin u-full-width u-full-height js-typeahead-search-field" placeholder="@options.searchPlaceholder" value="@options.searchValue"> 5450 @if (string.IsNullOrEmpty(options.searchSecondFeedId)) 5451 { 5452 <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> 5453 } 5454 else 5455 { 5456 <div class="dropdown dropdown--absolute-position dropdown--combined grid"> 5457 <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> 5458 <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> 5459 </div> 5460 } 5461 </div> 5462 <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> 5463 </div> 5464 } 54655466 @helper RenderMiniSearch(SearchConfiguration options) 5467 { 5468 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5469 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 54705471 <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"> 5472 <div class="@menuLinkClass dw-mod" title="@Translate("Search")"> 5473 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> 5474 </div> 5475 <div class="menu menu--dropdown menu--dropdown-right u-no-padding u-w380px grid__cell dw-mod"> 5476 <div class="typeahead js-typeahead" id="ProductSearchBar" 5477 data-page-size="7" 5478 data-search-feed-id="@options.searchFeedId" 5479 data-search-second-feed-id="@options.searchSecondFeedId" 5480 data-result-page-id="@options.resultPageLink" 5481 data-search-type="@options.searchType"> 5482 <div class="typeahead-search-field"> 5483 <input type="text" class="u-no-margin u-full-width js-typeahead-search-field" id="headerSearch" placeholder="@options.searchPlaceholder" value="@options.searchValue"> 5484 @if (string.IsNullOrEmpty(options.searchSecondFeedId)) 5485 { 5486 <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> 5487 } 5488 else 5489 { 5490 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--right-aligned"> 5491 <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> 5492 <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> 5493 </div> 5494 } 5495 </div> 5496 </div> 5497 </div> 5498 </li> 5499 } 5500 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 55015502 @using System 5503 @using System.Web 5504 @using Dynamicweb.Rapido.Blocks.Extensibility 5505 @using Dynamicweb.Rapido.Blocks 55065507 @{ 5508 string headerConfigurationTopLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5509 bool headerConfigurationHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 55105511 BlocksPage headerConfigurationPage = BlocksPage.GetBlockPage("Master"); 55125513 Block configDesktopLogo = headerConfigurationPage.GetBlockById("MasterDesktopLogo"); 5514 headerConfigurationPage.RemoveBlock(configDesktopLogo); 55155516 Block configDesktopMenu = headerConfigurationPage.GetBlockById("MasterDesktopMenu"); 5517 headerConfigurationPage.RemoveBlock(configDesktopMenu); 55185519 Block configSearchBar = headerConfigurationPage.GetBlockById("MasterSearchBar"); 5520 headerConfigurationPage.RemoveBlock(configSearchBar); 55215522 Block configSearchAction = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenuSearch"); 5523 headerConfigurationPage.RemoveBlock(configSearchAction); 55245525 Block configDesktopActionsMenu = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenu"); 5526 headerConfigurationPage.RemoveBlock(configDesktopActionsMenu); 55275528 Block configDesktopExtra = headerConfigurationPage.GetBlockById("MasterDesktopExtra"); 55295530 switch (headerConfigurationTopLayout) 5531 { 5532 case "condensed": //2 5533 configDesktopLogo.Design.Size = "auto-width"; 5534 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); 55355536 configDesktopMenu.SortId = 20; 5537 configDesktopMenu.Design.Size = "auto"; 5538 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 55395540 configDesktopActionsMenu.SortId = 30; 5541 configDesktopActionsMenu.Design.Size = "auto-width"; 5542 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 55435544 if (!headerConfigurationHideSearch) 5545 { 5546 configSearchBar.SortId = 40; 5547 configSearchBar.Design.Size = "12"; 5548 configDesktopExtra.SortId = 50; 5549 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); 5550 } 5551 break; 5552 case "splitted": //3 5553 configDesktopLogo.Design.Size = "auto"; 5554 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 55555556 if (!headerConfigurationHideSearch) 5557 { 5558 configSearchBar.SortId = 20; 5559 configSearchBar.Design.Size = "auto"; 5560 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); 5561 } 55625563 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 55645565 configDesktopActionsMenu.SortId = 20; 5566 configDesktopActionsMenu.Design.Size = "auto-width"; 5567 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 5568 break; 5569 case "splitted-center": //4 5570 configDesktopLogo.Design.Size = "auto"; 5571 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 5572 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 55735574 configDesktopActionsMenu.SortId = 30; 5575 configDesktopActionsMenu.Design.Size = "auto-width"; 5576 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopActionsMenu); 55775578 if (!headerConfigurationHideSearch) 5579 { 5580 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 5581 } 5582 break; 5583 case "minimal": //5 5584 configDesktopLogo.Design.Size = "auto-width"; 5585 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); 55865587 configDesktopMenu.Design.Size = "auto"; 5588 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 55895590 configDesktopActionsMenu.SortId = 20; 5591 configDesktopActionsMenu.Design.Size = "auto-width"; 5592 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 55935594 if (!headerConfigurationHideSearch) 5595 { 5596 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 5597 } 5598 break; 5599 case "minimal-center": //6 5600 configDesktopLogo.Design.Size = "auto-width"; 5601 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); 56025603 configDesktopMenu.Design.Size = "auto"; 5604 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 56055606 configDesktopActionsMenu.SortId = 20; 5607 configDesktopActionsMenu.Design.Size = "auto-width"; 5608 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 56095610 if (!headerConfigurationHideSearch) 5611 { 5612 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 5613 } 5614 break; 5615 case "minimal-right": //7 5616 configDesktopLogo.Design.Size = "auto-width"; 5617 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); 56185619 configDesktopMenu.Design.Size = "auto"; 5620 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 56215622 configDesktopActionsMenu.SortId = 20; 5623 configDesktopActionsMenu.Design.Size = "auto-width"; 5624 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 56255626 if (!headerConfigurationHideSearch) 5627 { 5628 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 5629 } 5630 break; 5631 case "two-lines": //8 5632 configDesktopLogo.Design.Size = "auto"; 5633 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 56345635 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 56365637 configDesktopActionsMenu.SortId = 20; 5638 configDesktopActionsMenu.Design.Size = "auto-width"; 5639 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 56405641 if (!headerConfigurationHideSearch) 5642 { 5643 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 5644 } 5645 break; 5646 case "two-lines-centered": //9 5647 configDesktopLogo.Design.Size = "auto"; 5648 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 56495650 configDesktopMenu.Design.Size = "auto-width"; 5651 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 56525653 configDesktopActionsMenu.SortId = 20; 5654 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 56555656 if (!headerConfigurationHideSearch) 5657 { 5658 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 5659 } 5660 break; 5661 case "normal": //1 5662 default: 5663 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 56645665 if (!headerConfigurationHideSearch) 5666 { 5667 configSearchBar.SortId = 20; 5668 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); 5669 } 56705671 configDesktopActionsMenu.SortId = 30; 5672 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopActionsMenu); 56735674 configDesktopActionsMenu.Design.Size = "auto-width"; 5675 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5676 break; 5677 } 5678 } 5679 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 56805681 @using System 5682 @using System.Web 5683 @using Dynamicweb.Rapido.Blocks.Extensibility 5684 @using Dynamicweb.Rapido.Blocks 56855686 @{ 56875688 } 568956905691 @helper RenderDesktopTools() 5692 { 5693 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopTools").OrderBy(item => item.SortId).ToList(); 56945695 <div class="tools-navigation dw-mod"> 5696 <div class="center-container grid top-container__center-container dw-mod"> 5697 @RenderBlockList(subBlocks) 5698 </div> 5699 </div> 5700 } 57015702 @helper RenderDesktopToolsText() 5703 { 5704 string toolsText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("ToolsText"); 5705 if (!string.IsNullOrEmpty(toolsText)) 5706 { 5707 <div class="u-margin-top u-margin-bottom">@toolsText</div> 5708 } 5709 } 57105711 @helper RenderDesktopToolsNavigation() 5712 { 5713 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 57145715 if (renderPagesInToolBar) 5716 { 5717 @RenderNavigation(new 5718 { 5719 id = "topToolsNavigation", 5720 cssclass = "menu menu-tools dw-mod dwnavigation", 5721 template = "TopMenu.xslt" 5722 }) 5723 } 5724 } 57255726 @helper RenderDesktopNavigation() 5727 { 5728 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopNavigation").OrderBy(item => item.SortId).ToList(); 5729 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5730 string alignClass = topLayout == "two-lines-centered" ? "grid--justify-center" : ""; 5731 <nav class="main-navigation dw-mod"> 5732 <div class="center-container top-container__center-container grid @alignClass dw-mod"> 5733 @RenderBlockList(subBlocks) 5734 </div> 5735 </nav> 5736 } 57375738 @helper RenderDesktopExtra() 5739 { 5740 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopExtra").OrderBy(item => item.SortId).ToList(); 57415742 if (subBlocks.Count > 0) 5743 { 5744 <div class="header header-top dw-mod"> 5745 <div class="center-container top-container__center-container grid--justify-space-between grid grid--align-center dw-mod"> 5746 @RenderBlockList(subBlocks) 5747 </div> 5748 </div> 5749 } 5750 }</text> 5751 } 57525753 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 57545755 @using System 5756 @using System.Web 5757 @using Dynamicweb.Rapido.Blocks.Extensibility 5758 @using Dynamicweb.Rapido.Blocks 5759 @using Dynamicweb.Rapido.Blocks.Components.General 5760 @using Dynamicweb.Frontend 57615762 @functions { 5763 int impersonationPageId; 5764 string impersonationLayout; 5765 int impersonationFeed; 5766 Block impersonationBar; 57675768 string getUserNameFromParams(string firstName, string middleName, string lastName, string name, string email, string userName) 5769 { 5770 string username = ""; 57715772 if (!string.IsNullOrEmpty(firstName) && !string.IsNullOrEmpty(lastName)) 5773 { 5774 username = firstName + " " + (!string.IsNullOrEmpty(middleName) ? middleName + " " : "") + lastName; 5775 } 5776 else if (!string.IsNullOrEmpty(name)) 5777 { 5778 username = name; 5779 } 5780 else if (!string.IsNullOrEmpty(email)) 5781 { 5782 username = email; 5783 } 5784 else 5785 { 5786 username = userName; 5787 } 5788 return username; 5789 } 57905791 string getUserName(UserViewModel user) 5792 { 5793 return getUserNameFromParams(user.FirstName, user.MiddleName, user.LastName, user.Name, user.Email, user.UserName); 5794 } 57955796 string getUserName(Dynamicweb.Security.UserManagement.User user) 5797 { 5798 return getUserNameFromParams(user.FirstName, user.MiddleName, user.LastName, user.Name, user.Email, user.UserName); 5799 } 5800 } 58015802 @{ 5803 impersonationPageId = GetPageIdByNavigationTag("Impersonation"); 5804 impersonationLayout = Model.Area.Item.GetItem("Ecommerce").GetList("ImpersonationLayout") != null ? Model.Area.Item.GetItem("Ecommerce").GetList("ImpersonationLayout").SelectedValue : "bar"; 5805 impersonationFeed = GetPageIdByNavigationTag("UsersFeed"); 58065807 if (Model.CurrentUser.ID > 0 && Model.SecondaryUsers.Count > 0) 5808 { 5809 impersonationBar = new Block 5810 { 5811 Id = "ImpersonationBar", 5812 SortId = 50, 5813 Template = RenderImpersonation(), 5814 SkipRenderBlocksList = true, 5815 Design = new Design 5816 { 5817 Size = "auto-width", 5818 HidePadding = true, 5819 RenderType = RenderType.Column 5820 } 5821 }; 58225823 if (impersonationLayout == "top-bar") { 5824 impersonationBar.SortId = 9; 5825 } 58265827 Block impersonationContent = new Block 5828 { 5829 Id = "ImpersonationContent", 5830 SortId = 20 5831 }; 58325833 if (Model.CurrentSecondaryUser != null && Model.CurrentSecondaryUser.ID > 0) 5834 { 5835 //Render stop impersonation view 5836 impersonationContent.Template = RenderStopImpersonationView(); 583758385839 Modal stopImpersonation = new Modal 5840 { 5841 Id = "StopImpersonation", 5842 Heading = new Heading { 5843 Level = 2, 5844 Title = Translate("Sign out"), 5845 Icon = new Icon { 5846 Name = "fa-sign-out", 5847 Prefix = "fas", 5848 LabelPosition = IconLabelPosition.After 5849 } 5850 }, 5851 Width = ModalWidth.Sm, 5852 BodyTemplate = RenderStopImpersonationForm() 5853 }; 58545855 Block stopImpersonationBlock = new Block 5856 { 5857 Id = "StopImpersonationBlock", 5858 SortId = 10, 5859 Component = stopImpersonation 5860 }; 5861 impersonationBar.BlocksList.Add(stopImpersonationBlock); 5862 } 5863 else 5864 { 5865 //Render main view 5866 switch (impersonationLayout) 5867 { 5868 case "right-lower-box": 5869 impersonationContent.BlocksList.Add( 5870 new Block { 5871 Id = "RightLowerBoxHeader", 5872 SortId = 10, 5873 Component = new Heading { 5874 Level = 5, 5875 Title = Translate("View the list of users you can sign in as"), 5876 CssClass = "impersonation-text" 5877 } 5878 } 5879 ); 5880 impersonationContent.BlocksList.Add( 5881 new Block { 5882 Id = "RightLowerBoxContent", 5883 SortId = 20, 5884 Template = RenderImpersonationControls() 5885 } 5886 ); 5887 break; 5888 case "right-lower-bar": 5889 impersonationContent.BlocksList.Add( 5890 new Block { 5891 Id = "RightLowerBarContent", 5892 SortId = 10, 5893 Template = RenderImpersonationControls() 5894 } 5895 ); 5896 break; 5897 case "bar": 5898 default: 5899 impersonationContent.BlocksList.Add( 5900 new Block { 5901 Id = "ViewListLink", 5902 SortId = 20, 5903 Template = RenderViewListLink() 5904 } 5905 ); 5906 impersonationContent.BlocksList.Add( 5907 new Block { 5908 Id = "BarTypeaheadSearch", 5909 SortId = 30, 5910 Template = RenderTypeaheadSearch() 5911 } 5912 ); 5913 break; 5914 } 5915 } 5916 impersonationBar.BlocksList.Add(impersonationContent); 59175918 impersonationBar.BlocksList.Add( 5919 new Block 5920 { 5921 Id = "ImpersonationSearchTemplates", 5922 SortId = 30, 5923 Template = RenderSearchResultTemplate() 5924 } 5925 ); 5926 if (impersonationLayout != "bar" && impersonationLayout != "top-bar") 5927 { 5928 impersonationBar.BlocksList.Add( 5929 new Block 5930 { 5931 Id = "ImpersonationSearchScripts", 5932 SortId = 40, 5933 Template = RenderSearchScripts() 5934 } 5935 ); 5936 } 5937 BlocksPage.GetBlockPage("Master").Add("MasterHeader", impersonationBar); 5938 } 5939 } 59405941 @helper RenderImpersonation() 5942 { 5943 List<Block> subBlocks = impersonationBar.BlocksList.OrderBy(item => item.SortId).ToList(); 5944 <input type="checkbox" class="impersonation-trigger js-remember-state" id="ImpersonationMinimizeTrigger" /> 5945 <div class="impersonation impersonation--@(impersonationLayout)-layout dw-mod" id="Impersonation"> 5946 @if (impersonationLayout == "right-lower-box") 5947 { 5948 @RenderRightLowerBoxHeader() 5949 } 5950 <div class="center-container top-container__center-container impersonation__container @(impersonationLayout != "bar" && impersonationLayout != "top-bar" ? "impersonation__container--box" : "") dw-mod"> 5951 @*Impersonation*@ 5952 @RenderBlockList(subBlocks) 5953 </div> 5954 </div> 5955 } 59565957 @helper RenderRightLowerBoxHeader() 5958 { 5959 <div class="impersonation__header dw-mod"> 5960 <div class="impersonation__title">@Translate("Impersonation")</div> 5961 <label for="ImpersonationMinimizeTrigger" class="btn btn--impersonation impersonation__minimize-btn dw-mod" onclick="this.blur();"> 5962 @Render(new Icon 5963 { 5964 Prefix = "fas", 5965 Name = "fa-window-minimize" 5966 }) 5967 </label> 5968 </div> 5969 } 59705971 @helper RenderStopImpersonationView() 5972 { 5973 string secondaryUserName = getUserName(Model.CurrentSecondaryUser); 5974 string userName = getUserName(Pageview.User); 5975 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> "; 5976 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; 59775978 if (impersonationLayout == "right-lower-box") 5979 { 5980 <div class="u-margin-bottom--lg u-ta-center"> 5981 @impersonationText 5982 </div> 5983 <div class="u-margin-bottom--lg u-ta-center"> 5984 @RenderSwitchAccountButton() 5985 </div> 5986 @RenderStopImpersonationButton() 5987 } 5988 else 5989 { 5990 <div class="grid grid--align-center impersonation__stop-wrap"> 5991 <div class="impersonation-bar-item dw-mod"> 5992 @impersonationText 5993 </div> 5994 <div class="impersonation-bar-item dw-mod"> 5995 @RenderSwitchAccountButton() 5996 </div> 5997 <div class="impersonation-bar-item dw-mod"> 5998 @RenderStopImpersonationButton() 5999 </div> 6000 </div> 6001 } 6002 } 60036004 @helper RenderSwitchAccountButton() { 6005 @Render(new Button 6006 { 6007 Href = "/Default.aspx?ID=" + impersonationPageId, 6008 ButtonType = ButtonType.Button, 6009 ButtonLayout = ButtonLayout.Clean, 6010 Title = Translate("Switch account"), 6011 Icon = new Icon { 6012 Name = "fa-users", 6013 Prefix = "fal", 6014 LabelPosition = IconLabelPosition.After 6015 }, 6016 CssClass = "u-no-margin u-color-inherit" 6017 }) 6018 } 60196020 @helper RenderStopImpersonationForm() 6021 { 6022 string secondaryUserName = getUserName(Model.CurrentSecondaryUser); 6023 string userName = getUserName(Pageview.User); 6024 int pageId = Model.TopPage.ID; 60256026 <form method="post" class="u-no-margin"> 6027 @Render(new Button 6028 { 6029 ButtonType = ButtonType.Submit, 6030 ButtonLayout = ButtonLayout.Secondary, 6031 Title = Translate("Sign out as") + " " + userName, 6032 Href = "/Default.aspx?ID=" + impersonationPageId, 6033 CssClass = "btn--full", 6034 Name = "DwExtranetRemoveSecondaryUser" 6035 }) 60366037 @Render(new Button 6038 { 6039 ButtonType = ButtonType.Submit, 6040 ButtonLayout = ButtonLayout.Secondary, 6041 Title = Translate("Sign out as") + " " + secondaryUserName, 6042 Href = "/Admin/Public/ExtranetLogoff.aspx?ID=" + pageId, 6043 CssClass = "btn--full", 6044 Name = "DwExtranetRemoveSecondaryUser" 6045 }) 6046 </form> 6047 } 60486049 @helper RenderStopImpersonationButton() { 6050 @Render(new Button 6051 { 6052 ButtonType = ButtonType.Button, 6053 ButtonLayout = ButtonLayout.Clean, 6054 Title = Translate("Sign out"), 6055 Icon = new Icon { 6056 Name = "fa-sign-out", 6057 Prefix = "fal", 6058 LabelPosition = IconLabelPosition.After 6059 }, 6060 OnClick = "document.getElementById('StopImpersonationModalTrigger').checked = true", 6061 CssClass = "u-no-margin" 6062 }) 6063 } 60646065 @helper RenderImpersonationControls() 6066 { 6067 <div class="impersonation__controls"> 6068 @RenderViewListLink() 6069 @RenderSearchBox() 6070 </div> 6071 @RenderResultsList() 6072 } 60736074 @helper RenderViewListLink() 6075 { 6076 string title = impersonationLayout == "right-lower-box" ? Translate("View the list") : Translate("View the list of users you can sign in as"); 6077 string buttonClasses = impersonationLayout == "right-lower-box" ? "impersonation__button btn btn--impersonation" : "impersonation__link impersonation__link"; 60786079 @Render(new Link { 6080 ButtonLayout = ButtonLayout.None, 6081 Title = title, 6082 Href = "/Default.aspx?ID=" + impersonationPageId, 6083 CssClass = buttonClasses 6084 }) 6085 } 60866087 @helper RenderSearchBox() 6088 { 6089 <div class="impersonation__search-wrap"> 6090 <input placeholder="@Translate("Search users")" type="text" class="impersonation__search-field dw-mod" onkeyup="searchKeyUpHandler(event)" id="ImpersonationBoxSearchField"> 6091 <div id="ImpersonationBoxSearchFind" class="impersonation__search-icon dw-mod" onclick="updateResults(document.getElementById('ImpersonationBoxSearchField').value)"> 6092 <i class="fal fa-search"></i> 6093 </div> 6094 <div id="ImpersonationBoxSearchClear" class="impersonation__search-icon u-hidden dw-mod" onclick="clearResults();"> 6095 <i class="fal fa-times"></i> 6096 </div> 6097 </div> 6098 } 60996100 @helper RenderTypeaheadSearch() 6101 { 6102 <div class="typeahead u-ta-right impersonation__typeahead js-typeahead dw-mod" id="ImpersonationSearchBar" 6103 data-page-size="5" 6104 data-search-feed-id="@impersonationFeed" 6105 data-result-page-id="@impersonationPageId" 6106 data-search-type="user-search" 6107 data-search-parameter-name="q"> 61086109 <div class="typeahead-search-field"> 6110 <input type="text" class="u-no-margin u-full-width js-typeahead-search-field" placeholder="@Translate("Search users")"> 6111 <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> 6112 </div> 6113 </div> 6114 } 61156116 @helper RenderResultsList() 6117 { 6118 <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> 6119 } 61206121 @helper RenderSearchResultTemplate() 6122 { 6123 <script id="ImpersonationSearchResult" type="text/x-template"> 6124 {{#.}} 6125 {{#Users}} 6126 <li class="impersonation__search-results-item impersonation-user"> 6127 <form method="post" class="impersonation-user__form" name="account{{id}}"> 6128 <input type="hidden" id="DWExtranetSecondaryUserSelector" name="DWExtranetSecondaryUserSelector" value="{{id}}"> 6129 <div class="impersonation-user__info"> 6130 <div class="impersonation-user__name">{{userName}}</div> 6131 <div class="impersonation-user__number">{{customerNumber}}</div> 6132 </div> 6133 @Render(new Button 6134 { 6135 ButtonType = ButtonType.Submit, 6136 ButtonLayout = ButtonLayout.Secondary, 6137 Title = Translate("Sign in as"), 6138 CssClass = "impersonation-user__sign-in-btn" + (impersonationLayout != "bar" ? " btn--impersonation" : "") 6139 }) 6140 </form> 6141 </li> 6142 {{/Users}} 6143 {{#unless Users}} 6144 <li class="impersonation__search-results-item impersonation__search-results-item--not-found"> 6145 @Translate("Your search gave 0 results") 6146 </li> 6147 {{/unless}} 6148 {{/.}} 6149 </script> 6150 } 61516152 @helper RenderSearchScripts() 6153 { 6154 <script> 6155 let inputDelayTimer; 6156 function searchKeyUpHandler(e) { 6157 clearTimeout(inputDelayTimer); 6158 let value = e.target.value; 6159 if (value != "") { 6160 inputDelayTimer = setTimeout(function () { 6161 updateResults(value); 6162 }, 500); 6163 } else { 6164 clearResults(); 6165 } 6166 }; 61676168 function updateResults(value) { 6169 if (value == "") { 6170 return null; 6171 } 6172 HandlebarsBolt.UpdateContent("ImpersonationBoxSearchResults", "/Default.aspx?ID=@impersonationFeed&q=" + value); 6173 document.getElementById("ImpersonationBoxSearchFind").classList.add("u-hidden"); 6174 document.getElementById("ImpersonationBoxSearchClear").classList.remove("u-hidden"); 6175 } 61766177 function clearResults() { 6178 document.getElementById("ImpersonationBoxSearchField").value = ""; 6179 HandlebarsBolt.CleanContainer("ImpersonationBoxSearchResults"); 6180 document.getElementById("ImpersonationBoxSearchFind").classList.remove("u-hidden"); 6181 document.getElementById("ImpersonationBoxSearchClear").classList.add("u-hidden"); 6182 } 6183 </script> 6184 } 6185 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 61866187 @using System 6188 @using System.Web 6189 @using System.Collections.Generic 6190 @using Dynamicweb.Rapido.Blocks.Extensibility 6191 @using Dynamicweb.Rapido.Blocks 61926193 @{ 6194 BlocksPage miniCartBlocksPage = BlocksPage.GetBlockPage("Master"); 6195 string orderlinesView = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView").SelectedValue : "table"; 61966197 Block orderLines = new Block 6198 { 6199 Id = "MiniCartOrderLines", 6200 SkipRenderBlocksList = true, 6201 BlocksList = new List<Block> 6202 { 6203 new Block { 6204 Id = "MiniCartOrderLinesList", 6205 SortId = 20, 6206 Template = RenderMiniCartOrderLinesList() 6207 } 6208 } 6209 }; 62106211 Block orderlinesScriptTemplates = new Block 6212 { 6213 Id = "OrderlinesScriptTemplates" 6214 }; 62156216 if (orderlinesView == "table") 6217 { 6218 orderLines.Template = RenderMiniCartOrderLinesTable(); 6219 orderLines.BlocksList.Add( 6220 new Block 6221 { 6222 Id = "MiniCartOrderlinesTableHeader", 6223 SortId = 10, 6224 Template = RenderMiniCartOrderLinesHeader() 6225 } 6226 ); 62276228 orderlinesScriptTemplates.Template = RenderMiniCartScriptsTableTemplates(); 6229 } 6230 else 6231 { 6232 orderLines.Template = RenderMiniCartOrderLinesBlocks(); 6233 orderlinesScriptTemplates.Template = RenderMiniCartScriptsListTemplates(); 6234 } 62356236 miniCartBlocksPage.Add("MasterBottomSnippets", orderlinesScriptTemplates); 62376238 Block miniCartScriptTemplates = new Block() 6239 { 6240 Id = "MasterMiniCartTemplates", 6241 SortId = 1, 6242 Template = RenderMiniCartScriptTemplates(), 6243 SkipRenderBlocksList = true, 6244 BlocksList = new List<Block> 6245 { 6246 orderLines, 6247 new Block { 6248 Id = "MiniCartFooter", 6249 Template = RenderMiniCartFooter(), 6250 SortId = 50, 6251 SkipRenderBlocksList = true, 6252 BlocksList = new List<Block> 6253 { 6254 new Block { 6255 Id = "MiniCartSubTotal", 6256 Template = RenderMiniCartSubTotal(), 6257 SortId = 30 6258 }, 6259 new Block { 6260 Id = "MiniCartFees", 6261 Template = RenderMiniCartFees(), 6262 SortId = 40 6263 }, 6264 new Block { 6265 Id = "MiniCartPoints", 6266 Template = RenderMiniCartPoints(), 6267 SortId = 50 6268 }, 6269 new Block { 6270 Id = "MiniCartTotal", 6271 Template = RenderMiniCartTotal(), 6272 SortId = 60 6273 }, 6274 new Block { 6275 Id = "MiniCartDisclaimer", 6276 Template = RenderMiniCartDisclaimer(), 6277 SortId = 70 6278 }, 6279 new Block { 6280 Id = "MiniCartActions", 6281 Template = RenderMiniCartActions(), 6282 SortId = 80 6283 } 6284 } 6285 } 6286 } 6287 }; 62886289 miniCartBlocksPage.Add("MasterBottomSnippets", miniCartScriptTemplates); 6290 } 62916292 @helper RenderMiniCartScriptsTableTemplates() 6293 { 6294 <script id="MiniCartOrderline" type="text/x-template"> 6295 {{#unless isEmpty}} 6296 <tr> 6297 <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> 6298 <td class="u-va-middle"> 6299 <a href="{{link}}" class="mini-cart-orderline__name" title="{{name}}">{{name}}</a> 6300 {{#if variantname}} 6301 <a href="{{link}}" class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{variantname}}</a> 6302 {{/if}} 6303 {{#if unitname}} 6304 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{unitname}}</div> 6305 {{/if}} 6306 </td> 6307 <td class="u-ta-right u-va-middle">{{quantity}}</td> 6308 <td class="u-ta-right u-va-middle"> 6309 {{#if pointsTotal}} 6310 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 6311 {{else}} 6312 {{totalprice}} 6313 {{/if}} 6314 </td> 6315 </tr> 6316 {{/unless}} 6317 </script> 63186319 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 6320 {{#unless isEmpty}} 6321 <tr class="table__row--no-border"> 6322 <td class="u-w60px">&nbsp;</td> 6323 <td><div class="mini-cart-orderline__name dw-mod">{{name}}</div></td> 6324 <td class="u-ta-right">&nbsp;</td> 6325 <td class="u-ta-right">{{totalprice}}</td> 6326 </tr> 6327 {{/unless}} 6328 </script> 6329 } 63306331 @helper RenderMiniCartScriptsListTemplates() 6332 { 6333 int cartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 63346335 <script id="MiniCartOrderline" type="text/x-template"> 6336 {{#unless isEmpty}} 6337 <div class="mini-cart-orderline grid dw-mod"> 6338 <div class="grid__col-4"> 6339 <a href="{{link}}" class="{{hideimage}}"> 6340 <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}}"> 6341 </a> 6342 </div> 6343 <div class="grid__col-8"> 6344 <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> 6345 {{#if variantname}} 6346 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Variant"): {{variantname}}</div> 6347 {{/if}} 6348 {{#if unitname}} 6349 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Unit"): {{unitname}}</div> 6350 {{/if}} 6351 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Qty"): {{quantity}}</div> 63526353 <div class="grid__cell-footer"> 6354 <div class="grid__cell"> 6355 <div class="u-pull--left mini-cart-orderline__price dw-mod"> 6356 {{#if pointsTotal}} 6357 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 6358 {{else}} 6359 {{totalprice}} 6360 {{/if}} 6361 </div> 6362 <button type="button" 6363 title="@Translate("Remove orderline")" 6364 class="btn btn--clean btn--condensed u-pull--right mini-cart-orderline__remove-btn dw-mod" 6365 onclick="{{#if googleImpression}}googleImpressionRemoveFromCart({{googleImpression}});{{/if}}Cart.UpdateCart('miniCartContent', '/Default.aspx?ID=@cartFeedPageId', 'CartCmd=DelOrderLine&key={{orderLineId}}&redirect=false', true);">@Translate("Remove")</button> 6366 </div> 6367 </div> 6368 </div> 6369 </div> 6370 {{/unless}} 6371 </script> 63726373 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 6374 {{#unless isEmpty}} 6375 <div class="mini-cart-orderline mini-cart-orderline--discount grid dw-mod"> 6376 <div class="grid__col-4"> 6377 <div class="mini-cart-orderline__name mini-cart-orderline__name dw-mod">{{name}}</div> 6378 </div> 6379 <div class="grid__col-8">{{totalprice}}</div> 6380 </div> 6381 {{/unless}} 6382 </script> 6383 } 63846385 @helper RenderMiniCartScriptTemplates() 6386 { 6387 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMiniCartTemplates").OrderBy(item => item.SortId).ToList(); 6388 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 6389 string cartPageLink = string.Concat("/Default.aspx?ID=", GetPageIdByNavigationTag("CartPage")); 6390 bool miniCartUseGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 63916392 <script id="MiniCartContent" type="text/x-template"> 6393 {{#.}} 6394 {{#unless isEmpty}} 6395 @if (miniCartUseGoogleTagManager) 6396 { 6397 <text>{{{googleEnchantImpressionEmptyCart OrderLines}}}</text> 6398 } 6399 @RenderBlockList(subBlocks) 6400 {{/unless}} 6401 {{/.}} 6402 </script> 6403 } 64046405 @helper RenderMiniCartOrderLinesTable() 6406 { 6407 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList(); 64086409 <div class="u-overflow-auto"> 6410 <table class="table mini-cart-table dw-mod"> 6411 @RenderBlockList(subBlocks) 6412 </table> 6413 </div> 6414 } 64156416 @helper RenderMiniCartOrderLinesBlocks() 6417 { 6418 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList(); 64196420 <div class="u-overflow-auto"> 6421 @RenderBlockList(subBlocks) 6422 </div> 6423 } 64246425 @helper RenderMiniCartOrderLinesHeader() 6426 { 6427 <thead> 6428 <tr> 6429 <td>&nbsp;</td> 6430 <td>@Translate("Product")</td> 6431 <td class="u-ta-right">@Translate("Qty")</td> 6432 <td class="u-ta-right" width="120">@Translate("Price")</td> 6433 </tr> 6434 </thead> 6435 } 64366437 @helper RenderMiniCartOrderLinesList() 6438 { 6439 <text> 6440 {{#OrderLines}} 6441 {{#ifCond template "===" "CartOrderline"}} 6442 {{>MiniCartOrderline}} 6443 {{/ifCond}} 6444 {{#ifCond template "===" "CartOrderlineMobile"}} 6445 {{>MiniCartOrderline}} 6446 {{/ifCond}} 6447 {{#ifCond template "===" "CartOrderlineDiscount"}} 6448 {{>MiniCartOrderlineDiscount}} 6449 {{/ifCond}} 6450 {{/OrderLines}} 6451 </text> 6452 } 64536454 @helper RenderMiniCartFees() 6455 { 6456 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 6457 if (!pointShop) 6458 { 6459 <text> 6460 {{#unless hidePaymentfee}} 6461 <div class="grid"> 6462 <div class="grid__col-6 grid__col--bleed-y"> 6463 {{paymentmethod}} 6464 </div> 6465 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{paymentfee}}</div> 6466 </div> 6467 {{/unless}} 6468 </text> 6469 } 6470 <text> 6471 {{#unless hideShippingfee}} 6472 <div class="grid"> 6473 <div class="grid__col-6 grid__col--bleed-y"> 6474 {{shippingmethod}} 6475 </div> 6476 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{shippingfee}}</div> 6477 </div> 6478 {{/unless}} 6479 </text> 6480 <text> 6481 {{#if hasTaxSettings}} 6482 <div class="grid"> 6483 <div class="grid__col-6 grid__col--bleed-y">@Translate("Sales Tax")</div> 6484 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{totaltaxes}}</div> 6485 </div> 6486 {{/if}} 6487 </text> 6488 } 64896490 @helper RenderMiniCartFooter() 6491 { 6492 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartFooter").OrderBy(item => item.SortId).ToList(); 64936494 <div class="mini-cart__footer u-border-top u-padding-top dw-mod"> 6495 @RenderBlockList(subBlocks) 6496 </div> 6497 } 64986499 @helper RenderMiniCartActions() 6500 { 6501 int cartPageId = GetPageIdByNavigationTag("CartPage"); 65026503 <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> 6504 <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> 6505 } 65066507 @helper RenderMiniCartPoints() 6508 { 6509 <text> 6510 {{#if earnings}} 6511 <div class="grid"> 6512 <div class="grid__col-6 grid__col--bleed-y">@Translate("Earnings")</div> 6513 <div class="grid__col-6 grid__col--bleed-y grid--align-end"> 6514 <div> 6515 <span class="u-color--loyalty-points">{{earnings}}</span> @Translate("points") 6516 </div> 6517 </div> 6518 </div> 6519 {{/if}} 6520 </text> 6521 } 65226523 @helper RenderMiniCartSubTotal() 6524 { 6525 bool hasTaxSettings = Dynamicweb.Rapido.Services.Countries.HasTaxSettings(Model.Cart.ID); 6526 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 6527 if (!pointShop) 6528 { 6529 <text> 6530 {{#unless hideSubTotal}} 6531 <div class="grid dw-mod u-bold"> 6532 <div class="grid__col-6 grid__col--bleed-y">@Translate("Subtotal")</div> 6533 <div class="grid__col-6 grid__col--bleed-y grid--align-end"> 6534 @if (hasTaxSettings) 6535 { 6536 <text>{{subtotalpricewithouttaxes}}</text> 6537 } 6538 else 6539 { 6540 <text>{{subtotalprice}}</text> 6541 } 6542 </div> 6543 </div> 6544 {{/unless}} 6545 </text> 6546 } 6547 } 65486549 @helper RenderMiniCartTotal() 6550 { 6551 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 65526553 <div class="mini-cart-totals grid u-border-top u-margin-top dw-mod"> 6554 <div class="grid__col-6">@Translate("Total")</div> 6555 <div class="grid__col-6 grid--align-end"> 6556 <div> 6557 @if (pointShop) 6558 { 6559 <span class="u-color--loyalty-points">{{pointsUsedInCart}}</span> @Translate("points") 6560 } 6561 else 6562 { 6563 <text>{{totalprice}}</text> 6564 } 6565 </div> 6566 </div> 6567 </div> 6568 } 65696570 @helper RenderMiniCartDisclaimer() 6571 { 6572 <text> 6573 {{#if showCheckoutDisclaimer}} 6574 <div class="grid u-margin-bottom u-ta-right"> 6575 <small class="grid__col-12">{{checkoutDisclaimer}}</small> 6576 </div> 6577 {{/if}} 6578 </text> 6579 } 6580 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 65816582 @using Dynamicweb.Rapido.Blocks.Extensibility 6583 @using Dynamicweb.Rapido.Blocks 6584 @using Dynamicweb.Rapido.Blocks.Components.General 6585 @using Dynamicweb.Rapido.Blocks.Components 6586 @using Dynamicweb.Rapido.Services 65876588 @{ 6589 string addToCartNotificationType = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType").SelectedValue : ""; 6590 string addToCartNotificationMiniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown"; 6591 bool addToCartHideCartIcon = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 65926593 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed() && !string.IsNullOrEmpty(addToCartNotificationType)) 6594 { 6595 if (addToCartNotificationType == "modal") 6596 { 6597 Block addToCartNotificationModal = new Block 6598 { 6599 Id = "AddToCartNotificationModal", 6600 Template = RenderAddToCartNotificationModal() 6601 }; 66026603 Block addToCartNotificationScript = new Block 6604 { 6605 Id = "AddToCartNotificationScript", 6606 Template = RenderAddToCartNotificationModalScript() 6607 }; 6608 BlocksPage.GetBlockPage("Master").Add("MasterTopSnippets", addToCartNotificationModal); 6609 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript); 6610 } 6611 else if (addToCartNotificationType == "toggle" && addToCartNotificationMiniCartLayout != "none" && !addToCartHideCartIcon && Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 6612 { 6613 Block addToCartNotificationScript = new Block 6614 { 6615 Id = "AddToCartNotificationScript", 6616 Template = RenderAddToCartNotificationToggleScript() 6617 }; 6618 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript); 6619 } 6620 } 6621 } 66226623 @helper RenderAddToCartNotificationModal() 6624 { 6625 <div id="LastAddedProductModal" data-template="LastAddedProductTemplate"></div> 6626 } 66276628 @helper RenderAddToCartNotificationModalScript() 6629 { 6630 int cartPageId = GetPageIdByNavigationTag("DownloadCart"); 66316632 <script id="LastAddedProductTemplate" type="text/x-template"> 6633 @{ 66346635 Modal lastAddedProduct = new Modal 6636 { 6637 Id = "LastAddedProduct", 6638 Heading = new Heading 6639 { 6640 Level = 2, 6641 Title = Translate("Product is added to the cart") 6642 }, 6643 Width = ModalWidth.Md, 6644 BodyTemplate = RenderModalContent() 6645 }; 66466647 lastAddedProduct.AddActions( 6648 new Button 6649 { 6650 ButtonType = ButtonType.Button, 6651 ButtonLayout = ButtonLayout.Secondary, 6652 Title = Translate("Continue shopping"), 6653 CssClass = "u-pull--left u-no-margin btn--sm", 6654 OnClick = "document.getElementById('LastAddedProductModalTrigger').checked = false" 6655 }, 6656 new Link 6657 { 6658 Href = "/Default.aspx?ID=" + cartPageId, 6659 ButtonLayout = ButtonLayout.Secondary, 6660 CssClass = "u-pull--right u-no-margin btn--sm", 6661 Title = Translate("Proceed to checkout"), 6662 OnClick = "document.getElementById('LastAddedProductModalTrigger').checked = false" 6663 } 6664 ); 66656666 @Render(lastAddedProduct) 6667 } 6668 </script> 6669 <script> 6670 document.addEventListener('addToCart', function (event) { 6671 Cart.ShowLastAddedProductModal(event.detail); 6672 }); 6673 </script> 6674 } 66756676 @helper RenderModalContent() 6677 { 6678 <div class="grid"> 6679 <div class="grid__col-2"> 6680 @Render(new Image { Path = "{{ productInfo.image }}", Link = "{{ productInfo.link }}", Title = "{{ productInfo.name }}", DisableImageEngine = true }) 6681 </div> 6682 <div class="u-padding grid--align-self-center"> 6683 <span>{{quantity}}</span> x 6684 </div> 6685 <div class="grid__col-auto grid--align-self-center"> 6686 <div>{{productInfo.name}}</div> 6687 {{#if productInfo.variantName}} 6688 <small class="u-margin-bottom-5px">{{productInfo.variantName}}</small> 6689 {{/if}} 6690 {{#if productInfo.unitName}} 6691 <small class="u-margin-bottom-5px">{{productInfo.unitName}}</small> 6692 {{/if}} 6693 </div> 6694 </div> 6695 } 66966697 @helper RenderAddToCartNotificationToggleScript() 6698 { 6699 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 67006701 <script> 6702 document.addEventListener('addToCart', function () { 6703 Cart.ToggleMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '@miniCartFeedPageId'); 6704 }); 6705 </script> 6706 } 6707 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 67086709 @using System 6710 @using System.Web 6711 @using System.Collections.Generic 6712 @using Dynamicweb.Rapido.Blocks.Extensibility 6713 @using Dynamicweb.Rapido.Blocks 6714 @using Dynamicweb.Rapido.Blocks.Components.General 67156716 @functions { 6717 BlocksPage footerBlocksPage = BlocksPage.GetBlockPage("Master"); 6718 } 67196720 @{ 6721 string footerColumnOneContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Content"); 6722 string footerColumnTwoContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Content"); 6723 string footerColumnThreeContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Content"); 6724 string footerColumnOneHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Header"); 6725 string footerColumnTwoHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Header"); 6726 string footerColumnThreeHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Header"); 67276728 Block masterFooterContent = new Block() 6729 { 6730 Id = "MasterFooterContent", 6731 SortId = 10, 6732 Template = RenderFooter(), 6733 SkipRenderBlocksList = true 6734 }; 6735 footerBlocksPage.Add(MasterBlockId.MasterFooter, masterFooterContent); 67366737 if (!string.IsNullOrEmpty(footerColumnOneContent) || !string.IsNullOrEmpty(footerColumnOneHeader)) 6738 { 6739 Block masterFooterColumnOne = new Block 6740 { 6741 Id = "MasterFooterColumnOne", 6742 SortId = 10, 6743 Template = RenderFooterColumn(footerColumnOneHeader, footerColumnOneContent), 6744 Design = new Design 6745 { 6746 Size = "auto", 6747 RenderType = RenderType.Column 6748 } 6749 }; 6750 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnOne); 6751 } 67526753 if (!string.IsNullOrEmpty(footerColumnTwoContent) || !string.IsNullOrEmpty(footerColumnTwoHeader)) 6754 { 6755 Block masterFooterColumnTwo = new Block 6756 { 6757 Id = "MasterFooterColumnTwo", 6758 SortId = 20, 6759 Template = RenderFooterColumn(footerColumnTwoHeader, footerColumnTwoContent), 6760 Design = new Design 6761 { 6762 Size = "auto", 6763 RenderType = RenderType.Column 6764 } 6765 }; 6766 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnTwo); 6767 } 67686769 if (!string.IsNullOrEmpty(footerColumnThreeContent) || !string.IsNullOrEmpty(footerColumnThreeHeader)) 6770 { 6771 Block masterFooterColumnThree = new Block 6772 { 6773 Id = "MasterFooterColumnThree", 6774 SortId = 30, 6775 Template = RenderFooterColumn(footerColumnThreeHeader, footerColumnThreeContent), 6776 Design = new Design 6777 { 6778 Size = "auto", 6779 RenderType = RenderType.Column 6780 } 6781 }; 6782 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnThree); 6783 } 67846785 if (Model.Area.Item.GetItem("Layout").GetBoolean("FooterNewsletterSignUp")) 6786 { 6787 Block masterFooterNewsletterSignUp = new Block 6788 { 6789 Id = "MasterFooterNewsletterSignUp", 6790 SortId = 40, 6791 Template = RenderFooterNewsletterSignUp(), 6792 Design = new Design 6793 { 6794 Size = "auto", 6795 RenderType = RenderType.Column 6796 } 6797 }; 6798 footerBlocksPage.Add("MasterFooterContent", masterFooterNewsletterSignUp); 6799 } 68006801 if (Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks").Count > 0) 6802 { 6803 Block masterFooterSocialLinks = new Block 6804 { 6805 Id = "MasterFooterSocialLinks", 6806 SortId = 50, 6807 Template = RenderFooterSocialLinks(), 6808 Design = new Design 6809 { 6810 Size = "auto", 6811 RenderType = RenderType.Column 6812 } 6813 }; 6814 footerBlocksPage.Add("MasterFooterContent", masterFooterSocialLinks); 6815 } 68166817 if (Model.Area.Item.GetItem("Layout").GetItems("FooterPayments") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterPayments").Count > 0) 6818 { 6819 Block masterFooterPayments = new Block 6820 { 6821 Id = "MasterFooterPayments", 6822 SortId = 60, 6823 Template = RenderFooterPayments(), 6824 Design = new Design 6825 { 6826 Size = "12", 6827 RenderType = RenderType.Column 6828 } 6829 }; 6830 footerBlocksPage.Add("MasterFooterContent", masterFooterPayments); 6831 } 68326833 Block masterFooterCopyright = new Block 6834 { 6835 Id = "MasterFooterCopyright", 6836 SortId = 70, 6837 Template = RenderFooterCopyright(), 6838 Design = new Design 6839 { 6840 Size = "12", 6841 RenderType = RenderType.Column 6842 } 6843 }; 6844 footerBlocksPage.Add("MasterFooterContent", masterFooterCopyright); 6845 } 68466847 @helper RenderFooter() 6848 { 6849 List<Block> subBlocks = this.footerBlocksPage.GetBlockListById("MasterFooterContent").OrderBy(item => item.SortId).ToList(); 68506851 <footer class="footer no-print dw-mod"> 6852 <div class="center-container top-container__center-container dw-mod"> 6853 <div class="grid grid--external-bleed-x"> 6854 @RenderBlockList(subBlocks) 6855 </div> 6856 </div> 6857 </footer> 6858 } 68596860 @helper RenderFooterColumn(string header, string content) 6861 { 6862 <h3 class="footer__heading dw-mod">@header</h3> 6863 <div class="footer__content dw-mod"> 6864 @content 6865 </div> 6866 } 68676868 @helper RenderFooterNewsletterSignUp() 6869 { 6870 string newsletterSignUpPageId = GetPageIdByNavigationTag("NewsletterSignUp").ToString(); 6871 Form form = new Form { Action = "/Default.aspx", Method = FormMethod.Get, Enctype = FormEnctype.multipart }; 68726873 form.Add(new HiddenField { Name = "ID", Value = newsletterSignUpPageId }); 6874 form.Add(new Text { Content = "<p>" + Translate("Sign up if you would like to receive occasional treats from us") + "</p>" }); 6875 form.Add(new TextField { 6876 Id = "NewsletterEmail", Name = "NewsletterEmail", Placeholder = Translate("Your email address"), 6877 Type = TextFieldType.Email, 6878 ActionButton = new Button { 6879 ButtonType = ButtonType.Submit, Id="Submitter", Title = Translate("Go"), OnClick = "Buttons.LockButton(event)", CssClass = "btn--condensed" 6880 } 6881 }); 68826883 <h3 class="footer__heading dw-mod">@Translate("Mailing list")</h3> 6884 <div class="footer__content dw-mod"> 6885 @Render(form) 6886 </div> 6887 } 68886889 @helper RenderFooterSocialLinks() 6890 { 6891 <h3 class="footer__heading dw-mod">@Translate("Social links")</h3> 6892 <div class="footer__content dw-mod"> 6893 <div class="collection dw-mod"> 6894 @foreach (var socialitem in Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks")) 6895 { 6896 var socialIcon = socialitem.GetValue("Icon") as Dynamicweb.Frontend.ListViewModel; 6897 string socialIconClass = socialIcon.SelectedValue; 6898 string socialIconTitle = socialIcon.SelectedName; 6899 string socialLink = socialitem.GetString("Link"); 69006901 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px" rel="noopener"><i class="@socialIconClass fa-2x"></i></a> 6902 } 6903 </div> 6904 </div> 6905 } 69066907 @helper RenderFooterPayments() 6908 { 6909 <div class="footer__content dw-mod"> 6910 <div class="collection dw-mod"> 6911 @foreach (var payment in Model.Area.Item.GetItem("Layout").GetItems("FooterPayments")) 6912 { 6913 var paymentItem = payment.GetValue("CardTypeOrVerifiedPayment") as Dynamicweb.Frontend.ListViewModel; 6914 string paymentImage = null; 6915 string paymentTitle = paymentItem.SelectedName; 6916 ListOptionViewModel selected = paymentItem.SelectedOptions.FirstOrDefault(); 6917 if (selected != null) 6918 { 6919 paymentImage = selected.Icon; 6920 } 69216922 <div class="footer__card-type"> 6923 <img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=60&Compression=75&image=@paymentImage" alt="@paymentTitle" title="@paymentTitle" /> 6924 </div> 6925 } 6926 </div> 6927 </div> 6928 } 69296930 @helper RenderFooterCopyright() 6931 { 6932 <div class="grid__col-12 footer__copyright dw-mod"> 6933 <p>@Model.Area.Item.GetItem("Layout").GetString("FooterCopyrightText")</p> 6934 </div> 6935 } 6936 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 69376938 @using System 6939 @using System.Web 6940 @using System.Collections.Generic 6941 @using Dynamicweb.Rapido.Blocks.Extensibility 6942 @using Dynamicweb.Rapido.Blocks 6943 @using Dynamicweb.Ecommerce.Common 69446945 @{ 6946 BlocksPage referencesBlocksPage = BlocksPage.GetBlockPage("Master"); 69476948 Block masterScriptReferences = new Block() 6949 { 6950 Id = "MasterScriptReferences", 6951 SortId = 1, 6952 Template = RenderMasterScriptReferences() 6953 }; 6954 referencesBlocksPage.Add(MasterBlockId.MasterReferences, masterScriptReferences); 6955 } 69566957 @helper RenderMasterScriptReferences() { 6958 <script src="/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js"></script> 6959 <script src="/Files/Templates/Designs/Rapido/js/master.min.js"></script> 69606961 if (Model.Area.Item.GetItem("Custom").GetBoolean("UseCustomJavascript")) 6962 { 6963 <script src="/Files/Templates/Designs/Rapido/js/custom.min.js"></script> 6964 PushPromise("/Files/Templates/Designs/Rapido/js/custom.min.js"); 6965 } 69666967 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> 69716972 @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 69796980 @{ 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")); 69846985 if (!navigationItemsHideSearch || isFavoriteList) 6986 { 6987 Block masterSearchScriptTemplates = new Block() 6988 { 6989 Id = "MasterSearchScriptTemplates", 6990 SortId = 1, 6991 Template = RenderSearchScriptTemplates() 6992 }; 69936994 searchBlocksPage.Add(MasterBlockId.MasterBottomSnippets, masterSearchScriptTemplates); 6995 } 6996 } 69976998 @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"); 70097010 <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> 70157016 <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> 71217122 <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> 71297130 <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> 71377138 <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> 71577158 <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> 71647165 <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 } 71727173 @using Dynamicweb.Rapido.Blocks.Components 7174 @using Dynamicweb.Rapido.Blocks.Components.General 7175 @using Dynamicweb.Rapido.Blocks 7176 @using System.IO 717771787179 @using Dynamicweb.Rapido.Blocks.Components.General 7180 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 718171827183 @* Component *@ 71847185 @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>(); 71937194 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 } 72127213 int rowCount = 0; 7214 int columnCount = 0; 72157216 <script> 7217 var variantsCollection = []; 7218 </script> 72197220 <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 } 72377238 <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; 72627263 <tr> 7264 <td class="u-min-w120px">@firstVariantOption.Name</td> 72657266 @foreach (VariantOption secondVariantOption in secondDimension) 7267 { 7268 variantId = firstVariantOption.Id + "." + secondVariantOption.Id; 7269 <td> 7270 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount) 7271 </td> 72727273 columnCount++; 72747275 productLoopCounter++; 7276 } 72777278 <td> 7279 <div class="qty-field js-total-qty-row-@rowCount dw-mod">0</div> 7280 </td> 7281 </tr> 72827283 rowCount++; 7284 } 72857286 @{ 7287 columnCount = 0; 7288 } 72897290 <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> 72977298 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); 73197320 <tr> 7321 <td colspan="@colspan" class="u-color-light-gray--bg u-bold">@firstVariantOption.Name</td> 7322 </tr> 73237324 foreach (VariantOption secondVariantOption in secondDimension) 7325 { 7326 string variantId = ""; 7327 columnCount = 0; 73287329 <tr> 7330 <td class="u-min-w120px">@secondVariantOption.Name</td> 73317332 @foreach (VariantOption thirdVariantOption in thirdDimension) 7333 { 7334 variantId = firstVariantOption.Id + "." + secondVariantOption.Id + "." + thirdVariantOption.Id; 73357336 <td> 7337 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount) 7338 </td> 73397340 columnCount++; 7341 productLoopCounter++; 7342 } 73437344 <td> 7345 <div class="qty-field js-total-qty-row-@rowCount dw-mod">0</div> 7346 </td> 7347 </tr> 7348 rowCount++; 7349 } 7350 } 73517352 @{ 7353 columnCount = 0; 7354 } 73557356 <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> 73637364 columnCount++; 7365 } 7366 <td>&nbsp;</td> 7367 </tr> 7368 </tbody> 7369 } 7370 </table> 73717372 <script> 7373 document.addEventListener("DOMContentLoaded", function (event) { 7374 MatrixUpdateQuantity("@settings.ProductId"); 7375 }); 73767377 MatrixUpdateQuantity = function (productId) { 7378 var currentMatrix = document.getElementById("VariantMatrixTable_" + productId); 7379 var allQtyFields = currentMatrix.getElementsByClassName("js-qty"); 73807381 var qtyRowArr = []; 7382 var qtyColumnArr = []; 73837384 var totalQty = 0; 73857386 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 } 73907391 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 } 73967397 //Update row counters 7398 for (var i = 0; i < qtyRowArr.length; i++) { 7399 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-row-" + i)[0]; 74007401 if (qtyRowArr[i] != undefined && qtyCounter != null) { 7402 var currentCount = qtyCounter.innerHTML; 7403 qtyCounter.innerHTML = qtyRowArr[i]; 74047405 if (currentCount != qtyCounter.innerHTML) { 7406 qtyCounter.classList.add("qty-field--active"); 7407 } 7408 } 74097410 } 74117412 //Update column counters 7413 for (var i = 0; i < qtyColumnArr.length; i++) { 7414 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-column-" + i)[0]; 74157416 if (qtyColumnArr[i] != undefined && qtyCounter != null) { 7417 var currentCount = qtyCounter.innerHTML; 7418 qtyCounter.innerHTML = qtyColumnArr[i]; 74197420 if (currentCount != qtyCounter.innerHTML) { 7421 qtyCounter.classList.add("qty-field--active"); 7422 } 7423 } 7424 } 74257426 if (document.getElementById("TotalQtyCount_" + productId)) { 7427 document.getElementById("TotalQtyCount_" + productId).innerHTML = totalQty; 7428 } 74297430 //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 } 74497450 @helper RenderVariantMatrixQuantityField(string variantId, VariantMatrix settings, int productLoopCounter, int rowCount, int columnCount) 7451 { 7452 string loopCount = productLoopCounter.ToString(); 74537454 bool combinationFound = false; 7455 double stock = 0; 7456 double quantityValue = 0; 7457 string note = ""; 74587459 VariantProduct variantProduct = null; 74607461 if (settings.GetVariantProducts().TryGetValue(variantId, out variantProduct)) 7462 { 7463 stock = variantProduct.Stock; 7464 quantityValue = variantProduct.Quantity; 7465 combinationFound = true; 7466 } 74677468 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"> 74757476 if (stock != 0) 7477 { 7478 <small>@Translate("Stock") @stock</small> 7479 } 74807481 <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 74937494 @* Component *@ 74957496 @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 } 75057506 settings.AddButton.QuantitySelectorId = settings.QuantitySelector.Id; 75077508 if (settings.Disabled) 7509 { 7510 settings.QuantitySelector.Disabled = true; 7511 } 75127513 if (string.IsNullOrEmpty(settings.QuantitySelector.Name)) 7514 { 7515 settings.QuantitySelector.Name = settings.QuantitySelector.Id; 7516 } 7517 } 75187519 if (settings.Disabled) 7520 { 7521 settings.AddButton.Disabled = true; 7522 } 75237524 settings.AddButton.CssClass += " btn--condensed"; 75257526 //unitsSelector 7527 if (settings.UnitSelector != null) 7528 { 7529 if (settings.Disabled) 7530 { 7531 settings.QuantitySelector.Disabled = true; 7532 } 7533 } 75347535 <div class="buttons-collection @settings.WrapperCssClass" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 7536 @if (settings.UnitSelector != null) 7537 { 7538 @Render(settings.UnitSelector) 7539 } 7540 @if (settings.QuantitySelector != null) 7541 { 7542 @Render(settings.QuantitySelector) 7543 } 7544 @Render(settings.AddButton) 7545 </div> 7546 } 7547 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 75487549 @* Component *@ 75507551 @helper RenderAddToCartButton(AddToCartButton settings) 7552 { 7553 if (!settings.HideTitle) 7554 { 7555 if (string.IsNullOrEmpty(settings.Title)) 7556 { 7557 if (settings.BuyForPoints) 7558 { 7559 settings.Title = Translate("Buy with points"); 7560 } 7561 else 7562 { 7563 settings.Title = Translate("Add to cart"); 7564 } 7565 } 7566 } 7567 else 7568 { 7569 settings.Title = ""; 7570 } 75717572 if (settings.Icon == null) 7573 { 7574 settings.Icon = new Icon(); 7575 settings.Icon.LabelPosition = Dynamicweb.Rapido.Blocks.Components.General.IconLabelPosition.After; 7576 } 75777578 if (string.IsNullOrEmpty(settings.Icon.Name)) 7579 { 7580 settings.Icon.Name = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue; 7581 } 75827583 settings.OnClick = "Cart.AddToCart(event, { " + 7584 "id: '" + settings.ProductId + "'," + 7585 (!string.IsNullOrEmpty(settings.VariantId) ? "variantId: '" + settings.VariantId + "'," : "") + 7586 (!string.IsNullOrEmpty(settings.UnitId) ? "unitId: '" + settings.UnitId + "'," : "") + 7587 (settings.BuyForPoints ? "buyForPoints: true," : "") + 7588 (!string.IsNullOrEmpty(settings.ProductInfo) ? "productInfo: " + settings.ProductInfo + "," : "") + 7589 "quantity: " + (string.IsNullOrEmpty(settings.QuantitySelectorId) ? "1" : "parseFloat(document.getElementById('" + settings.QuantitySelectorId + "').value)") + 7590 "});" + settings.OnClick; 75917592 @RenderButton(settings) 7593 } 7594 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 75957596 @* Component *@ 75977598 @helper RenderUnitSelector(UnitSelector settings) 7599 { 7600 if (string.IsNullOrEmpty(settings.Id)) 7601 { 7602 settings.Id = Guid.NewGuid().ToString("N"); 7603 } 7604 var disabledClass = settings.Disabled ? "disabled" : ""; 76057606 <input type="checkbox" id="@settings.Id" class="dropdown-trigger" /> 7607 <div class="dropdown unit-selector @settings.CssClass @disabledClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 7608 <label class="dropdown__header dropdown__btn dropdown__btn--unit-selector dw-mod" for="@settings.Id">@settings.SelectedOption</label> 7609 <div class="dropdown__content dw-mod"> 7610 @settings.OptionsContent 7611 </div> 7612 <label class="dropdown-trigger-off" for="@settings.Id"></label> 7613 </div> 7614 } 7615 @using System.Reflection 7616 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 76177618 @* Component *@ 76197620 @helper RenderQuantitySelector(QuantitySelector settings) 7621 { 7622 var attributes = new Dictionary<string, string>(); 76237624 /*base settings*/ 7625 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 7626 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 7627 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 7628 if (settings.Disabled) { attributes.Add("disabled", "true"); } 7629 if (settings.Required) { attributes.Add("required", "true"); } 7630 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 7631 /*end*/ 76327633 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 7634 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 7635 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 7636 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 7637 if (settings.Max != null) { attributes.Add("max", settings.Max.ToString()); } 7638 if (settings.Min == null) { settings.Min = 1; } 7639 attributes.Add("min", settings.Min.ToString()); 7640 if (settings.Step != null && !string.IsNullOrEmpty(settings.Step.ToString())) { attributes.Add("step", settings.Step.ToString()); } 7641 if (settings.Value == null) { settings.Value = 1; } 7642 attributes.Add("value", settings.Value.ToString()); 7643 attributes.Add("type", "number"); 76447645 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 76467647 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 7648 } 7649 @using Dynamicweb.Rapido.Blocks.Components 76507651 @using Dynamicweb.Frontend 7652 @using Dynamicweb.Frontend.Devices 7653 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 7654 @using Dynamicweb.Rapido.Blocks.Components.General 7655 @using System.Collections.Generic; 76567657 @* Component *@ 76587659 @helper RenderCustomerCenterList(CustomerCenterList settings) 7660 { 7661 bool isTouchDevice = Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet" ? true : false; 7662 string hideActions = isTouchDevice ? "u-block" : ""; 76637664 <table class="table data-list dw-mod"> 7665 @if (settings.GetHeaders().Length > 0) { 7666 <thead> 7667 <tr class="u-bold"> 7668 @foreach (CustomerCenterListHeaderItem header in settings.GetHeaders()) 7669 { 7670 var attributes = new Dictionary<string, string>(); 7671 if (!string.IsNullOrEmpty(header.Id)) { attributes.Add("id", header.Id); } 7672 if (!string.IsNullOrEmpty(header.CssClass)) { attributes.Add("class", header.CssClass); } 7673 attributes.Add("align", header.Align.ToString()); 7674 attributes = attributes.Concat(header.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 76757676 <td @ComponentMethods.AddAttributes(attributes)>@header.Title</td> 7677 } 7678 </tr> 7679 </thead> 7680 } 7681 @foreach (CustomerCenterListItem listItem in settings.GetItems()) 7682 { 7683 int columnCount = 0; 7684 int totalColumns = listItem.GetInfoItems().Length; 7685 string rowHasActions = listItem.GetActions().Length > 0 ? "data-list__item--has-actions" : ""; 7686 listItem.Id = !string.IsNullOrEmpty(listItem.Id) ? listItem.Id : Guid.NewGuid().ToString("N"); 76877688 var attributes = new Dictionary<string, string>(); 7689 if (!string.IsNullOrEmpty(listItem.Title)) { attributes.Add("title", listItem.Title); }; 76907691 attributes = attributes.Concat(listItem.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 7692 <tbody class="data-list__item @rowHasActions @listItem.CssClass dw-mod" @ComponentMethods.AddAttributes(attributes)> 7693 <tr> 7694 @if (!string.IsNullOrEmpty(listItem.Title) || !string.IsNullOrEmpty(listItem.Description)) { 7695 string onClick = !string.IsNullOrEmpty(listItem.OnClick) ? "onclick=\"" + listItem.OnClick + "\"" : ""; 76967697 <td rowspan="2" @onClick class="data-list__main-item dw-mod"> 7698 @if (!string.IsNullOrEmpty(listItem.Title)) { 7699 <div class="u-bold">@listItem.Title</div> 7700 } 7701 @if (!string.IsNullOrEmpty(listItem.Description)) { 7702 <div>@listItem.Description</div> 7703 } 7704 </td> 7705 } 77067707 @foreach (CustomerCenterListInfoItem infoItem in listItem.GetInfoItems()) 7708 { 7709 var infoAttributes = new Dictionary<string, string>(); 7710 if (!string.IsNullOrEmpty(infoItem.Id)) { infoAttributes.Add("id", infoItem.Id); }; 7711 if (!string.IsNullOrEmpty(infoItem.OnClick)) { infoAttributes.Add("onclick", infoItem.OnClick); }; 7712 infoAttributes.Add("align", infoItem.Align.ToString()); 77137714 infoAttributes = infoAttributes.Concat(infoItem.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 7715 string columnClick = columnCount < (totalColumns-1) && !string.IsNullOrEmpty(listItem.OnClick) ? "onclick=\"" + listItem.OnClick + "\"" : ""; 77167717 <td @ComponentMethods.AddAttributes(infoAttributes) @columnClick class="data-list__info-item dw-mod"> 7718 @if (!string.IsNullOrEmpty(infoItem.Title)) { 7719 <div>@infoItem.Title</div> 7720 } 7721 @if (!string.IsNullOrEmpty(infoItem.Subtitle)) { 7722 <div><small>@infoItem.Subtitle</small></div> 7723 } 7724 </td> 77257726 columnCount++; 7727 } 7728 </tr> 7729 <tr> 7730 <td colspan="7" align="right" class="u-va-bottom u-no-border"> 7731 <div class="data-list__actions @hideActions dw-mod" id="ActionsMenu_@listItem.Id"> 7732 @foreach (ButtonBase action in listItem.GetActions()) 7733 { 7734 action.ButtonLayout = ButtonLayout.LinkClean; 7735 action.Icon.CssClass += " u-full-height"; 7736 action.CssClass += " data-list__action-button link"; 77377738 @Render(action) 7739 } 7740 </div> 7741 </td> 7742 </tr> 7743 </tbody> 7744 } 7745 </table> 7746 } 7747 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 77487749 @using System 7750 @using System.Web 7751 @using System.Collections.Generic 7752 @using Dynamicweb.Rapido.Blocks.Extensibility 7753 @using Dynamicweb.Rapido.Blocks 77547755 @{ 7756 BlocksPage bottomSnippetsBlocksPage = BlocksPage.GetBlockPage("Master"); 77577758 Block primaryBottomSnippets = new Block() 7759 { 7760 Id = "MasterJavascriptInitializers", 7761 SortId = 100, 7762 Template = RenderPrimaryBottomSnippets() 7763 }; 7764 bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, primaryBottomSnippets); 77657766 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed()) 7767 { 7768 Block miniCartPageId = new Block 7769 { 7770 Id = "MiniCartPageId", 7771 Template = RenderMiniCartPageId() 7772 }; 7773 bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, miniCartPageId); 7774 } 7775 } 77767777 @helper RenderPrimaryBottomSnippets() 7778 { 7779 bool isWireframeMode = Model.Area.Item.GetItem("Settings").GetBoolean("WireframeMode"); 7780 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 77817782 if (isWireframeMode) 7783 { 7784 <script> 7785 Wireframe.Init(true); 7786 </script> 7787 } 778877897790 if (useGoogleTagManager) 7791 { 7792 <script> 7793 document.addEventListener('addToCart', function(event) { 7794 var googleImpression = JSON.parse(event.detail.productInfo.googleImpression); 7795 if (typeof googleImpression == "string") { 7796 googleImpression = JSON.parse(event.detail.productInfo.googleImpression); 7797 } 7798 dataLayer.push({ 7799 'event': 'addToCart', 7800 'ecommerce': { 7801 'currencyCode': googleImpression.currency, 7802 'add': { 7803 'products': [{ 7804 'name': googleImpression.name, 7805 'id': googleImpression.id, 7806 'price': googleImpression.price, 7807 'brand': googleImpression.brand, 7808 'category': googleImpression.category, 7809 'variant': googleImpression.variant, 7810 'quantity': event.detail.quantity 7811 }] 7812 } 7813 } 7814 }); 7815 }); 7816 </script> 7817 } 78187819 //if digitalwarehouse 7820 if (Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart")) 7821 { 7822 string cartContextId = Converter.ToString(HttpContext.Current.Application["DownloadCartContext"]); 78237824 if (string.IsNullOrEmpty(cartContextId)) 7825 { 7826 var moduleProps = Dynamicweb.Modules.Properties.GetParagraphModuleSettings(GetPageIdByNavigationTag("DownloadCart"), "eCom_CartV2"); 7827 var cartSettings = new Dynamicweb.Ecommerce.Cart.ModuleSettings(moduleProps); 7828 cartContextId = cartSettings.OrderContextID; 7829 HttpContext.Current.Application["DownloadCartContext"] = cartContextId; 7830 } 78317832 <script> 7833 let downloadCart = new DownloadCart({ 7834 cartPageId: @GetPageIdByNavigationTag("MiniCartFeed"), 7835 contextId: "@cartContextId", 7836 addButtonText: "@Translate("Add")", 7837 removeButtonText: "@Translate("Remove")" 7838 }); 7839 </script> 7840 } 78417842 <!--$$Javascripts--> 7843 } 78447845 @helper RenderMiniCartPageId() 7846 { 7847 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 7848 <script> 7849 window.cartId = "@miniCartFeedPageId"; 7850 </script> 7851 } 7852 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 78537854 @using System 7855 @using System.Web 7856 @using System.Collections.Generic 7857 @using Dynamicweb.Rapido.Blocks 78587859 @{ 7860 BlocksPage masterCustomBlocksPage = BlocksPage.GetBlockPage("Master"); 78617862 } 786378647865 @functions { 7866 public class ManifestIcon 7867 { 7868 public string src { get; set; } 7869 public string type { get; set; } 7870 public string sizes { get; set; } 7871 } 78727873 public class Manifest 7874 { 7875 public string name { get; set; } 7876 public string short_name { get; set; } 7877 public string start_url { get; set; } 7878 public string display { get; set; } 7879 public string background_color { get; set; } 7880 public string theme_color { get; set; } 7881 public List<ManifestIcon> icons { get; set; } 7882 } 7883 } 78847885 <!DOCTYPE html> 78867887 <html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName"> 7888788978907891 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 7892 @RenderBlockList(masterPage.BlocksRoot.BlocksList) 7893789478957896 @helper RenderMasterHead() { 7897 List<Block> subBlocks = this.masterPage.GetBlockListById("Head").OrderBy(item => item.SortId).ToList(); 78987899 <head> 7900 <!-- Rapido version 3.4.2 --> 79017902 @RenderBlockList(subBlocks) 7903 </head> 7904 } 79057906 @helper RenderMasterMetadata() { 7907 var swatches = new Dynamicweb.Content.Items.ColorSwatchService(); 7908 var brandColors = swatches.GetColorSwatch(1); 7909 string brandColorOne = brandColors.Palette["BrandColor1"]; 79107911 if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName")) && Model.Area.Item.GetItem("Settings").GetFile("AppIcon") != null) { 7912 Manifest manifest = new Manifest 7913 { 7914 name = Model.Area.Item.GetItem("Settings").GetString("AppName"), 7915 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"), 7916 start_url = "/", 7917 display = "standalone", 7918 background_color = Model.Area.Item.GetItem("Settings").GetString("AppBackgroundColor"), 7919 theme_color = Model.Area.Item.GetItem("Settings").GetString("AppThemeColor") 7920 }; 79217922 manifest.icons = new List<ManifestIcon> { 7923 new ManifestIcon { 7924 src = "/Admin/Public/GetImage.ashx?width=192&height=192&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 7925 sizes = "192x192", 7926 type = "image/png" 7927 }, 7928 new ManifestIcon { 7929 src = "/Admin/Public/GetImage.ashx?width=512&height=512&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 7930 sizes = "512x512", 7931 type = "image/png" 7932 }, 7933 new ManifestIcon { 7934 src = "/Admin/Public/GetImage.ashx?width=1024&height=1024&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 7935 sizes = "1024x1024", 7936 type = "image/png" 7937 } 7938 }; 79397940 string manifestFilePath = HttpContext.Current.Request.MapPath("/Files/Templates/Designs/Rapido/manifest.json"); 7941 string manifestJSON = Newtonsoft.Json.JsonConvert.SerializeObject(manifest); 7942 string currentManifest = File.ReadAllText(manifestFilePath); 79437944 if (manifestJSON != currentManifest) 7945 { 7946 File.WriteAllText(manifestFilePath, manifestJSON); 7947 } 7948 } 79497950 <meta charset="utf-8" /> 7951 <title>@Model.Title</title> 7952 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 7953 <meta name="robots" content="index, follow"> 7954 <meta name="theme-color" content="@brandColorOne" /> 79557956 if (!Model.MetaTags.Contains("og:image")) { 7957 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"))); 7958 } 79597960 if (!Model.MetaTags.Contains("og:description")) { 7961 Pageview.Meta.AddTag("og:description", Model.Description); 7962 } 79637964 Pageview.Meta.AddTag("og:title", Model.Title); 7965 Pageview.Meta.AddTag("og:site_name", Model.Name); 7966 Pageview.Meta.AddTag("og:url", HttpContext.Current.Request.Url.ToString()); 7967 Pageview.Meta.AddTag("og:type", "Website"); 79687969 if (!string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("FacebookAppID"))) { 7970 Pageview.Meta.AddTag("fb:app_id", Model.Area.Item.GetItem("Settings").GetString("FacebookAppID")); 7971 } 79727973 @Model.MetaTags 7974 } 79757976 @helper RenderMasterCss() { 7977 var fonts = new string[] { 7978 getFontFamily("Layout", "HeaderFont"), 7979 getFontFamily("Layout", "SubheaderFont"), 7980 getFontFamily("Layout", "TertiaryHeaderFont"), 7981 getFontFamily("Layout", "BodyText"), 7982 getFontFamily("Layout", "Header", "ToolsFont"), 7983 getFontFamily("Layout", "Header", "NavigationFont"), 7984 getFontFamily("Layout", "MobileNavigation", "Font"), 7985 getFontFamily("ProductList", "Facets", "HeaderFont"), 7986 getFontFamily("ProductPage", "PriceFontDesign"), 7987 getFontFamily("Ecommerce", "SaleSticker", "Font"), 7988 getFontFamily("Ecommerce", "NewSticker", "Font"), 7989 getFontFamily("Ecommerce", "CustomSticker", "Font") 7990 }; 79917992 string autoCssLink = "/Files/Templates/Designs/Rapido/css/rapido/rapido_" + Model.Area.ID.ToString() + ".min.css?ticks=" + Model.Area.UpdatedDate.Ticks; 7993 string favicon = Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon").Path : "/Files/Images/favicon.png"; 7994 bool useFontAwesomePro = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetBoolean("UseFontAwesomePro"); 7995 string fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomeFree/css/fontawesome-all.min.css"; 7996 if (useFontAwesomePro) 7997 { 7998 fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomePro/css/fontawesome-all.min.css"; 7999 } 80008001 //Favicon 8002 <link href="@favicon" rel="icon" type="image/png"> 80038004 //Base (Default, wireframe) styles 8005 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/base/base.min.css" type="text/css"> 80068007 //Rapido Css from Website Settings 8008 <link rel="stylesheet" id="rapidoCss" href="@autoCssLink" type="text/css"> 80098010 //Ignite Css (Custom site specific styles) 8011 <link rel="stylesheet" id="igniteCss" type="text/css" href="/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css"> 80128013 //Font awesome 8014 <link rel="stylesheet" href="@fontAwesomeCssLink" type="text/css"> 80158016 //Flag icon 8017 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css" type="text/css"> 80188019 //Google fonts 8020 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))); 80218022 <link href="https://fonts.googleapis.com/css?family=@family" rel="stylesheet"> 80238024 <!-- Flex CSS --> 8025 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/flex.css"> 80268027802880298030 PushPromise(favicon); 8031 PushPromise(fontAwesomeCssLink); 8032 PushPromise("/Files/Templates/Designs/Rapido/css/base/base.min.css"); 8033 PushPromise(autoCssLink); 8034 PushPromise("/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css"); 8035 PushPromise("/Files/Images/placeholder.gif"); 8036 PushPromise("/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css"); 8037 } 80388039 @helper RenderMasterManifest() { 8040 if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName"))) 8041 { 8042 <link rel="manifest" href="/Files/Templates/Designs/Rapido/manifest.json"> 8043 PushPromise("/Files/Templates/Designs/Rapido/manifest.json"); 8044 } 8045 } 80468047 @helper RenderMasterBody() { 8048 List<Block> subBlocks = this.masterPage.GetBlockListById("Body").OrderBy(item => item.SortId).ToList(); 8049 string designLayout = Model.PropertyItem.GetItem("CustomSettings") != null ? Model.PropertyItem.GetItem("CustomSettings").GetString("DesignLayout") != null ? Model.PropertyItem.GetItem("CustomSettings").GetList("DesignLayout").SelectedValue : "" : ""; 8050 if (!String.IsNullOrEmpty(designLayout)) { 8051 designLayout = "class=\"" + designLayout + "\""; 8052 } 80538054 <body @designLayout> 8055 @RenderBlockList(subBlocks) 8056 </body> 8057 } 80588059 @helper RenderMasterHeader() 8060 { 8061 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterHeader").OrderBy(item => item.SortId).ToList(); 8062 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 8063 string stickyTop = isNavigationStickyMenu ? "top-container--sticky" : ""; 80648065 <header class="top-container @stickyTop dw-mod" id="Top"> 8066 @RenderBlockList(subBlocks) 8067 </header> 8068 } 80698070 @helper RenderMain() 8071 { 8072 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMain").OrderBy(item => item.SortId).ToList(); 80738074 var pageBackground = ""; 80758076 var pageBackgroundColor = Model.PropertyItem.GetString("PageBackgroundColor") != null ? Model.PropertyItem.GetString("PageBackgroundColor") : ""; 8077807880798080 if ( Model.PropertyItem.GetFile("PageBackgroundImage") != null){ 8081 pageBackground += "background-image:url(" + Model.PropertyItem.GetFile("PageBackgroundImage") + ")"; 8082 } 80838084 else if ( pageBackgroundColor != ""){ 8085 pageBackground += "background-color:" + pageBackgroundColor + ";background-image:none;"; 8086 } 808780888089 <main style="@pageBackground" class="site dw-mod"> 8090 @RenderBlockList(subBlocks) 8091 </main> 8092 } 80938094 @helper RenderPageContent() 8095 { 8096 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 8097 string pagePos = isNavigationStickyMenu ? "js-page-pos" : ""; 80988099 <div id="Page" class="page @pagePos"> 8100 <section class="center-container content-container dw-mod" id="content"> 81018102 @RenderSnippet("Content") 8103 </section> 8104 </div> 8105 } 81068107 @* Hack to support nested helpers *@ 8108 @SnippetStart("Content") 8109 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 811081118112 @using Dynamicweb.Extensibility 8113 @using Dynamicweb.Core 8114 @using Dynamicweb.Rapido.Blocks.Components 8115 @using Dynamicweb.Rapido.Blocks.Components.Articles 8116 @using Dynamicweb.Rapido.Blocks.Components.General 8117 @using Dynamicweb.Rapido.Blocks 8118 @using Dynamicweb.Content.Items 81198120 @functions { 8121 BlocksPage articlePage = BlocksPage.GetBlockPage("DynamicArticle"); 81228123 public string GetParentSettingsItem(string systemName) { 8124 string item = null; 81258126 Dynamicweb.Content.Page current = Dynamicweb.Services.Pages.GetPage(Model.ID); 8127 while (current != null && current.Parent != current) { 8128 var temp = current.Item != null ? current.Item[systemName] : ""; 81298130 if (temp != null) { 8131 item = temp.ToString(); 81328133 if (!String.IsNullOrEmpty(item) && !String.Equals("default", item, StringComparison.OrdinalIgnoreCase)) { 8134 break; 8135 } 8136 } 81378138 current = current.Parent; 8139 } 81408141 return item; 8142 } 81438144 public string GetArticleCategory(int pageId) 8145 { 8146 string categoryName = null; 81478148 //Secure that the article is not in the root folder = Actual has a category 8149 if (Dynamicweb.Services.Pages.GetPage(pageId).Parent != null) { 8150 if (Dynamicweb.Services.Pages.GetPage(pageId).Parent.Parent != null) { 8151 if (!String.IsNullOrEmpty(Dynamicweb.Services.Pages.GetPage(pageId).Parent.Parent.ItemType)) 8152 { 8153 categoryName = Dynamicweb.Services.Pages.GetPage(pageId).Parent.GetDisplayName(); 8154 } 8155 } 8156 } 81578158 return categoryName; 8159 } 81608161 public string GetArticleCategoryColor(int pageId) 8162 { 8163 string categoryColor = ""; 81648165 //Secure that the article is not in the root folder = Actual has a category 8166 if (Dynamicweb.Services.Pages.GetPage(pageId).Parent != null) { 8167 if (Dynamicweb.Services.Pages.GetPage(pageId).Parent.Parent != null) { 8168 if (!String.IsNullOrEmpty(Dynamicweb.Services.Pages.GetPage(pageId).Parent.Parent.ItemType)) 8169 { 8170 if (Dynamicweb.Services.Pages.GetPage(pageId).Parent.Item["CategoryColor"] != null) 8171 { 8172 var service = new ColorSwatchService(); 8173 categoryColor = Dynamicweb.Services.Pages.GetPage(pageId).Parent.Item["CategoryColor"].ToString(); 81748175 if (!categoryColor.Contains("#")) { 8176 categoryColor = service.GetHexColor(Converter.ToInt32(Model.Area.ID), categoryColor); 8177 } 8178 } 8179 } 8180 } 8181 } 81828183 return categoryColor; 8184 } 8185 } 81868187 @{ 8188 string listPageId = Converter.ToString(GetPageIdByNavigationTag("DynamicListFeed")); 8189 string parentPageId = Dynamicweb.Services.Pages.GetPage(Model.ID).Parent.ID.ToString(); 8190 string topLayout = Model.Item.GetList("TopLayout") != null ? Model.Item.GetList("TopLayout").SelectedValue : "default"; 8191 topLayout = topLayout == "default" && GetParentSettingsItem("ArticleTopLayout") != null ? GetParentSettingsItem("ArticleTopLayout").ToString().ToLower() : topLayout; 8192 string textLayout = Model.Item.GetList("TextLayout") != null ? Model.Item.GetList("TextLayout").SelectedValue : "default"; 8193 textLayout = textLayout == "default" && GetParentSettingsItem("ArticleTextLayout") != null ? GetParentSettingsItem("ArticleTextLayout").ToString().ToLower() : textLayout; 8194 string imageLayout = Model.Item.GetList("ImageLayout") != null ? Model.Item.GetList("ImageLayout").SelectedValue : "default"; 8195 imageLayout = imageLayout == "default" && GetParentSettingsItem("ArticleImageLayout") != null ? GetParentSettingsItem("ArticleImageLayout").ToString().ToLower() : imageLayout; 81968197 string imageColumns = imageLayout == "straight" && textLayout != "full" ? "8" : "12"; 8198 string contentColumns = textLayout != "full" ? "8" : "12"; 81998200 int externalParagraphId = Model.Item.GetItem("CTAParagraphLink") != null ? Model.Item.GetItem("CTAParagraphLink").ParagraphID : 0; 82018202 ArticleHeaderLayout headerLayout; 82038204 switch (topLayout) 8205 { 8206 case "default": 8207 headerLayout = ArticleHeaderLayout.Clean; 8208 break; 8209 case "split": 8210 headerLayout = ArticleHeaderLayout.Split; 8211 break; 8212 case "banner": 8213 headerLayout = ArticleHeaderLayout.Banner; 8214 break; 8215 case "overlay": 8216 headerLayout = ArticleHeaderLayout.Overlay; 8217 break; 8218 default: 8219 headerLayout = ArticleHeaderLayout.Clean; 8220 break; 8221 } 822282238224 Block articleContainer = new Block 8225 { 8226 Id = "ArticleContainer", 8227 SortId = 10, 8228 Design = new Design 8229 { 8230 RenderType = RenderType.Row 8231 }, 8232 BlocksList = new List<Block> { 8233 new Block { 8234 Id = "ArticleBody", 8235 SortId = 30, 8236 Design = new Design { 8237 RenderType = RenderType.Column, 8238 Size = "12", 8239 HidePadding = true 8240 } 8241 } 8242 } 8243 }; 8244 articlePage.Add(articleContainer); 82458246 ButtonLayout topBannerButtonLayout = ButtonLayout.Primary; 82478248 switch (Model.Item.GetString("ButtonDesign")) { 8249 case "primary": 8250 topBannerButtonLayout = ButtonLayout.Primary; 8251 break; 8252 case "secondary": 8253 topBannerButtonLayout = ButtonLayout.Secondary; 8254 break; 8255 case "teritary": 8256 topBannerButtonLayout = ButtonLayout.Tertiary; 8257 break; 8258 case "link": 8259 topBannerButtonLayout = ButtonLayout.Link; 8260 break; 8261 } 82628263 ArticleHeader topBanner = new ArticleHeader 8264 { 8265 Layout = headerLayout, 8266 Image = new Image { Path = Model.Item.GetFile("Image"), ImageDefault = new ImageSettings { Width = 1920, Height = 640 } }, 8267 Heading = Model.Item.GetString("Title"), 8268 Subheading = Model.Item.GetString("Summary"), 8269 TextColor = "#fff", 8270 Author = Model.Item.GetString("Author"), 8271 Date = Model.Item.GetString("Date"), 8272 Category = GetArticleCategory(Model.ID), 8273 CategoryColor = GetArticleCategoryColor(Model.ID), 8274 Link = Model.Item.GetString("Link"), 8275 LinkText = Model.Item.GetString("LinkText"), 8276 ButtonLayout = topBannerButtonLayout, 8277 RatingScore = Model.Item.GetString("Rating") != null ? Converter.ToInt32(Model.Item.GetList("Rating").SelectedValue) : 0, 8278 RatingOutOf = Model.Item.GetString("Rating") != null ? Model.Item.GetList("Rating").Options.Count : 0, 8279 ExternalParagraphId = externalParagraphId 8280 }; 82818282 Block articleTop = new Block 8283 { 8284 Id = "ArticleHead", 8285 SortId = 20, 8286 Component = topBanner, 8287 Design = new Design 8288 { 8289 RenderType = RenderType.Column, 8290 Size = "12", 8291 HidePadding = true, 8292 CssClass = "article-head" 8293 } 8294 }; 8295 articlePage.Add("ArticleContainer", articleTop); 829682978298 Block articleBodyRow = new Block 8299 { 8300 Id = "ArticleBodyRow", 8301 SortId = 10, 8302 SkipRenderBlocksList = true 8303 }; 8304 articlePage.Add("ArticleBody", articleBodyRow); 830583068307 if (Model.Item.GetString("Paragraphs") != null) 8308 { 8309 int count = 0; 8310 foreach (var paragraph in Model.Item.GetItems("Paragraphs")) 8311 { 8312 if (!paragraph.GetBoolean("RenderAsQuote")) 8313 { 8314 string enableDropCap = Model.Item.GetString("EnableDropCap") != null ? Model.Item.GetList("EnableDropCap").SelectedValue.ToLower() : "default"; 8315 enableDropCap = enableDropCap == "default" && GetParentSettingsItem("EnableDropCap") != null ? GetParentSettingsItem("EnableDropCap").ToString().ToLower() : enableDropCap; 8316 string text = paragraph.GetString("Text") != null ? paragraph.GetString("Text") : ""; 83178318 if (!String.IsNullOrEmpty(text) && enableDropCap == "true" && count == 0 && paragraph.GetString("Text").Substring(0, 3) == "<p>") 8319 { 8320 string firstLetter = paragraph.GetString("Text").Substring(3, 1); 8321 text = paragraph.GetString("Text").Remove(3, 1); 8322 text = text.Insert(3, "<span class=\"article__drop-cap\">" + firstLetter + "</span>"); 8323 } 83248325 if (paragraph.GetFile("Image") != null) 8326 { 8327 string imageTitle = !string.IsNullOrEmpty(paragraph.GetString("Heading")) ? paragraph.GetString("Heading") : ""; 83288329 Block articleParagraphImage = new Block 8330 { 8331 Id = "ArticleParagraph" + count + "Image", 8332 SortId = (count * 10), 8333 Design = new Design 8334 { 8335 RenderType = RenderType.Column, 8336 Size = imageColumns, 8337 CssClass = "u-color-light--bg u-padding--lg" 8338 } 8339 }; 83408341 if (imageLayout == "banner") 8342 { 8343 ArticleBanner banner = new ArticleBanner 8344 { 8345 Image = new Image { Path = paragraph.GetFile("Image"), ImageDefault = new ImageSettings { Height = 650, Width = 1300 }, Caption = paragraph.GetString("ImageCaption") }, 8346 Heading = imageTitle, 8347 UseFilters = false 8348 }; 8349 articleParagraphImage.Component = banner; 8350 } 8351 else 8352 { 8353 ArticleImage image = new ArticleImage 8354 { 8355 Image = new Image 8356 { 8357 Path = paragraph.GetFile("Image"), 8358 Title = imageTitle, 8359 ImageDefault = new ImageSettings { Height = 650, Width = 1300 }, 8360 Caption = paragraph.GetString("ImageCaption") 8361 } 8362 }; 8363 articleParagraphImage.Component = image; 8364 } 83658366 articlePage.Add("ArticleBodyRow", articleParagraphImage); 8367 } 83688369 if (!String.IsNullOrEmpty(paragraph.GetString("VideoURL"))) 8370 { 8371 Block articleParagraphVideo = new Block 8372 { 8373 Id = "ArticleParagraph" + count + "Video", 8374 SortId = (count * 10) + 1, 8375 Component = new ArticleVideo { Url = paragraph.GetString("VideoURL"), AutoPlay = "false" }, 8376 Design = new Design 8377 { 8378 RenderType = RenderType.Column, 8379 Size = imageColumns, 8380 CssClass = "u-color-light--bg u-padding--lg" 8381 } 8382 }; 8383 articlePage.Add("ArticleBodyRow", articleParagraphVideo); 8384 } 83858386 if (!String.IsNullOrEmpty(paragraph.GetString("Heading"))) 8387 { 8388 Block articleParagraphHeader = new Block 8389 { 8390 Id = "ArticleParagraph" + count + "Heading", 8391 SortId = (count * 10) + 2, 8392 Component = new ArticleSubHeader { Title = paragraph.GetString("Heading") }, 8393 Design = new Design 8394 { 8395 RenderType = RenderType.Column, 8396 Size = contentColumns, 8397 CssClass = "u-color-light--bg u-padding--lg" 8398 } 8399 }; 8400 articlePage.Add("ArticleBodyRow", articleParagraphHeader); 8401 } 84028403 if (!String.IsNullOrEmpty(text)) 8404 { 8405 Block articleParagraphText = new Block 8406 { 8407 Id = "ArticleParagraph" + count + "Text", 8408 SortId = (count * 10) + 3, 8409 Component = new ArticleText { Text = text }, 8410 Design = new Design 8411 { 8412 RenderType = RenderType.Column, 8413 Size = contentColumns, 8414 CssClass = "u-color-light--bg u-padding--lg" 8415 } 8416 }; 84178418 articlePage.Add("ArticleBodyRow", articleParagraphText); 8419 } 8420 } 8421 else 8422 { 8423 if (!String.IsNullOrEmpty(paragraph.GetString("Text"))) 8424 { 8425 string quoteText = paragraph.GetString("Text") != null ? paragraph.GetString("Text") : ""; 8426 string quoteAuthor = paragraph.GetString("Heading") != null ? paragraph.GetString("Heading") : ""; 84278428 Block articleParagraphQuote = new Block 8429 { 8430 Id = "ArticleParagraph" + count + "Quote", 8431 SortId = (count * 10) + 3, 8432 Component = new ArticleQuote { Image = new Image { Path = paragraph.GetFile("Image") }, Text = quoteText, Author = quoteAuthor }, 8433 Design = new Design 8434 { 8435 RenderType = RenderType.Column, 8436 Size = contentColumns, 8437 CssClass = "u-color-light--bg u-padding--lg" 8438 } 8439 }; 8440 articlePage.Add("ArticleBodyRow", articleParagraphQuote); 8441 } 8442 } 84438444 count++; 8445 } 8446 } 84478448 articleBodyRow.Component = new ArticleBodyRow { SubBlocks = articleBodyRow.BlocksList, TopLayout = topLayout, TextLayout = textLayout }; 844984508451 //Related 8452 string showRelatedArtices = Model.Item.GetString("ShowRelatedArticles") != null ? Model.Item.GetList("ShowRelatedArticles").SelectedValue.ToLower() : "default"; 8453 showRelatedArtices = showRelatedArtices == "default" && GetParentSettingsItem("ShowRelatedArticles") != null ? GetParentSettingsItem("ShowRelatedArticles").ToString().ToLower() : showRelatedArtices; 84548455 if (showRelatedArtices == "true") 8456 { 8457 Block articleRelated = new Block 8458 { 8459 Id = "ArticleRelated", 8460 SortId = 30, 8461 Component = new ArticleRelated { Title = Translate("Related articles"), FeedPageId = listPageId, Query = "sourceType=Page&sourcePage=" + parentPageId, PageSize = 4, CurrentPageId = Model.ID.ToString() }, 8462 Design = new Design 8463 { 8464 RenderType = RenderType.Column, 8465 Size = "12" 8466 } 8467 }; 8468 articlePage.Add("ArticleContainer", articleRelated); 8469 } 8470 } 847184728473 @using System 8474 @using System.Web 8475 @using System.Collections.Generic 8476 @using Dynamicweb.Rapido.Blocks 84778478 @{ 8479 BlocksPage dynamicArticleCustomBlocksPage = BlocksPage.GetBlockPage("DynamicArticle"); 84808481 } 848284838484 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 8485 @RenderBlockList(articlePage.BlocksRoot.BlocksList) 8486 @SnippetEnd("Content") 84878488 @helper RenderIosTabletFix() { 8489 if (Pageview.Device != Dynamicweb.Frontend.Devices.DeviceType.Tablet && Pageview.Platform != Dynamicweb.Frontend.Devices.PlatformType.Ios) 8490 { 8491 <script> 8492 let isIpadIOS = (/iPad/.test(navigator.platform) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1)) && !window.MSStream; 8493 if (isIpadIOS) { 8494 var separator = (window.location.href.indexOf("?") === -1) ? "?" : "&"; 8495 window.location.href = window.location.href + separator + "DeviceType=Tablet&PlatformType=Ios"; 8496 } 8497 </script> 8498 } 8499 } 85008501 </html> 85028503