Error executing template "Designs/Rapido/_parsed/DynamicArticle.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_a2fd207e91914e4eb35b6602f9fc748c.Execute() in N:\DynamicWeb\XylonDWProd\Solutions\rapido342\Files\Templates\Designs\Rapido\_parsed\DynamicArticle.parsed.cshtml:line 8501
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

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