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