Error executing template "Designs/AgricoverCorporate/_parsed/VideoEveniment.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_73a62a35596c4f62aec4f0c053702eab.Execute() in C:\inetpub\wwwroot\dev.magazin.agricover.ro\Files\Templates\Designs\AgricoverCorporate\_parsed\VideoEveniment.parsed.cshtml:line 9626
   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 Block root = new Block 42 { 43 Id = "Root", 44 SortId = 10, 45 BlocksList = new List<Block> 46 { 47 new Block { 48 Id = "Head", 49 SortId = 10, 50 SkipRenderBlocksList = true, 51 Template = RenderMasterHead(), 52 BlocksList = new List<Block> 53 { 54 new Block { 55 Id = "HeadMetadata", 56 SortId = 10, 57 Template = RenderMasterMetadata(), 58 }, 59 new Block { 60 Id = "HeadCss", 61 SortId = 20, 62 Template = RenderMasterCss(), 63 }, 64 new Block { 65 Id = "HeadManifest", 66 SortId = 30, 67 Template = RenderMasterManifest(), 68 } 69 } 70 }, 71 new Block { 72 Id = "Body", 73 SortId = 20, 74 SkipRenderBlocksList = true, 75 Template = RenderMasterBody(), 76 BlocksList = new List<Block> 77 { 78 new Block() 79 { 80 Id = "Master", 81 SortId = 10, 82 BlocksList = new List<Block> { 83 new Block { 84 Id = "MasterTopSnippets", 85 SortId = 10 86 }, 87 new Block { 88 Id = "MasterMain", 89 SortId = 20, 90 Template = RenderMain(), 91 SkipRenderBlocksList = true, 92 BlocksList = new List<Block> { 93 new Block { 94 Id = "MasterHeader", 95 SortId = 10, 96 Template = RenderMasterHeader(), 97 SkipRenderBlocksList = true 98 }, 99 new Block { 100 Id = "MasterPageContent", 101 SortId = 20, 102 Template = RenderPageContent() 103 } 104 } 105 }, 106 new Block { 107 Id = "MasterFooter", 108 SortId = 30 109 }, 110 new Block { 111 Id = "MasterReferences", 112 SortId = 40 113 }, 114 new Block { 115 Id = "MasterBottomSnippets", 116 SortId = 50, 117 BlocksList = new List<Block> { 118 new Block { 119 Id = "iOsTabletFix", 120 SortId = 10, 121 Template = RenderIosTabletFix() 122 } 123 } 124 } 125 } 126 } 127 } 128 } 129 } 130 }; 131 132 masterPage.Add(root); 133 } 134 @* Include the required Grid builder (Contains the methods @RenderBlockList and @RenderBlock) *@ 135 @using System.Text.RegularExpressions 136 @using System.Collections.Generic 137 @using System.Reflection 138 @using System.Web 139 @using System.Web.UI.HtmlControls 140 @using Dynamicweb.Rapido.Blocks.Components 141 @using Dynamicweb.Rapido.Blocks.Components.Articles 142 @using Dynamicweb.Rapido.Blocks.Components.Documentation 143 @using Dynamicweb.Rapido.Blocks 144 145 146 @*--- START: Base block renderers ---*@ 147 148 @helper RenderBlockList(List<Block> blocks) 149 { 150 bool debug = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("debug")) ? Convert.ToBoolean(HttpContext.Current.Request.QueryString.Get("debug")) : false; 151 blocks = blocks.OrderBy(item => item.SortId).ToList(); 152 153 foreach (Block item in blocks) 154 { 155 if (debug) { 156 <!-- Block START: @item.Id --> 157 } 158 159 if (item.Design == null) 160 { 161 @RenderBlock(item) 162 } 163 else if (item.Design.RenderType == RenderType.None) { 164 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : ""; 165 166 <div class="@cssClass dw-mod"> 167 @RenderBlock(item) 168 </div> 169 } 170 else if (item.Design.RenderType != RenderType.Hide) 171 { 172 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : ""; 173 174 if (!item.SkipRenderBlocksList) { 175 if (item.Design.RenderType == RenderType.Row) 176 { 177 <div class="grid grid--align-content-start @cssClass dw-mod" id="Block__@item.Id"> 178 @RenderBlock(item) 179 </div> 180 } 181 182 if (item.Design.RenderType == RenderType.Column) 183 { 184 string hidePadding = item.Design.HidePadding ? "u-no-padding" : ""; 185 string size = item.Design.Size ?? "12"; 186 size = Regex.IsMatch(size, @"\d") ? "md-" + item.Design.Size : item.Design.Size; 187 188 <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"> 189 @RenderBlock(item) 190 </div> 191 } 192 193 if (item.Design.RenderType == RenderType.Table) 194 { 195 <table class="table @cssClass dw-mod" id="Block__@item.Id"> 196 @RenderBlock(item) 197 </table> 198 } 199 200 if (item.Design.RenderType == RenderType.TableRow) 201 { 202 <tr class="@cssClass dw-mod" id="Block__@item.Id"> 203 @RenderBlock(item) 204 </tr> 205 } 206 207 if (item.Design.RenderType == RenderType.TableColumn) 208 { 209 <td class="@cssClass dw-mod" id="Block__@item.Id"> 210 @RenderBlock(item) 211 </td> 212 } 213 214 if (item.Design.RenderType == RenderType.CardHeader) 215 { 216 <div class="card-header @cssClass dw-mod"> 217 @RenderBlock(item) 218 </div> 219 } 220 221 if (item.Design.RenderType == RenderType.CardBody) 222 { 223 <div class="card @cssClass dw-mod"> 224 @RenderBlock(item) 225 </div> 226 } 227 228 if (item.Design.RenderType == RenderType.CardFooter) 229 { 230 <div class="card-footer @cssClass dw-mod"> 231 @RenderBlock(item) 232 </div> 233 } 234 } 235 else 236 { 237 @RenderBlock(item) 238 } 239 } 240 241 if (debug) { 242 <!-- Block END: @item.Id --> 243 } 244 } 245 } 246 247 @helper RenderBlock(Block item) 248 { 249 bool debug = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("debug")) ? Convert.ToBoolean(HttpContext.Current.Request.QueryString.Get("debug")) : false; 250 251 if (item.Template != null) 252 { 253 @BlocksPage.RenderTemplate(item.Template) 254 } 255 256 if (item.Component != null) 257 { 258 string customSufix = "Custom"; 259 string methodName = item.Component.HelperName; 260 261 ComponentBase[] methodParameters = new ComponentBase[1]; 262 methodParameters[0] = item.Component; 263 Type methodType = this.GetType(); 264 265 MethodInfo customMethod = methodType.GetMethod(methodName + customSufix); 266 MethodInfo generalMethod = methodType.GetMethod(methodName); 267 268 try { 269 if (debug) { 270 <!-- Component: @methodName.Replace("Render", "") --> 271 } 272 @customMethod.Invoke(this, methodParameters).ToString(); 273 } catch { 274 try { 275 @generalMethod.Invoke(this, methodParameters).ToString(); 276 } catch(Exception ex) { 277 throw new Exception(item.Component.GetType().Name + " method '" + methodName +"' could not be invoked", ex); 278 } 279 } 280 } 281 282 if (item.BlocksList.Count > 0 && !item.SkipRenderBlocksList) 283 { 284 @RenderBlockList(item.BlocksList) 285 } 286 } 287 288 @*--- END: Base block renderers ---*@ 289 290 291 @* Include the components *@ 292 @using Dynamicweb.Rapido.Blocks.Components 293 @using Dynamicweb.Rapido.Blocks.Components.General 294 @using Dynamicweb.Rapido.Blocks 295 @using System.IO 296 297 @* Required *@ 298 @using Dynamicweb.Rapido.Blocks.Components 299 @using Dynamicweb.Rapido.Blocks.Components.General 300 @using Dynamicweb.Rapido.Blocks 301 302 303 @helper Render(ComponentBase component) 304 { 305 if (component != null) 306 { 307 @component.Render(this) 308 } 309 } 310 311 @* Components *@ 312 @using System.Reflection 313 @using Dynamicweb.Rapido.Blocks.Components.General 314 315 316 @* Component *@ 317 318 @helper RenderIcon(Icon settings) 319 { 320 if (settings != null) 321 { 322 string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : ""; 323 324 if (settings.Name != null) 325 { 326 if (string.IsNullOrEmpty(settings.Label)) 327 { 328 <i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i> 329 } 330 else 331 { 332 if (settings.LabelPosition == IconLabelPosition.Before) 333 { 334 <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> 335 } 336 else 337 { 338 <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> 339 } 340 } 341 } 342 else if (!string.IsNullOrEmpty(settings.Label)) 343 { 344 @settings.Label 345 } 346 } 347 } 348 @using System.Reflection 349 @using Dynamicweb.Rapido.Blocks.Components.General 350 @using Dynamicweb.Rapido.Blocks.Components 351 @using Dynamicweb.Core 352 353 @* Component *@ 354 355 @helper RenderButton(Button settings) 356 { 357 if (settings != null && (!string.IsNullOrEmpty(settings.Title) || settings.Icon != null)) 358 { 359 Dictionary<string, string> attributes = new Dictionary<string, string>(); 360 List<string> classList = settings.CssClass != null ? settings.CssClass.Split(' ').ToList() : new List<string>(); 361 if (settings.Disabled) { 362 attributes.Add("disabled", "true"); 363 classList.Add("disabled"); 364 } 365 366 if (!string.IsNullOrEmpty(settings.ConfirmText) || !string.IsNullOrEmpty(settings.ConfirmTitle)) 367 { 368 settings.Id = !string.IsNullOrEmpty(settings.Id) ? settings.Id : Guid.NewGuid().ToString("N"); 369 @RenderConfirmDialog(settings); 370 settings.OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = true"; 371 } 372 373 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 374 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 375 if (!string.IsNullOrEmpty(settings.AltText)) 376 { 377 attributes.Add("title", settings.AltText); 378 } 379 else if (!string.IsNullOrEmpty(settings.Title)) 380 { 381 string cleanTitle = Regex.Replace(settings.Title, "<.*?>", String.Empty); 382 cleanTitle = cleanTitle.Replace("&nbsp;", " "); 383 attributes.Add("title", cleanTitle); 384 } 385 386 var onClickEvents = new List<string>(); 387 if (!string.IsNullOrEmpty(settings.OnClick)) 388 { 389 onClickEvents.Add(settings.OnClick); 390 } 391 if (!string.IsNullOrEmpty(settings.Href)) 392 { 393 onClickEvents.Add("location.href='" + settings.Href + "'"); 394 } 395 if (onClickEvents.Count > 0) 396 { 397 attributes.Add("onClick", string.Join(";", onClickEvents)); 398 } 399 400 if (settings.ButtonLayout != ButtonLayout.None) 401 { 402 classList.Add("btn"); 403 string btnLayout = Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower(); 404 if (btnLayout == "linkclean") 405 { 406 btnLayout = "link-clean"; //fix 407 } 408 classList.Add("btn--" + btnLayout); 409 } 410 411 if (settings.Icon == null) 412 { 413 settings.Icon = new Icon(); 414 } 415 416 settings.Icon.CssClass += Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower() != "linkclean" ? " u-flex--align-center" : ""; 417 settings.Icon.Label = settings.Title; 418 419 attributes.Add("type", Enum.GetName(typeof(ButtonType), settings.ButtonType).ToLower()); 420 421 <button class="@string.Join(" ", classList) dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@Render(settings.Icon)</button> 422 } 423 } 424 425 @helper RenderConfirmDialog(Button settings) 426 { 427 Modal confirmDialog = new Modal { 428 Id = settings.Id, 429 Width = ModalWidth.Sm, 430 Heading = new Heading 431 { 432 Level = 2, 433 Title = settings.ConfirmTitle 434 }, 435 BodyText = settings.ConfirmText 436 }; 437 438 confirmDialog.AddAction(new Button { Title = Translate("Cancel"), ButtonLayout = ButtonLayout.Secondary, OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = false"}); 439 confirmDialog.AddAction(new Button { Title = Translate("OK"), ButtonLayout = ButtonLayout.Primary, OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = false;" + settings.OnClick }); 440 441 @Render(confirmDialog) 442 } 443 @using Dynamicweb.Rapido.Blocks.Components.General 444 @using Dynamicweb.Rapido.Blocks.Components 445 @using Dynamicweb.Core 446 447 @helper RenderDashboard(Dashboard settings) 448 { 449 var widgets = settings.GetWidgets(); 450 451 if (!string.IsNullOrEmpty(settings.WidgetsBaseBackgroundColor)) 452 { 453 //set bg color for them 454 455 System.Drawing.Color color = System.Drawing.ColorTranslator.FromHtml(settings.WidgetsBaseBackgroundColor); 456 int r = Convert.ToInt16(color.R); 457 int g = Convert.ToInt16(color.G); 458 int b = Convert.ToInt16(color.B); 459 460 var count = widgets.Length; 461 var max = Math.Max(r, Math.Max(g, b)); 462 double step = 255.0 / (max * count); 463 var i = 0; 464 foreach (var widget in widgets) 465 { 466 i++; 467 468 var shade = "rgb(" + Converter.ToString(r * step * i).Replace(",", ".") + ", " + Converter.ToString(g * step * i).Replace(",", ".") + ", " + Converter.ToString(b * step * i).Replace(",", ".") + ")"; 469 widget.BackgroundColor = shade; 470 } 471 } 472 473 <div class="dashboard @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 474 @foreach (var widget in widgets) 475 { 476 <div class="dashboard__widget"> 477 @Render(widget) 478 </div> 479 } 480 </div> 481 } 482 @using Dynamicweb.Rapido.Blocks.Components.General 483 @using Dynamicweb.Rapido.Blocks.Components 484 485 @helper RenderDashboardWidgetLink(DashboardWidgetLink settings) 486 { 487 if (!string.IsNullOrEmpty(settings.Link)) 488 { 489 var backgroundStyles = ""; 490 if (!string.IsNullOrEmpty(settings.BackgroundColor)) 491 { 492 backgroundStyles = "style=\"background-color:" + settings.BackgroundColor + "\""; 493 } 494 495 <a href="@settings.Link" class="widget widget--link @settings.CssClass dw-mod" @backgroundStyles title="@settings.Title" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 496 <div class="u-center-middle u-color-light"> 497 @if (settings.Icon != null) 498 { 499 settings.Icon.CssClass += "widget__icon"; 500 @Render(settings.Icon) 501 } 502 <div class="widget__title">@settings.Title</div> 503 </div> 504 </a> 505 } 506 } 507 @using Dynamicweb.Rapido.Blocks.Components.General 508 @using Dynamicweb.Rapido.Blocks.Components 509 510 @helper RenderDashboardWidgetCounter(DashboardWidgetCounter settings) 511 { 512 var backgroundStyles = ""; 513 if (!string.IsNullOrEmpty(settings.BackgroundColor)) 514 { 515 backgroundStyles = "style='background-color:" + settings.BackgroundColor + "'"; 516 } 517 518 <div class="widget @settings.CssClass dw-mod" @backgroundStyles @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 519 <div class="u-center-middle u-color-light"> 520 @if (settings.Icon != null) 521 { 522 settings.Icon.CssClass += "widget__icon"; 523 @Render(settings.Icon) 524 } 525 <div class="widget__counter">@settings.Count</div> 526 <div class="widget__title">@settings.Title</div> 527 </div> 528 </div> 529 } 530 @using System.Reflection 531 @using Dynamicweb.Rapido.Blocks.Components.General 532 @using Dynamicweb.Rapido.Blocks.Components 533 @using Dynamicweb.Core 534 535 @* Component *@ 536 537 @helper RenderLink(Link settings) 538 { 539 if (settings != null && !string.IsNullOrEmpty(settings.Href) && (!string.IsNullOrEmpty(settings.Title) || settings.Icon != null)) 540 { 541 Dictionary<string, string> attributes = new Dictionary<string, string>(); 542 List<string> classList = settings.CssClass != null ? settings.CssClass.Split(' ').ToList() : new List<string>(); 543 if (settings.Disabled) 544 { 545 attributes.Add("disabled", "true"); 546 classList.Add("disabled"); 547 } 548 549 if (!string.IsNullOrEmpty(settings.AltText)) 550 { 551 attributes.Add("title", settings.AltText); 552 } 553 else if (!string.IsNullOrEmpty(settings.Title)) 554 { 555 attributes.Add("title", settings.Title); 556 } 557 558 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 559 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 560 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onClick", settings.OnClick); } 561 attributes.Add("href", settings.Href); 562 563 if (settings.ButtonLayout != ButtonLayout.None) 564 { 565 classList.Add("btn"); 566 string btnLayout = Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower(); 567 if (btnLayout == "linkclean") 568 { 569 btnLayout = "link-clean"; //fix 570 } 571 classList.Add("btn--" + btnLayout); 572 } 573 574 if (settings.Icon == null) 575 { 576 settings.Icon = new Icon(); 577 } 578 settings.Icon.Label = settings.Title; 579 580 if (settings.Target == LinkTargetType.Blank && settings.Rel == LinkRelType.None) 581 { 582 settings.Rel = LinkRelType.Noopener; 583 } 584 if (settings.Target != LinkTargetType.None) 585 { 586 attributes.Add("target", "_" + Enum.GetName(typeof(LinkTargetType), settings.Target).ToLower()); 587 } 588 if (settings.Download) 589 { 590 attributes.Add("download", "true"); 591 } 592 if (settings.Rel != LinkRelType.None) 593 { 594 attributes.Add("rel", Enum.GetName(typeof(LinkRelType), settings.Rel).ToLower()); 595 } 596 597 <a class="@string.Join(" ", classList) dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@Render(settings.Icon)</a> 598 } 599 } 600 @using System.Reflection 601 @using Dynamicweb.Rapido.Blocks.Components 602 @using Dynamicweb.Rapido.Blocks.Components.General 603 @using Dynamicweb.Rapido.Blocks 604 605 606 @* Component *@ 607 608 @helper RenderRating(Rating settings) 609 { 610 if (settings.Score > 0) 611 { 612 int rating = settings.Score; 613 string iconType = "fa-star"; 614 615 switch (settings.Type.ToString()) { 616 case "Stars": 617 iconType = "fa-star"; 618 break; 619 case "Hearts": 620 iconType = "fa-heart"; 621 break; 622 case "Lemons": 623 iconType = "fa-lemon"; 624 break; 625 case "Bombs": 626 iconType = "fa-bomb"; 627 break; 628 } 629 630 <div class="u-ta-right"> 631 @for (int i = 0; i < settings.OutOf; i++) 632 { 633 <i class="@(rating > i ? "fas" : "far") @iconType"></i> 634 } 635 </div> 636 } 637 } 638 @using System.Reflection 639 @using Dynamicweb.Rapido.Blocks.Components.General 640 @using Dynamicweb.Rapido.Blocks.Components 641 642 643 @* Component *@ 644 645 @helper RenderSelectFieldOption(SelectFieldOption settings) 646 { 647 Dictionary<string, string> attributes = new Dictionary<string, string>(); 648 if (settings.Checked) { attributes.Add("selected", "true"); } 649 if (settings.Disabled) { attributes.Add("disabled", "true"); } 650 if (settings.Value != null) { attributes.Add("value", settings.Value); } 651 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 652 653 <option @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Label</option> 654 } 655 @using System.Reflection 656 @using Dynamicweb.Rapido.Blocks.Components.General 657 @using Dynamicweb.Rapido.Blocks.Components 658 659 660 @* Component *@ 661 662 @helper RenderNavigation(Navigation settings) { 663 @RenderNavigation(new 664 { 665 id = settings.Id, 666 cssclass = settings.CssClass, 667 startLevel = settings.StartLevel, 668 endlevel = settings.EndLevel, 669 expandmode = settings.Expandmode, 670 sitemapmode = settings.SitemapMode, 671 template = settings.Template 672 }) 673 } 674 @using Dynamicweb.Rapido.Blocks.Components.General 675 @using Dynamicweb.Rapido.Blocks.Components 676 677 678 @* Component *@ 679 680 @helper RenderBreadcrumbNavigation(BreadcrumbNavigation settings) { 681 settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id; 682 settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template; 683 settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel; 684 settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel; 685 settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode; 686 settings.SitemapMode = false; 687 688 @RenderNavigation(settings) 689 } 690 @using Dynamicweb.Rapido.Blocks.Components.General 691 @using Dynamicweb.Rapido.Blocks.Components 692 693 694 @* Component *@ 695 696 @helper RenderLeftNavigation(LeftNavigation settings) { 697 settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id; 698 settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template; 699 settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel; 700 settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel; 701 settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode; 702 703 <div class="grid__cell"> 704 @RenderNavigation(settings) 705 </div> 706 } 707 @using System.Reflection 708 @using Dynamicweb.Rapido.Blocks.Components.General 709 @using Dynamicweb.Core 710 711 @* Component *@ 712 713 @helper RenderHeading(Heading settings) 714 { 715 if (settings != null && !string.IsNullOrEmpty(settings.Title)) 716 { 717 string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : ""; 718 string tagName = settings.Level != 0 ? "h" + settings.Level.ToString() : "div"; 719 720 @("<" + tagName + " class=\"" + settings.CssClass + " dw-mod\" " + color + ">") 721 if (!string.IsNullOrEmpty(settings.Link)) 722 { 723 @Render(new Link { Href = settings.Link, Icon = settings.Icon, Title = settings.Title, ButtonLayout = ButtonLayout.None }) 724 } 725 else 726 { 727 if (settings.Icon == null) 728 { 729 settings.Icon = new Icon(); 730 } 731 settings.Icon.Label = settings.Title; 732 @Render(settings.Icon) 733 } 734 @("</" + tagName + ">"); 735 } 736 } 737 @using Dynamicweb.Rapido.Blocks.Components 738 @using Dynamicweb.Rapido.Blocks.Components.General 739 @using Dynamicweb.Rapido.Blocks 740 741 742 @* Component *@ 743 744 @helper RenderImage(Image settings) 745 { 746 if (settings.FilterPrimary != ImageFilter.None || settings.FilterSecondary != ImageFilter.None) 747 { 748 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>(); 749 if (!string.IsNullOrEmpty(settings.FilterColor)) { optionalAttributes.Add("style", "background-color: " + settings.FilterColor); } 750 751 if (settings.Caption != null) 752 { 753 @:<div> 754 } 755 756 var primaryFilterClass = settings.FilterPrimary.ToString().ToLower(); 757 var secondaryFilterClass = settings.FilterSecondary.ToString().ToLower(); 758 759 <div class="image-filter image-filter--@primaryFilterClass u-position-relative dw-mod" @ComponentMethods.AddAttributes(optionalAttributes)> 760 <div class="image-filter image-filter--@secondaryFilterClass dw-mod"> 761 @if (settings.Link != null) 762 { 763 <a href="@settings.Link"> 764 @RenderTheImage(settings) 765 </a> 766 } 767 else 768 { 769 @RenderTheImage(settings) 770 } 771 </div> 772 </div> 773 774 if (settings.Caption != null) 775 { 776 <span class="image-caption dw-mod">@settings.Caption</span> 777 @:</div> 778 } 779 } 780 else 781 { 782 if (settings.Caption != null) 783 { 784 @:<div> 785 } 786 if (!string.IsNullOrEmpty(settings.Link)) 787 { 788 <a href="@settings.Link"> 789 @RenderTheImage(settings) 790 </a> 791 } 792 else 793 { 794 @RenderTheImage(settings) 795 } 796 797 if (settings.Caption != null) 798 { 799 <span class="image-caption dw-mod">@settings.Caption</span> 800 @:</div> 801 } 802 } 803 } 804 805 @helper RenderTheImage(Image settings) 806 { 807 if (settings != null) 808 { 809 string alternativeImage = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("AlternativeImage")) ? Pageview.AreaSettings.GetItem("Settings").GetFile("AlternativeImage").PathUrlEncoded : "/Images/missing_image.jpg"; 810 string placeholderImage = "/Files/Images/placeholder.gif"; 811 string imageEngine = "/Admin/Public/GetImage.ashx?"; 812 813 string imageStyle = ""; 814 815 switch (settings.Style) 816 { 817 case ImageStyle.Ball: 818 imageStyle = "grid__cell-img--ball"; 819 break; 820 821 case ImageStyle.Triangle: 822 imageStyle = "grid__cell-img--triangle"; 823 break; 824 } 825 826 if (settings.Style == ImageStyle.Ball || settings.Style == ImageStyle.Circle || settings.Style == ImageStyle.Triangle) 827 { 828 settings.ImageDefault.Crop = settings.ImageDefault.Crop == 5 ? settings.ImageDefault.Crop = 0 : settings.ImageDefault.Crop; 829 830 if (settings.ImageDefault != null) 831 { 832 settings.ImageDefault.Height = settings.ImageDefault.Width; 833 } 834 if (settings.ImageMedium != null) 835 { 836 settings.ImageMedium.Height = settings.ImageMedium.Width; 837 } 838 if (settings.ImageSmall != null) 839 { 840 settings.ImageSmall.Height = settings.ImageSmall.Width; 841 } 842 } 843 844 string defaultImage = imageEngine; 845 string imageSmall = ""; 846 string imageMedium = ""; 847 848 if (settings.DisableImageEngine) 849 { 850 defaultImage = settings.Path; 851 } 852 else 853 { 854 if (settings.ImageDefault != null) 855 { 856 defaultImage += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageDefault); 857 858 if (settings.Path.GetType() != typeof(string)) 859 { 860 defaultImage += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 861 defaultImage += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 862 } 863 else 864 { 865 defaultImage += settings.Path != null ? "Image=" + settings.Path : ""; 866 } 867 868 defaultImage += "&AlternativeImage=" + alternativeImage; 869 } 870 871 if (settings.ImageSmall != null) 872 { 873 imageSmall = "data-src-small=\"" + imageEngine; 874 imageSmall += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageSmall); 875 876 if (settings.Path.GetType() != typeof(string)) 877 { 878 imageSmall += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 879 imageSmall += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 880 } 881 else 882 { 883 imageSmall += settings.Path != null ? "Image=" + settings.Path : ""; 884 } 885 886 imageSmall += "&alternativeImage=" + alternativeImage; 887 888 imageSmall += "\""; 889 } 890 891 if (settings.ImageMedium != null) 892 { 893 imageMedium = "data-src-medium=\"" + imageEngine; 894 imageMedium += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageMedium); 895 896 if (settings.Path.GetType() != typeof(string)) 897 { 898 imageMedium += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 899 imageMedium += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 900 } 901 else 902 { 903 imageMedium += settings.Path != null ? "Image=" + settings.Path : ""; 904 } 905 906 imageMedium += "&alternativeImage=" + alternativeImage; 907 908 imageMedium += "\""; 909 } 910 } 911 912 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>(); 913 if (!string.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick); } 914 if (!string.IsNullOrEmpty(settings.Title)) 915 { 916 optionalAttributes.Add("alt", settings.Title); 917 optionalAttributes.Add("title", settings.Title); 918 } 919 920 if (settings.DisableLazyLoad) 921 { 922 <img id="@settings.Id" class="@imageStyle @settings.CssClass dw-mod" src="@defaultImage" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 923 } 924 else 925 { 926 <img id="@settings.Id" loading="lazy" class=" @imageStyle @settings.CssClass dw-mod" src="@defaultImage" @imageSmall @imageMedium @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 927 } 928 } 929 } 930 @using System.Reflection 931 @using Dynamicweb.Rapido.Blocks.Components.General 932 @using Dynamicweb.Rapido.Blocks.Components 933 934 @* Component *@ 935 936 @helper RenderFileField(FileField settings) 937 { 938 var attributes = new Dictionary<string, string>(); 939 if (string.IsNullOrEmpty(settings.Id)) 940 { 941 settings.Id = Guid.NewGuid().ToString("N"); 942 } 943 944 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 945 if (settings.Disabled) { attributes.Add("disabled", "true"); } 946 if (settings.Required) { attributes.Add("required", "true"); } 947 if (settings.Multiple) { attributes.Add("multiple", "true"); } 948 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 949 if (string.IsNullOrEmpty(settings.ChooseFileText)) 950 { 951 settings.ChooseFileText = Translate("Choose file"); 952 } 953 if (string.IsNullOrEmpty(settings.NoFilesChosenText)) 954 { 955 settings.NoFilesChosenText = Translate("No files chosen..."); 956 } 957 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 958 959 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; } 960 961 string setValueToFakeInput = "FileUpload.setValueToFakeInput(this)"; 962 attributes.Add("onchange", setValueToFakeInput + (!string.IsNullOrEmpty(settings.OnChange) ? settings.OnChange : "")); 963 964 attributes.Add("type", "file"); 965 if (settings.Value != null) { attributes.Add("value", settings.Value); } 966 settings.CssClass = "u-full-width " + settings.CssClass; 967 968 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 969 970 <div class="form__field-group full-width-input u-full-width @settings.WrapperCssClass dw-mod"> 971 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null ) 972 { 973 <div class="u-full-width"> 974 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } 975 @if (settings.Link != null) { 976 <div class="u-pull--right"> 977 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } 978 @Render(settings.Link) 979 </div> 980 } 981 </div> 982 983 } 984 985 @if (!string.IsNullOrEmpty(settings.HelpText)) 986 { 987 <small class="form__help-text">@settings.HelpText</small> 988 } 989 990 <div class="form__field-combi file-input u-no-margin dw-mod"> 991 <input @ComponentMethods.AddAttributes(resultAttributes) class="file-input__real-input" data-no-files-text="@settings.NoFilesChosenText" data-many-files-text="@Translate("files")" /> 992 <label for="@settings.Id" class="file-input__btn btn--secondary btn dw-mod">@settings.ChooseFileText</label> 993 <label for="@settings.Id" class="@settings.CssClass file-input__fake-input js-fake-input dw-mod">@settings.NoFilesChosenText</label> 994 @if (settings.UploadButton != null) 995 { 996 settings.UploadButton.CssClass += " btn--condensed u-no-margin"; 997 @Render(settings.UploadButton) 998 } 999 </div> 1000 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1001 </div> 1002 } 1003 @using System.Reflection 1004 @using Dynamicweb.Rapido.Blocks.Components.General 1005 @using Dynamicweb.Rapido.Blocks.Components 1006 @using Dynamicweb.Core 1007 @using System.Linq 1008 1009 @* Component *@ 1010 1011 @helper RenderDateTimeField(DateTimeField settings) 1012 { 1013 if (string.IsNullOrEmpty(settings.Id)) 1014 { 1015 settings.Id = Guid.NewGuid().ToString("N"); 1016 } 1017 1018 var textField = new TextField { 1019 Name = settings.Name, 1020 Id = settings.Id, 1021 Label = settings.Label, 1022 HelpText = settings.HelpText, 1023 Value = settings.Value, 1024 Disabled = settings.Disabled, 1025 Required = settings.Required, 1026 ErrorMessage = settings.ErrorMessage, 1027 CssClass = settings.CssClass, 1028 WrapperCssClass = settings.WrapperCssClass, 1029 OnChange = settings.OnChange, 1030 OnClick = settings.OnClick, 1031 Link = settings.Link, 1032 ExtraAttributes = settings.ExtraAttributes, 1033 // 1034 Placeholder = settings.Placeholder 1035 }; 1036 1037 @Render(textField) 1038 1039 List<string> jsAttributes = new List<string>(); 1040 1041 jsAttributes.Add("mode: '" + Enum.GetName(typeof(DateTimeFieldMode), settings.Mode).ToLower() + "'"); 1042 1043 if (!string.IsNullOrEmpty(settings.DateFormat)) 1044 { 1045 jsAttributes.Add("dateFormat: '" + settings.DateFormat + "'"); 1046 } 1047 if (!string.IsNullOrEmpty(settings.MinDate)) 1048 { 1049 jsAttributes.Add("minDate: '" + settings.MinDate + "'"); 1050 } 1051 if (!string.IsNullOrEmpty(settings.MaxDate)) 1052 { 1053 jsAttributes.Add("maxDate: '" + settings.MaxDate + "'"); 1054 } 1055 if (settings.IsInline) 1056 { 1057 jsAttributes.Add("inline: " + Converter.ToString(settings.IsInline).ToLower()); 1058 } 1059 if (settings.EnableTime) 1060 { 1061 jsAttributes.Add("enableTime: " + Converter.ToString(settings.EnableTime).ToLower()); 1062 } 1063 if (settings.EnableWeekNumbers) 1064 { 1065 jsAttributes.Add("weekNumbers: " + Converter.ToString(settings.EnableWeekNumbers).ToLower()); 1066 } 1067 1068 jsAttributes.AddRange(settings.GetFlatPickrOptions().Select(x => x.Key + ": " + x.Value)); 1069 1070 <script> 1071 document.addEventListener("DOMContentLoaded", function () { 1072 flatpickr("#@textField.Id", { 1073 @string.Join(",", jsAttributes) 1074 }); 1075 }); 1076 </script> 1077 } 1078 @using System.Reflection 1079 @using Dynamicweb.Rapido.Blocks.Components.General 1080 @using Dynamicweb.Rapido.Blocks.Components 1081 1082 @* Component *@ 1083 1084 @helper RenderTextField(TextField settings) 1085 { 1086 var attributes = new Dictionary<string, string>(); 1087 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1088 { 1089 settings.Id = Guid.NewGuid().ToString("N"); 1090 } 1091 1092 /*base settings*/ 1093 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1094 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1095 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1096 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1097 if (settings.Required) { attributes.Add("required", "true"); } 1098 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1099 /*end*/ 1100 1101 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 1102 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 1103 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 1104 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 1105 if (settings.MaxLength != 0) { attributes.Add("maxlength", settings.MaxLength.ToString()); } 1106 if (!string.IsNullOrEmpty(settings.Placeholder)) { attributes.Add("placeholder", settings.Placeholder); } 1107 attributes.Add("type", Enum.GetName(typeof(TextFieldType), settings.Type).ToLower()); 1108 if (settings.Type == TextFieldType.Password) { attributes.Add("autocomplete", "off"); }; 1109 if (settings.Value != null) { attributes.Add("value", settings.Value); } 1110 1111 settings.CssClass = "u-full-width " + settings.CssClass; 1112 1113 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; } 1114 1115 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1116 1117 string noMargin = "u-no-margin"; 1118 if (!settings.ReadOnly) { 1119 noMargin = ""; 1120 } 1121 1122 <div class="form__field-group u-full-width @noMargin @settings.WrapperCssClass dw-mod"> 1123 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null ) 1124 { 1125 <div class="u-full-width"> 1126 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } 1127 @if (settings.Link != null) { 1128 settings.Link.ButtonLayout = ButtonLayout.LinkClean; 1129 1130 <div class="u-pull--right"> 1131 @Render(settings.Link) 1132 </div> 1133 } 1134 </div> 1135 1136 } 1137 1138 @if (!string.IsNullOrEmpty(settings.HelpText)) 1139 { 1140 <small class="form__help-text">@settings.HelpText</small> 1141 } 1142 1143 @if (settings.ActionButton != null) 1144 { 1145 settings.ActionButton.CssClass += " btn--condensed u-no-margin"; 1146 <div class="form__field-combi u-no-margin dw-mod "> 1147 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1148 @Render(settings.ActionButton) 1149 </div> 1150 } 1151 else 1152 { 1153 <input @ComponentMethods.AddAttributes(resultAttributes) class=" @settings.CssClass dw-mod" /> 1154 } 1155 1156 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1157 </div> 1158 } 1159 @using System.Reflection 1160 @using Dynamicweb.Rapido.Blocks.Components.General 1161 @using Dynamicweb.Rapido.Blocks.Components 1162 1163 @* Component *@ 1164 1165 @helper RenderNumberField(NumberField settings) 1166 { 1167 var attributes = new Dictionary<string, string>(); 1168 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1169 { 1170 settings.Id = Guid.NewGuid().ToString("N"); 1171 } 1172 1173 /*base settings*/ 1174 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1175 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1176 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1177 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1178 if (settings.Required) { attributes.Add("required", "true"); } 1179 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1180 /*end*/ 1181 1182 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 1183 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 1184 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 1185 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 1186 if (settings.Max != null) { attributes.Add("max", settings.Max.ToString()); } 1187 if (settings.Min != null) { attributes.Add("min", settings.Min.ToString()); } 1188 if (settings.Step != 0) { attributes.Add("step", settings.Step.ToString()); } 1189 if (settings.Value != null && !string.IsNullOrEmpty(settings.Value.ToString())) { attributes.Add("value", settings.Value.ToString()); } 1190 attributes.Add("type", "number"); 1191 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; } 1192 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1193 1194 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod"> 1195 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null ) 1196 { 1197 <div class="u-full-width"> 1198 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } 1199 @if (settings.Link != null) { 1200 <div class="u-pull--right"> 1201 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } 1202 @Render(settings.Link) 1203 </div> 1204 } 1205 </div> 1206 1207 } 1208 1209 @if (!string.IsNullOrEmpty(settings.HelpText)) 1210 { 1211 <small class="form__help-text">@settings.HelpText</small> 1212 } 1213 1214 @if (settings.ActionButton != null) 1215 { 1216 settings.ActionButton.CssClass += " btn--condensed u-no-margin"; 1217 <div class="form__field-combi u-no-margin dw-mod"> 1218 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1219 @Render(settings.ActionButton) 1220 </div> 1221 } 1222 else 1223 { 1224 <div class="form__field-combi u-no-margin dw-mod"> 1225 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1226 </div> 1227 } 1228 1229 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1230 </div> 1231 } 1232 @using System.Reflection 1233 @using Dynamicweb.Rapido.Blocks.Components.General 1234 @using Dynamicweb.Rapido.Blocks.Components 1235 1236 1237 @* Component *@ 1238 1239 @helper RenderTextareaField(TextareaField settings) 1240 { 1241 Dictionary<string, string> attributes = new Dictionary<string, string>(); 1242 string id = settings.Id; 1243 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(id)) 1244 { 1245 id = Guid.NewGuid().ToString("N"); 1246 } 1247 1248 if (!string.IsNullOrEmpty(id)) { attributes.Add("id", id); } 1249 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1250 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 1251 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 1252 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 1253 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1254 if (!string.IsNullOrEmpty(settings.Placeholder)) { attributes.Add("placeholder", settings.Placeholder); } 1255 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1256 if (settings.Required) { attributes.Add("required", "true"); } 1257 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 1258 if (settings.MaxLength != 0) { attributes.Add("maxlength", settings.MaxLength.ToString()); } 1259 if (settings.Rows != 0) { attributes.Add("rows", settings.Rows.ToString()); } 1260 attributes.Add("name", settings.Name); 1261 1262 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; } 1263 1264 <div class="form__field-group full-width-input @settings.WrapperCssClass dw-mod"> 1265 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null ) 1266 { 1267 <div class="u-full-width"> 1268 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } 1269 @if (settings.Link != null) { 1270 <div class="u-pull--right"> 1271 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } 1272 @Render(settings.Link) 1273 </div> 1274 } 1275 </div> 1276 } 1277 1278 @if (!string.IsNullOrEmpty(settings.HelpText)) 1279 { 1280 <small class="form__help-text">@settings.HelpText</small> 1281 } 1282 1283 <textarea class="u-full-width @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Value</textarea> 1284 1285 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1286 </div> 1287 } 1288 @using System.Reflection 1289 @using Dynamicweb.Rapido.Blocks.Components.General 1290 @using Dynamicweb.Rapido.Blocks.Components 1291 1292 1293 @* Component *@ 1294 1295 @helper RenderHiddenField(HiddenField settings) { 1296 var attributes = new Dictionary<string, string>(); 1297 attributes.Add("type", "hidden"); 1298 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1299 if (settings.Value != null) { attributes.Add("value", settings.Value); } 1300 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1301 1302 <input @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)/> 1303 } 1304 @using System.Reflection 1305 @using Dynamicweb.Rapido.Blocks.Components.General 1306 @using Dynamicweb.Rapido.Blocks.Components 1307 1308 @* Component *@ 1309 1310 @helper RenderCheckboxField(CheckboxField settings) 1311 { 1312 var attributes = new Dictionary<string, string>(); 1313 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1314 { 1315 settings.Id = Guid.NewGuid().ToString("N"); 1316 } 1317 1318 /*base settings*/ 1319 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1320 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1321 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1322 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1323 if (settings.Required) { attributes.Add("required", "true"); } 1324 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1325 /*end*/ 1326 1327 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; } 1328 1329 attributes.Add("type", "checkbox"); 1330 if (settings.Checked) { attributes.Add("checked", "true"); } 1331 settings.CssClass = "form__control " + settings.CssClass; 1332 if (settings.Value != null) { attributes.Add("value", settings.Value); } 1333 1334 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1335 1336 <div class="form__field-group full-width-input @settings.WrapperCssClass dw-mod"> 1337 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1338 @if (!string.IsNullOrEmpty(settings.Label)) 1339 { 1340 <label for="@settings.Id" class="dw-mod">@settings.Label</label> 1341 } 1342 1343 @if (settings.Link != null) { 1344 <span> 1345 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } 1346 @Render(settings.Link) 1347 </span> 1348 } 1349 1350 @if (!string.IsNullOrEmpty(settings.HelpText)) 1351 { 1352 <small class="form__help-text checkbox-help dw-mod">@settings.HelpText</small> 1353 } 1354 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1355 </div> 1356 } 1357 @using System.Reflection 1358 @using Dynamicweb.Rapido.Blocks.Components.General 1359 @using Dynamicweb.Rapido.Blocks.Components 1360 1361 1362 @* Component *@ 1363 1364 @helper RenderCheckboxListField(CheckboxListField settings) 1365 { 1366 <div class="form__field-group full-width-input @settings.WrapperCssClass u-margin-bottom dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1367 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null ) 1368 { 1369 <div class="u-full-width"> 1370 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } 1371 @if (settings.Link != null) { 1372 <div class="u-pull--right"> 1373 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } 1374 @Render(settings.Link) 1375 </div> 1376 } 1377 </div> 1378 1379 } 1380 1381 <div class="u-pull--left"> 1382 @if (!string.IsNullOrEmpty(settings.HelpText)) 1383 { 1384 <small class="form__help-text">@settings.HelpText</small> 1385 } 1386 1387 @foreach (var item in settings.Options) 1388 { 1389 if (settings.Required) 1390 { 1391 item.Required = true; 1392 } 1393 if (settings.Disabled) 1394 { 1395 item.Disabled = true; 1396 } 1397 if (!string.IsNullOrEmpty(settings.Name)) 1398 { 1399 item.Name = settings.Name; 1400 } 1401 if (!string.IsNullOrEmpty(settings.CssClass)) 1402 { 1403 item.CssClass += settings.CssClass; 1404 } 1405 1406 /* value is not supported */ 1407 1408 if (!string.IsNullOrEmpty(settings.OnClick)) 1409 { 1410 item.OnClick += settings.OnClick; 1411 } 1412 if (!string.IsNullOrEmpty(settings.OnChange)) 1413 { 1414 item.OnChange += settings.OnChange; 1415 } 1416 @Render(item) 1417 } 1418 1419 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1420 </div> 1421 1422 </div> 1423 } 1424 @using Dynamicweb.Rapido.Blocks.Components.General 1425 1426 @* Component *@ 1427 1428 @helper RenderSearch(Search settings) 1429 { 1430 var searchValue = HttpContext.Current.Request.QueryString.Get(settings.SearchParameter) ?? ""; 1431 var groupValue = HttpContext.Current.Request.QueryString.Get(settings.GroupsParameter) ?? ""; 1432 1433 if (string.IsNullOrEmpty(settings.Id)) 1434 { 1435 settings.Id = Guid.NewGuid().ToString("N"); 1436 } 1437 1438 var resultAttributes = new Dictionary<string, string>(); 1439 1440 if (settings.PageSize != 0) 1441 { 1442 resultAttributes.Add("data-page-size", settings.PageSize.ToString()); 1443 } 1444 if (!string.IsNullOrEmpty(settings.GroupItemsFeedUrl)) 1445 { 1446 resultAttributes.Add("data-groups-feed-url", settings.GroupItemsFeedUrl); 1447 if (!string.IsNullOrEmpty(groupValue)) 1448 { 1449 resultAttributes.Add("data-selected-group", groupValue); 1450 } 1451 if (!string.IsNullOrEmpty(settings.GroupsParameter)) 1452 { 1453 resultAttributes.Add("data-groups-parameter", settings.GroupsParameter); 1454 } 1455 } 1456 resultAttributes.Add("data-force-init", "true"); 1457 if (settings.GoToFirstSearchResultOnEnter) 1458 { 1459 resultAttributes.Add("data-go-to-first-search-result-on-enter", settings.GoToFirstSearchResultOnEnter.ToString().ToLower()); 1460 } 1461 if (!string.IsNullOrEmpty(settings.SearchParameter)) 1462 { 1463 resultAttributes.Add("data-search-parameter", settings.SearchParameter); 1464 } 1465 resultAttributes.Add("data-search-feed-url", settings.SearchData.SearchFeedUrl); 1466 resultAttributes.Add("data-results-template-id", settings.SearchData.ResultsTemplateId); 1467 1468 if (settings.SecondSearchData != null) 1469 { 1470 resultAttributes.Add("data-second-search-feed-url", settings.SecondSearchData.SearchFeedUrl); 1471 resultAttributes.Add("data-second-results-template-id", settings.SecondSearchData.ResultsTemplateId); 1472 } 1473 if (!string.IsNullOrEmpty(settings.ResultsPageUrl)) 1474 { 1475 resultAttributes.Add("data-results-page-url", settings.ResultsPageUrl); 1476 } 1477 1478 resultAttributes = resultAttributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1479 1480 string searchFieldCss = (settings.SearchButton == null) ? "search--with-icon" : ""; 1481 1482 <div class="search @settings.CssClass @searchFieldCss js-search-data-source dw-mod" id="@settings.Id" @ComponentMethods.AddAttributes(resultAttributes)> 1483 @if (!string.IsNullOrEmpty(settings.GroupItemsFeedUrl)) 1484 { 1485 <button type="button" class="search__groups-btn dw-mod js-search-groups-btn">@Translate("All")</button> 1486 <ul class="dropdown dropdown--absolute-position dw-mod search__groups-results js-search-groups-list"></ul> 1487 } 1488 1489 <input type="text" class="search__field dw-mod js-search-field" placeholder="@settings.Placeholder" value="@searchValue"> 1490 1491 <div class="dropdown dropdown--absolute-position search__results dw-mod js-search-results @(settings.SecondSearchData != null ? "search__results--combined" : "")"> 1492 @if (settings.SecondSearchData != null) 1493 { 1494 <div class="search__column search__column--products dw-mod"> 1495 <div class="search__column-header dw-mod">@Translate("Products")</div> 1496 <ul class="search__results-list dw-mod js-search-results-list" id="@(settings.Id)_ResultsList"></ul> 1497 @if (!string.IsNullOrEmpty(settings.SearchData.ResultsPageUrl)) 1498 { 1499 @Render(new Link { 1500 Title = Translate("View all"), 1501 CssClass = "js-view-all-button u-margin", 1502 Href = settings.SearchData.ResultsPageUrl 1503 }); 1504 } 1505 </div> 1506 <div class="search__column search__column--pages dw-mod"> 1507 <div class="search__column-header">@Translate("Pages")</div> 1508 <ul class="search__results-list dw-mod js-search-results-second-list" id="@(settings.Id)_SecondResultsList"></ul> 1509 @if (!string.IsNullOrEmpty(settings.SecondSearchData.ResultsPageUrl)) 1510 { 1511 @Render(new Link 1512 { 1513 Title = Translate("View all"), 1514 CssClass = "js-view-all-button u-margin", 1515 Href = settings.SecondSearchData.ResultsPageUrl 1516 }); 1517 } 1518 </div> 1519 } 1520 else 1521 { 1522 <div class="search__column search__column--only dw-mod"> 1523 <ul class="search__results-list dw-mod js-search-results-list" id="@(settings.Id)_ResultsList"></ul> 1524 @if (!string.IsNullOrEmpty(settings.SearchData.ResultsPageUrl)) 1525 { 1526 @Render(new Link { 1527 Title = Translate("View all"), 1528 CssClass = "js-view-all-button u-margin", 1529 Href = settings.SearchData.ResultsPageUrl 1530 }); 1531 } 1532 </div> 1533 } 1534 </div> 1535 1536 @if (settings.SearchButton != null) 1537 { 1538 settings.SearchButton.CssClass += " search__btn js-search-btn"; 1539 if (settings.RenderDefaultSearchIcon) 1540 { 1541 settings.SearchButton.Icon = new Icon { Name = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue }; 1542 } 1543 @Render(settings.SearchButton); 1544 } 1545 </div> 1546 } 1547 @using System.Reflection 1548 @using Dynamicweb.Rapido.Blocks.Components.General 1549 @using Dynamicweb.Rapido.Blocks.Components 1550 1551 1552 @* Component *@ 1553 1554 @helper RenderSelectField(SelectField settings) 1555 { 1556 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; } 1557 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1558 { 1559 settings.Id = Guid.NewGuid().ToString("N"); 1560 } 1561 1562 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod"> 1563 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null ) 1564 { 1565 <div class="u-full-width"> 1566 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } 1567 @if (settings.Link != null) { 1568 <div class="u-pull--right"> 1569 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } 1570 @Render(settings.Link) 1571 </div> 1572 } 1573 </div> 1574 } 1575 1576 @if (!string.IsNullOrEmpty(settings.HelpText)) 1577 { 1578 <small class="form__help-text">@settings.HelpText</small> 1579 } 1580 1581 @if (settings.ActionButton != null) 1582 { 1583 settings.ActionButton.CssClass += " btn--condensed u-no-margin"; 1584 <div class="form__field-combi u-no-margin dw-mod"> 1585 @RenderSelectBase(settings) 1586 @Render(settings.ActionButton) 1587 </div> 1588 } 1589 else 1590 { 1591 @RenderSelectBase(settings) 1592 } 1593 1594 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1595 </div> 1596 } 1597 1598 @helper RenderSelectBase(SelectField settings) 1599 { 1600 var attributes = new Dictionary<string, string>(); 1601 1602 /*base settings*/ 1603 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1604 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1605 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1606 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1607 if (settings.Required) { attributes.Add("required", "true"); } 1608 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1609 /*end*/ 1610 1611 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1612 1613 <select @ComponentMethods.AddAttributes(resultAttributes) class="u-full-width @settings.CssClass dw-mod"> 1614 @if (settings.Default != null) 1615 { 1616 @Render(settings.Default) 1617 } 1618 1619 @foreach (var item in settings.Options) 1620 { 1621 if (settings.Value != null) { 1622 item.Checked = item.Value == settings.Value; 1623 } 1624 @Render(item) 1625 } 1626 </select> 1627 } 1628 @using System.Reflection 1629 @using Dynamicweb.Rapido.Blocks.Components.General 1630 @using Dynamicweb.Rapido.Blocks.Components 1631 1632 @* Component *@ 1633 1634 @helper RenderRadioButtonField(RadioButtonField settings) 1635 { 1636 var attributes = new Dictionary<string, string>(); 1637 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1638 { 1639 settings.Id = Guid.NewGuid().ToString("N"); 1640 } 1641 1642 /*base settings*/ 1643 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1644 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1645 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1646 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1647 if (settings.Required) { attributes.Add("required", "true"); } 1648 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1649 /*end*/ 1650 1651 attributes.Add("type", "radio"); 1652 if (settings.Checked) { attributes.Add("checked", "true"); } 1653 settings.CssClass = "form__control " + settings.CssClass; 1654 if (settings.Value != null) { attributes.Add("value", settings.Value); } 1655 1656 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1657 1658 <div class="form__field-group @settings.WrapperCssClass dw-mod"> 1659 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1660 @if (!string.IsNullOrEmpty(settings.Label)) 1661 { 1662 <label for="@settings.Id" class="dw-mod">@settings.Label</label> 1663 } 1664 @if (!string.IsNullOrEmpty(settings.HelpText)) 1665 { 1666 <small class="form__help-text">@settings.HelpText</small> 1667 } 1668 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1669 </div> 1670 } 1671 @using System.Reflection 1672 @using Dynamicweb.Rapido.Blocks.Components.General 1673 @using Dynamicweb.Rapido.Blocks.Components 1674 1675 1676 @* Component *@ 1677 1678 @helper RenderRadioButtonListField(RadioButtonListField settings) 1679 { 1680 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; } 1681 1682 <div class="form__field-group @settings.WrapperCssClass u-margin-bottom dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1683 @if (!string.IsNullOrEmpty(settings.Label)) 1684 { 1685 <label>@settings.Label</label> 1686 } 1687 @if (!string.IsNullOrEmpty(settings.HelpText)) 1688 { 1689 <small class="form__help-text">@settings.HelpText</small> 1690 } 1691 1692 @foreach (var item in settings.Options) 1693 { 1694 if (settings.Required) 1695 { 1696 item.Required = true; 1697 } 1698 if (settings.Disabled) 1699 { 1700 item.Disabled = true; 1701 } 1702 if (!string.IsNullOrEmpty(settings.Name)) 1703 { 1704 item.Name = settings.Name; 1705 } 1706 if (settings.Value != null && settings.Value == item.Value) 1707 { 1708 item.Checked = true; 1709 } 1710 if (!string.IsNullOrEmpty(settings.OnClick)) 1711 { 1712 item.OnClick += settings.OnClick; 1713 } 1714 if (!string.IsNullOrEmpty(settings.OnChange)) 1715 { 1716 item.OnChange += settings.OnChange; 1717 } 1718 if (!string.IsNullOrEmpty(settings.CssClass)) 1719 { 1720 item.CssClass += settings.CssClass; 1721 } 1722 @Render(item) 1723 } 1724 1725 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1726 </div> 1727 } 1728 @using System.Reflection 1729 @using Dynamicweb.Rapido.Blocks.Components.General 1730 @using Dynamicweb.Rapido.Blocks.Components 1731 1732 1733 @* Component *@ 1734 1735 @helper RenderNotificationMessage(NotificationMessage settings) 1736 { 1737 if (!string.IsNullOrEmpty(settings.Message)) 1738 { 1739 var attributes = new Dictionary<string, string>(); 1740 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1741 1742 string messageTypeClass = Enum.GetName(typeof(NotificationMessageType), settings.MessageType).ToLower(); 1743 string messageLayoutClass = Enum.GetName(typeof(NotificationMessageLayout), settings.MessageLayout).ToLower(); 1744 string minHeightClass = settings.Icon != null ? "u-min-h70px" : ""; 1745 1746 <div class="notification-message-@messageTypeClass notification-message-@messageLayoutClass @messageLayoutClass @minHeightClass @settings.CssClass u-full-width dw-mod" @ComponentMethods.AddAttributes(attributes)> 1747 @if (settings.Icon != null) { 1748 settings.Icon.Label = !string.IsNullOrEmpty(settings.Icon.Label) ? settings.Message + settings.Icon.Label : settings.Message; 1749 @Render(settings.Icon) 1750 } else { 1751 @settings.Message 1752 } 1753 </div> 1754 } 1755 } 1756 @using Dynamicweb.Rapido.Blocks.Components.General 1757 1758 1759 @* Component *@ 1760 1761 @helper RenderHandlebarsRoot(HandlebarsRoot settings) { 1762 string preRender = !String.IsNullOrEmpty(settings.PreRenderScriptTemplate) ? "data-pre-render-template=\"" + settings.PreRenderScriptTemplate + "\"" : ""; 1763 1764 <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> 1765 @if (settings.SubBlocks != null) { 1766 @RenderBlockList(settings.SubBlocks) 1767 } 1768 </div> 1769 } 1770 @using System.Reflection 1771 @using Dynamicweb.Rapido.Blocks.Components.General 1772 @using Dynamicweb.Rapido.Blocks.Components 1773 @using System.Text.RegularExpressions 1774 1775 1776 @* Component *@ 1777 1778 @helper RenderSticker(Sticker settings) { 1779 if (!String.IsNullOrEmpty(settings.Title)) { 1780 string size = settings.Size.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Size.ToString().ToLower() : ""; 1781 string style = settings.Style.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Style.ToString().ToLower() : ""; 1782 1783 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>(); 1784 if (!String.IsNullOrEmpty(settings.Color) || !String.IsNullOrEmpty(settings.BackgroundColor)) { 1785 string styleTag = !String.IsNullOrEmpty(settings.Color) ? "color: " + settings.Color + "; " : ""; 1786 styleTag += !String.IsNullOrEmpty(settings.BackgroundColor) ? "background-color: " + settings.BackgroundColor + "; " : ""; 1787 optionalAttributes.Add("style", styleTag); 1788 } 1789 1790 <div class="stickers-container__tag @size @style @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Title</div> 1791 } 1792 } 1793 1794 @using System.Reflection 1795 @using Dynamicweb.Rapido.Blocks.Components.General 1796 @using Dynamicweb.Rapido.Blocks.Components 1797 1798 1799 @* Component *@ 1800 1801 @helper RenderStickersCollection(StickersCollection settings) 1802 { 1803 if (settings.Stickers.Count > 0) 1804 { 1805 string position = "stickers-container--" + Regex.Replace(settings.Position.ToString(), "([a-z])([A-Z])", "$1-$2").ToLower(); 1806 1807 <div class="stickers-container @position @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1808 @foreach (Sticker sticker in settings.Stickers) 1809 { 1810 @Render(sticker) 1811 } 1812 </div> 1813 } 1814 } 1815 1816 @using Dynamicweb.Rapido.Blocks.Components.General 1817 1818 1819 @* Component *@ 1820 1821 @helper RenderForm(Form settings) { 1822 if (settings != null) 1823 { 1824 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>(); 1825 if (!string.IsNullOrEmpty(settings.Action)) { optionalAttributes.Add("action", settings.Action); }; 1826 if (!string.IsNullOrEmpty(settings.Name)) { optionalAttributes.Add("name", settings.Name); }; 1827 if (!string.IsNullOrEmpty(settings.OnSubmit)) { optionalAttributes.Add("onsubmit", settings.OnSubmit); }; 1828 var enctypes = new Dictionary<string, string> 1829 { 1830 { "multipart", "multipart/form-data" }, 1831 { "text", "text/plain" }, 1832 { "application", "application/x-www-form-urlencoded" } 1833 }; 1834 if (settings.Enctype != FormEnctype.none) { optionalAttributes.Add("enctype", enctypes[Enum.GetName(typeof(FormEnctype), settings.Enctype).ToLower()]); }; 1835 optionalAttributes.Add("method", settings.Method.ToString()); 1836 1837 if (!string.IsNullOrEmpty(settings.FormStartMarkup)) 1838 { 1839 @settings.FormStartMarkup 1840 } 1841 else 1842 { 1843 @:<form class="@settings.CssClass u-no-margin dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1844 } 1845 1846 foreach (var field in settings.GetFields()) 1847 { 1848 <div class="hidden"> 1849 1850 </div> 1851 @Render(field) 1852 } 1853 1854 @:</form> 1855 } 1856 } 1857 @using System.Reflection 1858 @using Dynamicweb.Rapido.Blocks.Components.General 1859 @using Dynamicweb.Rapido.Blocks.Components 1860 1861 1862 @* Component *@ 1863 1864 @helper RenderText(Text settings) 1865 { 1866 @settings.Content 1867 } 1868 @using System.Reflection 1869 @using Dynamicweb.Rapido.Blocks.Components.General 1870 @using Dynamicweb.Rapido.Blocks.Components 1871 1872 1873 @* Component *@ 1874 1875 @helper RenderContentModule(ContentModule settings) { 1876 if (!string.IsNullOrEmpty(settings.Content)) 1877 { 1878 @settings.Content 1879 } 1880 } 1881 @using System.Reflection 1882 @using Dynamicweb.Rapido.Blocks.Components.General 1883 @using Dynamicweb.Rapido.Blocks.Components 1884 1885 1886 @* Component *@ 1887 1888 @helper RenderModal(Modal settings) { 1889 if (settings != null) 1890 { 1891 string modalId = !string.IsNullOrEmpty(settings.Id) ? settings.Id : Guid.NewGuid().ToString("N"); 1892 1893 string onchange = !string.IsNullOrEmpty(settings.OnClose) ? "onchange=\"if(!this.checked){" + settings.OnClose + "}\"" : ""; 1894 1895 <input type="checkbox" id="@(modalId)ModalTrigger" class="modal-trigger" @onchange /> 1896 1897 <div class="modal-container"> 1898 @if (!settings.DisableDarkOverlay) 1899 { 1900 <label for="@(modalId)ModalTrigger" id="@(modalId)ModalOverlay" class="modal-overlay"></label> 1901 } 1902 <div class="modal modal--@settings.Width.ToString().ToLower() modal-height--@settings.Height.ToString().ToLower()" id="@(modalId)Modal"> 1903 @if (settings.Heading != null) 1904 { 1905 if (!string.IsNullOrEmpty(settings.Heading.Title)) 1906 { 1907 <div class="modal__header"> 1908 @Render(settings.Heading) 1909 </div> 1910 } 1911 } 1912 <div class="modal__body @(settings.Width.ToString().ToLower() == "full" ? "modal__body--full" : "")"> 1913 @if (!string.IsNullOrEmpty(settings.BodyText)) 1914 { 1915 @settings.BodyText 1916 } 1917 @if (settings.BodyTemplate != null) 1918 { 1919 @settings.BodyTemplate 1920 } 1921 @{ 1922 var actions = settings.GetActions(); 1923 } 1924 </div> 1925 @if (actions.Length > 0) 1926 { 1927 <div class="modal__footer"> 1928 @foreach (var action in actions) 1929 { 1930 if (Pageview.Device.ToString() != "Mobile") { 1931 action.CssClass += " u-no-margin"; 1932 } else { 1933 action.CssClass += " u-full-width u-margin-bottom"; 1934 } 1935 1936 @Render(action) 1937 } 1938 </div> 1939 } 1940 <label class="modal__close-btn" for="@(modalId)ModalTrigger"></label> 1941 </div> 1942 </div> 1943 } 1944 } 1945 @using Dynamicweb.Rapido.Blocks.Components.General 1946 1947 @* Component *@ 1948 1949 @helper RenderMediaListItem(MediaListItem settings) 1950 { 1951 <div class="media-list-item @settings.CssClass dw-mod" @(!string.IsNullOrEmpty(settings.Id) ? "id=\"" + settings.Id + "\"" : "")> 1952 @if (!string.IsNullOrEmpty(settings.Label)) 1953 { 1954 if (!string.IsNullOrEmpty(settings.Link)) 1955 { 1956 @Render(new Link 1957 { 1958 Href = settings.Link, 1959 CssClass = "media-list-item__sticker dw-mod", 1960 ButtonLayout = ButtonLayout.None, 1961 Title = settings.Label, 1962 OnClick = !string.IsNullOrEmpty(settings.OnClick) ? settings.OnClick : "" 1963 }) 1964 } 1965 else if (!string.IsNullOrEmpty(settings.OnClick)) 1966 { 1967 <span class="media-list-item__sticker dw-mod" onclick="@(settings.OnClick)"> 1968 <span class="u-uppercase">@settings.Label</span> 1969 </span> 1970 } 1971 else 1972 { 1973 <span class="media-list-item__sticker media-list-item__sticker--no-link dw-mod"> 1974 <span class="u-uppercase">@settings.Label</span> 1975 </span> 1976 } 1977 } 1978 <div class="media-list-item__wrap"> 1979 <div class="media-list-item__info dw-mod"> 1980 <div class="media-list-item__header dw-mod"> 1981 @if (!string.IsNullOrEmpty(settings.Title)) 1982 { 1983 if (!string.IsNullOrEmpty(settings.Link)) 1984 { 1985 @Render(new Link 1986 { 1987 Href = settings.Link, 1988 CssClass = "media-list-item__name dw-mod", 1989 ButtonLayout = ButtonLayout.None, 1990 Title = settings.Title, 1991 OnClick = !string.IsNullOrEmpty(settings.OnClick) ? settings.OnClick : "" 1992 }) 1993 } 1994 else if (!string.IsNullOrEmpty(settings.OnClick)) 1995 { 1996 <span class="media-list-item__name dw-mod" onclick="@(settings.OnClick)">@settings.Title</span> 1997 } 1998 else 1999 { 2000 <span class="media-list-item__name media-list-item__name--no-link dw-mod">@settings.Title</span> 2001 } 2002 } 2003 2004 @if (!string.IsNullOrEmpty(settings.Status)) 2005 { 2006 <div class="media-list-item__state dw-mod">@settings.Status</div> 2007 } 2008 </div> 2009 @{ 2010 settings.InfoTable.CssClass += " media-list-item__parameters-table"; 2011 } 2012 2013 @Render(settings.InfoTable) 2014 </div> 2015 <div class="media-list-item__actions dw-mod"> 2016 <div class="media-list-item__actions-list dw-mod"> 2017 @{ 2018 var actions = settings.GetActions(); 2019 2020 foreach (ButtonBase action in actions) 2021 { 2022 action.ButtonLayout = ButtonLayout.None; 2023 action.CssClass += " media-list-item__action link"; 2024 2025 @Render(action) 2026 } 2027 } 2028 </div> 2029 2030 @if (settings.SelectButton != null && !string.IsNullOrEmpty(settings.SelectButton.Title)) 2031 { 2032 settings.SelectButton.CssClass += " u-no-margin"; 2033 2034 <div class="media-list-item__action-button"> 2035 @Render(settings.SelectButton) 2036 </div> 2037 } 2038 </div> 2039 </div> 2040 </div> 2041 } 2042 @using Dynamicweb.Rapido.Blocks.Components.General 2043 @using Dynamicweb.Rapido.Blocks.Components 2044 2045 @helper RenderTable(Table settings) 2046 { 2047 Dictionary<string, string> attributes = new Dictionary<string, string>(); 2048 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 2049 2050 var enumToClasses = new Dictionary<TableDesign, string> 2051 { 2052 { TableDesign.Clean, "table--clean" }, 2053 { TableDesign.Bordered, "table--bordered" }, 2054 { TableDesign.Striped, "table--striped" }, 2055 { TableDesign.Hover, "table--hover" }, 2056 { TableDesign.Compact, "table--compact" }, 2057 { TableDesign.Condensed, "table--condensed" }, 2058 { TableDesign.NoTopBorder, "table--no-top-border" } 2059 }; 2060 string tableDesignClass = ""; 2061 if (settings.Design != TableDesign.None) 2062 { 2063 tableDesignClass = enumToClasses[settings.Design]; 2064 } 2065 2066 if (!string.IsNullOrEmpty(settings.CssClass) || settings.Design != TableDesign.None) { attributes.Add("class", "table " + tableDesignClass + " " + settings.CssClass + " dw-mod"); } 2067 2068 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value); 2069 2070 <table @ComponentMethods.AddAttributes(resultAttributes)> 2071 @if (settings.Header != null) 2072 { 2073 <thead> 2074 @Render(settings.Header) 2075 </thead> 2076 } 2077 <tbody> 2078 @foreach (var row in settings.Rows) 2079 { 2080 @Render(row) 2081 } 2082 </tbody> 2083 @if (settings.Footer != null) 2084 { 2085 <tfoot> 2086 @Render(settings.Footer) 2087 </tfoot> 2088 } 2089 </table> 2090 } 2091 @using Dynamicweb.Rapido.Blocks.Components.General 2092 @using Dynamicweb.Rapido.Blocks.Components 2093 2094 @helper RenderTableRow(TableRow settings) 2095 { 2096 Dictionary<string, string> attributes = new Dictionary<string, string>(); 2097 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 2098 2099 var enumToClasses = new Dictionary<TableRowDesign, string> 2100 { 2101 { TableRowDesign.NoBorder, "table__row--no-border" }, 2102 { TableRowDesign.Border, "table__row--border" }, 2103 { TableRowDesign.TopBorder, "table__row--top-line" }, 2104 { TableRowDesign.BottomBorder, "table__row--bottom-line" }, 2105 { TableRowDesign.Solid, "table__row--solid" } 2106 }; 2107 2108 string tableRowDesignClass = ""; 2109 if (settings.Design != TableRowDesign.None) 2110 { 2111 tableRowDesignClass = enumToClasses[settings.Design]; 2112 } 2113 2114 if (!string.IsNullOrEmpty(settings.CssClass) || settings.Design != TableRowDesign.None) { attributes.Add("class", "table__row " + tableRowDesignClass + " " + settings.CssClass + " dw-mod"); } 2115 2116 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value); 2117 2118 <tr @ComponentMethods.AddAttributes(resultAttributes)> 2119 @foreach (var cell in settings.Cells) 2120 { 2121 if (settings.IsHeaderRow) 2122 { 2123 cell.IsHeader = true; 2124 } 2125 @Render(cell) 2126 } 2127 </tr> 2128 } 2129 @using Dynamicweb.Rapido.Blocks.Components.General 2130 @using Dynamicweb.Rapido.Blocks.Components 2131 @using Dynamicweb.Core 2132 2133 @helper RenderTableCell(TableCell settings) 2134 { 2135 Dictionary<string, string> attributes = new Dictionary<string, string>(); 2136 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 2137 if (settings.Colspan != 0) { attributes.Add("colspan", Converter.ToString(settings.Colspan)); } 2138 if (settings.Rowspan != 0) { attributes.Add("rowspan", Converter.ToString(settings.Rowspan)); } 2139 if (!string.IsNullOrEmpty(settings.CssClass)) { attributes.Add("class", settings.CssClass + " dw-mod"); } 2140 2141 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value); 2142 2143 string tagName = settings.IsHeader ? "th" : "td"; 2144 2145 @("<" + tagName + " " + ComponentMethods.AddAttributes(resultAttributes) + ">") 2146 @settings.Content 2147 @("</" + tagName + ">"); 2148 } 2149 @using System.Linq 2150 @using Dynamicweb.Rapido.Blocks.Components.General 2151 2152 @* Component *@ 2153 2154 @helper RenderPagination(Dynamicweb.Rapido.Blocks.Components.General.Pagination settings) 2155 { 2156 var pageNumberQueryStringName = Dynamicweb.Rapido.Services.Pagination.GetPageNumberQueryStringName(settings); // Get the proper 'page number' query string parameter 2157 var queryParameters = Dynamicweb.Rapido.Services.Url.GetQueryParameters(pageNumberQueryStringName); // Get the NameValueCollection from the querystring 2158 2159 if (settings.NumberOfPages > 1) 2160 { 2161 string url = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + "/Default.aspx"; 2162 string ariaLabel = !string.IsNullOrWhiteSpace(settings.AriaLabel) ? settings.AriaLabel : Translate("Page navigation"); 2163 Dictionary<string, int> startAndEndPageNumber = Dynamicweb.Rapido.Services.Pagination.GetStartAndEndPageNumber(settings); 2164 2165 <div class="pager u-margin-top dw-mod @settings.CssClass" aria-label="@ariaLabel"> 2166 @if (settings.ShowPagingInfo) 2167 { 2168 <div class="pager__info dw-mod"> 2169 @Translate("Page") @settings.CurrentPageNumber @Translate("of") @settings.NumberOfPages 2170 </div> 2171 } 2172 <ul class="pager__list dw-mod"> 2173 @if (!string.IsNullOrWhiteSpace(settings.FirstPageUrl) && settings.ShowFirstAndLastControls) 2174 { 2175 @Render(new PaginationItem { Link = settings.FirstPageUrl, Icon = settings.FirstIcon }) 2176 } 2177 @if (!string.IsNullOrWhiteSpace(settings.PreviousPageUrl) && settings.ShowNextAndPrevControls) 2178 { 2179 @Render(new PaginationItem { Link = settings.PreviousPageUrl, Icon = settings.PrevIcon }) 2180 } 2181 @if (settings.GetPages().Any()) 2182 { 2183 foreach (var page in settings.GetPages()) 2184 { 2185 @Render(page) 2186 } 2187 } 2188 else 2189 { 2190 for (var page = startAndEndPageNumber["StartPage"]; page <= startAndEndPageNumber["EndPage"]; page++) 2191 { 2192 queryParameters = Dynamicweb.Rapido.Services.Url.UpdateQueryStringParameter(queryParameters, pageNumberQueryStringName, page.ToString()); 2193 @Render(new PaginationItem { Label = page.ToString(), Link = Dynamicweb.Rapido.Services.Url.BuildUri(url, queryParameters).PathAndQuery, IsActive = (settings.CurrentPageNumber == page) }); 2194 } 2195 } 2196 @if (!string.IsNullOrWhiteSpace(settings.NextPageUrl) && settings.ShowNextAndPrevControls) 2197 { 2198 @Render(new PaginationItem { Link = settings.NextPageUrl, Icon = settings.NextIcon }) 2199 } 2200 @if (!string.IsNullOrWhiteSpace(settings.LastPageUrl) && settings.ShowFirstAndLastControls) 2201 { 2202 @Render(new PaginationItem { Link = settings.LastPageUrl, Icon = settings.LastIcon }) 2203 } 2204 </ul> 2205 </div> 2206 } 2207 } 2208 2209 @helper RenderPaginationItem(PaginationItem settings) 2210 { 2211 if (settings.Icon == null) 2212 { 2213 settings.Icon = new Icon(); 2214 } 2215 2216 settings.Icon.Label = settings.Label; 2217 <li class="pager__btn dw-mod"> 2218 @if (settings.IsActive) 2219 { 2220 <span class="pager__num pager__num--current dw-mod"> 2221 @Render(settings.Icon) 2222 </span> 2223 } 2224 else 2225 { 2226 <a href="@settings.Link" class="pager__num dw-mod"> 2227 @Render(settings.Icon) 2228 </a> 2229 } 2230 </li> 2231 } 2232 2233 2234 @using Dynamicweb.Rapido.Blocks.Components.General 2235 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 2236 2237 2238 @functions { 2239 2240 public class ArticleListPopularItems : ComponentBase 2241 { 2242 public string Category { get; set; } 2243 2244 } 2245 2246 2247 } 2248 2249 2250 2251 @using Dynamicweb.Frontend 2252 @using System.Reflection 2253 @using Dynamicweb.Content.Items 2254 @using System.Web.UI.HtmlControls 2255 @using Dynamicweb.Rapido.Blocks.Components 2256 @using Dynamicweb.Rapido.Blocks 2257 @using Dynamicweb.Rapido.Blocks.Components.Articles 2258 2259 @* Components for the articles *@ 2260 @using System.Reflection 2261 @using Dynamicweb.Rapido.Blocks.Components.Articles 2262 2263 2264 @* Component for the articles *@ 2265 2266 @helper RenderArticleBanner(dynamic settings) { 2267 string filterClasses = "image-filter image-filter--darken"; 2268 settings.Layout = ArticleHeaderLayout.Banner; 2269 2270 if (settings.Image != null) 2271 { 2272 if (settings.Image.Path != null) 2273 { 2274 <section class="multiple-paragraphs-container u-color-light paragraph-container--full-width"> 2275 <div class="background-image @filterClasses dw-mod"> 2276 <div class="background-image__wrapper @filterClasses dw-mod"> 2277 @{ 2278 settings.Image.CssClass += "background-image__cover dw-mod"; 2279 } 2280 @Render(settings.Image) 2281 </div> 2282 </div> 2283 <div class="center-container dw-mod"> 2284 <div class="grid"> 2285 <div class="grid__col-md-8 grid__col-xs-12 paragraph-container paragraph-container--height-lg"> 2286 <div class="u-left-middle"> 2287 <div> 2288 @if (!String.IsNullOrEmpty(settings.Heading)) 2289 { 2290 <h1 class="article__header article__header--giant dw-mod" style="color: @settings.TextColor">@settings.Heading</h1> 2291 } 2292 @if (!String.IsNullOrEmpty(settings.Subheading)) 2293 { 2294 <div class="article__leadtext dw-mod" style="color: @settings.TextColor">@settings.Subheading</div> 2295 } 2296 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 2297 { 2298 <small class="article__post-info u-margin-bottom--lg dw-mod" style="color: @settings.TextColor">@settings.Author @settings.Date</small> 2299 } 2300 @if (!String.IsNullOrEmpty(settings.Link)) { 2301 <div class="grid__cell"> 2302 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 2303 </div> 2304 } 2305 </div> 2306 </div> 2307 </div> 2308 @if (settings.ExternalParagraphId != 0) 2309 { 2310 <div class="grid__col-md-4 grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-auto dw-mod"> 2311 <div class="u-color-light-gray--bg u-color-dark dw-mod"> 2312 @RenderParagraphContent(settings.ExternalParagraphId) 2313 </div> 2314 </div> 2315 } 2316 2317 </div> 2318 </div> 2319 </section> 2320 if (!String.IsNullOrEmpty(settings.Image.Caption)) { 2321 <div class="image-caption dw-mod">@settings.Image.Caption</div> 2322 } 2323 } 2324 else 2325 { 2326 settings.Layout = ArticleHeaderLayout.Clean; 2327 @RenderArticleCleanHeader(settings); 2328 } 2329 } 2330 else 2331 { 2332 settings.Layout = ArticleHeaderLayout.Clean; 2333 @RenderArticleCleanHeader(settings); 2334 } 2335 } 2336 @using System.Reflection 2337 @using Dynamicweb.Rapido.Blocks.Components 2338 @using Dynamicweb.Rapido.Blocks.Components.General 2339 @using Dynamicweb.Rapido.Blocks.Components.Articles 2340 @using Dynamicweb.Rapido.Blocks 2341 2342 2343 @* Component for the articles *@ 2344 2345 @helper RenderArticleHeader(ArticleHeader settings) { 2346 dynamic[] methodParameters = new dynamic[1]; 2347 methodParameters[0] = settings; 2348 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleHeaderCustom"); 2349 2350 if (customMethod != null) 2351 { 2352 @customMethod.Invoke(this, methodParameters).ToString(); 2353 } else { 2354 switch (settings.Layout) 2355 { 2356 case ArticleHeaderLayout.Clean: 2357 @RenderArticleCleanHeader(settings); 2358 break; 2359 case ArticleHeaderLayout.Split: 2360 @RenderArticleSplitHeader(settings); 2361 break; 2362 case ArticleHeaderLayout.Banner: 2363 @RenderArticleBannerHeader(settings); 2364 break; 2365 case ArticleHeaderLayout.Overlay: 2366 @RenderArticleOverlayHeader(settings); 2367 break; 2368 default: 2369 @RenderArticleCleanHeader(settings); 2370 break; 2371 } 2372 } 2373 } 2374 2375 @helper RenderArticleCleanHeader(ArticleHeader settings) { 2376 dynamic[] methodParameters = new dynamic[1]; 2377 methodParameters[0] = settings; 2378 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleCleanHeaderCustom"); 2379 2380 if (customMethod != null) 2381 { 2382 @customMethod.Invoke(this, methodParameters).ToString(); 2383 } 2384 else 2385 { 2386 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12"; 2387 2388 <div class="grid grid--align-content-start grid--justify-start"> 2389 <div class="grid__col-md-@contentColumns grid__col-sm-12 u-padding--lg dw-mod"> 2390 @if (!String.IsNullOrEmpty(settings.Category) || !String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date) || settings.RatingOutOf != 0) 2391 { 2392 <div class="u-border-bottom u-padding-bottom"> 2393 @if (!String.IsNullOrEmpty(settings.Category)) 2394 { 2395 <div class="u-pull--left"> 2396 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div> 2397 </div> 2398 } 2399 <div class="u-pull--right"> 2400 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 2401 { 2402 <small class="article__post-info dw-mod">@settings.Author @settings.Date</small> 2403 } 2404 @if (settings.RatingOutOf != 0) 2405 { 2406 @Render(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) 2407 } 2408 </div> 2409 </div> 2410 } 2411 2412 <div class="grid__cell"> 2413 @if (!String.IsNullOrEmpty(settings.Heading)) 2414 { 2415 <h1 class="article__header test article__header--giant dw-mod">@settings.Heading </h1> 2416 2417 } 2418 @if (settings.Image != null) 2419 { 2420 if (settings.Image.Path != null) 2421 { 2422 <div class="u-padding-bottom--lg"> 2423 2424 @Render(settings.Image) 2425 2426 </div> 2427 } 2428 } 2429 @if (!String.IsNullOrEmpty(settings.Subheading)) 2430 { 2431 <div class="article__leadtext dw-mod">@settings.Subheading</div> 2432 } 2433 @if (!String.IsNullOrEmpty(settings.Link)) 2434 { 2435 <div class="grid__cell"> 2436 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 2437 </div> 2438 } 2439 </div> 2440 </div> 2441 @if (settings.ExternalParagraphId != 0) 2442 { 2443 <div class="grid__col-md-4 grid__col-sm-12 u-padding--lg u-color-light-gray--bg dw-mod"> 2444 @RenderParagraphContent(settings.ExternalParagraphId) 2445 </div> 2446 } 2447 </div> 2448 } 2449 } 2450 2451 @helper RenderArticleSplitHeader(ArticleHeader settings) { 2452 dynamic[] methodParameters = new dynamic[1]; 2453 methodParameters[0] = settings; 2454 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSplitHeaderCustom"); 2455 2456 if (customMethod != null) 2457 { 2458 @customMethod.Invoke(this, methodParameters).ToString(); 2459 } 2460 else 2461 { 2462 string headerColumnWidth = settings.ExternalParagraphId != 0 ? "4" : "6"; 2463 2464 if (settings.Image != null) 2465 { 2466 if (settings.Image.Path != null) 2467 { 2468 <section class="multiple-paragraphs-container paragraph-container--full-width"> 2469 <div class="grid"> 2470 <div class="grid__col-md-@headerColumnWidth grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-xl dw-mod"> 2471 <div class="u-left-middle u-padding--lg"> 2472 <div> 2473 @if (!String.IsNullOrEmpty(settings.Category)) 2474 { 2475 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div> 2476 } 2477 @if (!String.IsNullOrEmpty(settings.Heading)) 2478 { 2479 <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1> 2480 } 2481 @if (!String.IsNullOrEmpty(settings.Subheading)) 2482 { 2483 <div class="article__leadtext dw-mod">@settings.Subheading</div> 2484 } 2485 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 2486 { 2487 <small class="article__post-info u-pull--left dw-mod">@settings.Author @settings.Date</small> 2488 } 2489 @if (settings.RatingOutOf != 0) 2490 { 2491 <div class="u-pull--right"> 2492 @Render(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) 2493 </div> 2494 } 2495 @if (!String.IsNullOrEmpty(settings.Link)) { 2496 <div class="u-full-width u-pull--left u-margin-top"> 2497 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 2498 </div> 2499 } 2500 </div> 2501 </div> 2502 </div> 2503 <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;DoNotUpscale=true&amp;Quality=99&amp;Format=webP&amp;image=@settings.Image.Path); background-position: center center; background-size: cover;"></div> 2504 @if (settings.ExternalParagraphId != 0) 2505 { 2506 <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"> 2507 @RenderParagraphContent(settings.ExternalParagraphId) 2508 </div> 2509 } 2510 </div> 2511 </section> 2512 } 2513 } 2514 else 2515 { 2516 @RenderArticleCleanHeader(settings); 2517 } 2518 } 2519 } 2520 2521 @helper RenderArticleOverlayHeader(ArticleHeader settings) { 2522 dynamic[] methodParameters = new dynamic[1]; 2523 methodParameters[0] = settings; 2524 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleOverlayHeaderCustom"); 2525 2526 if (customMethod != null) 2527 { 2528 @customMethod.Invoke(this, methodParameters).ToString(); 2529 } 2530 else 2531 { 2532 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12"; 2533 string contentAlignment = settings.TextLayout == ArticleHeaderTextLayout.Center ? "grid--justify-center" : ""; 2534 2535 if (settings.Image != null) 2536 { 2537 if (settings.Image.Path != null) 2538 { 2539 if (settings.ExternalParagraphId == 0) 2540 { 2541 <section class="multiple-paragraphs-container u-color-light paragraph-container--full-width"> 2542 <div class="background-image image-filter image-filter--darken dw-mod"> 2543 <div class="background-image__wrapper image-filter image-filter--darken dw-mod"> 2544 @{ 2545 settings.Image.CssClass += "background-image__cover dw-mod"; 2546 } 2547 @Render(settings.Image) 2548 </div> 2549 </div> 2550 <div class="center-container dw-mod"> 2551 <div class="grid @contentAlignment"> 2552 <div class="grid__col-md-@contentColumns grid__col-xs-12 paragraph-container paragraph-container--height-xl u-no-padding dw-mod"> 2553 @if (!String.IsNullOrEmpty(settings.Heading)) 2554 { 2555 <h1 class="article__header article__header--giant u-padding-top--lg dw-mod" style="color: @settings.TextColor">@settings.Heading</h1> 2556 } 2557 @if (!String.IsNullOrEmpty(settings.Subheading)) 2558 { 2559 <div class="article__leadtext dw-mod" style="color: @settings.TextColor">@settings.Subheading</div> 2560 } 2561 <div class="u-margin-top"> 2562 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 2563 { 2564 <small class="article__post-info u-pull--left dw-mod" style="color: @settings.TextColor">@settings.Author @settings.Date</small> 2565 } 2566 @if (settings.RatingOutOf != 0) 2567 { 2568 <div class="u-pull--right"> 2569 @Render(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) 2570 </div> 2571 } 2572 </div> 2573 @if (!String.IsNullOrEmpty(settings.Link)) 2574 { 2575 <div class="grid__cell"> 2576 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 2577 </div> 2578 } 2579 </div> 2580 </div> 2581 </div> 2582 </section> 2583 } 2584 else 2585 { 2586 @RenderArticleBanner(settings); 2587 } 2588 } 2589 } 2590 else 2591 { 2592 @RenderArticleCleanHeader(settings); 2593 } 2594 } 2595 } 2596 2597 @helper RenderArticleBannerHeader(dynamic settings) { 2598 dynamic[] methodParameters = new dynamic[1]; 2599 methodParameters[0] = settings; 2600 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleBannerHeaderCustom"); 2601 2602 if (customMethod != null) 2603 { 2604 @customMethod.Invoke(this, methodParameters).ToString(); 2605 } 2606 else 2607 { 2608 @RenderArticleBanner(settings); 2609 } 2610 } 2611 @using System.Reflection 2612 @using System.Text.RegularExpressions; 2613 @using Dynamicweb.Frontend 2614 @using Dynamicweb.Content.Items 2615 @using Dynamicweb.Rapido.Blocks.Components 2616 @using Dynamicweb.Rapido.Blocks.Components.Articles 2617 @using Dynamicweb.Rapido.Blocks 2618 2619 @* Component for the articles *@ 2620 2621 @helper RenderArticleBodyRow(ArticleBodyRow settings) 2622 { 2623 string position = settings.TopLayout == "overlay" ? "article__overlay-offset" : ""; 2624 string contentAlignment = settings.TextLayout == "center" ? "grid--justify-center" : ""; 2625 2626 <div class="grid grid--align-content-start @contentAlignment @position dw-mod"> 2627 @RenderBlockList(settings.SubBlocks) 2628 </div> 2629 } 2630 @using System.Reflection 2631 @using Dynamicweb.Rapido.Blocks.Components 2632 @using Dynamicweb.Rapido.Blocks.Components.General 2633 @using Dynamicweb.Rapido.Blocks.Components.Articles 2634 @using Dynamicweb.Rapido.Blocks 2635 2636 @* Component for the articles *@ 2637 2638 @helper RenderArticleImage(ArticleImage settings) 2639 { 2640 if (settings.Image != null) 2641 { 2642 if (settings.Image.Path != null) 2643 { 2644 <div class="u-margin-bottom--lg"> 2645 @Render(settings.Image) 2646 </div> 2647 } 2648 } 2649 } 2650 @using System.Reflection 2651 @using Dynamicweb.Rapido.Blocks.Components 2652 @using Dynamicweb.Rapido.Blocks.Components.Articles 2653 2654 2655 @* Component for the articles *@ 2656 2657 @helper RenderArticleSubHeader(ArticleSubHeader settings) 2658 { 2659 if (!String.IsNullOrEmpty(settings.Title)) 2660 { 2661 <h2 class="article__header">@settings.Title</h2> 2662 } 2663 } 2664 @using System.Reflection 2665 @using Dynamicweb.Rapido.Blocks.Components 2666 @using Dynamicweb.Rapido.Blocks.Components.Articles 2667 @using Dynamicweb.Rapido.Blocks 2668 2669 2670 @* Component for the articles *@ 2671 2672 @helper RenderArticleText(ArticleText settings) 2673 { 2674 if (!String.IsNullOrEmpty(settings.Text)) 2675 { 2676 string greatTextClass = settings.EnableLargeText == true ? "article__paragraph--great-text" : ""; 2677 2678 <div class="article__paragraph @greatTextClass dw-mod"> 2679 @settings.Text 2680 </div> 2681 } 2682 } 2683 @using System.Reflection 2684 @using Dynamicweb.Rapido.Blocks.Components 2685 @using Dynamicweb.Rapido.Blocks.Components.Articles 2686 @using Dynamicweb.Rapido.Blocks 2687 2688 2689 @* Component for the articles *@ 2690 2691 @helper RenderArticleQuote(ArticleQuote settings) 2692 { 2693 string text = Regex.Replace(settings.Text, "<.*?>", String.Empty); 2694 2695 <div class="grid u-padding-bottom--lg"> 2696 @if (settings.Image != null) 2697 { 2698 if (settings.Image.Path != null) { 2699 <div class="grid__col-3"> 2700 <div class="grid__cell-img"> 2701 @{ 2702 settings.Image.Title = !String.IsNullOrEmpty(settings.Image.Title) ? settings.Image.Title : settings.Author; 2703 settings.Image.CssClass += " article__image article__image--ball"; 2704 settings.Image.ImageDefault.Width = 200; 2705 settings.Image.ImageDefault.Height = 200; 2706 } 2707 @Render(settings.Image) 2708 </div> 2709 </div> 2710 } 2711 } 2712 <div class="grid__col-auto"> 2713 @if (!String.IsNullOrEmpty(settings.Text)) 2714 { 2715 <div class="article__quote dw-mod"> 2716 <i class="fas fa-quote-right u-margin-bottom--lg"></i> 2717 @settings.Text 2718 <i class="fas fa-quote-right"></i> 2719 </div> 2720 } 2721 @if (!String.IsNullOrEmpty(settings.Author)) 2722 { 2723 <div class="article__quote-author dw-mod"> 2724 - @settings.Author 2725 </div> 2726 } 2727 </div> 2728 </div> 2729 } 2730 @using System.Reflection 2731 @using Dynamicweb.Rapido.Blocks.Components 2732 @using Dynamicweb.Rapido.Blocks.Components.Articles 2733 @using Dynamicweb.Rapido.Blocks 2734 2735 @* Component for the articles *@ 2736 2737 @helper RenderArticleInfoTable(ArticleInfoTable settings) 2738 { 2739 <table class="table table--clean"> 2740 @foreach (var row in settings.Rows) 2741 { 2742 string iconColor = row.IconColor != null ? row.IconColor : "u-brand-color-two"; 2743 2744 <tr> 2745 @if (!String.IsNullOrEmpty(row.Icon)) 2746 { 2747 <td class="u-w32px"><i class="@row.Icon fa-2x @row.IconColor"></i></td> 2748 } 2749 <td class="u-no-margin-on-p-elements"> 2750 <div class="u-bold">@row.Title</div> 2751 @if (!String.IsNullOrEmpty(row.SubTitle)) 2752 { 2753 if (row.Link == null) 2754 { 2755 <div>@row.SubTitle</div> 2756 } 2757 else 2758 { 2759 <a href="@row.Link" class="u-color-inherit">@row.SubTitle</a> 2760 } 2761 } 2762 </td> 2763 </tr> 2764 } 2765 </table> 2766 } 2767 @using System.Reflection 2768 @using Dynamicweb.Rapido.Blocks.Components 2769 @using Dynamicweb.Rapido.Blocks.Components.General 2770 @using Dynamicweb.Rapido.Blocks.Components.Articles 2771 @using Dynamicweb.Rapido.Blocks 2772 2773 @* Component for the articles *@ 2774 2775 @helper RenderArticleGalleryModal(ArticleGalleryModal settings) 2776 { 2777 Modal galleryModal = new Modal 2778 { 2779 Id = "ParagraphGallery", 2780 Width = ModalWidth.Full, 2781 BodyTemplate = RenderArticleGalleryModalContent() 2782 }; 2783 2784 @Render(galleryModal) 2785 } 2786 2787 @helper RenderArticleGalleryModalContent() { 2788 <div class="modal__image-min-size-wrapper"> 2789 @Render(new Image { 2790 Id = "ParagraphGallery", 2791 Path = "#", 2792 CssClass = "modal--full__img", 2793 DisableLazyLoad = true, 2794 DisableImageEngine = true 2795 }) 2796 </div> 2797 2798 <div class="modal__images-counter" id="ParagraphGallery_counter"></div> 2799 2800 @Render(new Button { 2801 Id = "ParagraphGallery_prev", 2802 ButtonType = ButtonType.Button, 2803 ButtonLayout = ButtonLayout.None, 2804 CssClass = "modal__prev-btn", 2805 Icon = new Icon { Prefix = "far", Name = "fa-angle-left", LabelPosition = IconLabelPosition.After }, 2806 OnClick = "Gallery.prevImage('ParagraphGallery')" 2807 }) 2808 2809 @Render(new Button { 2810 Id = "ParagraphGallery_next", 2811 ButtonType = ButtonType.Button, 2812 ButtonLayout = ButtonLayout.None, 2813 CssClass = "modal__next-btn", 2814 Icon = new Icon { Prefix = "far", Name = "fa-angle-right", LabelPosition = IconLabelPosition.After }, 2815 OnClick = "Gallery.nextImage('ParagraphGallery')" 2816 }) 2817 } 2818 @using System.Reflection 2819 @using Dynamicweb.Rapido.Blocks.Components 2820 @using Dynamicweb.Rapido.Blocks.Components.Articles 2821 @using Dynamicweb.Rapido.Blocks 2822 2823 2824 @* Component for the articles *@ 2825 2826 @helper RenderArticleRelated(ArticleRelated settings) 2827 { 2828 string cardClass = Pageview.Device.ToString() != "Tablet" ? "card u-color-light--bg u-full-height" : ""; 2829 string cardFooterClass = Pageview.Device.ToString() != "Tablet" ? "card-footer u-color-light--bg" : ""; 2830 2831 <section class="multiple-paragraphs-container u-color-light-gray--bg paragraph-container--full-width"> 2832 <div class="center-container dw-mod"> 2833 <div class="grid u-padding"> 2834 <div class="grid__col-md-12 grid__col-xs-12"> 2835 <h2 class="article__header u-no-margin u-margin-top">@settings.Title</h2> 2836 </div> 2837 </div> 2838 2839 <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> 2840 2841 <script id="RelatedSimpleTemplate" type="text/x-template"> 2842 {{#.}} 2843 <div class="grid u-padding-bottom--lg"> 2844 {{#Cases}} 2845 <div class="grid__col-lg-3 grid__col-sm-6 image-hover--zoom dw-mod"> 2846 <a href="{{link}}" class="u-full-height u-color-light--bg u-flex u-flex--column"> 2847 {{#if image}} 2848 <div class="u-color-light--bg u-no-padding dw-mod"> 2849 <div class="flex-img image-hover__wrapper"> 2850 <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}}" /> 2851 </div> 2852 </div> 2853 {{/if}} 2854 2855 <div class="card u-color-light--bg u-full-height dw-mod"> 2856 <h3 class="article-list__item-header u-truncate-text dw-mod">{{title}}</h3> 2857 <p class="article__short-summary dw-mod">{{summary}}</p> 2858 </div> 2859 </a> 2860 </div> 2861 {{/Cases}} 2862 </div> 2863 {{/.}} 2864 </script> 2865 </div> 2866 </section> 2867 } 2868 @using System.Reflection 2869 @using Dynamicweb.Rapido.Blocks.Components 2870 @using Dynamicweb.Rapido.Blocks.Components.Articles 2871 @using Dynamicweb.Rapido.Blocks 2872 2873 2874 @* Component for the articles *@ 2875 2876 @helper RenderArticleMenu(ArticleMenu settings) 2877 { 2878 if (!String.IsNullOrEmpty(settings.Title)) { 2879 <div class="u-margin u-border-bottom"> 2880 <h3 class="u-no-margin">@settings.Title</h3> 2881 </div> 2882 } 2883 2884 <ul class="menu-left u-margin-bottom dw-mod"> 2885 @foreach (var item in settings.Items) 2886 { 2887 @Render(item) 2888 } 2889 </ul> 2890 } 2891 2892 @helper RenderArticleMenuItem(ArticleMenuItem settings) 2893 { 2894 string link = !String.IsNullOrEmpty(settings.Link) ? settings.Link : "#"; 2895 2896 if (!String.IsNullOrEmpty(settings.Title)) { 2897 <li class="menu-left__item dw-mod"> 2898 <a href="@link" onclick="@settings.OnClick" class="menu-left__link dw-mod">@settings.Title</a> 2899 </li> 2900 } 2901 } 2902 @using System.Reflection 2903 @using Dynamicweb.Rapido.Blocks.Components 2904 @using Dynamicweb.Rapido.Blocks.Components.Articles 2905 @using Dynamicweb.Rapido.Blocks 2906 2907 @* Component for the articles *@ 2908 2909 @helper RenderArticleList(ArticleList settings) 2910 { 2911 if (Pageview != null) 2912 { 2913 bool isParagraph = Pageview.CurrentParagraph != null ? true : false; 2914 string[] sortArticlesListBy = new string[2]; 2915 2916 if (isParagraph) { 2917 sortArticlesListBy = Pageview.CurrentParagraph.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString()) ? Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "DESC" }; 2918 } 2919 else { 2920 sortArticlesListBy = Pageview.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.Item["SortArticlesListBy"].ToString()) ? Pageview.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "DESC" }; 2921 } 2922 2923 string sourcePage = settings.SourcePage != null ? settings.SourcePage : Pageview.ID.ToString(); 2924 2925 if (!settings.DisablePagination) { 2926 @RenderItemList(new 2927 { 2928 ItemType = !String.IsNullOrEmpty(settings.ItemType) ? settings.ItemType : "DynamicArticle", 2929 ListSourceType = settings.SourceType, 2930 ListSourcePage = sourcePage, 2931 ItemFieldsList = "*", 2932 Filter = settings.Filter, 2933 ListOrderBy = sortArticlesListBy[0], 2934 ListOrderByDirection = sortArticlesListBy[1], 2935 ListSecondOrderBy = sortArticlesListBy[0] == "Date" ? "InFocusSortId" : "Date", 2936 ListSecondOrderByDirection = "DESC", 2937 IncludeAllChildItems = true, 2938 ListTemplate = settings.Template, 2939 ListPageSize = settings.PageSize.ToString() 2940 }); 2941 } else { 2942 @RenderItemList(new 2943 { 2944 ItemType = !String.IsNullOrEmpty(settings.ItemType) ? settings.ItemType : "DynamicArticle", 2945 ListSourceType = settings.SourceType, 2946 ListSourcePage = sourcePage, 2947 ItemFieldsList = "*", 2948 Filter = settings.Filter, 2949 ListOrderBy = sortArticlesListBy[0], 2950 ListOrderByDirection = sortArticlesListBy[1], 2951 ListSecondOrderBy = sortArticlesListBy[0] == "Date" ? "InFocusSortId" : "Date", 2952 ListSecondOrderByDirection = "DESC", 2953 IncludeAllChildItems = true, 2954 ListTemplate = settings.Template, 2955 ListPageSize = settings.PageSize.ToString(), 2956 ListViewMode = "Partial", 2957 ListShowTo = settings.PageSize + 1 2958 }); 2959 } 2960 } 2961 } 2962 @using System.Reflection 2963 @using Dynamicweb.Rapido.Blocks.Components.Articles 2964 2965 2966 @* Component for the articles *@ 2967 2968 @helper RenderArticleSummary(ArticleSummary settings) 2969 { 2970 if (!String.IsNullOrEmpty(settings.Text)) 2971 { 2972 <div class="article__summary dw-mod">@settings.Text</div> 2973 } 2974 } 2975 @using System.Reflection 2976 @using Dynamicweb.Rapido.Blocks.Components 2977 @using Dynamicweb.Rapido.Blocks.Components.Articles 2978 @using Dynamicweb.Rapido.Blocks 2979 2980 @* Component for the articles *@ 2981 2982 @helper RenderArticleListCategoryFilter(ArticleListCategoryFilter settings) 2983 { 2984 string pageId = Pageview.ID.ToString(); 2985 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("sourcePage")) ? HttpContext.Current.Request.QueryString.Get("sourcePage") : Translate("All"); 2986 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString()); 2987 2988 foreach (var option in settings.Categories) 2989 { 2990 selectedFilter = selectedFilter == option.Value ? option.Key : selectedFilter; 2991 } 2992 2993 if (selectedFilter == pageId) 2994 { 2995 selectedFilter = Translate("All"); 2996 } 2997 2998 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 2999 { 3000 <div class="u-pull--right u-margin-left"> 3001 <div class="collection u-no-margin"> 3002 <h5>@Translate("Category")</h5> 3003 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" /> 3004 <div class="dropdown u-w180px dw-mod"> 3005 <label class="dropdown__header dropdown__btn u-padding-top u-padding-bottom u-font-size--sm dw-mod" for="CategorySelector">@Translate(selectedFilter)</label> 3006 <div class="dropdown__content dw-mod"> 3007 @foreach (var option in settings.Categories) 3008 { 3009 if (Translate(option.Key) != "Produse noi" && Translate(option.Key) != "Evenimente" && Translate(option.Key) != "Promoții") 3010 { 3011 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div> 3012 } 3013 } 3014 </div> 3015 <label class="dropdown-trigger-off" for="CategorySelector"></label> 3016 </div> 3017 </div> 3018 </div> 3019 } 3020 else 3021 { 3022 <div class="u-full-width u-margin-bottom"> 3023 <h5 class="u-no-margin">@Translate("Category")</h5> 3024 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" /> 3025 <div class="dropdown u-full-width dw-mod"> 3026 <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label> 3027 <div class="dropdown__content dw-mod"> 3028 @foreach (var option in settings.Categories) 3029 { 3030 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div> 3031 } 3032 </div> 3033 <label class="dropdown-trigger-off" for="CategorySelector"></label> 3034 </div> 3035 </div> 3036 } 3037 } 3038 @using System.Reflection 3039 @using Dynamicweb.Rapido.Blocks.Components 3040 @using Dynamicweb.Rapido.Blocks.Components.Articles 3041 @using Dynamicweb.Rapido.Blocks 3042 @using System.Collections.Generic 3043 3044 @* Component for the articles *@ 3045 3046 @helper RenderArticleListFilter(ArticleListFilter settings) 3047 { 3048 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get(settings.SystemName)) ? HttpContext.Current.Request.QueryString.Get(settings.SystemName) : Translate("All"); 3049 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString()); 3050 3051 if (settings.Options != null) 3052 { 3053 if (settings.Options is IEnumerable<dynamic>) 3054 { 3055 var options = (IEnumerable<dynamic>) settings.Options; 3056 settings.Options = options.OrderBy(item => item.Name); 3057 } 3058 3059 foreach (var option in settings.Options) 3060 { 3061 selectedFilter = selectedFilter == option.Value ? option.Name : selectedFilter; 3062 } 3063 3064 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 3065 { 3066 <div class="u-pull--right u-margin-left"> 3067 <div class="collection u-no-margin"> 3068 <h5>@settings.Label</h5> 3069 <input type="checkbox" id="@(settings.SystemName)Selector" class="dropdown-trigger" /> 3070 <div class="dropdown u-w180px dw-mod"> 3071 <label class="dropdown__header dropdown__btn dw-mod" for="@(settings.SystemName)Selector">@Translate(selectedFilter)</label> 3072 <div class="dropdown__content dw-mod"> 3073 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')">@Translate("All")</div> 3074 @foreach (var option in settings.Options) 3075 { 3076 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')">@Translate(option.Name)</div> 3077 } 3078 </div> 3079 <label class="dropdown-trigger-off" for="@(settings.SystemName)Selector"></label> 3080 </div> 3081 </div> 3082 </div> 3083 } 3084 else 3085 { 3086 <div class="u-full-width u-margin-bottom"> 3087 <h5 class="u-no-margin">@settings.Label</h5> 3088 <input type="checkbox" id="@(settings.SystemName)Selector" class="dropdown-trigger" /> 3089 <div class="dropdown u-full-width w-mod"> 3090 <label class="dropdown__header dropdown__btn dw-mod" for="@(settings.SystemName)Selector">@Translate(selectedFilter)</label> 3091 <div class="dropdown__content dw-mod"> 3092 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')">@Translate("All")</div> 3093 @foreach (var option in settings.Options) 3094 { 3095 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')">@Translate(option.Name)</div> 3096 } 3097 </div> 3098 <label class="dropdown-trigger-off" for="@(settings.SystemName)Selector"></label> 3099 </div> 3100 </div> 3101 } 3102 } 3103 } 3104 @using System.Reflection 3105 @using Dynamicweb.Rapido.Blocks.Components 3106 @using Dynamicweb.Rapido.Blocks.Components.Articles 3107 @using Dynamicweb.Rapido.Blocks 3108 3109 @* Component for the articles *@ 3110 3111 @helper RenderArticleListSearch(ArticleListSearch settings) 3112 { 3113 string searchParameter = !string.IsNullOrEmpty(settings.SearchParameter) ? settings.SearchParameter : "Title"; 3114 string searchWord = HttpContext.Current.Request.QueryString.Get(searchParameter); 3115 string searchString = !string.IsNullOrEmpty(searchWord) ? searchWord.Trim('*') : ""; 3116 string className = "u-w340px u-pull--right u-margin-left"; 3117 3118 if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet") 3119 { 3120 className = "u-full-width"; 3121 } 3122 3123 <div class="typeahead u-color-inherit dw-mod @className"> 3124 <input type="text" class="typeahead-search-field u-no-margin u-padding-top--lg u-padding-bottom--lg u-font-size--sm dw-mod" placeholder="@Translate("Search in list")" value="@searchString" id="ArticleListSearchInput" onchange="QueryArray.setParameterInCurrentURL('@searchParameter', '*' + document.getElementById('ArticleListSearchInput').value + '*')"> 3125 @*<input type="text" class="typeahead-search-field u-no-margin dw-mod" placeholder="@Translate("Search in list")" value="@searchString" id="ArticleListSearchInput" onchange="QueryArray.setParametersInCurrentURL({'Title' : '*' + document.getElementById('ArticleListSearchInput').value + '*', 'ScientificName' : '*' + document.getElementById('ArticleListSearchInput').value + '*'})">*@ 3126 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod"><i class="fas fa-search"></i></button> 3127 </div> 3128 } 3129 @using System.Reflection 3130 @using Dynamicweb.Rapido.Blocks.Components 3131 @using Dynamicweb.Rapido.Blocks.Components.Articles 3132 @using Dynamicweb.Rapido.Blocks 3133 3134 @* Component for the articles *@ 3135 3136 @helper RenderArticleListNoResultsInfo(ArticleListNoResultsInfo settings) 3137 { 3138 <div class="u-margin-top--lg u-bold u-ta-center u-bold">@Translate(settings.Message)</div> 3139 } 3140 @using System.Reflection 3141 @using Dynamicweb.Rapido.Blocks.Components 3142 @using Dynamicweb.Rapido.Blocks.Components.General 3143 @using Dynamicweb.Rapido.Blocks.Components.Articles 3144 @using Dynamicweb.Rapido.Blocks 3145 @using System.Text.RegularExpressions 3146 3147 @* Component for the articles *@ 3148 3149 @helper RenderArticleListItem(ArticleListItem settings) 3150 { 3151 switch (settings.Type) { 3152 case ArticleListItemType.Card: 3153 @RenderArticleListItemCard(settings); 3154 break; 3155 case ArticleListItemType.List: 3156 @RenderArticleListItemList(settings); 3157 break; 3158 case ArticleListItemType.Simple: 3159 @RenderArticleListItemSimple(settings); 3160 break; 3161 default: 3162 @RenderArticleListItemCard(settings); 3163 break; 3164 } 3165 } 3166 3167 @helper RenderArticleListItemCard(ArticleListItem settings) { 3168 <a href="@settings.Link" class="u-full-height u-color-light--bg u-flex u-flex--column"> 3169 <div class="u-color-light--bg u-no-padding dw-mod"> 3170 @if (settings.Logo != null) 3171 { 3172 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;" : ""; 3173 settings.Logo.ImageDefault.Crop = 5; 3174 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width; 3175 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height; 3176 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage"> 3177 @if (settings.Stickers != null) 3178 { 3179 if (settings.Stickers.Position != StickersListPosition.Custom && settings.Stickers.Position != StickersListPosition.None) 3180 { 3181 @Render(settings.Stickers); 3182 } 3183 } 3184 @RenderImage(settings.Logo) 3185 </div> 3186 } else if (settings.Image != null) 3187 { 3188 <div class="flex-img image-hover__wrapper u-position-relative dw-mod"> 3189 @if (settings.Stickers != null) 3190 { 3191 if (settings.Stickers.Position != StickersListPosition.Custom && settings.Stickers.Position != StickersListPosition.None) 3192 { 3193 @Render(settings.Stickers); 3194 } 3195 } 3196 @Render(settings.Image) 3197 </div> 3198 } 3199 </div> 3200 3201 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary)) 3202 { 3203 <div class="card u-color-light--bg u-full-height dw-mod"> 3204 @if (settings.Stickers != null) 3205 { 3206 if (settings.Stickers.Position == StickersListPosition.Custom) 3207 { 3208 @Render(settings.Stickers); 3209 } 3210 } 3211 @if (!String.IsNullOrEmpty(settings.Title)) 3212 { 3213 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3> 3214 } 3215 @if (!String.IsNullOrEmpty(settings.SubTitle)) 3216 { 3217 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 3218 } 3219 @if (!String.IsNullOrEmpty(settings.Summary)) 3220 { 3221 <p class="article__short-summary dw-mod">@settings.Summary</p> 3222 } 3223 3224 </div> 3225 } 3226 </a> 3227 } 3228 3229 @helper RenderArticleListItemList(ArticleListItem settings) { 3230 <a href="@settings.Link"> 3231 3232 3233 <div class="grid u-color-light--bg custom-article-list u-no-padding dw-mod"> 3234 3235 <div class="grid__col-md-3"> 3236 <div class="u-color-light--bg u-no-padding dw-mod"> 3237 @if (settings.Logo != null) 3238 { 3239 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;" : ""; 3240 settings.Logo.ImageDefault.Crop = 5; 3241 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width; 3242 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height; 3243 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage"> 3244 @* 3245 @if (settings.Stickers != null) 3246 { 3247 if (settings.Stickers.Position != StickersListPosition.Custom) 3248 { 3249 @Render(settings.Stickers); 3250 } 3251 } 3252 *@ 3253 @RenderImage(settings.Logo) 3254 </div> 3255 } 3256 else if (settings.Image != null) 3257 { 3258 <div class="flex-img image-hover__wrapper dw-mod"> 3259 @* 3260 @if (settings.Stickers != null) 3261 { 3262 if (settings.Stickers.Position != StickersListPosition.Custom) 3263 { 3264 @Render(settings.Stickers); 3265 } 3266 } 3267 *@ 3268 @Render(settings.Image) 3269 </div> 3270 } 3271 </div> 3272 </div> 3273 3274 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary)) 3275 { 3276 <div class="grid__col-md-9"> 3277 @Render(settings.Stickers) 3278 3279 @if (!String.IsNullOrEmpty(settings.Title)) 3280 { 3281 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3> 3282 } 3283 @if (settings.Stickers != null) 3284 { 3285 if (settings.Stickers.Position == StickersListPosition.Custom) 3286 { 3287 @Render(settings.Stickers) 3288 ; 3289 } 3290 } 3291 @if (!String.IsNullOrEmpty(settings.SubTitle)) 3292 { 3293 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 3294 } 3295 @if (!String.IsNullOrEmpty(settings.Summary)) 3296 { 3297 <p class="article__short-summary dw-mod">@settings.Summary</p> 3298 } 3299 @if (!String.IsNullOrEmpty(settings.Link)) 3300 { 3301 <a href="@settings.Link">@Translate("Mai mult >", "Mai mult >")</a> 3302 } 3303 </div> 3304 } 3305 </div> 3306 </a> 3307 } 3308 3309 @helper RenderArticleListItemSimple(ArticleListItem settings) { 3310 <a href="@settings.Link" class="u-color-inherit"> 3311 <div class="grid u-color-light--bg u-no-padding dw-mod"> 3312 <div class="grid__col-md-12"> 3313 @if (!String.IsNullOrEmpty(settings.Title)) 3314 { 3315 <div class="article-list-item__header test u-truncate-text u-no-margin dw-mod">@settings.Title</div> 3316 3317 } 3318 @if (!String.IsNullOrEmpty(settings.SubTitle)) 3319 { 3320 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 3321 } 3322 </div> 3323 </div> 3324 </a> 3325 } 3326 @using System.Reflection 3327 @using Dynamicweb.Rapido.Blocks.Components.Articles 3328 3329 3330 @* Component for the articles *@ 3331 3332 @helper RenderArticleAuthorAndDate(ArticleAuthorAndDate settings) 3333 { 3334 <small class="article__subscription"> 3335 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date))) 3336 { 3337 <text>@Translate("Written")</text> 3338 } 3339 @if (!string.IsNullOrWhiteSpace(settings.Author)) 3340 { 3341 <text>@Translate("by") @settings.Author</text> 3342 } 3343 @if (!string.IsNullOrWhiteSpace(settings.Date)) 3344 { 3345 <text>@Translate("on") @settings.Date</text> 3346 } 3347 </small> 3348 } 3349 @using System.Reflection 3350 @using Dynamicweb.Rapido.Blocks.Components.Articles 3351 @using Dynamicweb.Rapido.Blocks.Components.General 3352 3353 3354 @* Component for the articles *@ 3355 3356 @helper RenderArticleLink(ArticleLink settings) 3357 { 3358 if (!string.IsNullOrEmpty(settings.Title)) 3359 { 3360 Button link = new Button { 3361 ConfirmText = settings.ConfirmText, 3362 ConfirmTitle = settings.ConfirmTitle, 3363 ButtonType = settings.ButtonType, 3364 Id = settings.Id, 3365 Title = settings.Title, 3366 AltText = settings.AltText, 3367 OnClick = settings.OnClick, 3368 CssClass = settings.CssClass, 3369 Disabled = settings.Disabled, 3370 Icon = settings.Icon, 3371 Name = settings.Name, 3372 Href = settings.Href, 3373 ButtonLayout = settings.ButtonLayout, 3374 ExtraAttributes = settings.ExtraAttributes 3375 }; 3376 <div class="grid__cell"> 3377 @Render(link) 3378 </div> 3379 } 3380 } 3381 @using System.Reflection 3382 @using Dynamicweb.Rapido.Blocks 3383 @using Dynamicweb.Rapido.Blocks.Components.Articles 3384 @using Dynamicweb.Rapido.Blocks.Components.General 3385 3386 3387 @* Component for the articles *@ 3388 3389 @helper RenderArticleCarousel(ArticleCarousel settings) 3390 { 3391 <div class="grid"> 3392 <div class="grid__col-12 u-no-padding u-margin-bottom"> 3393 <div class="carousel" id="carousel_@settings.Id"> 3394 <div class="carousel__container js-carousel-slides dw-mod"> 3395 @RenderBlockList(settings.SubBlocks) 3396 </div> 3397 </div> 3398 </div> 3399 </div> 3400 3401 <script> 3402 document.addEventListener("DOMContentLoaded", function () { 3403 new CarouselModule("#carousel_@settings.Id", { 3404 slideTime: 0, 3405 dots: true 3406 }); 3407 }); 3408 </script> 3409 } 3410 3411 @helper RenderArticleCarouselSlide(ArticleCarouselSlide settings) 3412 { 3413 string imageEngine = "/Admin/Public/GetImage.ashx?"; 3414 3415 string defaultImage = settings.ImageSettings != null ? imageEngine : settings.Image; 3416 if (settings.ImageSettings != null) 3417 { 3418 defaultImage += settings.ImageSettings.Width != 0 ? "Width=" + settings.ImageSettings.Width + "&" : ""; 3419 defaultImage += settings.ImageSettings.Height != 0 ? "Height=" + settings.ImageSettings.Height + "&" : ""; 3420 defaultImage += "Crop=" + settings.ImageSettings.Crop + "&"; 3421 defaultImage += "Compression=" + settings.ImageSettings.Compression + "&"; 3422 defaultImage += "DoNotUpscale=" + settings.ImageSettings.DoNotUpscale.ToString() + "&"; 3423 defaultImage += "FillCanvas=" + settings.ImageSettings.FillCanvas.ToString() + "&"; 3424 } 3425 defaultImage += "&Image=" + settings.Image; 3426 3427 <div class="carousel__slide u-min-h300px u-flex dw-mod" style="background-size:cover; background-image:url('@defaultImage')"> 3428 <a class="article-carousel-item__wrap" href="@settings.Link" title="@settings.Title"> 3429 <h2 class="article-list__item-header u-truncate-text u-color-light dw-mod">@settings.Title</h2> 3430 <div class="article-list__item-info"> 3431 @if (settings.Stickers != null) 3432 { 3433 settings.Stickers.Position = StickersListPosition.Custom; 3434 @Render(settings.Stickers); 3435 } 3436 3437 <small class="u-margin-top--lg u-color-light"> 3438 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date))) 3439 { 3440 <text>@Translate("Written")</text> 3441 } 3442 @if (!string.IsNullOrWhiteSpace(settings.Author)) 3443 { 3444 <text>@Translate("by") @settings.Author</text> 3445 } 3446 @if (!string.IsNullOrWhiteSpace(settings.Date)) 3447 { 3448 <text>@Translate("on") @settings.Date</text> 3449 } 3450 </small> 3451 </div> 3452 3453 <h3 class="article__short-summary u-color-light">@settings.Summary</h3> 3454 </a> 3455 @if (settings.UseFilters == true) 3456 { 3457 <div class="background-image image-filter image-filter--darken dw-mod"></div> 3458 } 3459 </div> 3460 } 3461 @using System.Text.RegularExpressions 3462 @using Dynamicweb.Rapido.Blocks.Components 3463 @using Dynamicweb.Rapido.Blocks.Components.General 3464 @using Dynamicweb.Rapido.Blocks.Components.Articles 3465 @using Dynamicweb.Rapido.Blocks 3466 3467 @* Component for the articles *@ 3468 3469 @helper RenderArticleVideo(ArticleVideo settings) 3470 { 3471 if (settings.Url != null) 3472 { 3473 //getting video ID from youtube URL 3474 string videoCode = settings.Url; 3475 Regex regex = new Regex(@".be\/(.[^?]*)"); 3476 Match match = regex.Match(videoCode); 3477 string videoId = ""; 3478 if (match.Success) 3479 { 3480 videoId = match.Groups[1].Value; 3481 } 3482 else 3483 { 3484 regex = new Regex(@"v=([^&]+)"); 3485 match = regex.Match(videoCode); 3486 if (match.Success) 3487 { 3488 videoId = match.Groups[1].Value; 3489 } 3490 } 3491 3492 int autoPlay = settings.AutoPlay == "true" ? 1 : 0; 3493 3494 <div class="video-wrapper"> 3495 <div class="js-youtube-video" data-video="@videoId" id="ytPlayer@(Guid.NewGuid().ToString("N"))" data-auto-play="@autoPlay" data-enable-controls="1"></div> 3496 </div> 3497 } 3498 } 3499 @using System.Reflection 3500 @using Dynamicweb.Rapido.Blocks.Components 3501 @using Dynamicweb.Rapido.Blocks.Components.Articles 3502 @using Dynamicweb.Rapido.Blocks 3503 3504 3505 @functions{ 3506 BlocksPage articlePageComponent = BlocksPage.GetBlockPage("DynamicArticle"); 3507 public class DF_ArticleParagraph : ComponentBase 3508 { 3509 public ItemViewModel ParagraphContent {get; set;} 3510 public int counter {get; set;} 3511 public string imageColumns {get; set;} 3512 public string imageLayout {get; set;} 3513 public string contentColumns {get; set;} 3514 } 3515 3516 } 3517 3518 @helper RenderDF_ArticleParagraph(DF_ArticleParagraph settings) 3519 { 3520 ItemViewModel paragraph = settings.ParagraphContent; 3521 int count = settings.counter; 3522 string imageColumns = settings.imageColumns; 3523 string imageLayout = settings.imageLayout; 3524 string contentColumns = settings.contentColumns; 3525 3526 3527 3528 string paragraphListHeading = "12"; 3529 var contentPosition = paragraph.GetList("ContentPosition") != null ? paragraph.GetList("ContentPosition").SelectedValue : ""; 3530 //content position 3531 // number 5 is a random one to make the first item greater than second one 3532 var contentCountTextDecisionFirst = contentPosition == "left" || contentPosition == "top" ? 1 : 0; 3533 var contentCountImageDecisionFirst = contentPosition == "left" || contentPosition == "top" ? 5 : 0; 3534 var contentCountTextDecisionSecond = contentPosition == "right" || contentPosition == "bottom" ? 5 : 0; 3535 var contentCountImageDecisionSecond = contentPosition == "right" || contentPosition == "bottom" ? 1 : 0; 3536 3537 var paragraphTextColumn = contentPosition == "top" || contentPosition == "bottom" ? "12" : "6"; 3538 var paragraphImageColumn = contentPosition == "top" || contentPosition == "bottom" ? "12" : "6"; 3539 3540 3541 3542 if (!paragraph.GetBoolean("RenderAsQuote")) 3543 { 3544 //string enableDropCap = Model.Item.GetString("EnableDropCap") != null ? Model.Item.GetList("EnableDropCap").SelectedValue.ToLower() : "default"; 3545 //enableDropCap = enableDropCap == "default" && GetParentSettingsItem("EnableDropCap") != null ? GetParentSettingsItem("EnableDropCap").ToString().ToLower() : enableDropCap; 3546 string text = paragraph.GetString("Text") != null ? paragraph.GetString("Text") : ""; 3547 3548 //if (!String.IsNullOrEmpty(text) && enableDropCap == "true" && count == 0 && paragraph.GetString("Text").Substring(0, 3) == "<p>") 3549 //{ 3550 // string firstLetter = paragraph.GetString("Text").Substring(3, 1); 3551 // text = paragraph.GetString("Text").Remove(3, 1); 3552 // text = text.Insert(3, "<span class=\"article__drop-cap\">" + firstLetter + "</span>"); 3553 // } 3554 3555 if (!String.IsNullOrEmpty(paragraph.GetString("Heading"))) 3556 { 3557 var hideHeading = paragraph.GetBoolean("HideHeading"); 3558 var hideHeadingClass = hideHeading == true ? "u-hidden" : ""; 3559 3560 Block articleParagraphHeader = new Block 3561 { 3562 Id = "ArticleParagraph" + count + "Heading", 3563 SortId = (count * 10), 3564 Component = new ArticleSubHeader { Title = paragraph.GetString("Heading") }, 3565 Design = new Design 3566 { 3567 RenderType = RenderType.Column, 3568 Size = paragraphListHeading, 3569 CssClass = String.Format("u-color-light--bg u-padding--lg {0}", hideHeadingClass) 3570 } 3571 }; 3572 articlePageComponent.Add("ArticleParagraph" + count, articleParagraphHeader); 3573 } 3574 3575 if (paragraph.GetFile("Image") != null) 3576 { 3577 string imageTitle = !string.IsNullOrEmpty(paragraph.GetString("Heading")) ? paragraph.GetString("Heading") : ""; 3578 3579 Block articleParagraphImage = new Block 3580 { 3581 Id = "ArticleParagraph" + count + "Image", 3582 SortId = (count * 10) + 2 + contentCountImageDecisionFirst + contentCountImageDecisionSecond, 3583 Design = new Design 3584 { 3585 RenderType = RenderType.Column, 3586 Size = paragraphImageColumn, 3587 CssClass = "u-color-light--bg u-padding--lg" 3588 } 3589 }; 3590 3591 if (imageLayout == "banner") 3592 { 3593 ArticleBanner banner = new ArticleBanner 3594 { 3595 Image = new Image { Path = paragraph.GetFile("Image"), ImageDefault = new ImageSettings { Height = 650, Width = 1300 }, Caption = paragraph.GetString("ImageCaption") }, 3596 Heading = imageTitle, 3597 UseFilters = false 3598 }; 3599 articleParagraphImage.Component = banner; 3600 } 3601 else 3602 { 3603 ArticleImage image = new ArticleImage 3604 { 3605 Image = new Image 3606 { 3607 Path = paragraph.GetFile("Image"), 3608 Title = imageTitle, 3609 ImageDefault = new ImageSettings { Height = 650, Width = 1300 }, 3610 Caption = paragraph.GetString("ImageCaption") 3611 } 3612 }; 3613 articleParagraphImage.Component = image; 3614 } 3615 3616 articlePageComponent.Add("ArticleParagraph" + count, articleParagraphImage); 3617 } 3618 3619 3620 if (!String.IsNullOrEmpty(text)) 3621 { 3622 Block articleParagraphText = new Block 3623 { 3624 Id = "ArticleParagraph" + count + "Text", 3625 SortId = (count * 10) + 3 + contentCountTextDecisionFirst + contentCountTextDecisionSecond, 3626 Component = new ArticleText { Text = text }, 3627 Design = new Design 3628 { 3629 RenderType = RenderType.Column, 3630 Size = paragraphTextColumn, 3631 CssClass = "u-color-light--bg u-padding--lg" 3632 } 3633 }; 3634 3635 articlePageComponent.Add("ArticleParagraph" + count, articleParagraphText); 3636 } 3637 3638 if (!String.IsNullOrEmpty(paragraph.GetString("VideoURL"))) 3639 { 3640 Block articleParagraphVideo = new Block 3641 { 3642 Id = "ArticleParagraph" + count + "Video", 3643 SortId = (count * 10) + 1, 3644 Component = new ArticleVideo { Url = paragraph.GetString("VideoURL"), AutoPlay = "false" }, 3645 Design = new Design 3646 { 3647 RenderType = RenderType.Column, 3648 Size = imageColumns, 3649 CssClass = "u-color-light--bg u-padding--lg" 3650 } 3651 }; 3652 articlePageComponent.Add("ArticleParagraph" + count, articleParagraphVideo); 3653 } 3654 } 3655 else 3656 { 3657 if (!String.IsNullOrEmpty(paragraph.GetString("Text"))) 3658 { 3659 string quoteText = paragraph.GetString("Text") != null ? paragraph.GetString("Text") : ""; 3660 string quoteAuthor = paragraph.GetString("Heading") != null ? paragraph.GetString("Heading") : ""; 3661 3662 Block articleParagraphQuote = new Block 3663 { 3664 Id = "ArticleParagraph" + count + "Quote", 3665 SortId = (count * 10) + 3, 3666 Component = new ArticleQuote { Image = new Image { Path = paragraph.GetFile("Image") }, Text = quoteText, Author = quoteAuthor }, 3667 Design = new Design 3668 { 3669 RenderType = RenderType.Column, 3670 Size = contentColumns, 3671 CssClass = "u-color-light--bg u-padding--lg" 3672 } 3673 }; 3674 articlePageComponent.Add("ArticleParagraph" + count, articleParagraphQuote); 3675 } 3676 } 3677 3678 3679 } 3680 3681 @using System.Reflection 3682 @using Dynamicweb.Rapido.Blocks.Components 3683 @using Dynamicweb.Rapido.Blocks.Components.Articles 3684 @using Dynamicweb.Rapido.Blocks 3685 3686 @functions{ 3687 //BlocksPage articlePageComponent = BlocksPage.GetBlockPage("DynamicArticle"); 3688 public class DF_RelatedProducts : ComponentBase 3689 { 3690 public string Title {get; set;} 3691 public string Id {get; set;} 3692 public string FeedPageId {get; set;} 3693 public string Query {get; set;} 3694 public string CurrentPageId {get; set;} 3695 public string CurrentProductId {get; set;} 3696 public int PageSize {get; set;} 3697 public bool productManual {get; set;} 3698 } 3699 } 3700 3701 @helper RenderDF_RelatedProducts(DF_RelatedProducts settings) 3702 { 3703 <section class="multiple-paragraphs-container paragraph-container--full-width article--related-products"> 3704 <div class="center-container dw-mod"> 3705 <div class="grid u-padding"> 3706 <div class="grid__col-md-12 grid__col-xs-12"> 3707 <h2 class="article__header u-no-margin u-margin-top">@settings.Title</h2> 3708 </div> 3709 </div> 3710 @if(settings.productManual == false) { 3711 <div class="js-handlebars-root false u-padding" id="@settings.Id" data-template="ProductContainer" data-json-feed="/Default.aspx?ID=@settings.FeedPageId&@settings.Query&ExcludeItemID=@settings.CurrentPageId&PageSize=@settings.PageSize"></div> 3712 } else { 3713 <div class="js-handlebars-root true u-padding" id="@settings.Id" data-template="ProductContainer" data-json-feed="@settings.FeedPageId"></div> 3714 } 3715 3716 <script id="ProductContainer" type="text/x-template"> 3717 {{#.}} 3718 <div class="u-min-h400px u-full-width"> 3719 <div class="grid"> 3720 {{#ifCond totalPages '>' 1}} 3721 <div class="grid__col-45px grid__col--bleed-x content-promotion__buttons prev"> 3722 <div class="grid__cell grid__cell--align-middle-left"> 3723 @{ 3724 Button prevButton = new Button { Icon = new Icon { Prefix = "fas", Name = "fa-chevron-left fa-2x", LabelPosition = IconLabelPosition.After }, ButtonLayout = ButtonLayout.Clean, CssClass = "btn--condensed {{prevdisabled}} u-position-relative", OnClick = "HandlebarsBolt.UpdateContent('" + settings.Id + "', '{{prevPage}}')" }; 3725 prevButton.ExtraAttributes.Add("", "{{prevdisabled}}"); 3726 } 3727 @Render(prevButton) 3728 </div> 3729 </div> 3730 {{/ifCond}} 3731 <div class="grid__col-auto grid__col--bleed-x content-promotion__products"> 3732 <div id="ProductsContainer" data-template="ProductGridItemContainer" class="grid product-list dw-mod" data-save-cookie="true"> 3733 {{#ProductsContainer}} 3734 <div id="Product{{productId}}" class="grid__col-3 product-list__grid-item dw-mod"> 3735 {{#Product}} 3736 <div class="grid__col--auto js-product-scroll-trigger u-no-padding u-full-height" data-params="{{googleImpression}}"> 3737 <div class="grid__cell product-list__grid-item__image dw-mod {{noImage}}"> 3738 <a href="{{link}}" 3739 onclick="{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}" 3740 class="u-block u-position-relative image-hover__wrapper dw-mod"> 3741 @Render(new Image { Path = "{{image}}", ImageDefault = new ImageSettings { Width = 300, Height = 300, Crop = 5, FillCanvas = true, DoNotUpscale = true }, Title = "{{name}}", CssClass = "grid__cell-img grid__cell-img--centered u-min-h180px" }) 3742 {{#StickersContainers}} 3743 {{>StickersContainer}} 3744 {{/StickersContainers}} 3745 </a> 3746 3747 <div class="favorites favorites--for-grid-view u-pull--right {{hasVariants}} dw-mod" {{hasVariants}}> 3748 {{#Favorite}} 3749 {{>FavoriteTemplate}} 3750 {{/Favorite}} 3751 </div> 3752 3753 </div> 3754 3755 <div class="grid__cell product-list__grid-item__price-info dw-mod"> 3756 <a href="{{link}}" onclick="{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}" title="{{name}}" class="u-color-inherit"> 3757 @Render(new Heading { Title = "{{name}}", Level = 6, CssClass = "u-condensed-text u-bold" }) 3758 </a> 3759 @RenderGridViewPriceInfo() 3760 </div> 3761 3762 <div class="product-list__grid-item__footer dw-mod"> 3763 @RenderProductGridItemAddToCart() 3764 </div> 3765 </div> 3766 {{/Product}} 3767 </div> 3768 {{/ProductsContainer}} 3769 </div> 3770 </div> 3771 {{#ifCond totalPages '>' 1}} 3772 <div class="grid__col-45px grid__col--bleed-x content-promotion__buttons next"> 3773 <div class="grid__cell grid__cell--align-middle-right"> 3774 @{ 3775 Button nextButton = new Button { Icon = new Icon { Prefix = "fas", Name = "fa-chevron-right fa-2x", LabelPosition = IconLabelPosition.After }, ButtonLayout = ButtonLayout.Clean, CssClass = "btn--condensed {{nextdisabled}} u-position-relative", OnClick = "HandlebarsBolt.UpdateContent('" + settings.Id + "', '{{nextPage}}')" }; 3776 nextButton.ExtraAttributes.Add("", "{{nextdisabled}}"); 3777 } 3778 @Render(nextButton) 3779 </div> 3780 </div> 3781 {{/ifCond}} 3782 </div> 3783 </div> 3784 {{/.}} 3785 </script> 3786 <script id="StickersContainer" type="text/x-template"> 3787 <div class="stickers-container stickers-container--{{{convertStickerPositionToClassName Position}}} dw-mod"> 3788 {{#Stickers}} 3789 {{>Sticker}} 3790 {{/Stickers}} 3791 </div> 3792 </script> 3793 3794 <script id="Sticker" type="text/x-template"> 3795 @Render(new Sticker { Title = "{{Title}}", CssClass = "{{CssClass}}" }) 3796 </script> 3797 3798 <script> 3799 @{ 3800 bool relatedUseGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 3801 3802 if (relatedUseGoogleTagManager) 3803 { 3804 <text> 3805 document.addEventListener("DOMContentLoaded", function (event) { 3806 Scroll.AddIsInViewportListener(".js-product-scroll-trigger", function (elem) { 3807 let googleImpression = JSON.parse(elem.getAttribute("data-params")); 3808 googleImpression.list = "Related products"; 3809 googleEnchantImpression(googleImpression); 3810 elem.classList.remove("js-product-scroll-trigger"); 3811 }); 3812 }); 3813 </text> 3814 } 3815 } 3816 </script> 3817 </div> 3818 </section> 3819 } 3820 3821 @helper RenderGridViewPriceInfo() 3822 { 3823 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 3824 bool showPrice = !Pageview.AreaSettings.GetItem("ProductList").GetBoolean("HidePrice"); 3825 bool showCartButton = Pageview.AreaSettings.GetItem("ProductList").GetItem("GridView").GetBoolean("ShowAddToCartButton"); 3826 bool showVATPrice = Pageview.AreaSettings.GetItem("ProductList").GetBoolean("ShowBothPricesWithWithoutVAT"); 3827 bool isPricesWithVATEnabled = Dynamicweb.Ecommerce.Common.Context.DisplayPricesWithVat; 3828 3829 if (showPrice && Dynamicweb.Rapido.Services.User.IsPricesAllowed()) 3830 { 3831 if (pointShopOnly) 3832 { 3833 <text> 3834 {{#if havePointPrice}} 3835 <div class="price price--product-list dw-mod">{{points}} @Translate("points")</div> 3836 @if (showCartButton) 3837 { 3838 <text> 3839 {{#unless canBePurchasedWithPoints}} 3840 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small> 3841 {{/unless}} 3842 </text> 3843 } 3844 {{else}} 3845 @Translate("Not available") 3846 {{/if}} 3847 </text> 3848 } 3849 else 3850 { 3851 <div class="price price--product-list dw-mod">{{price}}</div> 3852 <div class="before-price {{onSale}} dw-mod">{{discount}}</div> 3853 if (showVATPrice) 3854 { 3855 <div class="vat-price vat-price--product-list u-margin-top dw-mod"> 3856 @if (isPricesWithVATEnabled) 3857 { 3858 <span>@Translate("excl. VAT")</span><span> ({{priceWithoutVAT}})</span> 3859 } 3860 else 3861 { 3862 <span>@Translate("incl. VAT")</span><span> ({{priceWithVAT}})</span> 3863 } 3864 </div> 3865 } 3866 <text> 3867 {{#if priceRRP}} 3868 <div><small>@Translate("RRP") {{priceRRP}}</small></div> 3869 {{/if}} 3870 </text> 3871 } 3872 } 3873 } 3874 3875 @helper RenderProductGridItemAddToCart() { 3876 var gridViewSettings = Pageview.AreaSettings.GetItem("ProductList").GetItem("GridView"); 3877 var ecommerceSettings = Pageview.AreaSettings.GetItem("Ecommerce"); 3878 3879 bool pointShopOnly = ecommerceSettings.GetBoolean("PointShopOnly"); 3880 bool showCartButton = gridViewSettings.GetBoolean("ShowAddToCartButton"); 3881 bool showViewButton = gridViewSettings.GetBoolean("ShowViewButton"); 3882 string viewMoreText = gridViewSettings.GetString("ViewMoreText"); 3883 viewMoreText = !string.IsNullOrEmpty(viewMoreText) ? viewMoreText : "View"; 3884 string wrapperClass = "buttons-collection--center"; 3885 int columnsCount = gridViewSettings.GetList("Columns") != null ? Converter.ToInt32(gridViewSettings.GetList("Columns").SelectedValue) : 4; 3886 bool hideButtonText = columnsCount >= 4 || Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet"; 3887 3888 if (pointShopOnly && columnsCount <= 4) 3889 { 3890 hideButtonText = false; 3891 } 3892 3893 var viewBtn = new Link 3894 { 3895 Href = "{{link}}", 3896 Id = "CartButton_{{id}}", 3897 Title = Translate(viewMoreText), 3898 OnClick = "{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}", 3899 ButtonLayout = ButtonLayout.Secondary, 3900 CssClass = "u-no-margin" 3901 }; 3902 3903 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed()) 3904 { 3905 var addToCartBtn = new AddToCart 3906 { 3907 WrapperCssClass = wrapperClass, 3908 AddButton = new AddToCartButton 3909 { 3910 ProductId = "{{productId}}", 3911 VariantId = "{{variantid}}", 3912 UnitId = "{{unitId}}", 3913 ProductInfo = "{{productInfo}}", 3914 BuyForPoints = pointShopOnly, 3915 HideTitle = hideButtonText, 3916 OnClick = "{{facebookPixelAction}}", 3917 ExtraAttributes = new Dictionary<string, string> 3918 { 3919 { "{{disabledBuyButton}}", "" } 3920 } 3921 } 3922 }; 3923 3924 if (!pointShopOnly) 3925 { 3926 addToCartBtn.QuantitySelector = new QuantitySelector 3927 { 3928 Id = "Quantity{{id}}" 3929 }; 3930 } 3931 3932 if (showCartButton && Dynamicweb.Rapido.Services.User.IsBuyingAllowed()) 3933 { 3934 if (!showViewButton) 3935 { 3936 @Render(addToCartBtn) 3937 } 3938 else 3939 { 3940 <text>{{#if hideAddToCartButton}}</text> 3941 <div>@Render(viewBtn)</div> 3942 <text>{{else}}</text> 3943 @Render(addToCartBtn) 3944 <text>{{/if}}</text> 3945 } 3946 } 3947 else if (showViewButton) 3948 { 3949 <div>@Render(viewBtn)</div> 3950 } 3951 } 3952 else if (showViewButton) 3953 { 3954 <div>@Render(viewBtn)</div> 3955 } 3956 } 3957 3958 @* Simple helpers *@ 3959 3960 @*Requires the Gallery ItemType that comes with Rapido*@ 3961 @helper RenderArticleItemGallery(IList<ItemViewModel> gallery) { 3962 if (gallery != null && gallery.Count > 0) 3963 { 3964 int count = 1; 3965 3966 foreach (var item in gallery) 3967 { 3968 if (item.GetFile("ImagePath") != null) 3969 { 3970 string image = item.GetFile("ImagePath").PathUrlEncoded; 3971 string imagePrefix = "/Admin/Public/GetImage.ashx?width=1200&amp;height=820&amp;crop=5&amp;Compression=75&amp;DoNotUpscale=1&amp;image="; 3972 int imagesCount = gallery.Count; 3973 3974 if (count == 1) 3975 { 3976 <label class="gallery" for="ParagraphGalleryModalTrigger" onclick="Gallery.openImage(this.querySelector('.js-gallery'))"> 3977 <span class="gallery__main-image"> 3978 <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" /> 3979 </span> 3980 <span class="gallery__image-counter"> 3981 <i class="fas fa-camera fa-2x"></i> <span class="gallery__image-counter__number">@imagesCount</span> 3982 <span class="gallery__image-counter__text">@Translate("See all") <i class="fas fa-angle-right"></i></span> 3983 </span> 3984 </label> 3985 } 3986 else 3987 { 3988 <div class="u-hidden js-gallery" data-for="ParagraphGallery" data-image="@imagePrefix@image"></div> 3989 } 3990 3991 count++; 3992 } 3993 } 3994 3995 @Render(new ArticleGalleryModal()) 3996 } 3997 } 3998 3999 @helper RenderMobileFilters(List<Block> subBlocks) 4000 { 4001 if (subBlocks.Count > 0) 4002 { 4003 <div class="grid__col-12"> 4004 <input type="checkbox" id="CheckFilters" class="js-remember-state u-hidden" data-expand="CheckFilters" /> 4005 <div class="grid u-margin-bottom dw-mod" data-trigger="CheckFilters"> 4006 @RenderBlockList(subBlocks) 4007 </div> 4008 <label for="CheckFilters" class="btn btn--secondary btn--full dw-mod js-expand-hide" data-trigger="CheckFilters">@Translate("Select filters")</label> 4009 <label for="CheckFilters" class="btn btn--secondary btn--full dw-mod expandable--collapsed" data-trigger="CheckFilters">@Translate("Close filters")</label> 4010 </div> 4011 } 4012 } 4013 4014 4015 @* Include the Blocks for the page *@ 4016 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 4017 4018 @using System 4019 @using System.Web 4020 @using System.Collections.Generic 4021 @using Dynamicweb.Rapido.Blocks.Extensibility 4022 @using Dynamicweb.Rapido.Blocks 4023 4024 @functions { 4025 string GoogleTagManagerID = ""; 4026 string GoogleAnalyticsID = ""; 4027 } 4028 4029 @{ 4030 GoogleTagManagerID = Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID"); 4031 GoogleAnalyticsID = Model.Area.Item.GetItem("Settings").GetString("GoogleAnalyticsTrackingID"); 4032 4033 BlocksPage topSnippetsBlocksPage = BlocksPage.GetBlockPage("Master"); 4034 4035 if (!string.IsNullOrWhiteSpace(GoogleAnalyticsID)) 4036 { 4037 Block tagManager = new Block() 4038 { 4039 Id = "GoogleAnalytics", 4040 SortId = 0, 4041 Template = RenderGoogleAnalyticsSnippet() 4042 }; 4043 topSnippetsBlocksPage.Add("Head", tagManager); 4044 } 4045 4046 if (!string.IsNullOrWhiteSpace(GoogleTagManagerID)) 4047 { 4048 Block tagManager = new Block() 4049 { 4050 Id = "TagManager", 4051 SortId = 1, 4052 Template = RenderGoogleTagManager() 4053 }; 4054 topSnippetsBlocksPage.Add("Head", tagManager); 4055 4056 Block tagManagerBodySnippet = new Block() 4057 { 4058 Id = "TagManagerBodySnippet", 4059 SortId = 1, 4060 Template = RenderGoogleTagManagerBodySnippet() 4061 }; 4062 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, tagManagerBodySnippet); 4063 } 4064 4065 Block facebookPixel = new Block() 4066 { 4067 Id = "FacebookPixel", 4068 SortId = 2, 4069 Template = RenderFacebookPixel() 4070 }; 4071 4072 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, facebookPixel); 4073 } 4074 4075 @helper RenderGoogleAnalyticsSnippet() 4076 { 4077 <!-- Global site tag (gtag.js) - Google Analytics --> 4078 <script async src="https://www.googletagmanager.com/gtag/js?id=@GoogleAnalyticsID"></script> 4079 <script> 4080 window.dataLayer = window.dataLayer || []; 4081 function gtag(){dataLayer.push(arguments);} 4082 gtag('js', new Date()); 4083 4084 gtag('config', '@GoogleAnalyticsID'); 4085 </script> 4086 4087 } 4088 4089 @helper RenderGoogleTagManager() 4090 { 4091 @*<script> 4092 (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': 4093 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], 4094 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 4095 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); 4096 })(window,document,'script','dataLayer','@GoogleTagManagerID'); 4097 </script>*@ 4098 4099 @*google consent mode v2*@ 4100 <script> 4101 window.dataLayer = window.dataLayer || []; 4102 function gtag(){dataLayer.push(arguments);} 4103 4104 gtag('consent', 'default', { 4105 'ad_storage': 'denied', 4106 'ad_user_data': 'denied', 4107 'ad_personalization': 'denied', 4108 'analytics_storage': 'denied', 4109 'functionality_storage': 'denied', 4110 'personalization_storage': 'denied', 4111 'security_storage': 'denied' 4112 }); 4113 </script> 4114 4115 4116 <!-- Google Tag Manager --> 4117 <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': 4118 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], 4119 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 4120 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); 4121 })(window,document,'script','dataLayer','@GoogleTagManagerID');</script> 4122 <!-- End Google Tag Manager --> 4123 } 4124 4125 @helper RenderGoogleTagManagerBodySnippet() 4126 { 4127 <!-- Google Tag Manager (noscript) --> 4128 <noscript> 4129 <iframe src="https://www.googletagmanager.com/ns.html?id=@GoogleTagManagerID" 4130 height="0" width="0" style="display:none;visibility:hidden"></iframe> 4131 </noscript> 4132 <!-- End Google Tag Manager (noscript) --> 4133 } 4134 4135 @helper RenderFacebookPixel() 4136 { 4137 string FacebookPixelID = Model.Area.Item.GetItem("Settings").GetString("FacebookPixelID"); 4138 4139 if (!string.IsNullOrWhiteSpace(FacebookPixelID)) 4140 { 4141 <!-- Facebook Pixel Code --> 4142 <script> 4143 !function(f,b,e,v,n,t,s) 4144 {if(f.fbq)return;n=f.fbq=function(){n.callMethod? 4145 n.callMethod.apply(n,arguments):n.queue.push(arguments)}; 4146 if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0'; 4147 n.queue=[];t=b.createElement(e);t.async=!0; 4148 t.src=v;s=b.getElementsByTagName(e)[0]; 4149 s.parentNode.insertBefore(t,s)}(window, document,'script', 4150 'https://connect.facebook.net/en_US/fbevents.js'); 4151 fbq('init', '@FacebookPixelID'); 4152 fbq('track', 'PageView'); 4153 </script> 4154 <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=@FacebookPixelID&ev=PageView&noscript=1" alt="" /></noscript> 4155 } 4156 } 4157 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 4158 4159 @using System 4160 @using System.Web 4161 @using System.Collections.Generic 4162 @using Dynamicweb.Rapido.Blocks 4163 @using Dynamicweb.Rapido.Blocks.Extensibility 4164 @using Dynamicweb.Security.UserManagement 4165 @using Dynamicweb.Security.UserManagement.ExternalAuthentication 4166 @using Dynamicweb.Rapido.Blocks.Components.General 4167 4168 @{ 4169 BlocksPage loginBlocksPage = BlocksPage.GetBlockPage("Master"); 4170 4171 Block loginModal = new Block() 4172 { 4173 Id = "LoginModal", 4174 SortId = 10, 4175 Component = new Modal 4176 { 4177 Id = "SignIn", 4178 Heading = new Heading 4179 { 4180 Level = 0, 4181 Title = Translate("Sign in") 4182 }, 4183 Width = ModalWidth.Sm, 4184 BodyTemplate = RenderLoginForm() 4185 } 4186 }; 4187 4188 loginBlocksPage.Add(MasterBlockId.MasterTopSnippets, loginModal); 4189 } 4190 4191 @helper RenderLoginForm() 4192 { 4193 int pageId = Model.TopPage.ID; 4194 string userSignedInErrorText = ""; 4195 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 4196 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; 4197 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 4198 bool showModalOnStart = pageId != GetPageIdByNavigationTag("CustomerCenter") && Model.LogOnFailed; 4199 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); 4200 bool hideForgotPasswordLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideForgotPasswordLink"); 4201 4202 ProviderCollection providers = Provider.GetActiveProviders(); 4203 4204 if (Model.LogOnFailed) 4205 { 4206 switch (Model.LogOnFailedReason) 4207 { 4208 case LogOnFailedReason.PasswordLengthInvalid: 4209 userSignedInErrorText = Translate("Password length is invalid"); 4210 break; 4211 case LogOnFailedReason.IncorrectLogin: 4212 userSignedInErrorText = Translate("Invalid email or password"); 4213 break; 4214 case LogOnFailedReason.ExceededFailedLogOnLimit: 4215 userSignedInErrorText = Translate("You have exceeded the limit of allowed login attempts. The user account is temporarily locked"); 4216 break; 4217 case LogOnFailedReason.LoginLocked: 4218 userSignedInErrorText = Translate("The user account is temporarily locked"); 4219 break; 4220 case LogOnFailedReason.PasswordExpired: 4221 userSignedInErrorText = Translate("The password has expired and needs to be renewed"); 4222 break; 4223 default: 4224 userSignedInErrorText = Translate("An unknown error occured"); 4225 break; 4226 } 4227 } 4228 4229 Form form = new Form { Method = FormMethod.Post, Name = "LoginModalForm" }; 4230 4231 TextField passwordField = new TextField { Id = "login-password", Type = TextFieldType.Password, Name = "password", Label = Translate("Password"), Required = true }; 4232 4233 if (!hideForgotPasswordLink) { 4234 passwordField.Link = new Link { Title = Translate("Forgot password?"), Href = "/Default.aspx?id=" + signInProfilePageId + "&LoginAction=Recovery" }; 4235 } 4236 4237 form.Add(new HiddenField { Name = "ID", Value = Converter.ToString(pageId) }); 4238 form.Add(new HiddenField { Name = "DWExtranetUsernameRemember", Value = "True" }); 4239 form.Add(new HiddenField { Name = "DWExtranetPasswordRemember", Value = "True" }); 4240 form.Add(new HiddenField { Name = "LoginAction", Value = "Login" }); 4241 form.Add(new TextField { Id = "LoginUsername", Name = "username", Label = Translate("Email"), CssClass = "u-full-width", Required = true }); 4242 form.Add(passwordField); 4243 form.Add(new NotificationMessage { Message = userSignedInErrorText, MessageType = NotificationMessageType.Error }); 4244 form.Add(new CheckboxField { Id = "LoginRememberMe", Value = "True", Name = "Autologin", Label = Translate("Remember me") }); 4245 form.Add(new Button { ButtonType = ButtonType.Submit, Title = Translate("Sign in"), CssClass = "btn--full", OnClick = "Buttons.LockButton(event)" }); 4246 4247 foreach (Provider LoginProvider in providers) 4248 { 4249 var ProviderName = LoginProvider.Name.ToLower(); 4250 form.Add(new Link { 4251 Href = "/Admin/Public/Social/ExternalLogin.aspx?action=login&providerID=" + LoginProvider.ID, 4252 Icon = new Icon { Prefix = "fab", Name = "fa-" + ProviderName, CssClass = "fa-1_5x", LabelPosition = IconLabelPosition.After }, 4253 ButtonLayout = ButtonLayout.LinkClean, 4254 CssClass = "btn--condensed u-margin-bottom u-margin-right u-inline-block u-color-" + ProviderName, 4255 AltText = ProviderName 4256 }); 4257 } 4258 4259 if (!hideCreateAccountLink) { 4260 form.Add(new Text { Content = "<div class=\"u-border-top u-full-width u-margin-bottom--lg\"></div>" }); 4261 form.Add(new Link 4262 { 4263 Href = "/Default.aspx?id=" + createAccountPageId, 4264 ButtonLayout = ButtonLayout.LinkClean, 4265 Title = Translate("Create account"), 4266 CssClass = "u-full-width u-ta-center" 4267 }); 4268 } 4269 4270 @Render(form) 4271 4272 if (showModalOnStart) 4273 { 4274 <script> 4275 document.getElementById("SignInModalTrigger").checked = true; 4276 </script> 4277 } 4278 } 4279 4280 @if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet") 4281 { 4282 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4283 4284 @using System 4285 @using System.Web 4286 @using System.Collections.Generic 4287 @using Dynamicweb.Rapido.Blocks.Extensibility 4288 @using Dynamicweb.Rapido.Blocks 4289 @using Dynamicweb.Rapido.Services 4290 4291 4292 @functions { 4293 BlocksPage mobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master"); 4294 } 4295 4296 @{ 4297 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"; 4298 bool mobileHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 4299 bool mobileHideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart") || !Dynamicweb.Rapido.Services.User.IsBuyingAllowed(); 4300 4301 var totalNumberOfProductsForDefault = 0; 4302 using (var contexter = new OrderContexter(Dynamicweb.Ecommerce.Orders.OrderContext.GetOrderContextById("ORDERCONTEXT7"))) 4303 { 4304 var cartContext = Dynamicweb.Ecommerce.Common.Context.Cart; 4305 totalNumberOfProductsForDefault = cartContext != null ? Converter.ToInt32(cartContext.ProductOrderLines.Sum(ol => ol.Quantity)) : 0; 4306 } 4307 4308 var totalNumberOfProductsForIngrasaminte = 0; 4309 using (var contexter = new OrderContexter(Dynamicweb.Ecommerce.Orders.OrderContext.GetOrderContextById("ORDERCONTEXT5"))) 4310 { 4311 var cartContext = Dynamicweb.Ecommerce.Common.Context.Cart; 4312 totalNumberOfProductsForIngrasaminte = cartContext != null ? Converter.ToInt32(cartContext.ProductOrderLines.Sum(ol => ol.Quantity)) : 0; 4313 } 4314 4315 var totalNumberOfProductsForAllCarts = totalNumberOfProductsForDefault + totalNumberOfProductsForIngrasaminte; 4316 4317 Block mobileHeader = new Block() 4318 { 4319 Id = "MobileTop", 4320 SortId = 10, 4321 Template = RenderMobileTop(), 4322 SkipRenderBlocksList = true 4323 }; 4324 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeader); 4325 4326 Block mobileHeaderNavigation = new Block() 4327 { 4328 Id = "MobileHeaderNavigation", 4329 SortId = 10, 4330 Template = RenderMobileHeaderNavigation(), 4331 SkipRenderBlocksList = true, 4332 BlocksList = new List<Block> { 4333 new Block { 4334 Id = "MobileHeaderNavigationTrigger", 4335 SortId = 10, 4336 Template = RenderMobileHeaderNavigationTrigger() 4337 } 4338 } 4339 }; 4340 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderNavigation); 4341 4342 Block mobileHeaderLogo = new Block() 4343 { 4344 Id = "MobileHeaderLogo", 4345 SortId = 20, 4346 Template = RenderMobileHeaderLogo(), 4347 SkipRenderBlocksList = true 4348 }; 4349 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderLogo); 4350 4351 Block mobileHeaderActions = new Block() 4352 { 4353 Id = "MobileHeaderActions", 4354 SortId = 30, 4355 Template = RenderMobileTopActions(), 4356 SkipRenderBlocksList = true 4357 }; 4358 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderActions); 4359 4360 Block mobileHeaderSignIn = new Block() 4361 { 4362 Id = "MobileHeaderAccount", 4363 SortId = 70, 4364 Template = RenderMobileHeaderSignIn(), 4365 SkipRenderBlocksList = true 4366 }; 4367 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderSignIn); 4368 4369 4370 Block mobileHeaderActions2 = new Block() 4371 { 4372 Id = "MobileHeaderActions2", 4373 SortId = 80, 4374 Template = RenderMobileTopActions2(), 4375 SkipRenderBlocksList = true 4376 }; 4377 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderActions2); 4378 4379 if (!mobileHideSearch) 4380 { 4381 Block mobileHeaderSearch = new Block 4382 { 4383 Id = "MobileHeaderSearch", 4384 SortId = 10, 4385 Template = RenderMobileTopSearch() 4386 }; 4387 mobileHeaderBlocksPage.Add("mobileHeaderActions2", mobileHeaderSearch); 4388 } 4389 4390 Block mobileHeaderMiniCart; 4391 4392 if (!mobileHideCart) 4393 { 4394 mobileHeaderMiniCart = new Block 4395 { 4396 Id = "MobileHeaderMiniCart", 4397 SortId = 20, 4398 Template = RenderMobileTopMiniCart(totalNumberOfProductsForDefault, totalNumberOfProductsForIngrasaminte) 4399 }; 4400 4401 Block miniCartCounterScriptTemplate = new Block 4402 { 4403 Id = "MiniCartCounterScriptTemplate", 4404 Template = RenderMobileMiniCartCounterContent() 4405 }; 4406 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate); 4407 } 4408 else 4409 { 4410 mobileHeaderMiniCart = new Block 4411 { 4412 Id = "MobileHeaderMiniCart", 4413 SortId = 20 4414 }; 4415 } 4416 4417 if (!mobileHideSearch) 4418 { 4419 Block mobileHeaderSearchBar = new Block() 4420 { 4421 Id = "MobileHeaderSearchBar", 4422 SortId = 30, 4423 Template = RenderMobileTopSearchBar() 4424 }; 4425 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeaderSearchBar); 4426 } 4427 4428 4429 4430 4431 4432 4433 4434 switch (mobileTopLayout) 4435 { 4436 case "nav-left": 4437 mobileHeaderNavigation.SortId = 10; 4438 mobileHeaderLogo.SortId = 20; 4439 mobileHeaderActions.SortId = 30; 4440 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart); 4441 break; 4442 case "nav-right": 4443 mobileHeaderLogo.SortId = 10; 4444 mobileHeaderActions.SortId = 20; 4445 mobileHeaderNavigation.SortId = 30; 4446 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart); 4447 break; 4448 case "nav-search-left": 4449 mobileHeaderNavigation.SortId = 10; 4450 mobileHeaderLogo.SortId = 20; 4451 mobileHeaderActions.SortId = 30; 4452 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart); 4453 break; 4454 case "search-left": 4455 mobileHeaderActions.SortId = 10; 4456 mobileHeaderLogo.SortId = 20; 4457 mobileHeaderNavigation.SortId = 30; 4458 mobileHeaderMiniCart.SortId = 0; 4459 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart); 4460 break; 4461 } 4462 } 4463 4464 4465 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4466 4467 @using System 4468 @using System.Web 4469 @using Dynamicweb.Rapido.Blocks.Extensibility 4470 @using Dynamicweb.Rapido.Blocks 4471 4472 @{ 4473 BlocksPage customMobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master"); 4474 } 4475 4476 4477 4478 4479 @helper RenderMobileTop() { 4480 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileTop").OrderBy(item => item.SortId).ToList(); 4481 4482 <nav class="main-navigation-mobile dw-mod"> 4483 <div class="center-container top-container__center-container dw-mod"> 4484 <div class="grid grid--align-center mobile__header-items"> 4485 @RenderBlockList(subBlocks) 4486 </div> 4487 </div> 4488 </nav> 4489 } 4490 4491 @helper RenderMobileHeaderNavigation() { 4492 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderNavigation").OrderBy(item => item.SortId).ToList(); 4493 4494 <div class="grid__col-auto-width grid__col--bleed hamburger__item"> 4495 <ul class="menu dw-mod u-flex u-flex--align-items-center"> 4496 4497 @RenderBlockList(subBlocks) 4498 4499 </ul> 4500 </div> 4501 } 4502 4503 @helper RenderMobileHeaderNavigationTrigger() { 4504 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 4505 <label for="MobileNavTrigger" class="mobile-nav-trigger-button menu__link menu__link--icon menu__link--mobile dw-mod"></label> 4506 </li> 4507 } 4508 4509 @helper RenderMobileHeaderLogo() { 4510 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderLogo").OrderBy(item => item.SortId).ToList(); 4511 4512 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"; 4513 string centeredLogo = mobileTopLayout != "nav-right" ? "u-ta-center" : ""; 4514 string firstPageId = Model.Area.FirstActivePage.ID.ToString(); 4515 string businessName = Model.Area.Item.GetItem("Settings").GetString("BusinessName"); 4516 4517 string logoLink = Pageview.Area.CultureInfo.TwoLetterISOLanguageName; 4518 logoLink = logoLink == "en" ? "/en" : "/"; 4519 4520 string mobileLogo = "/Files/Images/logo-dynamicweb.png"; 4521 if (Model.Area.Item.GetItem("Layout").GetItem("MobileTop") != null && Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo") != null) 4522 { 4523 mobileLogo = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo").PathUrlEncoded; 4524 } 4525 4526 if (Path.GetExtension(mobileLogo).ToLower() != ".svg") 4527 { 4528 mobileLogo = "/Admin/Public/GetImage.ashx?height=40&amp;width=100&amp;crop=5&amp;Compression=75&amp;image=" + mobileLogo; 4529 } 4530 else 4531 { 4532 mobileLogo = HttpUtility.UrlDecode(mobileLogo); 4533 } 4534 4535 <div class="grid__col-auto grid__col--bleed logo__item"> 4536 <div class="grid__cell @centeredLogo"> 4537 <a href="@logoLink" class="logo logo--mobile u-inline-block u-no-margin dw-mod"> 4538 <img class="grid__cell-img logo__img logo__img--mobile dw-mod" src="@mobileLogo" alt="@businessName" /> 4539 </a> 4540 </div> 4541 4542 @RenderBlockList(subBlocks) 4543 </div> 4544 } 4545 4546 @helper RenderMobileTopActions() { 4547 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderActions").OrderBy(item => item.SortId).ToList(); 4548 4549 <div class="grid__col-auto-width grid__col--bleed cart__item"> 4550 @RenderLanguageSelectorMobile() 4551 <ul class="menu dw-mod"> 4552 @RenderBlockList(subBlocks) 4553 </ul> 4554 </div> 4555 } 4556 4557 @helper RenderMobileTopActions2() { 4558 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderActions2").OrderBy(item => item.SortId).ToList(); 4559 4560 <div class="grid__col-auto-width grid__col--bleed search__item u-hidden"> 4561 <ul class="menu dw-mod"> 4562 @RenderBlockList(subBlocks) 4563 </ul> 4564 </div> 4565 } 4566 4567 @helper RenderMobileHeaderSignIn() { 4568 <div class="menu-mobile__item grid__col--bleed account__item"> 4569 <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></label> 4570 </div> 4571 } 4572 4573 4574 4575 @helper RenderMobileTopSearch() { 4576 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 4577 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> 4578 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> 4579 </label> 4580 </li> 4581 } 4582 4583 @helper RenderMobileTopMiniCart(int totalNumberOfProductsForDefault = 0, int totalNumberOfProductsForIngrasaminte = 0) { 4584 int miniCartFeedDefaultPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4585 int miniCartFeedIngrasamintePageId = GetPageIdByNavigationTag("MiniCartFeedIngrasaminte"); 4586 int miniCartFeedSelectedPageId = totalNumberOfProductsForDefault > 0 || totalNumberOfProductsForIngrasaminte == 0 ? miniCartFeedDefaultPageId : miniCartFeedIngrasamintePageId; 4587 4588 string cartProductsCount = (totalNumberOfProductsForDefault + totalNumberOfProductsForIngrasaminte).ToString(); 4589 4590 int cartPageId = GetPageIdByNavigationTag("CartPage"); 4591 int cartPageIngrasaminteId = GetPageIdByNavigationTag("CartPageIngrasaminte"); 4592 4593 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod" id="miniCartWrapper"> 4594 <div class="mini-cart dw-mod"> 4595 <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" data-cartpage-ingrasaminte="@cartPageIngrasaminteId" data-cartpage-regular="@cartPageId" data-order-context="@cartProductsCount"> 4596 <div id="minicart_icon" class="u-inline u-position-relative" data-miniCartFeedId="@miniCartFeedDefaultPageId" data-miniCartFeed-IngrasaminteId="@miniCartFeedIngrasamintePageId" data-miniCart-ContextId="@miniCartFeedSelectedPageId"> 4597 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue fa-1_5x"></i> 4598 <div class="mini-cart__counter dw-mod"> 4599 <div class="js-handlebars-root js-mini-cart-counter" id="cartCounter" data-template="MiniCartCounterContent" data-json-feed="/Default.aspx?ID=@miniCartFeedSelectedPageId&feedType=Counter" data-init-onload="false" data-preloader="false"> 4600 <div class="js-mini-cart-counter-content" data-count="@cartProductsCount"> 4601 @cartProductsCount 4602 </div> 4603 </div> 4604 </div> 4605 </div> 4606 </a> 4607 </div> 4608 </li> 4609 } 4610 4611 @helper RenderMobileTopSearchBar() 4612 { 4613 string searchFeedId = ""; 4614 string searchSecondFeedId = ""; 4615 int groupsFeedId; 4616 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 4617 // string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 4618 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults").ToString(); 4619 string resultPageLink; 4620 string searchPlaceholder; 4621 string searchType = "product-search"; 4622 string searchTemplate; 4623 string searchContentTemplate = ""; 4624 string searchValue = HttpContext.Current.Request.QueryString.Get("q") ?? ""; 4625 bool showGroups = true; 4626 4627 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch") 4628 { 4629 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 4630 resultPageLink = contentSearchPageLink; 4631 searchPlaceholder = Translate("Search page"); 4632 groupsFeedId = 0; 4633 searchType = "content-search"; 4634 searchTemplate = "SearchPagesTemplate"; 4635 showGroups = false; 4636 } 4637 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch") 4638 { 4639 searchFeedId = productsPageId + "&feed=true"; 4640 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 4641 resultPageLink = Converter.ToString(productsPageId); 4642 searchPlaceholder = Translate("Search products or pages"); 4643 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 4644 searchType = "combined-search"; 4645 searchTemplate = "SearchProductsTemplateWrap"; 4646 searchContentTemplate = "SearchPagesTemplateWrap"; 4647 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 4648 } 4649 else 4650 { 4651 resultPageLink = Converter.ToString(productsPageId); 4652 searchFeedId = productsPageId + "&feed=true"; 4653 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 4654 searchPlaceholder = Translate("Search products"); 4655 searchTemplate = "SearchProductsTemplate"; 4656 searchType = "product-search"; 4657 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 4658 } 4659 4660 @*<input type="checkbox" id="MobileSearchTrigger" class="mobile-search-trigger" />*@ 4661 4662 <div class="main-navigation-mobile typeahead-mobile dw-mod"> 4663 <div class="center-container top-container__center-container dw-mod"> 4664 <div class="grid"> 4665 <div class="u-full-width u-margin-bottom--lg"> 4666 <div class="typeahead-mobile__search-field dw-mod js-typeahead u-border u-padding-x u-flex" 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" data-search-parameter-name="q" style="background: #fff;"> 4667 <input name="q" type="text" class="js-typeahead-search-field u-w160px u-no-margin u-no-border" placeholder="@searchPlaceholder" value="@searchValue"> 4668 @if (string.IsNullOrEmpty(searchSecondFeedId)) 4669 { 4670 <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> 4671 } 4672 else 4673 { 4674 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--combined-mobile grid"> 4675 <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> 4676 <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> 4677 </div> 4678 } 4679 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod js-typeahead-enter-btn" aria-label="product search"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue"></i></button> 4680 </div> 4681 </div> 4682 <!-- <div class="grid__col-auto-width close__button"> 4683 <ul class="menu dw-mod"> 4684 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 4685 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> 4686 <i class="fas fa-times fa-1_5x"></i> 4687 </label> 4688 </li> 4689 </ul> 4690 </div> --> 4691 </div> 4692 </div> 4693 </div> 4694 } 4695 4696 @helper RenderMobileMiniCartCounterContent() 4697 { 4698 <script id="MiniCartCounterContent" type="text/x-template"> 4699 {{#.}} 4700 <div class="js-mini-cart-counter-content dw-mod" data-count="{{totalnumberofproductsforallcarts}}"> 4701 {{totalnumberofproductsforallcarts}} 4702 </div> 4703 {{/.}} 4704 </script> 4705 } 4706 4707 4708 @helper RenderCheckCartModal(int totalNumberOfProductsForDefault = 0, int totalNumberOfProductsForIngrasaminte = 0) { 4709 int cartRegularProductsCount = Converter.ToInt32(Model.Cart.TotalProductsCount); 4710 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage"); 4711 string cartIngrasamintePageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPageIngrasaminte"); 4712 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4713 4714 <div class="check-cart__wrapper u-hidden"> 4715 4716 <label for="Check_Cart" class="dw-mod"> 4717 <button class="u-no-margin u-margin-top--lg btn btn--primary dw-mod" style="pointer-events: none;">@Translate("Selecteaza Cosul")</button> 4718 </label> 4719 <!-- Trigger for the login modal --> 4720 <input type="checkbox" id="Check_Cart" class="modal-trigger"/> 4721 </div> 4722 <!-- Add address modal --> 4723 <div class="modal-container"> 4724 <label for="Check_Cart" id="CheckCartModalOverlay" class="modal-overlay"></label> 4725 <div class="modal modal--md" id="CheckCartModal"> 4726 <div class="modal__header no-border"> 4727 <button type="button" class="close btn btn--primary dw-mod u-margin-top--lg" aria-label="select cart"><i class="fas fa-times"></i></button> 4728 <h2 class="u-ta-center">@Translate("Selecteaza Cosul")</h2> 4729 </div> 4730 <div class="modal__body"> 4731 <div class="mini-cart-dropdown__body u-flex dw-mod"> 4732 <div class="js-handlebars-root u-flex grid--direction-column u-full-width dw-mod" id="MiniCartContentMobile" data-template="MiniCartContentMobileTemplate" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart"></div> 4733 </div> 4734 </div> 4735 </div> 4736 </div> 4737 4738 <script id="MiniCartContentMobileTemplate" type="text/x-template"> 4739 {{#.}} 4740 <div class="form__field-group--bordered" style="padding:1rem;"> 4741 <div class="container__cart-type"> 4742 <div class="radio"> 4743 <div> 4744 <input id="cart1" name="radio-2" value="" type="radio" checked> 4745 <label for="cart1" class="radio-label">Cosul Ingrasaminte:</label> 4746 </div> 4747 <div class="radio__item"> 4748 <div style="font-size: 1.4rem;">Nr. Produs(e):<span style="color:#073E79; font-weight: bold; margin-left:0.3rem;"> {{totalnumberofproductsforingrasamintecart}}</span></div> 4749 <div><button type="button" title="Goleste cosul" class="u-no-margin" onclick="googleEnchantImpressionEmptyCart(); Cart.EmptyCart(event, 'ORDERCONTEXT5');" aria-label="empty cart"><i class="fas fa-trash-alt" alt="goleste cosul"></i></button></div> 4750 </div> 4751 </div> 4752 <div class="radio"> 4753 <div> 4754 <input id="cart2" name="radio-2" value="" type="radio"> 4755 <label for="cart2" class="radio-label">Cosul cu restul produselor:</label> 4756 </div> 4757 <div class="radio__item"> 4758 <div style="font-size: 1.4rem;">Nr. Produs(e):<span style="color:#073E79; font-weight: bold; margin-left:0.3rem;"> {{totalnumberofproductsfordefaultcart}}</span></div> 4759 <div><button type="button" title="Goleste cosul" class="u-no-margin" onclick="googleEnchantImpressionEmptyCart(); Cart.EmptyCart(event, 'ORDERCONTEXT7');" aria-label="empty cart"><i class="fas fa-trash-alt" alt="goleste cosul"></i></button></div> 4760 </div> 4761 </div> 4762 </div> 4763 <a id="go_to_cart" href="" class="u-full-width u-no-margin u-margin-top--lg btn btn--primary dw-mod">@Translate("Vezi cosul")</a> 4764 </div> 4765 {{/.}} 4766 </script> 4767 4768 } 4769 4770 4771 4772 @helper RenderLanguageSelectorMobile() { 4773 List<Dynamicweb.Content.Page> languages = new List<Dynamicweb.Content.Page>(); 4774 Uri url = Dynamicweb.Context.Current.Request.Url; 4775 string hostName = url.Host; 4776 4777 4778 if (Pageview.Area.IsMaster) 4779 { 4780 languages.Add(Pageview.Page); 4781 if (Pageview.Page.Languages != null) 4782 { 4783 foreach (var language in Pageview.Page.Languages) 4784 { 4785 languages.Add(language); 4786 } 4787 } 4788 } 4789 else 4790 { 4791 languages.Add(Pageview.Page.MasterPage); 4792 if (Pageview.Page.MasterPage != null) 4793 { 4794 if (Pageview.Page.MasterPage.Languages != null) 4795 { 4796 foreach (var language in Pageview.Page.MasterPage.Languages