Error executing template "Designs/Rapido/_parsed/BlogArticle.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_d4e763b1745b4e59952f781bec81b22e.<RenderPageContent>b__149_0(TextWriter __razor_helper_writer) in C:\DW9Staging\Solutions\Files-rapidofull\Templates\Designs\Rapido\_parsed\BlogArticle.parsed.cshtml:line 6360
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_d4e763b1745b4e59952f781bec81b22e.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in C:\DW9Staging\Solutions\Files-rapidofull\Templates\Designs\Rapido\_parsed\BlogArticle.parsed.cshtml:line 224
   at CompiledRazorTemplates.Dynamic.RazorEngine_d4e763b1745b4e59952f781bec81b22e.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in C:\DW9Staging\Solutions\Files-rapidofull\Templates\Designs\Rapido\_parsed\BlogArticle.parsed.cshtml:line 138
   at CompiledRazorTemplates.Dynamic.RazorEngine_d4e763b1745b4e59952f781bec81b22e.<RenderMain>b__147_0(TextWriter __razor_helper_writer) in C:\DW9Staging\Solutions\Files-rapidofull\Templates\Designs\Rapido\_parsed\BlogArticle.parsed.cshtml:line 6251
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_d4e763b1745b4e59952f781bec81b22e.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in C:\DW9Staging\Solutions\Files-rapidofull\Templates\Designs\Rapido\_parsed\BlogArticle.parsed.cshtml:line 224
   at CompiledRazorTemplates.Dynamic.RazorEngine_d4e763b1745b4e59952f781bec81b22e.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in C:\DW9Staging\Solutions\Files-rapidofull\Templates\Designs\Rapido\_parsed\BlogArticle.parsed.cshtml:line 138
   at CompiledRazorTemplates.Dynamic.RazorEngine_d4e763b1745b4e59952f781bec81b22e.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in C:\DW9Staging\Solutions\Files-rapidofull\Templates\Designs\Rapido\_parsed\BlogArticle.parsed.cshtml:line 246
   at CompiledRazorTemplates.Dynamic.RazorEngine_d4e763b1745b4e59952f781bec81b22e.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in C:\DW9Staging\Solutions\Files-rapidofull\Templates\Designs\Rapido\_parsed\BlogArticle.parsed.cshtml:line 138
   at CompiledRazorTemplates.Dynamic.RazorEngine_d4e763b1745b4e59952f781bec81b22e.Execute() in C:\DW9Staging\Solutions\Files-rapidofull\Templates\Designs\Rapido\_parsed\BlogArticle.parsed.cshtml:line 6232
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 2 3 @using System.Web; 4 @using Dynamicweb.Frontend 5 @using Dynamicweb.Frontend.Devices 6 @using Dynamicweb.Extensibility 7 @using Dynamicweb.Content 8 @using Dynamicweb.Security 9 @using Dynamicweb.Core 10 @using System 11 @using System.Web 12 @using System.IO 13 @using Dynamicweb.Rapido.Blocks 14 @using System.Net 15 16 17 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 //Font settings 44 var fonts = new string[] { 45 getFontFamily("Layout", "HeaderFont"), 46 getFontFamily("Layout", "SubheaderFont"), 47 getFontFamily("Layout", "TertiaryHeaderFont"), 48 getFontFamily("Layout", "BodyText"), 49 getFontFamily("Layout", "Header", "ToolsFont"), 50 getFontFamily("Layout", "Header", "NavigationFont"), 51 getFontFamily("Layout", "MobileNavigation", "Font"), 52 getFontFamily("ProductList", "Facets", "HeaderFont"), 53 getFontFamily("ProductPage", "PriceFontDesign"), 54 getFontFamily("Ecommerce", "SaleSticker", "Font"), 55 getFontFamily("Ecommerce", "NewSticker", "Font"), 56 getFontFamily("Ecommerce", "CustomSticker", "Font") 57 }; 58 59 string autoCssLink = "/Files/Templates/Designs/Rapido/css/rapido/rapido_" + Model.Area.ID.ToString() + ".min.css?ticks=" + Model.Area.UpdatedDate.Ticks; 60 string favicon = Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon").Path : "/Files/Images/favicon.png"; 61 bool useFontAwesomePro = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetBoolean("UseFontAwesomePro"); 62 string fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomeFree/css/fontawesome-all.min.css"; 63 if (useFontAwesomePro) 64 { 65 fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomePro/css/fontawesome-all.min.css"; 66 } 67 } 68 69 @{ 70 Block master = new Block() 71 { 72 Id = "Master", 73 BlocksList = new List<Block> { 74 new Block { 75 Id = "MasterTopSnippets", 76 SortId = 10 77 }, 78 new Block { 79 Id = "MasterMain", 80 SortId = 20, 81 Template = RenderMain(), 82 SkipRenderBlocksList = true, 83 BlocksList = new List<Block> { 84 new Block { 85 Id = "MasterHeader", 86 SortId = 10, 87 Template = RenderMasterHeader(), 88 SkipRenderBlocksList = true 89 }, 90 new Block { 91 Id = "MasterPageContent", 92 SortId = 20, 93 Template = RenderPageContent() 94 } 95 } 96 }, 97 new Block { 98 Id = "MasterFooter", 99 SortId = 30 100 }, 101 new Block { 102 Id = "MasterReferences", 103 SortId = 40 104 }, 105 new Block { 106 Id = "MasterBottomSnippets", 107 SortId = 50 108 } 109 } 110 }; 111 112 masterPage.Add(master); 113 } 114 115 @* Include the required Grid builder (Contains the methods @RenderBlockList and @RenderBlock) *@ 116 @using System.Text.RegularExpressions 117 @using System.Collections.Generic 118 @using System.Reflection 119 @using System.Web.UI.HtmlControls 120 @using Dynamicweb.Rapido.Blocks.Components 121 @using Dynamicweb.Rapido.Blocks.Components.Articles 122 @using Dynamicweb.Rapido.Blocks.Components.Documentation 123 @using Dynamicweb.Rapido.Blocks 124 125 126 @*--- START: Base block renderers ---*@ 127 128 @helper RenderBlockList(List<Block> blocks) 129 { 130 blocks = blocks.OrderBy(item => item.SortId).ToList(); 131 132 foreach (Block item in blocks) 133 { 134 <!-- START: @item.Id --> 135 136 if (item.Design == null) 137 { 138 @RenderBlock(item) 139 } 140 else if (item.Design.RenderType == RenderType.None) { 141 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : ""; 142 143 <div class="@cssClass dw-mod"> 144 @RenderBlock(item) 145 </div> 146 } 147 else if (item.Design.RenderType != RenderType.Hide) 148 { 149 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : ""; 150 151 if (!item.SkipRenderBlocksList) { 152 if (item.Design.RenderType == RenderType.Row) 153 { 154 <div class="grid grid--align-content-start @cssClass dw-mod" id="Block__@item.Id"> 155 @RenderBlock(item) 156 </div> 157 } 158 159 if (item.Design.RenderType == RenderType.Column) 160 { 161 string hidePadding = item.Design.HidePadding ? "u-no-padding" : ""; 162 string size = item.Design.Size ?? "12"; 163 size = Regex.IsMatch(size, @"\d") ? "md-" + item.Design.Size : item.Design.Size; 164 165 <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"> 166 @RenderBlock(item) 167 </div> 168 } 169 170 if (item.Design.RenderType == RenderType.Table) 171 { 172 <table class="table @cssClass dw-mod" id="Block__@item.Id"> 173 @RenderBlock(item) 174 </table> 175 } 176 177 if (item.Design.RenderType == RenderType.TableRow) 178 { 179 <tr class="@cssClass dw-mod" id="Block__@item.Id"> 180 @RenderBlock(item) 181 </tr> 182 } 183 184 if (item.Design.RenderType == RenderType.TableColumn) 185 { 186 <td class="@cssClass dw-mod" id="Block__@item.Id"> 187 @RenderBlock(item) 188 </td> 189 } 190 191 if (item.Design.RenderType == RenderType.CardHeader) 192 { 193 <div class="card-header @cssClass dw-mod"> 194 @RenderBlock(item) 195 </div> 196 } 197 198 if (item.Design.RenderType == RenderType.CardBody) 199 { 200 <div class="card @cssClass dw-mod"> 201 @RenderBlock(item) 202 </div> 203 } 204 205 if (item.Design.RenderType == RenderType.CardFooter) 206 { 207 <div class="card-footer @cssClass dw-mod"> 208 @RenderBlock(item) 209 </div> 210 } 211 } 212 else 213 { 214 @RenderBlock(item) 215 } 216 } 217 218 <!-- END: @item.Id --> 219 } 220 } 221 222 @helper RenderBlock(Block item) 223 { 224 if (item.Template != null) 225 { 226 @BlocksPage.RenderTemplate(item.Template) 227 } 228 229 if (item.Component != null) 230 { 231 string methodName = item.Component.HelperName; 232 dynamic[] methodParameters = new dynamic[1]; 233 methodParameters[0] = item.Component; 234 Type methodType = this.GetType(); 235 MethodInfo generalMethod = methodType.GetMethod(methodName); 236 237 if (generalMethod != null) { 238 @generalMethod.Invoke(this, methodParameters).ToString(); 239 } else { 240 throw new Exception(item.Component.GetType().Name + " method '" + methodName +"' could not be invoked"); 241 } 242 } 243 244 if (item.BlocksList.Count > 0 && !item.SkipRenderBlocksList) 245 { 246 @RenderBlockList(item.BlocksList) 247 } 248 } 249 250 @*--- END: Base block renderers ---*@ 251 252 253 @* Include the components *@ 254 @using Dynamicweb.Rapido.Blocks.Components 255 @using Dynamicweb.Rapido.Blocks.Components.General 256 @using Dynamicweb.Rapido.Blocks 257 258 259 @* Components *@ 260 @using System.Reflection 261 @using Dynamicweb.Rapido.Blocks.Components.General 262 263 264 @* Component *@ 265 266 @helper RenderIcon(Icon settings) { 267 if (settings != null) 268 { 269 dynamic[] methodParameters = new dynamic[1]; 270 methodParameters[0] = settings; 271 MethodInfo customMethod = this.GetType().GetMethod("RenderIconCustom"); 272 273 if (customMethod != null) 274 { 275 @customMethod.Invoke(this, methodParameters).ToString(); 276 } else { 277 string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : ""; 278 279 if (settings.Name != null) 280 { 281 if (String.IsNullOrEmpty(settings.Label)) { 282 <i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i> 283 } else { 284 if (settings.LabelPosition == IconLabelPosition.Before) { 285 <span>@settings.Label <i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i></span> 286 } else { 287 <span><i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i> @settings.Label</span> 288 } 289 } 290 } 291 } 292 } 293 } 294 @using System.Reflection 295 @using Dynamicweb.Rapido.Blocks.Components.General 296 @using Dynamicweb.Rapido.Blocks.Components 297 298 299 @* Component *@ 300 301 @helper RenderButton(Button settings) { 302 dynamic[] methodParameters = new dynamic[1]; 303 methodParameters[0] = settings; 304 MethodInfo customMethod = this.GetType().GetMethod("RenderButtonCustom"); 305 306 if (customMethod != null) 307 { 308 @customMethod.Invoke(this, methodParameters).ToString(); 309 } 310 else 311 { 312 string target; 313 string disabled = settings.Disabled ? "disabled" : ""; 314 string buttonType = settings.ButtonType == ButtonType.Submit ? "submit" : "button"; 315 buttonType = settings.ButtonType == ButtonType.Reset ? "reset" : buttonType; 316 string buttonLayout = settings.ButtonLayout.ToString().ToLower(); 317 318 switch (settings.Target) 319 { 320 case LinkTargetType.Blank: 321 target = "_blank"; 322 break; 323 case LinkTargetType.Parent: 324 target = "_parent"; 325 break; 326 case LinkTargetType.Self: 327 target = "_self"; 328 break; 329 case LinkTargetType.Top: 330 target = "_top"; 331 break; 332 default: 333 target = "_self"; 334 break; 335 } 336 337 string onClickAction = settings.OnClick != null ? settings.OnClick : ""; 338 string noOpener = target == "_blank" ? "rel=\"noopener\"" : ""; 339 340 if (!String.IsNullOrEmpty(settings.ConfirmText)) 341 { 342 string modalId = settings.Id; 343 @RenderConfirmDialog(settings); 344 onClickAction = "document.getElementById('" + modalId + "ModalTrigger').checked = true"; 345 } 346 347 if (settings.Icon != null) 348 { 349 if (settings.IconPosition == null) { 350 settings.Icon.LabelPosition = IconLabelPosition.After; 351 } else { 352 settings.Icon.LabelPosition = settings.IconPosition == IconPosition.Before ? IconLabelPosition.After : IconLabelPosition.Before; 353 } 354 if (settings.Icon.Label == null) { 355 settings.Icon.Label = settings.Title; 356 } 357 } 358 string content = settings.Icon == null ? settings.Title : Convert.ToString(RenderIcon(settings.Icon)); 359 360 if (!String.IsNullOrEmpty(settings.Link) && String.IsNullOrEmpty(settings.ConfirmText)) 361 { 362 <a href="@settings.Link" target="@target" @noOpener class="btn btn--@buttonLayout @settings.CssClass @disabled dw-mod" onclick="@onClickAction" @ComponentMethods.AddAttributes(settings.ExtraAttributes) @disabled>@content</a> 363 } 364 else 365 { 366 <button type="@buttonType" class="btn btn--@buttonLayout @settings.CssClass @disabled dw-mod" onclick="@onClickAction" @ComponentMethods.AddAttributes(settings.ExtraAttributes) @disabled>@content</button> 367 } 368 } 369 } 370 371 372 @helper RenderConfirmDialog(Button settings) { 373 dynamic[] methodParameters = new dynamic[1]; 374 methodParameters[0] = settings; 375 MethodInfo customMethod = this.GetType().GetMethod("RenderConfirmDialogCustom"); 376 377 if (customMethod != null) 378 { 379 @customMethod.Invoke(this, methodParameters).ToString(); 380 } else { 381 string modalTriggerId = settings.Id + "ModalTrigger"; 382 383 <!-- Trigger for the confirm modal --> 384 <input type="checkbox" id="@modalTriggerId" class="modal-trigger" /> 385 386 <!-- Login modal --> 387 <div class="modal-container"> 388 <label for="@modalTriggerId" class="modal-overlay"></label> 389 <div class="modal modal--xs"> 390 <div class="modal__header"> 391 <h2>@settings.ConfirmText</h2> 392 </div> 393 <div class="modal__body"> 394 @RenderButton(new Button { Title = Translate("OK"), ButtonLayout = ButtonLayout.Primary, OnClick = settings.OnClick, CssClass = "u-full-width", Link = settings.Link }) 395 </div> 396 </div> 397 </div> 398 } 399 } 400 @using System.Reflection 401 @using Dynamicweb.Rapido.Blocks.Components 402 @using Dynamicweb.Rapido.Blocks.Components.General 403 @using Dynamicweb.Rapido.Blocks 404 405 406 @* Component *@ 407 408 @helper RenderRating(Rating settings) 409 { 410 dynamic[] methodParameters = new dynamic[1]; 411 methodParameters[0] = settings; 412 MethodInfo customMethod = this.GetType().GetMethod("RenderRatingCustom"); 413 414 if (customMethod != null) 415 { 416 @customMethod.Invoke(this, methodParameters).ToString(); 417 } else { 418 if (settings.Score > 0) 419 { 420 int rating = settings.Score; 421 string iconType = "fa-star"; 422 423 switch (settings.Type.ToString()) { 424 case "Stars": 425 iconType = "fa-star"; 426 break; 427 case "Hearts": 428 iconType = "fa-heart"; 429 break; 430 case "Lemons": 431 iconType = "fa-lemon"; 432 break; 433 case "Bombs": 434 iconType = "fa-bomb"; 435 break; 436 } 437 438 <div class="u-ta-right"> 439 @for (int i = 0; i < settings.OutOf; i++) 440 { 441 <i class="@(rating > i ? "fas" : "far") @iconType"></i> 442 } 443 </div> 444 } 445 } 446 } 447 @using System.Reflection 448 @using Dynamicweb.Rapido.Blocks.Components.General 449 @using Dynamicweb.Rapido.Blocks.Components 450 451 452 @* Component *@ 453 454 @helper RenderFieldListOption(FieldListOption settings) { 455 dynamic[] methodParameters = new dynamic[1]; 456 methodParameters[0] = settings; 457 MethodInfo customMethod = this.GetType().GetMethod("RenderFieldListOptionCustom"); 458 459 if (customMethod != null) 460 { 461 @customMethod.Invoke(this, methodParameters).ToString(); 462 } else { 463 string disabled = settings.Disabled ? "disabled" : ""; 464 string selected = settings.Checked ? "checked" : ""; 465 466 if (settings.Type.ToString() == "RadioButton") 467 { 468 <input class="form__control @disabled dw-mod" onchange="@settings.OnChange" onclick="@settings.OnClick" type="radio" name="@settings.Name" id="@settings.Id" value="@settings.Value" @selected @disabled @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 469 <label for="@settings.Id" class="u-inline @disabled dw-mod">@settings.Label</label> 470 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 471 } 472 473 if (settings.Type.ToString() == "Checkbox") 474 { 475 @RenderCheckboxField(settings) 476 } 477 478 if (settings.Type.ToString() == "SelectOption") 479 { 480 <option value="@settings.Value" id="@settings.Id" onclick="@settings.OnClick" class="@disabled" @disabled @selected @ComponentMethods.AddAttributes(settings.ExtraAttributes) >@settings.Name</option> 481 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 482 } 483 } 484 } 485 486 @using System.Reflection 487 @using Dynamicweb.Rapido.Blocks.Components.General 488 @using Dynamicweb.Rapido.Blocks.Components 489 490 491 @* Component *@ 492 493 @helper RenderNavigation(Navigation settings) { 494 dynamic[] methodParameters = new dynamic[1]; 495 methodParameters[0] = settings; 496 MethodInfo customMethod = this.GetType().GetMethod("RenderNavigationCustom"); 497 498 if (customMethod != null) 499 { 500 @customMethod.Invoke(this, methodParameters).ToString(); 501 } else { 502 @RenderNavigation(new 503 { 504 id = settings.Id, 505 cssclass = settings.CssClass, 506 startLevel = settings.StartLevel, 507 endlevel = settings.EndLevel, 508 expandmode = settings.Expandmode, 509 template = settings.Template 510 }) 511 } 512 } 513 @using System.Reflection 514 @using Dynamicweb.Rapido.Blocks.Components.General 515 @using Dynamicweb.Rapido.Blocks.Components 516 517 518 @* Component *@ 519 520 @helper RenderBreadcrumbNavigation(BreadcrumbNavigation settings) { 521 dynamic[] methodParameters = new dynamic[1]; 522 methodParameters[0] = settings; 523 MethodInfo customMethod = this.GetType().GetMethod("RenderBreadcrumbNavigationCustom"); 524 525 if (customMethod != null) 526 { 527 @customMethod.Invoke(this, methodParameters).ToString(); 528 } else { 529 settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id; 530 settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template; 531 settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel; 532 settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel; 533 settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode; 534 535 @RenderNavigation(settings) 536 } 537 } 538 @using System.Reflection 539 @using Dynamicweb.Rapido.Blocks.Components.General 540 541 542 @* Component *@ 543 544 @helper RenderHeading(Heading settings) { 545 dynamic[] methodParameters = new dynamic[1]; 546 methodParameters[0] = settings; 547 MethodInfo customMethod = this.GetType().GetMethod("RenderHeadingCustom"); 548 549 if (customMethod != null) 550 { 551 @customMethod.Invoke(this, methodParameters).ToString(); 552 } else { 553 string startTag = "<h" + settings.Level.ToString() + " class=\"" + settings.CssClass + "\">"; 554 string endTag = "</h" + settings.Level.ToString() + "\">"; 555 556 if (settings.Icon != null) 557 { 558 if (settings.IconPosition == null) { 559 settings.Icon.LabelPosition = IconLabelPosition.After; 560 } else { 561 settings.Icon.LabelPosition = settings.IconPosition == IconPosition.Before ? IconLabelPosition.After : IconLabelPosition.Before; 562 } 563 if (settings.Icon.Label == null) { 564 settings.Icon.Label = settings.Title; 565 } 566 567 @startTag@RenderIcon(settings.Icon)@endTag 568 } else { 569 @startTag@settings.Title@endTag 570 } 571 } 572 } 573 @using System.Reflection 574 @using Dynamicweb.Rapido.Blocks.Components 575 @using Dynamicweb.Rapido.Blocks.Components.General 576 @using Dynamicweb.Rapido.Blocks 577 578 579 @* Component *@ 580 581 @helper RenderImage(Image settings) 582 { 583 if (settings.Path != null) 584 { 585 dynamic[] methodParameters = new dynamic[1]; 586 methodParameters[0] = settings; 587 MethodInfo customMethod = this.GetType().GetMethod("RenderImageCustom"); 588 589 if (customMethod != null) 590 { 591 @customMethod.Invoke(this, methodParameters).ToString(); 592 } else { 593 <div> 594 @if (settings.Link != null) 595 { 596 <a href="@settings.Link"> 597 @RenderTheImage(settings); 598 </a> 599 } 600 else 601 { 602 @RenderTheImage(settings); 603 } 604 </div> 605 } 606 } 607 } 608 609 @functions { 610 string getImagePathFromSettings(ImageSettings settings) 611 { 612 string result = ""; 613 614 if (settings != null) 615 { 616 result += settings.Width != 0 ? "Width=" + settings.Width + "&" : ""; 617 result += settings.Height != 0 ? "Height=" + settings.Height + "&" : ""; 618 result += "Crop=" + settings.Crop + "&"; 619 result += "Compression=" + settings.Compression + "&"; 620 result += "DoNotUpscale=" + settings.DoNotUpscale.ToString() + "&"; 621 result += "FillCanvas=" + settings.FillCanvas.ToString() + "&"; 622 } 623 624 return result; 625 } 626 } 627 628 @helper RenderTheImage(Image settings) 629 { 630 if (settings != null) 631 { 632 dynamic[] methodParameters = new dynamic[1]; 633 methodParameters[0] = settings; 634 MethodInfo customMethod = this.GetType().GetMethod("RenderTheImageCustom"); 635 636 if (customMethod != null) 637 { 638 @customMethod.Invoke(this, methodParameters).ToString(); 639 } else { 640 string placeholderImage = "/Files/Images/placeholder.gif"; 641 string imageEngine = "/Admin/Public/GetImage.ashx?"; 642 643 string imageStyle = ""; 644 645 switch (settings.Style) 646 { 647 case ImageStyle.Ball: 648 imageStyle = "grid__cell-img--ball"; 649 break; 650 } 651 652 if (settings.Style == ImageStyle.Ball || settings.Style == ImageStyle.Circle) 653 { 654 if (settings.ImageDefault != null) 655 { 656 settings.ImageDefault.Height = settings.ImageDefault.Width; 657 } 658 if (settings.ImageMedium != null) 659 { 660 settings.ImageMedium.Height = settings.ImageMedium.Width; 661 } 662 if (settings.ImageSmall != null) 663 { 664 settings.ImageSmall.Height = settings.ImageSmall.Width; 665 } 666 } 667 668 string defaultImage = imageEngine; 669 string imageSmall = ""; 670 string imageMedium = ""; 671 672 if (settings.DisableImageEngine) { 673 defaultImage = settings.Path; 674 } else { 675 if (settings.ImageDefault != null) 676 { 677 defaultImage += getImagePathFromSettings(settings.ImageDefault); 678 679 if (settings.Path.GetType() != typeof(string)) 680 { 681 defaultImage += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 682 defaultImage += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 683 } 684 else 685 { 686 defaultImage += settings.Path != null ? "Image=" + settings.Path : ""; 687 } 688 } 689 690 if (settings.ImageSmall != null) 691 { 692 imageSmall = "data-src-small=\"" + imageEngine; 693 imageSmall += getImagePathFromSettings(settings.ImageSmall); 694 695 if (settings.Path.GetType() != typeof(string)) 696 { 697 imageSmall += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 698 imageSmall += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 699 } 700 else 701 { 702 imageSmall += settings.Path != null ? "Image=" + settings.Path : ""; 703 } 704 705 imageSmall += "\""; 706 } 707 708 if (settings.ImageMedium != null) 709 { 710 imageMedium = "data-src-medium=\"" + imageEngine; 711 imageMedium += getImagePathFromSettings(settings.ImageMedium); 712 713 if (settings.Path.GetType() != typeof(string)) 714 { 715 imageMedium += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 716 imageMedium += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 717 } 718 else 719 { 720 imageMedium += settings.Path != null ? "Image=" + settings.Path : ""; 721 } 722 723 imageMedium += "\""; 724 } 725 } 726 727 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>(); 728 if (!String.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick); } 729 if (!String.IsNullOrEmpty(settings.Title)) { optionalAttributes.Add("alt", settings.Title); } 730 731 if (settings.DisableLazyLoad) { 732 <img class="grid__cell-img @imageStyle @settings.CssClass dw-mod" src="@defaultImage" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 733 } else { 734 <img class="grid__cell-img b-lazy @imageStyle @settings.CssClass dw-mod" src="@placeholderImage" data-src="@defaultImage" @imageSmall @imageMedium @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 735 } 736 737 if (settings.Caption != null) 738 { 739 <span class="image-caption dw-mod">@settings.Caption</span> 740 } 741 } 742 } 743 } 744 @using System.Reflection 745 @using Dynamicweb.Rapido.Blocks.Components.General 746 @using Dynamicweb.Rapido.Blocks.Components 747 748 749 @* Component *@ 750 751 @helper RenderTextField(TextField settings) { 752 dynamic[] methodParameters = new dynamic[1]; 753 methodParameters[0] = settings; 754 MethodInfo customMethod = this.GetType().GetMethod("RenderTextFieldCustom"); 755 756 if (customMethod != null) 757 { 758 @customMethod.Invoke(this, methodParameters).ToString(); 759 } else { 760 int maxLength = settings.MaxLength != 0 ? settings.MaxLength : 524288; 761 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>(); 762 if (settings.Type == TextFieldType.Password) { optionalAttributes.Add("autocomplete", "off"); }; 763 if (!String.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick.ToString()); } 764 if (!String.IsNullOrEmpty(settings.Placeholder)) { optionalAttributes.Add("placeholder", settings.Placeholder); } 765 if (settings.Disabled) { optionalAttributes.Add("disabled", settings.Disabled.ToString()); } 766 if (settings.Required) { optionalAttributes.Add("required", settings.Required.ToString()); } 767 if (settings.MaxLength != 0) { optionalAttributes.Add("maxlength", settings.MaxLength.ToString()); } 768 769 <div class="form__field-group dw-mod"> 770 @if (!String.IsNullOrEmpty(settings.Label)) 771 { 772 <label for="@settings.Id">@settings.Label</label> 773 } 774 775 <input type="@settings.Type" class="u-full-width @settings.CssClass dw-mod" name="@settings.Id" id="@(settings.Id)" value="@settings.Value" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 776 777 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 778 </div> 779 } 780 } 781 @using System.Reflection 782 @using Dynamicweb.Rapido.Blocks.Components.General 783 @using Dynamicweb.Rapido.Blocks.Components 784 785 786 @* Component *@ 787 788 @helper RenderNumberField(NumberField settings) { 789 dynamic[] methodParameters = new dynamic[1]; 790 methodParameters[0] = settings; 791 MethodInfo customMethod = this.GetType().GetMethod("RenderNumberFieldCustom"); 792 793 if (customMethod != null) 794 { 795 @customMethod.Invoke(this, methodParameters).ToString(); 796 } else { 797 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>(); 798 if (!String.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick.ToString()); } 799 if (settings.Disabled) { optionalAttributes.Add("disabled", settings.Disabled.ToString()); } 800 if (settings.Required) { optionalAttributes.Add("required", settings.Required.ToString()); } 801 if (settings.Max != 0) { optionalAttributes.Add("max", settings.Max.ToString()); } 802 if (settings.Min != 0) { optionalAttributes.Add("min", settings.Min.ToString()); } 803 if (settings.Step != 0) { optionalAttributes.Add("step", settings.Step.ToString()); } 804 805 <div class="form__field-group dw-mod"> 806 @if (!String.IsNullOrEmpty(settings.Label)) 807 { 808 <div> 809 <label for="@settings.Id">@settings.Label</label> 810 </div> 811 } 812 813 <input type="Number" class="u-w70px @settings.CssClass dw-mod" name="@settings.Id" id="@(settings.Id)" value="@settings.Value" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 814 815 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 816 </div> 817 } 818 } 819 @using System.Reflection 820 @using Dynamicweb.Rapido.Blocks.Components.General 821 @using Dynamicweb.Rapido.Blocks.Components 822 823 824 @* Component *@ 825 826 @helper RenderTextareaField(TextareaField settings) { 827 dynamic[] methodParameters = new dynamic[1]; 828 methodParameters[0] = settings; 829 MethodInfo customMethod = this.GetType().GetMethod("RenderTextareaFieldCustom"); 830 831 if (customMethod != null) 832 { 833 @customMethod.Invoke(this, methodParameters).ToString(); 834 } else { 835 int maxLength = settings.MaxLength != 0 ? settings.MaxLength : 524288; 836 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>(); 837 if (!String.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick.ToString()); } 838 if (!String.IsNullOrEmpty(settings.Placeholder)) { optionalAttributes.Add("placeholder", settings.Placeholder); } 839 if (settings.Disabled) { optionalAttributes.Add("disabled", settings.Disabled.ToString()); } 840 if (settings.Required) { optionalAttributes.Add("required", settings.Required.ToString()); } 841 if (settings.MaxLength != 0) { optionalAttributes.Add("maxlength", settings.MaxLength.ToString()); } 842 if (settings.Rows != 0) { optionalAttributes.Add("rows", settings.Rows.ToString()); } 843 844 <div class="form__field-group dw-mod"> 845 @if (!String.IsNullOrEmpty(@settings.Label)) 846 { 847 <label for="@settings.Id">@settings.Label</label> 848 } 849 850 <textarea class="u-full-width @settings.CssClass dw-mod" name="@settings.Id" id="@(settings.Id)" value="@settings.Value" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)></textarea> 851 852 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 853 </div> 854 } 855 } 856 @using System.Reflection 857 @using Dynamicweb.Rapido.Blocks.Components.General 858 @using Dynamicweb.Rapido.Blocks.Components 859 860 861 @* Component *@ 862 863 @helper RenderHiddenField(HiddenField settings) { 864 dynamic[] methodParameters = new dynamic[1]; 865 methodParameters[0] = settings; 866 MethodInfo customMethod = this.GetType().GetMethod(settings.HelperName + "Custom"); 867 868 if (customMethod != null) 869 { 870 @customMethod.Invoke(this, methodParameters).ToString(); 871 } else { 872 <input type="hidden" name="@settings.Id" id="@(settings.Id)" value="@settings.Value" @ComponentMethods.AddAttributes(settings.ExtraAttributes)/> 873 } 874 } 875 @using System.Reflection 876 @using Dynamicweb.Rapido.Blocks.Components.General 877 @using Dynamicweb.Rapido.Blocks.Components 878 879 880 @* Component *@ 881 882 @helper RenderCheckboxField(dynamic settings) { 883 dynamic[] methodParameters = new dynamic[1]; 884 methodParameters[0] = settings; 885 MethodInfo customMethod = this.GetType().GetMethod("RenderCheckboxFieldCustom"); 886 887 if (customMethod != null) 888 { 889 @customMethod.Invoke(this, methodParameters).ToString(); 890 } else { 891 settings.Type = FieldListOptionType.Checkbox; 892 string disabled = settings.Disabled ? "disabled" : ""; 893 string required = settings.Required ? "required" : ""; 894 string checkedString = settings.Checked == true ? "checked" : ""; 895 string id = settings.Id != null ? settings.Id : settings.Label.Replace(" ", ""); 896 897 <div class="form__field-group dw-mod"> 898 <input type="checkbox" class="form__control @settings.CssClass @disabled dw-mod" name="@settings.Name" id="@id" value="@settings.Value" onclick="@settings.OnClick" @disabled @required @checkedString @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 899 900 @if (!String.IsNullOrEmpty(settings.Label)) 901 { 902 <label for="@id" class="@disabled dw-mod">@settings.Label</label> 903 } 904 905 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 906 </div> 907 } 908 } 909 @using System.Reflection 910 @using Dynamicweb.Rapido.Blocks.Components.General 911 @using Dynamicweb.Rapido.Blocks.Components 912 913 914 @* Component *@ 915 916 @helper RenderCheckboxListField(CheckboxListField settings) { 917 dynamic[] methodParameters = new dynamic[1]; 918 methodParameters[0] = settings; 919 MethodInfo customMethod = this.GetType().GetMethod("RenderCheckboxListFieldCustom"); 920 921 if (customMethod != null) 922 { 923 @customMethod.Invoke(this, methodParameters).ToString(); 924 } else { 925 string disabled = settings.Disabled ? "disabled" : ""; 926 927 <div class="form__field-group @settings.CssClass u-margin-bottom @disabled dw-mod" @disabled @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 928 @if (!String.IsNullOrEmpty(settings.Label)) 929 { 930 <div class="u-bold u-margin-bottom">@settings.Label</div> 931 } 932 933 @foreach (var item in settings.Options) 934 { 935 item.Type = FieldListOptionType.Checkbox; 936 @RenderFieldListOption(item) 937 } 938 939 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 940 </div> 941 } 942 } 943 944 @using System.Reflection 945 @using Dynamicweb.Rapido.Blocks.Components.General 946 @using Dynamicweb.Rapido.Blocks.Components 947 948 949 @* Component *@ 950 951 @helper RenderSelectField(SelectField settings) { 952 dynamic[] methodParameters = new dynamic[1]; 953 methodParameters[0] = settings; 954 MethodInfo customMethod = this.GetType().GetMethod("RenderSelectFieldCustom"); 955 956 if (customMethod != null) 957 { 958 @customMethod.Invoke(this, methodParameters).ToString(); 959 } else { 960 string disabled = settings.Disabled ? "disabled" : ""; 961 string required = settings.Required ? "required" : ""; 962 963 if (settings.Default != null) 964 { 965 settings.Default.Type = FieldListOptionType.SelectOption; 966 } 967 968 <div class="form__field-group u-full-width dw-mod"> 969 @if (!String.IsNullOrEmpty(settings.Label)) 970 { 971 <label for="@settings.Id">@settings.Label</label> 972 } 973 974 <div class="form__field-combi u-no-margin dw-mod"> 975 <select id="@settings.Id" class="u-full-width @settings.CssClass dw-mod" onchange="@settings.OnChange" @ComponentMethods.AddAttributes(settings.ExtraAttributes) > 976 @if (settings.Default.Value != null) 977 { 978 @RenderFieldListOption(settings.Default) 979 } 980 981 @foreach (var item in settings.Options) 982 { 983 item.Type = FieldListOptionType.SelectOption; 984 @RenderFieldListOption(item) 985 } 986 </select> 987 @if (settings.ActionButton.Link != null || settings.ActionButton.OnClick != null) { 988 settings.ActionButton.CssClass += " btn--condensed u-no-margin"; 989 @RenderButton(settings.ActionButton); 990 } 991 </div> 992 993 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 994 </div> 995 } 996 } 997 @using System.Reflection 998 @using Dynamicweb.Rapido.Blocks.Components.General 999 @using Dynamicweb.Rapido.Blocks.Components 1000 1001 1002 @* Component *@ 1003 1004 @helper RenderRadioButtonField(RadioButtonField settings) { 1005 dynamic[] methodParameters = new dynamic[1]; 1006 methodParameters[0] = settings; 1007 MethodInfo customMethod = this.GetType().GetMethod("RenderRadioButtonFieldCustom"); 1008 1009 if (customMethod != null) 1010 { 1011 @customMethod.Invoke(this, methodParameters).ToString(); 1012 } else { 1013 string disabled = settings.Disabled ? "disabled" : ""; 1014 1015 <div class="form__field-group @settings.CssClass u-margin-bottom @disabled" @disabled @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1016 @if (!String.IsNullOrEmpty(settings.Label)) 1017 { 1018 <div class="u-bold u-margin-bottom">@settings.Label</div> 1019 } 1020 1021 @foreach (var item in settings.Options) 1022 { 1023 item.Type = FieldListOptionType.RadioButton; 1024 1025 if (settings.Name != null) 1026 { 1027 item.Name = settings.Name; 1028 } 1029 1030 if (settings.RenderOptionsInline) 1031 { 1032 @RenderFieldListOption(item) 1033 } 1034 else 1035 { 1036 <div> 1037 @RenderFieldListOption(item) 1038 </div> 1039 } 1040 } 1041 1042 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 1043 </div> 1044 } 1045 } 1046 @using System.Reflection 1047 @using Dynamicweb.Rapido.Blocks.Components.General 1048 @using Dynamicweb.Rapido.Blocks.Components 1049 1050 1051 @* Component *@ 1052 1053 @helper RenderNotificationMessage(NotificationMessage settings) { 1054 dynamic[] methodParameters = new dynamic[1]; 1055 methodParameters[0] = settings; 1056 MethodInfo customMethod = this.GetType().GetMethod("RenderNotificationMessageCustom"); 1057 1058 if (customMethod != null) 1059 { 1060 @customMethod.Invoke(this, methodParameters).ToString(); 1061 } else { 1062 if (!String.IsNullOrEmpty(settings.Message)) 1063 { 1064 string messageTypeClass = settings.MessageType.ToString().ToLower(); 1065 <div class="field-@messageTypeClass @settings.CssClass u-full-width dw-mod">@settings.Message</div> 1066 } 1067 } 1068 } 1069 @using System.Reflection 1070 @using Dynamicweb.Rapido.Blocks.Components.General 1071 1072 1073 @* Component *@ 1074 1075 @helper RenderHandlebarsRoot(HandlebarsRoot settings) { 1076 dynamic[] methodParameters = new dynamic[1]; 1077 methodParameters[0] = settings; 1078 MethodInfo customMethod = this.GetType().GetMethod("RenderHandlebarsRootCustom"); 1079 1080 if (customMethod != null) 1081 { 1082 @customMethod.Invoke(this, methodParameters).ToString(); 1083 } else { 1084 string preRender = !String.IsNullOrEmpty(settings.PreRenderScriptTemplate) ? "data-pre-render-template=\"" + settings.PreRenderScriptTemplate + "\"" : ""; 1085 1086 <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> 1087 @if (settings.SubBlocks != null) { 1088 @RenderBlockList(settings.SubBlocks) 1089 } 1090 </div> 1091 } 1092 } 1093 @using System.Reflection 1094 @using Dynamicweb.Rapido.Blocks.Components.General 1095 @using Dynamicweb.Rapido.Blocks.Components 1096 @using System.Text.RegularExpressions 1097 1098 1099 @* Component *@ 1100 1101 @helper RenderSticker(Sticker settings) { 1102 dynamic[] methodParameters = new dynamic[1]; 1103 methodParameters[0] = settings; 1104 MethodInfo customMethod = this.GetType().GetMethod("RenderStickerCustom"); 1105 1106 if (customMethod != null) 1107 { 1108 @customMethod.Invoke(this, methodParameters).ToString(); 1109 } 1110 else 1111 { 1112 if (!String.IsNullOrEmpty(settings.Title)) { 1113 string size = settings.Size.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Size.ToString().ToLower() : ""; 1114 string style = settings.Style.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Style.ToString().ToLower() : ""; 1115 1116 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>(); 1117 if (!String.IsNullOrEmpty(settings.Color) || !String.IsNullOrEmpty(settings.BackgroundColor)) { 1118 string styleTag = !String.IsNullOrEmpty(settings.Color) ? "color: " + settings.Color + "; " : ""; 1119 styleTag += !String.IsNullOrEmpty(settings.BackgroundColor) ? "background-color: " + settings.BackgroundColor + "; " : ""; 1120 optionalAttributes.Add("style", styleTag); 1121 } 1122 1123 <div class="stickers-container__tag @size @style @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Title</div> 1124 } 1125 } 1126 } 1127 1128 @using System.Reflection 1129 @using Dynamicweb.Rapido.Blocks.Components.General 1130 @using Dynamicweb.Rapido.Blocks.Components 1131 1132 1133 @* Component *@ 1134 1135 @helper RenderStickersCollection(StickersCollection settings) { 1136 dynamic[] methodParameters = new dynamic[1]; 1137 methodParameters[0] = settings; 1138 MethodInfo customMethod = this.GetType().GetMethod("RenderStickersCollectionCustom"); 1139 1140 if (customMethod != null) 1141 { 1142 @customMethod.Invoke(this, methodParameters).ToString(); 1143 } 1144 else 1145 { 1146 if (settings.Stickers.Count > 0) { 1147 string position = settings.Position != null ? "" + "stickers-container--" + Regex.Replace(settings.Position.ToString(), "([a-z])([A-Z])", "$1-$2").ToLower() : ""; 1148 1149 <div class="stickers-container @position @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1150 @foreach (Sticker sticker in settings.Stickers) 1151 { 1152 @RenderSticker(sticker) 1153 } 1154 </div> 1155 } 1156 } 1157 } 1158 1159 @using System.Reflection 1160 @using Dynamicweb.Rapido.Blocks.Components.General 1161 @using Dynamicweb.Rapido.Blocks.Components 1162 1163 1164 1165 @* Component *@ 1166 1167 @helper RenderField(Field settings) { 1168 dynamic[] methodParameters = new dynamic[1]; 1169 methodParameters[0] = settings; 1170 MethodInfo customMethod = this.GetType().GetMethod("RenderFieldCustom"); 1171 1172 if (customMethod != null) 1173 { 1174 @customMethod.Invoke(this, methodParameters).ToString(); 1175 } else { 1176 switch (settings.FieldType) 1177 { 1178 case FieldType.Checkbox: 1179 CheckboxField checkbox = new CheckboxField 1180 { 1181 Label = settings.Label, 1182 Id = settings.Id, 1183 Name = settings.Label.Replace(" ", ""), 1184 Value = settings.Value, 1185 Checked = Convert.ToBoolean(settings.Placeholder), 1186 OnClick = settings.OnClick, 1187 Disabled = settings.Disabled, 1188 Required = settings.Required, 1189 CssClass = settings.CssClass, 1190 ExtraAttributes = settings.ExtraAttributes, 1191 ErrorMessage = settings.ErrorMessage 1192 }; 1193 1194 @RenderCheckboxField(checkbox) 1195 break; 1196 case FieldType.Email: 1197 TextField emailField = new TextField 1198 { 1199 Label = settings.Label != null ? settings.Label : Translate("Email"), 1200 Id = settings.Id, 1201 Value = settings.Value, 1202 OnClick = settings.OnClick, 1203 Disabled = settings.Disabled, 1204 Required = settings.Required, 1205 CssClass = settings.CssClass, 1206 ExtraAttributes = settings.ExtraAttributes, 1207 ErrorMessage = settings.ErrorMessage, 1208 Placeholder = settings.Placeholder, 1209 Type = TextFieldType.Email 1210 }; 1211 1212 @RenderTextField(emailField) 1213 break; 1214 case FieldType.Hidden: 1215 HiddenField hiddenField = new HiddenField 1216 { 1217 Label = settings.Label, 1218 Id = settings.Id, 1219 Value = settings.Value, 1220 Disabled = settings.Disabled, 1221 Required = settings.Required, 1222 CssClass = settings.CssClass, 1223 ExtraAttributes = settings.ExtraAttributes, 1224 ErrorMessage = settings.ErrorMessage 1225 }; 1226 1227 @RenderHiddenField(hiddenField) 1228 break; 1229 case FieldType.Integer: 1230 NumberField numberField = new NumberField 1231 { 1232 Label = settings.Label, 1233 Id = settings.Id, 1234 Value = settings.Value.GetType() == typeof(int) ? Convert.ToInt32(settings.Value) : 1, 1235 OnClick = settings.OnClick, 1236 Disabled = settings.Disabled, 1237 Required = settings.Required, 1238 CssClass = settings.CssClass, 1239 ExtraAttributes = settings.ExtraAttributes, 1240 ErrorMessage = settings.ErrorMessage, 1241 Step = 1 1242 }; 1243 1244 @RenderNumberField(numberField) 1245 break; 1246 case FieldType.Password: 1247 TextField passwordField = new TextField 1248 { 1249 Label = settings.Label != null ? settings.Label : Translate("Password"), 1250 Id = settings.Id, 1251 Value = settings.Value, 1252 OnClick = settings.OnClick, 1253 Disabled = settings.Disabled, 1254 Required = settings.Required, 1255 CssClass = settings.CssClass, 1256 ExtraAttributes = settings.ExtraAttributes, 1257 ErrorMessage = settings.ErrorMessage, 1258 Placeholder = settings.Placeholder, 1259 Type = TextFieldType.Password 1260 }; 1261 1262 @RenderTextField(passwordField) 1263 break; 1264 case FieldType.Reset: 1265 Button resetField = new Button 1266 { 1267 Title = settings.Label != null ? settings.Label : Translate("Reset"), 1268 Id = settings.Id, 1269 OnClick = settings.OnClick, 1270 Disabled = settings.Disabled, 1271 CssClass = settings.CssClass, 1272 ExtraAttributes = settings.ExtraAttributes, 1273 ButtonLayout = ButtonLayout.Secondary, 1274 ButtonType = ButtonType.Reset 1275 }; 1276 1277 @RenderButton(resetField) 1278 break; 1279 case FieldType.Submit: 1280 Button submitField = new Button 1281 { 1282 Title = settings.Label != null ? settings.Label : Translate("Submit"), 1283 Id = settings.Id, 1284 OnClick = settings.OnClick, 1285 Disabled = settings.Disabled, 1286 CssClass = settings.CssClass, 1287 ExtraAttributes = settings.ExtraAttributes, 1288 ButtonLayout = ButtonLayout.Primary, 1289 ButtonType = ButtonType.Submit 1290 }; 1291 1292 @RenderButton(submitField) 1293 break; 1294 case FieldType.Tel: 1295 TextField telField = new TextField 1296 { 1297 Label = settings.Label != null ? settings.Label : Translate("Phone"), 1298 Id = settings.Id, 1299 Value = settings.Value, 1300 OnClick = settings.OnClick, 1301 Disabled = settings.Disabled, 1302 Required = settings.Required, 1303 CssClass = settings.CssClass, 1304 ExtraAttributes = settings.ExtraAttributes, 1305 ErrorMessage = settings.ErrorMessage, 1306 Placeholder = settings.Placeholder, 1307 Type = TextFieldType.Tel 1308 }; 1309 1310 @RenderTextField(telField) 1311 break; 1312 case FieldType.Text: 1313 TextField textField = new TextField 1314 { 1315 Label = settings.Label, 1316 Id = settings.Id, 1317 Value = settings.Value, 1318 OnClick = settings.OnClick, 1319 Disabled = settings.Disabled, 1320 Required = settings.Required, 1321 CssClass = settings.CssClass, 1322 ExtraAttributes = settings.ExtraAttributes, 1323 ErrorMessage = settings.ErrorMessage, 1324 Placeholder = settings.Placeholder, 1325 Type = TextFieldType.Text 1326 }; 1327 1328 @RenderTextField(textField) 1329 break; 1330 case FieldType.Textarea: 1331 TextareaField textareaField = new TextareaField 1332 { 1333 Label = settings.Label, 1334 Id = settings.Id, 1335 Value = settings.Value, 1336 OnClick = settings.OnClick, 1337 Disabled = settings.Disabled, 1338 Required = settings.Required, 1339 CssClass = settings.CssClass, 1340 ExtraAttributes = settings.ExtraAttributes, 1341 ErrorMessage = settings.ErrorMessage, 1342 Placeholder = settings.Placeholder 1343 }; 1344 1345 @RenderTextareaField(textareaField) 1346 break; 1347 default: 1348 TextField defaultField = new TextField 1349 { 1350 Label = settings.Label, 1351 Id = settings.Id, 1352 Value = settings.Value, 1353 OnClick = settings.OnClick, 1354 Disabled = settings.Disabled, 1355 Required = settings.Required, 1356 CssClass = settings.CssClass, 1357 ExtraAttributes = settings.ExtraAttributes, 1358 ErrorMessage = settings.ErrorMessage, 1359 Placeholder = settings.Placeholder, 1360 Type = TextFieldType.Text 1361 }; 1362 1363 @RenderTextField(defaultField) 1364 break; 1365 } 1366 } 1367 } 1368 1369 1370 @using Dynamicweb.Frontend 1371 @using System.Reflection 1372 @using Dynamicweb.Content.Items 1373 @using System.Web.UI.HtmlControls 1374 @using Dynamicweb.Rapido.Blocks.Components 1375 @using Dynamicweb.Rapido.Blocks 1376 1377 1378 @* Components for the articles *@ 1379 @using System.Reflection 1380 @using Dynamicweb.Rapido.Blocks.Components.Articles 1381 1382 1383 @* Component for the articles *@ 1384 1385 @helper RenderArticleBanner(dynamic settings) { 1386 dynamic[] methodParameters = new dynamic[1]; 1387 methodParameters[0] = settings; 1388 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleBannerCustom"); 1389 1390 if (customMethod != null) 1391 { 1392 @customMethod.Invoke(this, methodParameters).ToString(); 1393 } else { 1394 string filterClasses = "image-filter image-filter--darken"; 1395 settings.Layout = ArticleHeaderLayout.Banner; 1396 1397 if (settings.Image != null) 1398 { 1399 if (settings.Image.Path != null) 1400 { 1401 <section class="multiple-paragraphs-container u-color-light paragraph-container--full-width"> 1402 <div class="background-image @filterClasses dw-mod"> 1403 <div class="background-image__wrapper @filterClasses dw-mod"> 1404 @{ 1405 settings.Image.CssClass += "background-image__cover dw-mod"; 1406 } 1407 @RenderImage(settings.Image) 1408 </div> 1409 </div> 1410 <div class="center-container dw-mod"> 1411 <div class="grid"> 1412 <div class="grid__col-md-8 grid__col-xs-12 paragraph-container paragraph-container--height-lg"> 1413 <div class="u-left-middle"> 1414 <div> 1415 @if (!String.IsNullOrEmpty(settings.Heading)) 1416 { 1417 <h1 class="article__header article__header--giant dw-mod" style="color: @settings.TextColor">@settings.Heading</h1> 1418 } 1419 @if (!String.IsNullOrEmpty(settings.Subheading)) 1420 { 1421 <div class="article__leadtext dw-mod" style="color: @settings.TextColor">@settings.Subheading</div> 1422 } 1423 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 1424 { 1425 <small class="article__post-info u-margin-bottom--lg dw-mod" style="color: @settings.TextColor">@settings.Author @settings.Date</small> 1426 } 1427 @if (!String.IsNullOrEmpty(settings.Link)) { 1428 <div class="grid__cell"> 1429 @RenderButton(new Button { Link= settings.Link, Title= settings.LinkText, ButtonLayout= settings.ButtonLayout }) 1430 </div> 1431 } 1432 </div> 1433 </div> 1434 </div> 1435 @if (settings.ExternalParagraphId != 0) 1436 { 1437 <div class="grid__col-md-4 grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-auto dw-mod"> 1438 <div class="u-color-light-gray--bg u-color-dark dw-mod"> 1439 @RenderParagraphContent(settings.ExternalParagraphId) 1440 </div> 1441 </div> 1442 } 1443 </div> 1444 </div> 1445 </section> 1446 } 1447 else 1448 { 1449 settings.Layout = ArticleHeaderLayout.Clean; 1450 @RenderArticleCleanHeader(settings); 1451 } 1452 } 1453 else 1454 { 1455 settings.Layout = ArticleHeaderLayout.Clean; 1456 @RenderArticleCleanHeader(settings); 1457 } 1458 } 1459 } 1460 @using System.Reflection 1461 @using Dynamicweb.Rapido.Blocks.Components 1462 @using Dynamicweb.Rapido.Blocks.Components.General 1463 @using Dynamicweb.Rapido.Blocks.Components.Articles 1464 @using Dynamicweb.Rapido.Blocks 1465 1466 1467 @* Component for the articles *@ 1468 1469 @helper RenderArticleHeader(ArticleHeader settings) { 1470 dynamic[] methodParameters = new dynamic[1]; 1471 methodParameters[0] = settings; 1472 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleHeaderCustom"); 1473 1474 if (customMethod != null) 1475 { 1476 @customMethod.Invoke(this, methodParameters).ToString(); 1477 } else { 1478 switch (settings.Layout) 1479 { 1480 case ArticleHeaderLayout.Clean: 1481 @RenderArticleCleanHeader(settings); 1482 break; 1483 case ArticleHeaderLayout.Split: 1484 @RenderArticleSplitHeader(settings); 1485 break; 1486 case ArticleHeaderLayout.Banner: 1487 @RenderArticleBannerHeader(settings); 1488 break; 1489 case ArticleHeaderLayout.Overlay: 1490 @RenderArticleOverlayHeader(settings); 1491 break; 1492 default: 1493 @RenderArticleCleanHeader(settings); 1494 break; 1495 } 1496 } 1497 } 1498 1499 @helper RenderArticleCleanHeader(ArticleHeader settings) { 1500 dynamic[] methodParameters = new dynamic[1]; 1501 methodParameters[0] = settings; 1502 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleCleanHeaderCustom"); 1503 1504 if (customMethod != null) 1505 { 1506 @customMethod.Invoke(this, methodParameters).ToString(); 1507 } 1508 else 1509 { 1510 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12"; 1511 1512 <div class="grid grid--align-content-start grid--justify-start"> 1513 <div class="grid__col-md-@contentColumns grid__col-sm-12 u-padding--lg dw-mod"> 1514 @if (!String.IsNullOrEmpty(settings.Category) || !String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date) || settings.RatingOutOf != 0) 1515 { 1516 <div class="u-border-bottom u-padding-bottom"> 1517 @if (!String.IsNullOrEmpty(settings.Category)) 1518 { 1519 <div class="u-pull--left"> 1520 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div> 1521 </div> 1522 } 1523 <div class="u-pull--right"> 1524 @*CS NT Hide date 20220411 1525 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 1526 { 1527 <small class="article__post-info dw-mod">@settings.Author @settings.Date</small> 1528 } 1529 *@ 1530 @if (settings.RatingOutOf != 0) 1531 { 1532 @RenderRating(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) 1533 } 1534 </div> 1535 </div> 1536 } 1537 1538 <div class="grid__cell"> 1539 @if (!String.IsNullOrEmpty(settings.Heading)) 1540 { 1541 <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1> 1542 } 1543 @if (settings.Image != null) 1544 { 1545 if (settings.Image.Path != null) 1546 { 1547 <div class="u-padding-bottom--lg"> 1548 @RenderImage(settings.Image) 1549 </div> 1550 } 1551 } 1552 @if (!String.IsNullOrEmpty(settings.Subheading)) 1553 { 1554 <div class="article__leadtext dw-mod">@settings.Subheading</div> 1555 } 1556 @if (!String.IsNullOrEmpty(settings.Link)) 1557 { 1558 <div class="grid__cell"> 1559 @RenderButton(new Button { Link = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 1560 </div> 1561 } 1562 </div> 1563 </div> 1564 @if (settings.ExternalParagraphId != 0) 1565 { 1566 <div class="grid__col-md-4 grid__col-sm-12 u-padding--lg u-color-light-gray--bg dw-mod"> 1567 @RenderParagraphContent(settings.ExternalParagraphId) 1568 </div> 1569 } 1570 </div> 1571 } 1572 } 1573 1574 @helper RenderArticleSplitHeader(ArticleHeader settings) { 1575 dynamic[] methodParameters = new dynamic[1]; 1576 methodParameters[0] = settings; 1577 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSplitHeaderCustom"); 1578 1579 if (customMethod != null) 1580 { 1581 @customMethod.Invoke(this, methodParameters).ToString(); 1582 } 1583 else 1584 { 1585 string headerColumnWidth = settings.ExternalParagraphId != 0 ? "4" : "6"; 1586 1587 if (settings.Image != null) 1588 { 1589 if (settings.Image.Path != null) 1590 { 1591 <section class="multiple-paragraphs-container paragraph-container--full-width"> 1592 <div class="grid"> 1593 <div class="grid__col-md-@headerColumnWidth grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-xl dw-mod"> 1594 <div class="u-left-middle u-padding--lg"> 1595 <div> 1596 @if (!String.IsNullOrEmpty(settings.Category)) 1597 { 1598 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div> 1599 } 1600 @if (!String.IsNullOrEmpty(settings.Heading)) 1601 { 1602 <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1> 1603 } 1604 @if (!String.IsNullOrEmpty(settings.Subheading)) 1605 { 1606 <div class="article__leadtext dw-mod">@settings.Subheading</div> 1607 } 1608 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 1609 { 1610 <small class="article__post-info u-pull--left dw-mod">@settings.Author @settings.Date</small> 1611 } 1612 @if (settings.RatingOutOf != 0) 1613 { 1614 <div class="u-pull--right"> 1615 @RenderRating(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) 1616 </div> 1617 } 1618 @if (!String.IsNullOrEmpty(settings.Link)) { 1619 @RenderButton(new Button { Link = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 1620 } 1621 </div> 1622 </div> 1623 </div> 1624 <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> 1625 @if (settings.ExternalParagraphId != 0) 1626 { 1627 <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"> 1628 @RenderParagraphContent(settings.ExternalParagraphId) 1629 </div> 1630 } 1631 </div> 1632 </section> 1633 } 1634 } 1635 else 1636 { 1637 @RenderArticleCleanHeader(settings); 1638 } 1639 } 1640 } 1641 1642 @helper RenderArticleOverlayHeader(ArticleHeader settings) { 1643 dynamic[] methodParameters = new dynamic[1]; 1644 methodParameters[0] = settings; 1645 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleOverlayHeaderCustom"); 1646 1647 if (customMethod != null) 1648 { 1649 @customMethod.Invoke(this, methodParameters).ToString(); 1650 } 1651 else 1652 { 1653 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12"; 1654 string contentAlignment = settings.TextLayout == ArticleHeaderTextLayout.Center ? "grid--justify-center" : ""; 1655 1656 if (settings.Image != null) 1657 { 1658 if (settings.Image.Path != null) 1659 { 1660 if (settings.ExternalParagraphId == 0) 1661 { 1662 <section class="multiple-paragraphs-container u-color-light paragraph-container--full-width"> 1663 <div class="background-image image-filter image-filter--darken dw-mod"> 1664 <div class="background-image__wrapper image-filter image-filter--darken dw-mod"> 1665 @{ 1666 settings.Image.CssClass += "background-image__cover dw-mod"; 1667 } 1668 @RenderImage(settings.Image) 1669 </div> 1670 </div> 1671 <div class="center-container dw-mod"> 1672 <div class="grid @contentAlignment"> 1673 <div class="grid__col-md-@contentColumns grid__col-xs-12 paragraph-container paragraph-container--height-xl u-no-padding dw-mod"> 1674 @if (!String.IsNullOrEmpty(settings.Heading)) 1675 { 1676 <h1 class="article__header article__header--giant u-padding-top--lg dw-mod" style="color: @settings.TextColor">@settings.Heading</h1> 1677 } 1678 @if (!String.IsNullOrEmpty(settings.Subheading)) 1679 { 1680 <div class="article__leadtext dw-mod" style="color: @settings.TextColor">@settings.Subheading</div> 1681 } 1682 <div class="u-margin-top"> 1683 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 1684 { 1685 <small class="article__post-info u-pull--left dw-mod" style="color: @settings.TextColor">@settings.Author @settings.Date</small> 1686 } 1687 @if (settings.RatingOutOf != 0) 1688 { 1689 <div class="u-pull--right"> 1690 @RenderRating(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) 1691 </div> 1692 } 1693 </div> 1694 @if (!String.IsNullOrEmpty(settings.Link)) 1695 { 1696 <div class="grid__cell"> 1697 @RenderButton(new Button { Link= settings.Link, Title= settings.LinkText, ButtonLayout= settings.ButtonLayout }) 1698 </div> 1699 } 1700 </div> 1701 </div> 1702 </div> 1703 </section> 1704 } 1705 else 1706 { 1707 @RenderArticleBanner(settings); 1708 } 1709 } 1710 } 1711 else 1712 { 1713 @RenderArticleCleanHeader(settings); 1714 } 1715 } 1716 } 1717 1718 @helper RenderArticleBannerHeader(dynamic settings) { 1719 dynamic[] methodParameters = new dynamic[1]; 1720 methodParameters[0] = settings; 1721 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleBannerHeaderCustom"); 1722 1723 if (customMethod != null) 1724 { 1725 @customMethod.Invoke(this, methodParameters).ToString(); 1726 } 1727 else 1728 { 1729 @RenderArticleBanner(settings); 1730 } 1731 } 1732 @using System.Reflection 1733 @using System.Text.RegularExpressions; 1734 @using Dynamicweb.Frontend 1735 @using Dynamicweb.Content.Items 1736 @using Dynamicweb.Rapido.Blocks.Components 1737 @using Dynamicweb.Rapido.Blocks.Components.Articles 1738 @using Dynamicweb.Rapido.Blocks 1739 1740 @* Component for the articles *@ 1741 1742 @helper RenderArticleBodyRow(ArticleBodyRow settings) 1743 { 1744 dynamic[] methodParameters = new dynamic[1]; 1745 methodParameters[0] = settings; 1746 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleBodyRowCustom"); 1747 1748 if (customMethod != null) 1749 { 1750 @customMethod.Invoke(this, methodParameters).ToString(); 1751 } else { 1752 string position = settings.TopLayout == "overlay" ? "article__overlay-offset" : ""; 1753 string contentAlignment = settings.TextLayout == "center" ? "grid--justify-center" : ""; 1754 1755 <div class="grid grid--align-content-start @contentAlignment @position dw-mod"> 1756 @RenderBlockList(settings.SubBlocks) 1757 </div> 1758 } 1759 } 1760 @using System.Reflection 1761 @using Dynamicweb.Rapido.Blocks.Components 1762 @using Dynamicweb.Rapido.Blocks.Components.General 1763 @using Dynamicweb.Rapido.Blocks.Components.Articles 1764 @using Dynamicweb.Rapido.Blocks 1765 1766 @* Component for the articles *@ 1767 1768 @helper RenderArticleImage(ArticleImage settings) 1769 { 1770 dynamic[] methodParameters = new dynamic[1]; 1771 methodParameters[0] = settings; 1772 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleImageCustom"); 1773 1774 if (customMethod != null) 1775 { 1776 @customMethod.Invoke(this, methodParameters).ToString(); 1777 } 1778 else 1779 { 1780 if (settings.Image != null) 1781 { 1782 if (settings.Image.Path != null) 1783 { 1784 <div class="u-margin-bottom--lg"> 1785 @RenderImage(settings.Image) 1786 </div> 1787 } 1788 } 1789 } 1790 } 1791 @using System.Reflection 1792 @using Dynamicweb.Rapido.Blocks.Components 1793 @using Dynamicweb.Rapido.Blocks.Components.Articles 1794 1795 1796 @* Component for the articles *@ 1797 1798 @helper RenderArticleSubHeader(ArticleSubHeader settings) 1799 { 1800 dynamic[] methodParameters = new dynamic[1]; 1801 methodParameters[0] = settings; 1802 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSubHeaderCustom"); 1803 1804 if (customMethod != null) 1805 { 1806 @customMethod.Invoke(this, methodParameters).ToString(); 1807 } else { 1808 if (!String.IsNullOrEmpty(settings.Title)) 1809 { 1810 <h2 class="article__header">@settings.Title</h2> 1811 } 1812 } 1813 } 1814 @using System.Reflection 1815 @using Dynamicweb.Rapido.Blocks.Components 1816 @using Dynamicweb.Rapido.Blocks.Components.Articles 1817 @using Dynamicweb.Rapido.Blocks 1818 1819 1820 @* Component for the articles *@ 1821 1822 @helper RenderArticleText(ArticleText settings) 1823 { 1824 dynamic[] methodParameters = new dynamic[1]; 1825 methodParameters[0] = settings; 1826 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleTextCustom"); 1827 1828 if (customMethod != null) 1829 { 1830 @customMethod.Invoke(this, methodParameters).ToString(); 1831 } else { 1832 if (!String.IsNullOrEmpty(settings.Text)) 1833 { 1834 string greatTextClass = settings.EnableLargeText == true ? "article__paragraph--great-text" : ""; 1835 1836 <div class="article__paragraph @greatTextClass"> 1837 @settings.Text 1838 </div> 1839 } 1840 } 1841 } 1842 @using System.Reflection 1843 @using Dynamicweb.Rapido.Blocks.Components 1844 @using Dynamicweb.Rapido.Blocks.Components.Articles 1845 @using Dynamicweb.Rapido.Blocks 1846 1847 1848 @* Component for the articles *@ 1849 1850 @helper RenderArticleQuote(ArticleQuote settings) 1851 { 1852 dynamic[] methodParameters = new dynamic[1]; 1853 methodParameters[0] = settings; 1854 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleQuoteCustom"); 1855 1856 if (customMethod != null) 1857 { 1858 @customMethod.Invoke(this, methodParameters).ToString(); 1859 } else { 1860 string text = Regex.Replace(settings.Text, "<.*?>", String.Empty); 1861 1862 <div class="grid u-padding-bottom--lg"> 1863 @if (settings.Image != null) 1864 { 1865 if (settings.Image.Path != null) { 1866 <div class="grid__col-3"> 1867 <div class="grid__cell-img"> 1868 @{ 1869 settings.Image.Title = !String.IsNullOrEmpty(settings.Image.Title) ? settings.Image.Title : settings.Author; 1870 settings.Image.CssClass += " article__image article__image--ball"; 1871 settings.Image.ImageDefault.Width = 200; 1872 settings.Image.ImageDefault.Height = 200; 1873 } 1874 @RenderImage(settings.Image) 1875 </div> 1876 </div> 1877 } 1878 } 1879 <div class="grid__col-auto"> 1880 @if (!String.IsNullOrEmpty(settings.Text)) 1881 { 1882 <div class="article__quote dw-mod"> 1883 <i class="fas fa-quote-right u-margin-bottom--lg"></i> 1884 @settings.Text 1885 <i class="fas fa-quote-right"></i> 1886 </div> 1887 } 1888 @if (!String.IsNullOrEmpty(settings.Author)) 1889 { 1890 <div class="article__quote-author dw-mod"> 1891 - @settings.Author 1892 </div> 1893 } 1894 </div> 1895 </div> 1896 } 1897 } 1898 @using System.Reflection 1899 @using Dynamicweb.Rapido.Blocks.Components 1900 @using Dynamicweb.Rapido.Blocks.Components.Articles 1901 @using Dynamicweb.Rapido.Blocks 1902 1903 @* Component for the articles *@ 1904 1905 @helper RenderArticleInfoTable(ArticleInfoTable settings) 1906 { 1907 dynamic[] methodParameters = new dynamic[1]; 1908 methodParameters[0] = settings; 1909 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleInfoTableCustom"); 1910 1911 if (customMethod != null) 1912 { 1913 @customMethod.Invoke(this, methodParameters).ToString(); 1914 } else { 1915 <table class="table table--clean"> 1916 @foreach (var row in settings.Rows) 1917 { 1918 string iconColor = row.IconColor != null ? row.IconColor : "u-brand-color-two"; 1919 1920 <tr> 1921 @if (!String.IsNullOrEmpty(row.Icon)) 1922 { 1923 <td class="u-w32px"><i class="@row.Icon fa-2x @row.IconColor"></i></td> 1924 } 1925 <td class="u-no-margin-on-p-elements"> 1926 <div class="u-bold">@row.Title</div> 1927 @if (!String.IsNullOrEmpty(row.SubTitle)) 1928 { 1929 if (row.Link == null) 1930 { 1931 <div>@row.SubTitle</div> 1932 } 1933 else 1934 { 1935 <a href="@row.Link" class="u-color-inherit">@row.SubTitle</a> 1936 } 1937 } 1938 </td> 1939 </tr> 1940 } 1941 </table> 1942 } 1943 } 1944 @using System.Reflection 1945 @using Dynamicweb.Rapido.Blocks.Components 1946 @using Dynamicweb.Rapido.Blocks.Components.Articles 1947 @using Dynamicweb.Rapido.Blocks 1948 1949 @* Component for the articles *@ 1950 1951 @helper RenderArticleGalleryModal(ArticleGalleryModal settings) 1952 { 1953 dynamic[] methodParameters = new dynamic[1]; 1954 methodParameters[0] = settings; 1955 MethodInfo customMethod = this.GetType().GetMethod(settings.HelperName + "Custom"); 1956 1957 if (customMethod != null) 1958 { 1959 @customMethod.Invoke(this, methodParameters).ToString(); 1960 } 1961 else 1962 { 1963 <input type="checkbox" id="ParagraphGalleryModalTrigger" class="modal-trigger" /> 1964 <div class="modal-container"> 1965 <label for="ParagraphGalleryModalTrigger" id="ParagraphGalleryModalOverlay" class="modal-overlay"></label> 1966 <div class="modal modal--full" id="ParagraphGalleryModal"> 1967 <div class="modal__body modal__body--full"> 1968 <div class="modal__image-min-size-wrapper"> 1969 <img src="/Files/Images/placeholder.gif" id="ParagraphGallery" class="modal--full__img dw-mod" alt=""> 1970 </div> 1971 <div class="modal__images-counter" id="ParagraphGallery_counter"></div> 1972 <button class="modal__prev-btn dw-mod" id="ParagraphGallery_prev" onclick="Gallery.prevImage('ParagraphGallery')" type="button"> 1973 <i class="far fa-angle-left"></i> 1974 </button> 1975 <button class="modal__next-btn dw-mod" id="ParagraphGallery_next" onclick="Gallery.nextImage('ParagraphGallery')" type="button"> 1976 <i class="far fa-angle-right"></i> 1977 </button> 1978 </div> 1979 <label class="modal__close-btn" for="ParagraphGalleryModalTrigger"></label> 1980 </div> 1981 </div> 1982 } 1983 } 1984 @using System.Reflection 1985 @using Dynamicweb.Rapido.Blocks.Components 1986 @using Dynamicweb.Rapido.Blocks.Components.Articles 1987 @using Dynamicweb.Rapido.Blocks 1988 1989 1990 @* Component for the articles *@ 1991 1992 @helper RenderArticleRelated(ArticleRelated settings) 1993 { 1994 string cardClass = Pageview.Device.ToString() != "Tablet" ? "card u-color-light--bg u-full-height" : ""; 1995 string cardFooterClass = Pageview.Device.ToString() != "Tablet" ? "card-footer u-color-light--bg" : ""; 1996 1997 <section class="multiple-paragraphs-container u-color-light-gray--bg paragraph-container--full-width"> 1998 <div class="center-container dw-mod"> 1999 <div class="grid u-padding"> 2000 <div class="grid__col-md-12 grid__col-xs-12"> 2001 <h2 class="article__header u-no-margin u-margin-top">@settings.Title</h2> 2002 </div> 2003 </div> 2004 2005 <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> 2006 2007 <script id="RelatedSimpleTemplate" type="text/x-template"> 2008 {{#.}} 2009 <div class="grid u-padding-bottom--lg"> 2010 {{#Cases}} 2011 <div class="grid__col-3 image-hover--zoom dw-mod"> 2012 <a href="{{link}}" class="u-full-height u-color-light--bg"> 2013 {{#if image}} 2014 <div class="u-color-light--bg u-no-padding dw-mod"> 2015 <div class="flex-img image-hover__wrapper"> 2016 <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}}" /> 2017 </div> 2018 </div> 2019 {{/if}} 2020 2021 <div class="card u-color-light--bg dw-mod"> 2022 <h3 class="article-list__item-header u-truncate-text dw-mod">{{title}}</h3> 2023 <p class="article__short-summary dw-mod">{{summary}}</p> 2024 </div> 2025 </a> 2026 </div> 2027 {{/Cases}} 2028 </div> 2029 {{/.}} 2030 </script> 2031 </div> 2032 </section> 2033 } 2034 @using System.Reflection 2035 @using Dynamicweb.Rapido.Blocks.Components 2036 @using Dynamicweb.Rapido.Blocks.Components.Articles 2037 @using Dynamicweb.Rapido.Blocks 2038 2039 2040 @* Component for the articles *@ 2041 2042 @helper RenderArticleMenu(ArticleMenu settings) 2043 { 2044 dynamic[] methodParameters = new dynamic[1]; 2045 methodParameters[0] = settings; 2046 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleMenuCustom"); 2047 2048 if (customMethod != null) 2049 { 2050 @customMethod.Invoke(this, methodParameters).ToString(); 2051 } else { 2052 if (!String.IsNullOrEmpty(settings.Title)) { 2053 <div class="u-margin u-border-bottom"> 2054 <h3 class="u-no-margin">@settings.Title</h3> 2055 </div> 2056 } 2057 2058 <ul class="menu-left u-margin-bottom dw-mod"> 2059 @foreach (var item in settings.Items) 2060 { 2061 @RenderArticleMenuItem(item) 2062 } 2063 </ul> 2064 } 2065 } 2066 2067 @helper RenderArticleMenuItem(ArticleMenuItem settings) 2068 { 2069 dynamic[] methodParameters = new dynamic[1]; 2070 methodParameters[0] = settings; 2071 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleMenuItemCustom"); 2072 2073 if (customMethod != null) 2074 { 2075 @customMethod.Invoke(this, methodParameters).ToString(); 2076 } else { 2077 string link = !String.IsNullOrEmpty(settings.Link) ? settings.Link : "#"; 2078 2079 if (!String.IsNullOrEmpty(settings.Title)) { 2080 <li class="menu-left__item dw-mod"> 2081 <a href="@link" onclick="@settings.OnClick" class="menu-left__link dw-mod">@settings.Title</a> 2082 </li> 2083 } 2084 } 2085 } 2086 @using System.Reflection 2087 @using Dynamicweb.Rapido.Blocks.Components 2088 @using Dynamicweb.Rapido.Blocks.Components.Articles 2089 @using Dynamicweb.Rapido.Blocks 2090 2091 @* Component for the articles *@ 2092 2093 @helper RenderArticleList(ArticleList settings) 2094 { 2095 dynamic[] methodParameters = new dynamic[1]; 2096 methodParameters[0] = settings; 2097 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListCustom"); 2098 2099 if (customMethod != null) 2100 { 2101 @customMethod.Invoke(this, methodParameters).ToString(); 2102 } else { 2103 if (Pageview != null) 2104 { 2105 bool isParagraph = Pageview.CurrentParagraph != null ? true : false; 2106 string[] sortArticlesListBy = new string[2]; 2107 2108 if (isParagraph) { 2109 sortArticlesListBy = Pageview.CurrentParagraph.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString()) ? Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" }; 2110 } 2111 else { 2112 sortArticlesListBy = Pageview.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.Item["SortArticlesListBy"].ToString()) ? Pageview.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" }; 2113 } 2114 2115 string sourcePage = settings.SourcePage != null ? settings.SourcePage : Pageview.ID.ToString(); 2116 2117 @RenderItemList(new 2118 { 2119 ItemType = !String.IsNullOrEmpty(settings.ItemType) ? settings.ItemType : "DynamicArticle", 2120 ListSourceType = settings.SourceType, 2121 ListSourcePage = sourcePage, 2122 ItemFieldsList = "*", 2123 Filter = settings.Filter, 2124 ListOrderBy = sortArticlesListBy[0], 2125 ListOrderByDirection = sortArticlesListBy[1], 2126 ListSecondOrderBy = sortArticlesListBy[0] == "Date" ? "InFocusSortId" : "Date", 2127 ListSecondOrderByDirection = "ASC", 2128 IncludeAllChildItems = true, 2129 ListTemplate = settings.Template, 2130 ListPageSize = settings.PageSize.ToString() 2131 }); 2132 } 2133 } 2134 } 2135 @using System.Reflection 2136 @using Dynamicweb.Rapido.Blocks.Components.Articles 2137 2138 2139 @* Component for the articles *@ 2140 2141 @helper RenderArticleSummary(ArticleSummary settings) 2142 { 2143 dynamic[] methodParameters = new dynamic[1]; 2144 methodParameters[0] = settings; 2145 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSummaryCustom"); 2146 2147 if (customMethod != null) 2148 { 2149 @customMethod.Invoke(this, methodParameters).ToString(); 2150 } else { 2151 if (!String.IsNullOrEmpty(settings.Text)) 2152 { 2153 <div class="article__summary dw-mod">@settings.Text</div> 2154 } 2155 } 2156 } 2157 @using System.Reflection 2158 @using Dynamicweb.Rapido.Blocks.Components 2159 @using Dynamicweb.Rapido.Blocks.Components.Articles 2160 @using Dynamicweb.Rapido.Blocks 2161 2162 @* Component for the articles *@ 2163 2164 @helper RenderArticleListCategoryFilter(ArticleListCategoryFilter settings) 2165 { 2166 dynamic[] methodParameters = new dynamic[1]; 2167 methodParameters[0] = settings; 2168 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListCategoryFilterCustom"); 2169 2170 if (customMethod != null) 2171 { 2172 @customMethod.Invoke(this, methodParameters).ToString(); 2173 } else { 2174 string pageId = Pageview.ID.ToString(); 2175 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("sourcePage")) ? HttpContext.Current.Request.QueryString.Get("sourcePage") : Translate("All"); 2176 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString()); 2177 2178 foreach (var option in settings.Categories) 2179 { 2180 selectedFilter = selectedFilter == option.Value ? option.Key : selectedFilter; 2181 } 2182 2183 if (selectedFilter == pageId) 2184 { 2185 selectedFilter = Translate("All"); 2186 } 2187 2188 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 2189 { 2190 <div class="u-pull--right u-margin-left"> 2191 <div class="collection u-no-margin"> 2192 <h5>@Translate("Category")</h5> 2193 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" /> 2194 <div class="dropdown u-w180px dw-mod"> 2195 <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label> 2196 <div class="dropdown__content dw-mod"> 2197 @foreach (var option in settings.Categories) 2198 { 2199 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div> 2200 } 2201 </div> 2202 <label class="dropdown-trigger-off" for="CategorySelector"></label> 2203 </div> 2204 </div> 2205 </div> 2206 } 2207 else 2208 { 2209 <div class="u-full-width u-margin-bottom"> 2210 <h5 class="u-no-margin">@Translate("Category")</h5> 2211 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" /> 2212 <div class="dropdown u-full-width dw-mod"> 2213 <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label> 2214 <div class="dropdown__content dw-mod"> 2215 @foreach (var option in settings.Categories) 2216 { 2217 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div> 2218 } 2219 </div> 2220 <label class="dropdown-trigger-off" for="CategorySelector"></label> 2221 </div> 2222 </div> 2223 } 2224 } 2225 } 2226 @using System.Reflection 2227 @using Dynamicweb.Rapido.Blocks.Components 2228 @using Dynamicweb.Rapido.Blocks.Components.Articles 2229 @using Dynamicweb.Rapido.Blocks 2230 2231 @* Component for the articles *@ 2232 2233 @helper RenderArticleListFilter(ArticleListFilter settings) 2234 { 2235 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get(settings.SystemName)) ? HttpContext.Current.Request.QueryString.Get(settings.SystemName) : Translate("All"); 2236 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString()); 2237 2238 if (settings.Options != null) 2239 { 2240 foreach (var option in settings.Options) 2241 { 2242 selectedFilter = selectedFilter == option.Value ? option.Name : selectedFilter; 2243 } 2244 2245 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 2246 { 2247 <div class="u-pull--right u-margin-left"> 2248 <div class="collection u-no-margin"> 2249 <h5>@settings.Label</h5> 2250 <input type="checkbox" id="@(settings.SystemName)Selector" class="dropdown-trigger" /> 2251 <div class="dropdown u-w180px dw-mod"> 2252 <label class="dropdown__header dropdown__btn dw-mod" for="@(settings.SystemName)Selector">@Translate(selectedFilter)</label> 2253 <div class="dropdown__content dw-mod"> 2254 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')">@Translate("All")</div> 2255 @foreach (var option in settings.Options) 2256 { 2257 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')">@Translate(option.Name)</div> 2258 } 2259 </div> 2260 <label class="dropdown-trigger-off" for="@(settings.SystemName)Selector"></label> 2261 </div> 2262 </div> 2263 </div> 2264 } 2265 else 2266 { 2267 <div class="u-full-width u-margin-bottom"> 2268 <h5 class="u-no-margin">@settings.Label</h5> 2269 <input type="checkbox" id="@(settings.SystemName)Selector" class="dropdown-trigger" /> 2270 <div class="dropdown u-full-width w-mod"> 2271 <label class="dropdown__header dropdown__btn dw-mod" for="@(settings.SystemName)Selector">@Translate(selectedFilter)</label> 2272 <div class="dropdown__content dw-mod"> 2273 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')">@Translate("All")</div> 2274 @foreach (var option in settings.Options) 2275 { 2276 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')">@Translate(option.Name)</div> 2277 } 2278 </div> 2279 <label class="dropdown-trigger-off" for="@(settings.SystemName)Selector"></label> 2280 </div> 2281 </div> 2282 } 2283 } 2284 } 2285 @using System.Reflection 2286 @using Dynamicweb.Rapido.Blocks.Components 2287 @using Dynamicweb.Rapido.Blocks.Components.Articles 2288 @using Dynamicweb.Rapido.Blocks 2289 2290 @* Component for the articles *@ 2291 2292 @helper RenderArticleListSearch(ArticleListSearch settings) 2293 { 2294 dynamic[] methodParameters = new dynamic[1]; 2295 methodParameters[0] = settings; 2296 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListSearchCustom"); 2297 2298 if (customMethod != null) 2299 { 2300 @customMethod.Invoke(this, methodParameters).ToString(); 2301 } else { 2302 string searchString = !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("Title")) ? HttpContext.Current.Request.QueryString.Get("Title").Trim('*') : ""; 2303 string className = "u-w340px u-pull--right u-margin-left"; 2304 2305 if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet") 2306 { 2307 className = "u-full-width"; 2308 } 2309 2310 <div class="typeahead u-color-inherit u-margin-bottom dw-mod @className"> 2311 <input type="text" class="typeahead-search-field u-no-margin dw-mod" placeholder="@Translate("Search in list")" value="@searchString" id="ArticleListSearchInput" onchange="QueryArray.setParameterInCurrentURL('Title', '*' + document.getElementById('ArticleListSearchInput').value + '*')"> 2312 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod"><i class="fas fa-search"></i></button> 2313 </div> 2314 } 2315 } 2316 @using System.Reflection 2317 @using Dynamicweb.Rapido.Blocks.Components 2318 @using Dynamicweb.Rapido.Blocks.Components.Articles 2319 @using Dynamicweb.Rapido.Blocks 2320 2321 @* Component for the articles *@ 2322 2323 @helper RenderArticleListNoResultsInfo(ArticleListNoResultsInfo settings) 2324 { 2325 dynamic[] methodParameters = new dynamic[1]; 2326 methodParameters[0] = settings; 2327 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListNoResultsInfoCustom"); 2328 2329 if (customMethod != null) 2330 { 2331 @customMethod.Invoke(this, methodParameters).ToString(); 2332 } else { 2333 <div class="u-margin-top--lg u-bold u-ta-center u-bold">@Translate(settings.Message)</div> 2334 } 2335 } 2336 @using System.Reflection 2337 @using Dynamicweb.Rapido.Blocks.Components 2338 @using Dynamicweb.Rapido.Blocks.Components.General 2339 @using Dynamicweb.Rapido.Blocks.Components.Articles 2340 @using Dynamicweb.Rapido.Blocks 2341 @using System.Text.RegularExpressions 2342 2343 @* Component for the articles *@ 2344 2345 @helper RenderArticleListItem(ArticleListItem settings) 2346 { 2347 switch (settings.Type) { 2348 case ArticleListItemType.Card: 2349 @RenderArticleListItemCard(settings); 2350 break; 2351 case ArticleListItemType.List: 2352 @RenderArticleListItemList(settings); 2353 break; 2354 case ArticleListItemType.Simple: 2355 @RenderArticleListItemSimple(settings); 2356 break; 2357 default: 2358 @RenderArticleListItemCard(settings); 2359 break; 2360 } 2361 } 2362 2363 @helper RenderArticleListItemCard(ArticleListItem settings) { 2364 <a href="@settings.Link" class="u-full-height u-color-light--bg"> 2365 <div class="u-color-light--bg u-no-padding dw-mod"> 2366 @if (settings.Logo != null) 2367 { 2368 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;" : ""; 2369 settings.Logo.ImageDefault.Crop = 5; 2370 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width; 2371 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height; 2372 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage"> 2373 @if (settings.Stickers != null) 2374 { 2375 if (settings.Stickers.Position != StickersListPosition.Custom) 2376 { 2377 @RenderStickersCollection(settings.Stickers); 2378 } 2379 } 2380 @RenderImage(settings.Logo) 2381 </div> 2382 } else if (settings.Image != null) 2383 { 2384 <div class="flex-img image-hover__wrapper u-position-relative dw-mod"> 2385 @if (settings.Stickers != null) 2386 { 2387 if (settings.Stickers.Position != StickersListPosition.Custom) 2388 { 2389 @RenderStickersCollection(settings.Stickers); 2390 } 2391 } 2392 @RenderImage(settings.Image) 2393 </div> 2394 } 2395 </div> 2396 2397 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary)) 2398 { 2399 <div class="card u-color-light--bg dw-mod"> 2400 @if (settings.Stickers != null) 2401 { 2402 if (settings.Stickers.Position == StickersListPosition.Custom) 2403 { 2404 @RenderStickersCollection(settings.Stickers); 2405 } 2406 } 2407 @if (!String.IsNullOrEmpty(settings.Title)) 2408 { 2409 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3> 2410 } 2411 @if (!String.IsNullOrEmpty(settings.SubTitle)) 2412 { 2413 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 2414 } 2415 @if (!String.IsNullOrEmpty(settings.Summary)) 2416 { 2417 <p class="article__short-summary dw-mod">@settings.Summary</p> 2418 } 2419 </div> 2420 } 2421 </a> 2422 } 2423 2424 @helper RenderArticleListItemList(ArticleListItem settings) { 2425 <a href="@settings.Link"> 2426 <div class="grid u-color-light--bg u-no-padding dw-mod"> 2427 <div class="grid__col-md-3"> 2428 <div class="u-color-light--bg u-no-padding dw-mod"> 2429 @if (settings.Logo != null) 2430 { 2431 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;" : ""; 2432 settings.Logo.ImageDefault.Crop = 5; 2433 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width; 2434 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height; 2435 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage"> 2436 @if (settings.Stickers != null) 2437 { 2438 if (settings.Stickers.Position != StickersListPosition.Custom) 2439 { 2440 @RenderStickersCollection(settings.Stickers); 2441 } 2442 } 2443 @RenderImage(settings.Logo) 2444 </div> 2445 } else if (settings.Image != null) 2446 { 2447 <div class="flex-img image-hover__wrapper dw-mod"> 2448 @if (settings.Stickers != null) 2449 { 2450 if (settings.Stickers.Position != StickersListPosition.Custom) 2451 { 2452 @RenderStickersCollection(settings.Stickers); 2453 } 2454 } 2455 @RenderImage(settings.Image) 2456 </div> 2457 } 2458 </div> 2459 </div> 2460 2461 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary)) 2462 { 2463 <div class="grid__col-md-9"> 2464 @if (!String.IsNullOrEmpty(settings.Title)) 2465 { 2466 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3> 2467 } 2468 @if (settings.Stickers != null) 2469 { 2470 if (settings.Stickers.Position == StickersListPosition.Custom) 2471 { 2472 @RenderStickersCollection(settings.Stickers); 2473 } 2474 } 2475 @if (!String.IsNullOrEmpty(settings.SubTitle)) 2476 { 2477 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 2478 } 2479 @if (!String.IsNullOrEmpty(settings.Summary)) 2480 { 2481 <p class="article__short-summary dw-mod">@settings.Summary</p> 2482 } 2483 </div> 2484 } 2485 </div> 2486 </a> 2487 } 2488 2489 @helper RenderArticleListItemSimple(ArticleListItem settings) { 2490 <a href="@settings.Link" class="u-color-inherit"> 2491 <div class="grid u-color-light--bg u-no-padding dw-mod"> 2492 <div class="grid__col-md-12"> 2493 @if (!String.IsNullOrEmpty(settings.Title)) 2494 { 2495 <div class="article-list-item__header u-truncate-text u-no-margin dw-mod">@settings.Title</div> 2496 } 2497 @if (!String.IsNullOrEmpty(settings.SubTitle)) 2498 { 2499 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 2500 } 2501 </div> 2502 </div> 2503 </a> 2504 } 2505 @using System.Reflection 2506 @using Dynamicweb.Rapido.Blocks.Components.Articles 2507 2508 2509 @* Component for the articles *@ 2510 2511 @helper RenderArticleAuthorAndDate(ArticleAuthorAndDate settings) 2512 { 2513 dynamic[] methodParameters = new dynamic[1]; 2514 methodParameters[0] = settings; 2515 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleAuthorAndDateCustom"); 2516 2517 if (customMethod != null) 2518 { 2519 @customMethod.Invoke(this, methodParameters).ToString(); 2520 } else { 2521 <small class="article__subscription"> 2522 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date))) 2523 { 2524 <text>@Translate("Written")</text> 2525 } 2526 @if (!string.IsNullOrWhiteSpace(settings.Author)) 2527 { 2528 <text>@Translate("by") @settings.Author</text> 2529 } 2530 @if (!string.IsNullOrWhiteSpace(settings.Date)) 2531 { 2532 <text>@Translate("on") @settings.Date</text> 2533 } 2534 </small> 2535 } 2536 } 2537 @using System.Reflection 2538 @using Dynamicweb.Rapido.Blocks.Components.Articles 2539 2540 2541 @* Component for the articles *@ 2542 2543 @helper RenderArticleLink(ArticleLink settings) 2544 { 2545 dynamic[] methodParameters = new dynamic[1]; 2546 methodParameters[0] = settings; 2547 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleLinkCustom"); 2548 2549 if (customMethod != null) 2550 { 2551 @customMethod.Invoke(this, methodParameters).ToString(); 2552 } else { 2553 if (!String.IsNullOrEmpty(settings.Title)) 2554 { 2555 <div class="grid__cell"> 2556 @RenderButton(settings) 2557 </div> 2558 } 2559 } 2560 } 2561 @using System.Reflection 2562 @using Dynamicweb.Rapido.Blocks 2563 @using Dynamicweb.Rapido.Blocks.Components.Articles 2564 @using Dynamicweb.Rapido.Blocks.Components.General 2565 2566 2567 @* Component for the articles *@ 2568 2569 @helper RenderArticleCarousel(ArticleCarousel settings) 2570 { 2571 dynamic[] methodParameters = new dynamic[1]; 2572 methodParameters[0] = settings; 2573 MethodInfo customMethod = this.GetType().GetMethod(settings.HelperName + "Custom"); 2574 2575 if (customMethod != null) 2576 { 2577 @customMethod.Invoke(this, methodParameters).ToString(); 2578 } else { 2579 <div class="grid"> 2580 <div class="grid__col-12"> 2581 <div class="carousel" id="carousel_@settings.Id"> 2582 <div class="carousel__container js-carousel-slides dw-mod"> 2583 @RenderBlockList(settings.SubBlocks) 2584 </div> 2585 </div> 2586 </div> 2587 </div> 2588 2589 <script> 2590 document.addEventListener("DOMContentLoaded", function () { 2591 new CarouselModule("#carousel_@settings.Id", { 2592 slideTime: 0, 2593 dots: true 2594 }); 2595 }); 2596 </script> 2597 } 2598 } 2599 2600 @helper RenderArticleCarouselSlide(ArticleCarouselSlide settings) 2601 { 2602 dynamic[] methodParameters = new dynamic[1]; 2603 methodParameters[0] = settings; 2604 MethodInfo customMethod = this.GetType().GetMethod(settings.HelperName + "Custom"); 2605 2606 if (customMethod != null) 2607 { 2608 @customMethod.Invoke(this, methodParameters).ToString(); 2609 } 2610 else 2611 { 2612 string imageEngine = "/Admin/Public/GetImage.ashx?"; 2613 2614 string defaultImage = settings.ImageSettings != null ? imageEngine : settings.Image; 2615 if (settings.ImageSettings != null) 2616 { 2617 defaultImage += settings.ImageSettings.Width != 0 ? "Width=" + settings.ImageSettings.Width + "&" : ""; 2618 defaultImage += settings.ImageSettings.Height != 0 ? "Height=" + settings.ImageSettings.Height + "&" : ""; 2619 defaultImage += "Crop=" + settings.ImageSettings.Crop + "&"; 2620 defaultImage += "Compression=" + settings.ImageSettings.Compression + "&"; 2621 defaultImage += "DoNotUpscale=" + settings.ImageSettings.DoNotUpscale.ToString() + "&"; 2622 defaultImage += "FillCanvas=" + settings.ImageSettings.FillCanvas.ToString() + "&"; 2623 } 2624 defaultImage += "&Image=" + settings.Image; 2625 2626 <div class="carousel__slide u-min-h300px u-flex dw-mod" style="background-size:cover; background-image:url('@defaultImage')"> 2627 <a class="article-carousel-item__wrap" href="@settings.Link" title="@settings.Title"> 2628 <h2 class="article-list__item-header u-truncate-text u-color-light dw-mod">@settings.Title</h2> 2629 <div class="article-list__item-info"> 2630 @if (settings.Stickers != null) 2631 { 2632 settings.Stickers.Position = StickersListPosition.Custom; 2633 @RenderStickersCollection(settings.Stickers); 2634 } 2635 2636 <small class="u-margin-top--lg u-color-light"> 2637 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date))) 2638 { 2639 <text>@Translate("Written")</text> 2640 } 2641 @if (!string.IsNullOrWhiteSpace(settings.Author)) 2642 { 2643 <text>@Translate("by") @settings.Author</text> 2644 } 2645 @if (!string.IsNullOrWhiteSpace(settings.Date)) 2646 { 2647 <text>@Translate("on") @settings.Date</text> 2648 } 2649 </small> 2650 </div> 2651 2652 <h3 class="article__short-summary u-color-light">@settings.Summary</h3> 2653 </a> 2654 @if (settings.UseFilters == true) 2655 { 2656 <div class="background-image image-filter image-filter--darken dw-mod"></div> 2657 } 2658 </div> 2659 } 2660 } 2661 @using System.Text.RegularExpressions 2662 @using Dynamicweb.Rapido.Blocks.Components 2663 @using Dynamicweb.Rapido.Blocks.Components.General 2664 @using Dynamicweb.Rapido.Blocks.Components.Articles 2665 @using Dynamicweb.Rapido.Blocks 2666 2667 @* Component for the articles *@ 2668 2669 @helper RenderArticleVideo(ArticleVideo settings) 2670 { 2671 dynamic[] methodParameters = new dynamic[1]; 2672 methodParameters[0] = settings; 2673 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleTextCustom"); 2674 2675 if (customMethod != null) 2676 { 2677 @customMethod.Invoke(this, methodParameters).ToString(); 2678 } else { 2679 if (settings.Url != null) 2680 { 2681 //getting video ID from youtube URL 2682 string videoCode = settings.Url; 2683 Regex regex = new Regex(@".be\/(.[^?]*)"); 2684 Match match = regex.Match(videoCode); 2685 string videoId = ""; 2686 if (match.Success) 2687 { 2688 videoId = match.Groups[1].Value; 2689 } 2690 else 2691 { 2692 regex = new Regex(@"v=([^&]+)"); 2693 match = regex.Match(videoCode); 2694 if (match.Success) 2695 { 2696 videoId = match.Groups[1].Value; 2697 } 2698 } 2699 2700 int autoPlay = settings.AutoPlay == "true" ? 1 : 0; 2701 2702 <div class="video-wrapper"> 2703 <div class="js-youtube-video" data-video="@videoId" id="ytPlayer@(Guid.NewGuid().ToString("N"))" data-auto-play="@autoPlay" data-enable-controls="1"></div> 2704 </div> 2705 } 2706 } 2707 } 2708 2709 2710 2711 @* Simple helpers *@ 2712 2713 @*Requires the Gallery ItemType that comes with Rapido*@ 2714 @helper RenderArticleItemGallery(IList<ItemViewModel> gallery) { 2715 if (gallery != null && gallery.Count > 0) 2716 { 2717 int count = 1; 2718 2719 foreach (var item in gallery) 2720 { 2721 if (item.GetFile("ImagePath") != null) 2722 { 2723 string image = item.GetFile("ImagePath").PathUrlEncoded; 2724 string imagePrefix = "/Admin/Public/GetImage.ashx?width=1200&amp;height=820&amp;crop=5&amp;Compression=75&amp;DoNotUpscale=1&amp;image="; 2725 int imagesCount = gallery.Count; 2726 2727 if (count == 1) 2728 { 2729 <label class="gallery" for="ParagraphGalleryModalTrigger" onclick="Gallery.openImage(this.querySelector('.js-gallery'))"> 2730 <span class="gallery__main-image"> 2731 <img src="/Admin/Public/GetImage.ashx?width=992&amp;height=760&amp;crop=0&amp;Compression=75&amp;DoNotUpscale=1&amp;image=@image" class="flex-img js-gallery" alt="" data-for="ParagraphGallery" data-image="@imagePrefix@image" /> 2732 </span> 2733 <span class="gallery__image-counter"> 2734 <i class="fas fa-camera fa-2x"></i> <span class="gallery__image-counter__number">@imagesCount</span> 2735 <span class="gallery__image-counter__text">@Translate("See all") <i class="fas fa-angle-right"></i></span> 2736 </span> 2737 </label> 2738 } 2739 else 2740 { 2741 <div class="u-hidden js-gallery" data-for="ParagraphGallery" data-image="@imagePrefix@image"></div> 2742 } 2743 2744 count++; 2745 } 2746 } 2747 @RenderArticleGalleryModal(new ArticleGalleryModal()) 2748 } 2749 } 2750 2751 @helper RenderMobileFilters(List<Block> subBlocks) 2752 { 2753 if (subBlocks.Count > 0) 2754 { 2755 <div class="grid__col-12"> 2756 <input type="checkbox" id="CheckFilters" class="js-remember-state u-hidden" data-expand="CheckFilters" /> 2757 <div class="grid u-margin-bottom dw-mod" data-trigger="CheckFilters"> 2758 @RenderBlockList(subBlocks) 2759 </div> 2760 <label for="CheckFilters" class="btn btn--secondary btn--full dw-mod js-expand-hide" data-trigger="CheckFilters">@Translate("Select filters")</label> 2761 <label for="CheckFilters" class="btn btn--secondary btn--full dw-mod expandable--collapsed" data-trigger="CheckFilters">@Translate("Close filters")</label> 2762 </div> 2763 } 2764 } 2765 2766 @if (File.Exists(HttpContext.Current.Server.MapPath("/Components/Custom/Custom__Components.cshtml"))) 2767 { 2768 <text>@using Dynamicweb.Rapido.Blocks.Components.General 2769 </text> 2770 } 2771 2772 2773 @* Include the Blocks for the page *@ 2774 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2775 2776 @using System 2777 @using System.Web 2778 @using System.Collections.Generic 2779 @using Dynamicweb.Rapido.Blocks.Extensibility 2780 @using Dynamicweb.Rapido.Blocks 2781 2782 @{ 2783 BlocksPage topSnippetsBlocksPage = BlocksPage.GetBlockPage("Master"); 2784 2785 Block tagManager = new Block() 2786 { 2787 Id = "TagManager", 2788 SortId = 1, 2789 Template = RenderGoogleTagManager() 2790 }; 2791 2792 Block facebookPixel = new Block() 2793 { 2794 Id = "FacebookPixel", 2795 SortId = 2, 2796 Template = RenderFacebookPixel() 2797 }; 2798 2799 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, tagManager); 2800 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, facebookPixel); 2801 } 2802 2803 @helper RenderGoogleTagManager() { 2804 string GoogleTagManagerID = Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID"); 2805 2806 if (!string.IsNullOrWhiteSpace(GoogleTagManagerID)) 2807 { 2808 <script> 2809 (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': 2810 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], 2811 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 2812 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); 2813 })(window,document,'script','dataLayer','@GoogleTagManagerID'); 2814 </script> 2815 <!-- Google Tag Manager (noscript) --> 2816 <noscript> 2817 <iframe src="https://www.googletagmanager.com/ns.html?id=@GoogleTagManagerID" 2818 height="0" width="0" style="display:none;visibility:hidden"></iframe> 2819 </noscript> 2820 <!-- End Google Tag Manager (noscript) --> 2821 } 2822 } 2823 2824 @helper RenderFacebookPixel() { 2825 string FacebookPixelID = Model.Area.Item.GetItem("Settings").GetString("FacebookPixelID"); 2826 2827 bool DoNotTrackForURL = false; 2828 string currentURL = HttpContext.Current.Request.Url.AbsoluteUri; 2829 //Logger.Instance.Log(ErrorLevel.DebugInfo,"TopSnippets.cshtml URL: " + currentURL); 2830 if (currentURL.Contains("create-user-profile") || currentURL.Contains("existing-customer") || currentURL.Contains("UserManagementForm") || currentURL.Contains("customer") 2831 || currentURL.Contains("FirstName") || currentURL.Contains("First Name") 2832 || currentURL.Contains("LastName") || currentURL.Contains("Last Name") 2833 || currentURL.Contains("DateOfBirth") || currentURL.Contains("Form_Email") 2834 || currentURL.Contains("ID=59") || currentURL.Contains("ID=2227") 2835 || currentURL.Contains("ID=2319") || currentURL.Contains("ID=2320") 2836 || currentURL.Contains("ID=2321") || currentURL.Contains("ID=2322") 2837 || currentURL.Contains("ID=2323") || currentURL.Contains("ID=2324") 2838 || currentURL.Contains("ID=2335") || currentURL.Contains("ID=2336") 2839 || currentURL.Contains("ID=2337") || currentURL.Contains("ID=2338") 2840 || currentURL.Contains("ID=2339") || currentURL.Contains("ID=2340") 2841 || currentURL.Contains("ID=2341") || currentURL.Contains("ID=2342") 2842 || currentURL.Contains("ID=2343") || currentURL.Contains("ID=2344") 2843 || currentURL.Contains("ID=2345") || currentURL.Contains("ID=2346") 2844 || currentURL.Contains("ID=2347") || currentURL.Contains("ID=2348")) 2845 { 2846 DoNotTrackForURL = true; 2847 } 2848 2849 if (!string.IsNullOrWhiteSpace(FacebookPixelID) && !DoNotTrackForURL) 2850 { 2851 <!-- Facebook Pixel Code --> 2852 <script> 2853 !function(f,b,e,v,n,t,s) 2854 {if(f.fbq)return;n=f.fbq=function(){n.callMethod? 2855 n.callMethod.apply(n,arguments):n.queue.push(arguments)}; 2856 if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0'; 2857 n.queue=[];t=b.createElement(e);t.async=!0; 2858 t.src=v;s=b.getElementsByTagName(e)[0]; 2859 s.parentNode.insertBefore(t,s)}(window, document,'script', 2860 'https://connect.facebook.net/en_US/fbevents.js'); 2861 fbq('init', '@FacebookPixelID'); 2862 fbq('track', 'PageView'); 2863 </script> 2864 <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=@FacebookPixelID&ev=PageView&noscript=1" alt="" /></noscript> 2865 } 2866 } 2867 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2868 2869 @using System 2870 @using System.Web 2871 @using System.Collections.Generic 2872 @using Dynamicweb.Rapido.Blocks 2873 @using Dynamicweb.Rapido.Blocks.Extensibility 2874 @using Dynamicweb.Security.UserManagement 2875 @using Dynamicweb.Security.UserManagement.ExternalAuthentication 2876 @{ 2877 BlocksPage loginBlocksPage = BlocksPage.GetBlockPage("Master"); 2878 2879 Block loginModal = new Block() 2880 { 2881 Id = "LoginModal", 2882 SortId = 10, 2883 Template = LoginModal() 2884 }; 2885 2886 loginBlocksPage.Add(MasterBlockId.MasterTopSnippets, loginModal); 2887 } 2888 2889 @helper LoginModal() { 2890 int pageId = Model.TopPage.ID; 2891 pageId = 3;//CS NT Test for rredirect 2892 string userSignedInError = !Model.LogOnFailed ? "" : "checked"; 2893 string userSignedInErrorText = ""; 2894 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 2895 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; 2896 //CS NT int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 2897 int createAccountPageId = GetPageIdByNavigationTag("CreateECommerceAccount"); 2898 2899 if (Model.LogOnFailed) { 2900 switch (Model.LogOnFailedReason) 2901 { 2902 case LogOnFailedReason.PasswordLengthInvalid: 2903 userSignedInErrorText = Translate("Password length is invalid"); 2904 break; 2905 case LogOnFailedReason.IncorrectLogin: 2906 userSignedInErrorText = Translate("Invalid email or password"); 2907 break; 2908 case LogOnFailedReason.ExceededFailedLogOnLimit: 2909 userSignedInErrorText = Translate("You have exceeded the limit of allowed login attempts. The user account is temporarily locked"); 2910 break; 2911 case LogOnFailedReason.LoginLocked: 2912 userSignedInErrorText = Translate("The user account is temporarily locked"); 2913 break; 2914 case LogOnFailedReason.PasswordExpired: 2915 userSignedInErrorText = Translate("The password has expired and needs to be renewed"); 2916 break; 2917 default: 2918 userSignedInErrorText = Translate("An unknown error occured"); 2919 break; 2920 } 2921 } 2922 2923 <!-- Trigger for the login modal --> 2924 <!--CS NT Hide Pop up sign in --> 2925 if (Pageview.Device.ToString() != "Desktop") 2926 { 2927 <input type="checkbox" id="SignInModalTrigger" class="modal-trigger" @userSignedInError /> 2928 } 2929 2930 <!-- Login modal --> 2931 <div class="modal-container"> 2932 <label for="SignInModalTrigger" id="SignInModalOverlay" class="modal-overlay"></label> 2933 <div class="modal modal--xs" id="SignInModal"> 2934 <div class="modal__header"> 2935 <h2>@Translate("Sign in")</h2> 2936 </div> 2937 <div class="modal__body"> 2938 <form method="post" id="LoginForm" class="u-no-margin"> 2939 <input type="hidden" name="ID" value="@pageId" /> 2940 <input type="hidden" name="DWExtranetUsernameRemember" value="True" /> 2941 <input type="hidden" name="DWExtranetPasswordRemember" value="True" /> 2942 <input type="text" class="u-full-width" id="LoginUsername" name="username" placeholder="@Translate("Email")" /> 2943 <input type="password" class="u-full-width" id="LoginPassword" name="password" placeholder="@Translate("Password")" /> 2944 <div class="field-error dw-mod">@userSignedInErrorText</div> 2945 2946 <div class="form__field-group dw-mod"> 2947 <input type="checkbox" id="LoginRememberMe" name="Autologin" checked="checked" value="True" class="form__control"> 2948 <label for="LoginRememberMe"> 2949 @Translate("Remember me", "Remember me") 2950 </label> 2951 </div> 2952 2953 <button type="submit" class="btn btn--primary btn--full dw-mod" name="LoginAction" value="Login" onclick="Buttons.LockButton(event)">@Translate("Sign in")</button> 2954 @{ 2955 ProviderCollection providers = Provider.GetActiveProviders(); 2956 } 2957 2958 @foreach(Provider LoginProvider in providers) 2959 { 2960 var ProviderName = LoginProvider.Name.ToLower(); 2961 <a href="/Admin/Public/Social/ExternalLogin.aspx?action=login&providerID=@LoginProvider.ID" title="@LoginProvider.Name" class="btn btn--clean btn--condensed u-color-@ProviderName dw-mod"><i class="fab fa-@ProviderName fa-1_5x"></i></a> 2962 } 2963 2964 <a class="btn btn--link-clean dw-mod" href="@forgotPasswordPageLink">@Translate("Forgot your password?", "Forgot your password?")</a> 2965 2966 <!-- CS NT<a class="btn btn--link-clean dw-mod" href="/default.aspx?ID=@createAccountPageId">@Translate("Create account")?</a> --> 2967 <a class="btn btn--link-clean dw-mod" href="/default.aspx?ID=@createAccountPageId">@Translate("Create account")?</a> 2968 </form> 2969 </div> 2970 </div> 2971 </div> 2972 } 2973 2974 @if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet") 2975 { 2976 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 2977 2978 @using System 2979 @using System.Web 2980 @using System.Collections.Generic 2981 @using Dynamicweb.Rapido.Blocks.Extensibility 2982 @using Dynamicweb.Rapido.Blocks 2983 2984 2985 @functions { 2986 BlocksPage mobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master"); 2987 } 2988 2989 @{ 2990 bool mobileOnlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("mobileOnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 2991 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"; 2992 bool mobileHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 2993 bool mobileHideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart") || mobileOnlyPreview; 2994 2995 Block mobileHeader = new Block() 2996 { 2997 Id = "MobileTop", 2998 SortId = 10, 2999 Template = RenderMobileTop(), 3000 SkipRenderBlocksList = true 3001 }; 3002 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeader); 3003 3004 Block mobileHeaderNavigation = new Block() 3005 { 3006 Id = "MobileHeaderNavigation", 3007 SortId = 10, 3008 Template = RenderMobileHeaderNavigation(), 3009 SkipRenderBlocksList = true, 3010 BlocksList = new List<Block> { 3011 new Block { 3012 Id = "MobileHeaderNavigationTrigger", 3013 SortId = 10, 3014 Template = RenderMobileHeaderNavigationTrigger() 3015 } 3016 } 3017 }; 3018 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderNavigation); 3019 3020 Block mobileHeaderLogo = new Block() 3021 { 3022 Id = "MobileHeaderLogo", 3023 SortId = 20, 3024 Template = RenderMobileHeaderLogo(), 3025 SkipRenderBlocksList = true 3026 }; 3027 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderLogo); 3028 3029 Block mobileHeaderActions = new Block() 3030 { 3031 Id = "MobileHeaderActions", 3032 SortId = 30, 3033 Template = RenderMobileTopActions(), 3034 SkipRenderBlocksList = true 3035 }; 3036 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderActions); 3037 3038 if (mobileHideSearch == false) 3039 { 3040 Block mobileHeaderSearch = new Block 3041 { 3042 Id = "MobileHeaderSearch", 3043 SortId = 10, 3044 Template = RenderMobileTopSearch() 3045 }; 3046 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderSearch); 3047 } 3048 3049 Block mobileHeaderMiniCart; 3050 3051 if (!mobileHideCart) 3052 { 3053 mobileHeaderMiniCart = new Block 3054 { 3055 Id = "MobileHeaderMiniCart", 3056 SortId = 20, 3057 Template = RenderMobileTopMiniCart() 3058 }; 3059 3060 Block miniCartCounterScriptTemplate = new Block 3061 { 3062 Id = "MiniCartCounterScriptTemplate", 3063 Template = RenderMobileMiniCartCounterContent() 3064 }; 3065 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate); 3066 } 3067 else 3068 { 3069 mobileHeaderMiniCart = new Block 3070 { 3071 Id = "MobileHeaderMiniCart", 3072 SortId = 20 3073 }; 3074 } 3075 3076 if (!mobileHideSearch) 3077 { 3078 Block mobileHeaderSearchBar = new Block() 3079 { 3080 Id = "MobileHeaderSearchBar", 3081 SortId = 30, 3082 Template = RenderMobileTopSearchBar() 3083 }; 3084 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeaderSearchBar); 3085 } 3086 3087 switch (mobileTopLayout) 3088 { 3089 case "nav-left": 3090 mobileHeaderNavigation.SortId = 10; 3091 mobileHeaderLogo.SortId = 20; 3092 mobileHeaderActions.SortId = 30; 3093 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart); 3094 break; 3095 case "nav-right": 3096 mobileHeaderLogo.SortId = 10; 3097 mobileHeaderActions.SortId = 20; 3098 mobileHeaderNavigation.SortId = 30; 3099 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart); 3100 break; 3101 case "nav-search-left": 3102 mobileHeaderNavigation.SortId = 10; 3103 mobileHeaderLogo.SortId = 20; 3104 mobileHeaderActions.SortId = 30; 3105 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart); 3106 break; 3107 case "search-left": 3108 mobileHeaderActions.SortId = 10; 3109 mobileHeaderLogo.SortId = 20; 3110 mobileHeaderNavigation.SortId = 30; 3111 mobileHeaderMiniCart.SortId = 0; 3112 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart); 3113 break; 3114 } 3115 3116 if (!mobileOnlyPreview) 3117 { 3118 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", new Block { 3119 Id = "CartInitialization", 3120 Template = RenderMobileCartInitialization() 3121 }); 3122 } 3123 } 3124 3125 @helper RenderMobileCartInitialization() 3126 { 3127 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 3128 <script> 3129 window.cartId = "@miniCartFeedPageId"; 3130 </script> 3131 } 3132 3133 @helper RenderMobileTop() { 3134 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileTop").OrderBy(item => item.SortId).ToList(); 3135 3136 <nav class="main-navigation-mobile dw-mod"> 3137 <div class="center-container top-container__center-container dw-mod"> 3138 <div class="grid grid--align-center"> 3139 @RenderBlockList(subBlocks) 3140 </div> 3141 </div> 3142 </nav> 3143 } 3144 3145 @helper RenderMobileHeaderNavigation() { 3146 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderNavigation").OrderBy(item => item.SortId).ToList(); 3147 3148 <div class="grid__col-auto-width"> 3149 <ul class="menu dw-mod"> 3150 @RenderBlockList(subBlocks) 3151 </ul> 3152 </div> 3153 } 3154 3155 @helper RenderMobileHeaderNavigationTrigger() { 3156 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 3157 <label for="MobileNavTrigger" class="mobile-nav-trigger-button menu__link menu__link--icon menu__link--mobile dw-mod"></label> 3158 </li> 3159 } 3160 3161 @helper RenderMobileHeaderLogo() { 3162 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderLogo").OrderBy(item => item.SortId).ToList(); 3163 3164 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"; 3165 string centeredLogo = mobileTopLayout != "nav-right" ? "u-ta-center" : ""; 3166 string firstPageId = Model.Area.FirstActivePage.ID.ToString(); 3167 string businessName = Model.Area.Item.GetItem("Settings").GetString("BusinessName"); 3168 3169 string mobileLogo = "/Files/Images/logo-dynamicweb.png"; 3170 if (Model.Area.Item.GetItem("Layout").GetItem("MobileTop") != null && Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo") != null) 3171 { 3172 mobileLogo = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo").PathUrlEncoded; 3173 } 3174 3175 if (Path.GetExtension(mobileLogo).ToLower() != ".svg") 3176 { 3177 mobileLogo = "/Admin/Public/GetImage.ashx?height=40&amp;crop=5&amp;Compression=75&amp;image=" + mobileLogo; 3178 } 3179 else 3180 { 3181 mobileLogo = HttpUtility.UrlDecode(mobileLogo); 3182 } 3183 3184 <div class="grid__col-auto grid__col--bleed"> 3185 <div class="grid__cell @centeredLogo"> 3186 <a href="/Default.aspx?ID=@firstPageId" class="logo logo--mobile u-inline-block dw-mod"> 3187 <img class="grid__cell-img logo__img logo__img--mobile dw-mod" src="@mobileLogo" alt="@businessName" /> 3188 </a> 3189 </div> 3190 3191 @RenderBlockList(subBlocks) 3192 </div> 3193 } 3194 3195 @helper RenderMobileTopActions() { 3196 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderActions").OrderBy(item => item.SortId).ToList(); 3197 3198 <div class="grid__col-auto-width"> 3199 <ul class="menu dw-mod"> 3200 @RenderBlockList(subBlocks) 3201 </ul> 3202 </div> 3203 } 3204 3205 @helper RenderMobileTopSearch() { 3206 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 3207 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> 3208 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> 3209 </label> 3210 </li> 3211 } 3212 3213 @helper RenderMobileTopMiniCart() { 3214 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 3215 int cartPageId = GetPageIdByNavigationTag("CartPage"); 3216 double cartProductsCount = Model.Cart.TotalProductsCount; 3217 3218 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod" id="miniCartWrapper"> 3219 <div class="mini-cart dw-mod"> 3220 <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"> 3221 <div class="u-inline u-position-relative"> 3222 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue fa-1_5x"></i> 3223 <div class="mini-cart__counter dw-mod"> 3224 <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"> 3225 <div class="js-mini-cart-counter-content" data-count="@cartProductsCount"> 3226 @cartProductsCount 3227 </div> 3228 </div> 3229 </div> 3230 </div> 3231 </a> 3232 </div> 3233 </li> 3234 } 3235 3236 @helper RenderMobileTopSearchBar() 3237 { 3238 string searchFeedId = ""; 3239 string searchSecondFeedId = ""; 3240 int groupsFeedId; 3241 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 3242 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 3243 string resultPageLink; 3244 string searchPlaceholder; 3245 string searchType = "product-search"; 3246 string searchTemplate; 3247 string searchContentTemplate = ""; 3248 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; 3249 bool showGroups = true; 3250 3251 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch") 3252 { 3253 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 3254 resultPageLink = contentSearchPageLink; 3255 searchPlaceholder = Translate("Search page"); 3256 groupsFeedId = 0; 3257 searchType = "content-search"; 3258 searchTemplate = "SearchPagesTemplate"; 3259 showGroups = false; 3260 } 3261 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch") 3262 { 3263 searchFeedId = productsPageId + "&feed=true"; 3264 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 3265 resultPageLink = Converter.ToString(productsPageId); 3266 searchPlaceholder = Translate("Search products or pages"); 3267 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 3268 searchType = "combined-search"; 3269 searchTemplate = "SearchProductsTemplateWrap"; 3270 searchContentTemplate = "SearchPagesTemplateWrap"; 3271 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 3272 } 3273 else 3274 { 3275 resultPageLink = Converter.ToString(productsPageId); 3276 searchFeedId = productsPageId + "&feed=true"; 3277 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 3278 searchPlaceholder = Translate("Search products"); 3279 searchTemplate = "SearchProductsTemplate"; 3280 searchType = "product-search"; 3281 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 3282 } 3283 3284 3285 <input type="checkbox" id="MobileSearchTrigger" class="mobile-search-trigger" /> 3286 3287 <div class="main-navigation-mobile typeahead-mobile dw-mod"> 3288 <div class="center-container top-container__center-container dw-mod"> 3289 <div class="grid"> 3290 <div class="grid__col-auto"> 3291 <div class="typeahead-mobile__search-field dw-mod js-typeahead" data-page-size="@(searchType == "combined-search" ? 4 : 8)" id="MobileProductSearch" data-search-feed-id="@searchFeedId" data-search-second-feed-id="@searchSecondFeedId" data-result-page-id="@resultPageLink" data-search-type="@searchType"> 3292 <input type="text" class="js-typeahead-search-field u-w160px u-no-margin" placeholder="@searchPlaceholder" value="@searchValue"> 3293 @if (string.IsNullOrEmpty(searchSecondFeedId)) 3294 { 3295 <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> 3296 } 3297 else 3298 { 3299 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--combined-mobile grid"> 3300 <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> 3301 <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> 3302 </div> 3303 } 3304 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod js-typeahead-enter-btn"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue"></i></button> 3305 </div> 3306 </div> 3307 <div class="grid__col-auto-width"> 3308 <ul class="menu dw-mod"> 3309 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 3310 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> 3311 <i class="fas fa-times fa-1_5x"></i> 3312 </label> 3313 </li> 3314 </ul> 3315 </div> 3316 </div> 3317 </div> 3318 </div> 3319 } 3320 3321 @helper RenderMobileMiniCartCounterContent() 3322 { 3323 <script id="MiniCartCounterContent" type="text/x-template"> 3324 {{#.}} 3325 <div class="js-mini-cart-counter-content dw-mod" data-count="{{numberofproducts}}"> 3326 {{numberofproducts}} 3327 </div> 3328 {{/.}} 3329 </script> 3330 }</text> 3331 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3332 3333 @using System 3334 @using System.Web 3335 @using System.Collections.Generic 3336 @using Dynamicweb.Rapido.Blocks.Extensibility 3337 @using Dynamicweb.Rapido.Blocks 3338 3339 @functions { 3340 BlocksPage mobileNavigationBlocksPage = BlocksPage.GetBlockPage("Master"); 3341 } 3342 3343 @{ 3344 bool mobileNavigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 3345 bool mobileHideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); 3346 bool mobileHideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); 3347 bool mobileHideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); 3348 bool mobileHideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); 3349 bool mobileHideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); 3350 3351 Block mobileNavigation = new Block() 3352 { 3353 Id = "MobileNavigation", 3354 SortId = 10, 3355 Template = MobileNavigation(), 3356 SkipRenderBlocksList = true 3357 }; 3358 mobileNavigationBlocksPage.Add(MasterBlockId.MasterTopSnippets, mobileNavigation); 3359 3360 if (Model.CurrentUser.ID > 0 && !mobileHideMyProfileLink) 3361 { 3362 Block mobileNavigationSignIn = new Block 3363 { 3364 Id = "MobileNavigationSignIn", 3365 SortId = 10, 3366 Template = RenderMobileNavigationSignIn() 3367 }; 3368 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationSignIn); 3369 } 3370 3371 Block mobileNavigationMenu = new Block 3372 { 3373 Id = "MobileNavigationMenu", 3374 SortId = 20, 3375 Template = RenderMobileNavigationMenu() 3376 }; 3377 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationMenu); 3378 3379 Block mobileNavigationActions = new Block 3380 { 3381 Id = "MobileNavigationActions", 3382 SortId = 30, 3383 Template = RenderMobileNavigationActions(), 3384 SkipRenderBlocksList = true 3385 }; 3386 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationActions); 3387 3388 if (!mobileNavigationItemsHideSignIn) 3389 { 3390 if (Model.CurrentUser.ID <= 0) 3391 { 3392 Block mobileNavigationSignInAction = new Block 3393 { 3394 Id = "MobileNavigationSignInAction", 3395 SortId = 10, 3396 Template = RenderMobileNavigationSignInAction() 3397 }; 3398 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignInAction); 3399 3400 if (!mobileHideCreateAccountLink) 3401 { 3402 Block mobileNavigationCreateAccountAction = new Block 3403 { 3404 Id = "MobileNavigationCreateAccountAction", 3405 SortId = 20, 3406 Template = RenderMobileNavigationCreateAccountAction() 3407 }; 3408 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationCreateAccountAction); 3409 } 3410 } 3411 else 3412 { 3413 //CS NT Show 'My Account' 3414 Block mobileNavigationMyAccount = new Block 3415 { 3416 Id = "MobileNavigationMyAccount", 3417 SortId = 19, 3418 Template = RenderMobileNavigationMyAccount() 3419 }; 3420 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationMyAccount); 3421 3422 3423 if (!mobileHideMyOrdersLink) 3424 { 3425 Block mobileNavigationOrdersAction = new Block 3426 { 3427 Id = "MobileNavigationOrdersAction", 3428 SortId = 20, 3429 Template = RenderMobileNavigationOrdersAction() 3430 }; 3431 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationOrdersAction); 3432 } 3433 if (!mobileHideMyFavoritesLink) 3434 { 3435 Block mobileNavigationFavoritesAction = new Block 3436 { 3437 Id = "MobileNavigationFavoritesAction", 3438 SortId = 30, 3439 Template = RenderMobileNavigationFavoritesAction() 3440 }; 3441 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationFavoritesAction); 3442 } 3443 if (!mobileHideMySavedCardsLink) 3444 { 3445 Block mobileNavigationSavedCardsAction = new Block 3446 { 3447 Id = "MobileNavigationFavoritesAction", 3448 SortId = 30, 3449 Template = RenderMobileNavigationSavedCardsAction() 3450 }; 3451 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSavedCardsAction); 3452 } 3453 3454 Block mobileNavigationSignOutAction = new Block 3455 { 3456 Id = "MobileNavigationSignOutAction", 3457 SortId = 40, 3458 Template = RenderMobileNavigationSignOutAction() 3459 }; 3460 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignOutAction); 3461 } 3462 } 3463 3464 /*CS NT Hide for now 3465 if (Model.Languages.Count > 1) 3466 { 3467 Block mobileNavigationLanguagesAction = new Block 3468 { 3469 Id = "MobileNavigationLanguagesAction", 3470 SortId = 50, 3471 Template = RenderMobileNavigationLanguagesAction() 3472 }; 3473 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationLanguagesAction); 3474 } 3475 */ 3476 } 3477 3478 3479 @helper MobileNavigation() 3480 { 3481 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigation").OrderBy(item => item.SortId).ToList(); 3482 string mobileTopDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design") != null ? Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design").SelectedValue : "nav-left"; 3483 string position = mobileTopDesign == "nav-left" || mobileTopDesign == "nav-search-left" ? "left" : "right"; 3484 3485 <!-- Trigger for mobile navigation --> 3486 <input type="checkbox" id="MobileNavTrigger" class="mobile-nav-trigger mobile-nav-trigger--@position" autocomplete="off" /> 3487 3488 <!-- Mobile navigation --> 3489 <nav class="mobile-navigation mobile-navigation--@position dw-mod"> 3490 <div class="mobile-navigation__wrapper" id="mobileNavigationWrapper"> 3491 @RenderBlockList(subBlocks) 3492 </div> 3493 </nav> 3494 3495 <label class="mobile-nav-trigger-off" for="MobileNavTrigger"></label> 3496 } 3497 3498 @helper RenderMobileNavigationSignIn() 3499 { 3500 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 3501 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 3502 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 3503 string myProfilePageLink = linkStart + myProfilePageId; 3504 string userName = Model.CurrentUser.FirstName ?? ""; 3505 userName += " " + (Model.CurrentUser.LastName ?? ""); 3506 userName += userName == "" && Model.CurrentUser.UserName != null ? Model.CurrentUser.UserName : ""; 3507 3508 <ul class="menu menu-mobile"> 3509 <li class="menu-mobile__item"> 3510 <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> 3511 </li> 3512 </ul> 3513 } 3514 3515 @helper RenderMobileNavigationMenu() 3516 { 3517 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides"; 3518 string menuTemplate = isSlidesDesign ? "BaseMenuForMobileSlides.xslt" : "BaseMenuForMobileExpandable.xslt"; 3519 string levels = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels") : "3"; 3520 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 3521 int startLevel = renderPagesInToolBar ? 1 : 0; 3522 3523 @RenderNavigation(new 3524 { 3525 id = "mobilenavigation", 3526 cssclass = "menu menu-mobile dwnavigation", 3527 startLevel = @startLevel, 3528 ecomStartLevel = @startLevel + 1, 3529 endlevel = @levels, 3530 expandmode = "all", 3531 template = @menuTemplate 3532 }) 3533 3534 if (isSlidesDesign) 3535 { 3536 <script> 3537 function goToLevel(level) { 3538 document.getElementById('mobileNavigationWrapper').style.left = -(level * 100) + "%"; 3539 } 3540 3541 document.addEventListener('DOMContentLoaded', function () { 3542 goToLevel(document.getElementById('mobileNavigationWrapper').querySelectorAll('input[type=radio]:checked').length); 3543 }); 3544 </script> 3545 } 3546 3547 if (renderPagesInToolBar) 3548 { 3549 @RenderNavigation(new 3550 { 3551 id = "topToolsMobileNavigation", 3552 cssclass = "menu menu-mobile dwnavigation", 3553 template = "ToolsMenuForMobile.xslt" 3554 }) 3555 } 3556 } 3557 3558 @helper RenderMobileNavigationActions() 3559 { 3560 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigationActions").OrderBy(item => item.SortId).ToList(); ; 3561 3562 <ul class="menu menu-mobile"> 3563 @RenderBlockList(subBlocks) 3564 </ul> 3565 } 3566 3567 @helper RenderMobileNavigationSignInAction() 3568 { 3569 <li class="menu-mobile__item"> 3570 <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> 3571 </li> 3572 } 3573 3574 @helper RenderMobileNavigationCreateAccountAction() 3575 { 3576 //CS NT int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 3577 int createAccountPageId = GetPageIdByNavigationTag("CreateECommerceAccount"); 3578 3579 <li class="menu-mobile__item"> 3580 <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> 3581 </li> 3582 } 3583 3584 @helper RenderMobileNavigationProfileAction() 3585 { 3586 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 3587 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 3588 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 3589 string myProfilePageLink = linkStart + myProfilePageId; 3590 3591 <li class="menu-mobile__item"> 3592 <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> 3593 </li> 3594 } 3595 3596 @helper RenderMobileNavigationMyAccount() 3597 { 3598 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 3599 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 3600 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 3601 string myProfilePageLink = linkStart + myProfilePageId; 3602 3603 <li class="menu-mobile__item"> 3604 <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 Account")</a> 3605 </li> 3606 } 3607 3608 @helper RenderMobileNavigationOrdersAction() 3609 { 3610 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 3611 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 3612 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); 3613 string myOrdersPageLink = linkStart + myOrdersPageId; 3614 string ordersIcon = "fas fa-list"; 3615 3616 <li class="menu-mobile__item"> 3617 <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> 3618 </li> 3619 } 3620 3621 @helper RenderMobileNavigationFavoritesAction() 3622 { 3623 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 3624 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 3625 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 3626 string myFavoritesPageLink = linkStart + myFavoritesPageId; 3627 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"; 3628 3629 3630 <li class="menu-mobile__item"> 3631 <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> 3632 </li> 3633 } 3634 3635 @helper RenderMobileNavigationSavedCardsAction() 3636 { 3637 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 3638 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 3639 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards"); 3640 string mySavedCardsPageLink = linkStart + mySavedCardsPageId; 3641 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"; 3642 3643 <li class="menu-mobile__item"> 3644 <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> 3645 </li> 3646 } 3647 3648 @helper RenderMobileNavigationSignOutAction() 3649 { 3650 int pageId = Model.TopPage.ID; 3651 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"; 3652 3653 <li class="menu-mobile__item"> 3654 <a class="menu-mobile__link menu-mobile__link--highlighted dw-mod" href="/Admin/Public/ExtranetLogoff.aspx?ID=@pageId"><i class="@signOutIcon menu-mobile__link-icon"></i> @Translate("Sign out")</a> 3655 </li> 3656 } 3657 3658 @helper RenderMobileNavigationLanguagesAction() 3659 { 3660 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides"; 3661 3662 string selectedLanguage = ""; 3663 foreach (var lang in Model.Languages) 3664 { 3665 if (lang.IsCurrent) 3666 { 3667 selectedLanguage = lang.Name; 3668 } 3669 } 3670 3671 <li class="menu-mobile__item dw-mod"> 3672 @if (isSlidesDesign) 3673 { 3674 <input id="MobileMenuCheck_Language" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(1);"> 3675 } 3676 else 3677 { 3678 <input id="MobileMenuCheck_Language" type="checkbox" class="expand-trigger"> 3679 } 3680 <div class="menu-mobile__link__wrap"> 3681 <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> 3682 <label for="MobileMenuCheck_Language" class="menu-mobile__trigger"></label> 3683 </div> 3684 <ul class="menu-mobile menu-mobile__submenu expand-menu"> 3685 @if (isSlidesDesign) 3686 { 3687 <li class="menu-mobile__item dw-mod"> 3688 <div class="menu-mobile__link__wrap"> 3689 <input id="MobileMenuCheck_Language_back" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(0);" /> 3690 <label for="MobileMenuCheck_Language_back" class="menu-mobile__trigger menu-mobile__trigger--back"></label> 3691 <label for="MobileMenuCheck_Language_back" class="menu-mobile__link dw-mod ">@Translate("Back")</label> 3692 </div> 3693 </li> 3694 } 3695 @foreach (var lang in Model.Languages) 3696 { 3697 <li class="menu-mobile__item dw-mod"> 3698 <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> 3699 </li> 3700 } 3701 </ul> 3702 </li> 3703 }</text> 3704 } 3705 else 3706 { 3707 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3708 3709 @using System 3710 @using System.Web 3711 @using System.Collections.Generic 3712 @using Dynamicweb.Rapido.Blocks.Extensibility 3713 @using Dynamicweb.Rapido.Blocks 3714 3715 @functions { 3716 BlocksPage headerBlocksPage = BlocksPage.GetBlockPage("Master"); 3717 } 3718 3719 @{ 3720 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 3721 { 3722 Block masterTools = new Block() 3723 { 3724 Id = "MasterDesktopTools", 3725 SortId = 10, 3726 Template = RenderDesktopTools(), 3727 SkipRenderBlocksList = true, 3728 BlocksList = new List<Block> 3729 { 3730 new Block { 3731 Id = "MasterDesktopToolsText", 3732 SortId = 10, 3733 Template = RenderDesktopToolsText(), 3734 Design = new Design 3735 { 3736 Size = "auto", 3737 HidePadding = true, 3738 RenderType = RenderType.Column 3739 } 3740 }, 3741 new Block { 3742 Id = "MasterDesktopToolsNavigation", 3743 SortId = 20, 3744 Template = RenderDesktopToolsNavigation(), 3745 Design = new Design 3746 { 3747 Size = "auto-width", 3748 HidePadding = true, 3749 RenderType = RenderType.Column 3750 } 3751 } 3752 } 3753 }; 3754 headerBlocksPage.Add("MasterHeader", masterTools); 3755 } 3756 3757 Block masterDesktopExtra = new Block() 3758 { 3759 Id = "MasterDesktopExtra", 3760 SortId = 10, 3761 Template = RenderDesktopExtra(), 3762 SkipRenderBlocksList = true 3763 }; 3764 headerBlocksPage.Add("MasterHeader", masterDesktopExtra); 3765 3766 Block masterDesktopNavigation = new Block() 3767 { 3768 Id = "MasterDesktopNavigation", 3769 SortId = 20, 3770 Template = RenderDesktopNavigation(), 3771 SkipRenderBlocksList = true 3772 }; 3773 headerBlocksPage.Add("MasterHeader", masterDesktopNavigation); 3774 } 3775 3776 3777 @*Include the Blocks for the page *@ 3778 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3779 3780 @using System 3781 @using System.Web 3782 @using Dynamicweb.Rapido.Blocks.Extensibility 3783 @using Dynamicweb.Rapido.Blocks 3784 3785 @{ 3786 Block masterDesktopLogo = new Block 3787 { 3788 Id = "MasterDesktopLogo", 3789 SortId = 10, 3790 Template = RenderDesktopLogo(), 3791 Design = new Design 3792 { 3793 Size = "auto-width", 3794 HidePadding = true, 3795 RenderType = RenderType.Column, 3796 CssClass = "grid--align-self-center" 3797 } 3798 }; 3799 3800 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopLogo); 3801 } 3802 3803 3804 @helper RenderDesktopLogo() 3805 { 3806 string firstPageId = Model.Area.FirstActivePage.ID.ToString(); 3807 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 3808 string alignClass = topLayout == "two-lines-centered" || topLayout == "two-lines" ? "grid--align-self-center" : ""; 3809 string logo = Model.Area.Item.GetItem("Layout").GetFile("LogoImage") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoImage").PathUrlEncoded : "/Files/Images/logo-dynamicweb.png"; 3810 if (Path.GetExtension(logo).ToLower() != ".svg") 3811 { 3812 int logoHeight = Model.Area.Item.GetItem("Layout").GetInt32("LogoHeight"); 3813 logoHeight = logoHeight > 0 && Pageview.Device.ToString() != "Mobile" ? logoHeight : 40; 3814 logo = "/Admin/Public/GetImage.ashx?height=" + Converter.ToString(logoHeight) + "&amp;crop=5&amp;Compression=75&amp;image=" + logo; 3815 } 3816 else 3817 { 3818 logo = HttpUtility.UrlDecode(logo); 3819 } 3820 3821 <div class="logo @alignClass dw-mod"> 3822 <a href="/Default.aspx?ID=@firstPageId" class="logo__img dw-mod u-block"> 3823 <img class="grid__cell-img logo__img dw-mod" src="@logo" alt="@Translate("Logo")" /> 3824 </a> 3825 </div> 3826 } 3827 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3828 3829 @using System 3830 @using System.Web 3831 @using Dynamicweb.Rapido.Blocks.Extensibility 3832 @using Dynamicweb.Rapido.Blocks 3833 3834 @functions { 3835 bool isMegaMenu; 3836 } 3837 3838 @{ 3839 isMegaMenu = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu") != null ? Converter.ToBoolean(Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu").SelectedValue) : false; 3840 Block masterDesktopMenu = new Block 3841 { 3842 Id = "MasterDesktopMenu", 3843 SortId = 10, 3844 Template = RenderDesktopMenu(), 3845 Design = new Design 3846 { 3847 Size = "auto", 3848 HidePadding = true, 3849 RenderType = RenderType.Column 3850 } 3851 }; 3852 3853 if (isMegaMenu) 3854 { 3855 masterDesktopMenu.Design.CssClass = "u-reset-position"; 3856 } 3857 3858 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopMenu); 3859 } 3860 3861 @helper RenderDesktopMenu() 3862 { 3863 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 3864 string menuAlignment = topLayout == "minimal-right" ? "grid--align-self-end" : ""; 3865 string megamenuPromotionImage = Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage").PathUrlEncoded : ""; 3866 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 3867 bool showOnlyHeaders = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowOnlyHeaders"); 3868 int startLevel = renderPagesInToolBar ? 1 : 0; 3869 3870 string promotionLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("MegamenuPromotionLink"); 3871 3872 <div class="grid__cell u-flex @(isMegaMenu ? "u-reset-position" : "") @menuAlignment"> 3873 @if (!isMegaMenu) 3874 { 3875 @RenderNavigation(new 3876 { 3877 id = "topnavigation", 3878 cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap", 3879 startLevel = startLevel, 3880 ecomStartLevel = startLevel + 1, 3881 endlevel = 5, 3882 expandmode = "all", 3883 template = "BaseMenuWithDropdown.xslt" 3884 }); 3885 } 3886 else 3887 { 3888 @RenderNavigation(new 3889 { 3890 id = "topnavigation", 3891 cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap", 3892 startLevel = startLevel, 3893 ecomStartLevel = startLevel + 1, 3894 endlevel = 5, 3895 promotionImage = megamenuPromotionImage, 3896 promotionLink = promotionLink, 3897 expandmode = "all", 3898 showOnlyHeaders = showOnlyHeaders.ToString().ToLower(), 3899 template = "BaseMegaMenu.xslt" 3900 }); 3901 } 3902 </div> 3903 } 3904 3905 3906 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3907 3908 @using System 3909 @using System.Web 3910 @using Dynamicweb.Rapido.Blocks.Extensibility 3911 @using Dynamicweb.Rapido.Blocks 3912 3913 @{ 3914 Block masterDesktopActionsMenu = new Block 3915 { 3916 Id = "MasterDesktopActionsMenu", 3917 SortId = 10, 3918 Template = RenderDesktopActionsMenu(), 3919 Design = new Design 3920 { 3921 CssClass = "u-flex" 3922 }, 3923 SkipRenderBlocksList = true 3924 3925 }; 3926 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopActionsMenu); 3927 3928 if (!string.IsNullOrWhiteSpace(Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink"))) 3929 { 3930 Block masterDesktopActionsHeaderButton = new Block 3931 { 3932 Id = "MasterDesktopActionsHeaderButton", 3933 SortId = 60, 3934 Template = RenderHeaderButton() 3935 }; 3936 masterDesktopActionsMenu.Add(masterDesktopActionsHeaderButton); 3937 } 3938 } 3939 3940 @helper RenderDesktopActionsMenu() 3941 { 3942 List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopActionsMenu").OrderBy(item => item.SortId).ToList(); 3943 3944 <ul class="menu u-flex dw-mod"> 3945 @RenderBlockList(subBlocks) 3946 </ul> 3947 } 3948 3949 @helper RenderHeaderButton() 3950 { 3951 string headerButtonText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonText"); 3952 string headerButtonLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink"); 3953 string headerButtonType = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType") != null ? "btn--" + Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType").SelectedName.ToLower() : ""; 3954 3955 <li class="menu__item menu__item--horizontal menu--clean dw-mod"> 3956 <a class="btn @headerButtonType dw-mod u-no-margin u-margin-top u-margin-left" href="@headerButtonLink">@headerButtonText</a> 3957 </li> 3958 } 3959 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3960 3961 @using System 3962 @using System.Web 3963 @using Dynamicweb.Core; 3964 @using System.Text.RegularExpressions 3965 @using Dynamicweb.Rapido.Blocks.Extensibility 3966 @using Dynamicweb.Rapido.Blocks 3967 3968 @{ 3969 //CS NT Hide this for now 20210303 3970 Block masterDesktopActionsMenuLanguageSelector = new Block 3971 { 3972 Id = "MasterDesktopActionsMenuLanguageSelector", 3973 SortId = 40, 3974 Template = RenderLanguageSelector() 3975 }; 3976 3977 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuLanguageSelector); 3978 3979 } 3980 3981 @helper RenderLanguageSelector() 3982 { 3983 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 3984 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 3985 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 3986 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() : ""; 3987 3988 if (Model.Languages.Count > 1) 3989 { 3990 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon is-dropdown is-dropdown--no-icon dw-mod"> 3991 <div class="@menuLinkClass dw-mod"> 3992 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue fa-1_5x"></i> 3993 </div> 3994 <div class="menu menu--dropdown menu--dropdown-right languages-dropdown dw-mod grid__cell"> 3995 @foreach (var lang in Model.Languages) 3996 { 3997 string langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " u-margin-right\"></span>" + lang.Name; 3998 string cultureName = Regex.Replace(Dynamicweb.Services.Areas.GetArea(lang.ID).CultureInfo.NativeName, @" ?\(.*?\)", string.Empty); 3999 cultureName = char.ToUpper(cultureName[0]) + cultureName.Substring(1); 4000 4001 if (languageViewType == "flag-culture") 4002 { 4003 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span> " + cultureName; 4004 } 4005 4006 if (languageViewType == "flag") 4007 { 4008 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span>"; 4009 } 4010 4011 if (languageViewType == "name") 4012 { 4013 langInfo = lang.Name; 4014 } 4015 4016 if (languageViewType == "culture") 4017 { 4018 langInfo = cultureName; 4019 } 4020 4021 <div class="menu__item dw-mod menu__item--fixed-width"> 4022 <a href="/Default.aspx?AreaID=@Dynamicweb.Services.Pages.GetPage(lang.Page.ID).Area.ID" class="menu-dropdown__link dw-mod">@langInfo</a> 4023 </div> 4024 } 4025 </div> 4026 </li> 4027 } 4028 } 4029 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4030 4031 @using System 4032 @using System.Web 4033 @using Dynamicweb.Rapido.Blocks.Extensibility 4034 @using Dynamicweb.Rapido.Blocks 4035 4036 @{ 4037 Block masterDesktopActionsMenuSignIn = new Block 4038 { 4039 Id = "MasterDesktopActionsMenuSignIn", 4040 SortId = 20, 4041 Template = RenderSignIn() 4042 }; 4043 4044 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuSignIn); 4045 } 4046 4047 @helper RenderSignIn() 4048 { 4049 bool navigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 4050 string userInitials = ""; 4051 int pageId = Model.TopPage.ID; 4052 //CS NT int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 4053 int createAccountPageId = GetPageIdByNavigationTag("CreateECommerceAccount"); 4054 int myDashboardPageId = GetPageIdByNavigationTag("CustomerDashboard"); 4055 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 4056 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); 4057 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 4058 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards"); 4059 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 4060 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); 4061 bool hideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); 4062 bool hideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); 4063 bool hideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); 4064 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); 4065 bool hideForgotPasswordLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideForgotPasswordLink"); 4066 4067 string linkStart = "/Default.aspx?ID="; 4068 if (Model.CurrentUser.ID <= 0) 4069 { 4070 linkStart += signInProfilePageId + "&RedirectPageId="; 4071 } 4072 4073 4074 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; 4075 string myProfilePageLink = linkStart + myProfilePageId; 4076 string myOrdersPageLink = linkStart + myOrdersPageId; 4077 string myFavoritesPageLink = linkStart + myFavoritesPageId; 4078 string mySavedCardsPageLink = linkStart + mySavedCardsPageId; 4079 4080 string profileIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue : "fa fa-user"; 4081 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"; 4082 4083 if (Model.CurrentUser.ID != 0) 4084 { 4085 if (!String.IsNullOrEmpty(Model.CurrentUser.Name)) 4086 { 4087 string[] names = Model.CurrentUser.Name.Trim().Split(' '); 4088 userInitials += Model.CurrentUser.Name.Substring(0, 1); 4089 4090 if (names.Length > 1) 4091 { 4092 userInitials += names[names.Length - 1].Substring(0, 1); 4093 } 4094 } 4095 else 4096 { 4097 userInitials += Model.CurrentUser.FirstName != null && Model.CurrentUser.FirstName != "" ? Model.CurrentUser.FirstName.Substring(0, 1) : ""; 4098 userInitials += Model.CurrentUser.LastName != null && Model.CurrentUser.LastName != "" ? Model.CurrentUser.LastName.Substring(0, 1) : ""; 4099 userInitials += userInitials.Length == 1 && Model.CurrentUser.FirstName != null && Model.CurrentUser.FirstName.Length > 1 ? Model.CurrentUser.FirstName.Substring(1, 2) : ""; 4100 userInitials += userInitials == "" && Model.CurrentUser.Email != null && Model.CurrentUser.Email.Length > 1 ? Model.CurrentUser.Email.Substring(0, 2) : ""; 4101 userInitials += userInitials == "" ? Model.CurrentUser.UserName.Substring(0, 2) : ""; 4102 } 4103 } 4104 4105 if (!navigationItemsHideSignIn) 4106 { 4107 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4108 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu__item--clean"; 4109 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4110 4111 <li class="menu__item menu__item--horizontal menu__item menu__item--icon @liClasses is-dropdown is-dropdown--no-icon dw-mod"> 4112 <div class="@menuLinkClass dw-mod"> 4113 @if (Model.CurrentUser.ID <= 0) 4114 { 4115 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue fa-1_5x"></i> 4116 } 4117 else 4118 { 4119 <!--<a href="/default.aspx?ID=@myDashboardPageId" class="u-color-inherit"><div class="circle-icon-btn">@userInitials.ToUpper()</div></a>--> 4120 <a href="/@myProfilePageLink" class="u-color-inherit"><div class="circle-icon-btn">@userInitials.ToUpper()</div></a> 4121 } 4122 </div> 4123 <div class="menu menu--dropdown menu--dropdown-right menu--sign-in grid__cell dw-mod"> 4124 <ul class="list list--clean dw-mod"> 4125 @if (Model.CurrentUser.ID <= 0) 4126 { 4127 <li> 4128 <a class="btn btn--primary btn--full u-no-margin sign-in-modal-trigger-button dw-mod" href="/createecommerceaccount">@Translate("Sign in")</a> 4129 <!--Commented out by CS NT and added the line above <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>--> 4130 </li> 4131 4132 if (!hideCreateAccountLink) 4133 { 4134 @RenderListItem("/default.aspx?ID=" + createAccountPageId, Translate("Create account")); 4135 } 4136 if (!hideForgotPasswordLink) 4137 { 4138 @RenderListItem(forgotPasswordPageLink, Translate("Forgot your password?")) 4139 } 4140 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) 4141 { 4142 @RenderSeparator() 4143 } 4144 } 4145 @if (!hideMyProfileLink) 4146 { 4147 @RenderListItem(myProfilePageLink, Translate("My Profile"), profileIcon) 4148 } 4149 @if (!hideMyOrdersLink) 4150 { 4151 @RenderListItem(myOrdersPageLink, Translate("My Orders"), "fas fa-list") 4152 } 4153 @if (!hideMyFavoritesLink) 4154 { 4155 @RenderListItem(myFavoritesPageLink, Translate("My Favorites"), favoritesIcon) 4156 } 4157 @if (!hideMySavedCardsLink) 4158 { 4159 @RenderListItem(mySavedCardsPageLink, Translate("My Saved cards"), "fas fa-credit-card") 4160 } 4161 @if (Model.CurrentUser.ID > 0) 4162 { 4163 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) 4164 { 4165 @RenderSeparator() 4166 } 4167 4168 @RenderListItem("/Admin/Public/ExtranetLogoff.aspx?ID=" + pageId, Translate("Sign out")) 4169 } 4170 </ul> 4171 </div> 4172 </li> 4173 } 4174 } 4175 4176 @helper RenderListItem(string link, string text, string icon = null) { 4177 <li> 4178 <a href="@link" class="list__link dw-mod"> 4179 @if (!string.IsNullOrEmpty(icon)) 4180 { 4181 <i class="@icon u-margin-right"></i> 4182 } 4183 @text 4184 </a> 4185 </li> 4186 } 4187 4188 @helper RenderSeparator() 4189 { 4190 <li class="list__seperator dw-mod"></li> 4191 } 4192 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4193 4194 @using System 4195 @using System.Web 4196 @using Dynamicweb.Rapido.Blocks.Extensibility 4197 @using Dynamicweb.Rapido.Blocks 4198 4199 @{ 4200 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideFavorites"); 4201 4202 Block masterDesktopActionsMenuFavorites = new Block 4203 { 4204 Id = "MasterDesktopActionsMenuFavorites", 4205 SortId = 30, 4206 Template = RenderFavorites() 4207 }; 4208 4209 if (!hideMyFavoritesLink && Model.CurrentUser.ID > 0) 4210 { 4211 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuFavorites); 4212 } 4213 } 4214 4215 @helper RenderFavorites() 4216 { 4217 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 4218 string myFavoritesPageLink = "/Default.aspx?ID=" + myFavoritesPageId; 4219 4220 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4221 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 4222 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4223 4224 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod"> 4225 <a href="@myFavoritesPageLink" class="@menuLinkClass dw-mod"> 4226 <i class="fas fa-@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue fa-1_5x"></i> 4227 </a> 4228 </li> 4229 } 4230 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4231 4232 @using System 4233 @using System.Web 4234 @using Dynamicweb.Rapido.Blocks.Extensibility 4235 @using Dynamicweb.Rapido.Blocks 4236 4237 @{ 4238 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 4239 bool hideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 4240 string miniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown"; 4241 4242 if (!onlyPreview && !hideCart) 4243 { 4244 Block masterDesktopActionsMenuMiniCart = new Block 4245 { 4246 Id = "MasterDesktopActionsMenuMiniCart", 4247 SortId = 50, 4248 Template = RenderMiniCart(miniCartLayout == "dropdown"), 4249 SkipRenderBlocksList = true, 4250 BlocksList = new List<Block>() 4251 }; 4252 4253 Block miniCartCounterScriptTemplate = new Block 4254 { 4255 Id = "MiniCartCounterScriptTemplate", 4256 Template = RenderMiniCartCounterContent() 4257 }; 4258 4259 //dropdown layout is default 4260 RazorEngine.Templating.TemplateWriter layoutTemplate = RenderMiniCartDropdownLayout(); 4261 RazorEngine.Templating.TemplateWriter miniCartTriggerTemplate = RenderMiniCartTriggerLink(); 4262 4263 switch (miniCartLayout) 4264 { 4265 case "panel": 4266 layoutTemplate = RenderMiniCartPanelLayout(); 4267 miniCartTriggerTemplate = RenderMiniCartTriggerLabel(); 4268 break; 4269 case "modal": 4270 layoutTemplate = RenderMiniCartModalLayout(); 4271 miniCartTriggerTemplate = RenderMiniCartTriggerLabel(); 4272 break; 4273 } 4274 4275 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block 4276 { 4277 Id = "MiniCartTrigger", 4278 Template = miniCartTriggerTemplate 4279 }); 4280 4281 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 4282 { 4283 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block 4284 { 4285 Id = "MiniCartLayout", 4286 Template = layoutTemplate 4287 }); 4288 } 4289 4290 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuMiniCart); 4291 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate); 4292 } 4293 } 4294 4295 @helper RenderMiniCart(bool hasMouseEnterEvent) 4296 { 4297 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterDesktopActionsMenuMiniCart").OrderBy(item => item.SortId).ToList(); 4298 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4299 string liClasses = topLayout != "normal" ? "menu__item--top-level" : "menu--clean"; 4300 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4301 string mouseEvent = ""; 4302 string id = "MiniCart"; 4303 if (hasMouseEnterEvent) 4304 { 4305 mouseEvent = "onmouseenter=\"Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=" + miniCartFeedPageId + "&feedType=MiniCart')\""; 4306 id = "miniCartTrigger"; 4307 } 4308 <li class="menu__item menu__item--horizontal menu__item--icon @liClasses dw-mod" id="@id" @mouseEvent> 4309 @RenderBlockList(subBlocks) 4310 </li> 4311 } 4312 4313 @helper RenderMiniCartTriggerLabel() 4314 { 4315 int cartPageId = GetPageIdByNavigationTag("CartPage"); 4316 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart"; 4317 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4318 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4319 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4320 4321 <div class="@menuLinkClass dw-mod js-mini-cart-button" onclick="Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart')"> 4322 <div class="u-inline u-position-relative"> 4323 <i class="@cartIcon fa-1_5x"></i> 4324 @RenderMiniCartCounter() 4325 </div> 4326 </div> 4327 } 4328 4329 @helper RenderMiniCartTriggerLink() 4330 { 4331 int cartPageId = GetPageIdByNavigationTag("CartPage"); 4332 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart"; 4333 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4334 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4335 4336 <a href="/Default.aspx?ID=@cartPageId&Purge=True" class="@menuLinkClass menu__item--icon dw-mod js-mini-cart-button"> 4337 <div class="u-inline u-position-relative"> 4338 <i class="@cartIcon fa-1_5x"></i> 4339 @RenderMiniCartCounter() 4340 </div> 4341 </a> 4342 } 4343 4344 @helper RenderMiniCartCounter() 4345 { 4346 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4347 string cartProductsCount = Model.Cart.TotalProductsCount.ToString(); 4348 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right"; 4349 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 4350 string cartProductsTotalPrice = showPrice && Model.Cart.TotalPrice != null ? Model.Cart.TotalPrice.Price.Formatted : ""; 4351 cartProductsTotalPrice = counterPosition == "right" ? cartProductsTotalPrice : ""; 4352 4353 if (showPrice && counterPosition == "right") 4354 { 4355 cartProductsCount = Translate("Cart") + "(" + cartProductsCount + ")"; 4356 } 4357 4358 <div class="mini-cart__counter dw-mod"> 4359 <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"> 4360 <div class="js-mini-cart-counter-content" data-count="@Model.Cart.TotalProductsCount.ToString()"> 4361 @cartProductsCount 4362 @cartProductsTotalPrice 4363 </div> 4364 </div> 4365 </div> 4366 } 4367 4368 @helper RenderMiniCartCounterContent() 4369 { 4370 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 4371 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right"; 4372 bool showPriceInMiniCartCounter = Pageview.Device.ToString() != "Mobile" && counterPosition == "right" && showPrice; 4373 4374 <script id="MiniCartCounterContent" type="text/x-template"> 4375 {{#.}} 4376 <div class="js-mini-cart-counter-content dw-mod" data-count="{{numberofproducts}}"> 4377 @if (showPriceInMiniCartCounter) 4378 { 4379 @Translate("Cart")<text>({{numberofproducts}}) {{totalprice}}</text> 4380 } 4381 else 4382 { 4383 <text>{{numberofproducts}}</text> 4384 } 4385 </div> 4386 {{/.}} 4387 </script> 4388 } 4389 4390 @helper RenderMiniCartDropdownLayout() 4391 { 4392 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4393 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage"); 4394 4395 <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"> 4396 <div class="mini-cart-dropdown__inner dw-mod"> 4397 <h3 class="u-ta-center dw-mod">@Translate("Shopping cart")</h3> 4398 <div class="mini-cart-dropdown__body u-flex dw-mod"> 4399 <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> 4400 </div> 4401 </div> 4402 </div> 4403 } 4404 4405 @helper RenderMiniCartPanelLayout() 4406 { 4407 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4408 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage"); 4409 4410 <div class="mini-cart grid__cell dw-mod"> 4411 <input type="checkbox" id="miniCartTrigger" class="panel-trigger" /> 4412 <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"> 4413 <label for="miniCartTrigger" class="panel__close-btn" title="@Translate("Close panel")"><i class="fas fa-times"></i></label> 4414 <div class="panel__content u-full-width dw-mod"> 4415 <h3 class="panel__header dw-mod u-margin-bottom u-ta-center">@Translate("Shopping cart")</h3> 4416 <div class="panel__content-body panel__content-body--cart dw-mod"> 4417 <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> 4418 </div> 4419 </div> 4420 </div> 4421 </div> 4422 } 4423 4424 @helper RenderMiniCartModalLayout() 4425 { 4426 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4427 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage"); 4428 4429 <div class="mini-cart grid__cell dw-mod"> 4430 <input type="checkbox" id="miniCartTrigger" class="modal-trigger" autocomplete="off" /> 4431 <div class="modal-container dw-mod js-mini-cart" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="block" data-cart-page-link="@cartPageLink"> 4432 <label for="miniCartTrigger" class="modal-overlay"></label> 4433 <div class="modal modal--top-right dw-mod"> 4434 <div class="modal__body u-flex grid--direction-column dw-mod"> 4435 <h3 class="dw-mod u-ta-center">@Translate("Shopping cart")</h3> 4436 <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> 4437 </div> 4438 <label class="modal__close-btn modal__close-btn--clean dw-mod" for="miniCartTrigger" title="@Translate("Close modal")"></label> 4439 </div> 4440 </div> 4441 </div> 4442 } 4443 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4444 4445 @using System 4446 @using System.Web 4447 @using Dynamicweb.Rapido.Blocks.Extensibility 4448 @using Dynamicweb.Rapido.Blocks 4449 4450 @{ 4451 bool showDownloadCartLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart"); 4452 4453 Block masterDesktopActionsMenuDownloadCart = new Block 4454 { 4455 Id = "MasterDesktopActionsMenuDownloadCart", 4456 SortId = 35, 4457 Template = RenderDownloadCart() 4458 }; 4459 4460 if (showDownloadCartLink && Model.CurrentUser.ID > 0) 4461 { 4462 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuDownloadCart); 4463 } 4464 } 4465 4466 @helper RenderDownloadCart() 4467 { 4468 int downloadCartPageId = GetPageIdByNavigationTag("DownloadCart"); 4469 string downloadCartPageLink = "/Default.aspx?ID=" + downloadCartPageId; 4470 4471 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4472 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 4473 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4474 4475 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod"> 4476 <a href="@downloadCartPageLink" class="@menuLinkClass dw-mod"> 4477 <i class="fas fa-cart-arrow-down fa-1_5x"></i> 4478 </a> 4479 </li> 4480 } 4481 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4482 4483 @using System 4484 @using System.Web 4485 @using Dynamicweb.Rapido.Blocks.Extensibility 4486 @using Dynamicweb.Rapido.Blocks 4487 4488 @functions { 4489 public class SearchConfiguration 4490 { 4491 public string searchFeedId { get; set; } 4492 public string searchSecondFeedId { get; set; } 4493 public int groupsFeedId { get; set; } 4494 public string resultPageLink { get; set; } 4495 public string searchPlaceholder { get; set; } 4496 public string searchType { get; set; } 4497 public string searchTemplate { get; set; } 4498 public string searchContentTemplate { get; set; } 4499 public string searchValue { get; set; } 4500 public bool showGroups { get; set; } 4501 4502 public SearchConfiguration() 4503 { 4504 searchFeedId = ""; 4505 searchSecondFeedId = ""; 4506 searchType = "product-search"; 4507 searchContentTemplate = ""; 4508 showGroups = true; 4509 } 4510 } 4511 } 4512 @{ 4513 Block masterSearchBar = new Block 4514 { 4515 Id = "MasterSearchBar", 4516 SortId = 40, 4517 Template = RenderSearch("bar"), 4518 Design = new Design 4519 { 4520 Size = "auto", 4521 HidePadding = true, 4522 RenderType = RenderType.Column 4523 } 4524 }; 4525 4526 Block masterSearchAction = new Block 4527 { 4528 Id = "MasterDesktopActionsMenuSearch", 4529 SortId = 10, 4530 Template = RenderSearch() 4531 }; 4532 4533 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterSearchBar); 4534 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterSearchAction); 4535 } 4536 4537 @helper RenderSearch(string type = "mini-search") 4538 { 4539 string productsPageId = Converter.ToString(GetPageIdByNavigationTag("ProductsPage")); 4540 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 4541 string searchType = Model.Area.Item.GetItem("Layout").GetList("TopSearch") != null ? Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue : "productSearch"; 4542 4543 SearchConfiguration searchConfiguration = null; 4544 4545 switch (searchType) { 4546 case "contentSearch": 4547 searchConfiguration = new SearchConfiguration() { 4548 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true", 4549 resultPageLink = contentSearchPageLink, 4550 searchPlaceholder = Translate("Search page"), 4551 groupsFeedId = 0, 4552 searchType = "content-search", 4553 searchTemplate = "SearchPagesTemplate", 4554 showGroups = false 4555 }; 4556 break; 4557 case "combinedSearch": 4558 searchConfiguration = new SearchConfiguration() { 4559 searchFeedId = productsPageId + "&feed=true", 4560 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true", 4561 resultPageLink = Converter.ToString(productsPageId), 4562 searchPlaceholder = Translate("Search products or pages"), 4563 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"), 4564 searchType = "combined-search", 4565 searchTemplate = "SearchProductsTemplateWrap", 4566 searchContentTemplate = "SearchPagesTemplateWrap", 4567 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector") 4568 }; 4569 break; 4570 default: //productSearch 4571 searchConfiguration = new SearchConfiguration() { 4572 resultPageLink = Converter.ToString(productsPageId), 4573 searchFeedId = productsPageId + "&feed=true", 4574 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"), 4575 searchPlaceholder = Translate("Search products"), 4576 searchTemplate = "SearchProductsTemplate", 4577 searchType = "product-search", 4578 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector") 4579 }; 4580 break; 4581 } 4582 searchConfiguration.searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; 4583 4584 if (type == "mini-search") { 4585 @RenderMiniSearch(searchConfiguration) 4586 } else { 4587 @RenderSearchBar(searchConfiguration) 4588 } 4589 } 4590 4591 @helper RenderSearchBar(SearchConfiguration options) 4592 { 4593 <div class="typeahead typeahead--centered u-color-inherit js-typeahead dw-mod" id="ProductSearchBar" 4594 data-page-size="7" 4595 data-search-feed-id="@options.searchFeedId" 4596 data-search-second-feed-id="@options.searchSecondFeedId" 4597 data-result-page-id="@options.resultPageLink" 4598 data-groups-page-id="@options.groupsFeedId" 4599 data-search-type="@options.searchType"> 4600 @if (options.showGroups) 4601 { 4602 <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> 4603 <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> 4604 } 4605 <div class="typeahead-search-field"> 4606 <input type="text" class="u-no-margin u-full-width u-full-height js-typeahead-search-field" placeholder="@options.searchPlaceholder" value="@options.searchValue"> 4607 @if (string.IsNullOrEmpty(options.searchSecondFeedId)) 4608 { 4609 <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> 4610 } 4611 else 4612 { 4613 <div class="dropdown dropdown--absolute-position dropdown--combined grid"> 4614 <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> 4615 <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> 4616 </div> 4617 } 4618 </div> 4619 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod js-typeahead-enter-btn"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue"></i></button> 4620 </div> 4621 } 4622 4623 @helper RenderMiniSearch(SearchConfiguration options) 4624 { 4625 <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" onmouseover="document.getElementById('headerSearch').focus()"> 4626 <div class="menu__link menu__link--icon dw-mod"> 4627 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> 4628 </div> 4629 <div class="menu menu--dropdown menu--dropdown-right u-no-padding u-w380px grid__cell dw-mod"> 4630 <div class="typeahead js-typeahead" id="ProductSearchBar" 4631 data-page-size="7" 4632 data-search-feed-id="@options.searchFeedId" 4633 data-search-second-feed-id="@options.searchSecondFeedId" 4634 data-result-page-id="@options.resultPageLink" 4635 data-search-type="@options.searchType"> 4636 <div class="typeahead-search-field"> 4637 <input type="text" class="u-no-margin u-full-width js-typeahead-search-field" id="headerSearch" placeholder="@options.searchPlaceholder" value="@options.searchValue"> 4638 @if (string.IsNullOrEmpty(options.searchSecondFeedId)) 4639 { 4640 <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> 4641 } 4642 else 4643 { 4644 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--right-aligned"> 4645 <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> 4646 <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> 4647 </div> 4648 } 4649 </div> 4650 </div> 4651 </div> 4652 </li> 4653 } 4654 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4655 4656 @using System 4657 @using System.Web 4658 @using Dynamicweb.Rapido.Blocks.Extensibility 4659 @using Dynamicweb.Rapido.Blocks 4660 4661 @{ 4662 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4663 bool hideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 4664 4665 BlocksPage headerConfigurationPage = BlocksPage.GetBlockPage("Master"); 4666 4667 Block configDesktopLogo = headerConfigurationPage.GetBlockById("MasterDesktopLogo"); 4668 headerConfigurationPage.RemoveBlock(configDesktopLogo); 4669 4670 Block configDesktopMenu = headerConfigurationPage.GetBlockById("MasterDesktopMenu"); 4671 headerConfigurationPage.RemoveBlock(configDesktopMenu); 4672 4673 Block configSearchBar = headerConfigurationPage.GetBlockById("MasterSearchBar"); 4674 headerConfigurationPage.RemoveBlock(configSearchBar); 4675 4676 Block configSearchAction = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenuSearch"); 4677 headerConfigurationPage.RemoveBlock(configSearchAction); 4678 4679 Block configDesktopActionsMenu = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenu"); 4680 headerConfigurationPage.RemoveBlock(configDesktopActionsMenu); 4681 4682 Block configDesktopExtra = headerConfigurationPage.GetBlockById("MasterDesktopExtra"); 4683 4684 switch (topLayout) 4685 { 4686 case "condensed": //2 4687 configDesktopLogo.Design.Size = "auto-width"; 4688 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); 4689 4690 configDesktopMenu.SortId = 20; 4691 configDesktopMenu.Design.Size = "auto"; 4692 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 4693 4694 configDesktopActionsMenu.SortId = 30; 4695 configDesktopActionsMenu.Design.Size = "auto-width"; 4696 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 4697 4698 if (!hideSearch) 4699 { 4700 configSearchBar.SortId = 40; 4701 configSearchBar.Design.Size = "12"; 4702 configDesktopExtra.SortId = 50; 4703 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); 4704 } 4705 break; 4706 case "splitted": //3 4707 configDesktopLogo.Design.Size = "auto"; 4708 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 4709 4710 if (!hideSearch) 4711 { 4712 configSearchBar.SortId = 20; 4713 configSearchBar.Design.Size = "auto"; 4714 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); 4715 } 4716 4717 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 4718 4719 configDesktopActionsMenu.SortId = 20; 4720 configDesktopActionsMenu.Design.Size = "auto-width"; 4721 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 4722 break; 4723 case "minimal": //4 4724 configDesktopLogo.Design.Size = "auto-width"; 4725 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); 4726 4727 configDesktopMenu.Design.Size = "auto"; 4728 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 4729 4730 configDesktopActionsMenu.SortId = 20; 4731 configDesktopActionsMenu.Design.Size = "auto-width"; 4732 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 4733 4734 if (!hideSearch) 4735 { 4736 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 4737 } 4738 break; 4739 case "minimal-right": //5 4740 configDesktopLogo.Design.Size = "auto-width"; 4741 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); 4742 4743 configDesktopMenu.Design.Size = "auto"; 4744 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 4745 4746 configDesktopActionsMenu.SortId = 20; 4747 configDesktopActionsMenu.Design.Size = "auto-width"; 4748 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 4749 4750 if (!hideSearch) 4751 { 4752 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 4753 } 4754 break; 4755 case "two-lines": //6 4756 configDesktopLogo.Design.Size = "auto"; 4757 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 4758 4759 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 4760 4761 configDesktopActionsMenu.SortId = 20; 4762 configDesktopActionsMenu.Design.Size = "auto-width"; 4763 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 4764 4765 if (!hideSearch) 4766 { 4767 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 4768 } 4769 break; 4770 case "two-lines-centered": //7 4771 configDesktopLogo.Design.Size = "auto"; 4772 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 4773 4774 configDesktopMenu.Design.Size = "auto-width"; 4775 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 4776 4777 configDesktopActionsMenu.SortId = 20; 4778 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 4779 4780 if (!hideSearch) 4781 { 4782 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 4783 } 4784 break; 4785 case "normal": //1 4786 default: 4787 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 4788 4789 if (!hideSearch) 4790 { 4791 configSearchBar.SortId = 20; 4792 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); 4793 } 4794 4795 configDesktopActionsMenu.SortId = 30; 4796 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopActionsMenu); 4797 4798 configDesktopActionsMenu.Design.Size = "auto-width"; 4799 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 4800 break; 4801 } 4802 } 4803 @if (File.Exists(HttpContext.Current.Server.MapPath("/Files/Templates/Designs/Rapido/MasterBlocks/HeaderBlocks/Custom__Blocks.cshtml"))) 4804 { 4805 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4806 4807 @using System 4808 @using System.Web 4809 @using Dynamicweb.Rapido.Blocks.Extensibility 4810 @using Dynamicweb.Rapido.Blocks 4811 4812 @{ 4813 4814 }</text> 4815 } 4816 4817 4818 @helper RenderDesktopTools() 4819 { 4820 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopTools").OrderBy(item => item.SortId).ToList(); 4821 4822 4823 4824 <div class="tools-navigation dw-mod"> 4825 <div class="center-container grid top-container__center-container dw-mod"> 4826 @RenderBlockList(subBlocks) 4827 </div> 4828 </div> 4829 } 4830 4831 @helper RenderDesktopToolsText() 4832 { 4833 string toolsText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("ToolsText"); 4834 if (!string.IsNullOrEmpty(toolsText)) 4835 { 4836 <div class="u-margin-top u-margin-bottom">@toolsText</div> 4837 } 4838 } 4839 4840 @helper RenderDesktopToolsNavigation() 4841 { 4842 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 4843 4844 if (renderPagesInToolBar) 4845 { 4846 @RenderNavigation(new 4847 { 4848 id = "topToolsNavigation", 4849 cssclass = "menu menu-tools dw-mod dwnavigation", 4850 template = "TopMenu.xslt" 4851 }) 4852 } 4853 } 4854 4855 @helper RenderDesktopNavigation() 4856 { 4857 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopNavigation").OrderBy(item => item.SortId).ToList(); 4858 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4859 string alignClass = topLayout == "two-lines-centered" ? "grid--justify-center" : ""; 4860 <nav class="main-navigation dw-mod"> 4861 <div class="center-container top-container__center-container grid @alignClass dw-mod"> 4862 @RenderBlockList(subBlocks) 4863 4864 </div> 4865 </nav> 4866 } 4867 4868 @helper RenderDesktopExtra() 4869 { 4870 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopExtra").OrderBy(item => item.SortId).ToList(); 4871 4872 if (subBlocks.Count > 0) 4873 { 4874 <div class="header header-top dw-mod"> 4875 <div class="center-container top-container__center-container grid--justify-space-between grid grid--align-center dw-mod"> 4876 @RenderBlockList(subBlocks) 4877 </div> 4878 </div> 4879 } 4880 }</text> 4881 } 4882 4883 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4884 4885 @using System 4886 @using System.Web 4887 @using Dynamicweb.Rapido.Blocks.Extensibility 4888 @using Dynamicweb.Rapido.Blocks 4889 4890 @{ 4891 Block impersonationBar = new Block 4892 { 4893 Id = "ImpersonationBar", 4894 SortId = 50, 4895 Template = RenderImpersonationBar(), 4896 Design = new Design 4897 { 4898 Size = "auto-width", 4899 HidePadding = true, 4900 RenderType = RenderType.Column 4901 } 4902 }; 4903 4904 if (Model.CurrentUser.ID > 0 && Model.SecondaryUsers.Count > 0) 4905 { 4906 BlocksPage.GetBlockPage("Master").Add("MasterHeader", impersonationBar); 4907 } 4908 } 4909 4910 @helper RenderImpersonationBar() 4911 { 4912 int impersonationPageId = GetPageIdByNavigationTag("Impersonation"); 4913 4914 <div class="u-color-warning--bg"> 4915 <div class="center-container top-container__center-container dw-mod"> 4916 @*Impersonation*@ 4917 <div class="grid"> 4918 <div class="grid--align-self-center grid__col-x"> 4919 @if (Model.CurrentSecondaryUser != null && Model.CurrentSecondaryUser.ID > 0) 4920 { 4921 string stopImpersonateTranslation = Translate("Stop impersonation"); 4922 string username = ""; 4923 if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.FirstName) && !string.IsNullOrEmpty(Model.CurrentSecondaryUser.LastName)) 4924 { 4925 username = Model.CurrentSecondaryUser.FirstName + " " + Model.CurrentSecondaryUser.LastName; 4926 } 4927 else if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.Name)) 4928 { 4929 username = Model.CurrentSecondaryUser.Name; 4930 } 4931 else if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.Email)) 4932 { 4933 username = Model.CurrentSecondaryUser.Email; 4934 } 4935 else 4936 { 4937 username = Model.CurrentSecondaryUser.UserName; 4938 } 4939 <div class="grid-cell"> 4940 <div class="u-pull--left u-bold u-margin-top"> 4941 <i class="fas fa-user-secret"></i> 4942 @Pageview.User.UserName<text>&nbsp;</text>@Translate("is impersonating")<text>&nbsp;</text>@username 4943 </div> 4944 <form method="post" class="u-pull--right u-no-margin"> 4945 <input type="submit" class="btn btn--secondary dw-mod u-no-margin" name="DwExtranetRemoveSecondaryUser" value="@stopImpersonateTranslation"> 4946 </form> 4947 </div> 4948 } 4949 else 4950 { 4951 string viewListTranslation = Translate("View the list of users you can impersonate"); 4952 <div class="grid-cell u-bold"> 4953 <i class="fas fa-user-secret"></i> 4954 <a href="/Default.aspx?ID=@impersonationPageId" title="@viewListTranslation" class="u-color-font-black">@viewListTranslation</a> 4955 </div> 4956 } 4957 </div> 4958 </div> 4959 </div> 4960 </div> 4961 } 4962 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4963 4964 @using System 4965 @using System.Web 4966 @using System.Collections.Generic 4967 @using Dynamicweb.Rapido.Blocks.Extensibility 4968 @using Dynamicweb.Rapido.Blocks 4969 @using NextechDWAddIn.Handlers 4970 @using NextechDWAddIn.Common 4971 4972 @{ 4973 4974 4975 BlocksPage miniCartBlocksPage = BlocksPage.GetBlockPage("Master"); 4976 string orderlinesView = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView").SelectedValue : "table"; 4977 4978 Block orderLines = new Block 4979 { 4980 Id = "MiniCartOrderLines", 4981 SkipRenderBlocksList = true, 4982 BlocksList = new List<Block> 4983 { 4984 new Block { 4985 Id = "MiniCartOrderLinesList", 4986 SortId = 20, 4987 Template = RenderMiniCartOrderLinesList() 4988 } 4989 } 4990 }; 4991 4992 Block orderlinesScriptTemplates = new Block 4993 { 4994 Id = "OrderlinesScriptTemplates" 4995 }; 4996 4997 if (orderlinesView == "table") 4998 { 4999 orderLines.Template = RenderMiniCartOrderLinesTable(); 5000 orderLines.BlocksList.Add( 5001 new Block { 5002 Id = "MiniCartOrderlinesTableHeader", 5003 SortId = 10, 5004 Template = RenderMiniCartOrderLinesHeader() 5005 } 5006 ); 5007 5008 orderlinesScriptTemplates.Template = RenderMiniCartScriptsTableTemplates(); 5009 } 5010 else 5011 { 5012 orderLines.Template = RenderMiniCartOrderLinesBlocks(); 5013 orderlinesScriptTemplates.Template = RenderMiniCartScriptsListTemplates(); 5014 } 5015 5016 miniCartBlocksPage.Add("MasterBottomSnippets", orderlinesScriptTemplates); 5017 5018 Block miniCartScriptTemplates = new Block() 5019 { 5020 Id = "MasterMiniCartTemplates", 5021 SortId = 1, 5022 Template = RenderMiniCartScriptTemplates(), 5023 SkipRenderBlocksList = true, 5024 BlocksList = new List<Block> 5025 { 5026 orderLines, 5027 new Block { 5028 Id = "MiniCartFooter", 5029 Template = RenderMiniCartFooter(), 5030 SortId = 50, 5031 SkipRenderBlocksList = true, 5032 BlocksList = new List<Block> 5033 { 5034 new Block { 5035 Id = "MiniCartFees", 5036 Template = RenderMiniCartFees(), 5037 SortId = 30 5038 }, 5039 new Block { 5040 Id = "MiniCartPoints", 5041 Template = RenderMiniCartPoints(), 5042 SortId = 40 5043 }, 5044 new Block { 5045 Id = "MiniCartTotal", 5046 Template = RenderMiniCartTotal(), 5047 SortId = 50 5048 }, 5049 new Block { 5050 Id = "MiniCartActions", 5051 Template = RenderMiniCartActions(), 5052 SortId = 60 5053 } 5054 } 5055 } 5056 } 5057 }; 5058 5059 miniCartBlocksPage.Add("MasterBottomSnippets", miniCartScriptTemplates); 5060 } 5061 5062 @helper RenderMiniCartScriptsTableTemplates() 5063 { 5064 <script id="MiniCartOrderline" type="text/x-template"> 5065 {{#unless isEmpty}} 5066 <tr> 5067 <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}}"></a></td> 5068 <td class="u-va-middle"> 5069 <a href="{{link}}" class="mini-cart-orderline__name" title="{{name}}">{{name}}</a> 5070 {{#if variantname}} 5071 <a href="{{link}}" class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{variantname}}</a> 5072 {{/if}} 5073 {{#if unitname}} 5074 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{unitname}}</div> 5075 {{/if}} 5076 </td> 5077 <td class="u-ta-right u-va-middle">{{quantity}}</td> 5078 <td class="u-ta-right u-va-middle"> 5079 {{#if pointsTotal}} 5080 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 5081 {{else}} 5082 {{totalprice}} 5083 {{/if}} 5084 </td> 5085 </tr> 5086 5087 {{#OrderLineChildren}} 5088 <tr class="table__row--no-border"> 5089 <!--CS NT Do not show the XDO NOT LET USER REMOVE ProductDiscount--> 5090 <td>&nbsp;</td> 5091 <td colspan="2">{{nameCS}} </td> 5092 <td class="cart-table__price u-ta-right dw-mod">{{totalpriceCS}}</td> 5093 </tr> 5094 {{/OrderLineChildren}} 5095 5096 {{/unless}} 5097 </script> 5098 5099 @*TODO CS NT Comment out and move further below with different html OR add seperator *@ 5100 5101 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 5102 {{#unless isEmpty}} 5103 5104 {{#if parentId}} 5105 {{else}} 5106 <tr class="table__row--no-border"> 5107 <td colspan="3">{{name}}</td> 5108 @*<td class="u-w60px">&nbsp;</td>*@ 5109 @*<td><div class="mini-cart-orderline__name dw-mod">{{name}}</div></td>*@ 5110 @*<td class="u-ta-right">&nbsp;</td>*@ 5111 <td class="u-ta-right">{{totalprice}}</td> 5112 </tr> 5113 {{/if}} 5114 {{/unless}} 5115 </script> 5116 } 5117 5118 @helper RenderMiniCartScriptsListTemplates() 5119 { 5120 int cartOrderlinesFeedPageId = GetPageIdByNavigationTag("CartOrderlinesFeed"); 5121 <script id="MiniCartOrderline" type="text/x-template"> 5122 {{#unless isEmpty}} 5123 <div class="mini-cart-orderline grid dw-mod"> 5124 <div class="grid__col-4"> 5125 <a href="{{link}}" class="{{hideimage}}"> 5126 <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}}"> 5127 </a> 5128 </div> 5129 <div class="grid__col-8"> 5130 <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> 5131 {{#if variantname}} 5132 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Variant"): {{variantname}}</div> 5133 {{/if}} 5134 {{#if unitname}} 5135 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Unit"): {{unitname}}</div> 5136 {{/if}} 5137 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Qty"): {{quantity}}</div> 5138 5139 <div class="grid__cell-footer"> 5140 <div class="grid__cell"> 5141 <div class="u-pull--left mini-cart-orderline__price dw-mod"> 5142 {{#if pointsTotal}} 5143 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 5144 {{else}} 5145 {{totalprice}} 5146 {{/if}} 5147 </div> 5148 <button type="button" title="@Translate("Remove orderline")" class="btn btn--clean btn--condensed u-pull--right mini-cart-orderline__remove-btn dw-mod" onclick="{{removeFromCartGoogleImpression}}; Cart.UpdateCart('Cart', '/Default.aspx?ID=@cartOrderlinesFeedPageId', 'CartCmd=DelOrderLine&key={{orderLineId}}', true);">@Translate("Remove") <i class="fas fa-times"></i></button> 5149 </div> 5150 </div> 5151 </div> 5152 </div> 5153 5154 {{#OrderLineChildren}} 5155 <div class="mini-cart-orderline mini-cart-orderline--discount grid dw-mod"> 5156 <div class="grid__col-4"><!--CS NT Mini cart (not table) product discount lines--> 5157 <div class="mini-cart-orderline__name mini-cart-orderline__name dw-mod">{{nameCS}}</div> 5158 </div> 5159 <div class="grid__col-8">{{totalpriceCS}}</div> 5160 </div> 5161 {{/OrderLineChildren}} 5162 5163 {{/unless}} 5164 </script> 5165 5166 @*TODO CS NT Comment out and move further below with different html OR add seperator *@ 5167 5168 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 5169 {{#unless isEmpty}} 5170 5171 {{#if parentId}} 5172 {{else}} 5173 <div class="mini-cart-orderline mini-cart-orderline--discount grid dw-mod"> 5174 <div class="grid__col-4"> 5175 <div class="mini-cart-orderline__name mini-cart-orderline__name dw-mod">{{name}}</div> 5176 </div> 5177 <div class="grid__col-8">{{totalprice}}</div> 5178 </div> 5179 {{/if}} 5180 {{/unless}} 5181 </script> 5182 } 5183 5184 @helper RenderMiniCartScriptTemplates() 5185 { 5186 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMiniCartTemplates").OrderBy(item => item.SortId).ToList(); 5187 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 5188 string cartPageLink = string.Concat("/Default.aspx?ID=", GetPageIdByNavigationTag("CartPage")); 5189 5190 <script id="MiniCartContent" type="text/x-template"> 5191 {{#.}} 5192 {{#unless isEmpty}} 5193 @if (useGoogleTagManager) 5194 { 5195 <text>{{{googleEnchantImpressionEmptyCart OrderLines}}}</text> 5196 } 5197 @RenderBlockList(subBlocks) 5198 {{/unless}} 5199 {{#if isEmpty}} 5200 {{{locationReload '@cartPageLink'}}} 5201 {{/if}} 5202 {{/.}} 5203 </script> 5204 } 5205 5206 @helper RenderMiniCartOrderLinesTable() 5207 { 5208 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList(); 5209 5210 <div class="u-overflow-auto"> 5211 <table class="table mini-cart-table dw-mod"> 5212 @RenderBlockList(subBlocks) 5213 </table> 5214 </div> 5215 } 5216 5217 @helper RenderMiniCartOrderLinesBlocks() 5218 { 5219 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList(); 5220 5221 <div class="u-overflow-auto"> 5222 @RenderBlockList(subBlocks) 5223 </div> 5224 } 5225 5226 @helper RenderMiniCartOrderLinesHeader() 5227 { 5228 <thead> 5229 <tr> 5230 <td>&nbsp;</td> 5231 <td>@Translate("Product")</td> 5232 <td class="u-ta-right">@Translate("Qty")</td> 5233 <td class="u-ta-right" width="120">@Translate("Price")</td> 5234 </tr> 5235 </thead> 5236 } 5237 5238 @helper RenderMiniCartOrderLinesList() 5239 { 5240 <text> 5241 {{#OrderLines}} 5242 {{#ifCond template "===" "CartOrderline"}} 5243 {{>MiniCartOrderline}} 5244 {{/ifCond}} 5245 {{#ifCond template "===" "CartOrderlineMobile"}} 5246 {{>MiniCartOrderline}} 5247 {{/ifCond}} 5248 {{#ifCond template "===" "CartOrderlineDiscount"}} 5249 {{>MiniCartOrderlineDiscount}} 5250 {{/ifCond}} 5251 {{/OrderLines}} 5252 </text> 5253 } 5254 5255 @helper RenderMiniCartFees() 5256 { 5257 @*CS NT Hide Payment 5258 <div class="grid u-border-top grid--external-bleed-bottom"> 5259 <div class="grid__col-6"> 5260 {{paymentmethod}} 5261 </div> 5262 <div class="grid__col-6 grid--align-end">{{paymentfee}}</div> 5263 </div> 5264 *@ 5265 <div class="grid grid--external-bleed-bottom"> 5266 <div class="grid__col-6"> 5267 {{shippingmethod}} 5268 </div> 5269 <div class="grid__col-6 grid--align-end">{{shippingfee}}</div> 5270 </div> 5271 } 5272 5273 @helper RenderMiniCartFooter() 5274 { 5275 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartFooter").OrderBy(item => item.SortId).ToList(); 5276 5277 <div class="mini-cart__footer dw-mod"> 5278 @RenderBlockList(subBlocks) 5279 </div> 5280 } 5281 5282 @helper RenderMiniCartActions() 5283 { 5284 int cartPageId = GetPageIdByNavigationTag("CartPage"); 5285 5286 <!-- CS NT Hide Empty Cart <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>--> 5287 <a href="/Default.aspx?ID=@cartPageId" title="@Translate("Proceed to checkout")" class="btn btn--primary u-full-width u-no-margin dw-mod">@Translate("Proceed to checkout")</a> 5288 } 5289 5290 @helper RenderMiniCartPoints() 5291 { 5292 <text> 5293 {{#if earnings}} 5294 <div class="grid grid--external-bleed-bottom"> 5295 <div class="grid__col-6">@Translate("Earnings")</div> 5296 <div class="grid__col-6 grid--align-end"> 5297 <div> 5298 <span class="u-color--loyalty-points">{{earnings}}</span> @Translate("points") 5299 </div> 5300 </div> 5301 </div> 5302 {{/if}} 5303 </text> 5304 } 5305 5306 @helper RenderMiniCartTotal() 5307 { 5308 <div class="mini-cart-totals grid u-margin-bottom dw-mod"> 5309 <div class="grid__col-6">@Translate("Total")</div> 5310 <div class="grid__col-6 grid--align-end">{{totalprice}}</div> 5311 </div> 5312 } 5313 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5314 5315 @using Dynamicweb.Rapido.Blocks.Extensibility 5316 @using Dynamicweb.Rapido.Blocks 5317 5318 @{ 5319 bool addToCartNotificationOnlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 5320 string addToCartNotificationType = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType").SelectedValue : ""; 5321 bool addToCartHideCartIcon = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 5322 5323 if (!addToCartNotificationOnlyPreview && !string.IsNullOrEmpty(addToCartNotificationType)) { 5324 if (addToCartNotificationType == "modal") 5325 { 5326 Block addToCartNotificationModal = new Block 5327 { 5328 Id = "AddToCartNotificationModal", 5329 Template = RenderAddToCartNotificationModal() 5330 }; 5331 5332 Block addToCartNotificationScript = new Block 5333 { 5334 Id = "AddToCartNotificationScript", 5335 Template = RenderAddToCartNotificationModalScript() 5336 }; 5337 BlocksPage.GetBlockPage("Master").Add("MasterTopSnippets", addToCartNotificationModal); 5338 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript); 5339 } 5340 else if (addToCartNotificationType == "toggle" && !addToCartHideCartIcon && Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 5341 { 5342 Block addToCartNotificationScript = new Block 5343 { 5344 Id = "AddToCartNotificationScript", 5345 Template = RenderAddToCartNotificationToggleScript() 5346 }; 5347 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript); 5348 } 5349 } 5350 } 5351 5352 @helper RenderAddToCartNotificationModal() 5353 { 5354 <div id="LastAddedProductModal" data-template="LastAddedProductTemplate"></div> 5355 } 5356 5357 @helper RenderAddToCartNotificationModalScript() 5358 { 5359 int cartPageId = GetPageIdByNavigationTag("CartPage"); 5360 5361 <script id="LastAddedProductTemplate" type="text/x-template"> 5362 <!-- Trigger for the login modal --> 5363 <input type="checkbox" id="LastAddedProductModalTrigger" class="modal-trigger" /> 5364 5365 <!-- Login modal --> 5366 <div class="modal-container"> 5367 <label for="LastAddedProductModalTrigger" class="modal-overlay"></label> 5368 <div class="modal modal--md"> 5369 <div class="modal__header"> 5370 <h2>@Translate("Product is added to the cart")</h2> 5371 </div> 5372 <div class="modal__body"> 5373 <div class="grid"> 5374 <div class="grid__col-2"> 5375 <a href="{{productInfo.link}}"> 5376 <img src="{{productInfo.image}}" alt="{{productInfo.name}}" class="dw-mod" /> 5377 </a> 5378 </div> 5379 <div class="u-padding grid--align-self-center"> 5380 <span>{{quantity}}</span> x 5381 </div> 5382 <div class="grid__col-auto grid--align-self-center"> 5383 <div>{{productInfo.name}}</div> 5384 {{#if productInfo.variantName}} 5385 <small class="u-margin-bottom-5px">{{productInfo.variantName}}</small> 5386 {{/if}} 5387 {{#if productInfo.unitName}} 5388 <small class="u-margin-bottom-5px">{{productInfo.unitName}}</small> 5389 {{/if}} 5390 </div> 5391 </div> 5392 <div class="modal__footer u-margin-top--lg"> 5393 <label class="btn btn--secondary u-pull--left u-no-margin dw-mod btn--sm" for="LastAddedProductModalTrigger">@Translate("Continue shopping")</label> 5394 <a href="/Default.aspx?ID=@cartPageId" class="btn btn--primary u-pull--right u-no-margin dw-mod btn--sm">@Translate("Proceed to checkout")</a> 5395 </div> 5396 </div> 5397 <label class="modal__close-btn" for="LastAddedProductModalTrigger"></label> 5398 </div> 5399 </div> 5400 </script> 5401 <script> 5402 document.addEventListener('addToCart', function (event) { 5403 Cart.ShowLastAddedProductModal(event.detail); 5404 }); 5405 </script> 5406 } 5407 5408 @helper RenderAddToCartNotificationToggleScript() 5409 { 5410 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 5411 5412 <script> 5413 document.addEventListener('addToCart', function () { 5414 Cart.ToggleMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '@miniCartFeedPageId'); 5415 }); 5416 </script> 5417 } 5418 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5419 5420 @using System 5421 @using System.Web 5422 @using System.Collections.Generic 5423 @using Dynamicweb.Rapido.Blocks.Extensibility 5424 @using Dynamicweb.Rapido.Blocks 5425 5426 @functions { 5427 BlocksPage footerBlocksPage = BlocksPage.GetBlockPage("Master"); 5428 } 5429 5430 @{ 5431 string footerColumnOneContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Content"); 5432 string footerColumnTwoContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Content"); 5433 string footerColumnThreeContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Content"); 5434 string footerColumnOneHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Header"); 5435 string footerColumnTwoHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Header"); 5436 string footerColumnThreeHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Header"); 5437 5438 Block masterFooterContent = new Block() 5439 { 5440 Id = "MasterFooterContent", 5441 SortId = 10, 5442 Template = RenderFooter(), 5443 SkipRenderBlocksList = true 5444 }; 5445 footerBlocksPage.Add(MasterBlockId.MasterFooter, masterFooterContent); 5446 5447 if (!string.IsNullOrEmpty(footerColumnOneContent) || !string.IsNullOrEmpty(footerColumnOneHeader)) 5448 { 5449 Block masterFooterColumnOne = new Block 5450 { 5451 Id = "MasterFooterColumnOne", 5452 SortId = 10, 5453 Template = RenderFooterColumn(footerColumnOneHeader, footerColumnOneContent), 5454 Design = new Design { 5455 Size = "auto", 5456 RenderType = RenderType.Column 5457 } 5458 }; 5459 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnOne); 5460 } 5461 5462 if (!string.IsNullOrEmpty(footerColumnTwoContent) || !string.IsNullOrEmpty(footerColumnTwoHeader)) 5463 { 5464 Block masterFooterColumnTwo = new Block 5465 { 5466 Id = "MasterFooterColumnTwo", 5467 SortId = 20, 5468 Template = RenderFooterColumn(footerColumnTwoHeader, footerColumnTwoContent), 5469 Design = new Design 5470 { 5471 Size = "auto", 5472 RenderType = RenderType.Column 5473 } 5474 }; 5475 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnTwo); 5476 } 5477 5478 if (!string.IsNullOrEmpty(footerColumnThreeContent) || !string.IsNullOrEmpty(footerColumnThreeHeader)) 5479 { 5480 Block masterFooterColumnThree = new Block 5481 { 5482 Id = "MasterFooterColumnThree", 5483 SortId = 30, 5484 Template = RenderFooterColumn(footerColumnThreeHeader, footerColumnThreeContent), 5485 Design = new Design 5486 { 5487 Size = "auto", 5488 RenderType = RenderType.Column 5489 } 5490 }; 5491 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnThree); 5492 } 5493 5494 if (Model.Area.Item.GetItem("Layout").GetBoolean("FooterNewsletterSignUp")) 5495 { 5496 Block masterFooterNewsletterSignUp = new Block 5497 { 5498 Id = "MasterFooterNewsletterSignUp", 5499 SortId = 40, 5500 Template = RenderFooterNewsletterSignUp(), 5501 Design = new Design 5502 { 5503 Size = "auto", 5504 RenderType = RenderType.Column 5505 } 5506 }; 5507 footerBlocksPage.Add("MasterFooterContent", masterFooterNewsletterSignUp); 5508 } 5509 5510 if (Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks").Count > 0) 5511 { 5512 Block masterFooterSocialLinks = new Block 5513 { 5514 Id = "MasterFooterSocialLinks", 5515 SortId = 50, 5516 Template = RenderFooterSocialLinks(), 5517 Design = new Design 5518 { 5519 Size = "auto", 5520 RenderType = RenderType.Column 5521 } 5522 }; 5523 footerBlocksPage.Add("MasterFooterContent", masterFooterSocialLinks); 5524 } 5525 5526 if (Model.Area.Item.GetItem("Layout").GetItems("FooterPayments") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterPayments").Count > 0) 5527 { 5528 Block masterFooterPayments = new Block 5529 { 5530 Id = "MasterFooterPayments", 5531 SortId = 60, 5532 Template = RenderFooterPayments(), 5533 Design = new Design 5534 { 5535 Size = "12", 5536 RenderType = RenderType.Column 5537 } 5538 }; 5539 footerBlocksPage.Add("MasterFooterContent", masterFooterPayments); 5540 } 5541 5542 Block masterFooterCopyright = new Block 5543 { 5544 Id = "MasterFooterCopyright", 5545 SortId = 70, 5546 Template = RenderFooterCopyright(), 5547 Design = new Design 5548 { 5549 Size = "12", 5550 RenderType = RenderType.Column 5551 } 5552 }; 5553 footerBlocksPage.Add("MasterFooterContent", masterFooterCopyright); 5554 } 5555 5556 @helper RenderFooter() { 5557 List<Block> subBlocks = this.footerBlocksPage.GetBlockListById("MasterFooterContent").OrderBy(item => item.SortId).ToList(); 5558 5559 <footer class="footer dw-mod"> 5560 <div class="center-container u-padding dw-mod" id="productPageDeliveryBenefitsAdvice"> 5561 <div class="grid productPage-Delivery-Benefits-Advice"> 5562 <div class="grid__col-lg-4 grid__col-md-4 grid__col-sm-12 grid__col-xs-12 oneThirdDiv"> 5563 <p> 5564 <a href="/"> 5565 <img src="Files/Images/General/delivery_icon.svg" /> 5566 </a> 5567 </p> 5568 <div> 5569 <p><strong>Free Standard Delivery when you </strong></p> 5570 5571 <p><strong>spend &euro;15 or more</strong></p> 5572 5573 <p>Delivery will take 3-5 working days</p> 5574 </div> 5575 </div> 5576 5577 <div class="grid__col-lg-4 grid__col-md-4 grid__col-sm-12 grid__col-xs-12 oneThirdDiv"> 5578 <p> 5579 <a href="/createecommerceaccount"> 5580 <img src="Files/Images/General/loyalty_icon.svg" /> 5581 </a> 5582 </p> 5583 <div> 5584 <p> 5585 <a href="/createecommerceaccount"><strong>Join our &lsquo;Benefits&rsquo; Loyalty Scheme</strong></a> 5586 </p> 5587 <p>Join our loyalty scheme today. Every &euro;1 of purchases adds 1 point to your account</p> 5588 <p>&nbsp;</p> 5589 </div> 5590 </div> 5591 5592 <div class="grid__col-lg-4 grid__col-md-4 grid__col-sm-12 grid__col-xs-12 oneThirdDiv"> 5593 <p> 5594 <a href="/expertly-trained"> 5595 <img src="Files/Images/General/ExpertlyTrained_footer_small.png" style="width: 55px; height: 45px;" /> 5596 </a> 5597 </p> 5598 <div> 5599 <p> 5600 <a href="/expertly-trained"><strong>@Translate("Ask our Experts!")</strong></a> 5601 </p> 5602 <p>@Translate("All our store colleagues are expertly trained to the highest standards within the industry. Visit us in-store or online.")</p> 5603 <p>&nbsp;</p> 5604 </div> 5605 </div> 5606 </div> 5607 </div> 5608 <div class="center-container top-container__center-container dw-mod"> 5609 5610 <!-- CS NT add Payments-Social and Lines Start..--> 5611 <div class="fullSoftLine"></div> 5612 <div class="grid" style="padding: 1rem 0;"> 5613 <!--<div class="oneHalfDiv_Payments"><img src="Files/Images/General/payment-options.svg" /></div> 5614 <div class="oneHalfDiv_Social"><img src="Files/Images/General/social-instagram.svg" /> <img src="Files/Images/General/social-facebook.svg" /></div>--> 5615 <div class="oneDiv_Payments"><img src="Files/Images/General/payments options.png" /></div> 5616 </div> 5617 <div class="fullThickLine"></div> 5618 <!-- CS NT add Payments-Social and Lines ..End--> 5619 5620 <div class="grid grid--external-bleed-x"> 5621 @RenderBlockList(subBlocks) 5622 </div> 5623 </div> 5624 </footer> 5625 } 5626 5627 @helper RenderFooterColumn(string header, string content) { 5628 <h3 class="footer__heading dw-mod">@header</h3> 5629 <div class="footer__content dw-mod"> 5630 @content 5631 </div> 5632 } 5633 5634 @helper RenderFooterNewsletterSignUp() { 5635 string newsletterSignUpPageId = GetPageIdByNavigationTag("NewsletterSignUp").ToString(); 5636 5637 <h3 class="footer__heading dw-mod">@Translate("Mailing list")</h3> 5638 <div class="footer__content dw-mod"> 5639 <form class="form dw-mod" name="NewsletterRedirect" action='/Default.aspx' method="get" enctype="multipart/form-data"> 5640 <input name="ID" value="@newsletterSignUpPageId" type="hidden" /> 5641 <label for="NewsletterEmail" class="u-margin-bottom">@Translate("Sign up if you would like to receive occasional treats from us", "Sign up if you would like to receive occasional treats from us")</label> 5642 <div class="form__field-combi"> 5643 <input name="NewsletterEmail" id="NewsletterEmail" type="text" placeholder='@Translate("Your email address", "Your email address")' class="u-full-width use-btn-primary-height" /> 5644 <input class="btn btn--primary btn--condensed dw-mod" type="submit" id="Submitter" value='@Translate("Go", "Go")' /> 5645 </div> 5646 </form> 5647 </div> 5648 } 5649 5650 @helper RenderFooterSocialLinks() { 5651 <h3 class="footer__heading dw-mod">@Translate("Social links")</h3> 5652 <div class="footer__content dw-mod"> 5653 <div class="collection dw-mod"> 5654 @foreach (var socialitem in Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks")) 5655 { 5656 var socialIcon = socialitem.GetValue("Icon") as Dynamicweb.Frontend.ListViewModel; 5657 string socialIconClass = socialIcon.SelectedValue; 5658 string socialIconTitle = socialIcon.SelectedName; 5659 string socialLink = socialitem.GetString("Link"); 5660 5661 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px" rel="noopener"><i class="@socialIconClass fa-2x"></i></a> 5662 } 5663 </div> 5664 </div> 5665 } 5666 5667 @helper RenderFooterPayments() { 5668 <div class="footer__content dw-mod"> 5669 <div class="collection dw-mod"> 5670 @foreach (var payment in Model.Area.Item.GetItem("Layout").GetItems("FooterPayments")) 5671 { 5672 var paymentItem = payment.GetValue("CardTypeOrVerifiedPayment") as Dynamicweb.Frontend.ListViewModel; 5673 string paymentImage = null; 5674 string paymentTitle = paymentItem.SelectedName; 5675 ListOptionViewModel selected = paymentItem.SelectedOptions.FirstOrDefault(); 5676 if (selected != null) 5677 { 5678 paymentImage = selected.Icon; 5679 } 5680 5681 <div class="footer__card-type"> 5682 <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" /> 5683 </div> 5684 } 5685 </div> 5686 </div> 5687 } 5688 5689 @helper RenderFooterCopyright() { 5690 <div class="grid__col-12 footer__copyright dw-mod"> 5691 <p>@Model.Area.Item.GetItem("Layout").GetString("FooterCopyrightText")</p> 5692 </div> 5693 } 5694 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 5695 5696 @using System 5697 @using System.Web 5698 @using System.Collections.Generic 5699 @using Dynamicweb.Rapido.Blocks.Extensibility 5700 @using Dynamicweb.Rapido.Blocks 5701 @using Dynamicweb.Ecommerce.Common 5702 5703 @{ 5704 BlocksPage referencesBlocksPage = BlocksPage.GetBlockPage("Master"); 5705 5706 Block masterScriptReferences = new Block() 5707 { 5708 Id = "MasterScriptReferences", 5709 SortId = 1, 5710 Template = RenderMasterScriptReferences() 5711 }; 5712 referencesBlocksPage.Add(MasterBlockId.MasterReferences, masterScriptReferences); 5713 } 5714 5715 @helper RenderMasterScriptReferences() 5716 { 5717 5718 5719 <script src="/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js"></script> 5720 <!--CS NT Use ticks <script src="/Files/Templates/Designs/Rapido/js/master.min.js"></script>--> 5721 //CS NT Ticks for files 5722 var masterMinJSfileInfo = new System.IO.FileInfo(System.Web.HttpContext.Current.Server.MapPath("/Files/Templates/Designs/Rapido/js/master.min.js")); 5723 <script type="text/javascript" src="/Files/Templates/Designs/Rapido/js/master.min.js?ticks=@masterMinJSfileInfo.LastWriteTime.Ticks.ToString()"></script> 5724 5725 if (Model.Area.Item.GetItem("Custom").GetBoolean("UseCustomJavascript")) 5726 { 5727 <script src="/Files/Templates/Designs/Rapido/js/custom.min.js"></script> 5728 PushPromise("/Files/Templates/Designs/Rapido/js/custom.min.js"); 5729 } 5730 5731 PushPromise("/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js"); 5732 PushPromise("/Files/Templates/Designs/Rapido/js/master.min.js"); 5733 } 5734 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5735 5736 @using System 5737 @using System.Web 5738 @using System.Collections.Generic 5739 @using Dynamicweb.Rapido.Blocks.Extensibility 5740 @using Dynamicweb.Rapido.Blocks 5741 5742 @{ 5743 BlocksPage searchBlocksPage = BlocksPage.GetBlockPage("Master"); 5744 bool navigationItemsHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 5745 bool isFavoriteList = !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("ListID")); 5746 5747 if (!navigationItemsHideSearch || isFavoriteList) 5748 { 5749 Block masterSearchScriptTemplates = new Block() 5750 { 5751 Id = "MasterSearchScriptTemplates", 5752 SortId = 1, 5753 Template = RenderSearchScriptTemplates() 5754 }; 5755 5756 searchBlocksPage.Add(MasterBlockId.MasterBottomSnippets, masterSearchScriptTemplates); 5757 } 5758 } 5759 5760 @helper RenderSearchScriptTemplates() 5761 { 5762 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 5763 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 5764 bool useFacebookPixel = !string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID")); 5765 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 5766 bool useGoogleTagManager = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID")); 5767 bool showPrice = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HidePriceInSearchResults"); 5768 bool showAddToCartButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideAddToCartButton"); 5769 bool showViewButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideViewButton"); 5770 bool showAddToDownloadButton = Pageview.AreaSettings.GetItem("Layout").GetBoolean("ShowAddToDownloadButton"); 5771 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 5772 5773 <script id="SearchGroupsTemplate" type="text/x-template"> 5774 {{#.}} 5775 <li class="dropdown__item dw-mod" onclick="Search.UpdateGroupSelection(this)" data-group-id="{{id}}">{{name}}</li> 5776 {{/.}} 5777 </script> 5778 5779 <script id="SearchProductsTemplate" type="text/x-template"> 5780 {{#each .}} 5781 {{#Product}} 5782 {{#ifCond template "!==" "SearchMore"}} 5783 <li class="dropdown__item dropdown__item--seperator dw-mod"> 5784 @if (useFacebookPixel) 5785 { 5786 <text>{{{facebookPixelSearch name number priceDouble currency searchParameter}}}</text> 5787 } 5788 @if (useGoogleTagManager) 5789 { 5790 <text>{{{googleEnchantImpression 'Search results' currency googleImpression}}}</text> 5791 } 5792 <div> 5793 <a href="{{link}}" class="js-typeahead-link u-color-inherit u-pull--left" onclick="{{googleImpressionClick}}" title="{{name}}"> 5794 <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}}"></div> 5795 <div class="u-pull--left"> 5796 <div class="u-bold u-max-w220px u-truncate-text js-typeahead-name">{{name}}</div> 5797 @if (showPrice && !onlyPreview) 5798 { 5799 if (pointShopOnly) 5800 { 5801 <text> 5802 {{#if havePointPrice}} 5803 <div> 5804 <span class="u-color--loyalty-points">{{points}}</span> @Translate("points") 5805 </div> 5806 {{else}} 5807 <small class="help-text u-no-margin">@Translate("Not available")</small> 5808 {{/if}} 5809 {{#unless canBePurchasedWithPoints}} 5810 {{#if havePointPrice}} 5811 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small> 5812 {{/if}} 5813 {{/unless}} 5814 </text> 5815 } 5816 else 5817 { 5818 <div>{{price}}</div> 5819 } 5820 } 5821 </div> 5822 </a> 5823 <div class="u-margin-left u-pull--right"> 5824 @if (showAddToCartButton && !onlyPreview) { 5825 if (pointShopOnly) 5826 { 5827 <button type="button" class="btn btn--primary btn--condensed btn--full u-no-margin dw-mod {{hideBuyOptions}} js-ignore-click-outside {{#unless canBePurchasedWithPoints}}js-stay-disabled{{/unless}}" name="CartCmd" value="addWithPoints" 5828 onclick="Cart.AddToCart(event, { 5829 id: '{{productId}}', 5830 quantity: 1, 5831 buyForPoints: true, 5832 productInfo: {{productInfo}} 5833 }); {{facebookPixelAction}}" {{disabledBuyButton}}> 5834 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue js-ignore-click-outside"></i> 5835 </button> 5836 } else { 5837 @* CS NT Comment out for onClick.. 5838 <button type="button" class="btn btn--primary btn--condensed btn--full u-no-margin dw-mod {{hideBuyOptions}} js-ignore-click-outside" 5839 onclick="Cart.AddToCart(event, { 5840 id: '{{productId}}', 5841 quantity: 1, 5842 productInfo: {{productInfo}} 5843 }); {{facebookPixelAction}}"> 5844 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue js-ignore-click-outside"></i> 5845 </button> 5846 .. CS NT Comment out for onClick*@ 5847 <input type="number" class="product__quantity-selector u-w70px use-btn-primary-height dw-mod" style="display: none;" id="Quantity_{{id}}" name="Quantity" value="1" min="1" data-qtyincart="{{qtyInCart}}" data-id="{{id}}"> 5848 <button type="button" id="CartButton_{{id}}" class="btn btn--primary btn--condensed btn--full u-no-margin dw-mod {{hideBuyOptions}} js-ignore-click-outside" 5849 onclick="ProductAddToCart(event, {{id}}, { 5850 id: '{{productId}}', 5851 variantId: '{{variantid}}', 5852 unitId: '{{unitId}}', 5853 quantity: 1, 5854 productInfo: {{productInfo}} 5855 }); {{facebookPixelAction}}" > 5856 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue js-ignore-click-outside"></i> 5857 </button> 5858 } 5859 <a href="{{link}}" onclick="{{googleImpressionClick}}" class="btn btn--secondary btn--condensed btn--full u-no-margin dw-mod {{hideViewMore}} js-ignore-click-outside" title="@Translate("View")">@Translate("View")</a> 5860 } 5861 else if (showViewButton) 5862 { 5863 <a href="{{link}}" onclick="{{googleImpressionClick}}" class="btn btn--secondary btn--condensed btn--full u-no-margin dw-mod js-ignore-click-outside" title="@Translate("View")">@Translate("View")</a> 5864 } 5865 @if (showAddToDownloadButton) 5866 { 5867 <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}}"> 5868 <i class="fas fa-plus js-button-icon"></i> 5869 </button> 5870 } 5871 </div> 5872 5873 <div class="error-message" style="display:none" id="error-message{{id}}"> 5874 <br /> 5875 <div class="error-block-nextech">@Translate("Available stock is") <span id="stockSpan{{id}}"></span></div> 5876 </div> 5877 5878 </div> 5879 </li> 5880 {{/ifCond}} 5881 {{#ifCond template "===" "SearchMore"}} 5882 {{>SearchMoreProducts}} 5883 {{/ifCond}} 5884 {{/Product}} 5885 {{else}} 5886 <li class="dropdown__item dropdown__item--seperator dw-mod"> 5887 @Translate("Your search gave 0 results") 5888 </li> 5889 {{/each}} 5890 </script> 5891 5892 <script id="SearchMoreProducts" type="text/x-template"> 5893 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 5894 <a href="/Default.aspx?ID=@productsPageId&Search={{searchParameter}}&GroupID={{groupId}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 5895 @Translate("View all") 5896 </a> 5897 </li> 5898 </script> 5899 5900 <script id="SearchMorePages" type="text/x-template"> 5901 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 5902 <a href="/Default.aspx?ID=@contentSearchPageLink&Search={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 5903 @Translate("View all") 5904 </a> 5905 </li> 5906 </script> 5907 5908 <script id="SearchPagesTemplate" type="text/x-template"> 5909 {{#each .}} 5910 {{#ifCond template "!==" "SearchMore"}} 5911 <li class="dropdown__item dropdown__item--seperator dw-mod"> 5912 <div> 5913 <a href="/Default.aspx?ID={{id}}" class="js-typeahead-link u-pull--left u-color-inherit"> 5914 <div class="u-margin-right u-pull--left"><i class="fa {{icon}} u-w20px u-ta-center"></i></div> 5915 <div class="u-pull--left"> 5916 <div class="u-bold u-truncate-text u-max-w220px js-typeahead-name">{{name}}</div> 5917 </div> 5918 </a> 5919 </div> 5920 </li> 5921 {{/ifCond}} 5922 {{#ifCond template "===" "SearchMore"}} 5923 {{>SearchMorePages}} 5924 {{/ifCond}} 5925 {{else}} 5926 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable dw-mod"> 5927 @Translate("Your search gave 0 results") 5928 </li> 5929 {{/each}} 5930 </script> 5931 5932 <script id="SearchPagesTemplateWrap" type="text/x-template"> 5933 <div class="dropdown__column-header">@Translate("Pages")</div> 5934 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom dw-mod"> 5935 {{>SearchPagesTemplate}} 5936 </ul> 5937 </script> 5938 5939 <script id="SearchProductsTemplateWrap" type="text/x-template"> 5940 <div class="dropdown__column-header">@Translate("Products")</div> 5941 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom dw-mod"> 5942 {{>SearchProductsTemplate}} 5943 </ul> 5944 </script> 5945 } 5946 5947 5948 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 5949 5950 @using System 5951 @using System.Web 5952 @using System.Collections.Generic 5953 @using Dynamicweb.Rapido.Blocks.Extensibility 5954 @using Dynamicweb.Rapido.Blocks 5955 5956 @{ 5957 BlocksPage bottomSnippetsBlocksPage = BlocksPage.GetBlockPage("Master"); 5958 5959 Block primaryBottomSnippets = new Block() 5960 { 5961 Id = "MasterJavascriptInitializers", 5962 SortId = 100, 5963 Template = RenderPrimaryBottomSnippets() 5964 }; 5965 bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, primaryBottomSnippets); 5966 } 5967 5968 @helper RenderPrimaryBottomSnippets() { 5969 bool isWireframeMode = Model.Area.Item.GetItem("Settings").GetBoolean("WireframeMode"); 5970 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 5971 5972 if (isWireframeMode) 5973 { 5974 <script> 5975 Wireframe.Init(true); 5976 </script> 5977 } 5978 5979 5980 if (useGoogleTagManager) 5981 { 5982 <script> 5983 document.addEventListener('addToCart', function(event) { 5984 var googleImpression = event.detail.productInfo.googleImpression; 5985 dataLayer.push({ 5986 'event': 'addToCart', 5987 'ecommerce': { 5988 'currencyCode': '@Dynamicweb.Ecommerce.Services.Currencies.GetDefaultCurrency().Code', 5989 'add': { 5990 'products': [{ 5991 'name': googleImpression.name, 5992 'id': googleImpression.id, 5993 'price': googleImpression.price, 5994 'brand': googleImpression.brand, 5995 'category': googleImpression.category, 5996 'variant': googleImpression.variant, 5997 'quantity': event.detail.quantity 5998 }] 5999 } 6000 } 6001 }); 6002 }); 6003 </script> 6004 } 6005 6006 //if digitalwarehouse 6007 if (Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart")) 6008 { 6009 string cartContextId = Converter.ToString(HttpContext.Current.Application["DownloadCartContext"]); 6010 6011 if (string.IsNullOrEmpty(cartContextId)) { 6012 var moduleProps = Dynamicweb.Modules.Properties.GetParagraphModuleSettings(GetPageIdByNavigationTag("DownloadCart"), "eCom_CartV2"); 6013 var cartSettings = new Dynamicweb.Ecommerce.Cart.ModuleSettings(moduleProps); 6014 cartContextId = cartSettings.OrderContextID; 6015 HttpContext.Current.Application["DownloadCartContext"] = cartContextId; 6016 } 6017 6018 <script> 6019 let downloadCart = new DownloadCart({ 6020 cartPageId: @GetPageIdByNavigationTag("MiniCartFeed"), 6021 contextId: "@cartContextId", 6022 addButtonText: "@Translate("Add")", 6023 removeButtonText: "@Translate("Remove")" 6024 }); 6025 </script> 6026 } 6027 6028 <!--$$Javascripts--> 6029 } 6030 @if (File.Exists(HttpContext.Current.Server.MapPath("/MasterBlocks/Custom__Blocks.cshtml"))) 6031 { 6032 <text>@inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 6033 6034 @using System 6035 @using System.Web 6036 @using System.Collections.Generic 6037 @using Dynamicweb.Rapido.Blocks 6038 6039 @{ 6040 BlocksPage masterCustomBlocksPage = BlocksPage.GetBlockPage("Master"); 6041 6042 }</text> 6043 } 6044 6045 6046 @functions { 6047 public class ManifestIcon 6048 { 6049 public string src { get; set; } 6050 public string type { get; set; } 6051 public string sizes { get; set; } 6052 } 6053 6054 public class Manifest 6055 { 6056 public string name { get; set; } 6057 public string short_name { get; set; } 6058 public string start_url { get; set; } 6059 public string display { get; set; } 6060 public string background_color { get; set; } 6061 public string theme_color { get; set; } 6062 public List<ManifestIcon> icons { get; set; } 6063 } 6064 } 6065 @{ 6066 if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName")) && Model.Area.Item.GetItem("Settings").GetFile("AppIcon") != null) { 6067 Manifest manifest = new Manifest 6068 { 6069 name = Model.Area.Item.GetItem("Settings").GetString("AppName"), 6070 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"), 6071 start_url = "/", 6072 display = "standalone", 6073 background_color = Model.Area.Item.GetItem("Settings").GetString("AppBackgroundColor"), 6074 theme_color = Model.Area.Item.GetItem("Settings").GetString("AppThemeColor") 6075 }; 6076 6077 manifest.icons = new List<ManifestIcon> { 6078 new ManifestIcon { 6079 src = "/Admin/Public/GetImage.ashx?width=192&height=192&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 6080 sizes = "192x192", 6081 type = "image/png" 6082 }, 6083 new ManifestIcon { 6084 src = "/Admin/Public/GetImage.ashx?width=512&height=512&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 6085 sizes = "512x512", 6086 type = "image/png" 6087 }, 6088 new ManifestIcon { 6089 src = "/Admin/Public/GetImage.ashx?width=1024&height=1024&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 6090 sizes = "1024x1024", 6091 type = "image/png" 6092 } 6093 }; 6094 6095 string manifestFilePath = HttpContext.Current.Request.MapPath("/Files/Templates/Designs/Rapido/manifest.json"); 6096 string manifestJSON = Newtonsoft.Json.JsonConvert.SerializeObject(manifest); 6097 string currentManifest = File.ReadAllText(manifestFilePath); 6098 6099 if (manifestJSON != currentManifest) 6100 { 6101 File.WriteAllText(manifestFilePath, manifestJSON); 6102 } 6103 } 6104 } 6105 6106 @{ 6107 var swatches = new Dynamicweb.Content.Items.ColorSwatchService(); 6108 var brandColors = swatches.GetColorSwatch(1); 6109 string brandColorOne = brandColors.Palette["BrandColor1"]; 6110 6111 //CS NT Ticks for files 6112 var customJSfileInfo = new System.IO.FileInfo(System.Web.HttpContext.Current.Server.MapPath("/Files/Templates/Designs/Rapido/js/source/Custom.js")); 6113 var nextechCSSfileInfo = new System.IO.FileInfo(System.Web.HttpContext.Current.Server.MapPath("/Files/Templates/Designs/Rapido/css/nextech.css")); 6114 6115 string addId_FB = ""; 6116 string url_FB = HttpContext.Current.Request.Url.AbsoluteUri; 6117 string imageURL_FB_path = ""; 6118 string imageURL_FB = ""; 6119 string imageExtension_FB ="png"; 6120 string title_FB = ""; 6121 string description_FB = ""; 6122 if(Model != null && Model.Item != null && Model.Item.GetFile("Image") != null )//&& !string.IsNullOrWhiteSpace(Model.Item.GetFile("Image").Path)) 6123 { 6124 imageURL_FB_path = Model.Item.GetFile("Image").ToString(); 6125 imageURL_FB = string.Format("{0}://{1}{2}", Dynamicweb.Context.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, imageURL_FB_path); 6126 title_FB = Model.Item.GetString("Title"); 6127 description_FB = Model.Item.GetString("Summary"); 6128 imageExtension_FB = Model.Item.GetFile("Image").Extension.Replace(".",""); 6129 6130 }else{ 6131 imageURL_FB = "https://staging.hollandandbarrett.com.cy/Files/Images/FeaturedImageForURLs.png"; 6132 title_FB = "Holland & Barrett Cyprus"; 6133 description_FB = "Holland And Barrett Cyprus"; 6134 } 6135 imageExtension_FB = "image/" + imageExtension_FB; 6136 6137 if (!string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID"))) 6138 { 6139 //addId_FB = Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID"); 6140 } 6141 6142 } 6143 6144 <!DOCTYPE html> 6145 6146 <html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName"> 6147 <head> 6148 <!-- Rapido version 3.1.1 --> 6149 <meta charset="utf-8" /> 6150 <title>@Model.Title</title> 6151 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 6152 <meta name="robots" content="index, follow"> 6153 <meta name="theme-color" content="@brandColorOne" /> 6154 <!--FACEBOOK--> 6155 <meta property="fb:app_id" content="@addId_FB"> 6156 <meta property="og:image" content="@imageURL_FB"> 6157 <meta property="og:image:type" content="image/png"> 6158 <meta property="og:image:width" content="1024"> 6159 <meta property="og:image:height" content="1024"> 6160 <meta property="og:type" content="website" /> 6161 <!--CS NT This redirects all pages <meta property="og:url" content="https://staging.hollandandbarrett.com.cy"/>--> 6162 <meta property="og:url" content="@url_FB"/> 6163 <meta property="og:title" content="@title_FB" /> 6164 <meta property="og:description" content="@description_FB" /> 6165 6166 @Model.MetaTags 6167 6168 <!-- CS NT JQuery Library--> 6169 <script type="text/javascript" src="/Files/Templates/Designs/Rapido/js/jquery.min.js"></script> 6170 6171 <!-- CS NT Slick.js Library--> 6172 <script type="text/javascript" src="/Files/Templates/Designs/Rapido/js/slick.js"></script> 6173 6174 <!-- CS NT Jquery Mask.js Library UNUSED --> 6175 <!--<script type="text/javascript" src="/Files/Templates/Designs/Rapido/js/jquery.mask.min.js"></script>--> 6176 6177 <!-- CS NT Custom.js from DW--> 6178 <script type="text/javascript" src="/Files/Templates/Designs/Rapido/js/source/Custom.js?ticks=@customJSfileInfo.LastWriteTime.Ticks.ToString()"></script> 6179 6180 <!-- Favicon --> 6181 <link href="@favicon" rel="icon" type="image/png"> 6182 6183 <!-- Base (Default, wireframe) styles --> 6184 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/base/base.min.css" type="text/css"> 6185 6186 <!-- Rapido Css from Website Settings --> 6187 <link rel="stylesheet" id="rapidoCss" href="@autoCssLink" type="text/css"> 6188 6189 <!-- Ignite Css (Custom site specific styles) --> 6190 <link rel="stylesheet" id="igniteCss" type="text/css" href="/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css"> 6191 6192 <!-- Font awesome --> 6193 <link rel="stylesheet" href="@fontAwesomeCssLink" type="text/css"> 6194 6195 <!-- Flag icon --> 6196 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css" type="text/css"> 6197 6198 <!-- CS NT Custom nextech.css--> 6199 <link rel="stylesheet" type="text/css" href="/Files/Templates/Designs/Rapido/css/nextech.css?ticks=@nextechCSSfileInfo.LastWriteTime.Ticks.ToString()"> 6200 6201 <!-- CS NT Custom slick.css--> 6202 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/slick.css" type="text/css"> 6203 6204 <!-- CS NT Custom slick-theme.css--> 6205 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/slick-theme.css" type="text/css"> 6206 6207 <!-- Google fonts --> 6208 @{ 6209 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))); 6210 } 6211 <link href="https://fonts.googleapis.com/css?family=@family" rel="stylesheet"> 6212 @{ 6213 PushPromise(favicon); 6214 PushPromise(fontAwesomeCssLink); 6215 PushPromise("/Files/Templates/Designs/Rapido/css/base/base.min.css"); 6216 PushPromise(autoCssLink); 6217 PushPromise("/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css"); 6218 PushPromise("/Files/Images/placeholder.gif"); 6219 PushPromise("/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css"); 6220 } 6221 6222 @if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName"))) 6223 { 6224 <link rel="manifest" href="/Files/Templates/Designs/Rapido/manifest.json"> 6225 PushPromise("/Files/Templates/Designs/Rapido/manifest.json"); 6226 } 6227 </head> 6228 6229 <body> 6230 6231 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 6232 @RenderBlockList(masterPage.BlocksRoot.BlocksList) 6233 6234 6235 @helper RenderMasterHeader() 6236 { 6237 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterHeader").OrderBy(item => item.SortId).ToList(); 6238 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 6239 string stickyTop = isNavigationStickyMenu ? "top-container--sticky" : ""; 6240 6241 <header class="top-container @stickyTop dw-mod" id="Top"> 6242 @RenderBlockList(subBlocks) 6243 </header> 6244 } 6245 6246 @helper RenderMain() 6247 { 6248 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMain").OrderBy(item => item.SortId).ToList(); 6249 6250 <main class="site dw-mod"> 6251 @RenderBlockList(subBlocks) 6252 </main> 6253 } 6254 6255 @helper RenderPageContent() 6256 { 6257 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 6258 string pagePos = isNavigationStickyMenu ? "js-page-pos" : ""; 6259 6260 <div id="Page" class="page @pagePos"> 6261 <section class="center-container content-container dw-mod" id="content"> 6262 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 6263 6264 6265 @using Dynamicweb.Rapido.Blocks.Components 6266 @using Dynamicweb.Rapido.Blocks.Components.Articles 6267 @using Dynamicweb.Rapido.Blocks.Components.General 6268 @using Dynamicweb.Rapido.Blocks 6269 6270 @functions { 6271 BlocksPage articlePage = BlocksPage.GetBlockPage("BlogArticle"); 6272 } 6273 6274 @{ 6275 string image = !String.IsNullOrEmpty(Model.Item.GetString("Image")) ? Model.Item.GetFile("Image").PathUrlEncoded : ""; 6276 6277 ArticleHeader topBanner = new ArticleHeader 6278 { 6279 Layout = ArticleHeaderLayout.Banner, 6280 Image = new Image { Path = image }, 6281 Heading = Model.Item.GetString("Title"), 6282 Subheading = Model.Item.GetString("Summary"), 6283 TextColor = "#fff", 6284 Category = Model.Item.GetString("Author"), 6285 Date = Model.Item.GetString("Date"), 6286 ButtonLayout = ButtonLayout.Primary, 6287 TextLayout = ArticleHeaderTextLayout.Full 6288 }; 6289 6290 ButtonLayout buttonDesign; 6291 Enum.TryParse<ButtonLayout>(Model.Item.GetString("ButtonDesign"), out buttonDesign); 6292 if (Enum.GetName(typeof(ButtonLayout), buttonDesign).ToLower() == "none") 6293 { 6294 buttonDesign = ButtonLayout.Primary; 6295 } 6296 6297 Block articleContainer = new Block 6298 { 6299 Id = "ArticleContainer", 6300 SortId = 10, 6301 Design = new Design 6302 { 6303 RenderType = RenderType.Row 6304 }, 6305 BlocksList = new List<Block> { 6306 new Block { 6307 Id = "ArticleHeader", 6308 SortId = 20, 6309 Component = topBanner, 6310 Design = new Design { 6311 RenderType = RenderType.Column, 6312 Size = "12", 6313 HidePadding = true, 6314 CssClass = "article-head" 6315 } 6316 }, 6317 new Block { 6318 Id = "ArticleBody", 6319 SortId = 30, 6320 Design = new Design { 6321 RenderType = RenderType.Column, 6322 Size = "8" 6323 }, 6324 BlocksList = new List<Block> { 6325 new Block { 6326 Id = "ArticleBodyRow", 6327 SortId = 10, 6328 Design = new Design { 6329 RenderType = RenderType.Row 6330 }, 6331 BlocksList = new List<Block> { 6332 new Block { 6333 Id = "ArticleText", 6334 SortId = 10, 6335 Component = new ArticleText { Text = Model.Item.GetString("Text") }, 6336 Design = new Design { 6337 RenderType = RenderType.Column, 6338 Size = "12", 6339 CssClass = "u-padding--lg" 6340 } 6341 }, 6342 new Block { 6343 Id = "ArticleLink", 6344 SortId = 20, 6345 Component = new ArticleLink { Link = Model.Item.GetString("Link"), Title = Model.Item.GetString("LinkText"), ButtonLayout = buttonDesign }, 6346 Design = new Design { 6347 RenderType = RenderType.Column, 6348 Size = "12", 6349 CssClass = "u-padding--lg u-ta-right" 6350 } 6351 } 6352 } 6353 } 6354 } 6355 } 6356 } 6357 }; 6358 articlePage.Add(articleContainer); 6359 6360 if (Model.PropertyItem.GetList("ShowBreadcrumb").SelectedValue == "True") 6361 { 6362 Block breadcrumb = new Block 6363 { 6364 Id = "ArticleBreadcrumb", 6365 SortId = 10, 6366 Component = new BreadcrumbNavigation { }, 6367 Design = new Design 6368 { 6369 RenderType = RenderType.Column, 6370 Size = "12" 6371 } 6372 }; 6373 articlePage.Add("ArticleContainer", breadcrumb); 6374 } 6375 } 6376 6377 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 6378 @RenderBlockList(articlePage.BlocksRoot.BlocksList) 6379 6380 </section> 6381 </div> 6382 } 6383 6384 <script> 6385 $(document).ready(function(){ 6386 //CS NT Not used now.. Maybe used in the future to displaying and error anywhere as an alert or a modal 6387 let searchParams = new URLSearchParams(window.location.search); 6388 if (searchParams.has('StockError')) 6389 { 6390 let stockErrorPar = searchParams.get('StockError'); 6391 alert(stockErrorPar); 6392 } 6393 }); 6394 </script> 6395 </body> 6396 </html> 6397 6398