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_1bfb1f9268a247a58a8f64d79f4fb8f2.Execute() in D:\dynamicweb.net\Solutions\Novicell\Færch\Files\Templates\Designs\Rapido\_parsed\NewsArticle.parsed.cshtml:line 8133
   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 3688 @{ 3689 BlocksPage customMobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master"); 3690 } 3691 3692 3693 3694 @helper RenderMobileCartInitialization() 3695 { 3696 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 3697 <script> 3698 window.cartId = "@miniCartFeedPageId"; 3699 </script> 3700 } 3701 3702 @helper RenderMobileTop() 3703 { 3704 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileTop").OrderBy(item => item.SortId).ToList(); 3705 3706 <nav class="main-navigation-mobile dw-mod"> 3707 <div class="center-container top-container__center-container dw-mod"> 3708 <div class="grid grid--align-center"> 3709 @RenderBlockList(subBlocks) 3710 </div> 3711 </div> 3712 </nav> 3713 } 3714 3715 @helper RenderMobileHeaderNavigation() 3716 { 3717 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderNavigation").OrderBy(item => item.SortId).ToList(); 3718 3719 <div class="grid__col-auto-width"> 3720 <ul class="menu dw-mod"> 3721 @RenderBlockList(subBlocks) 3722 </ul> 3723 </div> 3724 } 3725 3726 @helper RenderMobileHeaderNavigationTrigger() 3727 { 3728 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 3729 <label for="MobileNavTrigger" class="mobile-nav-trigger-button menu__link menu__link--icon menu__link--mobile dw-mod"></label> 3730 </li> 3731 } 3732 3733 @helper RenderMobileHeaderLogo() 3734 { 3735 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderLogo").OrderBy(item => item.SortId).ToList(); 3736 3737 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"; 3738 string centeredLogo = mobileTopLayout != "nav-right" ? "u-ta-center" : ""; 3739 string firstPageId = Model.Area.FirstActivePage.ID.ToString(); 3740 string businessName = Model.Area.Item.GetItem("Settings").GetString("BusinessName"); 3741 3742 string mobileLogo = "/Files/Images/logo-dynamicweb.png"; 3743 if (Model.Area.Item.GetItem("Layout").GetItem("MobileTop") != null && Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo") != null) 3744 { 3745 mobileLogo = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo").PathUrlEncoded; 3746 } 3747 3748 if (Path.GetExtension(mobileLogo).ToLower() != ".svg") 3749 { 3750 mobileLogo = "/Admin/Public/GetImage.ashx?height=40&amp;width=100&amp;crop=5&amp;Compression=75&amp;image=" + mobileLogo; 3751 } 3752 else 3753 { 3754 mobileLogo = HttpUtility.UrlDecode(mobileLogo); 3755 } 3756 3757 <div class="grid__col-auto grid__col--bleed"> 3758 <div class="grid__cell @centeredLogo"> 3759 <a href="/Default.aspx?ID=@firstPageId" class="logo logo--mobile u-inline-block dw-mod"> 3760 <img class="grid__cell-img logo__img logo__img--mobile dw-mod" src="@mobileLogo" alt="@businessName" /> 3761 </a> 3762 </div> 3763 3764 @RenderBlockList(subBlocks) 3765 </div> 3766 } 3767 3768 @helper RenderMobileTopActions() 3769 { 3770 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderActions").OrderBy(item => item.SortId).ToList(); 3771 3772 <div class="grid__col-auto-width"> 3773 <ul class="menu dw-mod"> 3774 @RenderBlockList(subBlocks) 3775 </ul> 3776 </div> 3777 } 3778 3779 @helper RenderMobileTopSearch() 3780 { 3781 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 3782 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> 3783 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> 3784 </label> 3785 </li> 3786 } 3787 3788 @helper RenderMobileTopMiniCart() 3789 { 3790 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 3791 int cartPageId = GetPageIdByNavigationTag("CartPage"); 3792 double cartProductsCount = Model.Cart.TotalProductsCount; 3793 3794 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod" id="miniCartWrapper"> 3795 <div class="mini-cart dw-mod"> 3796 <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"> 3797 <div class="u-inline u-position-relative"> 3798 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue fa-1_5x"></i> 3799 <div class="mini-cart__counter dw-mod"> 3800 <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"> 3801 <div class="js-mini-cart-counter-content" data-count="@cartProductsCount"> 3802 @cartProductsCount 3803 </div> 3804 </div> 3805 </div> 3806 </div> 3807 </a> 3808 </div> 3809 </li> 3810 } 3811 3812 @helper RenderMobileTopSearchBar() 3813 { 3814 string searchFeedId = ""; 3815 string searchSecondFeedId = ""; 3816 int groupsFeedId; 3817 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 3818 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 3819 string resultPageLink; 3820 string searchPlaceholder; 3821 string searchType = "product-search"; 3822 string searchTemplate; 3823 string searchContentTemplate = ""; 3824 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; 3825 bool showGroups = true; 3826 3827 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch") 3828 { 3829 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 3830 resultPageLink = contentSearchPageLink; 3831 searchPlaceholder = Translate("Search page"); 3832 groupsFeedId = 0; 3833 searchType = "content-search"; 3834 searchTemplate = "SearchPagesTemplate"; 3835 showGroups = false; 3836 } 3837 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch") 3838 { 3839 searchFeedId = productsPageId + "&feed=true"; 3840 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 3841 resultPageLink = Converter.ToString(productsPageId); 3842 searchPlaceholder = Translate("Search products or pages"); 3843 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 3844 searchType = "combined-search"; 3845 searchTemplate = "SearchProductsTemplateWrap"; 3846 searchContentTemplate = "SearchPagesTemplateWrap"; 3847 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 3848 } 3849 else 3850 { 3851 resultPageLink = Converter.ToString(productsPageId); 3852 searchFeedId = productsPageId + "&feed=true"; 3853 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 3854 searchPlaceholder = Translate("Search products"); 3855 searchTemplate = "SearchProductsTemplate"; 3856 searchType = "product-search"; 3857 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 3858 } 3859 3860 <input type="checkbox" id="MobileSearchTrigger" class="mobile-search-trigger" /> 3861 3862 <div class="main-navigation-mobile typeahead-mobile dw-mod"> 3863 <div class="center-container top-container__center-container dw-mod"> 3864 <div class="grid"> 3865 <div class="grid__col-auto"> 3866 <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"> 3867 <input type="text" class="js-typeahead-search-field u-w160px u-no-margin" placeholder="@searchPlaceholder" value="@searchValue"> 3868 @if (string.IsNullOrEmpty(searchSecondFeedId)) 3869 { 3870 <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> 3871 } 3872 else 3873 { 3874 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--combined-mobile grid"> 3875 <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> 3876 <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> 3877 </div> 3878 } 3879 <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> 3880 </div> 3881 </div> 3882 <div class="grid__col-auto-width"> 3883 <ul class="menu dw-mod"> 3884 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 3885 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> 3886 <i class="fas fa-times fa-1_5x"></i> 3887 </label> 3888 </li> 3889 </ul> 3890 </div> 3891 </div> 3892 </div> 3893 </div> 3894 } 3895 3896 @helper RenderMobileMiniCartCounterContent() 3897 { 3898 <script id="MiniCartCounterContent" type="text/x-template"> 3899 {{#.}} 3900 <div class="js-mini-cart-counter-content dw-mod" data-count="{{numberofproducts}}"> 3901 {{numberofproducts}} 3902 </div> 3903 {{/.}} 3904 </script> 3905 }</text> 3906 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3907 3908 @using System 3909 @using System.Web 3910 @using System.Collections.Generic 3911 @using Dynamicweb.Rapido.Blocks.Extensibility 3912 @using Dynamicweb.Rapido.Blocks 3913 3914 @functions { 3915 BlocksPage mobileNavigationBlocksPage = BlocksPage.GetBlockPage("Master"); 3916 } 3917 3918 @{ 3919 bool mobileNavigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 3920 bool mobileHideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); 3921 bool mobileHideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); 3922 bool mobileHideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); 3923 bool mobileHideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); 3924 bool mobileHideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); 3925 3926 Block mobileNavigation = new Block() 3927 { 3928 Id = "MobileNavigation", 3929 SortId = 10, 3930 Template = MobileNavigation(), 3931 SkipRenderBlocksList = true 3932 }; 3933 mobileNavigationBlocksPage.Add(MasterBlockId.MasterTopSnippets, mobileNavigation); 3934 3935 if (Model.CurrentUser.ID > 0 && !mobileHideMyProfileLink) 3936 { 3937 Block mobileNavigationSignIn = new Block 3938 { 3939 Id = "MobileNavigationSignIn", 3940 SortId = 10, 3941 Template = RenderMobileNavigationSignIn() 3942 }; 3943 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationSignIn); 3944 } 3945 3946 Block mobileNavigationMenu = new Block 3947 { 3948 Id = "MobileNavigationMenu", 3949 SortId = 20, 3950 Template = RenderMobileNavigationMenu() 3951 }; 3952 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationMenu); 3953 3954 Block mobileNavigationActions = new Block 3955 { 3956 Id = "MobileNavigationActions", 3957 SortId = 30, 3958 Template = RenderMobileNavigationActions(), 3959 SkipRenderBlocksList = true 3960 }; 3961 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationActions); 3962 3963 if (!mobileNavigationItemsHideSignIn) 3964 { 3965 if (Model.CurrentUser.ID <= 0) 3966 { 3967 Block mobileNavigationSignInAction = new Block 3968 { 3969 Id = "MobileNavigationSignInAction", 3970 SortId = 10, 3971 Template = RenderMobileNavigationSignInAction() 3972 }; 3973 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignInAction); 3974 3975 if (!mobileHideCreateAccountLink) 3976 { 3977 Block mobileNavigationCreateAccountAction = new Block 3978 { 3979 Id = "MobileNavigationCreateAccountAction", 3980 SortId = 20, 3981 Template = RenderMobileNavigationCreateAccountAction() 3982 }; 3983 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationCreateAccountAction); 3984 } 3985 } 3986 else 3987 { 3988 if (!mobileHideMyOrdersLink) 3989 { 3990 Block mobileNavigationOrdersAction = new Block 3991 { 3992 Id = "MobileNavigationOrdersAction", 3993 SortId = 20, 3994 Template = RenderMobileNavigationOrdersAction() 3995 }; 3996 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationOrdersAction); 3997 } 3998 if (!mobileHideMyFavoritesLink) 3999 { 4000 Block mobileNavigationFavoritesAction = new Block 4001 { 4002 Id = "MobileNavigationFavoritesAction", 4003 SortId = 30, 4004 Template = RenderMobileNavigationFavoritesAction() 4005 }; 4006 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationFavoritesAction); 4007 } 4008 if (!mobileHideMySavedCardsLink) 4009 { 4010 Block mobileNavigationSavedCardsAction = new Block 4011 { 4012 Id = "MobileNavigationFavoritesAction", 4013 SortId = 30, 4014 Template = RenderMobileNavigationSavedCardsAction() 4015 }; 4016 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSavedCardsAction); 4017 } 4018 4019 Block mobileNavigationSignOutAction = new Block 4020 { 4021 Id = "MobileNavigationSignOutAction", 4022 SortId = 40, 4023 Template = RenderMobileNavigationSignOutAction() 4024 }; 4025 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignOutAction); 4026 } 4027 } 4028 4029 if (Model.Languages.Count > 1) 4030 { 4031 Block mobileNavigationLanguagesAction = new Block 4032 { 4033 Id = "MobileNavigationLanguagesAction", 4034 SortId = 50, 4035 Template = RenderMobileNavigationLanguagesAction() 4036 }; 4037 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationLanguagesAction); 4038 } 4039 } 4040 4041 4042 @helper MobileNavigation() 4043 { 4044 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigation").OrderBy(item => item.SortId).ToList(); 4045 string mobileTopDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design") != null ? Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design").SelectedValue : "nav-left"; 4046 string position = mobileTopDesign == "nav-left" || mobileTopDesign == "nav-search-left" ? "left" : "right"; 4047 4048 <!-- Trigger for mobile navigation --> 4049 <input type="checkbox" id="MobileNavTrigger" class="mobile-nav-trigger mobile-nav-trigger--@position" autocomplete="off" /> 4050 4051 <!-- Mobile navigation --> 4052 <nav class="mobile-navigation mobile-navigation--@position dw-mod"> 4053 <div class="mobile-navigation__wrapper" id="mobileNavigationWrapper"> 4054 @RenderBlockList(subBlocks) 4055 </div> 4056 </nav> 4057 4058 <label class="mobile-nav-trigger-off" for="MobileNavTrigger"></label> 4059 } 4060 4061 @helper RenderMobileNavigationSignIn() 4062 { 4063 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 4064 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 4065 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 4066 string myProfilePageLink = linkStart + myProfilePageId; 4067 string userName = Model.CurrentUser.FirstName; 4068 if (!string.IsNullOrEmpty(userName) && !string.IsNullOrEmpty(Model.CurrentUser.LastName)) 4069 { 4070 userName += " " + Model.CurrentUser.LastName; 4071 } 4072 if (string.IsNullOrEmpty(userName)) 4073 { 4074 userName = Model.CurrentUser.Name; 4075 } 4076 if (string.IsNullOrEmpty(userName)) 4077 { 4078 userName = Model.CurrentUser.UserName; 4079 } 4080 if (string.IsNullOrEmpty(userName)) 4081 { 4082 userName = Model.CurrentUser.Email; 4083 } 4084 4085 <ul class="menu menu-mobile"> 4086 <li class="menu-mobile__item"> 4087 <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> 4088 </li> 4089 </ul> 4090 } 4091 4092 @helper RenderMobileNavigationMenu() 4093 { 4094 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides"; 4095 string menuTemplate = isSlidesDesign ? "BaseMenuForMobileSlides.xslt" : "BaseMenuForMobileExpandable.xslt"; 4096 string levels = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels") : "3"; 4097 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 4098 int startLevel = 0; 4099 var websiteName = Pageview.Area.Name; 4100 4101 if (websiteName == "Kosmetoglognet" || websiteName == "Kosmetolognet") 4102 { 4103 @RenderNavigation(new 4104 { 4105 id = "mobilenavigation", 4106 cssclass = "menu menu-mobile dwnavigation", 4107 startLevel = 0, 4108 ecomStartLevel = 1, 4109 endlevel = 1, 4110 expandmode = "none", 4111 template = @menuTemplate 4112 }) 4113 } 4114 4115 else 4116 { 4117 @RenderNavigation(new 4118 { 4119 id = "mobilenavigation", 4120 cssclass = "menu menu-mobile dwnavigation", 4121 startLevel = @startLevel, 4122 ecomStartLevel = @startLevel + 1, 4123 endlevel = @levels, 4124 expandmode = "all", 4125 template = @menuTemplate 4126 }) 4127 } 4128 4129 if (isSlidesDesign) 4130 { 4131 <script> 4132 function goToLevel(level) { 4133 document.getElementById('mobileNavigationWrapper').style.left = -(level * 100) + "%"; 4134 } 4135 4136 document.addEventListener('DOMContentLoaded', function () { 4137 goToLevel(document.getElementById('mobileNavigationWrapper').querySelectorAll('input[type=radio]:checked').length); 4138 }); 4139 </script> 4140 } 4141 4142 if (renderPagesInToolBar) 4143 { 4144 @* @RenderNavigation(new 4145 { 4146 id = "topToolsMobileNavigation", 4147 cssclass = "menu menu-mobile dwnavigation", 4148 template = "ToolsMenuForMobile.xslt" 4149 }) *@ 4150 } 4151 } 4152 4153 @helper RenderMobileNavigationActions() 4154 { 4155 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigationActions").OrderBy(item => item.SortId).ToList(); ; 4156 4157 <ul class="menu menu-mobile"> 4158 @RenderBlockList(subBlocks) 4159 </ul> 4160 } 4161 4162 @helper RenderMobileNavigationSignInAction() 4163 { 4164 <li class="menu-mobile__item"> 4165 <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> 4166 </li> 4167 } 4168 4169 @helper RenderMobileNavigationCreateAccountAction() 4170 { 4171 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 4172 4173 <li class="menu-mobile__item"> 4174 <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> 4175 </li> 4176 } 4177 4178 @helper RenderMobileNavigationProfileAction() 4179 { 4180 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 4181 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 4182 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 4183 string myProfilePageLink = linkStart + myProfilePageId; 4184 4185 <li class="menu-mobile__item"> 4186 <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> 4187 </li> 4188 } 4189 4190 @helper RenderMobileNavigationOrdersAction() 4191 { 4192 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 4193 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 4194 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); 4195 string myOrdersPageLink = linkStart + myOrdersPageId; 4196 string ordersIcon = "fas fa-list"; 4197 4198 <li class="menu-mobile__item"> 4199 <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> 4200 </li> 4201 } 4202 4203 @helper RenderMobileNavigationFavoritesAction() 4204 { 4205 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 4206 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 4207 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 4208 string myFavoritesPageLink = linkStart + myFavoritesPageId; 4209 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"; 4210 4211 4212 <li class="menu-mobile__item"> 4213 <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> 4214 </li> 4215 } 4216 4217 @helper RenderMobileNavigationSavedCardsAction() 4218 { 4219 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 4220 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 4221 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards"); 4222 string mySavedCardsPageLink = linkStart + mySavedCardsPageId; 4223 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"; 4224 4225 <li class="menu-mobile__item"> 4226 <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> 4227 </li> 4228 } 4229 4230 @helper RenderMobileNavigationSignOutAction() 4231 { 4232 int pageId = Model.TopPage.ID; 4233 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"; 4234 4235 <li class="menu-mobile__item"> 4236 <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> 4237 </li> 4238 } 4239 4240 @helper RenderMobileNavigationLanguagesAction() 4241 { 4242 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides"; 4243 4244 string selectedLanguage = ""; 4245 foreach (var lang in Model.Languages) 4246 { 4247 if (lang.IsCurrent) 4248 { 4249 selectedLanguage = lang.Name; 4250 } 4251 } 4252 4253 <li class="menu-mobile__item dw-mod"> 4254 @if (isSlidesDesign) 4255 { 4256 <input id="MobileMenuCheck_Language" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(1);"> 4257 } 4258 else 4259 { 4260 <input id="MobileMenuCheck_Language" type="checkbox" class="expand-trigger"> 4261 } 4262 <div class="menu-mobile__link__wrap"> 4263 <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> 4264 <label for="MobileMenuCheck_Language" class="menu-mobile__trigger"></label> 4265 </div> 4266 <ul class="menu-mobile menu-mobile__submenu expand-menu"> 4267 @if (isSlidesDesign) 4268 { 4269 <li class="menu-mobile__item dw-mod"> 4270 <div class="menu-mobile__link__wrap"> 4271 <input id="MobileMenuCheck_Language_back" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(0);" /> 4272 <label for="MobileMenuCheck_Language_back" class="menu-mobile__trigger menu-mobile__trigger--back"></label> 4273 <label for="MobileMenuCheck_Language_back" class="menu-mobile__link dw-mod ">@Translate("Back")</label> 4274 </div> 4275 </li> 4276 } 4277 @foreach (var lang in Model.Languages) 4278 { 4279 <li class="menu-mobile__item dw-mod"> 4280 <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> 4281 </li> 4282 } 4283 </ul> 4284 </li> 4285 }</text> 4286 } 4287 else 4288 { 4289 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4290 4291 @using System 4292 @using System.Web 4293 @using System.Collections.Generic 4294 @using Dynamicweb.Rapido.Blocks.Extensibility 4295 @using Dynamicweb.Rapido.Blocks 4296 4297 @functions { 4298 BlocksPage headerBlocksPage = BlocksPage.GetBlockPage("Master"); 4299 } 4300 4301 @{ 4302 4303 Block masterTools = new Block() 4304 { 4305 Id = "MasterDesktopTools", 4306 SortId = 10, 4307 Template = RenderDesktopTools(), 4308 SkipRenderBlocksList = true, 4309 BlocksList = new List<Block> 4310 { 4311 new Block { 4312 Id = "MasterDesktopToolsText", 4313 SortId = 10, 4314 Template = RenderDesktopToolsText(), 4315 Design = new Design 4316 { 4317 Size = "auto", 4318 HidePadding = true, 4319 RenderType = RenderType.Column 4320 } 4321 }, 4322 new Block { 4323 Id = "MasterDesktopToolsNavigation", 4324 SortId = 20, 4325 Template = RenderDesktopToolsNavigation(), 4326 Design = new Design 4327 { 4328 Size = "auto-width", 4329 HidePadding = true, 4330 RenderType = RenderType.Column 4331 } 4332 } 4333 } 4334 }; 4335 headerBlocksPage.Add("MasterHeader", masterTools); 4336 4337 Block masterDesktopExtra = new Block() 4338 { 4339 Id = "MasterDesktopExtra", 4340 SortId = 10, 4341 Template = RenderDesktopExtra(), 4342 SkipRenderBlocksList = true 4343 }; 4344 headerBlocksPage.Add("MasterHeader", masterDesktopExtra); 4345 4346 Block masterDesktopNavigation = new Block() 4347 { 4348 Id = "MasterDesktopNavigation", 4349 SortId = 20, 4350 Template = RenderDesktopNavigation(), 4351 SkipRenderBlocksList = true 4352 }; 4353 headerBlocksPage.Add("MasterHeader", masterDesktopNavigation); 4354 } 4355 4356 @* Include the Blocks for the page *@ 4357 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4358 4359 @using System 4360 @using System.Web 4361 @using Dynamicweb.Rapido.Blocks.Extensibility 4362 @using Dynamicweb.Rapido.Blocks 4363 4364 @{ 4365 Block masterDesktopLogo = new Block 4366 { 4367 Id = "MasterDesktopLogo", 4368 SortId = 10, 4369 Template = RenderDesktopLogo(), 4370 Design = new Design 4371 { 4372 Size = "auto-width", 4373 HidePadding = true, 4374 RenderType = RenderType.Column, 4375 CssClass = "grid--align-self-center" 4376 } 4377 }; 4378 4379 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopLogo); 4380 } 4381 4382 4383 @helper RenderDesktopLogo() 4384 { 4385 bool redirectFirstPage = Pageview.Area.RedirectFirstPage; 4386 string firstPageId = Model.Area.FirstActivePage.ID.ToString(); 4387 string logoLink = redirectFirstPage ? "/" : "/Default.aspx?ID=" + firstPageId; 4388 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4389 string alignClass = topLayout == "two-lines-centered" || topLayout == "two-lines" ? "grid--align-self-center" : ""; 4390 string logo = Model.Area.Item.GetItem("Layout").GetFile("LogoImage") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoImage").PathUrlEncoded : "/Files/Images/logo-dynamicweb.png"; 4391 if (Path.GetExtension(logo).ToLower() != ".svg") 4392 { 4393 int logoHeight = Model.Area.Item.GetItem("Layout").GetInt32("LogoHeight"); 4394 logoHeight = logoHeight > 0 && Pageview.Device.ToString() != "Mobile" ? logoHeight : 40; 4395 logo = "/Admin/Public/GetImage.ashx?height=" + Converter.ToString(logoHeight) + "&amp;crop=5&amp;Compression=75&amp;image=" + logo; 4396 } 4397 else 4398 { 4399 logo = HttpUtility.UrlDecode(logo); 4400 } 4401 4402 <div class="logo @alignClass dw-mod"> 4403 <a href="@logoLink" class="logo__img dw-mod u-block"> 4404 <img class="grid__cell-img logo__img dw-mod" src="@logo" alt="@Translate("Logo")" /> 4405 </a> 4406 </div> 4407 } 4408 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4409 4410 @using System 4411 @using System.Web 4412 @using Dynamicweb.Rapido.Blocks.Extensibility 4413 @using Dynamicweb.Rapido.Blocks 4414 4415 @functions { 4416 bool isMegaMenu; 4417 } 4418 4419 @{ 4420 isMegaMenu = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu") != null ? Converter.ToBoolean(Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu").SelectedValue) : false; 4421 Block masterDesktopMenu = new Block 4422 { 4423 Id = "MasterDesktopMenu", 4424 SortId = 10, 4425 Template = RenderDesktopMenu(), 4426 Design = new Design 4427 { 4428 Size = "auto", 4429 HidePadding = true, 4430 RenderType = RenderType.Column 4431 } 4432 }; 4433 4434 if (isMegaMenu) 4435 { 4436 masterDesktopMenu.Design.CssClass = "u-reset-position"; 4437 } 4438 4439 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopMenu); 4440 } 4441 4442 @helper RenderDesktopMenu() 4443 { 4444 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4445 string menuAlignment = topLayout == "minimal-right" ? "grid--align-self-end" : ""; 4446 string megamenuPromotionImage = Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage").PathUrlEncoded : ""; 4447 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 4448 bool showOnlyHeaders = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowOnlyHeaders"); 4449 int startLevel = renderPagesInToolBar ? 1 : 0; 4450 var websiteName = Pageview.Area.Name; 4451 4452 string promotionLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("MegamenuPromotionLink"); 4453 4454 <div class="grid__cell u-flex @(isMegaMenu ? "u-reset-position" : "") @menuAlignment"> 4455 @if (!isMegaMenu) 4456 { 4457 @RenderNavigation(new 4458 { 4459 id = "topnavigation", 4460 cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap", 4461 startLevel = startLevel, 4462 ecomStartLevel = startLevel + 1, 4463 endlevel = 5, 4464 expandmode = "all", 4465 template = "BaseMenuWithDropdown.xslt" 4466 }); 4467 } 4468 else 4469 { 4470 4471 if (websiteName == "Dermalogica" || websiteName == "Janeiredale") 4472 { 4473 @RenderNavigation(new 4474 { 4475 id = "topnavigation", 4476 cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap", 4477 startLevel = startLevel, 4478 ecomStartLevel = startLevel + 1, 4479 endlevel = 5, 4480 promotionImage = megamenuPromotionImage, 4481 promotionLink = promotionLink, 4482 expandmode = "all", 4483 showOnlyHeaders = showOnlyHeaders.ToString().ToLower(), 4484 template = "BaseMegaMenu.xslt" 4485 }); 4486 } 4487 4488 if (websiteName == "Kosmetoglognet" || websiteName == "Kosmetolognet") 4489 { 4490 @RenderNavigation(new 4491 { 4492 id = "topnavigation", 4493 cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap", 4494 startLevel = 0, 4495 ecomStartLevel = 1, 4496 endlevel = 1, 4497 promotionImage = megamenuPromotionImage, 4498 promotionLink = promotionLink, 4499 expandmode = "none", 4500 showOnlyHeaders = showOnlyHeaders.ToString().ToLower(), 4501 template = "BaseMegaMenuKosmetolognet.xslt" 4502 }); 4503 4504 } 4505 4506 4507 } 4508 </div> 4509 } 4510 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4511 4512 @using System 4513 @using System.Web 4514 @using Dynamicweb.Rapido.Blocks.Extensibility 4515 @using Dynamicweb.Rapido.Blocks 4516 4517 @{ 4518 var websiteName = Pageview.Area.Name; 4519 4520 if (websiteName == "Dermalogica" || websiteName == "Janeiredale") 4521 { 4522 Block masterDesktopActionsMenu = new Block 4523 { 4524 Id = "MasterDesktopActionsMenu", 4525 SortId = 10, 4526 //Template = RenderDesktopActionsMenu(), 4527 Design = new Design 4528 { 4529 CssClass = "u-flex" 4530 }, 4531 SkipRenderBlocksList = true 4532 4533 }; 4534 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopActionsMenu); 4535 4536 } 4537 4538 else 4539 { 4540 Block masterDesktopActionsMenu = new Block 4541 { 4542 Id = "MasterDesktopActionsMenu", 4543 SortId = 10, 4544 Template = RenderDesktopActionsMenu(), 4545 Design = new Design 4546 { 4547 CssClass = "u-flex" 4548 }, 4549 SkipRenderBlocksList = true 4550 4551 }; 4552 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopActionsMenu); 4553 4554 4555 4556 4557 if (!string.IsNullOrWhiteSpace(Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink"))) 4558 { 4559 Block masterDesktopActionsHeaderButton = new Block 4560 { 4561 Id = "MasterDesktopActionsHeaderButton", 4562 SortId = 60, 4563 Template = RenderHeaderButton() 4564 }; 4565 masterDesktopActionsMenu.Add(masterDesktopActionsHeaderButton); 4566 } 4567 } 4568 4569 @helper RenderDesktopActionsMenu() 4570 { 4571 List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopActionsMenu").OrderBy(item => item.SortId).ToList(); 4572 4573 <ul class="menu u-flex dw-mod"> 4574 @RenderBlockList(subBlocks) 4575 4576 </ul> 4577 } 4578 4579 @helper RenderHeaderButton() 4580 { 4581 string headerButtonText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonText"); 4582 string headerButtonLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink"); 4583 string headerButtonType = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType") != null ? "btn--" + Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType").SelectedName.ToLower() : ""; 4584 4585 <li class="menu__item menu__item--horizontal menu--clean dw-mod"> 4586 <a class="btn @headerButtonType dw-mod u-no-margin u-margin-top u-margin-left" href="@headerButtonLink">@headerButtonText</a> 4587 </li> 4588 } 4589 } 4590 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4591 4592 @using System 4593 @using System.Web 4594 @using Dynamicweb.Core; 4595 @using System.Text.RegularExpressions 4596 @using Dynamicweb.Rapido.Blocks.Extensibility 4597 @using Dynamicweb.Rapido.Blocks 4598 4599 @{ 4600 Block masterDesktopActionsMenuLanguageSelector = new Block 4601 { 4602 Id = "MasterDesktopActionsMenuLanguageSelector", 4603 SortId = 40, 4604 Template = RenderLanguageSelector() 4605 }; 4606 4607 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuLanguageSelector); 4608 } 4609 4610 @helper RenderLanguageSelector() 4611 { 4612 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4613 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 4614 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4615 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() : ""; 4616 4617 if (Model.Languages.Count > 1) 4618 { 4619 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon is-dropdown is-dropdown--no-icon dw-mod"> 4620 <div class="@menuLinkClass dw-mod" title="@Translate("Language")"> 4621 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue fa-1_5x"></i> 4622 </div> 4623 <div class="menu menu--dropdown menu--dropdown-right languages-dropdown dw-mod grid__cell"> 4624 @foreach (var lang in Model.Languages) 4625 { 4626 string widthClass = "menu__item--fixed-width"; 4627 string langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " u-margin-right\"></span>" + lang.Name; 4628 string cultureName = Regex.Replace(Dynamicweb.Services.Areas.GetArea(lang.ID).CultureInfo.NativeName, @" ?\(.*?\)", string.Empty); 4629 cultureName = char.ToUpper(cultureName[0]) + cultureName.Substring(1); 4630 4631 if (languageViewType == "flag-culture") 4632 { 4633 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span> " + cultureName; 4634 } 4635 4636 if (languageViewType == "flag") 4637 { 4638 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span>"; 4639 widthClass = ""; 4640 } 4641 4642 if (languageViewType == "name") 4643 { 4644 langInfo = lang.Name; 4645 } 4646 4647 if (languageViewType == "culture") 4648 { 4649 langInfo = cultureName; 4650 widthClass = ""; 4651 } 4652 4653 <div class="menu__item dw-mod @widthClass"> 4654 <a href="/Default.aspx?AreaID=@Dynamicweb.Services.Pages.GetPage(lang.Page.ID).Area.ID" class="menu-dropdown__link dw-mod">@langInfo</a> 4655 </div> 4656 } 4657 </div> 4658 </li> 4659 } 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 Block masterDesktopActionsMenuSignIn = new Block 4670 { 4671 Id = "MasterDesktopActionsMenuSignIn", 4672 SortId = 20, 4673 Template = RenderSignIn() 4674 }; 4675 4676 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuSignIn); 4677 } 4678 4679 @helper RenderSignIn() 4680 { 4681 bool navigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 4682 string userInitials = ""; 4683 int pageId = GetPageIdByNavigationTag("Frontpage"); 4684 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 4685 int myDashboardPageId = GetPageIdByNavigationTag("CustomerDashboard"); 4686 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 4687 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); 4688 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 4689 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards"); 4690 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 4691 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); 4692 bool hideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); 4693 bool hideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); 4694 bool hideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); 4695 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); 4696 bool hideForgotPasswordLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideForgotPasswordLink"); 4697 4698 string linkStart = "/Default.aspx?ID="; 4699 if (Model.CurrentUser.ID <= 0) 4700 { 4701 linkStart += signInProfilePageId + "&RedirectPageId="; 4702 } 4703 4704 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; 4705 string myProfilePageLink = linkStart + myProfilePageId; 4706 string myOrdersPageLink = linkStart + myOrdersPageId; 4707 string myFavoritesPageLink = linkStart + myFavoritesPageId; 4708 string mySavedCardsPageLink = linkStart + mySavedCardsPageId; 4709 4710 string profileIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue : "fa fa-user"; 4711 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"; 4712 4713 if (Model.CurrentUser.ID != 0) 4714 { 4715 userInitials = Dynamicweb.Rapido.Services.User.GetInitials(Model.CurrentUser.Name, Model.CurrentUser.FirstName, Model.CurrentUser.LastName, Model.CurrentUser.Email, Model.CurrentUser.UserName); 4716 } 4717 4718 if (!navigationItemsHideSignIn) 4719 { 4720 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4721 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu__item--clean"; 4722 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4723 4724 <li class="menu__item menu__item--horizontal menu__item menu__item--icon @liClasses is-dropdown is-dropdown--no-icon dw-mod"> 4725 <div class="@menuLinkClass dw-mod"> 4726 @if (Model.CurrentUser.ID <= 0) 4727 { 4728 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue fa-1_5x" title="@Translate("Sign in")"></i> 4729 } 4730 else 4731 { 4732 <a href="/default.aspx?ID=@myDashboardPageId" class="u-color-inherit" title="@Translate("Customer center")"><div class="circle-icon-btn">@userInitials.ToUpper()</div></a> 4733 } 4734 </div> 4735 <div class="menu menu--dropdown menu--dropdown-right menu--sign-in grid__cell dw-mod"> 4736 <ul class="list list--clean dw-mod"> 4737 @if (Model.CurrentUser.ID <= 0) 4738 { 4739 <li> 4740 <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> 4741 </li> 4742 4743 if (!hideCreateAccountLink) 4744 { 4745 @RenderListItem("/default.aspx?ID=" + createAccountPageId, Translate("Create account")); 4746 } 4747 if (!hideForgotPasswordLink) 4748 { 4749 @RenderListItem(forgotPasswordPageLink, Translate("Forgot your password?")) 4750 } 4751 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) 4752 { 4753 @RenderSeparator() 4754 } 4755 } 4756 @if (!hideMyProfileLink) 4757 { 4758 @RenderListItem(myProfilePageLink, Translate("My Profile"), profileIcon) 4759 } 4760 @if (!hideMyOrdersLink) 4761 { 4762 @RenderListItem(myOrdersPageLink, Translate("My Orders"), "fas fa-list") 4763 } 4764 @if (!hideMyFavoritesLink) 4765 { 4766 @RenderListItem(myFavoritesPageLink, Translate("My Favorites"), favoritesIcon) 4767 } 4768 @if (!hideMySavedCardsLink) 4769 { 4770 @RenderListItem(mySavedCardsPageLink, Translate("My Saved cards"), "fas fa-credit-card") 4771 } 4772 @if (Model.CurrentUser.ID > 0) 4773 { 4774 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) 4775 { 4776 @RenderSeparator() 4777 } 4778 4779 @RenderListItem("/Admin/Public/ExtranetLogoff.aspx?ID=" + pageId, Translate("Sign out")) 4780 } 4781 </ul> 4782 </div> 4783 </li> 4784 } 4785 } 4786 4787 @helper RenderListItem(string link, string text, string icon = null) { 4788 <li> 4789 <a href="@link" class="list__link dw-mod" onclick="RememberState.SetCookie('useAnotherAddress', false)"> 4790 @if (!string.IsNullOrEmpty(icon)){<i class="@icon u-margin-right"></i>}@text 4791 </a> 4792 </li> 4793 } 4794 4795 @helper RenderSeparator() 4796 { 4797 <li class="list__seperator dw-mod"></li> 4798 } 4799 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4800 4801 @using System 4802 @using System.Web 4803 @using Dynamicweb.Rapido.Blocks.Extensibility 4804 @using Dynamicweb.Rapido.Blocks 4805 4806 @{ 4807 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideFavorites"); 4808 4809 Block masterDesktopActionsMenuFavorites = new Block 4810 { 4811 Id = "MasterDesktopActionsMenuFavorites", 4812 SortId = 30, 4813 Template = RenderFavorites() 4814 }; 4815 4816 if (!hideMyFavoritesLink && Model.CurrentUser.ID > 0) 4817 { 4818 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuFavorites); 4819 } 4820 } 4821 4822 @helper RenderFavorites() 4823 { 4824 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 4825 string myFavoritesPageLink = "/Default.aspx?ID=" + myFavoritesPageId; 4826 4827 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4828 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 4829 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4830 4831 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod"> 4832 <a href="@myFavoritesPageLink" class="@menuLinkClass dw-mod" title="@Translate("Favorites")"> 4833 <i class="fas fa-@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue fa-1_5x"></i> 4834 </a> 4835 </li> 4836 } 4837 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4838 4839 @using System 4840 @using System.Web 4841 @using Dynamicweb.Rapido.Blocks.Extensibility 4842 @using Dynamicweb.Rapido.Blocks 4843 @using Dynamicweb.Rapido.Services 4844 4845 @{ 4846 bool hideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 4847 string miniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown"; 4848 4849 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed() && !hideCart) 4850 { 4851 Block masterDesktopActionsMenuMiniCart = new Block 4852 { 4853 Id = "MasterDesktopActionsMenuMiniCart", 4854 SortId = 50, 4855 Template = RenderMiniCart(miniCartLayout == "dropdown"), 4856 SkipRenderBlocksList = true, 4857 BlocksList = new List<Block>() 4858 }; 4859 4860 Block miniCartCounterScriptTemplate = new Block 4861 { 4862 Id = "MiniCartCounterScriptTemplate", 4863 Template = RenderMiniCartCounterContent() 4864 }; 4865 4866 //dropdown layout is default 4867 RazorEngine.Templating.TemplateWriter layoutTemplate; 4868 RazorEngine.Templating.TemplateWriter miniCartTriggerTemplate; 4869 4870 switch (miniCartLayout) 4871 { 4872 case "dropdown": 4873 layoutTemplate = RenderMiniCartDropdownLayout(); 4874 miniCartTriggerTemplate = RenderMiniCartTriggerLink(); 4875 break; 4876 case "panel": 4877 layoutTemplate = RenderMiniCartPanelLayout(); 4878 miniCartTriggerTemplate = RenderMiniCartTriggerLabel(); 4879 break; 4880 case "modal": 4881 layoutTemplate = RenderMiniCartModalLayout(); 4882 miniCartTriggerTemplate = RenderMiniCartTriggerLabel(); 4883 break; 4884 case "none": 4885 default: 4886 layoutTemplate = RenderNoLayoutMiniCart(); 4887 miniCartTriggerTemplate = RenderMiniCartTriggerLink(); 4888 break; 4889 } 4890 4891 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block 4892 { 4893 Id = "MiniCartTrigger", 4894 Template = miniCartTriggerTemplate 4895 }); 4896 4897 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 4898 { 4899 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block 4900 { 4901 Id = "MiniCartLayout", 4902 Template = layoutTemplate 4903 }); 4904 } 4905 4906 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuMiniCart); 4907 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate); 4908 } 4909 4910 if (hideCart && Dynamicweb.Rapido.Services.User.IsBuyingAllowed()) 4911 { 4912 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", new Block { 4913 Id = "CartInitialization", 4914 Template = RenderNoLayoutMiniCart() 4915 }); 4916 } 4917 } 4918 4919 @helper RenderMiniCart(bool hasMouseEnterEvent) 4920 { 4921 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterDesktopActionsMenuMiniCart").OrderBy(item => item.SortId).ToList(); 4922 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4923 string liClasses = topLayout != "normal" ? "menu__item--top-level" : "menu--clean"; 4924 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4925 string mouseEvent = ""; 4926 string id = "MiniCart"; 4927 if (hasMouseEnterEvent) 4928 { 4929 mouseEvent = "onmouseenter=\"Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=" + miniCartFeedPageId + "&feedType=MiniCart')\""; 4930 id = "miniCartTrigger"; 4931 } 4932 <li class="menu__item menu__item--horizontal menu__item--icon @liClasses dw-mod" id="@id" @mouseEvent> 4933 @RenderBlockList(subBlocks) 4934 </li> 4935 } 4936 4937 @helper RenderNoLayoutMiniCart() 4938 { 4939 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4940 <script> 4941 window.cartId = "@miniCartFeedPageId"; 4942 </script> 4943 } 4944 4945 @helper RenderMiniCartTriggerLabel() 4946 { 4947 int cartPageId = GetPageIdByNavigationTag("CartPage"); 4948 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart"; 4949 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4950 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4951 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4952 4953 <div class="@menuLinkClass dw-mod js-mini-cart-button" onclick="Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart')"> 4954 <div class="u-inline u-position-relative" title="@Translate("Cart")"> 4955 <i class="@cartIcon fa-1_5x"></i> 4956 @RenderMiniCartCounter() 4957 </div> 4958 </div> 4959 } 4960 4961 @helper RenderMiniCartTriggerLink() 4962 { 4963 int cartPageId = GetPageIdByNavigationTag("CartPage"); 4964 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart"; 4965 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4966 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4967 4968 <a href="/Default.aspx?ID=@cartPageId&Purge=True" class="@menuLinkClass menu__item--icon dw-mod js-mini-cart-button"> 4969 <div class="u-inline u-position-relative" title="@Translate("Cart")"> 4970 <i class="@cartIcon fa-1_5x"></i> 4971 @RenderMiniCartCounter() 4972 </div> 4973 </a> 4974 } 4975 4976 @helper RenderMiniCartCounter() 4977 { 4978 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4979 string cartProductsCount = Model.Cart.TotalProductsCount.ToString(); 4980 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right"; 4981 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 4982 string cartProductsTotalPrice = showPrice && Model.Cart.TotalPrice != null ? Model.Cart.TotalPrice.Price.Formatted : ""; 4983 cartProductsTotalPrice = counterPosition == "right" ? cartProductsTotalPrice : ""; 4984 4985 if (showPrice && counterPosition == "right") 4986 { 4987 cartProductsCount = Translate("Cart") + "(" + cartProductsCount + ")"; 4988 } 4989 4990 <div class="mini-cart__counter @(counterPosition == "right" ? "mini-cart__counter--inline" : "") dw-mod"> 4991 <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"> 4992 <div class="js-mini-cart-counter-content counter-number dw-mod" data-count="@Model.Cart.TotalProductsCount.ToString()"> 4993 @cartProductsCount 4994 @cartProductsTotalPrice 4995 </div> 4996 </div> 4997 </div> 4998 } 4999 5000 @helper RenderMiniCartCounterContent() 5001 { 5002 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 5003 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right"; 5004 bool showPriceInMiniCartCounter = Pageview.Device.ToString() != "Mobile" && counterPosition == "right" && showPrice; 5005 5006 <script id="MiniCartCounterContent" type="text/x-template"> 5007 {{#.}} 5008 <div class="js-mini-cart-counter-content counter-number dw-mod" data-count="{{numberofproducts}}"> 5009 @if (showPriceInMiniCartCounter) 5010 { 5011 @Translate("Cart")<text>({{numberofproducts}}) {{totalprice}}</text> 5012 } 5013 else 5014 { 5015 <text>{{numberofproducts}}</text> 5016 } 5017 </div> 5018 {{/.}} 5019 </script> 5020 } 5021 5022 @helper RenderMiniCartDropdownLayout() 5023 { 5024 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 5025 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage"); 5026 5027 <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"> 5028 <div class="mini-cart-dropdown__inner dw-mod"> 5029 <h3 class="u-ta-center dw-mod">@Translate("Shopping cart")</h3> 5030 <div class="mini-cart-dropdown__body u-flex dw-mod"> 5031 <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> 5032 </div> 5033 </div> 5034 </div> 5035 } 5036 5037 @helper RenderMiniCartPanelLayout() 5038 { 5039 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 5040 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage"); 5041 5042 <div class="mini-cart grid__cell dw-mod"> 5043 <input type="checkbox" id="miniCartTrigger" class="panel-trigger" /> 5044 <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"> 5045 <label for="miniCartTrigger" class="panel__close-btn" title="@Translate("Close panel")"><i class="fas fa-times"></i></label> 5046 <div class="panel__content u-full-width dw-mod"> 5047 <h3 class="panel__header dw-mod u-margin-bottom u-ta-center">@Translate("Shopping cart")</h3> 5048 <div class="panel__content-body panel__content-body--cart dw-mod"> 5049 <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> 5050 </div> 5051 </div> 5052 </div> 5053 </div> 5054 } 5055 5056 @helper RenderMiniCartModalLayout() 5057 { 5058 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 5059 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage"); 5060 5061 <div class="mini-cart grid__cell dw-mod"> 5062 <input type="checkbox" id="miniCartTrigger" class="modal-trigger" autocomplete="off" /> 5063 <div class="modal-container dw-mod js-mini-cart" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="block" data-cart-page-link="@cartPageLink"> 5064 <label for="miniCartTrigger" class="modal-overlay"></label> 5065 <div class="modal modal--md modal--top-right dw-mod"> 5066 <div class="modal__body u-flex grid--direction-column dw-mod"> 5067 <h3 class="dw-mod u-ta-center">@Translate("Shopping cart")</h3> 5068 <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> 5069 </div> 5070 <label class="modal__close-btn modal__close-btn--clean dw-mod" for="miniCartTrigger" title="@Translate("Close modal")"></label> 5071 </div> 5072 </div> 5073 </div> 5074 } 5075 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5076 5077 @using System 5078 @using System.Web 5079 @using Dynamicweb.Rapido.Blocks.Extensibility 5080 @using Dynamicweb.Rapido.Blocks 5081 5082 @{ 5083 bool showDownloadCartLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart"); 5084 5085 Block masterDesktopActionsMenuDownloadCart = new Block 5086 { 5087 Id = "MasterDesktopActionsMenuDownloadCart", 5088 SortId = 35, 5089 Template = RenderDownloadCart() 5090 }; 5091 5092 if (showDownloadCartLink && Model.CurrentUser.ID > 0) 5093 { 5094 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuDownloadCart); 5095 } 5096 } 5097 5098 @helper RenderDownloadCart() 5099 { 5100 int downloadCartPageId = GetPageIdByNavigationTag("DownloadCart"); 5101 string downloadCartPageLink = "/Default.aspx?ID=" + downloadCartPageId; 5102 5103 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5104 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 5105 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 5106 5107 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod"> 5108 <a href="@downloadCartPageLink" class="@menuLinkClass dw-mod" title="@Translate("Download cart")"> 5109 <i class="fas fa-cart-arrow-down fa-1_5x"></i> 5110 </a> 5111 </li> 5112 } 5113 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5114 5115 @using System 5116 @using System.Web 5117 @using Dynamicweb.Rapido.Blocks.Extensibility 5118 @using Dynamicweb.Rapido.Blocks 5119 5120 @functions { 5121 public class SearchConfiguration 5122 { 5123 public string searchFeedId { get; set; } 5124 public string searchSecondFeedId { get; set; } 5125 public int groupsFeedId { get; set; } 5126 public string resultPageLink { get; set; } 5127 public string searchPlaceholder { get; set; } 5128 public string searchType { get; set; } 5129 public string searchTemplate { get; set; } 5130 public string searchContentTemplate { get; set; } 5131 public string searchValue { get; set; } 5132 public bool showGroups { get; set; } 5133 5134 public SearchConfiguration() 5135 { 5136 searchFeedId = ""; 5137 searchSecondFeedId = ""; 5138 searchType = "product-search"; 5139 searchContentTemplate = ""; 5140 showGroups = true; 5141 } 5142 } 5143 } 5144 @{ 5145 Block masterSearchBar = new Block 5146 { 5147 Id = "MasterSearchBar", 5148 SortId = 40, 5149 Template = RenderSearch("bar"), 5150 Design = new Design 5151 { 5152 Size = "auto", 5153 HidePadding = true, 5154 RenderType = RenderType.Column 5155 } 5156 }; 5157 5158 Block masterSearchAction = new Block 5159 { 5160 Id = "MasterDesktopActionsMenuSearch", 5161 SortId = 10, 5162 Template = RenderSearch() 5163 }; 5164 5165 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterSearchBar); 5166 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterSearchAction); 5167 } 5168 5169 @helper RenderSearch(string type = "mini-search") 5170 { 5171 string productsPageId = Converter.ToString(GetPageIdByNavigationTag("ProductsPage")); 5172 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 5173 string searchType = Model.Area.Item.GetItem("Layout").GetList("TopSearch") != null ? Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue : "productSearch"; 5174 5175 SearchConfiguration searchConfiguration = null; 5176 5177 switch (searchType) { 5178 case "contentSearch": 5179 searchConfiguration = new SearchConfiguration() { 5180 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true", 5181 resultPageLink = contentSearchPageLink, 5182 searchPlaceholder = Translate("Search page"), 5183 groupsFeedId = 0, 5184 searchType = "content-search", 5185 searchTemplate = "SearchPagesTemplate", 5186 showGroups = false 5187 }; 5188 break; 5189 case "combinedSearch": 5190 searchConfiguration = new SearchConfiguration() { 5191 searchFeedId = productsPageId + "&feed=true", 5192 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true", 5193 resultPageLink = Converter.ToString(productsPageId), 5194 searchPlaceholder = Translate("Search products or pages"), 5195 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"), 5196 searchType = "combined-search", 5197 searchTemplate = "SearchProductsTemplateWrap", 5198 searchContentTemplate = "SearchPagesTemplateWrap", 5199 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector") 5200 }; 5201 break; 5202 default: //productSearch 5203 searchConfiguration = new SearchConfiguration() { 5204 resultPageLink = Converter.ToString(productsPageId), 5205 searchFeedId = productsPageId + "&feed=true", 5206 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"), 5207 searchPlaceholder = Translate("Search products"), 5208 searchTemplate = "SearchProductsTemplate", 5209 searchType = "product-search", 5210 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector") 5211 }; 5212 break; 5213 } 5214 searchConfiguration.searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; 5215 5216 if (type == "mini-search") { 5217 @RenderMiniSearch(searchConfiguration) 5218 } else { 5219 @RenderSearchBar(searchConfiguration) 5220 } 5221 } 5222 5223 @helper RenderSearchBar(SearchConfiguration options) 5224 { 5225 <div class="typeahead typeahead--centered u-color-inherit js-typeahead dw-mod" id="ProductSearchBar" 5226 data-page-size="7" 5227 data-search-feed-id="@options.searchFeedId" 5228 data-search-second-feed-id="@options.searchSecondFeedId" 5229 data-result-page-id="@options.resultPageLink" 5230 data-groups-page-id="@options.groupsFeedId" 5231 data-search-type="@options.searchType"> 5232 @if (options.showGroups) 5233 { 5234 <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> 5235 <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> 5236 } 5237 <div class="typeahead-search-field"> 5238 <input type="text" class="u-no-margin u-full-width u-full-height js-typeahead-search-field" placeholder="@options.searchPlaceholder" value="@options.searchValue"> 5239 @if (string.IsNullOrEmpty(options.searchSecondFeedId)) 5240 { 5241 <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> 5242 } 5243 else 5244 { 5245 <div class="dropdown dropdown--absolute-position dropdown--combined grid"> 5246 <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> 5247 <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> 5248 </div> 5249 } 5250 </div> 5251 <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> 5252 </div> 5253 } 5254 5255 @helper RenderMiniSearch(SearchConfiguration options) 5256 { 5257 <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"> 5258 <div class="menu__link menu__link--icon dw-mod" title="@Translate("Search")"> 5259 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> 5260 </div> 5261 <div class="menu menu--dropdown menu--dropdown-right u-no-padding u-w380px grid__cell dw-mod"> 5262 <div class="typeahead js-typeahead" id="ProductSearchBar" 5263 data-page-size="7" 5264 data-search-feed-id="@options.searchFeedId" 5265 data-search-second-feed-id="@options.searchSecondFeedId" 5266 data-result-page-id="@options.resultPageLink" 5267 data-search-type="@options.searchType"> 5268 <div class="typeahead-search-field"> 5269 <input type="text" class="u-no-margin u-full-width js-typeahead-search-field" id="headerSearch" placeholder="@options.searchPlaceholder" value="@options.searchValue"> 5270 @if (string.IsNullOrEmpty(options.searchSecondFeedId)) 5271 { 5272 <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> 5273 } 5274 else 5275 { 5276 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--right-aligned"> 5277 <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> 5278 <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> 5279 </div> 5280 } 5281 </div> 5282 </div> 5283 </div> 5284 </li> 5285 } 5286 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5287 5288 @using System 5289 @using System.Web 5290 @using Dynamicweb.Rapido.Blocks.Extensibility 5291 @using Dynamicweb.Rapido.Blocks 5292 5293 @{ 5294 string headerConfigurationTopLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5295 bool headerConfigurationHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 5296 5297 BlocksPage headerConfigurationPage = BlocksPage.GetBlockPage("Master"); 5298 5299 Block configDesktopLogo = headerConfigurationPage.GetBlockById("MasterDesktopLogo"); 5300 headerConfigurationPage.RemoveBlock(configDesktopLogo); 5301 5302 Block configDesktopMenu = headerConfigurationPage.GetBlockById("MasterDesktopMenu"); 5303 headerConfigurationPage.RemoveBlock(configDesktopMenu); 5304 5305 Block configSearchBar = headerConfigurationPage.GetBlockById("MasterSearchBar"); 5306 headerConfigurationPage.RemoveBlock(configSearchBar); 5307 5308 Block configSearchAction = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenuSearch"); 5309 headerConfigurationPage.RemoveBlock(configSearchAction); 5310 5311 Block configDesktopActionsMenu = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenu"); 5312 headerConfigurationPage.RemoveBlock(configDesktopActionsMenu); 5313 5314 Block configDesktopExtra = headerConfigurationPage.GetBlockById("MasterDesktopExtra"); 5315 5316 switch (headerConfigurationTopLayout) 5317 { 5318 case "condensed": //2 5319 configDesktopLogo.Design.Size = "auto-width"; 5320 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); 5321 5322 configDesktopMenu.SortId = 20; 5323 configDesktopMenu.Design.Size = "auto"; 5324 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5325 5326 configDesktopActionsMenu.SortId = 30; 5327 configDesktopActionsMenu.Design.Size = "auto-width"; 5328 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 5329 5330 if (!headerConfigurationHideSearch) 5331 { 5332 configSearchBar.SortId = 40; 5333 configSearchBar.Design.Size = "12"; 5334 configDesktopExtra.SortId = 50; 5335 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); 5336 } 5337 break; 5338 case "splitted": //3 5339 configDesktopLogo.Design.Size = "auto"; 5340 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 5341 5342 if (!headerConfigurationHideSearch) 5343 { 5344 configSearchBar.SortId = 20; 5345 configSearchBar.Design.Size = "auto"; 5346 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); 5347 } 5348 5349 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5350 5351 configDesktopActionsMenu.SortId = 20; 5352 configDesktopActionsMenu.Design.Size = "auto-width"; 5353 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 5354 break; 5355 case "minimal": //4 5356 configDesktopLogo.Design.Size = "auto-width"; 5357 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); 5358 5359 configDesktopMenu.Design.Size = "auto"; 5360 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5361 5362 configDesktopActionsMenu.SortId = 20; 5363 configDesktopActionsMenu.Design.Size = "auto-width"; 5364 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 5365 5366 if (!headerConfigurationHideSearch) 5367 { 5368 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 5369 } 5370 break; 5371 case "minimal-right": //5 5372 configDesktopLogo.Design.Size = "auto-width"; 5373 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); 5374 5375 configDesktopMenu.Design.Size = "auto"; 5376 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5377 5378 configDesktopActionsMenu.SortId = 20; 5379 configDesktopActionsMenu.Design.Size = "auto-width"; 5380 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 5381 5382 if (!headerConfigurationHideSearch) 5383 { 5384 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 5385 } 5386 break; 5387 case "two-lines": //6 5388 configDesktopLogo.Design.Size = "auto"; 5389 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 5390 5391 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5392 5393 configDesktopActionsMenu.SortId = 20; 5394 configDesktopActionsMenu.Design.Size = "auto-width"; 5395 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 5396 5397 if (!headerConfigurationHideSearch) 5398 { 5399 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 5400 } 5401 break; 5402 case "two-lines-centered": //7 5403 configDesktopLogo.Design.Size = "auto"; 5404 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 5405 5406 configDesktopMenu.Design.Size = "auto-width"; 5407 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5408 5409 configDesktopActionsMenu.SortId = 20; 5410 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 5411 5412 if (!headerConfigurationHideSearch) 5413 { 5414 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 5415 } 5416 break; 5417 case "normal": //1 5418 default: 5419 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 5420 5421 if (!headerConfigurationHideSearch) 5422 { 5423 configSearchBar.SortId = 20; 5424 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); 5425 } 5426 5427 configDesktopActionsMenu.SortId = 30; 5428 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopActionsMenu); 5429 5430 configDesktopActionsMenu.Design.Size = "auto-width"; 5431 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5432 break; 5433 } 5434 } 5435 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5436 5437 @using System 5438 @using System.Web 5439 @using Dynamicweb.Rapido.Blocks.Extensibility 5440 @using Dynamicweb.Rapido.Blocks 5441 @using Dynamicweb.Ecommerce.Products; 5442 5443 @{ 5444 BlocksPage customBlocksPage = BlocksPage.GetBlockPage("Master"); 5445 5446 string raptorCustomerId = Model.Area.Item.GetItem("Custom").GetString("RaptorCustomerId"); 5447 5448 Block raptor = new Block() 5449 { 5450 Id = "Raptor", 5451 SortId = 100, 5452 Template = RenderRaptor(raptorCustomerId) 5453 }; 5454 5455 customBlocksPage.Add(MasterBlockId.MasterTopSnippets, raptor); 5456 } 5457 5458 @functions { 5459 private readonly GroupService _groupService = new GroupService(); 5460 5461 public string GetCategoryPath(string groupId) 5462 { 5463 string path = ""; 5464 Dynamicweb.Ecommerce.Products.Group primaryGroup = _groupService.GetGroup(groupId, Pageview.Area.EcomLanguageId); 5465 if (primaryGroup != null) 5466 { 5467 if (!string.IsNullOrEmpty(primaryGroup.PrimaryParentGroupId)) 5468 { 5469 path += GetCategoryPath(primaryGroup.PrimaryParentGroupId); 5470 } 5471 5472 path += primaryGroup.Id + "#" + primaryGroup.Name + ";"; 5473 } 5474 return path; 5475 } 5476 } 5477 5478 @helper RenderRaptor(string customerId) 5479 { 5480 // Don't render raptor if no customer ID 5481 if (string.IsNullOrEmpty(customerId)) 5482 { 5483 // Dummy functions for sites without raptor 5484 <script type="text/javascript" language="javascript"> 5485 var trackAddToBasket = function () { }; 5486 var trackRemoveFromBasket = function () { }; 5487 var trackEmptyBasket = function () { }; 5488 </script> 5489 return; 5490 } 5491 5492 var cart = Dynamicweb.Ecommerce.Common.Context.Cart; 5493 List<string> orderLineProductIds = new List<string>(); 5494 if (cart != null) 5495 { 5496 foreach (var orderLine in cart.OrderLines) 5497 { 5498 orderLineProductIds.Add(orderLine.ProductNumber); 5499 } 5500 } 5501 string productId = HttpContext.Current.Request.QueryString["productid"]; 5502 string productNumber = ""; 5503 string productName = ""; 5504 string categoryPath = ""; 5505 string price = ""; 5506 string currency = ""; 5507 if (!string.IsNullOrEmpty(productId)) 5508 { 5509 string variantId = HttpContext.Current.Request.QueryString["variantid"]; 5510 var productService = new ProductService(); 5511 Product product = productService.GetProductById(productId, variantId, Pageview.Area.EcomLanguageId); 5512 if (product != null) 5513 { 5514 productNumber = product.Number; 5515 categoryPath = GetCategoryPath(product.PrimaryGroupId); 5516 productName = product.Name; 5517 var priceInfo = product.GetPrice(Pageview.Area.EcomCurrencyId, Pageview.Area.EcomCountryCode); 5518 if (priceInfo != null) 5519 { 5520 price = priceInfo.PriceWithVAT.ToString("F"); 5521 currency = priceInfo.Currency.Code; 5522 } 5523 } 5524 } 5525 5526 <script type="text/javascript" language="javascript" data-cookieconsent="marketing"> 5527 var raptorBasket = [ 5528 @foreach (var id in orderLineProductIds.Where(x => !string.IsNullOrEmpty(x))) 5529 { 5530 @:"@id", 5531 } 5532 ]; 5533 5534 var raptorLoaded = function (raptor) { 5535 raptor.initialize({ customerID: @customerId, productIdParamIndex: 2, eventTypeParamIndex: 1 }); 5536 @if (!string.IsNullOrEmpty(productId)) 5537 { 5538 @:raptor.trackEvent("Visit", "@productNumber", "@productName", "@categoryPath", "@price", "@currency", "@(Pageview.User?.Email)", "", "", ""); 5539 } 5540 }; 5541 5542 var trackAddToBasket = function (productId) { 5543 if (raptorBasket.indexOf(productId) === -1) { 5544 raptorBasket.push(productId); 5545 } 5546 5547 var basketString = getBasketString(); 5548 5549 raptor.trackEvent("Basket", "", "", "", "", "", "", "", "", basketString); 5550 console.log("Raptor tracked: " + productId + " added to basket"); 5551 }; 5552 5553 var trackRemoveFromBasket = function (productId) { 5554 for (var i = 0; i < raptorBasket.length; i++) { 5555 if (raptorBasket[i] === productId) { 5556 raptorBasket.splice(i, 1); 5557 i--; 5558 } 5559 } 5560 5561 var basketString = getBasketString(); 5562 5563 raptor.trackEvent("Basket", "", "", "", "", "", "", "", "", basketString); 5564 console.log("Raptor tracked: " + productId + " removed from basket"); 5565 }; 5566 5567 var trackEmptyBasket = function () { 5568 raptor.trackEvent("Basket", "", "", "", "", "", "", "", "", ""); 5569 console.log("Raptor tracked: Empty basket"); 5570 }; 5571 5572 var getBasketString = function () { 5573 var result = ''; 5574 for (var i = 0; i < raptorBasket.length; i++) { 5575 result += raptorBasket[i]; 5576 if (i !== raptorBasket.length - 1) { 5577 result += ','; 5578 } 5579 } 5580 return result; 5581 }; 5582 </script> 5583 5584 <script> 5585 (function (d, t) { 5586 var g = d.createElement(t), 5587 s = d.getElementsByTagName(t)[0]; 5588 g.src = '//az19942.vo.msecnd.net/script/raptor-2.1.3.js'; 5589 s.parentNode.insertBefore(g, s); 5590 }(document, 'script')); 5591 </script> 5592 } 5593 5594 5595 @helper RenderDesktopTools() 5596 { 5597 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopTools").OrderBy(item => item.SortId).ToList(); 5598 var websiteName = Pageview.Area.Name; 5599 5600 <div class="tools-navigation dw-mod"> 5601 <div class="center-container grid top-container__center-container dw-mod"> 5602 @RenderBlockList(subBlocks) 5603 @if (websiteName == "Dermalogica" || websiteName == "Janeiredale") 5604 { 5605 @RenderDesktopActionsMenu() 5606 5607 } 5608 5609 </div> 5610 </div> 5611 } 5612 5613 @helper RenderDesktopToolsText() 5614 { 5615 string toolsText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("ToolsText"); 5616 if (!string.IsNullOrEmpty(toolsText)) 5617 { 5618 <div class="u-margin-top u-margin-bottom">@toolsText</div> 5619 } 5620 } 5621 5622 @helper RenderDesktopToolsNavigation() 5623 { 5624 var websiteName = Pageview.Area.Name; 5625 5626 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 5627 5628 if (renderPagesInToolBar && websiteName == "Dermalogica" || websiteName == "Janeiredale") 5629 { 5630 @*@RenderNavigation(new 5631 { 5632 id = "topToolsNavigation", 5633 cssclass = "menu menu-tools dw-mod dwnavigation", 5634 template = "TopMenu.xslt" 5635 })*@ 5636 } 5637 5638 else if (renderPagesInToolBar && websiteName == "Kosmetolognet" || websiteName == "Kosmetoglognet") 5639 { 5640 @* @RenderNavigation(new 5641 { 5642 id = "topToolsNavigation", 5643 cssclass = "menu menu-tools dw-mod dwnavigation", 5644 template = "TopMenuKosmetolognet.xslt" 5645 }) *@ 5646 } 5647 } 5648 5649 @helper RenderDesktopNavigation() 5650 { 5651 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopNavigation").OrderBy(item => item.SortId).ToList(); 5652 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5653 string alignClass = topLayout == "two-lines-centered" ? "grid--justify-center" : ""; 5654 <nav class="main-navigation dw-mod"> 5655 <div class="center-container top-container__center-container grid @alignClass dw-mod"> 5656 @RenderBlockList(subBlocks) 5657 </div> 5658 </nav> 5659 } 5660 5661 @helper RenderDesktopExtra() 5662 { 5663 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopExtra").OrderBy(item => item.SortId).ToList(); 5664 5665 if (subBlocks.Count > 0) 5666 { 5667 <div class="header header-top dw-mod"> 5668 <div class="center-container top-container__center-container grid--justify-space-between grid grid--align-center dw-mod"> 5669 @RenderBlockList(subBlocks) 5670 </div> 5671 </div> 5672 } 5673 }</text> 5674 } 5675 5676 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5677 5678 @using System 5679 @using System.Web 5680 @using Dynamicweb.Rapido.Blocks.Extensibility 5681 @using Dynamicweb.Rapido.Blocks 5682 @using Dynamicweb.Rapido.Blocks.Components.General 5683 @using Dynamicweb.Frontend 5684 5685 @functions { 5686 int impersonationPageId; 5687 string impersonationLayout; 5688 int impersonationFeed; 5689 Block impersonationBar; 5690 5691 string getUserNameFromParams(string firstName, string middleName, string lastName, string name, string email, string userName) 5692 { 5693 string username = ""; 5694 5695 if (!string.IsNullOrEmpty(firstName) && !string.IsNullOrEmpty(lastName)) 5696 { 5697 username = firstName + " " + (!string.IsNullOrEmpty(middleName) ? middleName + " " : "") + lastName; 5698 } 5699 else if (!string.IsNullOrEmpty(name)) 5700 { 5701 username = name; 5702 } 5703 else if (!string.IsNullOrEmpty(email)) 5704 { 5705 username = email; 5706 } 5707 else 5708 { 5709 username = userName; 5710 } 5711 return username; 5712 } 5713 5714 string getUserName(UserViewModel user) 5715 { 5716 return getUserNameFromParams(user.FirstName, user.MiddleName, user.LastName, user.Name, user.Email, user.UserName); 5717 } 5718 5719 string getUserName(Dynamicweb.Security.UserManagement.User user) 5720 { 5721 return getUserNameFromParams(user.FirstName, user.MiddleName, user.LastName, user.Name, user.Email, user.UserName); 5722 } 5723 } 5724 5725 @{ 5726 impersonationPageId = GetPageIdByNavigationTag("Impersonation"); 5727 impersonationLayout = Model.Area.Item.GetItem("Ecommerce").GetList("ImpersonationLayout") != null ? Model.Area.Item.GetItem("Ecommerce").GetList("ImpersonationLayout").SelectedValue : "bar"; 5728 impersonationFeed = GetPageIdByNavigationTag("UsersFeed"); 5729 5730 if (Model.CurrentUser.ID > 0 && Model.SecondaryUsers.Count > 0) 5731 { 5732 impersonationBar = new Block 5733 { 5734 Id = "ImpersonationBar", 5735 SortId = 50, 5736 Template = RenderImpersonation(), 5737 SkipRenderBlocksList = true, 5738 Design = new Design 5739 { 5740 Size = "auto-width", 5741 HidePadding = true, 5742 RenderType = RenderType.Column 5743 } 5744 }; 5745 5746 Block impersonationContent = new Block 5747 { 5748 Id = "ImpersonationContent", 5749 SortId = 10 5750 }; 5751 5752 if (Model.CurrentSecondaryUser != null && Model.CurrentSecondaryUser.ID > 0) 5753 { 5754 //Render stop impersonation view 5755 impersonationContent.Template = RenderStopImpersonationView(); 5756 } 5757 else 5758 { 5759 //Render main view 5760 switch (impersonationLayout) 5761 { 5762 case "right-lower-box": 5763 impersonationContent.BlocksList.Add( 5764 new Block { 5765 Id = "RightLowerBoxHeader", 5766 SortId = 10, 5767 Component = new Heading { 5768 Level = 5, 5769 Title = Translate("View the list of users you can impersonate"), 5770 CssClass = "impersonation-text" 5771 } 5772 } 5773 ); 5774 impersonationContent.BlocksList.Add( 5775 new Block { 5776 Id = "RightLowerBoxContent", 5777 SortId = 20, 5778 Template = RenderImpersonationControls() 5779 } 5780 ); 5781 break; 5782 case "right-lower-bar": 5783 impersonationContent.BlocksList.Add( 5784 new Block { 5785 Id = "RightLowerBarContent", 5786 SortId = 10, 5787 Template = RenderImpersonationControls() 5788 } 5789 ); 5790 break; 5791 case "bar": 5792 default: 5793 impersonationContent.BlocksList.Add( 5794 new Block { 5795 Id = "ViewListLink", 5796 SortId = 20, 5797 Template = RenderViewListLink() 5798 } 5799 ); 5800 impersonationContent.BlocksList.Add( 5801 new Block { 5802 Id = "BarTypeaheadSearch", 5803 SortId = 30, 5804 Template = RenderTypeaheadSearch() 5805 } 5806 ); 5807 break; 5808 } 5809 } 5810 impersonationBar.BlocksList.Add(impersonationContent); 5811 5812 impersonationBar.BlocksList.Add( 5813 new Block 5814 { 5815 Id = "ImpersonationSearchTemplates", 5816 SortId = 20, 5817 Template = RenderSearchResultTemplate() 5818 } 5819 ); 5820 if (impersonationLayout != "bar") 5821 { 5822 impersonationBar.BlocksList.Add( 5823 new Block 5824 { 5825 Id = "ImpersonationSearchScripts", 5826 SortId = 30, 5827 Template = RenderSearchScripts() 5828 } 5829 ); 5830 } 5831 BlocksPage.GetBlockPage("Master").Add("MasterHeader", impersonationBar); 5832 } 5833 } 5834 5835 @helper RenderImpersonation() 5836 { 5837 List<Block> subBlocks = impersonationBar.BlocksList.OrderBy(item => item.SortId).ToList(); 5838 <input type="checkbox" class="impersonation-trigger js-remember-state" id="ImpersonationMinimizeTrigger" /> 5839 <div class="impersonation impersonation--@(impersonationLayout)-layout dw-mod" id="Impersonation"> 5840 @if (impersonationLayout == "right-lower-box") 5841 { 5842 @RenderRightLowerBoxHeader() 5843 } 5844 <div class="center-container top-container__center-container u-padding--lg impersonation__container @(impersonationLayout != "bar" ? "impersonation__container--box" : "") dw-mod"> 5845 @*Impersonation*@ 5846 @RenderBlockList(subBlocks) 5847 </div> 5848 </div> 5849 } 5850 5851 @helper RenderRightLowerBoxHeader() 5852 { 5853 <div class="impersonation__header dw-mod"> 5854 <div class="impersonation__title">@Translate("Impersonation")</div> 5855 <label for="ImpersonationMinimizeTrigger" class="btn btn--impersonation impersonation__minimize-btn dw-mod" onclick="this.blur();"> 5856 @Render(new Icon 5857 { 5858 Prefix = "fas", 5859 Name = "fa-window-minimize" 5860 }) 5861 </label> 5862 </div> 5863 } 5864 5865 @helper RenderStopImpersonationView() 5866 { 5867 string secondaryUserName = getUserName(Model.CurrentSecondaryUser); 5868 string userName = getUserName(Pageview.User); 5869 string impersonationText = "<b>" + userName + "</b> " + Translate("is impersonating") + " <b>" + secondaryUserName + "</b>"; 5870 impersonationText = Dynamicweb.Security.UserManagement.User.ImpersonationMode == Dynamicweb.Security.UserManagement.UserImpersonation.Full ? "<b>" + secondaryUserName + "</b> " + Translate("is impersonating") + " <b>" + userName + "</b>" : impersonationText; 5871 5872 if (impersonationLayout == "right-lower-box") 5873 { 5874 <div class="u-margin-bottom--lg u-ta-center"> 5875 @impersonationText 5876 </div> 5877 @RenderStopImpersonationForm() 5878 } 5879 else 5880 { 5881 <div class="grid grid--align-center grid--justify-space-between impersonation__stop-wrap"> 5882 <div class="u-margin-right--lg impersonation__stop-text"> 5883 <i class="fas fa-user-secret"></i> 5884 @impersonationText 5885 </div> 5886 @RenderStopImpersonationForm() 5887 </div> 5888 } 5889 } 5890 5891 @helper RenderStopImpersonationForm() 5892 { 5893 <form method="post" class="u-no-margin"> 5894 @Render(new Button 5895 { 5896 ButtonType = ButtonType.Submit, 5897 ButtonLayout = ButtonLayout.None, 5898 Title = Translate("Stop impersonation"), 5899 Href = "/Default.aspx?ID=" + impersonationPageId, 5900 CssClass = "impersonation__button btn btn--impersonation", 5901 Name = "DwExtranetRemoveSecondaryUser" 5902 }) 5903 </form> 5904 } 5905 5906 @helper RenderImpersonationControls() 5907 { 5908 <div class="impersonation__controls"> 5909 @RenderViewListLink() 5910 @RenderSearchBox() 5911 </div> 5912 @RenderResultsList() 5913 } 5914 5915 @helper RenderViewListLink() 5916 { 5917 string title = impersonationLayout == "right-lower-box" ? Translate("View the list") : Translate("View the list of users you can impersonate"); 5918 string buttonClasses = impersonationLayout == "right-lower-box" ? "impersonation__button btn btn--impersonation" : "impersonation__link impersonation__link"; 5919 5920 @Render(new Link { 5921 ButtonLayout = ButtonLayout.None, 5922 Title = title, 5923 Href = "/Default.aspx?ID=" + impersonationPageId, 5924 CssClass = buttonClasses 5925 }) 5926 } 5927 5928 @helper RenderSearchBox() 5929 { 5930 <div class="impersonation__search-wrap"> 5931 <input placeholder="@Translate("Search users")" type="text" class="impersonation__search-field dw-mod" onkeyup="searchKeyUpHandler(event)" id="ImpersonationBoxSearchField"> 5932 <div id="ImpersonationBoxSearchFind" class="impersonation__search-icon dw-mod" onclick="updateResults(document.getElementById('ImpersonationBoxSearchField').value)"> 5933 <i class="fal fa-search"></i> 5934 </div> 5935 <div id="ImpersonationBoxSearchClear" class="impersonation__search-icon u-hidden dw-mod" onclick="clearResults();"> 5936 <i class="fal fa-times"></i> 5937 </div> 5938 </div> 5939 } 5940 5941 @helper RenderTypeaheadSearch() 5942 { 5943 <div class="typeahead u-ta-right impersonation__typeahead js-typeahead dw-mod" id="ImpersonationSearchBar" 5944 data-page-size="5" 5945 data-search-feed-id="@impersonationFeed" 5946 data-result-page-id="@impersonationPageId" 5947 data-search-type="user-search" 5948 data-search-parameter-name="q"> 5949 5950 <div class="typeahead-search-field"> 5951 <input type="text" class="u-no-margin js-typeahead-search-field" placeholder="@Translate("Search users")"> 5952 <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> 5953 </div> 5954 </div> 5955 } 5956 5957 @helper RenderResultsList() 5958 { 5959 <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> 5960 } 5961 5962 @helper RenderSearchResultTemplate() 5963 { 5964 <script id="ImpersonationSearchResult" type="text/x-template"> 5965 {{#.}} 5966 {{#Users}} 5967 <li class="impersonation__search-results-item impersonation-user"> 5968 <form method="post" class="impersonation-user__form" name="account{{id}}"> 5969 <input type="hidden" id="DWExtranetSecondaryUserSelector" name="DWExtranetSecondaryUserSelector" value="{{id}}"> 5970 <div class="impersonation-user__info"> 5971 <div class="impersonation-user__name">{{userName}}</div> 5972 <div class="impersonation-user__number">{{customerNumber}}</div> 5973 </div> 5974 @Render(new Button 5975 { 5976 ButtonType = ButtonType.Submit, 5977 ButtonLayout = ButtonLayout.Secondary, 5978 Title = Translate("Sign in as"), 5979 CssClass = "impersonation-user__sign-in-btn" + (impersonationLayout != "bar" ? " btn--impersonation" : "") 5980 }) 5981 </form> 5982 </li> 5983 {{/Users}} 5984 {{#unless Users}} 5985 <li class="impersonation__search-results-item impersonation__search-results-item--not-found"> 5986 @Translate("Your search gave 0 results") 5987 </li> 5988 {{/unless}} 5989 {{/.}} 5990 </script> 5991 } 5992 5993 @helper RenderSearchScripts() 5994 { 5995 <script> 5996 let inputDelayTimer; 5997 function searchKeyUpHandler(e) { 5998 clearTimeout(inputDelayTimer); 5999 let value = e.target.value; 6000 if (value != "") { 6001 inputDelayTimer = setTimeout(function () { 6002 updateResults(value); 6003 }, 500); 6004 } else { 6005 clearResults(); 6006 } 6007 }; 6008 6009 function updateResults(value) { 6010 if (value == "") { 6011 return null; 6012 } 6013 HandlebarsBolt.UpdateContent("ImpersonationBoxSearchResults", "/Default.aspx?ID=@impersonationFeed&q=" + value); 6014 document.getElementById("ImpersonationBoxSearchFind").classList.add("u-hidden"); 6015 document.getElementById("ImpersonationBoxSearchClear").classList.remove("u-hidden"); 6016 } 6017 6018 function clearResults() { 6019 document.getElementById("ImpersonationBoxSearchField").value = ""; 6020 HandlebarsBolt.CleanContainer("ImpersonationBoxSearchResults"); 6021 document.getElementById("ImpersonationBoxSearchFind").classList.remove("u-hidden"); 6022 document.getElementById("ImpersonationBoxSearchClear").classList.add("u-hidden"); 6023 } 6024 </script> 6025 } 6026 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 6027 6028 @using System 6029 @using System.Web 6030 @using System.Collections.Generic 6031 @using Dynamicweb.Rapido.Blocks.Extensibility 6032 @using Dynamicweb.Rapido.Blocks 6033 6034 @{ 6035 BlocksPage miniCartBlocksPage = BlocksPage.GetBlockPage("Master"); 6036 string orderlinesView = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView").SelectedValue : "table"; 6037 6038 Block orderLines = new Block 6039 { 6040 Id = "MiniCartOrderLines", 6041 SkipRenderBlocksList = true, 6042 BlocksList = new List<Block> 6043 { 6044 new Block { 6045 Id = "MiniCartOrderLinesList", 6046 SortId = 20, 6047 Template = RenderMiniCartOrderLinesList() 6048 } 6049 } 6050 }; 6051 6052 Block orderlinesScriptTemplates = new Block 6053 { 6054 Id = "OrderlinesScriptTemplates" 6055 }; 6056 6057 if (orderlinesView == "table") 6058 { 6059 orderLines.Template = RenderMiniCartOrderLinesTable(); 6060 orderLines.BlocksList.Add( 6061 new Block 6062 { 6063 Id = "MiniCartOrderlinesTableHeader", 6064 SortId = 10, 6065 Template = RenderMiniCartOrderLinesHeader() 6066 } 6067 ); 6068 6069 orderlinesScriptTemplates.Template = RenderMiniCartScriptsTableTemplates(); 6070 } 6071 else 6072 { 6073 orderLines.Template = RenderMiniCartOrderLinesBlocks(); 6074 orderlinesScriptTemplates.Template = RenderMiniCartScriptsListTemplates(); 6075 } 6076 6077 miniCartBlocksPage.Add("MasterBottomSnippets", orderlinesScriptTemplates); 6078 6079 Block miniCartScriptTemplates = new Block() 6080 { 6081 Id = "MasterMiniCartTemplates", 6082 SortId = 1, 6083 Template = RenderMiniCartScriptTemplates(), 6084 SkipRenderBlocksList = true, 6085 BlocksList = new List<Block> 6086 { 6087 orderLines, 6088 new Block { 6089 Id = "MiniCartFooter", 6090 Template = RenderMiniCartFooter(), 6091 SortId = 50, 6092 SkipRenderBlocksList = true, 6093 BlocksList = new List<Block> 6094 { 6095 new Block { 6096 Id = "MiniCartSubTotal", 6097 Template = RenderMiniCartSubTotal(), 6098 SortId = 30 6099 }, 6100 new Block { 6101 Id = "MiniCartFees", 6102 Template = RenderMiniCartFees(), 6103 SortId = 40 6104 }, 6105 new Block { 6106 Id = "MiniCartPoints", 6107 Template = RenderMiniCartPoints(), 6108 SortId = 50 6109 }, 6110 new Block { 6111 Id = "MiniCartTotal", 6112 Template = RenderMiniCartTotal(), 6113 SortId = 60 6114 }, 6115 new Block { 6116 Id = "MiniCartDisclaimer", 6117 Template = RenderMiniCartDisclaimer(), 6118 SortId = 70 6119 }, 6120 new Block { 6121 Id = "MiniCartActions", 6122 Template = RenderMiniCartActions(), 6123 SortId = 80 6124 } 6125 } 6126 } 6127 } 6128 }; 6129 6130 miniCartBlocksPage.Add("MasterBottomSnippets", miniCartScriptTemplates); 6131 } 6132 6133 @helper RenderMiniCartScriptsTableTemplates() 6134 { 6135 <script id="MiniCartOrderline" type="text/x-template"> 6136 {{#unless isEmpty}} 6137 <tr> 6138 <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> 6139 <td class="u-va-middle"> 6140 <a href="{{link}}" class="mini-cart-orderline__name" title="{{name}}">{{name}}</a> 6141 {{#if variantname}} 6142 <a href="{{link}}" class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{variantname}}</a> 6143 {{/if}} 6144 {{#if unitname}} 6145 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{unitname}}</div> 6146 {{/if}} 6147 </td> 6148 <td class="u-ta-right u-va-middle">{{quantity}}</td> 6149 <td class="u-ta-right u-va-middle"> 6150 {{#if pointsTotal}} 6151 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 6152 {{else}} 6153 {{totalprice}} 6154 {{/if}} 6155 </td> 6156 </tr> 6157 {{/unless}} 6158 </script> 6159 6160 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 6161 {{#unless isEmpty}} 6162 <tr class="table__row--no-border"> 6163 <td class="u-w60px">&nbsp;</td> 6164 <td><div class="mini-cart-orderline__name dw-mod">{{name}}</div></td> 6165 <td class="u-ta-right">&nbsp;</td> 6166 <td class="u-ta-right">{{totalprice}}</td> 6167 </tr> 6168 {{/unless}} 6169 </script> 6170 } 6171 6172 @helper RenderMiniCartScriptsListTemplates() 6173 { 6174 int cartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 6175 6176 <script id="MiniCartOrderline" type="text/x-template"> 6177 {{#unless isEmpty}} 6178 <div class="mini-cart-orderline grid dw-mod"> 6179 <div class="grid__col-4"> 6180 <a href="{{link}}" class="{{hideimage}}"> 6181 <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}}"> 6182 </a> 6183 </div> 6184 <div class="grid__col-8"> 6185 <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> 6186 {{#if variantname}} 6187 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Variant"): {{variantname}}</div> 6188 {{/if}} 6189 {{#if unitname}} 6190 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Unit"): {{unitname}}</div> 6191 {{/if}} 6192 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Qty"): {{quantity}}</div> 6193 6194 <div class="grid__cell-footer"> 6195 <div class="grid__cell"> 6196 <div class="u-pull--left mini-cart-orderline__price dw-mod"> 6197 {{#if pointsTotal}} 6198 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 6199 {{else}} 6200 {{totalprice}} 6201 {{/if}} 6202 </div> 6203 <button type="button" 6204 title="@Translate("Remove orderline")" 6205 class="btn btn--clean btn--condensed u-pull--right mini-cart-orderline__remove-btn dw-mod" 6206 onclick="{{#if googleImpression}}googleImpressionRemoveFromCart({{googleImpression}});{{/if}}Cart.UpdateCart('miniCartContent', '/Default.aspx?ID=@cartFeedPageId', 'CartCmd=DelOrderLine&key={{orderLineId}}&redirect=false', true);"> 6207 @Translate("Remove") 6208 </button> 6209 </div> 6210 </div> 6211 </div> 6212 </div> 6213 {{/unless}} 6214 </script> 6215 6216 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 6217 {{#unless isEmpty}} 6218 <div class="mini-cart-orderline mini-cart-orderline--discount grid dw-mod"> 6219 <div class="grid__col-4"> 6220 <div class="mini-cart-orderline__name mini-cart-orderline__name dw-mod">{{name}}</div> 6221 </div> 6222 <div class="grid__col-8">{{totalprice}}</div> 6223 </div> 6224 {{/unless}} 6225 </script> 6226 } 6227 6228 @helper RenderMiniCartScriptTemplates() 6229 { 6230 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMiniCartTemplates").OrderBy(item => item.SortId).ToList(); 6231 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 6232 string cartPageLink = string.Concat("/Default.aspx?ID=", GetPageIdByNavigationTag("CartPage")); 6233 bool miniCartUseGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 6234 6235 <script id="MiniCartContent" type="text/x-template"> 6236 {{#.}} 6237 {{#unless isEmpty}} 6238 @if (miniCartUseGoogleTagManager) 6239 { 6240 <text>{{{googleEnchantImpressionEmptyCart OrderLines}}}</text> 6241 } 6242 @RenderBlockList(subBlocks) 6243 {{/unless}} 6244 {{/.}} 6245 </script> 6246 } 6247 6248 @helper RenderMiniCartOrderLinesTable() 6249 { 6250 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList(); 6251 6252 <div class="u-overflow-auto"> 6253 <table class="table mini-cart-table dw-mod"> 6254 @RenderBlockList(subBlocks) 6255 </table> 6256 </div> 6257 } 6258 6259 @helper RenderMiniCartOrderLinesBlocks() 6260 { 6261 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList(); 6262 6263 <div class="u-overflow-auto"> 6264 @RenderBlockList(subBlocks) 6265 </div> 6266 } 6267 6268 @helper RenderMiniCartOrderLinesHeader() 6269 { 6270 <thead> 6271 <tr> 6272 <td>&nbsp;</td> 6273 <td>@Translate("Product")</td> 6274 <td class="u-ta-right">@Translate("Qty")</td> 6275 <td class="u-ta-right" width="120">@Translate("Price")</td> 6276 </tr> 6277 </thead> 6278 } 6279 6280 @helper RenderMiniCartOrderLinesList() 6281 { 6282 <text> 6283 {{#OrderLines}} 6284 {{#ifCond template "===" "CartOrderline"}} 6285 {{>MiniCartOrderline}} 6286 {{/ifCond}} 6287 {{#ifCond template "===" "CartOrderlineMobile"}} 6288 {{>MiniCartOrderline}} 6289 {{/ifCond}} 6290 {{#ifCond template "===" "CartOrderlineDiscount"}} 6291 {{>MiniCartOrderlineDiscount}} 6292 {{/ifCond}} 6293 {{/OrderLines}} 6294 </text> 6295 } 6296 6297 @helper RenderMiniCartFees() 6298 { 6299 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 6300 if (!pointShop) 6301 { 6302 <text> 6303 {{#unless hidePaymentfee}} 6304 <div class="grid"> 6305 <div class="grid__col-6 grid__col--bleed-y"> 6306 {{paymentmethod}} 6307 </div> 6308 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{paymentfee}}</div> 6309 </div> 6310 {{/unless}} 6311 </text> 6312 } 6313 <text> 6314 @if (Dynamicweb.Ecommerce.Common.Context.Cart != null && !string.IsNullOrEmpty(Dynamicweb.Ecommerce.Common.Context.Cart.ShippingMethod)) 6315 { 6316 <text> 6317 {{#unless hideShippingfee}} 6318 <div class="grid"> 6319 <div class="grid__col-6 grid__col--bleed-y"> 6320 {{shippingmethod}} 6321 </div> 6322 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{shippingfee}}</div> 6323 </div> 6324 {{/unless}} 6325 </text> 6326 } 6327 6328 @* 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) *@ 6329 {{#ifCond correctGiftPrice "===" "Gratis"}} 6330 {{#ifCond websiteName "!==" "Kosmetoglognet"}} 6331 {{#ifCond websiteName "!==" "Kosmetolognet"}} 6332 <div class="grid"> 6333 <div class="grid__col-6 grid__col--bleed-y"> 6334 {{freeGiftText}} 6335 </div> 6336 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{correctGiftPrice}}</div> 6337 </div> 6338 {{/ifCond}} 6339 {{/ifCond}} 6340 {{/ifCond}} 6341 </text> 6342 <text> 6343 {{#if hasTaxSettings}} 6344 <div class="grid"> 6345 <div class="grid__col-6 grid__col--bleed-y">@Translate("Sales Tax")</div> 6346 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{totaltaxes}}</div> 6347 </div> 6348 {{/if}} 6349 </text> 6350 } 6351 6352 @helper RenderMiniCartFooter() 6353 { 6354 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartFooter").OrderBy(item => item.SortId).ToList(); 6355 6356 <div class="mini-cart__footer u-border-top u-padding-top dw-mod"> 6357 @RenderBlockList(subBlocks) 6358 </div> 6359 } 6360 6361 @helper RenderMiniCartActions() 6362 { 6363 int cartPageId = GetPageIdByNavigationTag("CartPage"); 6364 6365 <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(); Cart.EmptyCart(event);">@Translate("Empty cart")</button> 6366 <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> 6367 } 6368 6369 @helper RenderMiniCartPoints() 6370 { 6371 <text> 6372 {{#if earnings}} 6373 <div class="grid"> 6374 <div class="grid__col-6 grid__col--bleed-y">@Translate("Earnings")</div> 6375 <div class="grid__col-6 grid__col--bleed-y grid--align-end"> 6376 <div> 6377 <span class="u-color--loyalty-points">{{earnings}}</span> @Translate("points") 6378 </div> 6379 </div> 6380 </div> 6381 {{/if}} 6382 </text> 6383 } 6384 6385 @helper RenderMiniCartSubTotal() 6386 { 6387 bool hasTaxSettings = Dynamicweb.Rapido.Services.Countries.HasTaxSettings(Model.Cart.ID); 6388 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 6389 if (!pointShop) 6390 { 6391 <text> 6392 {{#unless hideSubTotal}} 6393 <div class="grid dw-mod u-bold"> 6394 <div class="grid__col-6 grid__col--bleed-y">@Translate("Subtotal")</div> 6395 <div class="grid__col-6 grid__col--bleed-y grid--align-end"> 6396 @if (hasTaxSettings) 6397 { 6398 <text>{{subtotalpricewithouttaxes}}</text> 6399 } 6400 else 6401 { 6402 <text>{{subtotalprice}}</text> 6403 } 6404 </div> 6405 </div> 6406 {{/unless}} 6407 </text> 6408 } 6409 } 6410 6411 @helper RenderMiniCartTotal() 6412 { 6413 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 6414 6415 <div class="mini-cart-totals grid u-border-top u-margin-top dw-mod"> 6416 <div class="grid__col-6">@Translate("Total")</div> 6417 <div class="grid__col-6 grid--align-end"> 6418 <div> 6419 @if (pointShop) 6420 { 6421 <span class="u-color--loyalty-points">{{pointsUsedInCart}}</span> @Translate("points") 6422 } 6423 else 6424 { 6425 <text>{{totalprice}}</text> 6426 } 6427 </div> 6428 </div> 6429 </div> 6430 } 6431 6432 @helper RenderMiniCartDisclaimer() 6433 { 6434 <text> 6435 {{#if showCheckoutDisclaimer}} 6436 <div class="grid u-margin-bottom u-ta-right"> 6437 <small class="grid__col-12">{{checkoutDisclaimer}}</small> 6438 </div> 6439 {{/if}} 6440 </text> 6441 } 6442 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 6443 6444 @using Dynamicweb.Rapido.Blocks.Extensibility 6445 @using Dynamicweb.Rapido.Blocks 6446 @using Dynamicweb.Rapido.Blocks.Components.General 6447 @using Dynamicweb.Rapido.Blocks.Components 6448 @using Dynamicweb.Rapido.Services 6449 6450 @{ 6451 string addToCartNotificationType = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType").SelectedValue : ""; 6452 string addToCartNotificationMiniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown"; 6453 bool addToCartHideCartIcon = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 6454 6455 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed() && !string.IsNullOrEmpty(addToCartNotificationType)) 6456 { 6457 if (addToCartNotificationType == "modal") 6458 { 6459 Block addToCartNotificationModal = new Block 6460 { 6461 Id = "AddToCartNotificationModal", 6462 Template = RenderAddToCartNotificationModal() 6463 }; 6464 6465 Block addToCartNotificationScript = new Block 6466 { 6467 Id = "AddToCartNotificationScript", 6468 Template = RenderAddToCartNotificationModalScript() 6469 }; 6470 BlocksPage.GetBlockPage("Master").Add("MasterTopSnippets", addToCartNotificationModal); 6471 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript); 6472 } 6473 else if (addToCartNotificationType == "toggle" && addToCartNotificationMiniCartLayout != "none" && !addToCartHideCartIcon && Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 6474 { 6475 Block addToCartNotificationScript = new Block 6476 { 6477 Id = "AddToCartNotificationScript", 6478 Template = RenderAddToCartNotificationToggleScript() 6479 }; 6480 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript); 6481 } 6482 } 6483 } 6484 6485 @helper RenderAddToCartNotificationModal() 6486 { 6487 <div id="LastAddedProductModal" data-template="LastAddedProductTemplate"></div> 6488 } 6489 6490 @helper RenderAddToCartNotificationModalScript() 6491 { 6492 int cartPageId = GetPageIdByNavigationTag("CartPage"); 6493 6494 <script id="LastAddedProductTemplate" type="text/x-template"> 6495 @{ 6496 6497 Modal lastAddedProduct = new Modal 6498 { 6499 Id = "LastAddedProduct", 6500 Heading = new Heading 6501 { 6502 Level = 2, 6503 Title = Translate("Product is added to the cart") 6504 }, 6505 Width = ModalWidth.Md, 6506 BodyTemplate = RenderModalContent() 6507 }; 6508 6509 lastAddedProduct.AddActions( 6510 new Button 6511 { 6512 ButtonType = ButtonType.Button, 6513 ButtonLayout = ButtonLayout.Secondary, 6514 Title = Translate("Continue shopping"), 6515 CssClass = "u-pull--left u-no-margin btn--sm", 6516 OnClick = "document.getElementById('LastAddedProductModalTrigger').checked = false" 6517 }, 6518 new Link 6519 { 6520 Href = "/Default.aspx?ID=" + cartPageId, 6521 ButtonLayout = ButtonLayout.Secondary, 6522 CssClass = "u-pull--right u-no-margin btn--sm", 6523 Title = Translate("Proceed to checkout") 6524 } 6525 ); 6526 6527 @Render(lastAddedProduct) 6528 } 6529 </script> 6530 <script> 6531 document.addEventListener('addToCart', function (event) { 6532 Cart.ShowLastAddedProductModal(event.detail); 6533 }); 6534 </script> 6535 } 6536 6537 @helper RenderModalContent() 6538 { 6539 <div class="grid"> 6540 <div class="grid__col-2"> 6541 @Render(new Image { Path = "{{ productInfo.image }}", Link = "{{ productInfo.link }}", Title = "{{ productInfo.name }}", DisableImageEngine = true }) 6542 </div> 6543 <div class="u-padding grid--align-self-center"> 6544 <span>{{quantity}}</span> x 6545 </div> 6546 <div class="grid__col-auto grid--align-self-center"> 6547 <div>{{productInfo.name}}</div> 6548 {{#if productInfo.variantName}} 6549 <small class="u-margin-bottom-5px">{{productInfo.variantName}}</small> 6550 {{/if}} 6551 {{#if productInfo.unitName}} 6552 <small class="u-margin-bottom-5px">{{productInfo.unitName}}</small> 6553 {{/if}} 6554 </div> 6555 </div> 6556 } 6557 6558 @helper RenderAddToCartNotificationToggleScript() 6559 { 6560 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 6561 6562 <script> 6563 document.addEventListener('addToCart', function () { 6564 Cart.ToggleMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '@miniCartFeedPageId'); 6565 }); 6566 </script> 6567 } 6568 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 6569 6570 @using System 6571 @using System.Web 6572 @using System.Collections.Generic 6573 @using Dynamicweb.Rapido.Blocks.Extensibility 6574 @using Dynamicweb.Rapido.Blocks 6575 @using Dynamicweb.Rapido.Blocks.Components.General 6576 6577 @functions { 6578 BlocksPage footerBlocksPage = BlocksPage.GetBlockPage("Master"); 6579 } 6580 6581 @{ 6582 string footerColumnOneContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Content"); 6583 string footerColumnTwoContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Content"); 6584 string footerColumnThreeContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Content"); 6585 string footerColumnOneHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Header"); 6586 string footerColumnTwoHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Header"); 6587 string footerColumnThreeHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Header"); 6588 6589 6590 Block masterFooterContent = new Block() 6591 { 6592 Id = "MasterFooterContent", 6593 SortId = 10, 6594 Template = RenderFooter(), 6595 SkipRenderBlocksList = true 6596 }; 6597 footerBlocksPage.Add(MasterBlockId.MasterFooter, masterFooterContent); 6598 6599 if (!string.IsNullOrEmpty(footerColumnOneContent) || !string.IsNullOrEmpty(footerColumnOneHeader)) 6600 { 6601 Block masterFooterColumnOne = new Block 6602 { 6603 Id = "MasterFooterColumnOne", 6604 SortId = 10, 6605 Template = RenderFooterColumn(footerColumnOneHeader, footerColumnOneContent), 6606 Design = new Design 6607 { 6608 Size = "auto", 6609 RenderType = RenderType.Column 6610 } 6611 }; 6612 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnOne); 6613 } 6614 6615 if (!string.IsNullOrEmpty(footerColumnTwoContent) || !string.IsNullOrEmpty(footerColumnTwoHeader)) 6616 { 6617 Block masterFooterColumnTwo = new Block 6618 { 6619 Id = "MasterFooterColumnTwo", 6620 SortId = 20, 6621 Template = RenderFooterColumn(footerColumnTwoHeader, footerColumnTwoContent), 6622 Design = new Design 6623 { 6624 Size = "auto", 6625 RenderType = RenderType.Column 6626 } 6627 }; 6628 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnTwo); 6629 } 6630 6631 if (!string.IsNullOrEmpty(footerColumnThreeContent) || !string.IsNullOrEmpty(footerColumnThreeHeader)) 6632 { 6633 Block masterFooterColumnThree = new Block 6634 { 6635 Id = "MasterFooterColumnThree", 6636 SortId = 30, 6637 Template = RenderFooterColumn(footerColumnThreeHeader, footerColumnThreeContent), 6638 Design = new Design 6639 { 6640 Size = "auto", 6641 RenderType = RenderType.Column 6642 } 6643 }; 6644 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnThree); 6645 } 6646 6647 if (Model.Area.Item.GetItem("Layout").GetBoolean("FooterNewsletterSignUp")) 6648 { 6649 Block masterFooterNewsletterSignUp = new Block 6650 { 6651 Id = "MasterFooterNewsletterSignUp", 6652 SortId = 40, 6653 Template = RenderFooterNewsletterSignUp(), 6654 Design = new Design 6655 { 6656 Size = "auto", 6657 RenderType = RenderType.Column 6658 } 6659 }; 6660 footerBlocksPage.Add("MasterFooterContent", masterFooterNewsletterSignUp); 6661 } 6662 6663 if (Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks").Count > 0) 6664 { 6665 Block masterFooterSocialLinks = new Block 6666 { 6667 Id = "MasterFooterSocialLinks", 6668 SortId = 50, 6669 Template = RenderFooterSocialLinks(), 6670 Design = new Design 6671 { 6672 Size = "auto", 6673 RenderType = RenderType.Column 6674 } 6675 }; 6676 footerBlocksPage.Add("MasterFooterContent", masterFooterSocialLinks); 6677 } 6678 6679 6680 6681 if (Model.Area.Item.GetItem("Layout").GetItems("FooterPayments") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterPayments").Count > 0 && Pageview.Area.Name != "Advanced Nutrition Programme") 6682 { 6683 Block masterFooterPayments = new Block 6684 { 6685 Id = "MasterFooterPayments", 6686 SortId = 60, 6687 Template = RenderFooterPayments(), 6688 Design = new Design 6689 { 6690 Size = "6", 6691 RenderType = RenderType.Column 6692 } 6693 }; 6694 footerBlocksPage.Add("MasterFooterContent", masterFooterPayments); 6695 } 6696 6697 else 6698 { 6699 Block masterFooterPayments = new Block 6700 { 6701 Id = "MasterFooterPayments", 6702 SortId = 60, 6703 Template = RenderFooterPayments(), 6704 Design = new Design 6705 { 6706 Size = "12", 6707 RenderType = RenderType.Column 6708 } 6709 }; 6710 footerBlocksPage.Add("MasterFooterContent", masterFooterPayments); 6711 } 6712 6713 Block masterFooterCopyright = new Block 6714 { 6715 Id = "MasterFooterCopyright", 6716 SortId = 70, 6717 Template = RenderFooterCopyright(), 6718 Design = new Design 6719 { 6720 Size = "12", 6721 RenderType = RenderType.Column 6722 } 6723 }; 6724 footerBlocksPage.Add("MasterFooterContent", masterFooterCopyright); 6725 } 6726 6727 @helper RenderFooter() 6728 { 6729 List<Block> subBlocks = this.footerBlocksPage.GetBlockListById("MasterFooterContent").OrderBy(item => item.SortId).ToList(); 6730 6731 <footer class="footer dw-mod"> 6732 <div class="center-container top-container__center-container dw-mod"> 6733 <div class="grid grid--external-bleed-x"> 6734 @RenderBlockList(subBlocks) 6735 </div> 6736 </div> 6737 </footer> 6738 } 6739 6740 @helper RenderFooterColumn(string header, string content) 6741 { 6742 <h3 class="footer__heading dw-mod">@header</h3> 6743 <div class="footer__content dw-mod"> 6744 @content 6745 </div> 6746 } 6747 6748 @helper RenderFooterNewsletterSignUp() 6749 { 6750 string newsletterSignUpPageId = GetPageIdByNavigationTag("NewsletterSignUp").ToString(); 6751 Form form = new Form { Action = "/Default.aspx", Method = FormMethod.Get, Enctype = FormEnctype.multipart }; 6752 6753 form.Add(new HiddenField { Name = "ID", Value = newsletterSignUpPageId }); 6754 form.Add(new Text { Content = "<p>" + Translate("Sign up if you would like to receive occasional treats from us") + "</p>" }); 6755 form.Add(new TextField 6756 { 6757 Id = "NewsletterEmail", 6758 Name = "NewsletterEmail", 6759 Placeholder = Translate("Your email address"), 6760 Type = TextFieldType.Email, 6761 ActionButton = new Button 6762 { 6763 ButtonType = ButtonType.Submit, 6764 Id = "Submitter", 6765 Title = Translate("Go"), 6766 OnClick = "Buttons.LockButton(event)", 6767 CssClass = "btn--condensed" 6768 } 6769 }); 6770 6771 <h3 class="footer__heading dw-mod">@Translate("Mailing list")</h3> 6772 <div class="footer__content dw-mod"> 6773 @Render(form) 6774 </div> 6775 } 6776 6777 @helper RenderFooterSocialLinks() 6778 { 6779 <h3 class="footer__heading dw-mod">@Translate("Social links")</h3> 6780 <div class="footer__content dw-mod"> 6781 <div class="collection dw-mod"> 6782 @foreach (var socialitem in Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks")) 6783 { 6784 var socialIcon = socialitem.GetValue("Icon") as Dynamicweb.Frontend.ListViewModel; 6785 string socialIconClass = socialIcon.SelectedValue; 6786 string socialIconTitle = socialIcon.SelectedName; 6787 string socialLink = socialitem.GetString("Link"); 6788 6789 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px" rel="noopener"><i class="@socialIconClass fa-2x"></i></a> 6790 } 6791 </div> 6792 </div> 6793 } 6794 6795 @helper RenderFooterPayments() 6796 { 6797 <div class="footer__content dw-mod"> 6798 <div class="collection dw-mod"> 6799 @foreach (var payment in Model.Area.Item.GetItem("Layout").GetItems("FooterPayments")) 6800 { 6801 var paymentItem = payment.GetValue("CardTypeOrVerifiedPayment") as Dynamicweb.Frontend.ListViewModel; 6802 string paymentImage = null; 6803 string paymentTitle = paymentItem.SelectedName; 6804 ListOptionViewModel selected = paymentItem.SelectedOptions.FirstOrDefault(); 6805 if (selected != null) 6806 { 6807 paymentImage = selected.Icon; 6808 } 6809 6810 <div class="footer__card-type"> 6811 <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" /> 6812 </div> 6813 } 6814 </div> 6815 </div> 6816 } 6817 6818 @helper RenderFooterCopyright() 6819 { 6820 <div class="grid__col-12 footer__copyright dw-mod"> 6821 <p>@Model.Area.Item.GetItem("Layout").GetString("FooterCopyrightText")</p> 6822 6823 @{ 6824 var currentPage = Pageview.Area.Name; 6825 6826 } 6827 6828 @if (currentPage == "Dermalogica") 6829 { 6830 @*<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>*@ 6831 } 6832 6833 @if (currentPage == "Janeiredale") 6834 { 6835 6836 @*<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>*@ 6837 } 6838 </div> 6839 6840 } 6841 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 6842 6843 @using System 6844 @using System.Web 6845 @using System.Collections.Generic 6846 @using Dynamicweb.Rapido.Blocks.Extensibility 6847 @using Dynamicweb.Rapido.Blocks 6848 @using Dynamicweb.Ecommerce.Common 6849 6850 @{ 6851 BlocksPage referencesBlocksPage = BlocksPage.GetBlockPage("Master"); 6852 6853 Block masterScriptReferences = new Block() 6854 { 6855 Id = "MasterScriptReferences", 6856 SortId = 1, 6857 Template = RenderMasterScriptReferences() 6858 }; 6859 referencesBlocksPage.Add(MasterBlockId.MasterReferences, masterScriptReferences); 6860 6861 6862 } 6863 6864 @helper RenderMasterScriptReferences() 6865 { 6866 6867 <script src="/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js" defer></script> 6868 <script src="/Files/Templates/Designs/Rapido/js/master.min.js" defer></script> 6869 6870 6871 if (Model.Area.Item.GetItem("Custom").GetBoolean("UseCustomJavascript")) 6872 { 6873 <script src="/Files/Templates/Designs/Rapido/js/custom.min.js"></script> 6874 PushPromise("/Files/Templates/Designs/Rapido/js/custom.min.js"); 6875 } 6876 6877 PushPromise("/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js"); 6878 PushPromise("/Files/Templates/Designs/Rapido/js/master.min.js"); 6879 6880 6881 var externalScripts = Model.Area.Item.GetItem("Custom").GetItems("ExternalScripts"); 6882 6883 6884 foreach (var script in externalScripts) 6885 { 6886 string externalScript = script.GetString("ScriptLink"); 6887 if (!string.IsNullOrEmpty(externalScript)) 6888 { 6889 @externalScript 6890 } 6891 6892 } 6893 6894 } 6895 6896 6897 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 6898 6899 @using System 6900 @using System.Web 6901 @using System.Collections.Generic 6902 @using Dynamicweb.Rapido.Blocks.Extensibility 6903 @using Dynamicweb.Rapido.Blocks 6904 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 6905 @using Dynamicweb.Rapido.Services 6906 6907 @{ 6908 BlocksPage searchBlocksPage = BlocksPage.GetBlockPage("Master"); 6909 bool navigationItemsHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 6910 bool isFavoriteList = !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("ListID")); 6911 6912 if (!navigationItemsHideSearch || isFavoriteList) 6913 { 6914 Block masterSearchScriptTemplates = new Block() 6915 { 6916 Id = "MasterSearchScriptTemplates", 6917 SortId = 1, 6918 Template = RenderSearchScriptTemplates() 6919 }; 6920 6921 searchBlocksPage.Add(MasterBlockId.MasterBottomSnippets, masterSearchScriptTemplates); 6922 } 6923 } 6924 6925 @helper RenderSearchScriptTemplates() 6926 { 6927 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 6928 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 6929 bool useFacebookPixel = !string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID")); 6930 bool useGoogleTagManager = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID")); 6931 bool showPrice = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HidePriceInSearchResults"); 6932 bool showAddToCartButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideAddToCartButton"); 6933 bool showViewButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideViewButton"); 6934 bool showAddToDownloadButton = Pageview.AreaSettings.GetItem("Layout").GetBoolean("ShowAddToDownloadButton"); 6935 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 6936 6937 <script id="SearchGroupsTemplate" type="text/x-template"> 6938 {{#.}} 6939 <li class="dropdown__item dw-mod" onclick="Search.UpdateGroupSelection(this)" data-group-id="{{id}}">{{name}}</li> 6940 {{/.}} 6941 </script> 6942 6943 <script id="SearchProductsTemplate" type="text/x-template"> 6944 {{#each .}} 6945 {{#Product}} 6946 {{#ifCond template "!==" "SearchMore"}} 6947 <li class="dropdown__item dropdown__item--seperator dw-mod"> 6948 @if (useFacebookPixel) 6949 { 6950 <text>{{{facebookPixelSearch name number priceDouble currency searchParameter}}}</text> 6951 } 6952 @if (useGoogleTagManager) 6953 { 6954 <text>{{{googleEnchantImpression googleImpression}}}</text> 6955 } 6956 <div> 6957 <a href="{{link}}" 6958 class="js-typeahead-link u-color-inherit u-pull--left" 6959 onclick="{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}" 6960 title="{{name}}{{#if variantName}}, {{variantName}}{{/if}}"> 6961 <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> 6962 <div class="u-pull--left"> 6963 <div class="u-bold u-max-w220px u-truncate-text js-typeahead-name">{{name}}{{#if variantName}}, {{variantName}}{{/if}}</div> 6964 @if (showPrice && Dynamicweb.Rapido.Services.User.IsPricesAllowed()) 6965 { 6966 if (pointShopOnly) 6967 { 6968 <text> 6969 {{#if havePointPrice}} 6970 <div> 6971 <span class="u-color--loyalty-points">{{points}}</span> @Translate("points") 6972 </div> 6973 {{else}} 6974 <small class="help-text u-no-margin">@Translate("Not available")</small> 6975 {{/if}} 6976 {{#unless canBePurchasedWithPoints}} 6977 {{#if havePointPrice}} 6978 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small> 6979 {{/if}} 6980 {{/unless}} 6981 </text> 6982 } 6983 else 6984 { 6985 <div>{{price}}</div> 6986 } 6987 } 6988 </div> 6989 </a> 6990 <div class="u-margin-left u-pull--right"> 6991 @{ 6992 var viewBtn = new Link 6993 { 6994 Href = "{{link}}", 6995 OnClick = "{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}", 6996 ButtonLayout = ButtonLayout.Secondary, 6997 CssClass = "btn--condensed u-no-margin u-w80px js-ignore-click-outside", 6998 Title = Translate("View") 6999 }; 7000 } 7001 @if (showAddToCartButton && Dynamicweb.Rapido.Services.User.IsBuyingAllowed()) 7002 { 7003 <text>{{#if hideAddToCartButton}}</text> 7004 @Render(viewBtn) 7005 <text>{{else}}</text> 7006 @Render(new AddToCartButton 7007 { 7008 HideTitle = true, 7009 ProductId = "{{productId}}", 7010 VariantId = "{{variantid}}", 7011 ProductInfo = "{{productInfo}}", 7012 BuyForPoints = pointShopOnly, 7013 OnClick = "{{facebookPixelAction}}", 7014 CssClass = "u-w80px u-no-margin js-ignore-click-outside", 7015 Icon = new Icon { 7016 CssClass = "js-ignore-click-outside" 7017 }, 7018 ExtraAttributes = new Dictionary<string, string> 7019 { 7020 { "{{disabledBuyButton}}", "" } 7021 } 7022 }) 7023 <text>{{/if}}</text> 7024 } 7025 else if (showViewButton) 7026 { 7027 @Render(viewBtn) 7028 } 7029 @if (showAddToDownloadButton) 7030 { 7031 <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}}"> 7032 <i class="fas fa-plus js-button-icon"></i> 7033 </button> 7034 } 7035 </div> 7036 </div> 7037 </li> 7038 {{/ifCond}} 7039 {{#ifCond template "===" "SearchMore"}} 7040 {{>SearchMoreProducts}} 7041 {{/ifCond}} 7042 {{/Product}} 7043 {{else}} 7044 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod"> 7045 @Translate("Your search gave 0 results") 7046 </li> 7047 {{/each}} 7048 </script> 7049 7050 <script id="SearchMoreProducts" type="text/x-template"> 7051 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 7052 <a href="/Default.aspx?ID=@productsPageId&Search={{searchParameter}}&GroupID={{groupId}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 7053 @Translate("View all") 7054 </a> 7055 </li> 7056 </script> 7057 7058 <script id="SearchMorePages" type="text/x-template"> 7059 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 7060 <a href="/Default.aspx?ID=@contentSearchPageLink&Search={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 7061 @Translate("View all") 7062 </a> 7063 </li> 7064 </script> 7065 7066 <script id="SearchPagesTemplate" type="text/x-template"> 7067 {{#each .}} 7068 {{#ifCond template "!==" "SearchMore"}} 7069 <li class="dropdown__item dropdown__item--seperator dropdown__item--no-padding dw-mod"> 7070 <a href="/Default.aspx?ID={{id}}" class="js-typeahead-link dropdown__link u-color-inherit"> 7071 <div class="u-margin-right"><i class="fa {{icon}} u-w20px u-ta-center"></i></div> 7072 <div class="u-bold u-truncate-text u-max-w220px js-typeahead-name">{{name}}</div> 7073 </a> 7074 </li> 7075 {{/ifCond}} 7076 {{#ifCond template "===" "SearchMore"}} 7077 {{>SearchMorePages}} 7078 {{/ifCond}} 7079 {{else}} 7080 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod"> 7081 @Translate("Your search gave 0 results") 7082 </li> 7083 {{/each}} 7084 </script> 7085 7086 <script id="SearchPagesTemplateWrap" type="text/x-template"> 7087 <div class="dropdown__column-header">@Translate("Pages")</div> 7088 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod"> 7089 {{>SearchPagesTemplate}} 7090 </ul> 7091 </script> 7092 7093 <script id="SearchProductsTemplateWrap" type="text/x-template"> 7094 <div class="dropdown__column-header">@Translate("Products")</div> 7095 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod"> 7096 {{>SearchProductsTemplate}} 7097 </ul> 7098 </script> 7099 } 7100 7101 @using Dynamicweb.Rapido.Blocks.Components 7102 @using Dynamicweb.Rapido.Blocks.Components.General 7103 @using Dynamicweb.Rapido.Blocks 7104 @using System.IO 7105 7106 7107 @using Dynamicweb.Rapido.Blocks.Components.General 7108 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 7109 7110 7111 @* Component *@ 7112 7113 @helper RenderVariantMatrix(VariantMatrix settings) { 7114 if (settings != null) 7115 { 7116 int productLoopCounter = 0; 7117 int groupCount = 0; 7118 List<VariantOption> firstDimension = new List<VariantOption>(); 7119 List<VariantOption> secondDimension = new List<VariantOption>(); 7120 List<VariantOption> thirdDimension = new List<VariantOption>(); 7121 7122 foreach (VariantGroup variantGroup in settings.GetVariantGroups()) 7123 { 7124 foreach (VariantOption variantOptions in variantGroup.GetVariantOptions()) 7125 { 7126 if (groupCount == 0) { 7127 firstDimension.Add(variantOptions); 7128 } 7129 if (groupCount == 1) 7130 { 7131 secondDimension.Add(variantOptions); 7132 } 7133 if (groupCount == 2) 7134 { 7135 thirdDimension.Add(variantOptions); 7136 } 7137 } 7138 groupCount++; 7139 } 7140 7141 int rowCount = 0; 7142 int columnCount = 0; 7143 7144 <script> 7145 var variantsCollection = []; 7146 </script> 7147 7148 <table class="table table--compact js-variants-matrix dw-mod" id="VariantMatrixTable_@settings.ProductId"> 7149 @if (groupCount == 1) 7150 { 7151 <tbody> 7152 @foreach (VariantOption firstVariantOption in firstDimension) 7153 { 7154 var variantId = firstVariantOption.Id; 7155 <tr> 7156 <td class="u-bold"> 7157 @firstVariantOption.Name 7158 </td> 7159 <td> 7160 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount) 7161 </td> 7162 </tr> 7163 productLoopCounter++; 7164 } 7165 7166 <tr> 7167 <td>&nbsp;</td> 7168 <td> 7169 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div> 7170 </td> 7171 </tr> 7172 </tbody> 7173 } 7174 @if (groupCount == 2) 7175 { 7176 <thead> 7177 <tr> 7178 <td>&nbsp;</td> 7179 @foreach (VariantOption variant in secondDimension) 7180 { 7181 <td>@variant.Name</td> 7182 } 7183 </tr> 7184 </thead> 7185 <tbody> 7186 @foreach (VariantOption firstVariantOption in firstDimension) 7187 { 7188 string variantId = ""; 7189 columnCount = 0; 7190 7191 <tr> 7192 <td class="u-min-w120px">@firstVariantOption.Name</td> 7193 7194 @foreach (VariantOption secondVariantOption in secondDimension) 7195 { 7196 variantId = firstVariantOption.Id + "." + secondVariantOption.Id; 7197 <td> 7198 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount) 7199 </td> 7200 7201 columnCount++; 7202 7203 productLoopCounter++; 7204 } 7205 7206 <td> 7207 <div class="qty-field js-total-qty-row-@rowCount dw-mod">0</div> 7208 </td> 7209 </tr> 7210 7211 rowCount++; 7212 } 7213 7214 @{ 7215 columnCount = 0; 7216 } 7217 7218 <tr> 7219 <td>&nbsp;</td> 7220 @foreach (VariantOption secondVariantOption in secondDimension) 7221 { 7222 <td> 7223 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div> 7224 </td> 7225 7226 columnCount++; 7227 } 7228 <td>&nbsp;</td> 7229 </tr> 7230 </tbody> 7231 } 7232 @if (groupCount == 3) 7233 { 7234 <thead> 7235 <tr> 7236 <td>&nbsp;</td> 7237 @foreach (VariantOption thirdVariantOption in thirdDimension) 7238 { 7239 <td>@thirdVariantOption.Name</td> 7240 } 7241 </tr> 7242 </thead> 7243 <tbody> 7244 @foreach (VariantOption firstVariantOption in firstDimension) 7245 { 7246 int colspan = (thirdDimension.Count + 1); 7247 7248 <tr> 7249 <td colspan="@colspan" class="u-color-light-gray--bg u-bold">@firstVariantOption.Name</td> 7250 </tr> 7251 7252 foreach (VariantOption secondVariantOption in secondDimension) 7253 { 7254 string variantId = ""; 7255 columnCount = 0; 7256 7257 <tr> 7258 <td class="u-min-w120px">@secondVariantOption.Name</td> 7259 7260 @foreach (VariantOption thirdVariantOption in thirdDimension) 7261 { 7262 variantId = firstVariantOption.Id + "." + secondVariantOption.Id + "." + thirdVariantOption.Id; 7263 7264 <td> 7265 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount) 7266 </td> 7267 7268 columnCount++; 7269 productLoopCounter++; 7270 } 7271 7272 <td> 7273 <div class="qty-field js-total-qty-row-@rowCount dw-mod">0</div> 7274 </td> 7275 </tr> 7276 rowCount++; 7277 } 7278 } 7279 7280 @{ 7281 columnCount = 0; 7282 } 7283 7284 <tr> 7285 <td>&nbsp;</td> 7286 @foreach (VariantOption thirdVariantOption in thirdDimension) 7287 { 7288 <td> 7289 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div> 7290 </td> 7291 7292 columnCount++; 7293 } 7294 <td>&nbsp;</td> 7295 </tr> 7296 </tbody> 7297 } 7298 </table> 7299 7300 <script> 7301 document.addEventListener("DOMContentLoaded", function (event) { 7302 MatrixUpdateQuantity("@settings.ProductId"); 7303 }); 7304 7305 MatrixUpdateQuantity = function (productId) { 7306 var currentMatrix = document.getElementById("VariantMatrixTable_" + productId); 7307 var allQtyFields = currentMatrix.getElementsByClassName("js-qty"); 7308 7309 var qtyRowArr = []; 7310 var qtyColumnArr = []; 7311 7312 var totalQty = 0; 7313 7314 for (var i = 0; i < allQtyFields.length; i++) { 7315 qtyRowArr[allQtyFields[i].getAttribute("data-qty-row-group")] = 0; 7316 qtyColumnArr[allQtyFields[i].getAttribute("data-qty-column-group")] = 0; 7317 } 7318 7319 for (var i = 0; i < allQtyFields.length; i++) { 7320 qtyRowArr[allQtyFields[i].getAttribute("data-qty-row-group")] += parseFloat(allQtyFields[i].value); 7321 qtyColumnArr[allQtyFields[i].getAttribute("data-qty-column-group")] += parseFloat(allQtyFields[i].value); 7322 totalQty += parseFloat(allQtyFields[i].value); 7323 } 7324 7325 //Update row counters 7326 for (var i = 0; i < qtyRowArr.length; i++) { 7327 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-row-" + i)[0]; 7328 7329 if (qtyRowArr[i] != undefined && qtyCounter != null) { 7330 var currentCount = qtyCounter.innerHTML; 7331 qtyCounter.innerHTML = qtyRowArr[i]; 7332 7333 if (currentCount != qtyCounter.innerHTML) { 7334 qtyCounter.classList.add("qty-field--active"); 7335 } 7336 } 7337 7338 } 7339 7340 //Update column counters 7341 for (var i = 0; i < qtyColumnArr.length; i++) { 7342 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-column-" + i)[0]; 7343 7344 if (qtyColumnArr[i] != undefined && qtyCounter != null) { 7345 var currentCount = qtyCounter.innerHTML; 7346 qtyCounter.innerHTML = qtyColumnArr[i]; 7347 7348 if (currentCount != qtyCounter.innerHTML) { 7349 qtyCounter.classList.add("qty-field--active"); 7350 } 7351 } 7352 } 7353 7354 if (document.getElementById("TotalQtyCount_" + productId)) { 7355 document.getElementById("TotalQtyCount_" + productId).innerHTML = totalQty; 7356 } 7357 7358 //Clean up animations 7359 setTimeout(function () { 7360 for (var i = 0; i < qtyRowArr.length; i++) { 7361 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-row-" + i)[0]; 7362 if (qtyCounter != null) { 7363 qtyCounter.classList.remove("qty-field--active"); 7364 } 7365 } 7366 for (var i = 0; i < qtyColumnArr.length; i++) { 7367 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-column-" + i)[0]; 7368 if (qtyCounter != null) { 7369 qtyCounter.classList.remove("qty-field--active"); 7370 } 7371 } 7372 }, 1000); 7373 } 7374 </script> 7375 } 7376 } 7377 7378 @helper RenderVariantMatrixQuantityField(string variantId, VariantMatrix settings, int productLoopCounter, int rowCount, int columnCount) 7379 { 7380 string loopCount = productLoopCounter.ToString(); 7381 7382 bool combinationFound = false; 7383 double stock = 0; 7384 double quantityValue = 0; 7385 string note = ""; 7386 7387 VariantProduct variantProduct = null; 7388 7389 if (settings.GetVariantProducts().TryGetValue(variantId, out variantProduct)) 7390 { 7391 stock = variantProduct.Stock; 7392 quantityValue = variantProduct.Quantity; 7393 combinationFound = true; 7394 } 7395 7396 if (combinationFound) 7397 { 7398 <input type="hidden" name="ProductLoopCounter@(loopCount)" value="@loopCount" /> 7399 <input type="hidden" name="ProductID@(loopCount)" value="@settings.ProductId" /> 7400 <input type="hidden" name="VariantID@(loopCount)" value="@variantId" /> 7401 <input type="hidden" name="CurrentNote@(loopCount)" id="CurrentNote_@(settings.ProductId)_@variantId" value="@note" /> 7402 <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"> 7403 7404 if (stock != 0) 7405 { 7406 <small>@Translate("Stock") @stock</small> 7407 } 7408 7409 <script> 7410 var variants = '{ "ProductId" :' + '"@settings.ProductId"' + ', "VariantId": ' + '"@variantId"' +'}'; 7411 variantsCollection.push(variants); 7412 document.getElementById("Quantity_@(settings.ProductId)_@variantId").closest(".js-variants-matrix").setAttribute("data-variants-collection", "[" + variantsCollection + "]" ); 7413 </script> 7414 } 7415 else 7416 { 7417 <div class="use-btn-height" style="background-color: #a8a8a8"></div> 7418 } 7419 } 7420 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 7421 7422 @* Component *@ 7423 7424 @helper RenderAddToCart(AddToCart settings) 7425 { 7426 //set Id for quantity selector to get it's value from button 7427 if (settings.QuantitySelector != null) 7428 { 7429 if (string.IsNullOrEmpty(settings.QuantitySelector.Id)) 7430 { 7431 settings.QuantitySelector.Id = Guid.NewGuid().ToString("N"); 7432 } 7433 7434 settings.AddButton.QuantitySelectorId = settings.QuantitySelector.Id; 7435 7436 if (settings.Disabled) 7437 { 7438 settings.QuantitySelector.Disabled = true; 7439 } 7440 7441 if (string.IsNullOrEmpty(settings.QuantitySelector.Name)) 7442 { 7443 settings.QuantitySelector.Name = settings.QuantitySelector.Id; 7444 } 7445 } 7446 7447 if (settings.Disabled) 7448 { 7449 settings.AddButton.Disabled = true; 7450 } 7451 7452 settings.AddButton.CssClass += " btn--condensed"; 7453 7454 //unitsSelector 7455 if (settings.UnitSelector != null) 7456 { 7457 if (settings.Disabled) 7458 { 7459 settings.QuantitySelector.Disabled = true; 7460 } 7461 } 7462 7463 <div class="buttons-collection @settings.WrapperCssClass" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 7464 @if (settings.UnitSelector != null) 7465 { 7466 @Render(settings.UnitSelector) 7467 } 7468 @if (settings.QuantitySelector != null) 7469 { 7470 @Render(settings.QuantitySelector) 7471 } 7472 @Render(settings.AddButton) 7473 </div> 7474 } 7475 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 7476 7477 @* Component *@ 7478 7479 @helper RenderAddToCartButton(AddToCartButton settings) 7480 { 7481 if (!settings.HideTitle) 7482 { 7483 if (string.IsNullOrEmpty(settings.Title)) 7484 { 7485 if (settings.BuyForPoints) 7486 { 7487 settings.Title = Translate("Buy with points"); 7488 } 7489 else 7490 { 7491 settings.Title = Translate("Add to cart"); 7492 } 7493 } 7494 } 7495 else 7496 { 7497 settings.Title = ""; 7498 } 7499 7500 if (settings.Icon == null) 7501 { 7502 settings.Icon = new Icon(); 7503 settings.Icon.LabelPosition = Dynamicweb.Rapido.Blocks.Components.General.IconLabelPosition.After; 7504 } 7505 7506 if (string.IsNullOrEmpty(settings.Icon.Name)) 7507 { 7508 settings.Icon.Name = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue; 7509 } 7510 7511 settings.OnClick = "Cart.AddToCart(event, { " + 7512 "id: '" + settings.ProductId + "'," + 7513 (!string.IsNullOrEmpty(settings.VariantId) ? "variantId: '" + settings.VariantId + "'," : "") + 7514 (!string.IsNullOrEmpty(settings.UnitId) ? "unitId: '" + settings.UnitId + "'," : "") + 7515 (settings.BuyForPoints ? "buyForPoints: true," : "") + 7516 (!string.IsNullOrEmpty(settings.ProductInfo) ? "productInfo: " + settings.ProductInfo + "," : "") + 7517 "quantity: " + (string.IsNullOrEmpty(settings.QuantitySelectorId) ? "1" : "parseFloat(document.getElementById('" + settings.QuantitySelectorId + "').value)") + 7518 "});" + settings.OnClick; 7519 7520 @RenderButton(settings) 7521 } 7522 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 7523 7524 @* Component *@ 7525 7526 @helper RenderUnitSelector(UnitSelector settings) 7527 { 7528 if (string.IsNullOrEmpty(settings.Id)) 7529 { 7530 settings.Id = Guid.NewGuid().ToString("N"); 7531 } 7532 var disabledClass = settings.Disabled ? "disabled" : ""; 7533 7534 <input type="checkbox" id="@settings.Id" class="dropdown-trigger" /> 7535 <div class="dropdown unit-selector @settings.CssClass @disabledClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 7536 <label class="dropdown__header dropdown__btn dropdown__btn--unit-selector dw-mod" for="@settings.Id">@settings.SelectedOption</label> 7537 <div class="dropdown__content dw-mod"> 7538 @settings.OptionsContent 7539 </div> 7540 <label class="dropdown-trigger-off" for="@settings.Id"></label> 7541 </div> 7542 } 7543 @using System.Reflection 7544 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 7545 7546 @* Component *@ 7547 7548 @helper RenderQuantitySelector(QuantitySelector settings) 7549 { 7550 var attributes = new Dictionary<string, string>(); 7551 7552 /*base settings*/ 7553 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 7554 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 7555 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 7556 if (settings.Disabled) { attributes.Add("disabled", "true"); } 7557 if (settings.Required) { attributes.Add("required", "true"); } 7558 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 7559 /*end*/ 7560 7561 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 7562 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 7563 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 7564 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 7565 if (settings.Max != null) { attributes.Add("max", settings.Max.ToString()); } 7566 if (settings.Min == null) { settings.Min = 1; } 7567 attributes.Add("min", settings.Min.ToString()); 7568 if (settings.Step != null && !string.IsNullOrEmpty(settings.Step.ToString())) { attributes.Add("step", settings.Step.ToString()); } 7569 if (settings.Value == null) { settings.Value = 1; } 7570 attributes.Add("value", settings.Value.ToString()); 7571 attributes.Add("type", "number"); 7572 7573 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 7574 7575 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 7576 } 7577 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 7578 7579 @using System 7580 @using System.Web 7581 @using System.Collections.Generic 7582 @using Dynamicweb.Rapido.Blocks.Extensibility 7583 @using Dynamicweb.Rapido.Blocks 7584 7585 @{ 7586 BlocksPage bottomSnippetsBlocksPage = BlocksPage.GetBlockPage("Master"); 7587 7588 Block primaryBottomSnippets = new Block() 7589 { 7590 Id = "MasterJavascriptInitializers", 7591 SortId = 100, 7592 Template = RenderPrimaryBottomSnippets() 7593 }; 7594 bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, primaryBottomSnippets); 7595 } 7596 7597 @helper RenderPrimaryBottomSnippets() 7598 { 7599 bool isWireframeMode = Model.Area.Item.GetItem("Settings").GetBoolean("WireframeMode"); 7600 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 7601 7602 if (isWireframeMode) 7603 { 7604 <script> 7605 Wireframe.Init(true); 7606 </script> 7607 } 7608 7609 7610 if (useGoogleTagManager) 7611 { 7612 <script> 7613 document.addEventListener('addToCart', function(event) { 7614 var googleImpression = JSON.parse(event.detail.productInfo.googleImpression); 7615 if (typeof googleImpression == "string") { 7616 googleImpression = JSON.parse(event.detail.productInfo.googleImpression); 7617 } 7618 dataLayer.push({ 7619 'event': 'addToCart', 7620 'ecommerce': { 7621 'currencyCode': googleImpression.currency, 7622 'add': { 7623 'products': [{ 7624 'name': googleImpression.name, 7625 'id': googleImpression.id, 7626 'price': googleImpression.price, 7627 'brand': googleImpression.brand, 7628 'category': googleImpression.category, 7629 'variant': googleImpression.variant, 7630 'quantity': event.detail.quantity 7631 }] 7632 } 7633 } 7634 }); 7635 }); 7636 </script> 7637 } 7638 7639 //if digitalwarehouse 7640 if (Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart")) 7641 { 7642 string cartContextId = Converter.ToString(HttpContext.Current.Application["DownloadCartContext"]); 7643 7644 if (string.IsNullOrEmpty(cartContextId)) 7645 { 7646 var moduleProps = Dynamicweb.Modules.Properties.GetParagraphModuleSettings(GetPageIdByNavigationTag("DownloadCart"), "eCom_CartV2"); 7647 var cartSettings = new Dynamicweb.Ecommerce.Cart.ModuleSettings(moduleProps); 7648 cartContextId = cartSettings.OrderContextID; 7649 HttpContext.Current.Application["DownloadCartContext"] = cartContextId; 7650 } 7651 7652 <script> 7653 let downloadCart = new DownloadCart({ 7654 cartPageId: @GetPageIdByNavigationTag("MiniCartFeed"), 7655 contextId: "@cartContextId", 7656 addButtonText: "@Translate("Add")", 7657 removeButtonText: "@Translate("Remove")" 7658 }); 7659 </script> 7660 } 7661 7662 <!--@Javascripts--> 7663 } 7664 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 7665 7666 @using System 7667 @using System.Web 7668 @using System.Collections.Generic 7669 @using Dynamicweb.Rapido.Blocks 7670 @using Dynamicweb.Rapido.Blocks.Extensibility 7671 @using Færch.CustomModules 7672 7673 @{ 7674 BlocksPage masterCustomBlocksPage = BlocksPage.GetBlockPage("Master"); 7675 7676 string trustPilotUrl = Model.Area.Item.GetItem("Custom").GetString("TrustPilotUrl"); 7677 string trustPilotTemplateId = Model.Area.Item.GetItem("Custom").GetString("TrustPilotTemplateId"); 7678 string trustPilotBusinessUnitId = Model.Area.Item.GetItem("Custom").GetString("TrustPilotBusinessUnitId"); 7679 7680 bool showTrustPilot = !string.IsNullOrEmpty(trustPilotUrl) && !string.IsNullOrEmpty(trustPilotTemplateId) && !string.IsNullOrEmpty(trustPilotBusinessUnitId); 7681 7682 bool showFooter = showTrustPilot; 7683 7684 Block footer = new Block() 7685 { 7686 Id = "CustomFooter", 7687 SortId = 51, 7688 Design = new Design 7689 { 7690 Size = "12", 7691 RenderType = RenderType.Row 7692 } 7693 }; 7694 7695 if (showFooter) 7696 { 7697 masterCustomBlocksPage.Add("MasterFooterContent", footer); 7698 } 7699 7700 if (showTrustPilot) 7701 { 7702 Block trustPilotScript = new Block() 7703 { 7704 Id = "TrustPilotScript", 7705 SortId = 101, 7706 Template = RenderTrustPilotScript() 7707 }; 7708 7709 masterCustomBlocksPage.Add(MasterBlockId.MasterTopSnippets, trustPilotScript); 7710 7711 Block trustPilotWidget = new Block() 7712 { 7713 Id = "TrustPilotWidget", 7714 SortId = 65, 7715 Template = RenderTrustPilotWidget(trustPilotUrl, trustPilotTemplateId, trustPilotBusinessUnitId), 7716 Design = new Design 7717 { 7718 Size = "6", 7719 RenderType = RenderType.Column 7720 } 7721 }; 7722 7723 masterCustomBlocksPage.Add("MasterFooterContent", trustPilotWidget); 7724 } 7725 7726 Block customScripts = new Block() 7727 { 7728 Id = "CustomScripts", 7729 SortId = 99, 7730 Template = RenderCustomScripts() 7731 }; 7732 7733 masterCustomBlocksPage.Add("Head", customScripts); 7734 } 7735 7736 @helper RenderCustomScripts() 7737 { 7738 <script type="text/javascript" src="@Helpers.GetRevisionNumber("/Files/Templates/Designs/Rapido/js/custom.min.js")"></script> 7739 } 7740 7741 @helper RenderTrustPilotScript() 7742 { 7743 <!-- TrustBox script --> 7744 <script type="text/javascript" data-cookieconsent="statistics" src="//widget.trustpilot.com/bootstrap/v5/tp.widget.bootstrap.min.js" async=""></script> 7745 <!-- End TrustBox script --> 7746 } 7747 7748 @helper RenderTrustPilotWidget(string url, string templateId, string businessUnitId) 7749 { 7750 <!-- TrustBox widget - Micro Star --> 7751 <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"> 7752 <a href="https://dk.trustpilot.com/review/@url" target="_blank" rel="noopener" class="u-pull--right">Trustpilot</a> 7753 </div> 7754 <!-- End TrustBox widget --> 7755 } 7756 7757 7758 @functions { 7759 public class ManifestIcon 7760 { 7761 public string src { get; set; } 7762 public string type { get; set; } 7763 public string sizes { get; set; } 7764 } 7765 7766 public class Manifest 7767 { 7768 public string name { get; set; } 7769 public string short_name { get; set; } 7770 public string start_url { get; set; } 7771 public string display { get; set; } 7772 public string background_color { get; set; } 7773 public string theme_color { get; set; } 7774 public List<ManifestIcon> icons { get; set; } 7775 } 7776 } 7777 7778 <!DOCTYPE html> 7779 7780 <html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName"> 7781 7782 7783 7784 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 7785 @RenderBlockList(masterPage.BlocksRoot.BlocksList) 7786 7787 7788 7789 @helper RenderMasterHead() 7790 { 7791 List<Block> subBlocks = this.masterPage.GetBlockListById("Head").OrderBy(item => item.SortId).ToList(); 7792 7793 <head> 7794 <!-- Rapido version 3.2.1 --> 7795 7796 @RenderBlockList(subBlocks) 7797 </head> 7798 7799 } 7800 7801 @helper RenderMasterMetadata() 7802 { 7803 var swatches = new Dynamicweb.Content.Items.ColorSwatchService(); 7804 var brandColors = swatches.GetColorSwatch(1); 7805 string brandColorOne = brandColors.Palette["BrandColor1"]; 7806 7807 if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName")) && Model.Area.Item.GetItem("Settings").GetFile("AppIcon") != null) 7808 { 7809 Manifest manifest = new Manifest 7810 { 7811 name = Model.Area.Item.GetItem("Settings").GetString("AppName"), 7812 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"), 7813 start_url = "/", 7814 display = "standalone", 7815 background_color = Model.Area.Item.GetItem("Settings").GetString("AppBackgroundColor"), 7816 theme_color = Model.Area.Item.GetItem("Settings").GetString("AppThemeColor") 7817 }; 7818 7819 manifest.icons = new List<ManifestIcon> { 7820 new ManifestIcon { 7821 src = "/Admin/Public/GetImage.ashx?width=192&height=192&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 7822 sizes = "192x192", 7823 type = "image/png" 7824 }, 7825 new ManifestIcon { 7826 src = "/Admin/Public/GetImage.ashx?width=512&height=512&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 7827 sizes = "512x512", 7828 type = "image/png" 7829 }, 7830 new ManifestIcon { 7831 src = "/Admin/Public/GetImage.ashx?width=1024&height=1024&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 7832 sizes = "1024x1024", 7833 type = "image/png" 7834 } 7835 }; 7836 7837 string manifestFilePath = HttpContext.Current.Request.MapPath("/Files/Templates/Designs/Rapido/manifest.json"); 7838 string manifestJSON = Newtonsoft.Json.JsonConvert.SerializeObject(manifest); 7839 string currentManifest = File.ReadAllText(manifestFilePath); 7840 7841 if (manifestJSON != currentManifest) 7842 { 7843 File.WriteAllText(manifestFilePath, manifestJSON); 7844 } 7845 } 7846 7847 <meta charset="utf-8" /> 7848 <title>@Model.Title</title> 7849 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 7850 <meta name="theme-color" content="@brandColorOne" /> 7851 string siteURL = Dynamicweb.Context.Current.Request.Url.Scheme + "://" + Dynamicweb.Context.Current.Request.Url.Host; 7852 7853 7854 if (siteURL.Contains("staging") || siteURL.Contains("local") || siteURL.Contains("ditnyewebsite")) 7855 { 7856 <meta name="robots" content="noindex, nofollow"> 7857 } 7858 7859 else 7860 { 7861 <meta name="robots" content="index, follow"> 7862 7863 } 7864 7865 if (!Model.MetaTags.Contains("og:image")) 7866 { 7867 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"))); 7868 } 7869 7870 if (!Model.MetaTags.Contains("og:description")) 7871 { 7872 Pageview.Meta.AddTag("og:description", Model.Description); 7873 } 7874 7875 Pageview.Meta.AddTag("og:title", Model.Title); 7876 Pageview.Meta.AddTag("og:site_name", Model.Name); 7877 Pageview.Meta.AddTag("og:url", HttpContext.Current.Request.Url.ToString()); 7878 Pageview.Meta.AddTag("og:type", "Website"); 7879 Pageview.Meta.AddTag("fb:page_id", Model.ID.ToString()); 7880 7881 @Model.MetaTags 7882 } 7883 7884 @helper RenderMasterCss() 7885 { 7886 var fonts = new string[] { 7887 getFontFamily("Layout", "HeaderFont"), 7888 getFontFamily("Layout", "SubheaderFont"), 7889 getFontFamily("Layout", "TertiaryHeaderFont"), 7890 getFontFamily("Layout", "BodyText"), 7891 getFontFamily("Layout", "Header", "ToolsFont"), 7892 getFontFamily("Layout", "Header", "NavigationFont"), 7893 getFontFamily("Layout", "MobileNavigation", "Font"), 7894 getFontFamily("ProductList", "Facets", "HeaderFont"), 7895 getFontFamily("ProductPage", "PriceFontDesign"), 7896 getFontFamily("Ecommerce", "SaleSticker", "Font"), 7897 getFontFamily("Ecommerce", "NewSticker", "Font"), 7898 getFontFamily("Ecommerce", "CustomSticker", "Font") 7899 }; 7900 7901 string autoCssLink = "/Files/Templates/Designs/Rapido/css/rapido/rapido_" + Model.Area.ID.ToString() + ".min.css?ticks=" + Model.Area.UpdatedDate.Ticks; 7902 string favicon = Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon").Path : "/Files/Images/favicon.png"; 7903 bool useFontAwesomePro = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetBoolean("UseFontAwesomePro"); 7904 string fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomeFree/css/fontawesome-all.min.css"; 7905 7906 //Used for changing the primary stylesheet for dermalogica, janeiredale and advancednutrion 7907 var websiteName = Pageview.Area.Name; 7908 7909 if (useFontAwesomePro) 7910 { 7911 fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomePro/css/fontawesome-all.min.css"; 7912 } 7913 7914 var userAgent = HttpContext.Current.Request.UserAgent.ToString(); 7915 7916 7917 7918 //Favicon 7919 <link href="@favicon" rel="icon" type="image/png"> 7920 7921 if (userAgent.Contains("Firefox") || userAgent.Contains("Trident")) 7922 { 7923 7924 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/base/base.min.css" type="text/css"> 7925 <link rel="stylesheet" href="@autoCssLink" type="text/css"> 7926 7927 } 7928 7929 else 7930 { 7931 //Base (Default, wireframe) styles 7932 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/base/base.min.css" type="text/css"> 7933 7934 //Rapido Css from Website Settings 7935 <link href="@autoCssLink" id="rapidoCss" type="text/css" rel="preload" onload="this.onload=null;this.rel='stylesheet'" as="style"> 7936 <noscript><link rel="stylesheet" href="@autoCssLink"></noscript> 7937 } 7938 7939 7940 7941 //Custom styles for Dermalogica and Kosmetoglognet 7942 if (websiteName == "Dermalogica") 7943 { 7944 //Ignite Css (Custom site specific styles) 7945 7946 if (userAgent.Contains("Firefox") || userAgent.Contains("Trident")) 7947 { 7948 7949 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/igniteDermalogica/igniteDermalogica.min.css" type="text/css"> 7950 7951 } 7952 7953 else 7954 { 7955 7956 <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"> 7957 <noscript><link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/ignite/igniteDermalogica.min.css"></noscript> 7958 <link rel="preload" href="/Files/Templates/Designs/Rapido/fonts/dermalogica/HelveticaNeueBold.woff" as="font" type="font/woff" onload="this.onload=null;this.rel='font'"> 7959 <link rel="preload" href="/Files/Templates/Designs/Rapido/fonts/dermalogica/HelveticaNeueRegular.woff" as="font" type="font/woff" onload="this.onload=null;this.rel='font'"> 7960 <link rel="preload" href="/Files/Templates/Designs/Rapido/fonts/dermalogica/HelveticaNeueRegular.woff2" as="font" type="font/woff2" onload="this.onload=null;this.rel='font'"> 7961 <link rel="preload" href="/Files/Templates/Designs/Rapido/fonts/dermalogica/HelveticaNeueBold.woff2" as="font" type="font/woff2" onload="this.onload=null;this.rel='font'"> 7962 7963 } 7964 7965 } 7966 7967 //Custom styles for Kosemetoglognet 7968 if (websiteName == "Janeiredale") 7969 { 7970 if (userAgent.Contains("Firefox") || userAgent.Contains("Trident")) 7971 { 7972 7973 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/igniteJaneiredale/igniteJaneiredale.min.css" type="text/css"> 7974 7975 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))); 7976 7977 <link href="https://fonts.googleapis.com/css?family=@family&display=swap" rel="stylesheet" type="text/css"> 7978 7979 } 7980 7981 else 7982 { 7983 //Ignite Css (Custom site specific styles) 7984 <link id="igniteCss" type="text/css" href="/Files/Templates/Designs/Rapido/css/igniteJaneiredale/igniteJaneiredale.min.css" rel="preload" onload="this.rel = 'stylesheet'" as="style"> 7985 7986 //Google fonts 7987 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))); 7988 <link href="https://fonts.googleapis.com/css?family=@family&display=swap" rel="preload" onload="this.rel = 'stylesheet'" as="style"> 7989 } 7990 7991 7992 } 7993 7994 //Custom styles for Janeiredale 7995 if (websiteName == "Kosmetoglognet" || websiteName == "Kosmetolognet") 7996 { 7997 //Ignite Css (Custom site specific styles) 7998 <link id="igniteCss" type="text/css" href="/Files/Templates/Designs/Rapido/css/igniteKosmetoglognet/igniteKosmetoglognet.min.css" rel="preload" onload="this.rel = 'stylesheet'" as="style"> 7999 8000 //Google fonts 8001 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))); 8002 <link href="https://fonts.googleapis.com/css?family=@family&display=swap" rel="preload" onload="this.rel = 'stylesheet'" as="style"> 8003 } 8004 8005 //Custom styles for Janeiredale 8006 if (websiteName == "Advanced Nutrition Programme") 8007 { 8008 //Ignite Css (Custom site specific styles) 8009 <link id="igniteCss" type="text/css" href="/Files/Templates/Designs/Rapido/css/igniteAdvancedNutritionProgramme/igniteAdvancedNutritionProgramme.min.css" rel="preload" onload="this.rel = 'stylesheet'" as="style"> 8010 } 8011 8012 @*if (websiteName == "AdvancedNutrition") 8013 { 8014 //Ignite Css (Custom site specific styles) 8015 <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"> 8016 }*@ 8017 8018 8019 if (userAgent.Contains("Firefox") || userAgent.Contains("Trident")) 8020 { 8021 8022 <link rel="stylesheet" href="@fontAwesomeCssLink" type="text/css"> 8023 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css" type="text/css"> 8024 8025 } 8026 8027 8028 else 8029 { 8030 //Font awesome 8031 <link href="@fontAwesomeCssLink" type="text/css" rel="preload" onload="this.onload=null;this.rel='stylesheet'" as="style"> 8032 <noscript><link rel="stylesheet" href="@fontAwesomeCssLink"></noscript> 8033 8034 //Flag icon 8035 <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"> 8036 <noscript><link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css"></noscript> 8037 } 8038 8039 8040 8041 8042 @*//Google fonts 8043 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))); 8044 <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=@family&display=swap">*@ 8045 8046 8047 <script src="https://cdnjs.cloudflare.com/ajax/libs/loadCSS/2.1.0/cssrelpreload.min.js" defer></script> 8048 8049 8050 8051 8052 PushPromise(favicon); 8053 PushPromise(fontAwesomeCssLink); 8054 PushPromise("/Files/Templates/Designs/Rapido/css/base/base.min.css"); 8055 PushPromise(autoCssLink); 8056 PushPromise("/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css"); 8057 PushPromise("/Files/Images/placeholder.gif"); 8058 PushPromise("/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css"); 8059 } 8060 8061 @helper RenderMasterManifest() 8062 { 8063 if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName"))) 8064 { 8065 <link rel="manifest" href="/Files/Templates/Designs/Rapido/manifest.json"> 8066 PushPromise("/Files/Templates/Designs/Rapido/manifest.json"); 8067 } 8068 } 8069 8070 @helper RenderMasterBody() 8071 { 8072 List<Block> subBlocks = this.masterPage.GetBlockListById("Body").OrderBy(item => item.SortId).ToList(); 8073 string designLayout = Model.PropertyItem.GetItem("CustomSettings") != null ? Model.PropertyItem.GetItem("CustomSettings").GetString("DesignLayout") != null ? Model.PropertyItem.GetItem("CustomSettings").GetList("DesignLayout").SelectedValue : "" : ""; 8074 if (!String.IsNullOrEmpty(designLayout)) 8075 { 8076 designLayout = "class=\"" + designLayout + "\""; 8077 } 8078 8079 <body @designLayout> 8080 @RenderBlockList(subBlocks) 8081 </body> 8082 8083 } 8084 8085 @helper RenderMasterHeader() 8086 { 8087 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterHeader").OrderBy(item => item.SortId).ToList(); 8088 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 8089 string stickyTop = isNavigationStickyMenu ? "top-container--sticky" : ""; 8090 8091 <header class="top-container @stickyTop dw-mod" id="Top"> 8092 @RenderBlockList(subBlocks) 8093 </header> 8094 } 8095 8096 @helper RenderMain() 8097 { 8098 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMain").OrderBy(item => item.SortId).ToList(); 8099 8100 <main class="site dw-mod"> 8101 @RenderBlockList(subBlocks) 8102 </main> 8103 } 8104 8105 @helper RenderPageContent() 8106 { 8107 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 8108 string pagePos = isNavigationStickyMenu ? "js-page-pos" : ""; 8109 8110 <div id="Page" class="page @pagePos"> 8111 <section class="center-container content-container dw-mod" id="content"> 8112 8113 @RenderSnippet("Content") 8114 </section> 8115 </div> 8116 } 8117 8118 @* Hack to support nested helpers *@ 8119 @SnippetStart("Content") 8120 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 8121 8122 8123 @using Dynamicweb.Rapido.Blocks.Components 8124 @using Dynamicweb.Rapido.Blocks.Components.Articles 8125 @using Dynamicweb.Rapido.Blocks.Components.General 8126 @using Dynamicweb.Rapido.Blocks 8127 8128 @functions { 8129 BlocksPage articlePage = BlocksPage.GetBlockPage("NewsArticle"); 8130 } 8131 8132 @{ 8133 string image = !String.IsNullOrEmpty(Model.Item.GetString("Image")) ? Model.Item.GetFile("Image").PathUrlEncoded : ""; 8134 8135 ArticleHeader topBanner = new ArticleHeader 8136 { 8137 Layout = ArticleHeaderLayout.Clean, 8138 Image = new Image { Path = image }, 8139 Heading = Model.Item.GetString("Title"), 8140 Subheading = Model.Item.GetString("Summary"), 8141 TextColor = "#fff", 8142 Category = Model.Item.GetString("Author"), 8143 Date = Model.Item.GetString("Date"), 8144 ButtonLayout = ButtonLayout.Primary, 8145 TextLayout = ArticleHeaderTextLayout.Full 8146 }; 8147 8148 ButtonLayout buttonDesign; 8149 Enum.TryParse<ButtonLayout>(Model.Item.GetString("ButtonDesign"), out buttonDesign); 8150 if (buttonDesign == ButtonLayout.None) 8151 { 8152 buttonDesign = ButtonLayout.Primary; 8153 } 8154 8155 Block articleContainer = new Block 8156 { 8157 Id = "ArticleContainer", 8158 SortId = 10, 8159 Design = new Design 8160 { 8161 RenderType = RenderType.Row 8162 }, 8163 BlocksList = new List<Block> { 8164 new Block { 8165 Id = "ArticleBody", 8166 SortId = 20, 8167 Design = new Design { 8168 RenderType = RenderType.Column, 8169 Size = "8" 8170 }, 8171 BlocksList = new List<Block> { 8172 new Block { 8173 Id = "ArticleBodyRow", 8174 SortId = 10, 8175 Design = new Design { 8176 RenderType = RenderType.Row 8177 }, 8178 BlocksList = new List<Block> { 8179 new Block { 8180 Id = "ArticleHeader", 8181 SortId = 10, 8182 Component = topBanner, 8183 Design = new Design { 8184 RenderType = RenderType.Column, 8185 Size = "12", 8186 HidePadding = true, 8187 CssClass = "article-head" 8188 } 8189 }, 8190 new Block { 8191 Id = "ArticleText", 8192 SortId = 20, 8193 Component = new ArticleText { Text = Model.Item.GetString("Text") }, 8194 Design = new Design { 8195 RenderType = RenderType.Column, 8196 Size = "12", 8197 CssClass = "u-padding--lg" 8198 } 8199 }, 8200 new Block { 8201 Id = "ArticleLink", 8202 SortId = 30, 8203 Component = new ArticleLink { Href = Model.Item.GetString("Link"), Title = Model.Item.GetString("LinkText"), ButtonLayout = buttonDesign }, 8204 Design = new Design { 8205 RenderType = RenderType.Column, 8206 Size = "12", 8207 CssClass = "u-padding--lg u-ta-right" 8208 } 8209 } 8210 } 8211 } 8212 } 8213 } 8214 } 8215 }; 8216 8217 articlePage.Add(articleContainer); 8218 8219 if (Model.PropertyItem.GetList("ShowBreadcrumb").SelectedValue == "True") 8220 { 8221 Block breadcrumb = new Block 8222 { 8223 Id = "ArticleBreadcrumb", 8224 SortId = 10, 8225 Component = new BreadcrumbNavigation { }, 8226 Design = new Design 8227 { 8228 RenderType = RenderType.Column, 8229 Size = "12" 8230 } 8231 }; 8232 articlePage.Add("ArticleContainer", breadcrumb); 8233 } 8234 } 8235 8236 8237 @using System 8238 @using System.Web 8239 @using System.Collections.Generic 8240 @using Dynamicweb.Rapido.Blocks 8241 8242 @{ 8243 BlocksPage newsArticleCustomBlocksPage = BlocksPage.GetBlockPage("NewsArticle"); 8244 8245 } 8246 8247 8248 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 8249 @RenderBlockList(articlePage.BlocksRoot.BlocksList) 8250 8251 @SnippetEnd("Content") 8252 8253 </html> 8254 8255