Error executing template "Designs/AgricoverCorporate/_parsed/DynamicArticle.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_f5a8249d7e79495fab8611b864ae7b2e.Execute() in C:\inetpub\wwwroot\dev.magazin.agricover.ro\Files\Templates\Designs\AgricoverCorporate\_parsed\DynamicArticle.parsed.cshtml:line 9338
   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 dw-mod" for="CategorySelector">@Translate(selectedFilter)</label> 3006 <div class="dropdown__content dw-mod"> 3007 @foreach (var option in settings.Categories) 3008 { 3009 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div> 3010 } 3011 </div> 3012 <label class="dropdown-trigger-off" for="CategorySelector"></label> 3013 </div> 3014 </div> 3015 </div> 3016 } 3017 else 3018 { 3019 <div class="u-full-width u-margin-bottom"> 3020 <h5 class="u-no-margin">@Translate("Category")</h5> 3021 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" /> 3022 <div class="dropdown u-full-width dw-mod"> 3023 <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label> 3024 <div class="dropdown__content dw-mod"> 3025 @foreach (var option in settings.Categories) 3026 { 3027 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div> 3028 } 3029 </div> 3030 <label class="dropdown-trigger-off" for="CategorySelector"></label> 3031 </div> 3032 </div> 3033 } 3034 } 3035 @using System.Reflection 3036 @using Dynamicweb.Rapido.Blocks.Components 3037 @using Dynamicweb.Rapido.Blocks.Components.Articles 3038 @using Dynamicweb.Rapido.Blocks 3039 @using System.Collections.Generic 3040 3041 @* Component for the articles *@ 3042 3043 @helper RenderArticleListFilter(ArticleListFilter settings) 3044 { 3045 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get(settings.SystemName)) ? HttpContext.Current.Request.QueryString.Get(settings.SystemName) : Translate("All"); 3046 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString()); 3047 3048 if (settings.Options != null) 3049 { 3050 if (settings.Options is IEnumerable<dynamic>) 3051 { 3052 var options = (IEnumerable<dynamic>) settings.Options; 3053 settings.Options = options.OrderBy(item => item.Name); 3054 } 3055 3056 foreach (var option in settings.Options) 3057 { 3058 selectedFilter = selectedFilter == option.Value ? option.Name : selectedFilter; 3059 } 3060 3061 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 3062 { 3063 <div class="u-pull--right u-margin-left"> 3064 <div class="collection u-no-margin"> 3065 <h5>@settings.Label</h5> 3066 <input type="checkbox" id="@(settings.SystemName)Selector" class="dropdown-trigger" /> 3067 <div class="dropdown u-w180px dw-mod"> 3068 <label class="dropdown__header dropdown__btn dw-mod" for="@(settings.SystemName)Selector">@Translate(selectedFilter)</label> 3069 <div class="dropdown__content dw-mod"> 3070 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')">@Translate("All")</div> 3071 @foreach (var option in settings.Options) 3072 { 3073 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')">@Translate(option.Name)</div> 3074 } 3075 </div> 3076 <label class="dropdown-trigger-off" for="@(settings.SystemName)Selector"></label> 3077 </div> 3078 </div> 3079 </div> 3080 } 3081 else 3082 { 3083 <div class="u-full-width u-margin-bottom"> 3084 <h5 class="u-no-margin">@settings.Label</h5> 3085 <input type="checkbox" id="@(settings.SystemName)Selector" class="dropdown-trigger" /> 3086 <div class="dropdown u-full-width w-mod"> 3087 <label class="dropdown__header dropdown__btn dw-mod" for="@(settings.SystemName)Selector">@Translate(selectedFilter)</label> 3088 <div class="dropdown__content dw-mod"> 3089 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')">@Translate("All")</div> 3090 @foreach (var option in settings.Options) 3091 { 3092 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')">@Translate(option.Name)</div> 3093 } 3094 </div> 3095 <label class="dropdown-trigger-off" for="@(settings.SystemName)Selector"></label> 3096 </div> 3097 </div> 3098 } 3099 } 3100 } 3101 @using System.Reflection 3102 @using Dynamicweb.Rapido.Blocks.Components 3103 @using Dynamicweb.Rapido.Blocks.Components.Articles 3104 @using Dynamicweb.Rapido.Blocks 3105 3106 @* Component for the articles *@ 3107 3108 @helper RenderArticleListSearch(ArticleListSearch settings) 3109 { 3110 string searchParameter = !string.IsNullOrEmpty(settings.SearchParameter) ? settings.SearchParameter : "Title"; 3111 string searchWord = HttpContext.Current.Request.QueryString.Get(searchParameter); 3112 string searchString = !string.IsNullOrEmpty(searchWord) ? searchWord.Trim('*') : ""; 3113 string className = "u-w340px u-pull--right u-margin-left"; 3114 3115 if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet") 3116 { 3117 className = "u-full-width"; 3118 } 3119 3120 <div class="typeahead u-color-inherit u-margin-bottom dw-mod @className"> 3121 <input type="text" class="typeahead-search-field u-no-margin dw-mod" placeholder="@Translate("Search in list")" value="@searchString" id="ArticleListSearchInput" onchange="QueryArray.setParameterInCurrentURL('@searchParameter', '*' + document.getElementById('ArticleListSearchInput').value + '*')"> 3122 @*<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 + '*'})">*@ 3123 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod"><i class="fas fa-search"></i></button> 3124 </div> 3125 } 3126 @using System.Reflection 3127 @using Dynamicweb.Rapido.Blocks.Components 3128 @using Dynamicweb.Rapido.Blocks.Components.Articles 3129 @using Dynamicweb.Rapido.Blocks 3130 3131 @* Component for the articles *@ 3132 3133 @helper RenderArticleListNoResultsInfo(ArticleListNoResultsInfo settings) 3134 { 3135 <div class="u-margin-top--lg u-bold u-ta-center u-bold">@Translate(settings.Message)</div> 3136 } 3137 @using System.Reflection 3138 @using Dynamicweb.Rapido.Blocks.Components 3139 @using Dynamicweb.Rapido.Blocks.Components.General 3140 @using Dynamicweb.Rapido.Blocks.Components.Articles 3141 @using Dynamicweb.Rapido.Blocks 3142 @using System.Text.RegularExpressions 3143 3144 @* Component for the articles *@ 3145 3146 @helper RenderArticleListItem(ArticleListItem settings) 3147 { 3148 switch (settings.Type) { 3149 case ArticleListItemType.Card: 3150 @RenderArticleListItemCard(settings); 3151 break; 3152 case ArticleListItemType.List: 3153 @RenderArticleListItemList(settings); 3154 break; 3155 case ArticleListItemType.Simple: 3156 @RenderArticleListItemSimple(settings); 3157 break; 3158 default: 3159 @RenderArticleListItemCard(settings); 3160 break; 3161 } 3162 } 3163 3164 @helper RenderArticleListItemCard(ArticleListItem settings) { 3165 <a href="@settings.Link" class="u-full-height u-color-light--bg u-flex u-flex--column"> 3166 <div class="u-color-light--bg u-no-padding dw-mod"> 3167 @if (settings.Logo != null) 3168 { 3169 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;" : ""; 3170 settings.Logo.ImageDefault.Crop = 5; 3171 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width; 3172 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height; 3173 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage"> 3174 @if (settings.Stickers != null) 3175 { 3176 if (settings.Stickers.Position != StickersListPosition.Custom && settings.Stickers.Position != StickersListPosition.None) 3177 { 3178 @Render(settings.Stickers); 3179 } 3180 } 3181 @RenderImage(settings.Logo) 3182 </div> 3183 } else if (settings.Image != null) 3184 { 3185 <div class="flex-img image-hover__wrapper u-position-relative dw-mod"> 3186 @if (settings.Stickers != null) 3187 { 3188 if (settings.Stickers.Position != StickersListPosition.Custom && settings.Stickers.Position != StickersListPosition.None) 3189 { 3190 @Render(settings.Stickers); 3191 } 3192 } 3193 @Render(settings.Image) 3194 </div> 3195 } 3196 </div> 3197 3198 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary)) 3199 { 3200 <div class="card u-color-light--bg u-full-height dw-mod"> 3201 @if (settings.Stickers != null) 3202 { 3203 if (settings.Stickers.Position == StickersListPosition.Custom) 3204 { 3205 @Render(settings.Stickers); 3206 } 3207 } 3208 @if (!String.IsNullOrEmpty(settings.Title)) 3209 { 3210 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3> 3211 } 3212 @if (!String.IsNullOrEmpty(settings.SubTitle)) 3213 { 3214 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 3215 } 3216 @if (!String.IsNullOrEmpty(settings.Summary)) 3217 { 3218 <p class="article__short-summary dw-mod">@settings.Summary</p> 3219 } 3220 3221 </div> 3222 } 3223 </a> 3224 } 3225 3226 @helper RenderArticleListItemList(ArticleListItem settings) { 3227 <a href="@settings.Link"> 3228 3229 3230 <div class="grid u-color-light--bg custom-article-list u-no-padding dw-mod"> 3231 3232 <div class="grid__col-md-3"> 3233 <div class="u-color-light--bg u-no-padding dw-mod"> 3234 @if (settings.Logo != null) 3235 { 3236 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;" : ""; 3237 settings.Logo.ImageDefault.Crop = 5; 3238 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width; 3239 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height; 3240 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage"> 3241 @* 3242 @if (settings.Stickers != null) 3243 { 3244 if (settings.Stickers.Position != StickersListPosition.Custom) 3245 { 3246 @Render(settings.Stickers); 3247 } 3248 } 3249 *@ 3250 @RenderImage(settings.Logo) 3251 </div> 3252 } 3253 else if (settings.Image != null) 3254 { 3255 <div class="flex-img image-hover__wrapper dw-mod"> 3256 @* 3257 @if (settings.Stickers != null) 3258 { 3259 if (settings.Stickers.Position != StickersListPosition.Custom) 3260 { 3261 @Render(settings.Stickers); 3262 } 3263 } 3264 *@ 3265 @Render(settings.Image) 3266 </div> 3267 } 3268 </div> 3269 </div> 3270 3271 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary)) 3272 { 3273 <div class="grid__col-md-9"> 3274 @Render(settings.Stickers) 3275 3276 @if (!String.IsNullOrEmpty(settings.Title)) 3277 { 3278 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3> 3279 } 3280 @if (settings.Stickers != null) 3281 { 3282 if (settings.Stickers.Position == StickersListPosition.Custom) 3283 { 3284 @Render(settings.Stickers) 3285 ; 3286 } 3287 } 3288 @if (!String.IsNullOrEmpty(settings.SubTitle)) 3289 { 3290 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 3291 } 3292 @if (!String.IsNullOrEmpty(settings.Summary)) 3293 { 3294 <p class="article__short-summary dw-mod">@settings.Summary</p> 3295 } 3296 @if (!String.IsNullOrEmpty(settings.Link)) 3297 { 3298 <a href="@settings.Link">@Translate("Mai mult >", "Mai mult >")</a> 3299 } 3300 </div> 3301 } 3302 </div> 3303 </a> 3304 } 3305 3306 @helper RenderArticleListItemSimple(ArticleListItem settings) { 3307 <a href="@settings.Link" class="u-color-inherit"> 3308 <div class="grid u-color-light--bg u-no-padding dw-mod"> 3309 <div class="grid__col-md-12"> 3310 @if (!String.IsNullOrEmpty(settings.Title)) 3311 { 3312 <div class="article-list-item__header test u-truncate-text u-no-margin dw-mod">@settings.Title</div> 3313 3314 } 3315 @if (!String.IsNullOrEmpty(settings.SubTitle)) 3316 { 3317 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 3318 } 3319 </div> 3320 </div> 3321 </a> 3322 } 3323 @using System.Reflection 3324 @using Dynamicweb.Rapido.Blocks.Components.Articles 3325 3326 3327 @* Component for the articles *@ 3328 3329 @helper RenderArticleAuthorAndDate(ArticleAuthorAndDate settings) 3330 { 3331 <small class="article__subscription"> 3332 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date))) 3333 { 3334 <text>@Translate("Written")</text> 3335 } 3336 @if (!string.IsNullOrWhiteSpace(settings.Author)) 3337 { 3338 <text>@Translate("by") @settings.Author</text> 3339 } 3340 @if (!string.IsNullOrWhiteSpace(settings.Date)) 3341 { 3342 <text>@Translate("on") @settings.Date</text> 3343 } 3344 </small> 3345 } 3346 @using System.Reflection 3347 @using Dynamicweb.Rapido.Blocks.Components.Articles 3348 @using Dynamicweb.Rapido.Blocks.Components.General 3349 3350 3351 @* Component for the articles *@ 3352 3353 @helper RenderArticleLink(ArticleLink settings) 3354 { 3355 if (!string.IsNullOrEmpty(settings.Title)) 3356 { 3357 Button link = new Button { 3358 ConfirmText = settings.ConfirmText, 3359 ConfirmTitle = settings.ConfirmTitle, 3360 ButtonType = settings.ButtonType, 3361 Id = settings.Id, 3362 Title = settings.Title, 3363 AltText = settings.AltText, 3364 OnClick = settings.OnClick, 3365 CssClass = settings.CssClass, 3366 Disabled = settings.Disabled, 3367 Icon = settings.Icon, 3368 Name = settings.Name, 3369 Href = settings.Href, 3370 ButtonLayout = settings.ButtonLayout, 3371 ExtraAttributes = settings.ExtraAttributes 3372 }; 3373 <div class="grid__cell"> 3374 @Render(link) 3375 </div> 3376 } 3377 } 3378 @using System.Reflection 3379 @using Dynamicweb.Rapido.Blocks 3380 @using Dynamicweb.Rapido.Blocks.Components.Articles 3381 @using Dynamicweb.Rapido.Blocks.Components.General 3382 3383 3384 @* Component for the articles *@ 3385 3386 @helper RenderArticleCarousel(ArticleCarousel settings) 3387 { 3388 <div class="grid"> 3389 <div class="grid__col-12 u-no-padding u-margin-bottom"> 3390 <div class="carousel" id="carousel_@settings.Id"> 3391 <div class="carousel__container js-carousel-slides dw-mod"> 3392 @RenderBlockList(settings.SubBlocks) 3393 </div> 3394 </div> 3395 </div> 3396 </div> 3397 3398 <script> 3399 document.addEventListener("DOMContentLoaded", function () { 3400 new CarouselModule("#carousel_@settings.Id", { 3401 slideTime: 0, 3402 dots: true 3403 }); 3404 }); 3405 </script> 3406 } 3407 3408 @helper RenderArticleCarouselSlide(ArticleCarouselSlide settings) 3409 { 3410 string imageEngine = "/Admin/Public/GetImage.ashx?"; 3411 3412 string defaultImage = settings.ImageSettings != null ? imageEngine : settings.Image; 3413 if (settings.ImageSettings != null) 3414 { 3415 defaultImage += settings.ImageSettings.Width != 0 ? "Width=" + settings.ImageSettings.Width + "&" : ""; 3416 defaultImage += settings.ImageSettings.Height != 0 ? "Height=" + settings.ImageSettings.Height + "&" : ""; 3417 defaultImage += "Crop=" + settings.ImageSettings.Crop + "&"; 3418 defaultImage += "Compression=" + settings.ImageSettings.Compression + "&"; 3419 defaultImage += "DoNotUpscale=" + settings.ImageSettings.DoNotUpscale.ToString() + "&"; 3420 defaultImage += "FillCanvas=" + settings.ImageSettings.FillCanvas.ToString() + "&"; 3421 } 3422 defaultImage += "&Image=" + settings.Image; 3423 3424 <div class="carousel__slide u-min-h300px u-flex dw-mod" style="background-size:cover; background-image:url('@defaultImage')"> 3425 <a class="article-carousel-item__wrap" href="@settings.Link" title="@settings.Title"> 3426 <h2 class="article-list__item-header u-truncate-text u-color-light dw-mod">@settings.Title</h2> 3427 <div class="article-list__item-info"> 3428 @if (settings.Stickers != null) 3429 { 3430 settings.Stickers.Position = StickersListPosition.Custom; 3431 @Render(settings.Stickers); 3432 } 3433 3434 <small class="u-margin-top--lg u-color-light"> 3435 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date))) 3436 { 3437 <text>@Translate("Written")</text> 3438 } 3439 @if (!string.IsNullOrWhiteSpace(settings.Author)) 3440 { 3441 <text>@Translate("by") @settings.Author</text> 3442 } 3443 @if (!string.IsNullOrWhiteSpace(settings.Date)) 3444 { 3445 <text>@Translate("on") @settings.Date</text> 3446 } 3447 </small> 3448 </div> 3449 3450 <h3 class="article__short-summary u-color-light">@settings.Summary</h3> 3451 </a> 3452 @if (settings.UseFilters == true) 3453 { 3454 <div class="background-image image-filter image-filter--darken dw-mod"></div> 3455 } 3456 </div> 3457 } 3458 @using System.Text.RegularExpressions 3459 @using Dynamicweb.Rapido.Blocks.Components 3460 @using Dynamicweb.Rapido.Blocks.Components.General 3461 @using Dynamicweb.Rapido.Blocks.Components.Articles 3462 @using Dynamicweb.Rapido.Blocks 3463 3464 @* Component for the articles *@ 3465 3466 @helper RenderArticleVideo(ArticleVideo settings) 3467 { 3468 if (settings.Url != null) 3469 { 3470 //getting video ID from youtube URL 3471 string videoCode = settings.Url; 3472 Regex regex = new Regex(@".be\/(.[^?]*)"); 3473 Match match = regex.Match(videoCode); 3474 string videoId = ""; 3475 if (match.Success) 3476 { 3477 videoId = match.Groups[1].Value; 3478 } 3479 else 3480 { 3481 regex = new Regex(@"v=([^&]+)"); 3482 match = regex.Match(videoCode); 3483 if (match.Success) 3484 { 3485 videoId = match.Groups[1].Value; 3486 } 3487 } 3488 3489 int autoPlay = settings.AutoPlay == "true" ? 1 : 0; 3490 3491 <div class="video-wrapper"> 3492 <div class="js-youtube-video" data-video="@videoId" id="ytPlayer@(Guid.NewGuid().ToString("N"))" data-auto-play="@autoPlay" data-enable-controls="1"></div> 3493 </div> 3494 } 3495 } 3496 @using System.Reflection 3497 @using Dynamicweb.Rapido.Blocks.Components 3498 @using Dynamicweb.Rapido.Blocks.Components.Articles 3499 @using Dynamicweb.Rapido.Blocks 3500 3501 3502 @functions{ 3503 BlocksPage articlePageComponent = BlocksPage.GetBlockPage("DynamicArticle"); 3504 public class DF_ArticleParagraph : ComponentBase 3505 { 3506 public ItemViewModel ParagraphContent {get; set;} 3507 public int counter {get; set;} 3508 public string imageColumns {get; set;} 3509 public string imageLayout {get; set;} 3510 public string contentColumns {get; set;} 3511 } 3512 3513 } 3514 3515 @helper RenderDF_ArticleParagraph(DF_ArticleParagraph settings) 3516 { 3517 ItemViewModel paragraph = settings.ParagraphContent; 3518 int count = settings.counter; 3519 string imageColumns = settings.imageColumns; 3520 string imageLayout = settings.imageLayout; 3521 string contentColumns = settings.contentColumns; 3522 3523 3524 3525 string paragraphListHeading = "12"; 3526 var contentPosition = paragraph.GetList("ContentPosition") != null ? paragraph.GetList("ContentPosition").SelectedValue : ""; 3527 //content position 3528 // number 5 is a random one to make the first item greater than second one 3529 var contentCountTextDecisionFirst = contentPosition == "left" || contentPosition == "top" ? 1 : 0; 3530 var contentCountImageDecisionFirst = contentPosition == "left" || contentPosition == "top" ? 5 : 0; 3531 var contentCountTextDecisionSecond = contentPosition == "right" || contentPosition == "bottom" ? 5 : 0; 3532 var contentCountImageDecisionSecond = contentPosition == "right" || contentPosition == "bottom" ? 1 : 0; 3533 3534 var paragraphTextColumn = contentPosition == "top" || contentPosition == "bottom" ? "12" : "6"; 3535 var paragraphImageColumn = contentPosition == "top" || contentPosition == "bottom" ? "12" : "6"; 3536 3537 3538 3539 if (!paragraph.GetBoolean("RenderAsQuote")) 3540 { 3541 //string enableDropCap = Model.Item.GetString("EnableDropCap") != null ? Model.Item.GetList("EnableDropCap").SelectedValue.ToLower() : "default"; 3542 //enableDropCap = enableDropCap == "default" && GetParentSettingsItem("EnableDropCap") != null ? GetParentSettingsItem("EnableDropCap").ToString().ToLower() : enableDropCap; 3543 string text = paragraph.GetString("Text") != null ? paragraph.GetString("Text") : ""; 3544 3545 //if (!String.IsNullOrEmpty(text) && enableDropCap == "true" && count == 0 && paragraph.GetString("Text").Substring(0, 3) == "<p>") 3546 //{ 3547 // string firstLetter = paragraph.GetString("Text").Substring(3, 1); 3548 // text = paragraph.GetString("Text").Remove(3, 1); 3549 // text = text.Insert(3, "<span class=\"article__drop-cap\">" + firstLetter + "</span>"); 3550 // } 3551 3552 if (!String.IsNullOrEmpty(paragraph.GetString("Heading"))) 3553 { 3554 var hideHeading = paragraph.GetBoolean("HideHeading"); 3555 var hideHeadingClass = hideHeading == true ? "u-hidden" : ""; 3556 3557 Block articleParagraphHeader = new Block 3558 { 3559 Id = "ArticleParagraph" + count + "Heading", 3560 SortId = (count * 10), 3561 Component = new ArticleSubHeader { Title = paragraph.GetString("Heading") }, 3562 Design = new Design 3563 { 3564 RenderType = RenderType.Column, 3565 Size = paragraphListHeading, 3566 CssClass = String.Format("u-color-light--bg u-padding--lg {0}", hideHeadingClass) 3567 } 3568 }; 3569 articlePageComponent.Add("ArticleParagraph" + count, articleParagraphHeader); 3570 } 3571 3572 if (paragraph.GetFile("Image") != null) 3573 { 3574 string imageTitle = !string.IsNullOrEmpty(paragraph.GetString("Heading")) ? paragraph.GetString("Heading") : ""; 3575 3576 Block articleParagraphImage = new Block 3577 { 3578 Id = "ArticleParagraph" + count + "Image", 3579 SortId = (count * 10) + 2 + contentCountImageDecisionFirst + contentCountImageDecisionSecond, 3580 Design = new Design 3581 { 3582 RenderType = RenderType.Column, 3583 Size = paragraphImageColumn, 3584 CssClass = "u-color-light--bg u-padding--lg" 3585 } 3586 }; 3587 3588 if (imageLayout == "banner") 3589 { 3590 ArticleBanner banner = new ArticleBanner 3591 { 3592 Image = new Image { Path = paragraph.GetFile("Image"), ImageDefault = new ImageSettings { Height = 650, Width = 1300 }, Caption = paragraph.GetString("ImageCaption") }, 3593 Heading = imageTitle, 3594 UseFilters = false 3595 }; 3596 articleParagraphImage.Component = banner; 3597 } 3598 else 3599 { 3600 ArticleImage image = new ArticleImage 3601 { 3602 Image = new Image 3603 { 3604 Path = paragraph.GetFile("Image"), 3605 Title = imageTitle, 3606 ImageDefault = new ImageSettings { Height = 650, Width = 1300 }, 3607 Caption = paragraph.GetString("ImageCaption") 3608 } 3609 }; 3610 articleParagraphImage.Component = image; 3611 } 3612 3613 articlePageComponent.Add("ArticleParagraph" + count, articleParagraphImage); 3614 } 3615 3616 3617 if (!String.IsNullOrEmpty(text)) 3618 { 3619 Block articleParagraphText = new Block 3620 { 3621 Id = "ArticleParagraph" + count + "Text", 3622 SortId = (count * 10) + 3 + contentCountTextDecisionFirst + contentCountTextDecisionSecond, 3623 Component = new ArticleText { Text = text }, 3624 Design = new Design 3625 { 3626 RenderType = RenderType.Column, 3627 Size = paragraphTextColumn, 3628 CssClass = "u-color-light--bg u-padding--lg" 3629 } 3630 }; 3631 3632 articlePageComponent.Add("ArticleParagraph" + count, articleParagraphText); 3633 } 3634 3635 if (!String.IsNullOrEmpty(paragraph.GetString("VideoURL"))) 3636 { 3637 Block articleParagraphVideo = new Block 3638 { 3639 Id = "ArticleParagraph" + count + "Video", 3640 SortId = (count * 10) + 1, 3641 Component = new ArticleVideo { Url = paragraph.GetString("VideoURL"), AutoPlay = "false" }, 3642 Design = new Design 3643 { 3644 RenderType = RenderType.Column, 3645 Size = imageColumns, 3646 CssClass = "u-color-light--bg u-padding--lg" 3647 } 3648 }; 3649 articlePageComponent.Add("ArticleParagraph" + count, articleParagraphVideo); 3650 } 3651 } 3652 else 3653 { 3654 if (!String.IsNullOrEmpty(paragraph.GetString("Text"))) 3655 { 3656 string quoteText = paragraph.GetString("Text") != null ? paragraph.GetString("Text") : ""; 3657 string quoteAuthor = paragraph.GetString("Heading") != null ? paragraph.GetString("Heading") : ""; 3658 3659 Block articleParagraphQuote = new Block 3660 { 3661 Id = "ArticleParagraph" + count + "Quote", 3662 SortId = (count * 10) + 3, 3663 Component = new ArticleQuote { Image = new Image { Path = paragraph.GetFile("Image") }, Text = quoteText, Author = quoteAuthor }, 3664 Design = new Design 3665 { 3666 RenderType = RenderType.Column, 3667 Size = contentColumns, 3668 CssClass = "u-color-light--bg u-padding--lg" 3669 } 3670 }; 3671 articlePageComponent.Add("ArticleParagraph" + count, articleParagraphQuote); 3672 } 3673 } 3674 3675 3676 } 3677 3678 @using System.Reflection 3679 @using Dynamicweb.Rapido.Blocks.Components 3680 @using Dynamicweb.Rapido.Blocks.Components.Articles 3681 @using Dynamicweb.Rapido.Blocks 3682 3683 @functions{ 3684 //BlocksPage articlePageComponent = BlocksPage.GetBlockPage("DynamicArticle"); 3685 public class DF_RelatedProducts : ComponentBase 3686 { 3687 public string Title {get; set;} 3688 public string Id {get; set;} 3689 public string FeedPageId {get; set;} 3690 public string Query {get; set;} 3691 public string CurrentPageId {get; set;} 3692 public string CurrentProductId {get; set;} 3693 public int PageSize {get; set;} 3694 public bool productManual {get; set;} 3695 } 3696 } 3697 3698 @helper RenderDF_RelatedProducts(DF_RelatedProducts settings) 3699 { 3700 <section class="multiple-paragraphs-container paragraph-container--full-width article--related-products"> 3701 <div class="center-container dw-mod"> 3702 <div class="grid u-padding"> 3703 <div class="grid__col-md-12 grid__col-xs-12"> 3704 <h2 class="article__header u-no-margin u-margin-top">@settings.Title</h2> 3705 </div> 3706 </div> 3707 @if(settings.productManual == false) { 3708 <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> 3709 } else { 3710 <div class="js-handlebars-root true u-padding" id="@settings.Id" data-template="ProductContainer" data-json-feed="@settings.FeedPageId"></div> 3711 } 3712 3713 <script id="ProductContainer" type="text/x-template"> 3714 {{#.}} 3715 <div class="u-min-h400px u-full-width"> 3716 <div class="grid"> 3717 {{#ifCond totalPages '>' 1}} 3718 <div class="grid__col-45px grid__col--bleed-x content-promotion__buttons prev"> 3719 <div class="grid__cell grid__cell--align-middle-left"> 3720 @{ 3721 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}}')" }; 3722 prevButton.ExtraAttributes.Add("", "{{prevdisabled}}"); 3723 } 3724 @Render(prevButton) 3725 </div> 3726 </div> 3727 {{/ifCond}} 3728 <div class="grid__col-auto grid__col--bleed-x content-promotion__products"> 3729 <div id="ProductsContainer" data-template="ProductGridItemContainer" class="grid product-list dw-mod" data-save-cookie="true"> 3730 {{#ProductsContainer}} 3731 <div id="Product{{productId}}" class="grid__col-3 product-list__grid-item dw-mod"> 3732 {{#Product}} 3733 <div class="grid__col--auto js-product-scroll-trigger u-no-padding u-full-height" data-params="{{googleImpression}}"> 3734 <div class="grid__cell product-list__grid-item__image dw-mod {{noImage}}"> 3735 <a href="{{link}}" 3736 onclick="{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}" 3737 class="u-block u-position-relative image-hover__wrapper dw-mod"> 3738 @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" }) 3739 {{#StickersContainers}} 3740 {{>StickersContainer}} 3741 {{/StickersContainers}} 3742 </a> 3743 3744 <div class="favorites favorites--for-grid-view u-pull--right {{hasVariants}} dw-mod" {{hasVariants}}> 3745 {{#Favorite}} 3746 {{>FavoriteTemplate}} 3747 {{/Favorite}} 3748 </div> 3749 3750 </div> 3751 3752 <div class="grid__cell product-list__grid-item__price-info dw-mod"> 3753 <a href="{{link}}" onclick="{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}" title="{{name}}" class="u-color-inherit"> 3754 @Render(new Heading { Title = "{{name}}", Level = 6, CssClass = "u-condensed-text u-bold" }) 3755 </a> 3756 @RenderGridViewPriceInfo() 3757 </div> 3758 3759 <div class="product-list__grid-item__footer dw-mod"> 3760 @RenderProductGridItemAddToCart() 3761 </div> 3762 </div> 3763 {{/Product}} 3764 </div> 3765 {{/ProductsContainer}} 3766 </div> 3767 </div> 3768 {{#ifCond totalPages '>' 1}} 3769 <div class="grid__col-45px grid__col--bleed-x content-promotion__buttons next"> 3770 <div class="grid__cell grid__cell--align-middle-right"> 3771 @{ 3772 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}}')" }; 3773 nextButton.ExtraAttributes.Add("", "{{nextdisabled}}"); 3774 } 3775 @Render(nextButton) 3776 </div> 3777 </div> 3778 {{/ifCond}} 3779 </div> 3780 </div> 3781 {{/.}} 3782 </script> 3783 <script id="StickersContainer" type="text/x-template"> 3784 <div class="stickers-container stickers-container--{{{convertStickerPositionToClassName Position}}} dw-mod"> 3785 {{#Stickers}} 3786 {{>Sticker}} 3787 {{/Stickers}} 3788 </div> 3789 </script> 3790 3791 <script id="Sticker" type="text/x-template"> 3792 @Render(new Sticker { Title = "{{Title}}", CssClass = "{{CssClass}}" }) 3793 </script> 3794 3795 <script> 3796 @{ 3797 bool relatedUseGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 3798 3799 if (relatedUseGoogleTagManager) 3800 { 3801 <text> 3802 document.addEventListener("DOMContentLoaded", function (event) { 3803 Scroll.AddIsInViewportListener(".js-product-scroll-trigger", function (elem) { 3804 let googleImpression = JSON.parse(elem.getAttribute("data-params")); 3805 googleImpression.list = "Related products"; 3806 googleEnchantImpression(googleImpression); 3807 elem.classList.remove("js-product-scroll-trigger"); 3808 }); 3809 }); 3810 </text> 3811 } 3812 } 3813 </script> 3814 </div> 3815 </section> 3816 } 3817 3818 @helper RenderGridViewPriceInfo() 3819 { 3820 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 3821 bool showPrice = !Pageview.AreaSettings.GetItem("ProductList").GetBoolean("HidePrice"); 3822 bool showCartButton = Pageview.AreaSettings.GetItem("ProductList").GetItem("GridView").GetBoolean("ShowAddToCartButton"); 3823 bool showVATPrice = Pageview.AreaSettings.GetItem("ProductList").GetBoolean("ShowBothPricesWithWithoutVAT"); 3824 bool isPricesWithVATEnabled = Dynamicweb.Ecommerce.Common.Context.DisplayPricesWithVat; 3825 3826 if (showPrice && Dynamicweb.Rapido.Services.User.IsPricesAllowed()) 3827 { 3828 if (pointShopOnly) 3829 { 3830 <text> 3831 {{#if havePointPrice}} 3832 <div class="price price--product-list dw-mod">{{points}} @Translate("points")</div> 3833 @if (showCartButton) 3834 { 3835 <text> 3836 {{#unless canBePurchasedWithPoints}} 3837 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small> 3838 {{/unless}} 3839 </text> 3840 } 3841 {{else}} 3842 @Translate("Not available") 3843 {{/if}} 3844 </text> 3845 } 3846 else 3847 { 3848 <div class="price price--product-list dw-mod">{{price}}</div> 3849 <div class="before-price {{onSale}} dw-mod">{{discount}}</div> 3850 if (showVATPrice) 3851 { 3852 <div class="vat-price vat-price--product-list u-margin-top dw-mod"> 3853 @if (isPricesWithVATEnabled) 3854 { 3855 <span>@Translate("excl. VAT")</span><span> ({{priceWithoutVAT}})</span> 3856 } 3857 else 3858 { 3859 <span>@Translate("incl. VAT")</span><span> ({{priceWithVAT}})</span> 3860 } 3861 </div> 3862 } 3863 <text> 3864 {{#if priceRRP}} 3865 <div><small>@Translate("RRP") {{priceRRP}}</small></div> 3866 {{/if}} 3867 </text> 3868 } 3869 } 3870 } 3871 3872 @helper RenderProductGridItemAddToCart() { 3873 var gridViewSettings = Pageview.AreaSettings.GetItem("ProductList").GetItem("GridView"); 3874 var ecommerceSettings = Pageview.AreaSettings.GetItem("Ecommerce"); 3875 3876 bool pointShopOnly = ecommerceSettings.GetBoolean("PointShopOnly"); 3877 bool showCartButton = gridViewSettings.GetBoolean("ShowAddToCartButton"); 3878 bool showViewButton = gridViewSettings.GetBoolean("ShowViewButton"); 3879 string viewMoreText = gridViewSettings.GetString("ViewMoreText"); 3880 viewMoreText = !string.IsNullOrEmpty(viewMoreText) ? viewMoreText : "View"; 3881 string wrapperClass = "buttons-collection--center"; 3882 int columnsCount = gridViewSettings.GetList("Columns") != null ? Converter.ToInt32(gridViewSettings.GetList("Columns").SelectedValue) : 4; 3883 bool hideButtonText = columnsCount >= 4 || Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet"; 3884 3885 if (pointShopOnly && columnsCount <= 4) 3886 { 3887 hideButtonText = false; 3888 } 3889 3890 var viewBtn = new Link 3891 { 3892 Href = "{{link}}", 3893 Id = "CartButton_{{id}}", 3894 Title = Translate(viewMoreText), 3895 OnClick = "{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}", 3896 ButtonLayout = ButtonLayout.Secondary, 3897 CssClass = "u-no-margin" 3898 }; 3899 3900 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed()) 3901 { 3902 var addToCartBtn = new AddToCart 3903 { 3904 WrapperCssClass = wrapperClass, 3905 AddButton = new AddToCartButton 3906 { 3907 ProductId = "{{productId}}", 3908 VariantId = "{{variantid}}", 3909 UnitId = "{{unitId}}", 3910 ProductInfo = "{{productInfo}}", 3911 BuyForPoints = pointShopOnly, 3912 HideTitle = hideButtonText, 3913 OnClick = "{{facebookPixelAction}}", 3914 ExtraAttributes = new Dictionary<string, string> 3915 { 3916 { "{{disabledBuyButton}}", "" } 3917 } 3918 } 3919 }; 3920 3921 if (!pointShopOnly) 3922 { 3923 addToCartBtn.QuantitySelector = new QuantitySelector 3924 { 3925 Id = "Quantity{{id}}" 3926 }; 3927 } 3928 3929 if (showCartButton && Dynamicweb.Rapido.Services.User.IsBuyingAllowed()) 3930 { 3931 if (!showViewButton) 3932 { 3933 @Render(addToCartBtn) 3934 } 3935 else 3936 { 3937 <text>{{#if hideAddToCartButton}}</text> 3938 <div>@Render(viewBtn)</div> 3939 <text>{{else}}</text> 3940 @Render(addToCartBtn) 3941 <text>{{/if}}</text> 3942 } 3943 } 3944 else if (showViewButton) 3945 { 3946 <div>@Render(viewBtn)</div> 3947 } 3948 } 3949 else if (showViewButton) 3950 { 3951 <div>@Render(viewBtn)</div> 3952 } 3953 } 3954 3955 @* Simple helpers *@ 3956 3957 @*Requires the Gallery ItemType that comes with Rapido*@ 3958 @helper RenderArticleItemGallery(IList<ItemViewModel> gallery) { 3959 if (gallery != null && gallery.Count > 0) 3960 { 3961 int count = 1; 3962 3963 foreach (var item in gallery) 3964 { 3965 if (item.GetFile("ImagePath") != null) 3966 { 3967 string image = item.GetFile("ImagePath").PathUrlEncoded; 3968 string imagePrefix = "/Admin/Public/GetImage.ashx?width=1200&amp;height=820&amp;crop=5&amp;Compression=75&amp;DoNotUpscale=1&amp;image="; 3969 int imagesCount = gallery.Count; 3970 3971 if (count == 1) 3972 { 3973 <label class="gallery" for="ParagraphGalleryModalTrigger" onclick="Gallery.openImage(this.querySelector('.js-gallery'))"> 3974 <span class="gallery__main-image"> 3975 <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" /> 3976 </span> 3977 <span class="gallery__image-counter"> 3978 <i class="fas fa-camera fa-2x"></i> <span class="gallery__image-counter__number">@imagesCount</span> 3979 <span class="gallery__image-counter__text">@Translate("See all") <i class="fas fa-angle-right"></i></span> 3980 </span> 3981 </label> 3982 } 3983 else 3984 { 3985 <div class="u-hidden js-gallery" data-for="ParagraphGallery" data-image="@imagePrefix@image"></div> 3986 } 3987 3988 count++; 3989 } 3990 } 3991 3992 @Render(new ArticleGalleryModal()) 3993 } 3994 } 3995 3996 @helper RenderMobileFilters(List<Block> subBlocks) 3997 { 3998 if (subBlocks.Count > 0) 3999 { 4000 <div class="grid__col-12"> 4001 <input type="checkbox" id="CheckFilters" class="js-remember-state u-hidden" data-expand="CheckFilters" /> 4002 <div class="grid u-margin-bottom dw-mod" data-trigger="CheckFilters"> 4003 @RenderBlockList(subBlocks) 4004 </div> 4005 <label for="CheckFilters" class="btn btn--secondary btn--full dw-mod js-expand-hide" data-trigger="CheckFilters">@Translate("Select filters")</label> 4006 <label for="CheckFilters" class="btn btn--secondary btn--full dw-mod expandable--collapsed" data-trigger="CheckFilters">@Translate("Close filters")</label> 4007 </div> 4008 } 4009 } 4010 4011 4012 @* Include the Blocks for the page *@ 4013 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 4014 4015 @using System 4016 @using System.Web 4017 @using System.Collections.Generic 4018 @using Dynamicweb.Rapido.Blocks.Extensibility 4019 @using Dynamicweb.Rapido.Blocks 4020 4021 @functions { 4022 string GoogleTagManagerID = ""; 4023 string GoogleAnalyticsID = ""; 4024 } 4025 4026 @{ 4027 GoogleTagManagerID = Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID"); 4028 GoogleAnalyticsID = Model.Area.Item.GetItem("Settings").GetString("GoogleAnalyticsTrackingID"); 4029 4030 BlocksPage topSnippetsBlocksPage = BlocksPage.GetBlockPage("Master"); 4031 4032 if (!string.IsNullOrWhiteSpace(GoogleAnalyticsID)) 4033 { 4034 Block tagManager = new Block() 4035 { 4036 Id = "GoogleAnalytics", 4037 SortId = 0, 4038 Template = RenderGoogleAnalyticsSnippet() 4039 }; 4040 topSnippetsBlocksPage.Add("Head", tagManager); 4041 } 4042 4043 if (!string.IsNullOrWhiteSpace(GoogleTagManagerID)) 4044 { 4045 Block tagManager = new Block() 4046 { 4047 Id = "TagManager", 4048 SortId = 1, 4049 Template = RenderGoogleTagManager() 4050 }; 4051 topSnippetsBlocksPage.Add("Head", tagManager); 4052 4053 Block tagManagerBodySnippet = new Block() 4054 { 4055 Id = "TagManagerBodySnippet", 4056 SortId = 1, 4057 Template = RenderGoogleTagManagerBodySnippet() 4058 }; 4059 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, tagManagerBodySnippet); 4060 } 4061 4062 Block facebookPixel = new Block() 4063 { 4064 Id = "FacebookPixel", 4065 SortId = 2, 4066 Template = RenderFacebookPixel() 4067 }; 4068 4069 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, facebookPixel); 4070 } 4071 4072 @helper RenderGoogleAnalyticsSnippet() 4073 { 4074 <!-- Global site tag (gtag.js) - Google Analytics --> 4075 <script async src="https://www.googletagmanager.com/gtag/js?id=@GoogleAnalyticsID"></script> 4076 <script> 4077 window.dataLayer = window.dataLayer || []; 4078 function gtag(){dataLayer.push(arguments);} 4079 gtag('js', new Date()); 4080 4081 gtag('config', '@GoogleAnalyticsID'); 4082 </script> 4083 4084 } 4085 4086 @helper RenderGoogleTagManager() 4087 { 4088 <script> 4089 (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': 4090 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], 4091 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 4092 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); 4093 })(window,document,'script','dataLayer','@GoogleTagManagerID'); 4094 </script> 4095 } 4096 4097 @helper RenderGoogleTagManagerBodySnippet() 4098 { 4099 <!-- Google Tag Manager (noscript) --> 4100 <noscript> 4101 <iframe src="https://www.googletagmanager.com/ns.html?id=@GoogleTagManagerID" 4102 height="0" width="0" style="display:none;visibility:hidden"></iframe> 4103 </noscript> 4104 <!-- End Google Tag Manager (noscript) --> 4105 } 4106 4107 @helper RenderFacebookPixel() 4108 { 4109 string FacebookPixelID = Model.Area.Item.GetItem("Settings").GetString("FacebookPixelID"); 4110 4111 if (!string.IsNullOrWhiteSpace(FacebookPixelID)) 4112 { 4113 <!-- Facebook Pixel Code --> 4114 <script> 4115 !function(f,b,e,v,n,t,s) 4116 {if(f.fbq)return;n=f.fbq=function(){n.callMethod? 4117 n.callMethod.apply(n,arguments):n.queue.push(arguments)}; 4118 if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0'; 4119 n.queue=[];t=b.createElement(e);t.async=!0; 4120 t.src=v;s=b.getElementsByTagName(e)[0]; 4121 s.parentNode.insertBefore(t,s)}(window, document,'script', 4122 'https://connect.facebook.net/en_US/fbevents.js'); 4123 fbq('init', '@FacebookPixelID'); 4124 fbq('track', 'PageView'); 4125 </script> 4126 <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=@FacebookPixelID&ev=PageView&noscript=1" alt="" /></noscript> 4127 } 4128 } 4129 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 4130 4131 @using System 4132 @using System.Web 4133 @using System.Collections.Generic 4134 @using Dynamicweb.Rapido.Blocks 4135 @using Dynamicweb.Rapido.Blocks.Extensibility 4136 @using Dynamicweb.Security.UserManagement 4137 @using Dynamicweb.Security.UserManagement.ExternalAuthentication 4138 @using Dynamicweb.Rapido.Blocks.Components.General 4139 4140 @{ 4141 BlocksPage loginBlocksPage = BlocksPage.GetBlockPage("Master"); 4142 4143 Block loginModal = new Block() 4144 { 4145 Id = "LoginModal", 4146 SortId = 10, 4147 Component = new Modal 4148 { 4149 Id = "SignIn", 4150 Heading = new Heading 4151 { 4152 Level = 0, 4153 Title = Translate("Sign in") 4154 }, 4155 Width = ModalWidth.Sm, 4156 BodyTemplate = RenderLoginForm() 4157 } 4158 }; 4159 4160 loginBlocksPage.Add(MasterBlockId.MasterTopSnippets, loginModal); 4161 } 4162 4163 @helper RenderLoginForm() 4164 { 4165 int pageId = Model.TopPage.ID; 4166 string userSignedInErrorText = ""; 4167 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 4168 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; 4169 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 4170 bool showModalOnStart = pageId != GetPageIdByNavigationTag("CustomerCenter") && Model.LogOnFailed; 4171 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); 4172 bool hideForgotPasswordLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideForgotPasswordLink"); 4173 4174 ProviderCollection providers = Provider.GetActiveProviders(); 4175 4176 if (Model.LogOnFailed) 4177 { 4178 switch (Model.LogOnFailedReason) 4179 { 4180 case LogOnFailedReason.PasswordLengthInvalid: 4181 userSignedInErrorText = Translate("Password length is invalid"); 4182 break; 4183 case LogOnFailedReason.IncorrectLogin: 4184 userSignedInErrorText = Translate("Invalid email or password"); 4185 break; 4186 case LogOnFailedReason.ExceededFailedLogOnLimit: 4187 userSignedInErrorText = Translate("You have exceeded the limit of allowed login attempts. The user account is temporarily locked"); 4188 break; 4189 case LogOnFailedReason.LoginLocked: 4190 userSignedInErrorText = Translate("The user account is temporarily locked"); 4191 break; 4192 case LogOnFailedReason.PasswordExpired: 4193 userSignedInErrorText = Translate("The password has expired and needs to be renewed"); 4194 break; 4195 default: 4196 userSignedInErrorText = Translate("An unknown error occured"); 4197 break; 4198 } 4199 } 4200 4201 Form form = new Form { Method = FormMethod.Post, Name = "LoginModalForm" }; 4202 4203 TextField passwordField = new TextField { Id = "login-password", Type = TextFieldType.Password, Name = "password", Label = Translate("Password"), Required = true }; 4204 4205 if (!hideForgotPasswordLink) { 4206 passwordField.Link = new Link { Title = Translate("Forgot password?"), Href = "/Default.aspx?id=" + signInProfilePageId + "&LoginAction=Recovery" }; 4207 } 4208 4209 form.Add(new HiddenField { Name = "ID", Value = Converter.ToString(pageId) }); 4210 form.Add(new HiddenField { Name = "DWExtranetUsernameRemember", Value = "True" }); 4211 form.Add(new HiddenField { Name = "DWExtranetPasswordRemember", Value = "True" }); 4212 form.Add(new HiddenField { Name = "LoginAction", Value = "Login" }); 4213 form.Add(new TextField { Id = "LoginUsername", Name = "username", Label = Translate("Email"), CssClass = "u-full-width", Required = true }); 4214 form.Add(passwordField); 4215 form.Add(new NotificationMessage { Message = userSignedInErrorText, MessageType = NotificationMessageType.Error }); 4216 form.Add(new CheckboxField { Id = "LoginRememberMe", Value = "True", Name = "Autologin", Label = Translate("Remember me") }); 4217 form.Add(new Button { ButtonType = ButtonType.Submit, Title = Translate("Sign in"), CssClass = "btn--full", OnClick = "Buttons.LockButton(event)" }); 4218 4219 foreach (Provider LoginProvider in providers) 4220 { 4221 var ProviderName = LoginProvider.Name.ToLower(); 4222 form.Add(new Link { 4223 Href = "/Admin/Public/Social/ExternalLogin.aspx?action=login&providerID=" + LoginProvider.ID, 4224 Icon = new Icon { Prefix = "fab", Name = "fa-" + ProviderName, CssClass = "fa-1_5x", LabelPosition = IconLabelPosition.After }, 4225 ButtonLayout = ButtonLayout.LinkClean, 4226 CssClass = "btn--condensed u-margin-bottom u-margin-right u-inline-block u-color-" + ProviderName, 4227 AltText = ProviderName 4228 }); 4229 } 4230 4231 if (!hideCreateAccountLink) { 4232 form.Add(new Text { Content = "<div class=\"u-border-top u-full-width u-margin-bottom--lg\"></div>" }); 4233 form.Add(new Link 4234 { 4235 Href = "/Default.aspx?id=" + createAccountPageId, 4236 ButtonLayout = ButtonLayout.LinkClean, 4237 Title = Translate("Create account"), 4238 CssClass = "u-full-width u-ta-center" 4239 }); 4240 } 4241 4242 @Render(form) 4243 4244 if (showModalOnStart) 4245 { 4246 <script> 4247 document.getElementById("SignInModalTrigger").checked = true; 4248 </script> 4249 } 4250 } 4251 4252 @if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet") 4253 { 4254 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4255 4256 @using System 4257 @using System.Web 4258 @using System.Collections.Generic 4259 @using Dynamicweb.Rapido.Blocks.Extensibility 4260 @using Dynamicweb.Rapido.Blocks 4261 @using Dynamicweb.Rapido.Services 4262 4263 4264 @functions { 4265 BlocksPage mobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master"); 4266 } 4267 4268 @{ 4269 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"; 4270 bool mobileHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 4271 bool mobileHideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart") || !Dynamicweb.Rapido.Services.User.IsBuyingAllowed(); 4272 4273 var totalNumberOfProductsForDefault = 0; 4274 using (var contexter = new OrderContexter(Dynamicweb.Ecommerce.Orders.OrderContext.GetOrderContextById("ORDERCONTEXT7"))) 4275 { 4276 var cartContext = Dynamicweb.Ecommerce.Common.Context.Cart; 4277 totalNumberOfProductsForDefault = cartContext != null ? Converter.ToInt32(cartContext.ProductOrderLines.Sum(ol => ol.Quantity)) : 0; 4278 } 4279 4280 var totalNumberOfProductsForIngrasaminte = 0; 4281 using (var contexter = new OrderContexter(Dynamicweb.Ecommerce.Orders.OrderContext.GetOrderContextById("ORDERCONTEXT5"))) 4282 { 4283 var cartContext = Dynamicweb.Ecommerce.Common.Context.Cart; 4284 totalNumberOfProductsForIngrasaminte = cartContext != null ? Converter.ToInt32(cartContext.ProductOrderLines.Sum(ol => ol.Quantity)) : 0; 4285 } 4286 4287 var totalNumberOfProductsForAllCarts = totalNumberOfProductsForDefault + totalNumberOfProductsForIngrasaminte; 4288 4289 Block mobileHeader = new Block() 4290 { 4291 Id = "MobileTop", 4292 SortId = 10, 4293 Template = RenderMobileTop(), 4294 SkipRenderBlocksList = true 4295 }; 4296 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeader); 4297 4298 Block mobileHeaderNavigation = new Block() 4299 { 4300 Id = "MobileHeaderNavigation", 4301 SortId = 10, 4302 Template = RenderMobileHeaderNavigation(), 4303 SkipRenderBlocksList = true, 4304 BlocksList = new List<Block> { 4305 new Block { 4306 Id = "MobileHeaderNavigationTrigger", 4307 SortId = 10, 4308 Template = RenderMobileHeaderNavigationTrigger() 4309 } 4310 } 4311 }; 4312 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderNavigation); 4313 4314 Block mobileHeaderLogo = new Block() 4315 { 4316 Id = "MobileHeaderLogo", 4317 SortId = 20, 4318 Template = RenderMobileHeaderLogo(), 4319 SkipRenderBlocksList = true 4320 }; 4321 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderLogo); 4322 4323 Block mobileHeaderActions = new Block() 4324 { 4325 Id = "MobileHeaderActions", 4326 SortId = 30, 4327 Template = RenderMobileTopActions(), 4328 SkipRenderBlocksList = true 4329 }; 4330 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderActions); 4331 4332 Block mobileHeaderSignIn = new Block() 4333 { 4334 Id = "MobileHeaderAccount", 4335 SortId = 70, 4336 Template = RenderMobileHeaderSignIn(), 4337 SkipRenderBlocksList = true 4338 }; 4339 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderSignIn); 4340 4341 4342 Block mobileHeaderActions2 = new Block() 4343 { 4344 Id = "MobileHeaderActions2", 4345 SortId = 80, 4346 Template = RenderMobileTopActions2(), 4347 SkipRenderBlocksList = true 4348 }; 4349 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderActions2); 4350 4351 if (!mobileHideSearch) 4352 { 4353 Block mobileHeaderSearch = new Block 4354 { 4355 Id = "MobileHeaderSearch", 4356 SortId = 10, 4357 Template = RenderMobileTopSearch() 4358 }; 4359 mobileHeaderBlocksPage.Add("mobileHeaderActions2", mobileHeaderSearch); 4360 } 4361 4362 Block mobileHeaderMiniCart; 4363 4364 if (!mobileHideCart) 4365 { 4366 mobileHeaderMiniCart = new Block 4367 { 4368 Id = "MobileHeaderMiniCart", 4369 SortId = 20, 4370 Template = RenderMobileTopMiniCart(totalNumberOfProductsForDefault, totalNumberOfProductsForIngrasaminte) 4371 }; 4372 4373 Block miniCartCounterScriptTemplate = new Block 4374 { 4375 Id = "MiniCartCounterScriptTemplate", 4376 Template = RenderMobileMiniCartCounterContent() 4377 }; 4378 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate); 4379 } 4380 else 4381 { 4382 mobileHeaderMiniCart = new Block 4383 { 4384 Id = "MobileHeaderMiniCart", 4385 SortId = 20 4386 }; 4387 } 4388 4389 if (!mobileHideSearch) 4390 { 4391 Block mobileHeaderSearchBar = new Block() 4392 { 4393 Id = "MobileHeaderSearchBar", 4394 SortId = 30, 4395 Template = RenderMobileTopSearchBar() 4396 }; 4397 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeaderSearchBar); 4398 } 4399 4400 4401 4402 4403 4404 4405 4406 switch (mobileTopLayout) 4407 { 4408 case "nav-left": 4409 mobileHeaderNavigation.SortId = 10; 4410 mobileHeaderLogo.SortId = 20; 4411 mobileHeaderActions.SortId = 30; 4412 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart); 4413 break; 4414 case "nav-right": 4415 mobileHeaderLogo.SortId = 10; 4416 mobileHeaderActions.SortId = 20; 4417 mobileHeaderNavigation.SortId = 30; 4418 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart); 4419 break; 4420 case "nav-search-left": 4421 mobileHeaderNavigation.SortId = 10; 4422 mobileHeaderLogo.SortId = 20; 4423 mobileHeaderActions.SortId = 30; 4424 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart); 4425 break; 4426 case "search-left": 4427 mobileHeaderActions.SortId = 10; 4428 mobileHeaderLogo.SortId = 20; 4429 mobileHeaderNavigation.SortId = 30; 4430 mobileHeaderMiniCart.SortId = 0; 4431 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart); 4432 break; 4433 } 4434 } 4435 4436 4437 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4438 4439 @using System 4440 @using System.Web 4441 @using Dynamicweb.Rapido.Blocks.Extensibility 4442 @using Dynamicweb.Rapido.Blocks 4443 4444 @{ 4445 BlocksPage customMobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master"); 4446 } 4447 4448 4449 4450 4451 @helper RenderMobileTop() { 4452 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileTop").OrderBy(item => item.SortId).ToList(); 4453 4454 <nav class="main-navigation-mobile dw-mod"> 4455 <div class="center-container top-container__center-container dw-mod"> 4456 <div class="grid grid--align-center mobile__header-items"> 4457 @RenderBlockList(subBlocks) 4458 </div> 4459 </div> 4460 </nav> 4461 } 4462 4463 @helper RenderMobileHeaderNavigation() { 4464 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderNavigation").OrderBy(item => item.SortId).ToList(); 4465 4466 <div class="grid__col-auto-width grid__col--bleed hamburger__item"> 4467 <ul class="menu dw-mod"> 4468 @RenderBlockList(subBlocks) 4469 </ul> 4470 </div> 4471 } 4472 4473 @helper RenderMobileHeaderNavigationTrigger() { 4474 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 4475 <label for="MobileNavTrigger" class="mobile-nav-trigger-button menu__link menu__link--icon menu__link--mobile dw-mod"></label> 4476 </li> 4477 } 4478 4479 @helper RenderMobileHeaderLogo() { 4480 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderLogo").OrderBy(item => item.SortId).ToList(); 4481 4482 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"; 4483 string centeredLogo = mobileTopLayout != "nav-right" ? "u-ta-center" : ""; 4484 string firstPageId = Model.Area.FirstActivePage.ID.ToString(); 4485 string businessName = Model.Area.Item.GetItem("Settings").GetString("BusinessName"); 4486 4487 string logoLink = Pageview.Area.CultureInfo.TwoLetterISOLanguageName; 4488 logoLink = logoLink == "en" ? "/en" : "/"; 4489 4490 string mobileLogo = "/Files/Images/logo-dynamicweb.png"; 4491 if (Model.Area.Item.GetItem("Layout").GetItem("MobileTop") != null && Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo") != null) 4492 { 4493 mobileLogo = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo").PathUrlEncoded; 4494 } 4495 4496 if (Path.GetExtension(mobileLogo).ToLower() != ".svg") 4497 { 4498 mobileLogo = "/Admin/Public/GetImage.ashx?height=40&amp;width=100&amp;crop=5&amp;Compression=75&amp;image=" + mobileLogo; 4499 } 4500 else 4501 { 4502 mobileLogo = HttpUtility.UrlDecode(mobileLogo); 4503 } 4504 4505 <div class="grid__col-auto grid__col--bleed logo__item"> 4506 <div class="grid__cell @centeredLogo"> 4507 <a href="@logoLink" class="logo logo--mobile u-inline-block dw-mod"> 4508 <img class="grid__cell-img logo__img logo__img--mobile dw-mod" src="@mobileLogo" alt="@businessName" /> 4509 </a> 4510 </div> 4511 4512 @RenderBlockList(subBlocks) 4513 </div> 4514 } 4515 4516 @helper RenderMobileTopActions() { 4517 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderActions").OrderBy(item => item.SortId).ToList(); 4518 4519 <div class="grid__col-auto-width grid__col--bleed cart__item"> 4520 <ul class="menu dw-mod"> 4521 @RenderBlockList(subBlocks) 4522 </ul> 4523 </div> 4524 } 4525 4526 @helper RenderMobileTopActions2() { 4527 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderActions2").OrderBy(item => item.SortId).ToList(); 4528 4529 <div class="grid__col-auto-width grid__col--bleed search__item"> 4530 <ul class="menu dw-mod"> 4531 @RenderBlockList(subBlocks) 4532 </ul> 4533 </div> 4534 } 4535 4536 @helper RenderMobileHeaderSignIn() { 4537 <div class="menu-mobile__item grid__col--bleed account__item"> 4538 <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> 4539 </div> 4540 } 4541 4542 4543 4544 @helper RenderMobileTopSearch() { 4545 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 4546 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> 4547 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> 4548 </label> 4549 </li> 4550 } 4551 4552 @helper RenderMobileTopMiniCart(int totalNumberOfProductsForDefault = 0, int totalNumberOfProductsForIngrasaminte = 0) { 4553 int miniCartFeedDefaultPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4554 int miniCartFeedIngrasamintePageId = GetPageIdByNavigationTag("MiniCartFeedIngrasaminte"); 4555 int miniCartFeedSelectedPageId = totalNumberOfProductsForDefault > 0 || totalNumberOfProductsForIngrasaminte == 0 ? miniCartFeedDefaultPageId : miniCartFeedIngrasamintePageId; 4556 4557 string cartProductsCount = (totalNumberOfProductsForDefault + totalNumberOfProductsForIngrasaminte).ToString(); 4558 4559 int cartPageId = GetPageIdByNavigationTag("CartPage"); 4560 int cartPageIngrasaminteId = GetPageIdByNavigationTag("CartPageIngrasaminte"); 4561 4562 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod" id="miniCartWrapper"> 4563 <div class="mini-cart dw-mod"> 4564 <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"> 4565 <div id="minicart_icon" class="u-inline u-position-relative" data-miniCartFeedId="@miniCartFeedDefaultPageId" data-miniCartFeed-IngrasaminteId="@miniCartFeedIngrasamintePageId" data-miniCart-ContextId="@miniCartFeedSelectedPageId"> 4566 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue fa-1_5x"></i> 4567 <div class="mini-cart__counter dw-mod"> 4568 <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"> 4569 <div class="js-mini-cart-counter-content" data-count="@cartProductsCount"> 4570 @cartProductsCount 4571 </div> 4572 </div> 4573 </div> 4574 </div> 4575 </a> 4576 </div> 4577 </li> 4578 } 4579 4580 @helper RenderMobileTopSearchBar() 4581 { 4582 string searchFeedId = ""; 4583 string searchSecondFeedId = ""; 4584 int groupsFeedId; 4585 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 4586 // string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 4587 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults").ToString(); 4588 string resultPageLink; 4589 string searchPlaceholder; 4590 string searchType = "product-search"; 4591 string searchTemplate; 4592 string searchContentTemplate = ""; 4593 string searchValue = HttpContext.Current.Request.QueryString.Get("q") ?? ""; 4594 bool showGroups = true; 4595 4596 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch") 4597 { 4598 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 4599 resultPageLink = contentSearchPageLink; 4600 searchPlaceholder = Translate("Search page"); 4601 groupsFeedId = 0; 4602 searchType = "content-search"; 4603 searchTemplate = "SearchPagesTemplate"; 4604 showGroups = false; 4605 } 4606 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch") 4607 { 4608 searchFeedId = productsPageId + "&feed=true"; 4609 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 4610 resultPageLink = Converter.ToString(productsPageId); 4611 searchPlaceholder = Translate("Search products or pages"); 4612 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 4613 searchType = "combined-search"; 4614 searchTemplate = "SearchProductsTemplateWrap"; 4615 searchContentTemplate = "SearchPagesTemplateWrap"; 4616 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 4617 } 4618 else 4619 { 4620 resultPageLink = Converter.ToString(productsPageId); 4621 searchFeedId = productsPageId + "&feed=true"; 4622 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 4623 searchPlaceholder = Translate("Search products"); 4624 searchTemplate = "SearchProductsTemplate"; 4625 searchType = "product-search"; 4626 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 4627 } 4628 4629 @*<input type="checkbox" id="MobileSearchTrigger" class="mobile-search-trigger" />*@ 4630 4631 <div class="main-navigation-mobile typeahead-mobile dw-mod"> 4632 <div class="center-container top-container__center-container dw-mod"> 4633 <div class="grid"> 4634 <div class="grid__col-auto" style="padding-left:0; padding-right:0;"> 4635 <div class="typeahead-mobile__search-field dw-mod js-typeahead" data-page-size="@(searchType == "combined-search" ? 4 : 8)" id="MobileProductSearch" data-search-feed-id="@searchFeedId" data-search-second-feed-id="@searchSecondFeedId" data-result-page-id="@resultPageLink" data-search-type="@searchType" data-search-parameter-name="q"> 4636 <input name="q" type="text" class="js-typeahead-search-field u-w160px u-no-margin" placeholder="@searchPlaceholder" value="@searchValue"> 4637 @if (string.IsNullOrEmpty(searchSecondFeedId)) 4638 { 4639 <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> 4640 } 4641 else 4642 { 4643 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--combined-mobile grid"> 4644 <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> 4645 <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> 4646 </div> 4647 } 4648 <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> 4649 </div> 4650 </div> 4651 <!-- <div class="grid__col-auto-width close__button"> 4652 <ul class="menu dw-mod"> 4653 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 4654 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> 4655 <i class="fas fa-times fa-1_5x"></i> 4656 </label> 4657 </li> 4658 </ul> 4659 </div> --> 4660 </div> 4661 </div> 4662 </div> 4663 } 4664 4665 @helper RenderMobileMiniCartCounterContent() 4666 { 4667 <script id="MiniCartCounterContent" type="text/x-template"> 4668 {{#.}} 4669 <div class="js-mini-cart-counter-content dw-mod" data-count="{{totalnumberofproductsforallcarts}}"> 4670 {{totalnumberofproductsforallcarts}} 4671 </div> 4672 {{/.}} 4673 </script> 4674 } 4675 4676 4677 @helper RenderCheckCartModal(int totalNumberOfProductsForDefault = 0, int totalNumberOfProductsForIngrasaminte = 0) { 4678 int cartRegularProductsCount = Converter.ToInt32(Model.Cart.TotalProductsCount); 4679 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage"); 4680 string cartIngrasamintePageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPageIngrasaminte"); 4681 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4682 4683 <div class="check-cart__wrapper u-hidden"> 4684 4685 <label for="Check_Cart" class="dw-mod"> 4686 <button class="u-no-margin u-margin-top--lg btn btn--primary dw-mod" style="pointer-events: none;">@Translate("Selecteaza Cosul")</button> 4687 </label> 4688 <!-- Trigger for the login modal --> 4689 <input type="checkbox" id="Check_Cart" class="modal-trigger"/> 4690 </div> 4691 <!-- Add address modal --> 4692 <div class="modal-container"> 4693 <label for="Check_Cart" id="CheckCartModalOverlay" class="modal-overlay"></label> 4694 <div class="modal modal--md" id="CheckCartModal"> 4695 <div class="modal__header no-border"> 4696 <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> 4697 <h2 class="u-ta-center">@Translate("Selecteaza Cosul")</h2> 4698 </div> 4699 <div class="modal__body"> 4700 <div class="mini-cart-dropdown__body u-flex dw-mod"> 4701 <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> 4702 </div> 4703 </div> 4704 </div> 4705 </div> 4706 4707 <script id="MiniCartContentMobileTemplate" type="text/x-template"> 4708 {{#.}} 4709 <div class="form__field-group--bordered" style="padding:1rem;"> 4710 <div class="container__cart-type"> 4711 <div class="radio"> 4712 <div> 4713 <input id="cart1" name="radio-2" value="" type="radio" checked> 4714 <label for="cart1" class="radio-label">Cosul Ingrasaminte:</label> 4715 </div> 4716 <div class="radio__item"> 4717 <div style="font-size: 1.4rem;">Nr. Produs(e):<span style="color:#073E79; font-weight: bold; margin-left:0.3rem;"> {{totalnumberofproductsforingrasamintecart}}</span></div> 4718 <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> 4719 </div> 4720 </div> 4721 <div class="radio"> 4722 <div> 4723 <input id="cart2" name="radio-2" value="" type="radio"> 4724 <label for="cart2" class="radio-label">Cosul cu restul produselor:</label> 4725 </div> 4726 <div class="radio__item"> 4727 <div style="font-size: 1.4rem;">Nr. Produs(e):<span style="color:#073E79; font-weight: bold; margin-left:0.3rem;"> {{totalnumberofproductsfordefaultcart}}</span></div> 4728 <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> 4729 </div> 4730 </div> 4731 </div> 4732 <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> 4733 </div> 4734 {{/.}} 4735 </script> 4736 4737 } 4738 </text> 4739 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4740 4741 @using System 4742 @using System.Web 4743 @using System.Collections.Generic 4744 @using Dynamicweb.Rapido.Blocks.Extensibility 4745 @using Dynamicweb.Rapido.Blocks 4746 4747 @functions { 4748 BlocksPage mobileNavigationBlocksPage = BlocksPage.GetBlockPage("Master"); 4749 } 4750 4751 @{ 4752 bool mobileNavigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 4753 bool mobileHideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); 4754 bool mobileHideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); 4755 bool mobileHideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); 4756 bool mobileHideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); 4757 bool mobileHideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); 4758 4759 Block mobileNavigation = new Block() 4760 { 4761 Id = "MobileNavigation", 4762 SortId = 10, 4763 Template = MobileNavigation(), 4764 SkipRenderBlocksList = true 4765 }; 4766 mobileNavigationBlocksPage.Add(MasterBlockId.MasterTopSnippets, mobileNavigation); 4767 4768 if (Model.CurrentUser.ID > 0 && !mobileHideMyProfileLink) 4769 { 4770 Block mobileNavigationSignIn = new Block 4771 { 4772 Id = "MobileNavigationSignIn", 4773 SortId = 10, 4774 Template = RenderMobileNavigationSignIn() 4775 }; 4776 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationSignIn); 4777 } 4778 4779 Block mobileNavigationMenu = new Block 4780 { 4781 Id = "MobileNavigationMenu", 4782 SortId = 20, 4783 Template = RenderMobileNavigationMenu() 4784 }; 4785 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationMenu); 4786 4787 Block mobileNavigationActions = new Block 4788 { 4789 Id = "MobileNavigationActions", 4790 SortId = 30, 4791 Template = RenderMobileNavigationActions(), 4792 SkipRenderBlocksList = true 4793 }; 4794 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationActions); 4795 4796 if (!mobileNavigationItemsHideSignIn) 4797 { 4798 if (Model.CurrentUser.ID <= 0) 4799 { 4800 Block mobileNavigationSignInAction = new Block 4801 { 4802 Id = "MobileNavigationSignInAction", 4803 SortId = 10, 4804 Template = RenderMobileNavigationSignInAction() 4805 }; 4806 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignInAction); 4807 4808 if (!mobileHideCreateAccountLink) 4809 { 4810 Block mobileNavigationCreateAccountAction = new Block 4811 { 4812 Id = "MobileNavigationCreateAccountAction", 4813 SortId = 20, 4814 Template = RenderMobileNavigationCreateAccountAction() 4815 }; 4816 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationCreateAccountAction); 4817 } 4818 } 4819 else 4820 { 4821 if (!mobileHideMyOrdersLink) 4822 { 4823 Block mobileNavigationOrdersAction = new Block 4824 { 4825 Id = "MobileNavigationOrdersAction", 4826 SortId = 20, 4827 Template = RenderMobileNavigationOrdersAction() 4828 }; 4829 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationOrdersAction); 4830 } 4831 if (!mobileHideMyFavoritesLink) 4832 { 4833 Block mobileNavigationFavoritesAction = new Block 4834 { 4835 Id = "MobileNavigationFavoritesAction", 4836 SortId = 30, 4837 Template = RenderMobileNavigationFavoritesAction() 4838 }; 4839 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationFavoritesAction); 4840 } 4841 if (!mobileHideMySavedCardsLink) 4842 { 4843 Block mobileNavigationSavedCardsAction = new Block 4844 { 4845 Id = "MobileNavigationFavoritesAction", 4846 SortId = 30, 4847 Template = RenderMobileNavigationSavedCardsAction() 4848 }; 4849 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSavedCardsAction); 4850 } 4851 4852 Block mobileNavigationSignOutAction = new Block 4853 { 4854 Id = "MobileNavigationSignOutAction", 4855 SortId = 40, 4856 Template = RenderMobileNavigationSignOutAction() 4857 }; 4858 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignOutAction); 4859 } 4860 } 4861 4862 if (Model.Languages.Count > 1) 4863 { 4864 Block mobileNavigationLanguagesAction = new Block 4865 { 4866 Id = "MobileNavigationLanguagesAction", 4867 SortId = 50, 4868 Template = RenderMobileNavigationLanguagesAction() 4869 }; 4870 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationLanguagesAction); 4871 } 4872 } 4873 4874 4875 @helper MobileNavigation() 4876 { 4877 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigation").OrderBy(item => item.SortId).ToList(); 4878 string mobileTopDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design") != null ? Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design").SelectedValue : "nav-left"; 4879 string position = mobileTopDesign == "nav-left" || mobileTopDesign == "nav-search-left" ? "left" : "right"; 4880 int toolsPage = GetPageIdByNavigationTag("ToolsNavigationTag"); 4881 <!-- Trigger for mobile navigation --> 4882 <input type="checkbox" id="MobileNavTrigger" class="mobile-nav-trigger mobile-nav-trigger--@position" autocomplete="off" /> 4883 4884 <!-- Mobile navigation --> 4885 <nav class="mobile-navigation agricover-corporate-mobile-navigation mobile-navigation--@position dw-mod"> 4886 <div class="mobile-navigation__wrapper" id="mobileNavigationWrapper"> 4887 @RenderBlockList(subBlocks) 4888 @{ 4889 var navigationSettings = new NavigationSettings(); 4890 navigationSettings.StartLevel = 1; 4891 navigationSettings.StopLevel = 2; 4892 navigationSettings.ExpandMode = ExpandMode.All; 4893 navigationSettings.RootPageId = toolsPage; 4894 } 4895 <div> 4896 @Navigation.RenderNavigation("../Navigation/LeftNavigationExpandable.cshtml", navigationSettings) 4897 <div class="mobile-search-tools-bar">@RenderMobileTopSearchBar()</div> 4898 </div> 4899 </nav> 4900 4901 <label class="mobile-nav-trigger-off" for="MobileNavTrigger"></label> 4902 } 4903 4904 @helper RenderMobileNavigationSignIn() 4905 { 4906 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 4907 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 4908 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 4909 string myProfilePageLink = linkStart + myProfilePageId; 4910 string userName = Model.CurrentUser.FirstName; 4911 if (!string.IsNullOrEmpty(userName) && !string.IsNullOrEmpty(Model.CurrentUser.LastName)) 4912 { 4913 userName += " " + Model.CurrentUser.LastName; 4914 } 4915 if (string.IsNullOrEmpty(userName)) 4916 { 4917 userName = Model.CurrentUser.Name; 4918 } 4919 if (string.IsNullOrEmpty(userName)) 4920 { 4921 userName = Model.CurrentUser.UserName; 4922 } 4923 if (string.IsNullOrEmpty(userName)) 4924 { 4925 userName = Model.CurrentUser.Email; 4926 } 4927 4928 <ul class="menu menu-mobile"> 4929 <li class="menu-mobile__item"> 4930 <a href="@myProfilePageLink" class="menu-mobile__link dw-mod"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue menu-mobile__link-icon"></i> @userName</a> 4931 </li> 4932 </ul> 4933 } 4934 4935 @helper RenderMobileNavigationMenu() 4936 { 4937 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides"; 4938 string menuTemplate = isSlidesDesign ? "BaseMenuForMobileSlides.xslt" : "BaseMenuForMobileExpandable.xslt"; 4939 string levels = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels") : "3"; 4940 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 4941 int startLevel = 0; 4942 4943 @RenderNavigation(new 4944 { 4945 id = "mobilenavigation", 4946 cssclass = "menu menu-mobile dwnavigation", 4947 startLevel = @startLevel, 4948 ecomStartLevel = @startLevel + 1, 4949 endlevel = @levels, 4950 4951 template = @menuTemplate 4952 }) 4953 4954 4955 4956 if (renderPagesInToolBar) 4957 { 4958 var navigationSettings = new NavigationSettings(); 4959 navigationSettings.StartLevel = 1; 4960 navigationSettings.StopLevel = 2; 4961 navigationSettings.RootPageId = 7939; 4962 navigationSettings.ExpandMode = ExpandMode.All; 4963 @Navigation.RenderNavigation("../Navigation/LeftNavigationExpandable.cshtml", navigationSettings) 4964 4965 } 4966 } 4967 4968 @helper RenderMobileNavigationActions() 4969 { 4970 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigationActions").OrderBy(item => item.SortId).ToList(); ; 4971 4972 <ul class="menu menu-mobile"> 4973 @RenderBlockList(subBlocks) 4974 </ul> 4975 } 4976 4977 @helper RenderMobileNavigationSignInAction() 4978 { 4979 <li class="menu-mobile__item"> 4980 <label for="SignInModalTrigger" onclick="document.getElementById('MobileNavTrigger').checked = false;" class="menu-mobile__link dw-mod menu-mobile__link--highlighted"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue menu-mobile__link-icon"></i> @Translate("Sign in")</label> 4981 </li> 4982 } 4983 4984 @helper RenderMobileNavigationCreateAccountAction() 4985 { 4986 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 4987 4988 <li class="menu-mobile__item"> 4989 <a class="menu-mobile__link menu-mobile__link--highlighted dw-mod" href="/Default.aspx?ID=@createAccountPageId"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue menu-mobile__link-icon"></i> @Translate("Create account")</a> 4990 </li> 4991 } 4992 4993 @helper RenderMobileNavigationProfileAction() 4994 { 4995 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 4996 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 4997 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 4998 string myProfilePageLink = linkStart + myProfilePageId; 4999 5000 <li class="menu-mobile__item"> 5001 <a href="@myProfilePageLink" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue menu-mobile__link-icon"></i> @Translate("My Profile")</a> 5002 </li> 5003 } 5004 5005 @helper RenderMobileNavigationOrdersAction() 5006 { 5007 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 5008 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 5009 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); 5010 string myOrdersPageLink = linkStart + myOrdersPageId; 5011 string ordersIcon = "fas fa-list"; 5012 5013 <li class="menu-mobile__item"> 5014 <a href="@myOrdersPageLink" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@ordersIcon menu-mobile__link-icon"></i> @Translate("My Orders")</a> 5015 </li> 5016 } 5017 5018 @helper RenderMobileNavigationFavoritesAction() 5019 { 5020 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 5021 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 5022 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 5023 string myFavoritesPageLink = linkStart + myFavoritesPageId; 5024 string favoritesIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon") != null ? "fas fa-" + Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue : "fa fa-star"; 5025 5026 5027 <li class="menu-mobile__item"> 5028 <a href="@myFavoritesPageLink" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@favoritesIcon menu-mobile__link-icon"></i> @Translate("My Favorites")</a> 5029 </li> 5030 } 5031 5032 @helper RenderMobileNavigationSavedCardsAction() 5033 { 5034 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 5035 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 5036 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards"); 5037 string mySavedCardsPageLink = linkStart + mySavedCardsPageId; 5038 string savedCardsIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SavedCards") != null ? "fas fa-" + Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SavedCards").SelectedValue : "fas fa-credit-card"; 5039 5040 <li class="menu-mobile__item"> 5041 <a href="@mySavedCardsPageLink" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@savedCardsIcon menu-mobile__link-icon"></i> @Translate("My Saved Cards")</a> 5042 </li> 5043 } 5044 5045 @helper RenderMobileNavigationSignOutAction() 5046 { 5047 int pageId = Model.TopPage.ID; 5048 string signOutIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignOutIcon") != null ? "fas fa-" + Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignOutIcon").SelectedValue : "far fa-sign-out-alt"; 5049 5050 <li class="menu-mobile__item"> 5051 <a class="menu-mobile__link menu-mobile__link--highlighted dw-mod" href="/Admin/Public/ExtranetLogoff.aspx?ID=@pageId" onclick="RememberState.SetCookie('useAnotherAddress', false)"><i class="@signOutIcon menu-mobile__link-icon"></i> @Translate("Sign out")</a> 5052 </li> 5053 } 5054 5055 @helper RenderMobileNavigationLanguagesAction() 5056 { 5057 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides"; 5058 var searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 5059 string selectedLanguage = ""; 5060 foreach (var lang in Model.Languages) 5061 { 5062 if (lang.IsCurrent) 5063 { 5064 selectedLanguage = lang.Name; 5065 } 5066 } 5067 5068 <li class="menu-mobile__item dw-mod languge-switch-mobile"> 5069 @if (isSlidesDesign) 5070 { 5071 <input id="MobileMenuCheck_Language" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(1);"> 5072 } 5073 else 5074 { 5075 <input id="MobileMenuCheck_Language" type="checkbox" class="expand-trigger"> 5076 } 5077 <div class="menu-mobile__link__wrap"> 5078 <label for="MobileMenuCheck_Language" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue menu-mobile__link-icon"></i> @selectedLanguage</label> 5079 <label for="MobileMenuCheck_Language" class="menu-mobile__trigger"></label> 5080 </div> 5081 <ul class="menu-mobile menu-mobile__submenu expand-menu"> 5082 @if (isSlidesDesign) 5083 { 5084 <li class="menu-mobile__item dw-mod"> 5085 <div class="menu-mobile__link__wrap"> 5086 <input id="MobileMenuCheck_Language_back" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(0);" /> 5087 <label for="MobileMenuCheck_Language_back" class="menu-mobile__trigger menu-mobile__trigger--back"></label> 5088 <label for="MobileMenuCheck_Language_back" class="menu-mobile__link dw-mod ">@Translate("Back")</label> 5089 </div> 5090 </li> 5091 } 5092 @foreach (var lang in Model.Languages) 5093 { 5094 <li class="menu-mobile__item dw-mod"> 5095 <a class="menu-mobile__link menu-mobile__link--highlighted dw-mod menu-mobile__link--level-1" href="/Default.aspx?ID=@lang.Page.ID">@lang.Name</a> 5096 </li> 5097 } 5098 </ul> 5099 </li> 5100 }</text> 5101 } 5102 else 5103 { 5104 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5105 5106 @using System 5107 @using System.Web 5108 @using System.Collections.Generic 5109 @using Dynamicweb.Rapido.Blocks.Extensibility 5110 @using Dynamicweb.Rapido.Blocks 5111 5112 @functions { 5113 BlocksPage headerBlocksPage = BlocksPage.GetBlockPage("Master"); 5114 } 5115 5116 @{ 5117 Block masterTools = new Block() 5118 { 5119 Id = "MasterDesktopTools", 5120 SortId = 10, 5121 Template = RenderDesktopTools(), 5122 SkipRenderBlocksList = true, 5123 BlocksList = new List<Block> 5124 { 5125 new Block { 5126 Id = "MasterDesktopToolsText", 5127 SortId = 10, 5128 Template = RenderDesktopToolsText(), 5129 Design = new Design 5130 { 5131 Size = "auto", 5132 HidePadding = true, 5133 RenderType = RenderType.Column 5134 } 5135 }, 5136 new Block { 5137 Id = "MasterDesktopToolsNavigation", 5138 SortId = 20, 5139 Template = RenderDesktopToolsNavigation(), 5140 Design = new Design 5141 { 5142 Size = "auto-width", 5143 HidePadding = true, 5144 RenderType = RenderType.Column 5145 } 5146 } 5147 } 5148 }; 5149 headerBlocksPage.Add("MasterHeader", masterTools); 5150 5151 Block masterDesktopExtra = new Block() 5152 { 5153 Id = "MasterDesktopExtra", 5154 SortId = 10, 5155 Template = RenderDesktopExtra(), 5156 SkipRenderBlocksList = true 5157 }; 5158 headerBlocksPage.Add("MasterHeader", masterDesktopExtra); 5159 5160 Block masterDesktopNavigation = new Block() 5161 { 5162 Id = "MasterDesktopNavigation", 5163 SortId = 20, 5164 Template = RenderDesktopNavigation(), 5165 SkipRenderBlocksList = true 5166 }; 5167 headerBlocksPage.Add("MasterHeader", masterDesktopNavigation); 5168 } 5169 5170 @* Include the Blocks for the page *@ 5171 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5172 5173 @using System 5174 @using System.Web 5175 @using Dynamicweb.Rapido.Blocks.Extensibility 5176 @using Dynamicweb.Rapido.Blocks 5177 5178 @{ 5179 Block masterDesktopLogo = new Block 5180 { 5181 Id = "MasterDesktopLogo", 5182 SortId = 10, 5183 Template = RenderDesktopLogo(), 5184 Design = new Design 5185 { 5186 Size = "auto-width", 5187 HidePadding = true, 5188 RenderType = RenderType.Column, 5189 CssClass = "grid--align-self-center" 5190 } 5191 }; 5192 5193 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopLogo); 5194 } 5195 5196 5197 @helper RenderDesktopLogo() 5198 { 5199 string firstPageId = Model.Area.FirstActivePage.ID.ToString(); 5200 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5201 string alignClass = topLayout == "two-lines-centered" || topLayout == "two-lines" ? "grid--align-self-center" : ""; 5202 alignClass = topLayout == "splitted-center" ? "u-middle" : alignClass; 5203 string logo = Model.Area.Item.GetItem("Layout").GetFile("LogoImage") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoImage").PathUrlEncoded : "/Files/Images/logo-dynamicweb.png"; 5204 string logoLink = Pageview.Area.CultureInfo.TwoLetterISOLanguageName; 5205 logoLink = logoLink == "en" ? "/en" : "/"; 5206 5207 if (Path.GetExtension(logo).ToLower() != ".svg") 5208 { 5209 int logoHeight = Model.Area.Item.GetItem("Layout").GetInt32("LogoHeight"); 5210 logoHeight = logoHeight > 0 && Pageview.Device.ToString() != "Mobile" ? logoHeight : 40; 5211 logo = "/Admin/Public/GetImage.ashx?height=" + Converter.ToString(logoHeight) + "&amp;crop=5&amp;Compression=75&amp;image=" + logo; 5212 } 5213 else 5214 { 5215 logo = HttpUtility.UrlDecode(logo); 5216 } 5217 5218 <div class="logo @alignClass dw-mod"> 5219 <a href="@logoLink" class="logo__img dw-mod u-block"> 5220 <img class="grid__cell-img logo__img dw-mod" src="@logo" alt="@Translate("Logo")" /> 5221 </a> 5222 </div> 5223 } 5224 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5225 5226 @using Dynamicweb.Frontend.Navigation 5227 @using System 5228 @using System.Web 5229 @using Dynamicweb.Rapido.Blocks.Extensibility 5230 @using Dynamicweb.Rapido.Blocks 5231 5232 @functions { 5233 bool isMegaMenu; 5234 } 5235 5236 @{ 5237 isMegaMenu = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu") != null ? Converter.ToBoolean(Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu").SelectedValue) : false; 5238 Block masterDesktopMenu = new Block 5239 { 5240 Id = "MasterDesktopMenu", 5241 SortId = 10, 5242 Template = RenderDesktopMenu(), 5243 Design = new Design 5244 { 5245 Size = "auto", 5246 HidePadding = true, 5247 RenderType = RenderType.Column 5248 } 5249 }; 5250 5251 if (isMegaMenu) 5252 { 5253 masterDesktopMenu.Design.CssClass = "u-reset-position"; 5254 } 5255 5256 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopMenu); 5257 } 5258 5259 @helper RenderDesktopMenu() 5260 { 5261 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5262 string menuAlignment = topLayout == "minimal-right" ? "grid--align-self-end" : ""; 5263 menuAlignment = topLayout == "minimal-center" ? "grid--align-self-center" : topLayout; 5264 string megamenuPromotionImage = Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage").PathUrlEncoded : ""; 5265 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 5266 bool showOnlyHeaders = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowOnlyHeaders"); 5267 int startLevel = renderPagesInToolBar ? 1 : 0; 5268 string promotionLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("MegamenuPromotionLink"); 5269 string isHomepage = Model.Area.FirstPage.ID == Model.ID ? "true" : "false"; 5270 int productPage = GetPageIdByNavigationTag("ProductsPage"); 5271 int toolsPage = GetPageIdByNavigationTag("ToolsNavigationTag"); 5272 5273 <div class="grid__cell u-flex @(isMegaMenu ? "u-reset-position" : "") @menuAlignment"> 5274 @if (!isMegaMenu) 5275 { 5276 5277 var navigationSettings = new NavigationSettings(); 5278 navigationSettings.StartLevel = 1; 5279 navigationSettings.StopLevel = 3; 5280 navigationSettings.ExpandMode = ExpandMode.All; 5281 navigationSettings.RootPageId = toolsPage; 5282 navigationSettings.ExpandMode = Dynamicweb.Frontend.Navigation.ExpandMode.All; 5283 5284 <div> 5285 @Navigation.RenderNavigation("../Navigation/LeftNavigationExpandable.cshtml", navigationSettings) 5286 5287 </div> 5288 int navigationCustomMenuId = GetPageIdByNavigationTag("MainCustomMenu"); 5289 5290 } 5291 else 5292 { 5293 @RenderNavigation(new 5294 { 5295 id = "topnavigation", 5296 cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap", 5297 startLevel = startLevel, 5298 ecomStartLevel = startLevel + 1, 5299 endlevel = 5, 5300 promotionImage = megamenuPromotionImage, 5301 promotionLink = promotionLink, 5302 expandmode = "all", 5303 showOnlyHeaders = showOnlyHeaders.ToString().ToLower(), 5304 template = "BaseMegaMenu.xslt", 5305 isHomepage = isHomepage, 5306 productsPage = productPage, 5307 parenttag = "toolsMenu" 5308 }); 5309 } 5310 </div> 5311 } 5312 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5313 5314 @using System 5315 @using System.Web 5316 @using Dynamicweb.Rapido.Blocks.Extensibility 5317 @using Dynamicweb.Rapido.Blocks 5318 5319 @{ 5320 Block masterDesktopActionsMenu = new Block 5321 { 5322 Id = "MasterDesktopActionsMenu", 5323 SortId = 10, 5324 Template = RenderDesktopActionsMenu(), 5325 Design = new Design 5326 { 5327 CssClass = "u-flex" 5328 }, 5329 SkipRenderBlocksList = true 5330 5331 }; 5332 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopActionsMenu); 5333 5334 if (!string.IsNullOrWhiteSpace(Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink"))) 5335 { 5336 Block masterDesktopActionsHeaderButton = new Block 5337 { 5338 Id = "MasterDesktopActionsHeaderButton", 5339 SortId = 10, 5340 Template = RenderHeaderButton() 5341 }; 5342 masterDesktopActionsMenu.Add(masterDesktopActionsHeaderButton); 5343 } 5344 } 5345 5346 @helper RenderDesktopActionsMenu() 5347 { 5348 List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopActionsMenu").OrderBy(item => item.SortId).ToList(); 5349 5350 <ul class="menu u-flex dw-mod"> 5351 @RenderBlockList(subBlocks) 5352 </ul> 5353 } 5354 5355 @helper RenderHeaderButton() 5356 { 5357 string headerButtonText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonText"); 5358 string headerButtonLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink"); 5359 string headerButtonType = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType") != null ? "btn--" + Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType").SelectedName.ToLower() : ""; 5360 5361 <li class="menu__item menu__item--horizontal menu--clean dw-mod"> 5362 <a class="btn @headerButtonType dw-mod u-no-margin u-margin-left header__buton" href="@headerButtonLink"><span class="header__buton-icon"><i class="fas fa-envelope-open"></i></span>@headerButtonText</a> 5363 </li> 5364 } 5365 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5366 5367 @using System 5368 @using System.Web 5369 @using Dynamicweb.Core; 5370 @using System.Text.RegularExpressions 5371 @using Dynamicweb.Rapido.Blocks.Extensibility 5372 @using Dynamicweb.Rapido.Blocks 5373 5374 @{ 5375 Block masterDesktopActionsMenuLanguageSelector = new Block 5376 { 5377 Id = "MasterDesktopActionsMenuLanguageSelector", 5378 SortId = 40, 5379 Template = RenderLanguageSelector() 5380 }; 5381 5382 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuLanguageSelector); 5383 } 5384 5385 @helper RenderLanguageSelector() 5386 { 5387 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5388 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 5389 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 5390 string languageViewType = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("LanguageSelector").SelectedValue) ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("LanguageSelector").SelectedValue.ToLower() : ""; 5391 5392 if (Model.Languages.Count > 1) 5393 { 5394 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon is-dropdown is-dropdown--no-icon dw-mod"> 5395 <div class="@menuLinkClass dw-mod" title="@Translate("Language")"> 5396 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue fa-1_5x"></i> 5397 </div> 5398 <div class="menu menu--dropdown menu--dropdown-right languages-dropdown dw-mod grid__cell"> 5399 @foreach (var lang in Model.Languages) 5400 { 5401 string widthClass = "menu__item--fixed-width"; 5402 string langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " u-margin-right\"></span>" + lang.Name; 5403 string cultureName = Regex.Replace(Dynamicweb.Services.Areas.GetArea(lang.ID).CultureInfo.NativeName, @" ?\(.*?\)", string.Empty); 5404 cultureName = char.ToUpper(cultureName[0]) + cultureName.Substring(1); 5405 5406 if (languageViewType == "flag-culture") 5407 { 5408 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span> " + cultureName; 5409 } 5410 5411 if (languageViewType == "flag") 5412 { 5413 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span>"; 5414 widthClass = ""; 5415 } 5416 5417 if (languageViewType == "name") 5418 { 5419 langInfo = lang.Name; 5420 } 5421 5422 if (languageViewType == "culture") 5423 { 5424 langInfo = cultureName; 5425 widthClass = ""; 5426 } 5427 5428 <div class="menu__item dw-mod @widthClass"> 5429 <a href="/Default.aspx?AreaID=@Dynamicweb.Services.Pages.GetPage(lang.Page.ID).Area.ID" class="menu-dropdown__link dw-mod">@langInfo</a> 5430 </div> 5431 } 5432 </div> 5433 </li> 5434 } 5435 } 5436 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5437 5438 @using System 5439 @using System.Web 5440 @using Dynamicweb.Rapido.Blocks.Extensibility 5441 @using Dynamicweb.Rapido.Blocks 5442 5443 @{ 5444 Block masterDesktopActionsMenuSignIn = new Block 5445 { 5446 Id = "MasterDesktopActionsMenuSignIn", 5447 SortId = 20, 5448 Template = RenderSignIn() 5449 }; 5450 5451 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuSignIn); 5452 } 5453 5454 @helper RenderSignIn() 5455 { 5456 bool navigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 5457 string userInitials = ""; 5458 int pageId = Model.TopPage.ID; 5459 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 5460 int myDashboardPageId = GetPageIdByNavigationTag("CustomerDashboard"); 5461 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 5462 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); 5463 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 5464 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards"); 5465 int myOrderDraftsPageId = GetPageIdByNavigationTag("OrderDraft"); 5466 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 5467 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); 5468 bool hideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); 5469 bool hideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); 5470 bool hideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); 5471 bool hideMyOrderDraftsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrderDrafts"); 5472 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); 5473 bool hideForgotPasswordLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideForgotPasswordLink"); 5474 5475 string linkStart = "/Default.aspx?ID="; 5476 if (Model.CurrentUser.ID <= 0) 5477 { 5478 linkStart += signInProfilePageId + "&RedirectPageId="; 5479 } 5480 5481 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; 5482 string myProfilePageLink = linkStart + myProfilePageId; 5483 string myOrdersPageLink = linkStart + myOrdersPageId; 5484 string myFavoritesPageLink = linkStart + myFavoritesPageId; 5485 string mySavedCardsPageLink = linkStart + mySavedCardsPageId; 5486 string myOrderDraftsLink = linkStart + myOrderDraftsPageId; 5487 5488 string profileIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue : "fa fa-user"; 5489 string favoritesIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon") != null ? "fas fa-" + Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue : "fa fa-star"; 5490 string orderDraftsIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("DraftIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("DraftIcon").SelectedValue : "fa fa-clipboard"; 5491 5492 if (Model.CurrentUser.ID != 0) 5493 { 5494 userInitials = Dynamicweb.Rapido.Services.User.GetInitials(Model.CurrentUser.Name, Model.CurrentUser.FirstName, Model.CurrentUser.LastName, Model.CurrentUser.Email, Model.CurrentUser.UserName); 5495 } 5496 5497 if (!navigationItemsHideSignIn) 5498 { 5499 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5500 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu__item--clean"; 5501 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 5502 5503 <li class="menu__item menu__item--horizontal menu__item menu__item--icon @liClasses is-dropdown is-dropdown--no-icon dw-mod sign_in_element"> 5504 <div class="@menuLinkClass dw-mod"> 5505 @if (Model.CurrentUser.ID <= 0) 5506 { 5507 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue fa-1_5x" title="@Translate("Sign in")"></i> 5508 } 5509 else 5510 { 5511 <a href="/default.aspx?ID=@myDashboardPageId" class="u-color-inherit" title="@Translate("Customer center")"><div class="circle-icon-btn">@userInitials.ToUpper()</div></a> 5512 } 5513 </div> 5514 <div class="menu menu--dropdown menu--dropdown-right menu--sign-in grid__cell dw-mod"> 5515 <ul class="list list--clean dw-mod"> 5516 @if (Model.CurrentUser.ID <= 0) 5517 { 5518 <li> 5519 <label for="SignInModalTrigger" class="btn btn--primary btn--full u-no-margin sign-in-modal-trigger-button dw-mod" onclick="setTimeout(function () { document.getElementById('LoginUsername').focus() }, 10)">@Translate("Sign in")</label> 5520 </li> 5521 5522 if (!hideCreateAccountLink) 5523 { 5524 @RenderListItem("/default.aspx?ID=" + createAccountPageId, Translate("Create account")); 5525 } 5526 if (!hideForgotPasswordLink) 5527 { 5528 @RenderListItem(forgotPasswordPageLink, Translate("Forgot your password?")) 5529 } 5530 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) 5531 { 5532 @RenderSeparator() 5533 } 5534 } 5535 @if (!hideMyProfileLink) 5536 { 5537 @RenderListItem(myProfilePageLink, Translate("My Profile"), profileIcon) 5538 } 5539 @if (!hideMyOrdersLink) 5540 { 5541 @RenderListItem(myOrdersPageLink, Translate("My Orders"), "fas fa-list") 5542 } 5543 @if (!hideMyFavoritesLink) 5544 { 5545 @RenderListItem(myFavoritesPageLink, Translate("My Favorites"), favoritesIcon) 5546 } 5547 @if (!hideMySavedCardsLink) 5548 { 5549 @RenderListItem(mySavedCardsPageLink, Translate("My Saved cards"), "fas fa-credit-card") 5550 } 5551 @if (!hideMyOrderDraftsLink) 5552 { 5553 @RenderListItem(myOrderDraftsLink, Translate("My Order drafts"), orderDraftsIcon) 5554 } 5555 @if (Model.CurrentUser.ID > 0) 5556 { 5557 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) 5558 { 5559 @RenderSeparator() 5560 } 5561 5562 //Check if impersonation is on 5563 if (Model.CurrentSecondaryUser != null && Model.CurrentSecondaryUser.ID > 0) 5564 { 5565 <li> 5566 <div class="list__link dw-mod" onclick="document.getElementById('StopImpersonationModalTrigger').checked = true;"> 5567 @Translate("Sign out") 5568 </div> 5569 </li> 5570 } else { 5571 @RenderListItem("/Admin/Public/ExtranetLogoff.aspx?ID=" + pageId, Translate("Sign out")) 5572 } 5573 } 5574 </ul> 5575 </div> 5576 </li> 5577 } 5578 } 5579 5580 @helper RenderListItem(string link, string text, string icon = null) { 5581 <li> 5582 <a href="@link" class="list__link dw-mod" onclick="RememberState.SetCookie('useAnotherAddress', false)"> 5583 @if (!string.IsNullOrEmpty(icon)){<i class="@icon u-margin-right"></i>}@text 5584 </a> 5585 </li> 5586 } 5587 5588 @helper RenderSeparator() 5589 { 5590 <li class="list__seperator dw-mod"></li> 5591 } 5592 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5593 5594 @using System 5595 @using System.Web 5596 @using Dynamicweb.Rapido.Blocks.Extensibility 5597 @using Dynamicweb.Rapido.Blocks 5598 5599 @{ 5600 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideFavorites"); 5601 5602 Block masterDesktopActionsMenuFavorites = new Block 5603 { 5604 Id = "MasterDesktopActionsMenuFavorites", 5605 SortId = 30, 5606 Template = RenderFavorites() 5607 }; 5608 5609 if (!hideMyFavoritesLink && Model.CurrentUser.ID > 0) 5610 { 5611 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuFavorites); 5612 } 5613 } 5614 5615 @helper RenderFavorites() 5616 { 5617 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 5618 string myFavoritesPageLink = "/Default.aspx?ID=" + myFavoritesPageId; 5619 5620 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5621 string liClasses = topLayout != "normal" && topLayout != "splitted-center" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 5622 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 5623 5624 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod"> 5625 <a href="@myFavoritesPageLink" class="@menuLinkClass dw-mod" title="@Translate("Favorites")"> 5626 <i class="fas fa-@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue fa-1_5x"></i> 5627 </a> 5628 </li> 5629 } 5630 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5631 5632 @using System 5633 @using System.Web 5634 @using Dynamicweb.Rapido.Blocks.Extensibility 5635 @using Dynamicweb.Rapido.Blocks 5636 @using Dynamicweb.Rapido.Services 5637 @using Dynamicweb.Ecommerce 5638 @using Dynamicweb.Ecommerce.Orders 5639 @using Df.Dw 5640 5641 @{ 5642 bool hideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 5643 string miniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown"; 5644 5645 var totalNumberOfProductsForDefault = 0; 5646 using (var contexter = new OrderContexter(Dynamicweb.Ecommerce.Orders.OrderContext.GetOrderContextById("ORDERCONTEXT7"))) 5647 { 5648 var cartContext = Dynamicweb.Ecommerce.Common.Context.Cart; 5649 totalNumberOfProductsForDefault = cartContext != null ? Converter.ToInt32(cartContext.ProductOrderLines.Sum(ol => ol.Quantity)) : 0; 5650 } 5651 5652 var totalNumberOfProductsForIngrasaminte = 0; 5653 using (var contexter = new OrderContexter(Dynamicweb.Ecommerce.Orders.OrderContext.GetOrderContextById("ORDERCONTEXT5"))) 5654 { 5655 var cartContext = Dynamicweb.Ecommerce.Common.Context.Cart; 5656 totalNumberOfProductsForIngrasaminte = cartContext != null ? Converter.ToInt32(cartContext.ProductOrderLines.Sum(ol => ol.Quantity)) : 0; 5657 } 5658 5659 var totalNumberOfProductsForAllCarts = totalNumberOfProductsForDefault + totalNumberOfProductsForIngrasaminte; 5660 5661 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed() && !hideCart) 5662 { 5663 Block masterDesktopActionsMenuMiniCart = new Block 5664 { 5665 Id = "MasterDesktopActionsMenuMiniCart", 5666 SortId = 60, 5667 Template = RenderMiniCart(miniCartLayout == "dropdown"), 5668 SkipRenderBlocksList = true, 5669 BlocksList = new List<Block>() 5670 }; 5671 5672 Block miniCartCounterScriptTemplate = new Block 5673 { 5674 Id = "MiniCartCounterScriptTemplate", 5675 Template = RenderMiniCartCounterContent() 5676 }; 5677 5678 //dropdown layout is default 5679 RazorEngine.Templating.TemplateWriter layoutTemplate; 5680 RazorEngine.Templating.TemplateWriter miniCartTriggerTemplate; 5681 5682 switch (miniCartLayout) 5683 { 5684 case "dropdown": 5685 layoutTemplate = RenderMiniCartDropdownLayout(); 5686 miniCartTriggerTemplate = RenderMiniCartTriggerLink(totalNumberOfProductsForDefault, totalNumberOfProductsForIngrasaminte); 5687 break; 5688 case "panel": 5689 layoutTemplate = RenderMiniCartPanelLayout(); 5690 //miniCartTriggerTemplate = RenderMiniCartTriggerLabel(); 5691 miniCartTriggerTemplate = RenderMiniCartTriggerLabel(totalNumberOfProductsForDefault, totalNumberOfProductsForIngrasaminte); 5692 break; 5693 case "modal": 5694 layoutTemplate = RenderMiniCartModalLayout(); 5695 miniCartTriggerTemplate = RenderMiniCartTriggerLabel(totalNumberOfProductsForDefault, totalNumberOfProductsForIngrasaminte); 5696 break; 5697 case "none": 5698 default: 5699 layoutTemplate = RenderMiniCartDropdownLayout(); 5700 miniCartTriggerTemplate = RenderMiniCartTriggerLink(totalNumberOfProductsForDefault, totalNumberOfProductsForIngrasaminte); 5701 break; 5702 } 5703 5704 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block 5705 { 5706 Id = "MiniCartTrigger", 5707 Template = miniCartTriggerTemplate 5708 }); 5709 5710 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 5711 { 5712 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block 5713 { 5714 Id = "MiniCartLayout", 5715 Template = layoutTemplate 5716 }); 5717 } 5718 5719 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuMiniCart); 5720 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate); 5721 } 5722 5723 if (hideCart && Dynamicweb.Rapido.Services.User.IsBuyingAllowed()) 5724 { 5725 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", new Block { 5726 Id = "CartInitialization" 5727 }); 5728 } 5729 } 5730 5731 @helper RenderMiniCart(bool hasMouseEnterEvent) 5732 { 5733 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterDesktopActionsMenuMiniCart").OrderBy(item => item.SortId).ToList(); 5734 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5735 string liClasses = topLayout != "normal" ? "menu__item--top-level" : "menu--clean"; 5736 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 5737 string mouseEvent = ""; 5738 string id = "MiniCart"; 5739 if (hasMouseEnterEvent) 5740 { 5741 mouseEvent = "onmouseenter=\"Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=" + miniCartFeedPageId + "&feedType=MiniCart')\""; 5742 id = "miniCartTrigger"; 5743 } 5744 <li class="menu__item menu__item--horizontal menu__item--icon @liClasses dw-mod" id="@id" @mouseEvent> 5745 @RenderBlockList(subBlocks) 5746 </li> 5747 } 5748 5749 @helper RenderMiniCartTriggerLabel(int totalNumberOfProductsForDefault = 0, int totalNumberOfProductsForIngrasaminte = 0) 5750 { 5751 int cartPageId = GetPageIdByNavigationTag("CartPage"); 5752 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart"; 5753 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5754 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 5755 int miniCartFeedDefaultPageId = GetPageIdByNavigationTag("MiniCartFeed"); 5756 int miniCartFeedIngrasamintePageId = GetPageIdByNavigationTag("MiniCartFeedIngrasaminte"); 5757 int miniCartFeedSelectedPageId = totalNumberOfProductsForDefault > 0 || totalNumberOfProductsForIngrasaminte == 0 ? miniCartFeedDefaultPageId : miniCartFeedIngrasamintePageId; 5758 5759 <div id="minicart_icon" data-miniCartFeedId="@miniCartFeedDefaultPageId" data-miniCartFeed-IngrasaminteId="@miniCartFeedIngrasamintePageId" data-miniCart-ContextId="@miniCartFeedSelectedPageId" class="@menuLinkClass dw-mod js-mini-cart-button" onclick="Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=@miniCartFeedSelectedPageId&feedType=MiniCart')" title="@Translate("Cart")"> 5760 <div class="u-inline u-position-relative"> 5761 <i class="@cartIcon fa-1_5x"></i> 5762 @RenderMiniCartCounter(totalNumberOfProductsForDefault, totalNumberOfProductsForIngrasaminte) 5763 </div> 5764 </div> 5765 } 5766 5767 @helper RenderMiniCartTriggerLink(int totalNumberOfProductsForDefault = 0, int totalNumberOfProductsForIngrasaminte = 0) 5768 { 5769 int cartPageId = GetPageIdByNavigationTag("CartPage"); 5770 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart"; 5771 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5772 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 5773 5774 <a href="/Default.aspx?ID=@cartPageId&Purge=True" class="@menuLinkClass menu__item--icon dw-mod js-mini-cart-button" title="@Translate("Cart")"> 5775 <span class="u-inline u-position-relative"> 5776 <i class="@cartIcon fa-1_5x"></i> 5777 @RenderMiniCartCounter(totalNumberOfProductsForDefault, totalNumberOfProductsForIngrasaminte) 5778 </span> 5779 </a> 5780 } 5781 5782 @helper RenderMiniCartCounter(int totalNumberOfProductsForDefault = 0, int totalNumberOfProductsForIngrasaminte = 0) 5783 { 5784 int miniCartFeedDefaultPageId = GetPageIdByNavigationTag("MiniCartFeed"); 5785 int miniCartFeedIngrasamintePageId = GetPageIdByNavigationTag("MiniCartFeedIngrasaminte"); 5786 int miniCartFeedSelectedPageId = totalNumberOfProductsForDefault > 0 || totalNumberOfProductsForIngrasaminte == 0 ? miniCartFeedDefaultPageId : miniCartFeedIngrasamintePageId; 5787 5788 string cartProductsCount = (totalNumberOfProductsForDefault + totalNumberOfProductsForIngrasaminte).ToString(); 5789 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right"; 5790 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 5791 string cartProductsTotalPrice = showPrice && Model.Cart.TotalPrice != null ? Model.Cart.TotalPrice.Price.Formatted : ""; 5792 cartProductsTotalPrice = counterPosition == "right" ? cartProductsTotalPrice : ""; 5793 5794 if (showPrice && counterPosition == "right") 5795 { 5796 cartProductsCount = Translate("Cart") + " (" + cartProductsCount + ")"; 5797 } 5798 <span class="mini-cart__counter @(counterPosition == "right" ? "mini-cart__counter--inline" : "") dw-mod"> 5799 <span 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"> 5800 <span class="js-mini-cart-counter-content" data-count="@cartProductsCount"> 5801 @cartProductsCount @cartProductsTotalPrice 5802 </span> 5803 </span> 5804 </span> 5805 } 5806 5807 @helper RenderMiniCartCounterContent() 5808 { 5809 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 5810 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right"; 5811 bool showPriceInMiniCartCounter = Pageview.Device.ToString() != "Mobile" && counterPosition == "right" && showPrice; 5812 5813 <script id="MiniCartCounterContent" type="text/x-template"> 5814 {{#.}} 5815 <span class="js-mini-cart-counter-content dw-mod" data-count="{{totalnumberofproductsforallcarts}}"> 5816 @if (showPriceInMiniCartCounter) 5817 { 5818 @Translate("Cart")<text>({{totalnumberofproductsforallcarts}}) {{totalprice}}</text> 5819 } 5820 else 5821 { 5822 <text>{{totalnumberofproductsforallcarts}}</text> 5823 } 5824 </span> 5825 {{/.}} 5826 </script> 5827 } 5828 5829 5830 5831 @helper RenderMiniCartDropdownLayout() 5832 { 5833 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 5834 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage"); 5835 5836 <div class="mini-cart mini-cart-dropdown js-mini-cart grid__cell dw-mod" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="dropdown" data-cart-page-link="@cartPageLink"> 5837 <div class="mini-cart-dropdown__inner dw-mod"> 5838 <h3 class="u-ta-center dw-mod">@Translate("Shopping cart")</h3> 5839 <div class="mini-cart-dropdown__body u-flex dw-mod"> 5840 <div class="js-handlebars-root u-flex grid--direction-column u-full-width dw-mod" id="miniCartContent" data-template="MiniCartContent" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart" data-init-onload="false"></div> 5841 </div> 5842 </div> 5843 </div> 5844 } 5845 5846 @helper RenderMiniCartPanelLayout() 5847 { 5848 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 5849 int minicartIngrasaminteFeedPageId = GetPageIdByNavigationTag("MiniCartFeedIngrasaminte"); 5850 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage"); 5851 string cartIngrasamintePageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPageIngrasaminte"); 5852 5853 5854 <div class="mini-cart grid__cell dw-mod"> 5855 <input type="checkbox" id="miniCartTrigger" class="panel-trigger" /> 5856 <div class="panel panel--right panel--with-close-btn dw-mod js-mini-cart" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="block" data-cart-page-link="@cartPageLink"> 5857 <label for="miniCartTrigger" class="panel__close-btn" title="@Translate("Close panel")"><i class="fas fa-times"></i></label> 5858 <div class="panel__content u-full-width dw-mod"> 5859 <h3 class="panel__header dw-mod u-margin-bottom u-ta-center">@Translate("Shopping cart")</h3> 5860 <div class="panel__content-body panel__content-body--cart dw-mod"> 5861 <div class="select__carts-wrapper"> 5862 <select id="CartSelect" data-json-feed="/Default.aspx?feedType=MiniCart&ID="> 5863 <option value="@minicartIngrasaminteFeedPageId">Cosul Ingrasaminte</option> 5864 <option value="@miniCartFeedPageId">Cosul cu restul produselor</option> 5865 </select> 5866 </div> 5867 <div class="js-handlebars-root u-flex grid--direction-column u-full-height dw-mod" id="miniCartContent" data-template="MiniCartContent" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart" data-init-onload="false"></div> 5868 </div> 5869 </div> 5870 </div> 5871 </div> 5872 } 5873 5874 @helper RenderMiniCartModalLayout() 5875 { 5876 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 5877 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage"); 5878 5879 <div class="mini-cart grid__cell dw-mod"> 5880 <input type="checkbox" id="miniCartTrigger" class="modal-trigger" autocomplete="off" /> 5881 <div class="modal-container dw-mod js-mini-cart" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="block" data-cart-page-link="@cartPageLink"> 5882 <label for="miniCartTrigger" class="modal-overlay"></label> 5883 <div class="modal modal--md modal--top-right dw-mod"> 5884 <div class="modal__body u-flex grid--direction-column dw-mod"> 5885 <h3 class="dw-mod u-ta-center">@Translate("Shopping cart")</h3> 5886 <div class="js-handlebars-root u-flex grid--direction-column dw-mod" id="miniCartContent" data-template="MiniCartContent" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart" data-init-onload="false"></div> 5887 </div> 5888 <label class="modal__close-btn modal__close-btn--clean dw-mod" for="miniCartTrigger" title="@Translate("Close modal")"></label> 5889 </div> 5890 </div> 5891 </div> 5892 } 5893 5894 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5895 5896 @using System 5897 @using System.Web 5898 @using Dynamicweb.Rapido.Blocks.Extensibility 5899 @using Dynamicweb.Rapido.Blocks 5900 5901 @{ 5902 bool showOrderDraftLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowOrderDraftIcon"); 5903 5904 Block masterDesktopActionsMenuOrderDraft = new Block 5905 { 5906 Id = "MasterDesktopActionsMenuOrderDraft", 5907 SortId = 40, 5908 Template = RenderOrderDraft() 5909 }; 5910 5911 if (showOrderDraftLink && Model.CurrentUser.ID > 0) 5912 { 5913 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuOrderDraft); 5914 } 5915 } 5916 5917 @helper RenderOrderDraft() 5918 { 5919 int OrderDraftPageId = GetPageIdByNavigationTag("OrderDraft"); 5920 string OrderDraftPageLink = "/Default.aspx?ID=" + OrderDraftPageId; 5921 string draftIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("DraftIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("DraftIcon").SelectedValue : "fa fa-clipboard"; 5922 5923 5924 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5925 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 5926 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 5927 5928 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod"> 5929 <a href="@OrderDraftPageLink" class="@menuLinkClass dw-mod" title="@Translate("My order drafts")"> 5930 <span class="u-inline u-position-relative"> 5931 <i class="@draftIcon fa-1_5x"></i> 5932 </span> 5933 </a> 5934 </li> 5935 } 5936 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5937 5938 @using System 5939 @using System.Web 5940 @using Dynamicweb.Rapido.Blocks.Extensibility 5941 @using Dynamicweb.Rapido.Blocks 5942 5943 @{ 5944 bool showDownloadCartLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart"); 5945 5946 Block masterDesktopActionsMenuDownloadCart = new Block 5947 { 5948 Id = "MasterDesktopActionsMenuDownloadCart", 5949 SortId = 50, 5950 Template = RenderDownloadCart() 5951 }; 5952 5953 if (showDownloadCartLink && Model.CurrentUser.ID > 0) 5954 { 5955 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuDownloadCart); 5956 } 5957 } 5958 5959 @helper RenderDownloadCart() 5960 { 5961 int downloadCartPageId = GetPageIdByNavigationTag("DownloadCart"); 5962 string downloadCartPageLink = "/Default.aspx?ID=" + downloadCartPageId; 5963 5964 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5965 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 5966 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 5967 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right"; 5968 5969 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod"> 5970 <a href="@downloadCartPageLink" class="@menuLinkClass dw-mod" title="@Translate("Download cart")"> 5971 <span class="u-inline u-position-relative"> 5972 <i class="fas fa-cart-arrow-down fa-1_5x"></i> 5973 <span class="mini-cart__counter u-hidden @(counterPosition == "right" ? "mini-cart__counter--inline" : "") dw-mod js-download-cart-counter"></span> 5974 </span> 5975 </a> 5976 </li> 5977 } 5978 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5979 5980 @using System 5981 @using System.Web 5982 @using Dynamicweb.Rapido.Blocks.Extensibility 5983 @using Dynamicweb.Rapido.Blocks 5984 5985 @functions { 5986 public class SearchConfiguration 5987 { 5988 public string searchFeedId { get; set; } 5989 public string searchSecondFeedId { get; set; } 5990 public int groupsFeedId { get; set; } 5991 public string resultPageLink { get; set; } 5992 public string searchPlaceholder { get; set; } 5993 public string searchType { get; set; } 5994 public string searchTemplate { get; set; } 5995 public string searchContentTemplate { get; set; } 5996 public string searchValue { get; set; } 5997 public bool showGroups { get; set; } 5998 5999 public SearchConfiguration() 6000 { 6001 searchFeedId = ""; 6002 searchSecondFeedId = ""; 6003 searchType = "product-search"; 6004 searchContentTemplate = ""; 6005 showGroups = true; 6006 } 6007 } 6008 } 6009 @{ 6010 Block masterSearchBar = new Block 6011 { 6012 Id = "MasterSearchBar", 6013 SortId = 40, 6014 Template = RenderSearch("bar"), 6015 Design = new Design 6016 { 6017 Size = "auto", 6018 HidePadding = true, 6019 RenderType = RenderType.Column 6020 } 6021 }; 6022 6023 Block masterSearchAction = new Block 6024 { 6025 Id = "MasterDesktopActionsMenuSearch", 6026 SortId = 10, 6027 Template = RenderSearch() 6028 }; 6029 6030 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterSearchBar); 6031 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterSearchAction); 6032 } 6033 6034 @helper RenderSearch(string type = "mini-search") 6035 { 6036 string productsPageId = Converter.ToString(GetPageIdByNavigationTag("ProductsPage")); 6037 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 6038 string searchType = Model.Area.Item.GetItem("Layout").GetList("TopSearch") != null ? Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue : "productSearch"; 6039 6040 SearchConfiguration searchConfiguration = null; 6041 6042 switch (searchType) { 6043 case "contentSearch": 6044 searchConfiguration = new SearchConfiguration() { 6045 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true", 6046 resultPageLink = contentSearchPageLink, 6047 searchPlaceholder = Translate("Search page"), 6048 groupsFeedId = 0, 6049 searchType = "content-search", 6050 searchTemplate = "SearchPagesTemplate", 6051 showGroups = false 6052 }; 6053 break; 6054 case "combinedSearch": 6055 searchConfiguration = new SearchConfiguration() { 6056 searchFeedId = productsPageId + "&feed=true", 6057 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true", 6058 resultPageLink = Converter.ToString(productsPageId), 6059 searchPlaceholder = Translate("Search products or pages"), 6060 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"), 6061 searchType = "combined-search", 6062 searchTemplate = "SearchProductsTemplateWrap", 6063 searchContentTemplate = "SearchPagesTemplateWrap", 6064 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector") 6065 }; 6066 break; 6067 default: //productSearch 6068 searchConfiguration = new SearchConfiguration() { 6069 resultPageLink = Converter.ToString(productsPageId), 6070 searchFeedId = productsPageId + "&feed=true", 6071 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"), 6072 searchPlaceholder = Translate("Search products"), 6073 searchTemplate = "SearchProductsTemplate", 6074 searchType = "product-search", 6075 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector") 6076 }; 6077 break; 6078 } 6079 searchConfiguration.searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; 6080 6081 if (type == "mini-search") { 6082 @RenderMiniSearch(searchConfiguration) 6083 } else { 6084 @RenderSearchBar(searchConfiguration) 6085 } 6086 } 6087 6088 @helper RenderSearchBar(SearchConfiguration options) 6089 { 6090 <div class="typeahead typeahead--centered u-color-inherit js-typeahead dw-mod" id="ProductSearchBar" 6091 data-page-size="7" 6092 data-search-feed-id="@options.searchFeedId" 6093 data-search-second-feed-id="@options.searchSecondFeedId" 6094 data-result-page-id="@options.resultPageLink" 6095 data-groups-page-id="@options.groupsFeedId" 6096 data-search-type="@options.searchType"> 6097 @if (options.showGroups) 6098 { 6099 <button type="button" class="btn btn--condensed u-color-light-gray--bg typeahead-group-btn dw-mod js-typeahead-groups-btn" data-group-id="all">@Translate("All")</button> 6100 <ul class="dropdown dropdown--absolute-position u-min-w220px js-handlebars-root js-typeahead-groups-content dw-mod" id="ProductSearchBarGroupsContent" data-template="SearchGroupsTemplate" data-json-feed="/Default.aspx?ID=@options.groupsFeedId&feedType=productGroups" data-init-onload="false" data-preloader="minimal"></ul> 6101 } 6102 <div class="typeahead-search-field"> 6103 <input type="text" class="u-no-margin u-full-width u-full-height js-typeahead-search-field" placeholder="@options.searchPlaceholder" value="@options.searchValue"> 6104 @if (string.IsNullOrEmpty(options.searchSecondFeedId)) 6105 { 6106 <ul class="dropdown dropdown--absolute-position u-min-w220px u-full-width js-handlebars-root js-typeahead-search-content dw-mod" id="ProductSearchBarContent" data-template="@options.searchTemplate" data-json-feed="/Default.aspx?ID=@options.searchFeedId&feedType=productsOnly" data-init-onload="false"></ul> 6107 } 6108 else 6109 { 6110 <div class="dropdown dropdown--absolute-position dropdown--combined grid"> 6111 <div class="js-typeahead-search-content grid__col-sm-7 grid__col--bleed-y" id="ProductSearchBarContent" data-template="@options.searchTemplate" data-init-onload="false"></div> 6112 <div class="js-typeahead-additional-search-content grid__col-sm-5 grid__col--bleed-y" id="ContentSearchBarContent" data-template="@options.searchContentTemplate" data-init-onload="false"></div> 6113 </div> 6114 } 6115 </div> 6116 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod js-typeahead-enter-btn" title="@Translate("Search")"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue"></i></button> 6117 </div> 6118 } 6119 6120 @helper RenderMiniSearch(SearchConfiguration options) 6121 { 6122 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 6123 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 6124 6125 <li class="menu__item menu__item--horizontal menu__item--top-level menu__item--icon u-hidden-xxs is-dropdown is-dropdown--no-icon dw-mod" id="miniSearchIcon"> 6126 <div class="@menuLinkClass dw-mod" title="@Translate("Search")"> 6127 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> 6128 </div> 6129 <div class="menu menu--dropdown menu--dropdown-right u-no-padding u-w380px grid__cell dw-mod"> 6130 <div class="typeahead js-typeahead" id="ProductSearchBar" 6131 data-page-size="7" 6132 data-search-feed-id="@options.searchFeedId" 6133 data-search-second-feed-id="@options.searchSecondFeedId" 6134 data-result-page-id="@options.resultPageLink" 6135 data-search-type="@options.searchType"> 6136 <div class="typeahead-search-field"> 6137 <input type="text" class="u-no-margin u-full-width js-typeahead-search-field" id="headerSearch" placeholder="@options.searchPlaceholder" value="@options.searchValue"> 6138 @if (string.IsNullOrEmpty(options.searchSecondFeedId)) 6139 { 6140 <ul class="dropdown dropdown--absolute-position u-min-w220px u-full-width js-handlebars-root js-typeahead-search-content dw-mod" id="ProductSearchBarContent" data-template="@options.searchTemplate" data-json-feed="/Default.aspx?ID=@options.searchFeedId&feedType=productsOnly" data-init-onload="false"></ul> 6141 } 6142 else 6143 { 6144 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--right-aligned"> 6145 <div class="js-handlebars-root js-typeahead-search-content grid__col-sm-7 grid__col--bleed-y" id="ProductSearchBarContent" data-template="@options.searchTemplate" data-json-feed="/Default.aspx?ID=@options.searchFeedId&feedType=productsOnly" data-init-onload="false"></div> 6146 <div class="js-handlebars-root js-typeahead-additional-search-content grid__col-sm-5 grid__col--bleed-y" id="ContentSearchBarContent" data-template="@options.searchContentTemplate" data-json-feed="/Default.aspx?ID=@options.searchSecondFeedId" data-init-onload="false"></div> 6147 </div> 6148 } 6149 </div> 6150 </div> 6151 </div> 6152 </li> 6153 } 6154 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 6155 6156 @using System 6157 @using System.Web 6158 @using Dynamicweb.Rapido.Blocks.Extensibility 6159 @using Dynamicweb.Rapido.Blocks 6160 6161 @{ 6162 string headerConfigurationTopLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 6163 bool headerConfigurationHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 6164 6165 BlocksPage headerConfigurationPage = BlocksPage.GetBlockPage("Master"); 6166 6167 Block configDesktopLogo = headerConfigurationPage.GetBlockById("MasterDesktopLogo"); 6168 headerConfigurationPage.RemoveBlock(configDesktopLogo); 6169 6170 Block configDesktopMenu = headerConfigurationPage.GetBlockById("MasterDesktopMenu"); 6171 headerConfigurationPage.RemoveBlock(configDesktopMenu); 6172 6173 Block configSearchBar = headerConfigurationPage.GetBlockById("MasterSearchBar"); 6174 headerConfigurationPage.RemoveBlock(configSearchBar); 6175 6176 Block configSearchAction = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenuSearch"); 6177 headerConfigurationPage.RemoveBlock(configSearchAction); 6178 6179 Block configDesktopActionsMenu = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenu"); 6180 headerConfigurationPage.RemoveBlock(configDesktopActionsMenu); 6181 6182 Block configDesktopExtra = headerConfigurationPage.GetBlockById("MasterDesktopExtra"); 6183 6184 switch (headerConfigurationTopLayout) 6185 { 6186 case "condensed": //2 6187 configDesktopLogo.Design.Size = "auto-width"; 6188 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); 6189 6190 configDesktopMenu.SortId = 20; 6191 configDesktopMenu.Design.Size = "auto"; 6192 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 6193 6194 configDesktopActionsMenu.SortId = 30; 6195 configDesktopActionsMenu.Design.Size = "auto-width"; 6196 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 6197 6198 if (!headerConfigurationHideSearch) 6199 { 6200 configSearchBar.SortId = 40; 6201 configSearchBar.Design.Size = "12"; 6202 configDesktopExtra.SortId = 50; 6203 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); 6204 } 6205 break; 6206 case "splitted": //3 6207 configDesktopLogo.Design.Size = "auto"; 6208 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 6209 6210 if (!headerConfigurationHideSearch) 6211 { 6212 configSearchBar.SortId = 20; 6213 configSearchBar.Design.Size = "auto"; 6214 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); 6215 } 6216 6217 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 6218 6219 configDesktopActionsMenu.SortId = 20; 6220 configDesktopActionsMenu.Design.Size = "auto-width"; 6221 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 6222 break; 6223 case "splitted-center": //4 6224 configDesktopLogo.Design.Size = "auto"; 6225 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 6226 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 6227 6228 configDesktopActionsMenu.SortId = 30; 6229 configDesktopActionsMenu.Design.Size = "auto-width"; 6230 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopActionsMenu); 6231 6232 if (!headerConfigurationHideSearch) 6233 { 6234 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 6235 } 6236 break; 6237 case "minimal": //5 6238 configDesktopLogo.Design.Size = "auto-width"; 6239 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); 6240 6241 configDesktopMenu.Design.Size = "auto"; 6242 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 6243 6244 configDesktopActionsMenu.SortId = 20; 6245 configDesktopActionsMenu.Design.Size = "auto-width"; 6246 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 6247 6248 if (!headerConfigurationHideSearch) 6249 { 6250 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 6251 } 6252 break; 6253 case "minimal-center": //6 6254 configDesktopLogo.Design.Size = "auto-width"; 6255 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); 6256 6257 configDesktopMenu.Design.Size = "auto"; 6258 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 6259 6260 configDesktopActionsMenu.SortId = 20; 6261 configDesktopActionsMenu.Design.Size = "auto-width"; 6262 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 6263 6264 if (!headerConfigurationHideSearch) 6265 { 6266 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 6267 } 6268 break; 6269 case "minimal-right": //7 6270 configDesktopLogo.Design.Size = "auto-width"; 6271 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); 6272 6273 configDesktopMenu.Design.Size = "auto"; 6274 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 6275 6276 configDesktopActionsMenu.SortId = 20; 6277 configDesktopActionsMenu.Design.Size = "auto-width"; 6278 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 6279 6280 if (!headerConfigurationHideSearch) 6281 { 6282 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 6283 } 6284 break; 6285 case "two-lines": //8 6286 configDesktopLogo.Design.Size = "auto"; 6287 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 6288 6289 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 6290 6291 configDesktopActionsMenu.SortId = 20; 6292 configDesktopActionsMenu.Design.Size = "auto-width"; 6293 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 6294 6295 if (!headerConfigurationHideSearch) 6296 { 6297 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 6298 } 6299 break; 6300 case "two-lines-centered": //9 6301 configDesktopLogo.Design.Size = "auto"; 6302 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 6303 6304 configDesktopMenu.Design.Size = "auto-width"; 6305 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 6306 6307 configDesktopActionsMenu.SortId = 20; 6308 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 6309 6310 if (!headerConfigurationHideSearch) 6311 { 6312 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 6313 } 6314 break; 6315 case "normal": //1 6316 default: 6317 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 6318 6319 if (!headerConfigurationHideSearch) 6320 { 6321 configSearchBar.SortId = 20; 6322 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); 6323 } 6324 6325 configDesktopActionsMenu.SortId = 30; 6326 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopActionsMenu); 6327 6328 configDesktopActionsMenu.Design.Size = "auto-width"; 6329 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 6330 break; 6331 } 6332 } 6333 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 6334 6335 @using System 6336 @using System.Web 6337 @using Dynamicweb.Rapido.Blocks.Extensibility 6338 @using Dynamicweb.Rapido.Blocks 6339 6340 @{ 6341 6342 } 6343 6344 6345 @helper RenderDesktopTools() 6346 { 6347 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopTools").OrderBy(item => item.SortId).ToList(); 6348 6349 <div class="tools-navigation dw-mod"> 6350 <div class="center-container grid top-container__center-container dw-mod"> 6351 @RenderBlockList(subBlocks) 6352 </div> 6353 </div> 6354 } 6355 6356 @helper RenderDesktopToolsText() 6357 { 6358 string toolsText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("ToolsText"); 6359 if (!string.IsNullOrEmpty(toolsText)) 6360 { 6361 <div class="u-margin-top u-margin-bottom">@toolsText</div> 6362 } 6363 } 6364 6365 @helper RenderDesktopToolsNavigation() 6366 { 6367 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 6368 6369 if (renderPagesInToolBar) 6370 { 6371 @RenderNavigation(new 6372 { 6373 id = "topToolsNavigation", 6374 cssclass = "menu menu-tools dw-mod dwnavigation", 6375 template = "TopMenu.xslt", 6376 endlevel = 1, 6377 startlevel = 1 6378 }) 6379 } 6380 <div class = "desktop-search"> 6381 <span class="search-desktop-header"><i class="fas fa-search"></i></span> 6382 @RenderMobileTopSearchBar() 6383 <span class="language-selector-header"><a href ="/en/home">EN </a>/<a href="/"> RO</a></span> 6384 </div> 6385 } 6386 6387 @helper RenderDesktopNavigation() 6388 { 6389 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopNavigation").OrderBy(item => item.SortId).ToList(); 6390 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 6391 string alignClass = topLayout == "two-lines-centered" ? "grid--justify-center" : ""; 6392 <nav class="main-navigation dw-mod"> 6393 <div class="center-container top-container__center-container grid @alignClass dw-mod"> 6394 @RenderBlockList(subBlocks) 6395 6396 </div> 6397 <div class = "navigation-overlay"></div> 6398 </nav> 6399 } 6400 6401 @helper RenderDesktopExtra() 6402 { 6403 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopExtra").OrderBy(item => item.SortId).ToList(); 6404 6405 if (subBlocks.Count > 0) 6406 { 6407 <div class="header header-top dw-mod"> 6408 <div class="center-container top-container__center-container grid--justify-space-between grid grid--align-center dw-mod"> 6409 <div class="menu-bars__wrapper"> 6410 <i class="fas fa-bars"></i> 6411 </div> 6412 @RenderBlockList(subBlocks) 6413 </div> 6414 </div> 6415 } 6416 }</text> 6417 } 6418 6419 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 6420 6421 @using System 6422 @using System.Web 6423 @using Dynamicweb.Rapido.Blocks.Extensibility 6424 @using Dynamicweb.Rapido.Blocks 6425 @using Dynamicweb.Rapido.Blocks.Components.General 6426 @using Dynamicweb.Frontend 6427 6428 @functions { 6429 int impersonationPageId; 6430 string impersonationLayout; 6431 int impersonationFeed; 6432 Block impersonationBar; 6433 6434 string getUserNameFromParams(string firstName, string middleName, string lastName, string name, string email, string userName) 6435 { 6436 string username = ""; 6437 6438 if (!string.IsNullOrEmpty(firstName) && !string.IsNullOrEmpty(lastName)) 6439 { 6440 username = firstName + " " + (!string.IsNullOrEmpty(middleName) ? middleName + " " : "") + lastName; 6441 } 6442 else if (!string.IsNullOrEmpty(name)) 6443 { 6444 username = name; 6445 } 6446 else if (!string.IsNullOrEmpty(email)) 6447 { 6448 username = email; 6449 } 6450 else 6451 { 6452 username = userName; 6453 } 6454 return username; 6455 } 6456 6457 string getUserName(UserViewModel user) 6458 { 6459 return getUserNameFromParams(user.FirstName, user.MiddleName, user.LastName, user.Name, user.Email, user.UserName); 6460 } 6461 6462 string getUserName(Dynamicweb.Security.UserManagement.User user) 6463 { 6464 return getUserNameFromParams(user.FirstName, user.MiddleName, user.LastName, user.Name, user.Email, user.UserName); 6465 } 6466 } 6467 6468 @{ 6469 impersonationPageId = GetPageIdByNavigationTag("Impersonation"); 6470 impersonationLayout = Model.Area.Item.GetItem("Ecommerce").GetList("ImpersonationLayout") != null ? Model.Area.Item.GetItem("Ecommerce").GetList("ImpersonationLayout").SelectedValue : "bar"; 6471 impersonationFeed = GetPageIdByNavigationTag("UsersFeed"); 6472 6473 if (Model.CurrentUser.ID > 0 && Model.SecondaryUsers.Count > 0) 6474 { 6475 impersonationBar = new Block 6476 { 6477 Id = "ImpersonationBar", 6478 SortId = 50, 6479 Template = RenderImpersonation(), 6480 SkipRenderBlocksList = true, 6481 Design = new Design 6482 { 6483 Size = "auto-width", 6484 HidePadding = true, 6485 RenderType = RenderType.Column 6486 } 6487 }; 6488 6489 if (impersonationLayout == "top-bar") { 6490 impersonationBar.SortId = 9; 6491 } 6492 6493 Block impersonationContent = new Block 6494 { 6495 Id = "ImpersonationContent", 6496 SortId = 20 6497 }; 6498 6499 if (Model.CurrentSecondaryUser != null && Model.CurrentSecondaryUser.ID > 0) 6500 { 6501 //Render stop impersonation view 6502 impersonationContent.Template = RenderStopImpersonationView(); 6503 6504 6505 Modal stopImpersonation = new Modal 6506 { 6507 Id = "StopImpersonation", 6508 Heading = new Heading { 6509 Level = 2, 6510 Title = Translate("Sign out"), 6511 Icon = new Icon { 6512 Name = "fa-sign-out", 6513 Prefix = "fas", 6514 LabelPosition = IconLabelPosition.After 6515 } 6516 }, 6517 Width = ModalWidth.Sm, 6518 BodyTemplate = RenderStopImpersonationForm() 6519 }; 6520 6521 Block stopImpersonationBlock = new Block 6522 { 6523 Id = "StopImpersonationBlock", 6524 SortId = 10, 6525 Component = stopImpersonation 6526 }; 6527 impersonationBar.BlocksList.Add(stopImpersonationBlock); 6528 } 6529 else 6530 { 6531 //Render main view 6532 switch (impersonationLayout) 6533 { 6534 case "right-lower-box": 6535 impersonationContent.BlocksList.Add( 6536 new Block { 6537 Id = "RightLowerBoxHeader", 6538 SortId = 10, 6539 Component = new Heading { 6540 Level = 5, 6541 Title = Translate("View the list of users you can sign in as"), 6542 CssClass = "impersonation-text" 6543 } 6544 } 6545 ); 6546 impersonationContent.BlocksList.Add( 6547 new Block { 6548 Id = "RightLowerBoxContent", 6549 SortId = 20, 6550 Template = RenderImpersonationControls() 6551 } 6552 ); 6553 break; 6554 case "right-lower-bar": 6555 impersonationContent.BlocksList.Add( 6556 new Block { 6557 Id = "RightLowerBarContent", 6558 SortId = 10, 6559 Template = RenderImpersonationControls() 6560 } 6561 ); 6562 break; 6563 case "bar": 6564 default: 6565 impersonationContent.BlocksList.Add( 6566 new Block { 6567 Id = "ViewListLink", 6568 SortId = 20, 6569 Template = RenderViewListLink() 6570 } 6571 ); 6572 impersonationContent.BlocksList.Add( 6573 new Block { 6574 Id = "BarTypeaheadSearch", 6575 SortId = 30, 6576 Template = RenderTypeaheadSearch() 6577 } 6578 ); 6579 break; 6580 } 6581 } 6582 impersonationBar.BlocksList.Add(impersonationContent); 6583 6584 impersonationBar.BlocksList.Add( 6585 new Block 6586 { 6587 Id = "ImpersonationSearchTemplates", 6588 SortId = 30, 6589 Template = RenderSearchResultTemplate() 6590 } 6591 ); 6592 if (impersonationLayout != "bar" && impersonationLayout != "top-bar") 6593 { 6594 impersonationBar.BlocksList.Add( 6595 new Block 6596 { 6597 Id = "ImpersonationSearchScripts", 6598 SortId = 40, 6599 Template = RenderSearchScripts() 6600 } 6601 ); 6602 } 6603 BlocksPage.GetBlockPage("Master").Add("MasterHeader", impersonationBar); 6604 } 6605 } 6606 6607 @helper RenderImpersonation() 6608 { 6609 List<Block> subBlocks = impersonationBar.BlocksList.OrderBy(item => item.SortId).ToList(); 6610 <input type="checkbox" class="impersonation-trigger js-remember-state" id="ImpersonationMinimizeTrigger" /> 6611 <div class="impersonation impersonation--@(impersonationLayout)-layout dw-mod" id="Impersonation"> 6612 @if (impersonationLayout == "right-lower-box") 6613 { 6614 @RenderRightLowerBoxHeader() 6615 } 6616 <div class="center-container top-container__center-container impersonation__container @(impersonationLayout != "bar" && impersonationLayout != "top-bar" ? "impersonation__container--box" : "") dw-mod"> 6617 @*Impersonation*@ 6618 @RenderBlockList(subBlocks) 6619 </div> 6620 </div> 6621 } 6622 6623 @helper RenderRightLowerBoxHeader() 6624 { 6625 <div class="impersonation__header dw-mod"> 6626 <div class="impersonation__title">@Translate("Impersonation")</div> 6627 <label for="ImpersonationMinimizeTrigger" class="btn btn--impersonation impersonation__minimize-btn dw-mod" onclick="this.blur();"> 6628 @Render(new Icon 6629 { 6630 Prefix = "fas", 6631 Name = "fa-window-minimize" 6632 }) 6633 </label> 6634 </div> 6635 } 6636 6637 @helper RenderStopImpersonationView() 6638 { 6639 string secondaryUserName = getUserName(Model.CurrentSecondaryUser); 6640 string userName = getUserName(Pageview.User); 6641 string impersonationText = "<span class=\"impersonation-light-text dw-mod\">" + Translate("Logged in as") + "</span> <b>" + secondaryUserName + "</b> <span class=\"impersonation-light-text dw-mod\">" + Translate("by") + "</span> <b>" + userName + "</b> "; 6642 impersonationText = Dynamicweb.Security.UserManagement.User.ImpersonationMode == Dynamicweb.Security.UserManagement.UserImpersonation.Full ? "<span class=\"impersonation-light-text dw-mod\">" + Translate("Logged in as") + "</span> <b>" + userName + "</b> <span class=\"impersonation-light-text dw-mod\">" + Translate("by") + "</span> <b>" + secondaryUserName + "</b> " : impersonationText; 6643 6644 if (impersonationLayout == "right-lower-box") 6645 { 6646 <div class="u-margin-bottom--lg u-ta-center"> 6647 @impersonationText 6648 </div> 6649 <div class="u-margin-bottom--lg u-ta-center"> 6650 @RenderSwitchAccountButton() 6651 </div> 6652 @RenderStopImpersonationButton() 6653 } 6654 else 6655 { 6656 <div class="grid grid--align-center impersonation__stop-wrap"> 6657 <div class="impersonation-bar-item dw-mod"> 6658 @impersonationText 6659 </div> 6660 <div class="impersonation-bar-item dw-mod"> 6661 @RenderSwitchAccountButton() 6662 </div> 6663 <div class="impersonation-bar-item dw-mod"> 6664 @RenderStopImpersonationButton() 6665 </div> 6666 </div> 6667 } 6668 } 6669 6670 @helper RenderSwitchAccountButton() { 6671 @Render(new Button 6672 { 6673 Href = "/Default.aspx?ID=" + impersonationPageId, 6674 ButtonType = ButtonType.Button, 6675 ButtonLayout = ButtonLayout.Clean, 6676 Title = Translate("Switch account"), 6677 Icon = new Icon { 6678 Name = "fa-users", 6679 Prefix = "fal", 6680 LabelPosition = IconLabelPosition.After 6681 }, 6682 CssClass = "u-no-margin u-color-inherit" 6683 }) 6684 } 6685 6686 @helper RenderStopImpersonationForm() 6687 { 6688 string secondaryUserName = getUserName(Model.CurrentSecondaryUser); 6689 string userName = getUserName(Pageview.User); 6690 int pageId = Model.TopPage.ID; 6691 6692 <form method="post" class="u-no-margin"> 6693 @Render(new Button 6694 { 6695 ButtonType = ButtonType.Submit, 6696 ButtonLayout = ButtonLayout.Secondary, 6697 Title = Translate("Sign out as") + " " + userName, 6698 Href = "/Default.aspx?ID=" + impersonationPageId, 6699 CssClass = "btn--full", 6700 Name = "DwExtranetRemoveSecondaryUser" 6701 }) 6702 6703 @Render(new Button 6704 { 6705 ButtonType = ButtonType.Submit, 6706 ButtonLayout = ButtonLayout.Secondary, 6707 Title = Translate("Sign out as") + " " + secondaryUserName, 6708 Href = "/Admin/Public/ExtranetLogoff.aspx?ID=" + pageId, 6709 CssClass = "btn--full", 6710 Name = "DwExtranetRemoveSecondaryUser" 6711 }) 6712 </form> 6713 } 6714 6715 @helper RenderStopImpersonationButton() { 6716 @Render(new Button 6717 { 6718 ButtonType = ButtonType.Button, 6719 ButtonLayout = ButtonLayout.Clean, 6720 Title = Translate("Sign out"), 6721 Icon = new Icon { 6722 Name = "fa-sign-out", 6723 Prefix = "fal", 6724 LabelPosition = IconLabelPosition.After 6725 }, 6726 OnClick = "document.getElementById('StopImpersonationModalTrigger').checked = true", 6727 CssClass = "u-no-margin" 6728 }) 6729 } 6730 6731 @helper RenderImpersonationControls() 6732 { 6733 <div class="impersonation__controls"> 6734 @RenderViewListLink() 6735 @RenderSearchBox() 6736 </div> 6737 @RenderResultsList() 6738 } 6739 6740 @helper RenderViewListLink() 6741 { 6742 string title = impersonationLayout == "right-lower-box" ? Translate("View the list") : Translate("View the list of users you can sign in as"); 6743 string buttonClasses = impersonationLayout == "right-lower-box" ? "impersonation__button btn btn--impersonation" : "impersonation__link impersonation__link"; 6744 6745 @Render(new Link { 6746 ButtonLayout = ButtonLayout.None, 6747 Title = title, 6748 Href = "/Default.aspx?ID=" + impersonationPageId, 6749 CssClass = buttonClasses 6750 }) 6751 } 6752 6753 @helper RenderSearchBox() 6754 { 6755 <div class="impersonation__search-wrap"> 6756 <input placeholder="@Translate("Search users")" type="text" class="impersonation__search-field dw-mod" onkeyup="searchKeyUpHandler(event)" id="ImpersonationBoxSearchField"> 6757 <div id="ImpersonationBoxSearchFind" class="impersonation__search-icon dw-mod" onclick="updateResults(document.getElementById('ImpersonationBoxSearchField').value)"> 6758 <i class="fal fa-search"></i> 6759 </div> 6760 <div id="ImpersonationBoxSearchClear" class="impersonation__search-icon u-hidden dw-mod" onclick="clearResults();"> 6761 <i class="fal fa-times"></i> 6762 </div> 6763 </div> 6764 } 6765 6766 @helper RenderTypeaheadSearch() 6767 { 6768 <div class="typeahead u-ta-right impersonation__typeahead js-typeahead dw-mod" id="ImpersonationSearchBar" 6769 data-page-size="5" 6770 data-search-feed-id="@impersonationFeed" 6771 data-result-page-id="@impersonationPageId" 6772 data-search-type="user-search" 6773 data-search-parameter-name="q"> 6774 6775 <div class="typeahead-search-field"> 6776 <input type="text" class="u-no-margin u-full-width js-typeahead-search-field" placeholder="@Translate("Search users")"> 6777 <ul class="dropdown dropdown--absolute-position u-min-w220px u-full-width js-handlebars-root js-typeahead-search-content dw-mod" id="ImpersonationSearchBarContent" data-template="ImpersonationSearchResult" data-json-feed="/Default.aspx?ID=@impersonationFeed" data-init-onload="false"></ul> 6778 </div> 6779 </div> 6780 } 6781 6782 @helper RenderResultsList() 6783 { 6784 <ul id="ImpersonationBoxSearchResults" class="impersonation__search-results js-handlebars-root dw-mod" data-template="ImpersonationSearchResult" data-json-feed="/Default.aspx?ID=@impersonationFeed" data-init-onload="false" data-preloader="minimal"></ul> 6785 } 6786 6787 @helper RenderSearchResultTemplate() 6788 { 6789 <script id="ImpersonationSearchResult" type="text/x-template"> 6790 {{#.}} 6791 {{#Users}} 6792 <li class="impersonation__search-results-item impersonation-user"> 6793 <form method="post" class="impersonation-user__form" name="account{{id}}"> 6794 <input type="hidden" id="DWExtranetSecondaryUserSelector" name="DWExtranetSecondaryUserSelector" value="{{id}}"> 6795 <div class="impersonation-user__info"> 6796 <div class="impersonation-user__name">{{userName}}</div> 6797 <div class="impersonation-user__number">{{customerNumber}}</div> 6798 </div> 6799 @Render(new Button 6800 { 6801 ButtonType = ButtonType.Submit, 6802 ButtonLayout = ButtonLayout.Secondary, 6803 Title = Translate("Sign in as"), 6804 CssClass = "impersonation-user__sign-in-btn" + (impersonationLayout != "bar" ? " btn--impersonation" : "") 6805 }) 6806 </form> 6807 </li> 6808 {{/Users}} 6809 {{#unless Users}} 6810 <li class="impersonation__search-results-item impersonation__search-results-item--not-found"> 6811 @Translate("Your search gave 0 results") 6812 </li> 6813 {{/unless}} 6814 {{/.}} 6815 </script> 6816 } 6817 6818 @helper RenderSearchScripts() 6819 { 6820 <script> 6821 let inputDelayTimer; 6822 function searchKeyUpHandler(e) { 6823 clearTimeout(inputDelayTimer); 6824 let value = e.target.value; 6825 if (value != "") { 6826 inputDelayTimer = setTimeout(function () { 6827 updateResults(value); 6828 }, 500); 6829 } else { 6830 clearResults(); 6831 } 6832 }; 6833 6834 function updateResults(value) { 6835 if (value == "") { 6836 return null; 6837 } 6838 HandlebarsBolt.UpdateContent("ImpersonationBoxSearchResults", "/Default.aspx?ID=@impersonationFeed&q=" + value); 6839 document.getElementById("ImpersonationBoxSearchFind").classList.add("u-hidden"); 6840 document.getElementById("ImpersonationBoxSearchClear").classList.remove("u-hidden"); 6841 } 6842 6843 function clearResults() { 6844 document.getElementById("ImpersonationBoxSearchField").value = ""; 6845 HandlebarsBolt.CleanContainer("ImpersonationBoxSearchResults"); 6846 document.getElementById("ImpersonationBoxSearchFind").classList.remove("u-hidden"); 6847 document.getElementById("ImpersonationBoxSearchClear").classList.add("u-hidden"); 6848 } 6849 </script> 6850 } 6851 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 6852 6853 @using System 6854 @using System.Web 6855 @using System.Collections.Generic 6856 @using Dynamicweb.Rapido.Blocks.Extensibility 6857 @using Dynamicweb.Rapido.Blocks 6858 6859 @{ 6860 BlocksPage miniCartBlocksPage = BlocksPage.GetBlockPage("Master"); 6861 string orderlinesView = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView").SelectedValue : "table"; 6862 6863 Block orderLines = new Block 6864 { 6865 Id = "MiniCartOrderLines", 6866 SkipRenderBlocksList = true, 6867 BlocksList = new List<Block> 6868 { 6869 new Block { 6870 Id = "MiniCartOrderLinesList", 6871 SortId = 20, 6872 Template = RenderMiniCartOrderLinesList() 6873 } 6874 } 6875 }; 6876 6877 Block orderlinesScriptTemplates = new Block 6878 { 6879 Id = "OrderlinesScriptTemplates" 6880 }; 6881 6882 if (orderlinesView == "table") 6883 { 6884 orderLines.Template = RenderMiniCartOrderLinesTable(); 6885 orderLines.BlocksList.Add( 6886 new Block 6887 { 6888 Id = "MiniCartOrderlinesTableHeader", 6889 SortId = 10, 6890 Template = RenderMiniCartOrderLinesHeader() 6891 } 6892 ); 6893 6894 orderlinesScriptTemplates.Template = RenderMiniCartScriptsTableTemplates(); 6895 } 6896 else 6897 { 6898 orderLines.Template = RenderMiniCartOrderLinesBlocks(); 6899 orderlinesScriptTemplates.Template = RenderMiniCartScriptsListTemplates(); 6900 } 6901 6902 miniCartBlocksPage.Add("MasterBottomSnippets", orderlinesScriptTemplates); 6903 6904 Block miniCartScriptTemplates = new Block() 6905 { 6906 Id = "MasterMiniCartTemplates", 6907 SortId = 1, 6908 Template = RenderMiniCartScriptTemplates(), 6909 SkipRenderBlocksList = true, 6910 BlocksList = new List<Block> 6911 { 6912 orderLines, 6913 new Block { 6914 Id = "MiniCartFooter", 6915 Template = RenderMiniCartFooter(), 6916 SortId = 50, 6917 SkipRenderBlocksList = true, 6918 BlocksList = new List<Block> 6919 { 6920 new Block { 6921 Id = "MiniCartSubTotal", 6922 Template = RenderMiniCartSubTotal(), 6923 SortId = 30 6924 }, 6925 new Block { 6926 Id = "MiniCartFees", 6927 Template = RenderMiniCartFees(), 6928 SortId = 40 6929 }, 6930 new Block { 6931 Id = "MiniCartPoints", 6932 Template = RenderMiniCartPoints(), 6933 SortId = 50 6934 }, 6935 new Block { 6936 Id = "MiniCartTotal", 6937 Template = RenderMiniCartTotal(), 6938 SortId = 60 6939 }, 6940 new Block { 6941 Id = "MiniCartDisclaimer", 6942 Template = RenderMiniCartDisclaimer(), 6943 SortId = 70 6944 }, 6945 new Block { 6946 Id = "MiniCartActions", 6947 Template = RenderMiniCartActions(), 6948 SortId = 80 6949 } 6950 } 6951 } 6952 } 6953 }; 6954 6955 miniCartBlocksPage.Add("MasterBottomSnippets", miniCartScriptTemplates); 6956 } 6957 6958 @helper RenderMiniCartScriptsTableTemplates() 6959 { 6960 <script id="MiniCartOrderline" type="text/x-template"> 6961 {{#unless isEmpty}} 6962 <tr> 6963 <td class="u-w60px"><a href="{{link}}" class="{{hideimage}}"><img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=50&height=50&crop=5&Compression=75&image={{image}}" alt="{{name}}" title="{{name}}"></a></td> 6964 <td class="u-va-middle"> 6965 <a href="{{link}}" class="mini-cart-orderline__name" title="{{name}}">{{name}}</a> 6966 {{#if variantname}} 6967 <a href="{{link}}" class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{variantname}}</a> 6968 {{/if}} 6969 {{#if unitname}} 6970 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{unitname}}</div> 6971 {{/if}} 6972 </td> 6973 <td class="u-ta-right u-va-middle">{{quantity}}</td> 6974 <td class="u-ta-right u-va-middle"> 6975 {{#if pointsTotal}} 6976 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 6977 {{else}} 6978 {{totalprice}} 6979 {{/if}} 6980 </td> 6981 </tr> 6982 {{/unless}} 6983 </script> 6984 6985 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 6986 {{#unless isEmpty}} 6987 <tr class="table__row--no-border"> 6988 <td class="u-w60px">&nbsp;</td> 6989 <td><div class="mini-cart-orderline__name dw-mod">{{name}}</div></td> 6990 <td class="u-ta-right">&nbsp;</td> 6991 <td class="u-ta-right">{{totalprice}}</td> 6992 </tr> 6993 {{/unless}} 6994 </script> 6995 } 6996 6997 @helper RenderMiniCartScriptsListTemplates() 6998 { 6999 7000 <script id="MiniCartOrderline" type="text/x-template"> 7001 {{#unless isEmpty}} 7002 <div class="mini-cart-orderline grid dw-mod"> 7003 <div class="grid__col-4"> 7004 <a href="{{link}}" class="{{hideimage}}"> 7005 <img class="" src="/Admin/Public/GetImage.ashx?width=100&height=100&crop=5&Compression=75&image={{image}}" alt="{{name}}" title="{{name}}"> 7006 </a> 7007 </div> 7008 <div class="grid__col-8"> 7009 <a href="{{link}}" class="mini-cart-orderline__name mini-cart-orderline__name--truncate mini-cart-orderline__name--md u-padding-right--lg" title="{{name}}">{{name}}</a> 7010 {{#if variantname}} 7011 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Variant"): {{variantname}}</div> 7012 {{/if}} 7013 {{#if unitname}} 7014 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Unit"): {{unitname}}</div> 7015 {{/if}} 7016 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Qty"): {{quantity}}</div> 7017 7018 <div class="grid__cell-footer"> 7019 <div class="grid__cell"> 7020 <div class="u-pull--left mini-cart-orderline__price dw-mod"> 7021 {{#if pointsTotal}} 7022 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 7023 {{else}} 7024 {{totalprice}} 7025 {{/if}} 7026 </div> 7027 <button type="button" 7028 title="@Translate("Remove orderline")" 7029 class="btn btn--clean btn--condensed u-pull--right mini-cart-orderline__remove-btn dw-mod" 7030 onclick="{{#if googleImpression}}googleImpressionRemoveFromCart({{googleImpression}});{{/if}}Cart.UpdateCart('miniCartContent', '/Default.aspx?ID={{cartFeedPageId}}', '{{removeLink}}', true);">@Translate("Remove")</button> 7031 </div> 7032 </div> 7033 </div> 7034 </div> 7035 {{/unless}} 7036 </script> 7037 7038 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 7039 {{#unless isEmpty}} 7040 <div class="mini-cart-orderline mini-cart-orderline--discount grid dw-mod"> 7041 <div class="grid__col-8"> 7042 <div class="mini-cart-orderline__name mini-cart-orderline__name dw-mod">{{name}}</div> 7043 </div> 7044 <div class="grid__col-4 u-align-right">{{totalprice}}</div> 7045 </div> 7046 {{/unless}} 7047 </script> 7048 } 7049 7050 @helper RenderMiniCartScriptTemplates() 7051 { 7052 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMiniCartTemplates").OrderBy(item => item.SortId).ToList(); 7053 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 7054 string cartPageLink = string.Concat("/Default.aspx?ID=", GetPageIdByNavigationTag("CartPage")); 7055 bool miniCartUseGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 7056 7057 <script id="MiniCartContent" type="text/x-template"> 7058 {{#.}} 7059 {{#unless isEmpty}} 7060 @if (miniCartUseGoogleTagManager) 7061 { 7062 <text>{{{googleEnchantImpressionEmptyCart OrderLines}}}</text> 7063 } 7064 @RenderBlockList(subBlocks) 7065 {{/unless}} 7066 7067 {{#if isEmpty}} 7068 {{cartIsEmptyMessage}} 7069 {{/if}} 7070 {{/.}} 7071 </script> 7072 } 7073 7074 @helper RenderMiniCartOrderLinesTable() 7075 { 7076 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList(); 7077 7078 <div class="u-overflow-auto"> 7079 <table class="table mini-cart-table dw-mod"> 7080 @RenderBlockList(subBlocks) 7081 </table> 7082 </div> 7083 } 7084 7085 @helper RenderMiniCartOrderLinesBlocks() 7086 { 7087 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList(); 7088 7089 <div class="u-overflow-hidden"> 7090 @RenderBlockList(subBlocks) 7091 </div> 7092 } 7093 7094 @helper RenderMiniCartOrderLinesHeader() 7095 { 7096 <thead> 7097 <tr> 7098 <td>&nbsp;</td> 7099 <td>@Translate("Product")</td> 7100 <td class="u-ta-right">@Translate("Qty")</td> 7101 <td class="u-ta-right" width="120">@Translate("Price")</td> 7102 </tr> 7103 </thead> 7104 } 7105 7106 @helper RenderMiniCartOrderLinesList() 7107 { 7108 <text> 7109 {{#OrderLines}} 7110 {{#ifCond template "===" "CartOrderline"}} 7111 {{>MiniCartOrderline}} 7112 {{/ifCond}} 7113 {{#ifCond template "===" "CartOrderlineMobile"}} 7114 {{>MiniCartOrderline}} 7115 {{/ifCond}} 7116 {{#ifCond template "===" "CartOrderlineDiscount"}} 7117 {{>MiniCartOrderlineDiscount}} 7118 {{/ifCond}} 7119 {{/OrderLines}} 7120 </text> 7121 } 7122 7123 @helper RenderMiniCartFees() 7124 { 7125 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 7126 if (!pointShop) 7127 { 7128 <text> 7129 {{#unless hidePaymentfee}} 7130 <div class="grid"> 7131 <div class="grid__col-6 grid__col--bleed-y"> 7132 {{paymentmethod}} 7133 </div> 7134 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{paymentfee}}</div> 7135 </div> 7136 {{/unless}} 7137 </text> 7138 } 7139 <text> 7140 {{#unless hideShippingfee}} 7141 <div class="grid"> 7142 <div class="grid__col-6 grid__col--bleed-y"> 7143 {{shippingmethod}} 7144 </div> 7145 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{shippingfee}}</div> 7146 </div> 7147 {{/unless}} 7148 </text> 7149 <text> 7150 {{#if hasTaxSettings}} 7151 <div class="grid"> 7152 <div class="grid__col-6 grid__col--bleed-y">@Translate("Sales Tax")</div> 7153 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{totaltaxes}}</div> 7154 </div> 7155 {{/if}} 7156 </text> 7157 } 7158 7159 @helper RenderMiniCartFooter() 7160 { 7161 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartFooter").OrderBy(item => item.SortId).ToList(); 7162 7163 <div class="mini-cart__footer u-border-top u-padding-top dw-mod"> 7164 @RenderBlockList(subBlocks) 7165 </div> 7166 } 7167 7168 @helper RenderMiniCartActions() 7169 { 7170 int cartPageId = GetPageIdByNavigationTag("CartPage"); 7171 7172 <button type="button" title="@Translate("Empty cart")" class="btn btn--secondary u-full-width dw-mod u-no-margin u-margin-bottom" onclick="googleEnchantImpressionEmptyCart(); Cart.EmptyCart(event, '{{orderContext}}');">@Translate("Empty cart")</button> 7173 <a href="/Default.aspx?ID={{cartPageId}}" title="@Translate("Go to cart")" class="btn btn--primary u-full-width u-no-margin dw-mod">@Translate("Go to cart")</a> 7174 } 7175 7176 @helper RenderMiniCartPoints() 7177 { 7178 <text> 7179 {{#if earnings}} 7180 <div class="grid"> 7181 <div class="grid__col-6 grid__col--bleed-y">@Translate("Earnings")</div> 7182 <div class="grid__col-6 grid__col--bleed-y grid--align-end"> 7183 <div> 7184 <span class="u-color--loyalty-points">{{earnings}}</span> @Translate("points") 7185 </div> 7186 </div> 7187 </div> 7188 {{/if}} 7189 </text> 7190 } 7191 7192 @helper RenderMiniCartSubTotal() 7193 { 7194 bool hasTaxSettings = Dynamicweb.Rapido.Services.Countries.HasTaxSettings(Model.Cart.ID); 7195 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 7196 if (!pointShop) 7197 { 7198 <text> 7199 {{#unless hideSubTotal}} 7200 <div class="grid dw-mod u-bold"> 7201 <div class="grid__col-6 grid__col--bleed-y">@Translate("Subtotal")</div> 7202 <div class="grid__col-6 grid__col--bleed-y grid--align-end"> 7203 @if (hasTaxSettings) 7204 { 7205 <text>{{subtotalpricewithouttaxes}}</text> 7206 } 7207 else 7208 { 7209 <text>{{subtotalprice}}</text> 7210 } 7211 </div> 7212 </div> 7213 {{/unless}} 7214 </text> 7215 } 7216 } 7217 7218 @helper RenderMiniCartTotal() 7219 { 7220 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 7221 7222 <div class="mini-cart-totals grid u-border-top u-margin-top dw-mod"> 7223 <div class="grid__col-6">@Translate("Total")</div> 7224 <div class="grid__col-6 grid--align-end"> 7225 <div> 7226 @if (pointShop) 7227 { 7228 <span class="u-color--loyalty-points">{{pointsUsedInCart}}</span> @Translate("points") 7229 } 7230 else 7231 { 7232 <text>{{totalprice}}</text> 7233 } 7234 </div> 7235 </div> 7236 </div> 7237 } 7238 7239 @helper RenderMiniCartDisclaimer() 7240 { 7241 <text> 7242 {{#if showCheckoutDisclaimer}} 7243 <div class="grid u-margin-bottom u-ta-right"> 7244 <small class="grid__col-12">{{checkoutDisclaimer}}</small> 7245 </div> 7246 {{/if}} 7247 </text> 7248 } 7249 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 7250 7251 @using Dynamicweb.Rapido.Blocks.Extensibility 7252 @using Dynamicweb.Rapido.Blocks 7253 @using Dynamicweb.Rapido.Blocks.Components.General 7254 @using Dynamicweb.Rapido.Blocks.Components 7255 @using Dynamicweb.Rapido.Services 7256 7257 @{ 7258 string addToCartNotificationType = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType").SelectedValue : ""; 7259 string addToCartNotificationMiniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown"; 7260 bool addToCartHideCartIcon = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 7261 7262 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed() && !string.IsNullOrEmpty(addToCartNotificationType)) 7263 { 7264 if (addToCartNotificationType == "modal") 7265 { 7266 Block addToCartNotificationModal = new Block 7267 { 7268 Id = "AddToCartNotificationModal", 7269 Template = RenderAddToCartNotificationModal() 7270 }; 7271 7272 Block addToCartNotificationScript = new Block 7273 { 7274 Id = "AddToCartNotificationScript", 7275 Template = RenderAddToCartNotificationModalScript() 7276 }; 7277 BlocksPage.GetBlockPage("Master").Add("MasterTopSnippets", addToCartNotificationModal); 7278 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript); 7279 } 7280 else if (addToCartNotificationType == "toggle" && addToCartNotificationMiniCartLayout != "none" && !addToCartHideCartIcon && Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 7281 { 7282 Block addToCartNotificationScript = new Block 7283 { 7284 Id = "AddToCartNotificationScript", 7285 Template = RenderAddToCartNotificationToggleScript() 7286 }; 7287 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript); 7288 } 7289 } 7290 } 7291 7292 @helper RenderAddToCartNotificationModal() 7293 { 7294 <div id="LastAddedProductModal" data-template="LastAddedProductTemplate"></div> 7295 } 7296 7297 @helper RenderAddToCartNotificationModalScript() 7298 { 7299 int cartPageId = GetPageIdByNavigationTag("CartPage"); 7300 7301 <script id="LastAddedProductTemplate" type="text/x-template"> 7302 @{ 7303 7304 Modal lastAddedProduct = new Modal 7305 { 7306 Id = "LastAddedProduct", 7307 Heading = new Heading 7308 { 7309 Level = 2, 7310 Title = Translate("Product is added to the cart") 7311 }, 7312 Width = ModalWidth.Md, 7313 BodyTemplate = RenderModalContent() 7314 }; 7315 7316 lastAddedProduct.AddActions( 7317 new Button 7318 { 7319 ButtonType = ButtonType.Button, 7320 ButtonLayout = ButtonLayout.Secondary, 7321 Title = Translate("Continue shopping"), 7322 CssClass = "u-pull--left u-no-margin btn--sm", 7323 OnClick = "document.getElementById('LastAddedProductModalTrigger').checked = false" 7324 }, 7325 new Link 7326 { 7327 Href = "/Default.aspx?ID=" + cartPageId, 7328 ButtonLayout = ButtonLayout.Secondary, 7329 CssClass = "u-pull--right u-no-margin btn--sm", 7330 Title = Translate("Proceed to checkout"), 7331 OnClick = "document.getElementById('LastAddedProductModalTrigger').checked = false" 7332 } 7333 ); 7334 7335 @Render(lastAddedProduct) 7336 } 7337 </script> 7338 <script> 7339 document.addEventListener('addToCart', function (event) { 7340 Cart.ShowLastAddedProductModal(event.detail); 7341 }); 7342 </script> 7343 } 7344 7345 @helper RenderModalContent() 7346 { 7347 <div class="grid"> 7348 <div class="grid__col-2"> 7349 @Render(new Image { Path = "{{ productInfo.image }}", Link = "{{ productInfo.link }}", Title = "{{ productInfo.name }}", DisableImageEngine = true }) 7350 </div> 7351 <div class="u-padding grid--align-self-center"> 7352 <span>{{quantity}}</span> x 7353 </div> 7354 <div class="grid__col-auto grid--align-self-center"> 7355 <div>{{productInfo.name}}</div> 7356 {{#if productInfo.variantName}} 7357 <small class="u-margin-bottom-5px">{{productInfo.variantName}}</small> 7358 {{/if}} 7359 {{#if productInfo.unitName}} 7360 <small class="u-margin-bottom-5px">{{productInfo.unitName}}</small> 7361 {{/if}} 7362 </div> 7363 </div> 7364 } 7365 7366 @helper RenderAddToCartNotificationToggleScript() 7367 { 7368 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 7369 7370 <script> 7371 document.addEventListener('addToCart', function () { 7372 Cart.ToggleMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '@miniCartFeedPageId'); 7373 }); 7374 </script> 7375 } 7376 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 7377 7378 @using System 7379 @using System.Web 7380 @using System.Collections.Generic 7381 @using Dynamicweb.Rapido.Blocks.Extensibility 7382 @using Dynamicweb.Rapido.Blocks 7383 @using Dynamicweb.Rapido.Blocks.Components.General 7384 7385 @functions { 7386 BlocksPage footerBlocksPage = BlocksPage.GetBlockPage("Master"); 7387 } 7388 7389 @{ 7390 string footerColumnOneContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Content"); 7391 string footerColumnTwoContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Content"); 7392 string footerColumnThreeContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Content"); 7393 string footerColumnFourContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnFour") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnFour").GetString("Content") : ""; 7394 string footerColumnOneHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Header"); 7395 string footerColumnTwoHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Header"); 7396 string footerColumnThreeHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Header"); 7397 string footerColumnFourHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnFour") != null ? Model.Area.Item.GetItem("Layout").GetItem("FooterColumnFour").GetString("Header") : ""; 7398 7399 Block masterFooterContent = new Block() 7400 { 7401 Id = "MasterFooterContent", 7402 SortId = 10, 7403 Template = RenderFooter(), 7404 SkipRenderBlocksList = true 7405 }; 7406 footerBlocksPage.Add(MasterBlockId.MasterFooter, masterFooterContent); 7407 7408 if (!string.IsNullOrEmpty(footerColumnOneContent) || !string.IsNullOrEmpty(footerColumnOneHeader)) 7409 { 7410 Block masterFooterColumnOne = new Block 7411 { 7412 Id = "MasterFooterColumnOne", 7413 SortId = 10, 7414 Template = RenderFooterColumn(footerColumnOneHeader, footerColumnOneContent), 7415 Design = new Design 7416 { 7417 Size = "auto", 7418 RenderType = RenderType.Column 7419 } 7420 }; 7421 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnOne); 7422 } 7423 7424 if (!string.IsNullOrEmpty(footerColumnTwoContent) || !string.IsNullOrEmpty(footerColumnTwoHeader)) 7425 { 7426 Block masterFooterColumnTwo = new Block 7427 { 7428 Id = "MasterFooterColumnTwo", 7429 SortId = 20, 7430 Template = RenderFooterColumn(footerColumnTwoHeader, footerColumnTwoContent), 7431 Design = new Design 7432 { 7433 Size = "auto", 7434 RenderType = RenderType.Column 7435 } 7436 }; 7437 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnTwo); 7438 } 7439 7440 if (!string.IsNullOrEmpty(footerColumnThreeContent) || !string.IsNullOrEmpty(footerColumnThreeHeader)) 7441 { 7442 Block masterFooterColumnThree = new Block 7443 { 7444 Id = "MasterFooterColumnThree", 7445 SortId = 30, 7446 Template = RenderFooterColumn(footerColumnThreeHeader, footerColumnThreeContent), 7447 Design = new Design 7448 { 7449 Size = "auto", 7450 RenderType = RenderType.Column 7451 } 7452 }; 7453 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnThree); 7454 } 7455 7456 if (!string.IsNullOrEmpty(footerColumnFourContent) || !string.IsNullOrEmpty(footerColumnFourHeader)) 7457 { 7458 Block masterFooterColumnFour = new Block 7459 { 7460 Id = "MasterFooterColumnFour", 7461 SortId = 40, 7462 Template = RenderFooterColumn(footerColumnFourHeader, footerColumnFourContent), 7463 Design = new Design 7464 { 7465 Size = "auto", 7466 RenderType = RenderType.Column 7467 } 7468 }; 7469 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnFour); 7470 } 7471 7472 if (Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks").Count > 0) 7473 { 7474 Block masterFooterSocialLinks = new Block 7475 { 7476 Id = "MasterFooterSocialLinks", 7477 SortId = 40, 7478 Template = RenderFooterSocialLinks(), 7479 Design = new Design 7480 { 7481 Size = "auto", 7482 RenderType = RenderType.Column, 7483 CssClass = "footer__column-wrapper" 7484 } 7485 }; 7486 footerBlocksPage.Add("MasterFooterContent", masterFooterSocialLinks); 7487 } 7488 7489 if (Model.Area.Item.GetItem("Layout").GetBoolean("FooterNewsletterSignUp")) 7490 { 7491 Block masterFooterNewsletterSignUp = new Block 7492 { 7493 Id = "MasterFooterNewsletterSignUp", 7494 SortId = 50, 7495 Template = RenderFooterNewsletterSignUp(), 7496 Design = new Design 7497 { 7498 Size = "auto", 7499 RenderType = RenderType.Column, 7500 CssClass = "footer__column-wrapper" 7501 } 7502 }; 7503 footerBlocksPage.Add("MasterFooterContent", masterFooterNewsletterSignUp); 7504 } 7505 7506 @*if (Model.Area.Item.GetItem("Layout").GetItems("FooterPayments") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterPayments").Count > 0) 7507 { 7508 Block masterFooterPayments = new Block 7509 { 7510 Id = "MasterFooterPayments", 7511 SortId = 60, 7512 Template = RenderFooterPayments(), 7513 Design = new Design 7514 { 7515 Size = "12", 7516 RenderType = RenderType.Column 7517 } 7518 }; 7519 footerBlocksPage.Add("MasterFooterContent", masterFooterPayments); 7520 } 7521 7522 Block masterFooterCopyright = new Block 7523 { 7524 Id = "MasterFooterCopyright", 7525 SortId = 70, 7526 Template = RenderFooterCopyright(), 7527 Design = new Design 7528 { 7529 Size = "12", 7530 RenderType = RenderType.Column 7531 } 7532 }; 7533 footerBlocksPage.Add("MasterFooterContent", masterFooterCopyright);*@ 7534 } 7535 7536 @helper RenderFooter() 7537 { 7538 List<Block> subBlocks = this.footerBlocksPage.GetBlockListById("MasterFooterContent").OrderBy(item => item.SortId).ToList(); 7539 7540 var premiumArea = Model.Area.ID.ToString() == "32" ? "agricover-premium-footer" : ""; 7541 var isPremiumArea = Model.Area.ID.ToString() == "32" ? "True" : ""; 7542 <footer class="footer no-print dw-mod"> 7543 7544 <div class="center-container top-container__center-container dw-mod"> 7545 @if (isPremiumArea != "True") 7546 { 7547 @RenderLogoColumn() 7548 } 7549 <div class="grid grid--external-bleed-x footer__wrapper agricover-footer @premiumArea"> 7550 @if (isPremiumArea == "True") 7551 { 7552 @RenderLogoColumn() 7553 } 7554 @RenderBlockList(subBlocks) 7555 </div> 7556 </div> 7557 <div class="footer__bottom agricover-footer-bottom"> 7558 <div class="center-container top-container__center-container dw-mod"> 7559 <div class="grid grid--external-bleed-x footer__wrapper"> 7560 @if (Model.Area.Item.GetItem("Layout").GetItems("FooterPayments") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterPayments").Count > 0) 7561 { 7562 <div class="footer__bottom-payments">@RenderFooterPayments()</div> 7563 } 7564 <div class="footer__bottom-copyright">@RenderFooterCopyright()</div> 7565 </div> 7566 </div> 7567 </div> 7568 </footer> 7569 } 7570 7571 @helper RenderLogoColumn() 7572 { 7573 7574 <div class="footer__logo agricover-footer__logo dw-mod"> 7575 <img src='@Model.Area.Item.GetItem("Layout").GetString("Footer_Logo")' alt="" /> 7576 </div> 7577 } 7578 @helper RenderFooterColumn(string header, string content) 7579 { 7580 <h3 class="footer__heading dw-mod">@header</h3> 7581 <div class="footer__content dw-mod"> 7582 @content 7583 </div> 7584 } 7585 7586 @helper RenderFooterNewsletterSignUp() 7587 { 7588 string newsletterSignUpPageId = GetPageIdByNavigationTag("NewsletterSignUp").ToString(); 7589 Form form = new Form { Action = "/Default.aspx", Method = FormMethod.Get, Enctype = FormEnctype.multipart }; 7590 7591 form.Add(new HiddenField { Name = "ID", Value = newsletterSignUpPageId }); 7592 form.Add(new Text { Content = "<p>" + Translate("Sign up if you would like to receive occasional treats from us") + "</p>" }); 7593 form.Add(new TextField { 7594 Id = "NewsletterEmail", Name = "NewsletterEmail", Placeholder = Translate("Your email address"), 7595 Type = TextFieldType.Email, 7596 ActionButton = new Button { 7597 ButtonType = ButtonType.Submit, Id="Submitter", Title = Translate("Go"), OnClick = "Buttons.LockButton(event)", CssClass = "btn--condensed" 7598 } 7599 }); 7600 7601 <h3 class="footer__heading dw-mod">@Translate("Mailing list")<i class="icon--accordion fas fa-chevron-down"></i></h3> 7602 <div class="footer__content dw-mod"> 7603 @Render(form) 7604 </div> 7605 7606 @RenderANPCIcons() 7607 } 7608 7609 @helper RenderFooterSocialLinks() 7610 { 7611 string currentYear = DateTime.Now.Year.ToString(); 7612 <h3 class="footer__heading dw-mod">@Translate("Social links")<i class="icon--accordion fas fa-chevron-down"></i></h3> 7613 <div class="footer__content dw-mod"> 7614 <div class="collection dw-mod"> 7615 @foreach (var socialitem in Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks")) 7616 { 7617 var socialIcon = socialitem.GetValue("Icon") as Dynamicweb.Frontend.ListViewModel; 7618 string socialIconClass = socialIcon.SelectedValue; 7619 string socialIconTitle = socialIcon.SelectedName; 7620 string socialLink = socialitem.GetString("Link"); 7621 if (socialIconTitle == "Facebook") 7622 { 7623 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px" rel="noopener"><i class="fab fa-facebook-f fa-2x"></i></a> 7624 } 7625 else 7626 { 7627 if (socialIconTitle == "LinkedIn") 7628 { 7629 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px" rel="noopener"><i class="fab fa-linkedin-in fa-2x"></i></a> 7630 } 7631 else 7632 { 7633 if (socialIconTitle == "Twitter") 7634 { 7635 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px" rel="noopener"><i class="fab fa-twitter fa-2x"></i></a> 7636 } 7637 else 7638 { 7639 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px" rel="noopener"><i class="@socialIconClass fa-2x"></i></a> 7640 } 7641 } 7642 7643 } 7644 7645 } 7646 <p>© @currentYear @Model.Area.Item.GetItem("Layout").GetString("FooterCopyrightText")</p> 7647 </div> 7648 </div> 7649 } 7650 7651 @helper RenderFooterPayments() 7652 { 7653 <div class="footer__content dw-mod"> 7654 <div class="collection dw-mod"> 7655 @foreach (var payment in Model.Area.Item.GetItem("Layout").GetItems("FooterPayments")) 7656 { 7657 var paymentItem = payment.GetValue("CardTypeOrVerifiedPayment") as Dynamicweb.Frontend.ListViewModel; 7658 string paymentImage = null; 7659 string paymentTitle = paymentItem.SelectedName; 7660 ListOptionViewModel selected = paymentItem.SelectedOptions.FirstOrDefault(); 7661 if (selected != null) 7662 { 7663 paymentImage = selected.Icon; 7664 } 7665 7666 <div class="footer__card-type"> 7667 <img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=60&Compression=75&image=@paymentImage" alt="@paymentTitle" title="@paymentTitle" /> 7668 </div> 7669 } 7670 </div> 7671 </div> 7672 } 7673 7674 @helper RenderFooterCopyright() 7675 { 7676 <div class="grid__col-12 footer__copyright dw-mod"> 7677 7678 </div> 7679 7680 } 7681 7682 @helper RenderANPCIcons() 7683 { 7684 <div class="u-margin-top--lg u-margin-bottom--lg"> 7685 <a href="https://anpc.ro/ce-este-sal/" target="_blank"><img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=250&Compression=95&image=/Files/Images/pictograma1-ANPC.png" alt="ANPC" title="ANPC" /></a> 7686 7687 <a href="https://ec.europa.eu/consumers/odr" target="_blank"><img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=250&Compression=95&image=/Files/Images/pictograma2-ANPC.png" alt="Solutionarea online a litigiilor" title="Solutionarea online a litigiilor" /></a> 7688 </div> 7689 } 7690 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 7691 7692 @using System 7693 @using System.Web 7694 @using System.Collections.Generic 7695 @using Dynamicweb.Rapido.Blocks.Extensibility 7696 @using Dynamicweb.Rapido.Blocks 7697 @using Dynamicweb.Ecommerce.Common 7698 7699 @{ 7700 BlocksPage referencesBlocksPage = BlocksPage.GetBlockPage("Master"); 7701 7702 Block masterScriptReferences = new Block() 7703 { 7704 Id = "MasterScriptReferences", 7705 SortId = 1, 7706 Template = RenderMasterScriptReferences() 7707 }; 7708 referencesBlocksPage.Add(MasterBlockId.MasterReferences, masterScriptReferences); 7709 } 7710 7711 @helper RenderMasterScriptReferences() { 7712 <script src="/Files/Templates/Designs/AgricoverCorporate/dist/vendor.min.js?v=5"></script> 7713 <script src="/Files/Templates/Designs/AgricoverCorporate/js/custom.min.js?v=4"></script> 7714 <script src="/Files/Templates/Designs/AgricoverCorporate/js/master.js?v=5"></script> 7715 <script src="/Files/Templates/Designs/AgricoverCorporate/dist/app.bundle.js?v=146"></script> 7716 7717 PushPromise("/Files/Templates/Designs/AgricoverCorporate/dist/vendor.min.js?v=5"); 7718 PushPromise("/Files/Templates/Designs/AgricoverCorporate/js/custom.min.js?v=4"); 7719 PushPromise("/Files/Templates/Designs/AgricoverCorporate/js/master.js?v=5"); 7720 PushPromise("/Files/Templates/Designs/AgricoverCorporate/dist/app.bundle.js?v=146"); 7721 } 7722 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 7723 7724 @using System 7725 @using System.Web 7726 @using System.Collections.Generic 7727 @using Dynamicweb.Rapido.Blocks.Extensibility 7728 @using Dynamicweb.Rapido.Blocks 7729 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 7730 @using Dynamicweb.Rapido.Services 7731 7732 @{ 7733 BlocksPage searchBlocksPage = BlocksPage.GetBlockPage("Master"); 7734 bool navigationItemsHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 7735 bool isFavoriteList = !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("ListID")); 7736 7737 if (!navigationItemsHideSearch || isFavoriteList) 7738 { 7739 Block masterSearchScriptTemplates = new Block() 7740 { 7741 Id = "MasterSearchScriptTemplates", 7742 SortId = 1, 7743 Template = RenderSearchScriptTemplates() 7744 }; 7745 7746 searchBlocksPage.Add(MasterBlockId.MasterBottomSnippets, masterSearchScriptTemplates); 7747 } 7748 } 7749 7750 @helper RenderSearchScriptTemplates() 7751 { 7752 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 7753 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 7754 bool useFacebookPixel = !string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID")); 7755 bool useGoogleTagManager = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID")); 7756 bool showPrice = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HidePriceInSearchResults"); 7757 bool showAddToCartButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideAddToCartButton"); 7758 bool showViewButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideViewButton"); 7759 bool showAddToDownloadButton = Pageview.AreaSettings.GetItem("Layout").GetBoolean("ShowAddToDownloadButton"); 7760 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 7761 7762 <script id="SearchGroupsTemplate" type="text/x-template"> 7763 {{#.}} 7764 <li class="dropdown__item dw-mod" onclick="Search.UpdateGroupSelection(this)" data-group-id="{{id}}">{{name}}</li> 7765 {{/.}} 7766 </script> 7767 7768 <script id="SearchProductsTemplate" type="text/x-template"> 7769 {{#each .}} 7770 {{#Product}} 7771 {{#ifCond template "!==" "SearchMore"}} 7772 <li class="dropdown__item dropdown__item--seperator dw-mod"> 7773 @if (useFacebookPixel) 7774 { 7775 <text>{{{facebookPixelSearch name number priceDouble currency searchParameter}}}</text> 7776 } 7777 @if (useGoogleTagManager) 7778 { 7779 <text>{{{googleEnchantImpression googleImpression}}}</text> 7780 } 7781 <div> 7782 <a href="{{link}}" 7783 class="js-typeahead-link u-color-inherit u-pull--left" 7784 onclick="{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}" 7785 title="{{name}}{{#if variantName}}, {{variantName}}{{/if}}"> 7786 <div class="u-margin-right u-pull--left {{noimage}}"><img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=45&height=36&crop=5&FillCanvas=True&Compression=75&image={{image}}" alt="{{name}}{{#if variantName}}, {{variantName}}{{/if}}"></div> 7787 <div class="u-pull--left"> 7788 <div class="u-bold u-truncate-text js-typeahead-name">{{name}}{{#if variantName}}, {{variantName}}{{/if}}</div> 7789 @if (showPrice && Dynamicweb.Rapido.Services.User.IsPricesAllowed()) 7790 { 7791 if (pointShopOnly) 7792 { 7793 <text> 7794 {{#if havePointPrice}} 7795 <div> 7796 <span class="u-color--loyalty-points">{{points}}</span> @Translate("points") 7797 </div> 7798 {{else}} 7799 <small class="help-text u-no-margin">@Translate("Not available")</small> 7800 {{/if}} 7801 {{#unless canBePurchasedWithPoints}} 7802 {{#if havePointPrice}} 7803 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small> 7804 {{/if}} 7805 {{/unless}} 7806 </text> 7807 } 7808 else 7809 { 7810 <div>{{#ifCond priceDouble '>' 0}}{{price}}{{/ifCond}}</div> 7811 } 7812 } 7813 </div> 7814 </a> 7815 @*<div class="u-margin-left u-pull--right"> 7816 @{ 7817 var viewBtn = new Link 7818 { 7819 Href = "{{link}}", 7820 OnClick = "{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}", 7821 ButtonLayout = ButtonLayout.Secondary, 7822 CssClass = "btn--condensed u-no-margin u-w80px js-ignore-click-outside", 7823 Title = Translate("View") 7824 }; 7825 } 7826 @if (showAddToCartButton && Dynamicweb.Rapido.Services.User.IsBuyingAllowed()) 7827 { 7828 <text>{{#if hideAddToCartButton}}</text> 7829 @Render(viewBtn) 7830 <text>{{else}}</text> 7831 @Render(new AddToCartButton 7832 { 7833 HideTitle = true, 7834 ProductId = "{{productId}}", 7835 ProductInfo = "{{productInfo}}", 7836 BuyForPoints = pointShopOnly, 7837 OnClick = "{{facebookPixelAction}}", 7838 CssClass = "u-w80px u-no-margin js-ignore-click-outside", 7839 Icon = new Icon { 7840 CssClass = "js-ignore-click-outside" 7841 }, 7842 ExtraAttributes = new Dictionary<string, string> 7843 { 7844 { "{{disabledBuyButton}}", "" } 7845 } 7846 }) 7847 <text>{{/if}}</text> 7848 } 7849 else if (showViewButton) 7850 { 7851 @Render(viewBtn) 7852 } 7853 @if (showAddToDownloadButton) 7854 { 7855 <button type="button" class="btn btn--primary u-no-margin btn--condensed dw-mod js-add-to-downloads" title="@Translate("Add")" data-product-id="{{productId}}"> 7856 <i class="fas fa-plus js-button-icon"></i> 7857 </button> 7858 } 7859 </div>*@ 7860 </div> 7861 </li> 7862 {{/ifCond}} 7863 {{#ifCond template "===" "SearchMore"}} 7864 {{>SearchMoreProducts}} 7865 {{/ifCond}} 7866 {{/Product}} 7867 {{else}} 7868 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod"> 7869 @Translate("Your search gave 0 results") 7870 </li> 7871 {{/each}} 7872 </script> 7873 7874 <script id="SearchMoreProducts" type="text/x-template"> 7875 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 7876 <a href="/Default.aspx?ID=@productsPageId&Search={{searchParameter}}&GroupID={{groupId}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 7877 @Translate("View all") 7878 </a> 7879 </li> 7880 </script> 7881 7882 <script id="SearchMorePages" type="text/x-template"> 7883 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 7884 <a href="/Default.aspx?ID=@contentSearchPageLink&Search={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 7885 @Translate("View all") 7886 </a> 7887 </li> 7888 </script> 7889 7890 <script id="SearchPagesTemplate" type="text/x-template"> 7891 {{#each .}} 7892 {{#ifCond template "!==" "SearchMore"}} 7893 <li class="dropdown__item dropdown__item--seperator dropdown__item--no-padding dw-mod"> 7894 <a href="/Default.aspx?ID={{id}}" class="js-typeahead-link dropdown__link u-color-inherit u-flex"> 7895 {{#ifCond icon "!==" null}} 7896 <div class="u-margin-right u-flex grid--align-center"><i class="fa {{icon}} u-w20px u-ta-center"></i></div> 7897 {{/ifCond}} 7898 7899 {{#ifCond image "!==" null}} 7900 <div class="seach__image-wrapper dropdown" style='background:url("{{image}}");'></div> 7901 {{/ifCond}} 7902 7903 <div class="u-flex grid--align-center"><div class='u-bold u-truncate-text u-inline-block js-typeahead-name'>{{name}}</div></div> 7904 7905 </a> 7906 </li> 7907 {{/ifCond}} 7908 {{#ifCond template "===" "SearchMore"}} 7909 {{>SearchMorePages}} 7910 {{/ifCond}} 7911 {{else}} 7912 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod"> 7913 @Translate("Your search gave 0 results") 7914 </li> 7915 {{/each}} 7916 </script> 7917 7918 <script id="SearchPagesTemplateWrap" type="text/x-template"> 7919 <div class="dropdown__column-header">@Translate("Pages")</div> 7920 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod"> 7921 {{>SearchPagesTemplate}} 7922 </ul> 7923 </script> 7924 7925 <script id="SearchProductsTemplateWrap" type="text/x-template"> 7926 <div class="dropdown__column-header">@Translate("Products")</div> 7927 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod"> 7928 {{>SearchProductsTemplate}} 7929 </ul> 7930 </script> 7931 } 7932 7933 @using Dynamicweb.Rapido.Blocks.Components 7934 @using Dynamicweb.Rapido.Blocks.Components.General 7935 @using Dynamicweb.Rapido.Blocks 7936 @using System.IO 7937 7938 7939 @using Dynamicweb.Rapido.Blocks.Components.General 7940 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 7941 7942 7943 @* Component *@ 7944 7945 @helper RenderVariantMatrix(VariantMatrix settings) { 7946 if (settings != null) 7947 { 7948 int productLoopCounter = 0; 7949 int groupCount = 0; 7950 List<VariantOption> firstDimension = new List<VariantOption>(); 7951 List<VariantOption> secondDimension = new List<VariantOption>(); 7952 List<VariantOption> thirdDimension = new List<VariantOption>(); 7953 7954 foreach (VariantGroup variantGroup in settings.GetVariantGroups()) 7955 { 7956 foreach (VariantOption variantOptions in variantGroup.GetVariantOptions()) 7957 { 7958 if (groupCount == 0) { 7959 firstDimension.Add(variantOptions); 7960 } 7961 if (groupCount == 1) 7962 { 7963 secondDimension.Add(variantOptions); 7964 } 7965 if (groupCount == 2) 7966 { 7967 thirdDimension.Add(variantOptions); 7968 } 7969 } 7970 groupCount++; 7971 } 7972 7973 int rowCount = 0; 7974 int columnCount = 0; 7975 7976 <script> 7977 var variantsCollection = []; 7978 </script> 7979 7980 <table class="table table--compact js-variants-matrix dw-mod" id="VariantMatrixTable_@settings.ProductId"> 7981 @if (groupCount == 1) 7982 { 7983 <tbody> 7984 @foreach (VariantOption firstVariantOption in firstDimension) 7985 { 7986 var variantId = firstVariantOption.Id; 7987 <tr> 7988 <td class="u-bold"> 7989 @firstVariantOption.Name 7990 </td> 7991 <td> 7992 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount) 7993 </td> 7994 </tr> 7995 productLoopCounter++; 7996 } 7997 7998 <tr> 7999 <td>&nbsp;</td> 8000 <td> 8001 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div> 8002 </td> 8003 </tr> 8004 </tbody> 8005 } 8006 @if (groupCount == 2) 8007 { 8008 <thead> 8009 <tr> 8010 <td>&nbsp;</td> 8011 @foreach (VariantOption variant in secondDimension) 8012 { 8013 <td>@variant.Name</td> 8014 } 8015 </tr> 8016 </thead> 8017 <tbody> 8018 @foreach (VariantOption firstVariantOption in firstDimension) 8019 { 8020 string variantId = ""; 8021 columnCount = 0; 8022 8023 <tr> 8024 <td class="u-min-w120px">@firstVariantOption.Name</td> 8025 8026 @foreach (VariantOption secondVariantOption in secondDimension) 8027 { 8028 variantId = firstVariantOption.Id + "." + secondVariantOption.Id; 8029 <td> 8030 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount) 8031 </td> 8032 8033 columnCount++; 8034 8035 productLoopCounter++; 8036 } 8037 8038 <td> 8039 <div class="qty-field js-total-qty-row-@rowCount dw-mod">0</div> 8040 </td> 8041 </tr> 8042 8043 rowCount++; 8044 } 8045 8046 @{ 8047 columnCount = 0; 8048 } 8049 8050 <tr> 8051 <td>&nbsp;</td> 8052 @foreach (VariantOption secondVariantOption in secondDimension) 8053 { 8054 <td> 8055 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div> 8056 </td> 8057 8058 columnCount++; 8059 } 8060 <td>&nbsp;</td> 8061 </tr> 8062 </tbody> 8063 } 8064 @if (groupCount == 3) 8065 { 8066 <thead> 8067 <tr> 8068 <td>&nbsp;</td> 8069 @foreach (VariantOption thirdVariantOption in thirdDimension) 8070 { 8071 <td>@thirdVariantOption.Name</td> 8072 } 8073 </tr> 8074 </thead> 8075 <tbody> 8076 @foreach (VariantOption firstVariantOption in firstDimension) 8077 { 8078 int colspan = (thirdDimension.Count + 1); 8079 8080 <tr> 8081 <td colspan="@colspan" class="u-color-light-gray--bg u-bold">@firstVariantOption.Name</td> 8082 </tr> 8083 8084 foreach (VariantOption secondVariantOption in secondDimension) 8085 { 8086 string variantId = ""; 8087 columnCount = 0; 8088 8089 <tr> 8090 <td class="u-min-w120px">@secondVariantOption.Name</td> 8091 8092 @foreach (VariantOption thirdVariantOption in thirdDimension) 8093 { 8094 variantId = firstVariantOption.Id + "." + secondVariantOption.Id + "." + thirdVariantOption.Id; 8095 8096 <td> 8097 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount) 8098 </td> 8099 8100 columnCount++; 8101 productLoopCounter++; 8102 } 8103 8104 <td> 8105 <div class="qty-field js-total-qty-row-@rowCount dw-mod">0</div> 8106 </td> 8107 </tr> 8108 rowCount++; 8109 } 8110 } 8111 8112 @{ 8113 columnCount = 0; 8114 } 8115 8116 <tr> 8117 <td>&nbsp;</td> 8118 @foreach (VariantOption thirdVariantOption in thirdDimension) 8119 { 8120 <td> 8121 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div> 8122 </td> 8123 8124 columnCount++; 8125 } 8126 <td>&nbsp;</td> 8127 </tr> 8128 </tbody> 8129 } 8130 </table> 8131 8132 <script> 8133 document.addEventListener("DOMContentLoaded", function (event) { 8134 MatrixUpdateQuantity("@settings.ProductId"); 8135 }); 8136 8137 MatrixUpdateQuantity = function (productId) { 8138 var currentMatrix = document.getElementById("VariantMatrixTable_" + productId); 8139 var allQtyFields = currentMatrix.getElementsByClassName("js-qty"); 8140 8141 var qtyRowArr = []; 8142 var qtyColumnArr = []; 8143 8144 var totalQty = 0; 8145 8146 for (var i = 0; i < allQtyFields.length; i++) { 8147 qtyRowArr[allQtyFields[i].getAttribute("data-qty-row-group")] = 0; 8148 qtyColumnArr[allQtyFields[i].getAttribute("data-qty-column-group")] = 0; 8149 } 8150 8151 for (var i = 0; i < allQtyFields.length; i++) { 8152 qtyRowArr[allQtyFields[i].getAttribute("data-qty-row-group")] += parseFloat(allQtyFields[i].value); 8153 qtyColumnArr[allQtyFields[i].getAttribute("data-qty-column-group")] += parseFloat(allQtyFields[i].value); 8154 totalQty += parseFloat(allQtyFields[i].value); 8155 } 8156 8157 //Update row counters 8158 for (var i = 0; i < qtyRowArr.length; i++) { 8159 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-row-" + i)[0]; 8160 8161 if (qtyRowArr[i] != undefined && qtyCounter != null) { 8162 var currentCount = qtyCounter.innerHTML; 8163 qtyCounter.innerHTML = qtyRowArr[i]; 8164 8165 if (currentCount != qtyCounter.innerHTML) { 8166 qtyCounter.classList.add("qty-field--active"); 8167 } 8168 } 8169 8170 } 8171 8172 //Update column counters 8173 for (var i = 0; i < qtyColumnArr.length; i++) { 8174 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-column-" + i)[0]; 8175 8176 if (qtyColumnArr[i] != undefined && qtyCounter != null) { 8177 var currentCount = qtyCounter.innerHTML; 8178 qtyCounter.innerHTML = qtyColumnArr[i]; 8179 8180 if (currentCount != qtyCounter.innerHTML) { 8181 qtyCounter.classList.add("qty-field--active"); 8182 } 8183 } 8184 } 8185 8186 if (document.getElementById("TotalQtyCount_" + productId)) { 8187 document.getElementById("TotalQtyCount_" + productId).innerHTML = totalQty; 8188 } 8189 8190 //Clean up animations 8191 setTimeout(function () { 8192 for (var i = 0; i < qtyRowArr.length; i++) { 8193 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-row-" + i)[0]; 8194 if (qtyCounter != null) { 8195 qtyCounter.classList.remove("qty-field--active"); 8196 } 8197 } 8198 for (var i = 0; i < qtyColumnArr.length; i++) { 8199 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-column-" + i)[0]; 8200 if (qtyCounter != null) { 8201 qtyCounter.classList.remove("qty-field--active"); 8202 } 8203 } 8204 }, 1000); 8205 } 8206 </script> 8207 } 8208 } 8209 8210 @helper RenderVariantMatrixQuantityField(string variantId, VariantMatrix settings, int productLoopCounter, int rowCount, int columnCount) 8211 { 8212 string loopCount = productLoopCounter.ToString(); 8213 8214 bool combinationFound = false; 8215 double stock = 0; 8216 double quantityValue = 0; 8217 string note = ""; 8218 8219 VariantProduct variantProduct = null; 8220 8221 if (settings.GetVariantProducts().TryGetValue(variantId, out variantProduct)) 8222 { 8223 stock = variantProduct.Stock; 8224 quantityValue = variantProduct.Quantity; 8225 combinationFound = true; 8226 } 8227 8228 if (combinationFound) 8229 { 8230 <input type="hidden" name="ProductLoopCounter@(loopCount)" value="@loopCount" /> 8231 <input type="hidden" name="ProductID@(loopCount)" value="@settings.ProductId" /> 8232 <input type="hidden" name="VariantID@(loopCount)" value="@variantId" /> 8233 <input type="hidden" name="CurrentNote@(loopCount)" id="CurrentNote_@(settings.ProductId)_@variantId" value="@note" /> 8234 <input type="number" name="Quantity@(loopCount)" id="Quantity_@(settings.ProductId)_@variantId" value="@quantityValue" min="0" class="js-qty u-no-margin u-full-max-width" style="width: 100%; max-width: 100%" onkeyup="MatrixUpdateQuantity('@settings.ProductId')" onmouseup="MatrixUpdateQuantity('@settings.ProductId')" data-qty-row-group="@rowCount" data-qty-column-group="@columnCount"> 8235 8236 if (stock != 0) 8237 { 8238 <small>@Translate("Stock") @stock</small> 8239 } 8240 8241 <script> 8242 var variants = '{ "ProductId" :' + '"@settings.ProductId"' + ', "VariantId": ' + '"@variantId"' +'}'; 8243 variantsCollection.push(variants); 8244 document.getElementById("Quantity_@(settings.ProductId)_@variantId").closest(".js-variants-matrix").setAttribute("data-variants-collection", "[" + variantsCollection + "]" ); 8245 </script> 8246 } 8247 else 8248 { 8249 <div class="use-btn-height" style="background-color: #a8a8a8"></div> 8250 } 8251 } 8252 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 8253 8254 @* Component *@ 8255 8256 @helper RenderAddToCart(AddToCart settings) 8257 { 8258 //set Id for quantity selector to get it's value from button 8259 if (settings.QuantitySelector != null) 8260 { 8261 if (string.IsNullOrEmpty(settings.QuantitySelector.Id)) 8262 { 8263 settings.QuantitySelector.Id = Guid.NewGuid().ToString("N"); 8264 } 8265 8266 settings.AddButton.QuantitySelectorId = settings.QuantitySelector.Id; 8267 8268 if (settings.Disabled) 8269 { 8270 settings.QuantitySelector.Disabled = true; 8271 } 8272 8273 if (string.IsNullOrEmpty(settings.QuantitySelector.Name)) 8274 { 8275 settings.QuantitySelector.Name = settings.QuantitySelector.Id; 8276 } 8277 } 8278 8279 if (settings.Disabled) 8280 { 8281 settings.AddButton.Disabled = true; 8282 } 8283 8284 settings.AddButton.CssClass += " btn--condensed"; 8285 8286 //unitsSelector 8287 if (settings.UnitSelector != null) 8288 { 8289 if (settings.Disabled) 8290 { 8291 settings.QuantitySelector.Disabled = true; 8292 } 8293 } 8294 8295 <div class="buttons-collection @settings.WrapperCssClass" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 8296 @if (settings.UnitSelector != null) 8297 { 8298 @Render(settings.UnitSelector) 8299 } 8300 @if (settings.QuantitySelector != null) 8301 { 8302 @Render(settings.QuantitySelector) 8303 } 8304 @Render(settings.AddButton) 8305 </div> 8306 } 8307 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 8308 8309 @* Component *@ 8310 8311 @helper RenderAddToCartButton(AddToCartButton settings) 8312 { 8313 if (!settings.HideTitle) 8314 { 8315 if (string.IsNullOrEmpty(settings.Title)) 8316 { 8317 if (settings.BuyForPoints) 8318 { 8319 settings.Title = Translate("Buy with points"); 8320 } 8321 else 8322 { 8323 settings.Title = Translate("Add to cart"); 8324 } 8325 } 8326 } 8327 else 8328 { 8329 settings.Title = ""; 8330 } 8331 8332 if (settings.Icon == null) 8333 { 8334 settings.Icon = new Icon(); 8335 settings.Icon.LabelPosition = Dynamicweb.Rapido.Blocks.Components.General.IconLabelPosition.After; 8336 } 8337 8338 if (string.IsNullOrEmpty(settings.Icon.Name)) 8339 { 8340 settings.Icon.Name = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue; 8341 } 8342 8343 settings.OnClick = "Cart.AddToCart(event, { " + 8344 "id: '" + settings.ProductId + "'," + 8345 (!string.IsNullOrEmpty(settings.VariantId) ? "variantId: '" + settings.VariantId + "'," : "") + 8346 (!string.IsNullOrEmpty(settings.UnitId) ? "unitId: '" + settings.UnitId + "'," : "") + 8347 (settings.BuyForPoints ? "buyForPoints: true," : "") + 8348 (!string.IsNullOrEmpty(settings.ProductInfo) ? "productInfo: " + settings.ProductInfo + "," : "") + 8349 "quantity: " + (string.IsNullOrEmpty(settings.QuantitySelectorId) ? "1" : "parseFloat(document.getElementById('" + settings.QuantitySelectorId + "').value)") + 8350 "});" + settings.OnClick; 8351 8352 @RenderButton(settings) 8353 } 8354 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 8355 8356 @* Component *@ 8357 8358 @helper RenderUnitSelector(UnitSelector settings) 8359 { 8360 if (string.IsNullOrEmpty(settings.Id)) 8361 { 8362 settings.Id = Guid.NewGuid().ToString("N"); 8363 } 8364 var disabledClass = settings.Disabled ? "disabled" : ""; 8365 8366 <input type="checkbox" id="@settings.Id" class="dropdown-trigger" /> 8367 <div class="dropdown unit-selector @settings.CssClass @disabledClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 8368 <label class="dropdown__header dropdown__btn dropdown__btn--unit-selector dw-mod" for="@settings.Id">@settings.SelectedOption</label> 8369 <div class="dropdown__content dw-mod"> 8370 @settings.OptionsContent 8371 </div> 8372 <label class="dropdown-trigger-off" for="@settings.Id"></label> 8373 </div> 8374 } 8375 @using System.Reflection 8376 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 8377 8378 @* Component *@ 8379 8380 @helper RenderQuantitySelector(QuantitySelector settings) 8381 { 8382 var attributes = new Dictionary<string, string>(); 8383 8384 /*base settings*/ 8385 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 8386 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 8387 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 8388 if (settings.Disabled) { attributes.Add("disabled", "true"); } 8389 if (settings.Required) { attributes.Add("required", "true"); } 8390 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 8391 /*end*/ 8392 8393 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 8394 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 8395 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 8396 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 8397 if (settings.Max != null) { attributes.Add("max", settings.Max.ToString()); } 8398 if (settings.Min == null) { settings.Min = 1; } 8399 attributes.Add("min", settings.Min.ToString()); 8400 if (settings.Step != null && !string.IsNullOrEmpty(settings.Step.ToString())) { attributes.Add("step", settings.Step.ToString()); } 8401 if (settings.Value == null) { settings.Value = 1; } 8402 attributes.Add("value", settings.Value.ToString()); 8403 attributes.Add("type", "number"); 8404 8405 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 8406 8407 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 8408 } 8409 @using Dynamicweb.Rapido.Blocks.Components 8410 8411 @using Dynamicweb.Frontend 8412 @using Dynamicweb.Frontend.Devices 8413 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 8414 @using Dynamicweb.Rapido.Blocks.Components.General 8415 @using System.Collections.Generic; 8416 8417 @* Component *@ 8418 8419 @helper RenderCustomerCenterList(CustomerCenterList settings) 8420 { 8421 bool isTouchDevice = Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet" ? true : false; 8422 string hideActions = isTouchDevice ? "u-block" : ""; 8423 8424 <table class="table data-list dw-mod"> 8425 @if (settings.GetHeaders().Length > 0) { 8426 <thead> 8427 <tr class="u-bold"> 8428 @foreach (CustomerCenterListHeaderItem header in settings.GetHeaders()) 8429 { 8430 var attributes = new Dictionary<string, string>(); 8431 if (!string.IsNullOrEmpty(header.Id)) { attributes.Add("id", header.Id); } 8432 if (!string.IsNullOrEmpty(header.CssClass)) { attributes.Add("class", header.CssClass); } 8433 attributes.Add("align", header.Align.ToString()); 8434 attributes = attributes.Concat(header.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 8435 8436 <td @ComponentMethods.AddAttributes(attributes)>@header.Title</td> 8437 } 8438 </tr> 8439 </thead> 8440 } 8441 @foreach (CustomerCenterListItem listItem in settings.GetItems()) 8442 { 8443 int columnCount = 0; 8444 int totalColumns = listItem.GetInfoItems().Length; 8445 string rowHasActions = listItem.GetActions().Length > 0 ? "data-list__item--has-actions" : ""; 8446 listItem.Id = !string.IsNullOrEmpty(listItem.Id) ? listItem.Id : Guid.NewGuid().ToString("N"); 8447 8448 var attributes = new Dictionary<string, string>(); 8449 if (!string.IsNullOrEmpty(listItem.Title)) { attributes.Add("title", listItem.Title); }; 8450 8451 attributes = attributes.Concat(listItem.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 8452 <tbody class="data-list__item @rowHasActions @listItem.CssClass dw-mod" @ComponentMethods.AddAttributes(attributes)> 8453 <tr> 8454 @if (!string.IsNullOrEmpty(listItem.Title) || !string.IsNullOrEmpty(listItem.Description)) { 8455 string onClick = !string.IsNullOrEmpty(listItem.OnClick) ? "onclick=\"" + listItem.OnClick + "\"" : ""; 8456 8457 <td rowspan="2" @onClick class="data-list__main-item dw-mod"> 8458 @if (!string.IsNullOrEmpty(listItem.Title)) { 8459 <div class="u-bold">@listItem.Title</div> 8460 } 8461 @if (!string.IsNullOrEmpty(listItem.Description)) { 8462 <div>@listItem.Description</div> 8463 } 8464 </td> 8465 } 8466 8467 @foreach (CustomerCenterListInfoItem infoItem in listItem.GetInfoItems()) 8468 { 8469 var infoAttributes = new Dictionary<string, string>(); 8470 if (!string.IsNullOrEmpty(infoItem.Id)) { infoAttributes.Add("id", infoItem.Id); }; 8471 if (!string.IsNullOrEmpty(infoItem.OnClick)) { infoAttributes.Add("onclick", infoItem.OnClick); }; 8472 infoAttributes.Add("align", infoItem.Align.ToString()); 8473 8474 infoAttributes = infoAttributes.Concat(infoItem.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 8475 string columnClick = columnCount < (totalColumns-1) && !string.IsNullOrEmpty(listItem.OnClick) ? "onclick=\"" + listItem.OnClick + "\"" : ""; 8476 8477 <td @ComponentMethods.AddAttributes(infoAttributes) @columnClick class="data-list__info-item dw-mod"> 8478 @if (!string.IsNullOrEmpty(infoItem.Title)) { 8479 <div>@infoItem.Title</div> 8480 } 8481 @if (!string.IsNullOrEmpty(infoItem.Subtitle)) { 8482 <div><small>@infoItem.Subtitle</small></div> 8483 } 8484 </td> 8485 8486 columnCount++; 8487 } 8488 </tr> 8489 <tr> 8490 <td colspan="@columnCount" align="right" class="u-va-bottom u-no-border"> 8491 <div class="data-list__actions @hideActions dw-mod" id="ActionsMenu_@listItem.Id"> 8492 @foreach (ButtonBase action in listItem.GetActions()) 8493 { 8494 action.ButtonLayout = ButtonLayout.LinkClean; 8495 action.Icon.CssClass += " u-full-height"; 8496 action.CssClass += " data-list__action-button link"; 8497 8498 @Render(action) 8499 } 8500 </div> 8501 </td> 8502 </tr> 8503 </tbody> 8504 } 8505 </table> 8506 } 8507 @using System.Reflection 8508 @using Dynamicweb.Rapido.Blocks.Components 8509 @using Dynamicweb.Rapido.Blocks.Components.Articles 8510 @using Dynamicweb.Rapido.Blocks 8511 8512 8513 @functions{ 8514 8515 public class DF_ItemListField : ComponentBase 8516 { 8517 public int[] itemList {get; set;} 8518 public string itemListDisplay {get; set;} 8519 public string itemLabel {get; set;} 8520 } 8521 8522 } 8523 8524 @helper RenderDF_ItemListField(DF_ItemListField settings) 8525 { 8526 if(settings.itemList != null) 8527 { 8528 int[] itemList = settings.itemList; 8529 string itemLabel = settings.itemLabel; 8530 string itemListDisplay = settings.itemListDisplay != null ? settings.itemListDisplay: "linkList"; 8531 var pageService = Dynamicweb.Extensibility.ServiceLocator.Current.GetInstance<Dynamicweb.Content.IPageService>(); 8532 var pages = pageService.GetPages(itemList); 8533 8534 if(pages.Any()) 8535 { 8536 <div class="grid__col-md-4 grid__col-sm-12 u-margin-bottom"> 8537 <div class="u-bold">@itemLabel</div> 8538 <ul> 8539 @foreach(var page in pages) 8540 { 8541 if(page != null) 8542 { 8543 <li><a href="/Default.aspx?ID=@page.ID">@page.MenuText</a></li> 8544 } 8545 } 8546 </ul> 8547 </div> 8548 8549 } 8550 } 8551 } 8552 8553 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 8554 8555 @using System 8556 @using System.Web 8557 @using System.Collections.Generic 8558 @using Dynamicweb.Rapido.Blocks.Extensibility 8559 @using Dynamicweb.Rapido.Blocks 8560 8561 @{ 8562 BlocksPage bottomSnippetsBlocksPage = BlocksPage.GetBlockPage("Master"); 8563 8564 Block primaryBottomSnippets = new Block() 8565 { 8566 Id = "MasterJavascriptInitializers", 8567 SortId = 100, 8568 Template = RenderPrimaryBottomSnippets() 8569 }; 8570 bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, primaryBottomSnippets); 8571 8572 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed()) 8573 { 8574 Block miniCartPageId = new Block 8575 { 8576 Id = "MiniCartPageId", 8577 Template = RenderMiniCartPageId() 8578 }; 8579 bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, miniCartPageId); 8580 } 8581 } 8582 8583 @helper RenderPrimaryBottomSnippets() 8584 { 8585 bool isWireframeMode = Model.Area.Item.GetItem("Settings").GetBoolean("WireframeMode"); 8586 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 8587 8588 //if (isWireframeMode) 8589 //{ 8590 //<script> 8591 //Wireframe.Init(true); 8592 //</script> 8593 //} 8594 8595 8596 if (useGoogleTagManager) 8597 { 8598 <script> 8599 document.addEventListener('addToCart', function(event) { 8600 var googleImpression = JSON.parse(event.detail.productInfo.googleImpression); 8601 if (typeof googleImpression == "string") { 8602 googleImpression = JSON.parse(event.detail.productInfo.googleImpression); 8603 } 8604 dataLayer.push({ 8605 'event': 'addToCart', 8606 'ecommerce': { 8607 'currencyCode': googleImpression.currency, 8608 'add': { 8609 'products': [{ 8610 'name': googleImpression.name, 8611 'id': googleImpression.id, 8612 'price': googleImpression.price, 8613 'brand': googleImpression.brand, 8614 'category': googleImpression.category, 8615 'variant': googleImpression.variant, 8616 'quantity': event.detail.quantity 8617 }] 8618 } 8619 } 8620 }); 8621 }); 8622 </script> 8623 } 8624 8625 //if digitalwarehouse 8626 if (Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart")) 8627 { 8628 string cartContextId = Converter.ToString(HttpContext.Current.Application["DownloadCartContext"]); 8629 8630 if (string.IsNullOrEmpty(cartContextId)) 8631 { 8632 var moduleProps = Dynamicweb.Modules.Properties.GetParagraphModuleSettings(GetPageIdByNavigationTag("DownloadCart"), "eCom_CartV2"); 8633 var cartSettings = new Dynamicweb.Ecommerce.Cart.ModuleSettings(moduleProps); 8634 cartContextId = cartSettings.OrderContextID; 8635 HttpContext.Current.Application["DownloadCartContext"] = cartContextId; 8636 } 8637 8638 <script> 8639 let downloadCart = new DownloadCart({ 8640 cartPageId: @GetPageIdByNavigationTag("MiniCartFeed"), 8641 contextId: "@cartContextId", 8642 addButtonText: "@Translate("Add")", 8643 removeButtonText: "@Translate("Remove")" 8644 }); 8645 </script> 8646 } 8647 8648 <!--$$Javascripts--> 8649 } 8650 8651 @helper RenderMiniCartPageId() 8652 { 8653 8654 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 8655 <script> 8656 window.cartId = "@miniCartFeedPageId"; 8657 </script> 8658 8659 } 8660 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 8661 8662 @using System 8663 @using System.Web 8664 @using System.Collections.Generic 8665 @using Dynamicweb.Rapido.Blocks 8666 8667 @{ 8668 BlocksPage masterCustomBlocksPage = BlocksPage.GetBlockPage("Master"); 8669 8670 } 8671 8672 @* Include Replacement blocks *@ 8673 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 8674 8675 @using System 8676 @using System.Web 8677 @using System.Collections.Generic 8678 @using Dynamicweb.Rapido.Blocks 8679 @using Dynamicweb.Rapido.Blocks.Extensibility 8680 8681 @{ 8682 8683 8684 BlocksPage masterBlocksBlocksPage = BlocksPage.GetBlockPage("Master"); 8685 8686 8687 //string footerColumnOneContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Content"); 8688 //string footerColumnTwoContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Content"); 8689 //string footerColumnThreeContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Content"); 8690 //string footerColumnOneHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Header"); 8691 //string footerColumnTwoHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Header"); 8692 //string footerColumnThreeHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Header"); 8693 IList<ItemViewModel> footerColumnOneLinks = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetItems("Pages"); 8694 IList<ItemViewModel> footerColumnTwoLinks = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetItems("Pages"); 8695 IList<ItemViewModel> footerColumnThreeLinks = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetItems("Pages"); 8696 IList<ItemViewModel> footerColumnFourLinks = new List<ItemViewModel>(); 8697 if(Model.Area.Item.GetItem("Layout").GetItem("FooterColumnFour") != null) { 8698 footerColumnFourLinks = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnFour").GetItems("Pages"); 8699 } 8700 8701 8702 bool footerColumnOneHasLinks = footerColumnOneLinks != null && footerColumnOneLinks.Count > 0 ? true : false; 8703 bool footerColumnTwoHasLinks = footerColumnTwoLinks != null && footerColumnTwoLinks.Count > 0 ? true : false; 8704 bool footerColumnThreeHasLinks = footerColumnThreeLinks != null && footerColumnThreeLinks.Count > 0 ? true : false; 8705 bool footerColumnFourHasLinks = footerColumnFourLinks != null && footerColumnFourLinks.Count > 0 ? true : false; 8706 8707 8708 if (!string.IsNullOrEmpty(footerColumnOneContent) || !string.IsNullOrEmpty(footerColumnOneHeader) || footerColumnOneHasLinks) 8709 { 8710 8711 Block masterFooterColumnOne = new Block 8712 { 8713 Id = "MasterFooterColumnOne", 8714 SortId = 10, 8715 Template = RenderFooterColumnCustom(footerColumnOneHeader, footerColumnOneContent, footerColumnOneLinks), 8716 Design = new Design { 8717 Size = "auto", 8718 RenderType = RenderType.Column, 8719 CssClass = "footer__column-wrapper" 8720 } 8721 }; 8722 masterBlocksBlocksPage.ReplaceBlock(masterFooterColumnOne); 8723 } 8724 8725 if (!string.IsNullOrEmpty(footerColumnTwoContent) || !string.IsNullOrEmpty(footerColumnTwoHeader) ) 8726 { 8727 Block masterFooterColumnTwo = new Block 8728 { 8729 Id = "MasterFooterColumnTwo", 8730 SortId = 20, 8731 Template = RenderFooterColumnCustom(footerColumnTwoHeader, footerColumnTwoContent, footerColumnTwoLinks), 8732 Design = new Design 8733 { 8734 Size = "auto", 8735 RenderType = RenderType.Column, 8736 CssClass = "footer__column-wrapper" 8737 } 8738 }; 8739 masterBlocksBlocksPage.ReplaceBlock(masterFooterColumnTwo); 8740 } 8741 8742 if (!string.IsNullOrEmpty(footerColumnThreeContent) || !string.IsNullOrEmpty(footerColumnThreeHeader)) 8743 { 8744 Block masterFooterColumnThree = new Block 8745 { 8746 Id = "MasterFooterColumnThree", 8747 SortId = 30, 8748 Template = RenderFooterColumnCustom(footerColumnThreeHeader, footerColumnThreeContent, footerColumnThreeLinks), 8749 Design = new Design 8750 { 8751 Size = "auto", 8752 RenderType = RenderType.Column, 8753 CssClass = "footer__column-wrapper" 8754 } 8755 }; 8756 masterBlocksBlocksPage.ReplaceBlock(masterFooterColumnThree); 8757 } 8758 8759 if (!string.IsNullOrEmpty(footerColumnFourContent) || !string.IsNullOrEmpty(footerColumnFourHeader)) 8760 { 8761 Block masterFooterColumnFour = new Block 8762 { 8763 Id = "MasterFooterColumnFour", 8764 SortId = 40, 8765 Template = RenderFooterColumnCustom(footerColumnFourHeader, footerColumnFourContent, footerColumnFourLinks), 8766 Design = new Design 8767 { 8768 Size = "auto", 8769 RenderType = RenderType.Column, 8770 CssClass = "footer__column-wrapper" 8771 } 8772 }; 8773 masterBlocksBlocksPage.ReplaceBlock(masterFooterColumnFour); 8774 } 8775 8776 if (Model.Area.Item.GetItem("Layout").GetBoolean("FooterNewsletterSignUp")) 8777 { 8778 Block masterFooterNewsletterSignUp = new Block 8779 { 8780 Id = "MasterFooterNewsletterSignUp", 8781 SortId = 2, 8782 Template = RenderFooterNewsletterSignUpCustom(), 8783 Design = new Design 8784 { 8785 Size = "auto", 8786 RenderType = RenderType.Column, 8787 CssClass = "footer__column-wrapper" 8788 } 8789 }; 8790 // masterBlocksBlocksPage.ReplaceBlock(masterFooterNewsletterSignUp); 8791 } 8792 8793 if (Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks").Count > 0) 8794 { 8795 Block masterFooterSocialLinks = new Block 8796 { 8797 Id = "MasterFooterSocialLinks", 8798 SortId = 1, 8799 Template = RenderFooterSocialLinksCustom(), 8800 Design = new Design 8801 { 8802 Size = "auto", 8803 RenderType = RenderType.Column, 8804 CssClass = "footer__column-wrapper" 8805 } 8806 }; 8807 //masterBlocksBlocksPage.ReplaceBlock(masterFooterSocialLinks); 8808 } 8809 8810 // edit payments 8811 //if (Model.Area.Item.GetItem("Layout").GetItems("FooterPayments") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterPayments").Count > 0) 8812 //{ 8813 //Block masterFooterPaymentsCustom = new Block 8814 //{ 8815 //Id = "MasterFooterPayments", 8816 //SortId = 60, 8817 //Design = new Design 8818 //{ 8819 //Size = "12", 8820 //RenderType = RenderType.Column 8821 //} 8822 //}; 8823 //masterBlocksBlocksPage.ReplaceBlock(masterFooterPaymentsCustom); 8824 //} 8825 8826 8827 Block masterFooterCopyrightCustom = new Block 8828 { 8829 Id = "MasterFooterCopyright", 8830 SortId = 70, 8831 Template = RenderFooterCopyrightCustom(), 8832 Design = new Design 8833 { 8834 Size = "12", 8835 RenderType = RenderType.Column 8836 } 8837 }; 8838 masterBlocksBlocksPage.ReplaceBlock(masterFooterCopyrightCustom); 8839 } 8840 8841 @helper RenderFooterColumnCustom(string header, string content, IList<ItemViewModel> links) { 8842 <h3 class="footer__heading dw-mod">@header<i class="icon--accordion fas fa-chevron-down"></i></h3> 8843 <div class="footer__content dw-mod"> 8844 @if(links.Any()){ 8845 <ul class="footer-links u-margin-bottom dw-mod"> 8846 @foreach(var pageLink in links){ 8847 string link = pageLink.GetString("Link"); 8848 string title = pageLink.GetString("Title"); 8849 string icon = pageLink.GetString("Icon"); 8850 string newWindow = pageLink.GetBoolean("NewWindow") ? " target=\"_blank\"" : ""; 8851 <li class="footer-links__item dw-mod"> 8852 <a href="@link" @newWindow class="footer-links__link dw-mod">@icon @title</a> 8853 </li> 8854 } 8855 </ul> 8856 }else{ 8857 @content 8858 } 8859 </div> 8860 } 8861 @helper RenderFooterNewsletterSignUpCustom() { 8862 string newsletterSignUpPageId = GetPageIdByNavigationTag("NewsletterSignUp").ToString(); 8863 8864 <h3 class="footer__heading dw-mod">@Translate("Mailing list")</h3> 8865 <div class="footer__content dw-mod"> 8866 <form class="form dw-mod" name="NewsletterRedirect" action='/Default.aspx' method="get" enctype="multipart/form-data"> 8867 <input name="ID" value="@newsletterSignUpPageId" type="hidden" /> 8868 <label for="NewsletterEmail" class="u-margin-bottom">@Translate("Sign up if you would like to receive occasional treats from us", "Sign up if you would like to receive occasional treats from us")</label> 8869 <div class="form__field-combi"> 8870 <input name="NewsletterEmail" id="NewsletterEmail" type="text" placeholder='@Translate("Your email address", "Your email address")' class="u-full-width use-btn-primary-height" /> 8871 <input class="btn btn--primary btn--condensed dw-mod" type="submit" id="Submitter" value='@Translate("Go", "Go")' /> 8872 </div> 8873 </form> 8874 </div> 8875 8876 8877 } 8878 8879 @helper RenderFooterSocialLinksCustom() { 8880 string logoFooter = Model.Area.Item.GetItem("Custom").GetFile("WhiteLogoImage") != null ? Model.Area.Item.GetItem("Custom").GetFile("WhiteLogoImage").PathUrlEncoded : "/Files/Images/logo-dynamicweb.png"; 8881 8882 if (Path.GetExtension(logoFooter).ToLower() != ".svg") 8883 { 8884 int logoHeight = Model.Area.Item.GetItem("Layout").GetInt32("LogoHeight"); 8885 logoHeight = logoHeight > 0 && Pageview.Device.ToString() != "Mobile" ? logoHeight : 40; 8886 logoFooter = "/Admin/Public/GetImage.ashx?height=" + Converter.ToString(logoHeight) + "&amp;crop=5&amp;Compression=75&amp;image=" + logoFooter; 8887 } 8888 else 8889 { 8890 logoFooter = HttpUtility.UrlDecode(logoFooter); 8891 } 8892 8893 <div class="footer_logo__wrapper"> 8894 <img src="@logoFooter" alt='@Translate("Logo")' /> 8895 </div> 8896 <div class="footer__content dw-mod"> 8897 <div class="collection dw-mod"> 8898 @foreach (var socialitem in Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks")) 8899 { 8900 var socialIcon = socialitem.GetValue("Icon") as Dynamicweb.Frontend.ListViewModel; 8901 string socialIconClass = socialIcon.SelectedValue; 8902 string socialIconTitle = socialIcon.SelectedName; 8903 string socialLink = socialitem.GetString("Link"); 8904 8905 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px" rel="noopener"><i class="@socialIconClass fa-2x"></i></a> 8906 } 8907 </div> 8908 </div> 8909 } 8910 8911 @helper RenderFooterCopyrightCustom() { 8912 <div class="grid__col-12 footer__copyright dw-mod"> 8913 <p class="u--heading-sans u-ta-center">@Model.Area.Item.GetItem("Layout").GetString("FooterCopyrightText")</p> 8914 </div> 8915 } 8916 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 8917 8918 @using System 8919 @using System.Web 8920 @using System.Collections.Generic 8921 @using Dynamicweb.Rapido.Blocks 8922 @using Dynamicweb.Rapido.Blocks.Extensibility 8923 @using Dynamicweb.Security.UserManagement 8924 @using Dynamicweb.Security.UserManagement.ExternalAuthentication 8925 @{ 8926 Block loginModalCustom = new Block() 8927 { 8928 Id = "LoginModal", 8929 SortId = 10, 8930 Template = LoginModalCustom() 8931 }; 8932 8933 loginBlocksPage.RemoveBlock(loginModalCustom); 8934 } 8935 8936 @helper LoginModalCustom() { 8937 int pageId = Model.TopPage.ID; 8938 string userSignedInError = !Model.LogOnFailed ? "" : "checked"; 8939 string userSignedInErrorText = ""; 8940 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 8941 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; 8942 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 8943 bool isCartPage = GetPageIdByNavigationTag("CartPage") == pageId ? true : false; 8944 string redirectToDashboard = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl("Default.aspx?ID=" + GetPageIdByNavigationTag("CustomerDashboard")); 8945 string redirectDecision = !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("ProductID")) || !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("GroupID")) || isCartPage ? "" : redirectToDashboard; 8946 8947 if (Model.LogOnFailed) { 8948 switch (Model.LogOnFailedReason) 8949 { 8950 case LogOnFailedReason.PasswordLengthInvalid: 8951 userSignedInErrorText = Translate("Password length is invalid"); 8952 break; 8953 case LogOnFailedReason.IncorrectLogin: 8954 userSignedInErrorText = Translate("Invalid email or password"); 8955 break; 8956 case LogOnFailedReason.ExceededFailedLogOnLimit: 8957 userSignedInErrorText = Translate("You have exceeded the limit of allowed login attempts. The user account is temporarily locked"); 8958 break; 8959 case LogOnFailedReason.LoginLocked: 8960 userSignedInErrorText = Translate("The user account is temporarily locked"); 8961 break; 8962 case LogOnFailedReason.PasswordExpired: 8963 userSignedInErrorText = Translate("The password has expired and needs to be renewed"); 8964 break; 8965 default: 8966 userSignedInErrorText = Translate("An unknown error occured"); 8967 break; 8968 } 8969 } 8970 8971 <!-- Trigger for the login modal --> 8972 <input type="checkbox" id="SignInModalTrigger" class="modal-trigger" @userSignedInError /> 8973 8974 <!-- Login modal --> 8975 <div class="modal-container"> 8976 <label for="SignInModalTrigger" id="SignInModalOverlay" class="modal-overlay"></label> 8977 <div class="modal modal--md" id="SignInModal"> 8978 <div class="modal__header no-border"> 8979 <button type="button" class="close btn btn--primary dw-mod u-margin-top--lg"><i class="fas fa-times"></i></button> 8980 <h2 class="u-ta-center">@Translate("Sign in")</h2> 8981 </div> 8982 <div class="modal__body"> 8983 <form method="post" id="LoginForm" class="u-no-margin"> 8984 <input type="hidden" name="ID" value="@pageId" /> 8985 <input type="hidden" name="DWExtranetUsernameRemember" value="True" /> 8986 <input type="hidden" name="DWExtranetPasswordRemember" value="True" /> 8987 @if(redirectDecision!=""){ 8988 <input type="hidden" name="redirect" value="@redirectDecision"> 8989 } 8990 @* <label for="username">@Translate("Email")</label> *@ 8991 <input type="text" class="u-full-width" id="LoginUsername" name="username" placeholder="@Translate("Email")" /> 8992 8993 @* <label for="password">@Translate("Password")</label> *@ 8994 <input type="password" class="u-full-width" id="LoginPassword" name="password" placeholder="@Translate("Password")" /> 8995 <div class="field-error dw-mod">@userSignedInErrorText</div> 8996 8997 <div class="form__field-group dw-mod"> 8998 <input type="checkbox" id="LoginRememberMe" name="Autologin" checked="checked" value="True" class="form__control"> 8999 <label for="LoginRememberMe"> 9000 @Translate("Remember me", "Remember me") 9001 </label> 9002 </div> 9003 9004 <a class="btn btn--link-clean dw-mod" href="@forgotPasswordPageLink">@Translate("Forgot your password?")</a> 9005 9006 <button type="submit" class="btn btn--primary btn--full dw-mod u-margin-top--lg" name="LoginAction" value="Login" onclick="Buttons.LockButton(event)">@Translate("Sign in")</button> 9007 @{ 9008 ProviderCollection providers = Provider.GetActiveProviders(); 9009 } 9010 9011 @foreach(Provider LoginProvider in providers) 9012 { 9013 var ProviderName = LoginProvider.Name.ToLower(); 9014 <a href="/Admin/Public/Social/ExternalLogin.aspx?action=login&providerID=@LoginProvider.ID" title="@LoginProvider.Name" class="btn btn--clean btn--condensed u-color-@ProviderName dw-mod"><i class="fab fa-@ProviderName fa-1_5x"></i></a> 9015 } 9016 9017 9018 <div class="dw-mod u-margin-top--lg"> 9019 <div class="u-ta-center u-margin-bottom--lg"> 9020 <h5 class="u-no-margin">@Translate("No Idera account?")</h5> 9021 <p class="u-no-margin" style="font-size: 13px;">@Translate("Follow the steps and become a member today")</p> 9022 </div> 9023 <a class="btn btn--primary btn--full dw-mod" href="/default.aspx?ID=@createAccountPageId">@Translate("Create account")</a> 9024 </div> 9025 </form> 9026 </div> 9027 </div> 9028 </div> 9029 } 9030 9031 @* Include New blocks *@ 9032 @*Include("NewBlocks/Promotion.cshtml")*@ 9033 @using Dynamicweb.Content 9034 9035 9036 @{ 9037 //BlocksPage masterBlocksBlocksPage = BlocksPage.GetBlockPage("Master"); 9038 9039 Block megaMenu = new Block 9040 { 9041 Id = "MegaMenu", 9042 SortId = 100, 9043 Template = RenderMegaMenu() 9044 }; 9045 masterBlocksBlocksPage.Add(MasterBlockId.MasterFooter, megaMenu); 9046 } 9047 9048 @helper RenderMegaMenu(){ 9049 int megaMenuPage = GetPageIdByNavigationTag("MenuConfiguration"); 9050 if(megaMenuPage > 0){ 9051 <div class="hidden"> 9052 @RenderPageContent(@megaMenuPage) 9053 </div> 9054 } 9055 } 9056 9057 @*Include("NewBlocks/FooterPayments.cshtml")*@ 9058 9059 @functions { 9060 public class ManifestIcon 9061 { 9062 public string src { get; set; } 9063 public string type { get; set; } 9064 public string sizes { get; set; } 9065 } 9066 9067 public class Manifest 9068 { 9069 public string name { get; set; } 9070 public string short_name { get; set; } 9071 public string start_url { get; set; } 9072 public string display { get; set; } 9073 public string background_color { get; set; } 9074 public string theme_color { get; set; } 9075 public List<ManifestIcon> icons { get; set; } 9076 } 9077 } 9078 9079 <!DOCTYPE html> 9080 9081 <html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName"> 9082 9083 9084 9085 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 9086 @RenderBlockList(masterPage.BlocksRoot.BlocksList) 9087 9088 9089 9090 @helper RenderMasterHead() { 9091 List<Block> subBlocks = this.masterPage.GetBlockListById("Head").OrderBy(item => item.SortId).ToList(); 9092 9093 <head> 9094 <!-- AgricoverCorporate version 3.4.2 --> 9095 9096 @RenderBlockList(subBlocks) 9097 </head> 9098 } 9099 9100 @helper RenderMasterMetadata() { 9101 var swatches = new Dynamicweb.Content.Items.ColorSwatchService(); 9102 var brandColors = swatches.GetColorSwatch(1); 9103 string brandColorOne = brandColors.Palette["BrandColor1"]; 9104 9105 if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName")) && Model.Area.Item.GetItem("Settings").GetFile("AppIcon") != null) { 9106 Manifest manifest = new Manifest 9107 { 9108 name = Model.Area.Item.GetItem("Settings").GetString("AppName"), 9109 short_name = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppShortName")) ? Model.Area.Item.GetItem("Settings").GetString("AppShortName") : Model.Area.Item.GetItem("Settings").GetString("AppName"), 9110 start_url = "/", 9111 display = "standalone", 9112 background_color = Model.Area.Item.GetItem("Settings").GetString("AppBackgroundColor"), 9113 theme_color = Model.Area.Item.GetItem("Settings").GetString("AppThemeColor") 9114 }; 9115 9116 manifest.icons = new List<ManifestIcon> { 9117 new ManifestIcon { 9118 src = "/Admin/Public/GetImage.ashx?width=192&height=192&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 9119 sizes = "192x192", 9120 type = "image/png" 9121 }, 9122 new ManifestIcon { 9123 src = "/Admin/Public/GetImage.ashx?width=512&height=512&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 9124 sizes = "512x512", 9125 type = "image/png" 9126 }, 9127 new ManifestIcon { 9128 src = "/Admin/Public/GetImage.ashx?width=1024&height=1024&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 9129 sizes = "1024x1024", 9130 type = "image/png" 9131 } 9132 }; 9133 9134 string manifestFilePath = HttpContext.Current.Request.MapPath("/Files/Templates/Designs/AgricoverCorporate/manifest.json"); 9135 string manifestJSON = Newtonsoft.Json.JsonConvert.SerializeObject(manifest); 9136 string currentManifest = File.ReadAllText(manifestFilePath); 9137 9138 if (manifestJSON != currentManifest) 9139 { 9140 File.WriteAllText(manifestFilePath, manifestJSON); 9141 } 9142 } 9143 9144 var titlePrefix = Translate("Agricover"); 9145 string titleTag = Model.Title + " | " + titlePrefix; 9146 9147 string index = "index"; 9148 string follow = "follow"; 9149 if(!string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("q")) || !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("sourceType"))) 9150 { 9151 index = "noindex"; 9152 follow = "nofollow"; 9153 } 9154 9155 <meta charset="utf-8" /> 9156 <title>@titleTag</title> 9157 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 9158 <meta name="robots" content="@index, @follow"> 9159 <meta name="theme-color" content="@brandColorOne" /> 9160 9161 if (Model.MetaTags != null && !Model.MetaTags.Contains("og:image") && Model.PropertyItem != null && Model.PropertyItem.GetFile("OpenGraphImage") != null) 9162 { 9163 Pageview.Meta.AddTag("og:image", string.Format("{0}://{1}{2}", Dynamicweb.Context.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, Model.PropertyItem.GetFile("OpenGraphImage"))); 9164 } 9165 9166 if (!Model.MetaTags.Contains("og:description") && !string.IsNullOrEmpty(Model.Description)) 9167 { 9168 Pageview.Meta.AddTag("og:description", Model.Description); 9169 } 9170 9171 @*Pageview.Meta.AddTag("og:title", Model.Title);*@ 9172 Pageview.Meta.AddTag("og:title", titleTag); 9173 Pageview.Meta.AddTag("og:site_name", Model.Name); 9174 Pageview.Meta.AddTag("og:url", HttpContext.Current.Request.Url.ToString()); 9175 Pageview.Meta.AddTag("og:type", "Website"); 9176 9177 if (!string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("FacebookAppID"))) { 9178 Pageview.Meta.AddTag("fb:app_id", Model.Area.Item.GetItem("Settings").GetString("FacebookAppID")); 9179 } 9180 if (GetPageIdByNavigationTag("contactPage") == Model.ID) 9181 { 9182 <script type="application/ld+json"> 9183 { 9184 "@@context": "https://schema.org", 9185 "@@type": "ProfessionalService", 9186 "address": { 9187 "@@type": "PostalAddress", 9188 "addressLocality": "Ilfov", 9189 "addressRegion": "Voluntari", 9190 "postalCode": "77190", 9191 "streetAddress": "Bulevardul Pipera 1B, Cubic Center etaj 6" 9192 }, 9193 "name": "Agricover", 9194 "telephone": "021 336 4645", 9195 "url": "https://agricover.ro" 9196 } 9197 </script> 9198 } 9199 9200 9201 @Model.MetaTags 9202 } 9203 @helper RenderMasterCss() { 9204 var fonts = new string[] { 9205 getFontFamily("Layout", "HeaderFont"), 9206 getFontFamily("Layout", "SubheaderFont"), 9207 getFontFamily("Layout", "TertiaryHeaderFont"), 9208 getFontFamily("Layout", "BodyText"), 9209 getFontFamily("Layout", "Header", "ToolsFont"), 9210 getFontFamily("Layout", "Header", "NavigationFont"), 9211 getFontFamily("Layout", "MobileNavigation", "Font"), 9212 getFontFamily("ProductList", "Facets", "HeaderFont"), 9213 getFontFamily("ProductPage", "PriceFontDesign"), 9214 getFontFamily("Ecommerce", "SaleSticker", "Font"), 9215 getFontFamily("Ecommerce", "NewSticker", "Font"), 9216 getFontFamily("Ecommerce", "CustomSticker", "Font") 9217 }; 9218 9219 var DesignFolder = Pageview.Layout.Design.Name; 9220 string autoCssLink = "/Files/Templates/Designs/AgricoverCorporate/css/rapido/agricovercorporate_31.min.css?ticks=" + Model.Area.UpdatedDate.Ticks; 9221 string ApplicationCssLink = "/Files/Templates/Designs/"+DesignFolder+"/dist/app.bundle.css?v=142&ticks=" + Model.Area.UpdatedDate.Ticks; 9222 string favicon = Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon").Path : "/Files/Images/favicon.png"; 9223 bool useFontAwesomePro = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetBoolean("UseFontAwesomePro"); 9224 string fontAwesomeCssLink = "/Files/Templates/Designs/AgricoverCorporate/css/fonts/FontAwesomeFree/css/fontawesome-all.min.css"; 9225 if (useFontAwesomePro) 9226 { 9227 fontAwesomeCssLink = "/Files/Templates/Designs/AgricoverCorporate/css/fonts/FontAwesomePro/css/fontawesome-all.min.css"; 9228 } 9229 9230 //Favicon 9231 <link href="@favicon" rel="icon" type="image/png"> 9232 9233 //Base (Default, wireframe) styles 9234 <link rel="stylesheet" href="/Files/Templates/Designs/AgricoverCorporate/css/base/base.min.css" type="text/css"> 9235 9236 //AgricoverCorporate Css from Website Settings 9237 <link rel="stylesheet" id="rapidoCss" href="@autoCssLink" type="text/css"> 9238 9239 //Ignite Css (Custom site specific styles) 9240 //<link rel="stylesheet" id="igniteCss" type="text/css" href="/Files/Templates/Designs/AgricoverCorporate/css/ignite/ignite.min.css?v=8"> 9241 9242 //Adi Css (Custom site specific styles) 9243 //<link rel="stylesheet" id="igniteCss" type="text/css" href="/Files/Templates/Designs/AgricoverCorporate/css/ignite/adi.css?v=7"> 9244 9245 //Bundle Css 9246 @*<link rel="stylesheet" id="igniteCss" type="text/css" href="/Files/Templates/Designs/AgricoverCorporate/dist/app.bundle.css">*@ 9247 <link rel="stylesheet" type="text/css" href="@ApplicationCssLink"> 9248 9249 //Font awesome 9250 <link rel="stylesheet" href="@fontAwesomeCssLink" type="text/css"> 9251 9252 //Flag icon 9253 <link rel="stylesheet" href="/Files/Templates/Designs/AgricoverCorporate/css/fonts/flag-icon.min.css" type="text/css"> 9254 9255 //Google fonts 9256 var family = string.Join("%7C", fonts.Where(x => !string.IsNullOrEmpty(x)).Distinct().Select(x => string.Format("{0}:100,200,300,400,500,600,700,800,900", x))); 9257 9258 <link href="https://fonts.googleapis.com/css?family=@family" rel="stylesheet"> 9259 9260 PushPromise(favicon); 9261 PushPromise(fontAwesomeCssLink); 9262 PushPromise("/Files/Templates/Designs/AgricoverCorporate/css/base/base.min.css"); 9263 PushPromise(autoCssLink); 9264 PushPromise("/Files/Templates/Designs/AgricoverCorporate/css/ignite/ignite.min.css"); 9265 PushPromise("/Files/Images/placeholder.gif"); 9266 PushPromise("/Files/Templates/Designs/AgricoverCorporate/css/fonts/flag-icon.min.css"); 9267 9268 } 9269 9270 @helper RenderMasterManifest() { 9271 if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName"))) 9272 { 9273 <link rel="manifest" href="/Files/Templates/Designs/AgricoverCorporate/manifest.json"> 9274 PushPromise("/Files/Templates/Designs/AgricoverCorporate/manifest.json"); 9275 } 9276 } 9277 9278 @helper RenderMasterBody() { 9279 List<Block> subBlocks = this.masterPage.GetBlockListById("Body").OrderBy(item => item.SortId).ToList(); 9280 string designLayout = Model.PropertyItem.GetItem("CustomSettings") != null ? Model.PropertyItem.GetItem("CustomSettings").GetString("DesignLayout") != null ? Model.PropertyItem.GetItem("CustomSettings").GetList("DesignLayout").SelectedValue : "" : ""; 9281 if (!String.IsNullOrEmpty(designLayout)) { 9282 designLayout = "class=\"" + designLayout + "\""; 9283 } 9284 9285 <body @designLayout> 9286 @RenderBlockList(subBlocks) 9287 </body> 9288 } 9289 9290 @helper RenderMasterHeader() 9291 { 9292 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterHeader").OrderBy(item => item.SortId).ToList(); 9293 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 9294 string stickyTop = isNavigationStickyMenu ? "top-container--sticky" : ""; 9295 string isStiky = Model.PropertyItem != null & Model.PropertyItem.GetList("MoveThisPageBehindTheHeader") != null ? Model.PropertyItem.GetList("MoveThisPageBehindTheHeader").SelectedValue : "False"; 9296 9297 <header class="top-container agricover-corporate-header sticky-top @isStiky @stickyTop no-print dw-mod" id="Top"> 9298 @RenderBlockList(subBlocks) 9299 </header> 9300 } 9301 9302 @helper RenderMain() 9303 { 9304 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMain").OrderBy(item => item.SortId).ToList(); 9305 9306 <main class="site dw-mod agricover-corporate-site"> 9307 @RenderBlockList(subBlocks) 9308 </main> 9309 } 9310 9311 @helper RenderPageContent() 9312 { 9313 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 9314 string pagePos = isNavigationStickyMenu ? "js-page-pos" : ""; 9315 9316 <div id="Page" class="page @pagePos test"> 9317 <section class="center-container content-container dw-mod" id="content"> 9318 9319 @RenderSnippet("Content") 9320 </section> 9321 </div> 9322 } 9323 9324 @* Hack to support nested helpers *@ 9325 @SnippetStart("Content") 9326 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 9327 9328 9329 @using Dynamicweb.Extensibility 9330 @using Dynamicweb.Core 9331 @using Dynamicweb.Rapido.Blocks.Components 9332 @using Dynamicweb.Rapido.Blocks.Components.Articles 9333 @using Dynamicweb.Rapido.Blocks.Components.General 9334 @using Dynamicweb.Rapido.Blocks 9335 @using Dynamicweb.Content.Items 9336 @{ 9337 var siteLogo = Model.Area.Item.GetString("LogoImage"); 9338 var image = Model.Item.GetFile("image").Path; 9339 var urlScheme = Dynamicweb.Context.Current.Request.Url.Scheme; 9340 var ulrHost = HttpContext.Current.Request.Url.Host; 9341 var fullPathImage = urlScheme + "://" + ulrHost + image; 9342 var articleText = Model.Item.GetString("Summary"); 9343 var author = Model.Item.GetString("Author"); 9344 } 9345 @functions { 9346 BlocksPage articlePage = BlocksPage.GetBlockPage("DynamicArticle"); 9347 9348 public string GetParentSettingsItem(string systemName) { 9349 string item = null; 9350 9351 Dynamicweb.Content.Page current = Dynamicweb.Services.Pages.GetPage(Model.ID); 9352 while (current != null && current.Parent != current) { 9353 var temp = current.Item != null ? current.Item[systemName] : ""; 9354 9355 if (temp != null) { 9356 item = temp.ToString(); 9357 9358 if (!String.IsNullOrEmpty(item) && !String.Equals("default", item, StringComparison.OrdinalIgnoreCase)) { 9359 break; 9360 } 9361 } 9362 9363 current = current.Parent; 9364 } 9365 9366 return item; 9367 } 9368 9369 public string GetArticleCategory(int pageId) 9370 { 9371 string categoryName = null; 9372 9373 //Secure that the article is not in the root folder = Actual has a category 9374 if (Dynamicweb.Services.Pages.GetPage(pageId).Parent != null) { 9375 if (Dynamicweb.Services.Pages.GetPage(pageId).Parent.Parent != null) { 9376 if (!String.IsNullOrEmpty(Dynamicweb.Services.Pages.GetPage(pageId).Parent.Parent.ItemType)) 9377 { 9378 categoryName = Dynamicweb.Services.Pages.GetPage(pageId).Parent.GetDisplayName(); 9379 } 9380 } 9381 } 9382 9383 return categoryName; 9384 } 9385 9386 public string GetArticleCategoryColor(int pageId) 9387 { 9388 string categoryColor = ""; 9389 9390 //Secure that the article is not in the root folder = Actual has a category 9391 if (Dynamicweb.Services.Pages.GetPage(pageId).Parent != null) { 9392 if (Dynamicweb.Services.Pages.GetPage(pageId).Parent.Parent != null) { 9393 if (!String.IsNullOrEmpty(Dynamicweb.Services.Pages.GetPage(pageId).Parent.Parent.ItemType)) 9394 { 9395 if (Dynamicweb.Services.Pages.GetPage(pageId).Parent.Item["CategoryColor"] != null) 9396 { 9397 var service = new ColorSwatchService(); 9398 categoryColor = Dynamicweb.Services.Pages.GetPage(pageId).Parent.Item["CategoryColor"].ToString(); 9399 9400 if (!categoryColor.Contains("#")) { 9401 categoryColor = service.GetHexColor(Converter.ToInt32(Model.Area.ID), categoryColor); 9402 } 9403 } 9404 } 9405 } 9406 } 9407 9408 return categoryColor; 9409 } 9410 } 9411 9412 @{ 9413 string listPageId = Converter.ToString(GetPageIdByNavigationTag("DynamicListFeed")); 9414 string parentPageId = Dynamicweb.Services.Pages.GetPage(Model.ID).Parent.ID.ToString(); 9415 string topLayout = Model.Item.GetList("TopLayout") != null ? Model.Item.GetList("TopLayout").SelectedValue : "default"; 9416 topLayout = topLayout == "default" && GetParentSettingsItem("ArticleTopLayout") != null ? GetParentSettingsItem("ArticleTopLayout").ToString().ToLower() : topLayout; 9417 string textLayout = Model.Item.GetList("TextLayout") != null ? Model.Item.GetList("TextLayout").SelectedValue : "default"; 9418 textLayout = textLayout == "default" && GetParentSettingsItem("ArticleTextLayout") != null ? GetParentSettingsItem("ArticleTextLayout").ToString().ToLower() : textLayout; 9419 string imageLayout = Model.Item.GetList("ImageLayout") != null ? Model.Item.GetList("ImageLayout").SelectedValue : "default"; 9420 imageLayout = imageLayout == "default" && GetParentSettingsItem("ArticleImageLayout") != null ? GetParentSettingsItem("ArticleImageLayout").ToString().ToLower() : imageLayout; 9421 9422 string imageColumns = imageLayout == "straight" && textLayout != "full" ? "8" : "12"; 9423 string contentColumns = textLayout != "full" ? "8" : "12"; 9424 9425 int externalParagraphId = Model.Item.GetItem("CTAParagraphLink") != null ? Model.Item.GetItem("CTAParagraphLink").ParagraphID : 0; 9426 9427 ArticleHeaderLayout headerLayout; 9428 9429 switch (topLayout) 9430 { 9431 case "default": 9432 headerLayout = ArticleHeaderLayout.Clean; 9433 break; 9434 case "split": 9435 headerLayout = ArticleHeaderLayout.Split; 9436 break; 9437 case "banner": 9438 headerLayout = ArticleHeaderLayout.Banner; 9439 break; 9440 case "overlay": 9441 headerLayout = ArticleHeaderLayout.Overlay; 9442 break; 9443 default: 9444 headerLayout = ArticleHeaderLayout.Clean; 9445 break; 9446 } 9447 9448 9449 Block articleContainer = new Block 9450 { 9451 Id = "ArticleContainer", 9452 SortId = 10, 9453 Design = new Design 9454 { 9455 RenderType = RenderType.Row 9456 }, 9457 BlocksList = new List<Block> { 9458 new Block { 9459 Id = "ArticleBody", 9460 SortId = 30, 9461 Design = new Design { 9462 RenderType = RenderType.Column, 9463 Size = "12", 9464 HidePadding = true 9465 } 9466 } 9467 } 9468 }; 9469 articlePage.Add(articleContainer); 9470 9471 ButtonLayout topBannerButtonLayout = ButtonLayout.Primary; 9472 9473 switch (Model.Item.GetString("ButtonDesign")) { 9474 case "primary": 9475 topBannerButtonLayout = ButtonLayout.Primary; 9476 break; 9477 case "secondary": 9478 topBannerButtonLayout = ButtonLayout.Secondary; 9479 break; 9480 case "teritary": 9481 topBannerButtonLayout = ButtonLayout.Tertiary; 9482 break; 9483 case "link": 9484 topBannerButtonLayout = ButtonLayout.Link; 9485 break; 9486 } 9487 9488 ArticleHeader topBanner = new ArticleHeader 9489 { 9490 Layout = headerLayout, 9491 Image = new Image { Path = Model.Item.GetFile("Image"), ImageDefault = new ImageSettings { Width = 1920, Height = 640 } }, 9492 Heading = Model.Item.GetString("Title"), 9493 9494 Subheading = Model.Item.GetString("Summary"), 9495 TextColor = "#fff", 9496 Author = Model.Item.GetString("Author"), 9497 Date = Model.Item.GetString("Date"), 9498 Category = GetArticleCategory(Model.ID), 9499 CategoryColor = GetArticleCategoryColor(Model.ID), 9500 Link = Model.Item.GetString("Link"), 9501 LinkText = Model.Item.GetString("LinkText"), 9502 ButtonLayout = topBannerButtonLayout, 9503 RatingScore = Model.Item.GetString("Rating") != null ? Converter.ToInt32(Model.Item.GetList("Rating").SelectedValue) : 0, 9504 RatingOutOf = Model.Item.GetString("Rating") != null ? Model.Item.GetList("Rating").Options.Count : 0, 9505 ExternalParagraphId = externalParagraphId 9506 }; 9507 9508 9509 Block articleTop = new Block 9510 { 9511 Id = "ArticleHead", 9512 SortId = 20, 9513 Component = topBanner, 9514 Design = new Design 9515 { 9516 RenderType = RenderType.Column, 9517 Size = "12", 9518 HidePadding = true, 9519 CssClass = "article-head" 9520 } 9521 }; 9522 9523 Block articleTopWithVIdeo = new Block 9524 { 9525 Id = "ArticleHeadVideo", 9526 SortId = 20, 9527 Template = RenderHeaderWithVideo(topBanner), 9528 Design = new Design 9529 { 9530 RenderType = RenderType.Column, 9531 Size = "12", 9532 HidePadding = true, 9533 CssClass = "article-head" 9534 } 9535 9536 }; 9537 Block articleTopWithDownload = new Block 9538 { 9539 Id = "ArticleHeadDownload", 9540 SortId = 20, 9541 Template = RenderHeaderWithDownload(topBanner), 9542 Design = new Design 9543 { 9544 RenderType = RenderType.Column, 9545 Size = "12", 9546 HidePadding = true, 9547 CssClass = "article-head" 9548 } 9549 }; 9550 9551 if (String.IsNullOrEmpty(Model.Item.GetString("Video"))) 9552 { 9553 9554 if (!String.IsNullOrEmpty(Model.Item.GetString("Is_Press_Release"))) 9555 { 9556 articlePage.Add("ArticleContainer", articleTopWithDownload); 9557 }else{ 9558 articlePage.Add("ArticleContainer", articleTop); 9559 } 9560 } else { 9561 articlePage.Add("ArticleContainer", articleTopWithVIdeo); 9562 } 9563 9564 9565 9566 Block articleBodyRow = new Block 9567 { 9568 Id = "ArticleBodyRow", 9569 SortId = 10, 9570 SkipRenderBlocksList = true 9571 }; 9572 articlePage.Add("ArticleBody", articleBodyRow); 9573 9574 9575 if (Model.Item.GetString("Paragraphs") != null && Model.Item.GetItems("Paragraphs") != null) 9576 { 9577 int count = 0; 9578 foreach (var paragraph in Model.Item.GetItems("Paragraphs")) 9579 { 9580 Block articleContent = new Block{ 9581 Id = "ArticleParagraph" + count, 9582 SortId = (count * 10), 9583 Design = new Design 9584 { 9585 RenderType = RenderType.Column, 9586 Size = imageColumns, 9587 CssClass = "u-color-light--bg u-padding--lg" 9588 }, 9589 9590 }; 9591 9592 articleContent.Component = new DF_ArticleParagraph {ParagraphContent = paragraph, counter = count, imageColumns = imageColumns, imageLayout = imageLayout, contentColumns = contentColumns}; 9593 articlePage.Add("ArticleBodyRow", articleContent); 9594 9595 9596 count++; 9597 } 9598 } 9599 9600 articleBodyRow.Component = new ArticleBodyRow { SubBlocks = articleBodyRow.BlocksList, TopLayout = topLayout, TextLayout = textLayout }; 9601 9602 9603 //Related 9604 string showRelatedArtices = Model.Item.GetString("ShowRelatedArticles") != null ? Model.Item.GetList("ShowRelatedArticles").SelectedValue.ToLower() : "default"; 9605 showRelatedArtices = showRelatedArtices == "default" && GetParentSettingsItem("ShowRelatedArticles") != null ? GetParentSettingsItem("ShowRelatedArticles").ToString().ToLower() : showRelatedArtices; 9606 9607 if (showRelatedArtices == "true") 9608 { 9609 Block articleRelated = new Block 9610 { 9611 Id = "ArticleRelated", 9612 SortId = 30, 9613 Component = new ArticleRelated { Title = Translate("Related articles"), FeedPageId = listPageId, Query = "sourceType=Page&sourcePage=" + parentPageId, PageSize = 4, CurrentPageId = Model.ID.ToString() }, 9614 Design = new Design 9615 { 9616 RenderType = RenderType.Column, 9617 Size = "12" 9618 } 9619 }; 9620 articlePage.Add("ArticleContainer", articleRelated); 9621 } 9622 } 9623 <div> 9624 @{ 9625 string startLevel = "2"; 9626 } 9627 <div class="u-full-width"> 9628 @Render(new BreadcrumbNavigation { Id = "breadcrumb", Template = "Breadcrumb.xslt", SitemapMode = true, StartLevel = Int32.Parse(startLevel) }) 9629 </div> 9630 9631 @using System 9632 @using System.Web 9633 @using System.Collections.Generic 9634 @using Dynamicweb.Rapido.Blocks 9635 9636 @{ 9637 BlocksPage dynamicArticleCustomBlocksPage = BlocksPage.GetBlockPage("DynamicArticle"); 9638 9639 } 9640 9641 9642 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 9643 @RenderBlockList(articlePage.BlocksRoot.BlocksList) 9644 </div> 9645 9646 @helper RenderHeaderWithVideo(ArticleHeader settings) 9647 { 9648 dynamic[] methodParameters = new dynamic[1]; 9649 methodParameters[0] = settings; 9650 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleCleanHeaderCustom"); 9651 9652 if (customMethod != null) 9653 { 9654 @customMethod.Invoke(this, methodParameters).ToString(); 9655 } 9656 else 9657 { 9658 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12"; 9659 9660 <div class="grid grid--align-content-start grid--justify-start"> 9661 <div class="grid__col-md-@contentColumns grid__col-sm-12 u-padding--lg dw-mod"> 9662 @if (!String.IsNullOrEmpty(settings.Category) || !String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date) || settings.RatingOutOf != 0) 9663 { 9664 <div class="u-border-bottom u-padding-bottom"> 9665 @if (!String.IsNullOrEmpty(settings.Category)) 9666 { 9667 <div class="u-pull--left"> 9668 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div> 9669 </div> 9670 } 9671 <div class="u-pull--right"> 9672 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 9673 { 9674 <small class="article__post-info dw-mod">@settings.Author @settings.Date</small> 9675 } 9676 @if (settings.RatingOutOf != 0) 9677 { 9678 @Render(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) 9679 } 9680 </div> 9681 </div> 9682 } 9683 9684 <div class="grid__cell"> 9685 @if (!String.IsNullOrEmpty(settings.Heading)) 9686 { 9687 <h1 class="article__header article__header--giant dw-mod">@settings.Heading </h1> 9688 9689 } 9690 @if (settings.Image != null) 9691 { 9692 if (settings.Image.Path != null) 9693 { 9694 <div class="u-padding-bottom--lg "> 9695 @if (String.IsNullOrEmpty(Model.Item.GetString("Video"))) 9696 { 9697 @Render(settings.Image) 9698 9699 } 9700 else 9701 { 9702 <div class="video-wrapper"> 9703 @Model.Item.GetString("Video") 9704 </div> 9705 } 9706 </div> 9707 } 9708 } 9709 @if (!String.IsNullOrEmpty(settings.Subheading)) 9710 { 9711 <div class="article__leadtext dw-mod">@settings.Subheading</div> 9712 } 9713 @if (!String.IsNullOrEmpty(settings.Link)) 9714 { 9715 <div class="grid__cell"> 9716 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 9717 </div> 9718 } 9719 </div> 9720 </div> 9721 @if (settings.ExternalParagraphId != 0) 9722 { 9723 <div class="grid__col-md-4 grid__col-sm-12 u-padding--lg u-color-light-gray--bg dw-mod"> 9724 @RenderParagraphContent(settings.ExternalParagraphId) 9725 </div> 9726 } 9727 </div> 9728 } 9729 } 9730 @helper RenderHeaderWithDownload(ArticleHeader settings) 9731 { 9732 dynamic[] methodParameters = new dynamic[1]; 9733 methodParameters[0] = settings; 9734 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleCleanHeaderCustom"); 9735 9736 if (customMethod != null) 9737 { 9738 @customMethod.Invoke(this, methodParameters).ToString(); 9739 } 9740 else 9741 { 9742 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12"; 9743 9744 <div class="grid grid--align-content-start grid--justify-start"> 9745 <div class="grid__col-md-@contentColumns grid__col-sm-12 u-padding--lg dw-mod"> 9746 @if (!String.IsNullOrEmpty(settings.Category) || !String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date) || settings.RatingOutOf != 0) 9747 { 9748 <div class="u-border-bottom u-padding-bottom"> 9749 @if (!String.IsNullOrEmpty(settings.Category)) 9750 { 9751 <div class="u-pull--left"> 9752 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div> 9753 </div> 9754 } 9755 <div class="u-pull--right"> 9756 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 9757 { 9758 <small class="article__post-info dw-mod">@settings.Author @settings.Date</small> 9759 } 9760 @if (settings.RatingOutOf != 0) 9761 { 9762 @Render(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) 9763 } 9764 </div> 9765 </div> 9766 } 9767 9768 <div class="grid__cell"> 9769 @if (!String.IsNullOrEmpty(settings.Heading)) 9770 { 9771 <h1 class="article__header article__header--giant dw-mod">@settings.Heading </h1> 9772 9773 } 9774 @if (settings.Image != null) 9775 { 9776 if (settings.Image.Path != null) 9777 { 9778 <div class="u-padding-bottom--lg"> 9779 9780 @Render(settings.Image) 9781 <a href="@Model.Item.GetString("Image") " class="download-press-relese" target="_blank" download >@Translate("Descarcă imaginea", "Descarcă imaginea") <i class="fas fa-download"></i></a> 9782 </div> 9783 } 9784 } 9785 @if (!String.IsNullOrEmpty(settings.Subheading)) 9786 { 9787 <div class="article__leadtext dw-mod">@settings.Subheading</div> 9788 } 9789 @if (!String.IsNullOrEmpty(settings.Link)) 9790 { 9791 <div class="grid__cell"> 9792 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 9793 </div> 9794 } 9795 </div> 9796 </div> 9797 @if (settings.ExternalParagraphId != 0) 9798 { 9799 <div class="grid__col-md-4 grid__col-sm-12 u-padding--lg u-color-light-gray--bg dw-mod"> 9800 @RenderParagraphContent(settings.ExternalParagraphId) 9801 </div> 9802 } 9803 </div> 9804 } 9805 } 9806 @SnippetStart("SchemaOrg") 9807 <script type="application/ld+json"> 9808 { 9809 "@@context": "https://schema.org", 9810 "@@type": "NewsArticle", 9811 "url": "@Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(Model.ID)", 9812 "publisher":{ 9813 "@@type":"ProfessionalService", 9814 "name":"Agricover", 9815 "logo":"@siteLogo" 9816 }, 9817 "author":{ 9818 "@@type": "Person", 9819 "name": "@author", 9820 "sameAs" :"" 9821 }, 9822 "headline": "@Model.Name.Replace("\"", "\\\"")", 9823 "mainEntityOfPage": "@Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(Model.TopPage.ID)", 9824 "articleBody": "@HttpUtility.JavaScriptStringEncode(articleText)", 9825 "image":[ 9826 "@fullPathImage" 9827 ], 9828 "datePublished":"@Model.CreatedDate" 9829 } 9830 </script> 9831 @SnippetEnd("SchemaOrg") 9832 @SnippetEnd("Content") 9833 <script type="text/javascript"> 9834 9835 _linkedin_partner_id = "3552330"; 9836 9837 window._linkedin_data_partner_ids = window._linkedin_data_partner_ids || []; 9838 9839 window._linkedin_data_partner_ids.push(_linkedin_partner_id); 9840 9841 </script><script type="text/javascript"> 9842 9843 (function(l) { 9844 9845 if (!l){window.lintrk = function(a,b){window.lintrk.q.push([a,b])}; 9846 9847 window.lintrk.q=[]} 9848 9849 var s = document.getElementsByTagName("script")[0]; 9850 9851 var b = document.createElement("script"); 9852 9853 b.type = "text/javascript";b.async = true; 9854 9855 b.src = "https://snap.licdn.com/li.lms-analytics/insight.min.js"; 9856 9857 s.parentNode.insertBefore(b, s);})(window.lintrk); 9858 9859 </script> 9860 9861 <noscript> 9862 9863 <img height="1" width="1" style="display:none;" alt="" src="https://px.ads.linkedin.com/collect/?pid=3552330&fmt=gif" /> 9864 9865 </noscript> 9866 @helper RenderIosTabletFix() { 9867 if (Pageview.Device != Dynamicweb.Frontend.Devices.DeviceType.Tablet && Pageview.Platform != Dynamicweb.Frontend.Devices.PlatformType.Ios) 9868 { 9869 <script> 9870 let isIpadIOS = (/iPad/.test(navigator.platform) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1)) && !window.MSStream; 9871 if (isIpadIOS) { 9872 var separator = (window.location.href.indexOf("?") === -1) ? "?" : "&"; 9873 window.location.href = window.location.href + separator + "DeviceType=Tablet&PlatformType=Ios"; 9874 } 9875 </script> 9876 } 9877 } 9878 @RenderSnippet("ScriptCataloage") 9879 @RenderSnippet("DisqusScript") 9880 </html> 9881 9882