Error executing template "Designs/Rapido/_parsed/NewsArticle.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_17a925398ba5426c9d54dd994e2ce894.Execute() in D:\dynamicweb.net\Solutions\Novicell\Færch\Files\Templates\Designs\Rapido\_parsed\NewsArticle.parsed.cshtml:line 8286
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

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