Error executing template "Designs/Rapido/_parsed/Page.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_8492de9aa30845bbb376586cd5121f76.b__217_0(TextWriter __razor_helper_writer) in e:\WGOIISShare\WGO_Prod\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 8218
   at CompiledRazorTemplates.Dynamic.RazorEngine_8492de9aa30845bbb376586cd5121f76.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in e:\WGOIISShare\WGO_Prod\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 248
   at CompiledRazorTemplates.Dynamic.RazorEngine_8492de9aa30845bbb376586cd5121f76.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in e:\WGOIISShare\WGO_Prod\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 156
   at CompiledRazorTemplates.Dynamic.RazorEngine_8492de9aa30845bbb376586cd5121f76.b__216_0(TextWriter __razor_helper_writer) in e:\WGOIISShare\WGO_Prod\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 8163
   at CompiledRazorTemplates.Dynamic.RazorEngine_8492de9aa30845bbb376586cd5121f76.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in e:\WGOIISShare\WGO_Prod\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 248
   at CompiledRazorTemplates.Dynamic.RazorEngine_8492de9aa30845bbb376586cd5121f76.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in e:\WGOIISShare\WGO_Prod\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 156
   at CompiledRazorTemplates.Dynamic.RazorEngine_8492de9aa30845bbb376586cd5121f76.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in e:\WGOIISShare\WGO_Prod\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 279
   at CompiledRazorTemplates.Dynamic.RazorEngine_8492de9aa30845bbb376586cd5121f76.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in e:\WGOIISShare\WGO_Prod\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 156
   at CompiledRazorTemplates.Dynamic.RazorEngine_8492de9aa30845bbb376586cd5121f76.Execute() in e:\WGOIISShare\WGO_Prod\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 8153
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

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