Error executing template "Designs/Rapido/_parsed/Page.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_b348dc3a47a940098b0e61b2a63245e1.b__147_0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\FactorAdman\egholm2019.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 6042
   at CompiledRazorTemplates.Dynamic.RazorEngine_b348dc3a47a940098b0e61b2a63245e1.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\FactorAdman\egholm2019.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 225
   at CompiledRazorTemplates.Dynamic.RazorEngine_b348dc3a47a940098b0e61b2a63245e1.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\FactorAdman\egholm2019.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 137
   at CompiledRazorTemplates.Dynamic.RazorEngine_b348dc3a47a940098b0e61b2a63245e1.b__146_0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\FactorAdman\egholm2019.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 6025
   at CompiledRazorTemplates.Dynamic.RazorEngine_b348dc3a47a940098b0e61b2a63245e1.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\FactorAdman\egholm2019.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 225
   at CompiledRazorTemplates.Dynamic.RazorEngine_b348dc3a47a940098b0e61b2a63245e1.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\FactorAdman\egholm2019.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 137
   at CompiledRazorTemplates.Dynamic.RazorEngine_b348dc3a47a940098b0e61b2a63245e1.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\FactorAdman\egholm2019.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 245
   at CompiledRazorTemplates.Dynamic.RazorEngine_b348dc3a47a940098b0e61b2a63245e1.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\FactorAdman\egholm2019.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 137
   at CompiledRazorTemplates.Dynamic.RazorEngine_b348dc3a47a940098b0e61b2a63245e1.Execute() in D:\Dynamicweb.net\Solutions\FactorAdman\egholm2019.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 6007
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

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