Error executing template "Designs/Rapido/_parsed/NewsArticle.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_ed27afffbc2c43c3959316855d9dee7e.b__154_0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\Dynamicweb\aedgroup.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\NewsArticle.parsed.cshtml:line 6593
   at CompiledRazorTemplates.Dynamic.RazorEngine_ed27afffbc2c43c3959316855d9dee7e.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\Dynamicweb\aedgroup.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\NewsArticle.parsed.cshtml:line 225
   at CompiledRazorTemplates.Dynamic.RazorEngine_ed27afffbc2c43c3959316855d9dee7e.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\Dynamicweb\aedgroup.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\NewsArticle.parsed.cshtml:line 137
   at CompiledRazorTemplates.Dynamic.RazorEngine_ed27afffbc2c43c3959316855d9dee7e.b__152_0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\Dynamicweb\aedgroup.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\NewsArticle.parsed.cshtml:line 6569
   at CompiledRazorTemplates.Dynamic.RazorEngine_ed27afffbc2c43c3959316855d9dee7e.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\Dynamicweb\aedgroup.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\NewsArticle.parsed.cshtml:line 225
   at CompiledRazorTemplates.Dynamic.RazorEngine_ed27afffbc2c43c3959316855d9dee7e.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\Dynamicweb\aedgroup.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\NewsArticle.parsed.cshtml:line 137
   at CompiledRazorTemplates.Dynamic.RazorEngine_ed27afffbc2c43c3959316855d9dee7e.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\Dynamicweb\aedgroup.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\NewsArticle.parsed.cshtml:line 245
   at CompiledRazorTemplates.Dynamic.RazorEngine_ed27afffbc2c43c3959316855d9dee7e.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\Dynamicweb\aedgroup.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\NewsArticle.parsed.cshtml:line 137
   at CompiledRazorTemplates.Dynamic.RazorEngine_ed27afffbc2c43c3959316855d9dee7e.Execute() in D:\Dynamicweb.net\Solutions\Dynamicweb\aedgroup.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\NewsArticle.parsed.cshtml:line 6550
   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 u-no-padding 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 <i class="fas fa-quote-right u-margin-bottom--lg"></i> 1881 @settings.Text 1882 <i class="fas fa-quote-right"></i> 1883 </div> 1884 } 1885 @if (!String.IsNullOrEmpty(settings.Author)) 1886 { 1887 <div class="article__quote-author dw-mod"> 1888 - @settings.Author 1889 </div> 1890 } 1891 </div> 1892 </div> 1893 } 1894 } 1895 @using System.Reflection 1896 @using Dynamicweb.Rapido.Blocks.Components 1897 @using Dynamicweb.Rapido.Blocks.Components.Articles 1898 @using Dynamicweb.Rapido.Blocks 1899 1900 @* Component for the articles *@ 1901 1902 @helper RenderArticleInfoTable(ArticleInfoTable settings) 1903 { 1904 dynamic[] methodParameters = new dynamic[1]; 1905 methodParameters[0] = settings; 1906 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleInfoTableCustom"); 1907 1908 if (customMethod != null) 1909 { 1910 @customMethod.Invoke(this, methodParameters).ToString(); 1911 } else { 1912 <table class="table table--clean"> 1913 @foreach (var row in settings.Rows) 1914 { 1915 string iconColor = row.IconColor != null ? row.IconColor : "u-brand-color-two"; 1916 1917 <tr> 1918 @if (!String.IsNullOrEmpty(row.Icon)) 1919 { 1920 <td class="u-w32px"><i class="@row.Icon fa-2x @row.IconColor"></i></td> 1921 } 1922 <td class="u-no-margin-on-p-elements"> 1923 <div class="u-bold">@row.Title</div> 1924 @if (!String.IsNullOrEmpty(row.SubTitle)) 1925 { 1926 if (row.Link == null) 1927 { 1928 <div>@row.SubTitle</div> 1929 } 1930 else 1931 { 1932 <a href="@row.Link" class="u-color-inherit">@row.SubTitle</a> 1933 } 1934 } 1935 </td> 1936 </tr> 1937 } 1938 </table> 1939 } 1940 } 1941 @using System.Reflection 1942 @using Dynamicweb.Rapido.Blocks.Components 1943 @using Dynamicweb.Rapido.Blocks.Components.Articles 1944 @using Dynamicweb.Rapido.Blocks 1945 1946 @* Component for the articles *@ 1947 1948 @helper RenderArticleGalleryModal(ArticleGalleryModal settings) 1949 { 1950 dynamic[] methodParameters = new dynamic[1]; 1951 methodParameters[0] = settings; 1952 MethodInfo customMethod = this.GetType().GetMethod(settings.HelperName + "Custom"); 1953 1954 if (customMethod != null) 1955 { 1956 @customMethod.Invoke(this, methodParameters).ToString(); 1957 } 1958 else 1959 { 1960 <input type="checkbox" id="ParagraphGalleryTrigger" class="modal-trigger" /> 1961 <div class="modal-container"> 1962 <label for="ParagraphGalleryTrigger" id="ParagraphGalleryOverlay" class="modal-overlay"></label> 1963 <div class="modal modal--full" id="ParagraphGallery"> 1964 <div class="modal__body modal__body--full"> 1965 <img src="/Files/Images/placeholder.gif" alt="" id="ParagraphGalleryModalImage" style="margin: 0 auto;" /> 1966 <div class="u-padding u-ta-center" id="ParagraphGalleryModalCaption"></div> 1967 <label class="modal__close-btn dw-mod" for="ParagraphGalleryTrigger"></label> 1968 </div> 1969 </div> 1970 </div> 1971 <script> 1972 function showImageInModal(image) { 1973 let imageNode = document.getElementById('ParagraphGalleryModalImage'); 1974 let captionNode = document.getElementById('ParagraphGalleryModalCaption'); 1975 let trigger = document.getElementById('ParagraphGalleryTrigger'); 1976 imageNode.src = image.src; 1977 if (image.alt != "") { 1978 captionNode.innerText = image.alt; 1979 imageNode.alt = image.alt; 1980 captionNode.style.display = "block"; 1981 } else { 1982 captionNode.style.display = "none"; 1983 } 1984 trigger.checked = true; 1985 } 1986 </script> 1987 } 1988 } 1989 @using System.Reflection 1990 @using Dynamicweb.Rapido.Blocks.Components 1991 @using Dynamicweb.Rapido.Blocks.Components.Articles 1992 @using Dynamicweb.Rapido.Blocks 1993 1994 1995 @* Component for the articles *@ 1996 1997 @helper RenderArticleRelated(ArticleRelated settings) 1998 { 1999 string cardClass = Pageview.Device.ToString() != "Tablet" ? "card u-color-light--bg u-full-height" : ""; 2000 string cardFooterClass = Pageview.Device.ToString() != "Tablet" ? "card-footer u-color-light--bg" : ""; 2001 2002 <section class="multiple-paragraphs-container u-color-light-gray--bg paragraph-container--full-width"> 2003 <div class="center-container dw-mod"> 2004 <div class="grid u-padding"> 2005 <div class="grid__col-md-12 grid__col-xs-12"> 2006 <h2 class="article__header u-no-margin u-margin-top">@settings.Title</h2> 2007 </div> 2008 </div> 2009 2010 <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> 2011 2012 <script id="RelatedSimpleTemplate" type="text/x-template"> 2013 {{#.}} 2014 <div class="grid u-padding-bottom--lg"> 2015 {{#Cases}} 2016 <div class="grid__col-3 image-hover--zoom dw-mod"> 2017 <a href="{{link}}" class="u-full-height u-color-light--bg"> 2018 {{#if image}} 2019 <div class="u-color-light--bg u-no-padding dw-mod"> 2020 <div class="flex-img image-hover__wrapper"> 2021 <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}}" /> 2022 </div> 2023 </div> 2024 {{/if}} 2025 2026 <div class="card u-color-light--bg dw-mod"> 2027 <h3 class="article-list__item-header u-truncate-text dw-mod">{{title}}</h3> 2028 <p class="article__short-summary dw-mod">{{summary}}</p> 2029 </div> 2030 </a> 2031 </div> 2032 {{/Cases}} 2033 </div> 2034 {{/.}} 2035 </script> 2036 </div> 2037 </section> 2038 } 2039 @using System.Reflection 2040 @using Dynamicweb.Rapido.Blocks.Components 2041 @using Dynamicweb.Rapido.Blocks.Components.Articles 2042 @using Dynamicweb.Rapido.Blocks 2043 2044 2045 @* Component for the articles *@ 2046 2047 @helper RenderArticleMenu(ArticleMenu settings) 2048 { 2049 dynamic[] methodParameters = new dynamic[1]; 2050 methodParameters[0] = settings; 2051 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleMenuCustom"); 2052 2053 if (customMethod != null) 2054 { 2055 @customMethod.Invoke(this, methodParameters).ToString(); 2056 } else { 2057 if (!String.IsNullOrEmpty(settings.Title)) { 2058 <div class="u-margin u-border-bottom"> 2059 <h3 class="u-no-margin">@settings.Title</h3> 2060 </div> 2061 } 2062 2063 <ul class="menu-left u-margin-bottom dw-mod"> 2064 @foreach (var item in settings.Items) 2065 { 2066 @RenderArticleMenuItem(item) 2067 } 2068 </ul> 2069 } 2070 } 2071 2072 @helper RenderArticleMenuItem(ArticleMenuItem settings) 2073 { 2074 dynamic[] methodParameters = new dynamic[1]; 2075 methodParameters[0] = settings; 2076 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleMenuItemCustom"); 2077 2078 if (customMethod != null) 2079 { 2080 @customMethod.Invoke(this, methodParameters).ToString(); 2081 } else { 2082 string link = !String.IsNullOrEmpty(settings.Link) ? settings.Link : "#"; 2083 2084 if (!String.IsNullOrEmpty(settings.Title)) { 2085 <li class="menu-left__item dw-mod"> 2086 <a href="@link" onclick="@settings.OnClick" class="menu-left__link dw-mod">@settings.Title</a> 2087 </li> 2088 } 2089 } 2090 } 2091 @using System.Reflection 2092 @using Dynamicweb.Rapido.Blocks.Components 2093 @using Dynamicweb.Rapido.Blocks.Components.Articles 2094 @using Dynamicweb.Rapido.Blocks 2095 2096 @* Component for the articles *@ 2097 2098 @helper RenderArticleList(ArticleList settings) 2099 { 2100 dynamic[] methodParameters = new dynamic[1]; 2101 methodParameters[0] = settings; 2102 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListCustom"); 2103 2104 if (customMethod != null) 2105 { 2106 @customMethod.Invoke(this, methodParameters).ToString(); 2107 } else { 2108 if (Pageview != null) 2109 { 2110 bool isParagraph = Pageview.CurrentParagraph != null ? true : false; 2111 string[] sortArticlesListBy = new string[2]; 2112 2113 if (isParagraph) { 2114 sortArticlesListBy = Pageview.CurrentParagraph.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString()) ? Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" }; 2115 } 2116 else { 2117 sortArticlesListBy = Pageview.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.Item["SortArticlesListBy"].ToString()) ? Pageview.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" }; 2118 } 2119 2120 string sourcePage = settings.SourcePage != null ? settings.SourcePage : Pageview.ID.ToString(); 2121 2122 @RenderItemList(new 2123 { 2124 ItemType = !String.IsNullOrEmpty(settings.ItemType) ? settings.ItemType : "DynamicArticle", 2125 ListSourceType = settings.SourceType, 2126 ListSourcePage = sourcePage, 2127 ItemFieldsList = "*", 2128 Filter = settings.Filter, 2129 ListOrderBy = sortArticlesListBy[0], 2130 ListOrderByDirection = sortArticlesListBy[1], 2131 ListSecondOrderBy = sortArticlesListBy[0] == "Date" ? "InFocusSortId" : "Date", 2132 ListSecondOrderByDirection = "ASC", 2133 IncludeAllChildItems = true, 2134 ListTemplate = settings.Template, 2135 ListPageSize = settings.PageSize.ToString() 2136 }); 2137 } 2138 } 2139 } 2140 @using System.Reflection 2141 @using Dynamicweb.Rapido.Blocks.Components.Articles 2142 2143 2144 @* Component for the articles *@ 2145 2146 @helper RenderArticleSummary(ArticleSummary settings) 2147 { 2148 dynamic[] methodParameters = new dynamic[1]; 2149 methodParameters[0] = settings; 2150 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSummaryCustom"); 2151 2152 if (customMethod != null) 2153 { 2154 @customMethod.Invoke(this, methodParameters).ToString(); 2155 } else { 2156 if (!String.IsNullOrEmpty(settings.Text)) 2157 { 2158 <div class="article__summary dw-mod">@settings.Text</div> 2159 } 2160 } 2161 } 2162 @using System.Reflection 2163 @using Dynamicweb.Rapido.Blocks.Components 2164 @using Dynamicweb.Rapido.Blocks.Components.Articles 2165 @using Dynamicweb.Rapido.Blocks 2166 2167 @* Component for the articles *@ 2168 2169 @helper RenderArticleListCategoryFilter(ArticleListCategoryFilter settings) 2170 { 2171 dynamic[] methodParameters = new dynamic[1]; 2172 methodParameters[0] = settings; 2173 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListCategoryFilterCustom"); 2174 2175 if (customMethod != null) 2176 { 2177 @customMethod.Invoke(this, methodParameters).ToString(); 2178 } else { 2179 string pageId = Pageview.ID.ToString(); 2180 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("sourcePage")) ? HttpContext.Current.Request.QueryString.Get("sourcePage") : Translate("All"); 2181 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString()); 2182 2183 foreach (var option in settings.Categories) 2184 { 2185 selectedFilter = selectedFilter == option.Value ? option.Key : selectedFilter; 2186 } 2187 2188 if (selectedFilter == pageId) 2189 { 2190 selectedFilter = Translate("All"); 2191 } 2192 2193 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 2194 { 2195 <div class="u-pull--right u-margin-left"> 2196 <div class="collection u-no-margin"> 2197 <h5>@Translate("Category")</h5> 2198 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" /> 2199 <div class="dropdown u-w180px dw-mod"> 2200 <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label> 2201 <div class="dropdown__content dw-mod"> 2202 @foreach (var option in settings.Categories) 2203 { 2204 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div> 2205 } 2206 </div> 2207 <label class="dropdown-trigger-off" for="CategorySelector"></label> 2208 </div> 2209 </div> 2210 </div> 2211 } 2212 else 2213 { 2214 <div class="u-full-width u-margin-bottom"> 2215 <h5 class="u-no-margin">@Translate("Category")</h5> 2216 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" /> 2217 <div class="dropdown u-full-width dw-mod"> 2218 <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label> 2219 <div class="dropdown__content dw-mod"> 2220 @foreach (var option in settings.Categories) 2221 { 2222 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div> 2223 } 2224 </div> 2225 <label class="dropdown-trigger-off" for="CategorySelector"></label> 2226 </div> 2227 </div> 2228 } 2229 } 2230 } 2231 @using System.Reflection 2232 @using Dynamicweb.Rapido.Blocks.Components 2233 @using Dynamicweb.Rapido.Blocks.Components.Articles 2234 @using Dynamicweb.Rapido.Blocks 2235 2236 @* Component for the articles *@ 2237 2238 @helper RenderArticleListFilter(ArticleListFilter settings) 2239 { 2240 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get(settings.SystemName)) ? HttpContext.Current.Request.QueryString.Get(settings.SystemName) : Translate("All"); 2241 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString()); 2242 2243 if (settings.Options != null) 2244 { 2245 foreach (var option in settings.Options) 2246 { 2247 selectedFilter = selectedFilter == option.Value ? option.Name : selectedFilter; 2248 } 2249 2250 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 2251 { 2252 <div class="u-pull--right u-margin-left"> 2253 <div class="collection u-no-margin"> 2254 <h5>@settings.Label</h5> 2255 <input type="checkbox" id="@(settings.SystemName)Selector" class="dropdown-trigger" /> 2256 <div class="dropdown u-w180px dw-mod"> 2257 <label class="dropdown__header dropdown__btn dw-mod" for="@(settings.SystemName)Selector">@Translate(selectedFilter)</label> 2258 <div class="dropdown__content dw-mod"> 2259 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')">@Translate("All")</div> 2260 @foreach (var option in settings.Options) 2261 { 2262 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')">@Translate(option.Name)</div> 2263 } 2264 </div> 2265 <label class="dropdown-trigger-off" for="@(settings.SystemName)Selector"></label> 2266 </div> 2267 </div> 2268 </div> 2269 } 2270 else 2271 { 2272 <div class="u-full-width u-margin-bottom"> 2273 <h5 class="u-no-margin">@settings.Label</h5> 2274 <input type="checkbox" id="@(settings.SystemName)Selector" class="dropdown-trigger" /> 2275 <div class="dropdown u-full-width w-mod"> 2276 <label class="dropdown__header dropdown__btn dw-mod" for="@(settings.SystemName)Selector">@Translate(selectedFilter)</label> 2277 <div class="dropdown__content dw-mod"> 2278 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')">@Translate("All")</div> 2279 @foreach (var option in settings.Options) 2280 { 2281 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')">@Translate(option.Name)</div> 2282 } 2283 </div> 2284 <label class="dropdown-trigger-off" for="@(settings.SystemName)Selector"></label> 2285 </div> 2286 </div> 2287 } 2288 } 2289 } 2290 @using System.Reflection 2291 @using Dynamicweb.Rapido.Blocks.Components 2292 @using Dynamicweb.Rapido.Blocks.Components.Articles 2293 @using Dynamicweb.Rapido.Blocks 2294 2295 @* Component for the articles *@ 2296 2297 @helper RenderArticleListSearch(ArticleListSearch settings) 2298 { 2299 dynamic[] methodParameters = new dynamic[1]; 2300 methodParameters[0] = settings; 2301 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListSearchCustom"); 2302 2303 if (customMethod != null) 2304 { 2305 @customMethod.Invoke(this, methodParameters).ToString(); 2306 } else { 2307 string searchString = !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("Title")) ? HttpContext.Current.Request.QueryString.Get("Title").Trim('*') : ""; 2308 string className = "u-w340px u-pull--right u-margin-left"; 2309 2310 if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet") 2311 { 2312 className = "u-full-width"; 2313 } 2314 2315 <div class="typeahead u-color-inherit u-margin-bottom dw-mod @className"> 2316 <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 + '*')"> 2317 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod"><i class="fas fa-search"></i></button> 2318 </div> 2319 } 2320 } 2321 @using System.Reflection 2322 @using Dynamicweb.Rapido.Blocks.Components 2323 @using Dynamicweb.Rapido.Blocks.Components.Articles 2324 @using Dynamicweb.Rapido.Blocks 2325 2326 @* Component for the articles *@ 2327 2328 @helper RenderArticleListNoResultsInfo(ArticleListNoResultsInfo settings) 2329 { 2330 dynamic[] methodParameters = new dynamic[1]; 2331 methodParameters[0] = settings; 2332 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListNoResultsInfoCustom"); 2333 2334 if (customMethod != null) 2335 { 2336 @customMethod.Invoke(this, methodParameters).ToString(); 2337 } else { 2338 <div class="u-margin-top--lg u-bold u-ta-center u-bold">@Translate(settings.Message)</div> 2339 } 2340 } 2341 @using System.Reflection 2342 @using Dynamicweb.Rapido.Blocks.Components 2343 @using Dynamicweb.Rapido.Blocks.Components.General 2344 @using Dynamicweb.Rapido.Blocks.Components.Articles 2345 @using Dynamicweb.Rapido.Blocks 2346 @using System.Text.RegularExpressions 2347 2348 @* Component for the articles *@ 2349 2350 @helper RenderArticleListItem(ArticleListItem settings) 2351 { 2352 switch (settings.Type) { 2353 case ArticleListItemType.Card: 2354 @RenderArticleListItemCard(settings); 2355 break; 2356 case ArticleListItemType.List: 2357 @RenderArticleListItemList(settings); 2358 break; 2359 case ArticleListItemType.Simple: 2360 @RenderArticleListItemSimple(settings); 2361 break; 2362 default: 2363 @RenderArticleListItemCard(settings); 2364 break; 2365 } 2366 } 2367 2368 @helper RenderArticleListItemCard(ArticleListItem settings) { 2369 <a href="@settings.Link" class="u-full-height u-color-light--bg"> 2370 <div class="u-color-light--bg u-no-padding dw-mod"> 2371 @if (settings.Logo != null) 2372 { 2373 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;" : ""; 2374 settings.Logo.ImageDefault.Crop = 5; 2375 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width; 2376 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height; 2377 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage"> 2378 @if (settings.Stickers != null) 2379 { 2380 if (settings.Stickers.Position != StickersListPosition.Custom) 2381 { 2382 @RenderStickersCollection(settings.Stickers); 2383 } 2384 } 2385 @RenderImage(settings.Logo) 2386 </div> 2387 } else if (settings.Image != null) 2388 { 2389 <div class="flex-img image-hover__wrapper u-position-relative dw-mod"> 2390 @if (settings.Stickers != null) 2391 { 2392 if (settings.Stickers.Position != StickersListPosition.Custom) 2393 { 2394 @RenderStickersCollection(settings.Stickers); 2395 } 2396 } 2397 @RenderImage(settings.Image) 2398 </div> 2399 } 2400 </div> 2401 2402 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary)) 2403 { 2404 <div class="card u-color-light--bg dw-mod"> 2405 @if (settings.Stickers != null) 2406 { 2407 if (settings.Stickers.Position == StickersListPosition.Custom) 2408 { 2409 @RenderStickersCollection(settings.Stickers); 2410 } 2411 } 2412 @if (!String.IsNullOrEmpty(settings.Title)) 2413 { 2414 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3> 2415 } 2416 @if (!String.IsNullOrEmpty(settings.SubTitle)) 2417 { 2418 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 2419 } 2420 @if (!String.IsNullOrEmpty(settings.Summary)) 2421 { 2422 <p class="article__short-summary dw-mod">@settings.Summary</p> 2423 } 2424 </div> 2425 } 2426 </a> 2427 } 2428 2429 @helper RenderArticleListItemList(ArticleListItem settings) { 2430 <a href="@settings.Link"> 2431 <div class="grid u-color-light--bg u-no-padding dw-mod"> 2432 <div class="grid__col-md-3"> 2433 <div class="u-color-light--bg u-no-padding dw-mod"> 2434 @if (settings.Logo != null) 2435 { 2436 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;" : ""; 2437 settings.Logo.ImageDefault.Crop = 5; 2438 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width; 2439 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height; 2440 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage"> 2441 @if (settings.Stickers != null) 2442 { 2443 if (settings.Stickers.Position != StickersListPosition.Custom) 2444 { 2445 @RenderStickersCollection(settings.Stickers); 2446 } 2447 } 2448 @RenderImage(settings.Logo) 2449 </div> 2450 } else if (settings.Image != null) 2451 { 2452 <div class="flex-img image-hover__wrapper dw-mod"> 2453 @if (settings.Stickers != null) 2454 { 2455 if (settings.Stickers.Position != StickersListPosition.Custom) 2456 { 2457 @RenderStickersCollection(settings.Stickers); 2458 } 2459 } 2460 @RenderImage(settings.Image) 2461 </div> 2462 } 2463 </div> 2464 </div> 2465 2466 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary)) 2467 { 2468 <div class="grid__col-md-9"> 2469 @if (!String.IsNullOrEmpty(settings.Title)) 2470 { 2471 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3> 2472 } 2473 @if (settings.Stickers != null) 2474 { 2475 if (settings.Stickers.Position == StickersListPosition.Custom) 2476 { 2477 @RenderStickersCollection(settings.Stickers); 2478 } 2479 } 2480 @if (!String.IsNullOrEmpty(settings.SubTitle)) 2481 { 2482 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 2483 } 2484 @if (!String.IsNullOrEmpty(settings.Summary)) 2485 { 2486 <p class="article__short-summary dw-mod">@settings.Summary</p> 2487 } 2488 </div> 2489 } 2490 </div> 2491 </a> 2492 } 2493 2494 @helper RenderArticleListItemSimple(ArticleListItem settings) { 2495 <a href="@settings.Link" class="u-color-inherit"> 2496 <div class="grid u-color-light--bg u-no-padding dw-mod"> 2497 <div class="grid__col-md-12"> 2498 @if (!String.IsNullOrEmpty(settings.Title)) 2499 { 2500 <div class="article-list-item__header u-truncate-text u-no-margin dw-mod">@settings.Title</div> 2501 } 2502 @if (!String.IsNullOrEmpty(settings.SubTitle)) 2503 { 2504 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 2505 } 2506 </div> 2507 </div> 2508 </a> 2509 } 2510 @using System.Reflection 2511 @using Dynamicweb.Rapido.Blocks.Components.Articles 2512 2513 2514 @* Component for the articles *@ 2515 2516 @helper RenderArticleAuthorAndDate(ArticleAuthorAndDate settings) 2517 { 2518 dynamic[] methodParameters = new dynamic[1]; 2519 methodParameters[0] = settings; 2520 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleAuthorAndDateCustom"); 2521 2522 if (customMethod != null) 2523 { 2524 @customMethod.Invoke(this, methodParameters).ToString(); 2525 } else { 2526 <small class="article__subscription"> 2527 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date))) 2528 { 2529 <text>@Translate("Written")</text> 2530 } 2531 @if (!string.IsNullOrWhiteSpace(settings.Author)) 2532 { 2533 <text>@Translate("by") @settings.Author</text> 2534 } 2535 @if (!string.IsNullOrWhiteSpace(settings.Date)) 2536 { 2537 <text>@Translate("on") @settings.Date</text> 2538 } 2539 </small> 2540 } 2541 } 2542 @using System.Reflection 2543 @using Dynamicweb.Rapido.Blocks.Components.Articles 2544 2545 2546 @* Component for the articles *@ 2547 2548 @helper RenderArticleLink(ArticleLink settings) 2549 { 2550 dynamic[] methodParameters = new dynamic[1]; 2551 methodParameters[0] = settings; 2552 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleLinkCustom"); 2553 2554 if (customMethod != null) 2555 { 2556 @customMethod.Invoke(this, methodParameters).ToString(); 2557 } else { 2558 if (!String.IsNullOrEmpty(settings.Title)) 2559 { 2560 <div class="grid__cell"> 2561 @RenderButton(settings) 2562 </div> 2563 } 2564 } 2565 } 2566 @using System.Reflection 2567 @using Dynamicweb.Rapido.Blocks 2568 @using Dynamicweb.Rapido.Blocks.Components.Articles 2569 @using Dynamicweb.Rapido.Blocks.Components.General 2570 2571 2572 @* Component for the articles *@ 2573 2574 @helper RenderArticleCarousel(ArticleCarousel settings) 2575 { 2576 dynamic[] methodParameters = new dynamic[1]; 2577 methodParameters[0] = settings; 2578 MethodInfo customMethod = this.GetType().GetMethod(settings.HelperName + "Custom"); 2579 2580 if (customMethod != null) 2581 { 2582 @customMethod.Invoke(this, methodParameters).ToString(); 2583 } else { 2584 <div class="grid"> 2585 <div class="grid__col-12"> 2586 <div class="carousel" id="carousel_@settings.Id"> 2587 <div class="carousel__container js-carousel-slides dw-mod"> 2588 @RenderBlockList(settings.SubBlocks) 2589 </div> 2590 </div> 2591 </div> 2592 </div> 2593 2594 <script> 2595 document.addEventListener("DOMContentLoaded", function () { 2596 new CarouselModule("#carousel_@settings.Id", { 2597 slideTime: 0, 2598 dots: true 2599 }); 2600 }); 2601 </script> 2602 } 2603 } 2604 2605 @helper RenderArticleCarouselSlide(ArticleCarouselSlide settings) 2606 { 2607 dynamic[] methodParameters = new dynamic[1]; 2608 methodParameters[0] = settings; 2609 MethodInfo customMethod = this.GetType().GetMethod(settings.HelperName + "Custom"); 2610 2611 if (customMethod != null) 2612 { 2613 @customMethod.Invoke(this, methodParameters).ToString(); 2614 } 2615 else 2616 { 2617 string imageEngine = "/Admin/Public/GetImage.ashx?"; 2618 2619 string defaultImage = settings.ImageSettings != null ? imageEngine : settings.Image; 2620 if (settings.ImageSettings != null) 2621 { 2622 defaultImage += settings.ImageSettings.Width != 0 ? "Width=" + settings.ImageSettings.Width + "&" : ""; 2623 defaultImage += settings.ImageSettings.Height != 0 ? "Height=" + settings.ImageSettings.Height + "&" : ""; 2624 defaultImage += "Crop=" + settings.ImageSettings.Crop + "&"; 2625 defaultImage += "Compression=" + settings.ImageSettings.Compression + "&"; 2626 defaultImage += "DoNotUpscale=" + settings.ImageSettings.DoNotUpscale.ToString() + "&"; 2627 defaultImage += "FillCanvas=" + settings.ImageSettings.FillCanvas.ToString() + "&"; 2628 } 2629 defaultImage += "&Image=" + settings.Image; 2630 2631 <div class="carousel__slide u-min-h300px u-flex dw-mod" style="background-size:cover; background-image:url('@defaultImage')"> 2632 <a class="article-carousel-item__wrap" href="@settings.Link" title="@settings.Title"> 2633 <h2 class="article-list__item-header u-truncate-text u-color-light dw-mod">@settings.Title</h2> 2634 <div class="article-list__item-info"> 2635 @if (settings.Stickers != null) 2636 { 2637 settings.Stickers.Position = StickersListPosition.Custom; 2638 @RenderStickersCollection(settings.Stickers); 2639 } 2640 2641 <small class="u-margin-top--lg u-color-light"> 2642 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date))) 2643 { 2644 <text>@Translate("Written")</text> 2645 } 2646 @if (!string.IsNullOrWhiteSpace(settings.Author)) 2647 { 2648 <text>@Translate("by") @settings.Author</text> 2649 } 2650 @if (!string.IsNullOrWhiteSpace(settings.Date)) 2651 { 2652 <text>@Translate("on") @settings.Date</text> 2653 } 2654 </small> 2655 </div> 2656 2657 <h3 class="article__short-summary u-color-light">@settings.Summary</h3> 2658 </a> 2659 @if (settings.UseFilters == true) 2660 { 2661 <div class="background-image image-filter image-filter--darken dw-mod"></div> 2662 } 2663 </div> 2664 } 2665 } 2666 @using System.Text.RegularExpressions 2667 @using Dynamicweb.Rapido.Blocks.Components 2668 @using Dynamicweb.Rapido.Blocks.Components.General 2669 @using Dynamicweb.Rapido.Blocks.Components.Articles 2670 @using Dynamicweb.Rapido.Blocks 2671 2672 @* Component for the articles *@ 2673 2674 @helper RenderArticleVideo(ArticleVideo settings) 2675 { 2676 dynamic[] methodParameters = new dynamic[1]; 2677 methodParameters[0] = settings; 2678 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleTextCustom"); 2679 2680 if (customMethod != null) 2681 { 2682 @customMethod.Invoke(this, methodParameters).ToString(); 2683 } else { 2684 if (settings.Url != null) 2685 { 2686 //getting video ID from youtube URL 2687 string videoCode = settings.Url; 2688 Regex regex = new Regex(@".be\/(.[^?]*)"); 2689 Match match = regex.Match(videoCode); 2690 string videoId = ""; 2691 if (match.Success) 2692 { 2693 videoId = match.Groups[1].Value; 2694 } 2695 else 2696 { 2697 regex = new Regex(@"v=([^&]+)"); 2698 match = regex.Match(videoCode); 2699 if (match.Success) 2700 { 2701 videoId = match.Groups[1].Value; 2702 } 2703 } 2704 2705 int autoPlay = settings.AutoPlay == "true" ? 1 : 0; 2706 2707 <div class="video-wrapper"> 2708 <div class="js-youtube-video" data-video="@videoId" id="ytPlayer@(Guid.NewGuid().ToString("N"))" data-auto-play="@autoPlay" data-enable-controls="1"></div> 2709 </div> 2710 } 2711 } 2712 } 2713 2714 2715 2716 @* Simple helpers *@ 2717 2718 @*Requires the Gallery ItemType that comes with Rapido*@ 2719 @helper RenderArticleItemGallery(IList<ItemViewModel> gallery) { 2720 if (gallery != null && gallery.Count > 0) 2721 { 2722 int count = 1; 2723 2724 foreach (var item in gallery) 2725 { 2726 if (item.GetFile("ImagePath") != null) 2727 { 2728 string image = item.GetFile("ImagePath").PathUrlEncoded; 2729 string imagePrefix = "/Admin/Public/GetImage.ashx?width=1200&amp;height=820&amp;crop=5&amp;Compression=75&amp;DoNotUpscale=1&amp;image="; 2730 int imagesCount = gallery.Count; 2731 2732 if (count == 1) 2733 { 2734 <label class="gallery" for="GalleryModalTrigger" onclick="Gallery.openImage(this.querySelector('.js-gallery'))"> 2735 <span class="gallery__main-image"> 2736 <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" /> 2737 </span> 2738 <span class="gallery__image-counter"> 2739 <i class="fas fa-camera fa-2x"></i> <span class="gallery__image-counter__number">@imagesCount</span> 2740 <span class="gallery__image-counter__text">@Translate("See all") <i class="fas fa-angle-right"></i></span> 2741 </span> 2742 </label> 2743 } 2744 else 2745 { 2746 <div class="u-hidden js-gallery" data-for="FullImage" data-image="@imagePrefix@image"></div> 2747 } 2748 2749 count++; 2750 } 2751 } 2752 } 2753 } 2754 2755 @helper RenderArticleItemGalleryModal() { 2756 <!-- Trigger for the gallery modal --> 2757 <input type="checkbox" id="GalleryModalTrigger" class="modal-trigger" /> 2758 2759 <!-- Gallery modal --> 2760 <div class="modal-container"> 2761 <label for="GalleryModalTrigger" id="GalleryModalOverlay" class="modal-overlay"></label> 2762 <div class="modal modal--full" id="GalleryModal"> 2763 <div class="modal__body modal__body--full"> 2764 <div class="gallery-slider"> 2765 <div class="gallery-slider__image"> 2766 <img src="#" alt="" class="modal--full__img" id="FullImage" /> 2767 </div> 2768 <div class="gallery-slider__image-counter" id="FullImage_counter"></div> 2769 <label class="gallery-slider__close-btn" for="GalleryModalTrigger"></label> 2770 <button class="gallery-slider__previous-btn" id="FullImage_prev" onclick="Gallery.prevImage('FullImage')"></button> 2771 <button class="gallery-slider__next-btn" id="FullImage_next" onclick="Gallery.nextImage('FullImage')"></button> 2772 </div> 2773 </div> 2774 </div> 2775 </div> 2776 } 2777 2778 2779 @helper RenderMobileFilters(List<Block> subBlocks) 2780 { 2781 if (subBlocks.Count > 0) 2782 { 2783 <div class="grid__col-12"> 2784 <input type="checkbox" id="CheckFilters" class="js-remember-state u-hidden" data-expand="CheckFilters" /> 2785 <div class="grid u-margin-bottom dw-mod" data-trigger="CheckFilters"> 2786 @RenderBlockList(subBlocks) 2787 </div> 2788 <label for="CheckFilters" class="btn btn--secondary btn--full dw-mod js-expand-hide" data-trigger="CheckFilters">@Translate("Select filters")</label> 2789 <label for="CheckFilters" class="btn btn--secondary btn--full dw-mod expandable--collapsed" data-trigger="CheckFilters">@Translate("Close filters")</label> 2790 </div> 2791 } 2792 } 2793 2794 @if (File.Exists(HttpContext.Current.Server.MapPath("/Components/Custom/Custom__Components.cshtml"))) 2795 { 2796 <text>@using Dynamicweb.Rapido.Blocks.Components.General 2797 </text> 2798 } 2799 2800 2801 @* Include the Blocks for the page *@ 2802 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2803 2804 @using System 2805 @using System.Web 2806 @using System.Collections.Generic 2807 @using Dynamicweb.Rapido.Blocks.Extensibility 2808 @using Dynamicweb.Rapido.Blocks 2809 2810 @{ 2811 BlocksPage topSnippetsBlocksPage = BlocksPage.GetBlockPage("Master"); 2812 2813 Block tagManager = new Block() 2814 { 2815 Id = "TagManager", 2816 SortId = 1, 2817 Template = RenderGoogleTagManager() 2818 }; 2819 2820 Block facebookPixel = new Block() 2821 { 2822 Id = "FacebookPixel", 2823 SortId = 2, 2824 Template = RenderFacebookPixel() 2825 }; 2826 2827 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, tagManager); 2828 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, facebookPixel); 2829 } 2830 2831 @helper RenderGoogleTagManager() { 2832 string GoogleTagManagerID = Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID"); 2833 2834 if (!string.IsNullOrWhiteSpace(GoogleTagManagerID)) 2835 { 2836 <script> 2837 (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': 2838 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], 2839 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 2840 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); 2841 })(window,document,'script','dataLayer','@GoogleTagManagerID'); 2842 </script> 2843 <!-- Google Tag Manager (noscript) --> 2844 <noscript> 2845 <iframe src="https://www.googletagmanager.com/ns.html?id=@GoogleTagManagerID" 2846 height="0" width="0" style="display:none;visibility:hidden"></iframe> 2847 </noscript> 2848 <!-- End Google Tag Manager (noscript) --> 2849 } 2850 } 2851 2852 @helper RenderFacebookPixel() { 2853 string FacebookPixelID = Model.Area.Item.GetItem("Settings").GetString("FacebookPixelID"); 2854 2855 if (!string.IsNullOrWhiteSpace(FacebookPixelID)) 2856 { 2857 <!-- Facebook Pixel Code --> 2858 <script> 2859 !function(f,b,e,v,n,t,s) 2860 {if(f.fbq)return;n=f.fbq=function(){n.callMethod? 2861 n.callMethod.apply(n,arguments):n.queue.push(arguments)}; 2862 if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0'; 2863 n.queue=[];t=b.createElement(e);t.async=!0; 2864 t.src=v;s=b.getElementsByTagName(e)[0]; 2865 s.parentNode.insertBefore(t,s)}(window, document,'script', 2866 'https://connect.facebook.net/en_US/fbevents.js'); 2867 fbq('init', '@FacebookPixelID'); 2868 fbq('track', 'PageView'); 2869 </script> 2870 <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=@FacebookPixelID&ev=PageView&noscript=1" alt="" /></noscript> 2871 } 2872 } 2873 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2874 2875 @using System 2876 @using System.Web 2877 @using System.Collections.Generic 2878 @using Dynamicweb.Rapido.Blocks 2879 @using Dynamicweb.Rapido.Blocks.Extensibility 2880 @using Dynamicweb.Security.UserManagement 2881 @using Dynamicweb.Security.UserManagement.ExternalAuthentication 2882 @{ 2883 BlocksPage loginBlocksPage = BlocksPage.GetBlockPage("Master"); 2884 2885 Block loginModal = new Block() 2886 { 2887 Id = "LoginModal", 2888 SortId = 10, 2889 Template = LoginModal() 2890 }; 2891 2892 loginBlocksPage.Add(MasterBlockId.MasterTopSnippets, loginModal); 2893 } 2894 2895 @helper LoginModal() { 2896 int pageId = Model.TopPage.ID; 2897 string userSignedInError = !Model.LogOnFailed ? "" : "checked"; 2898 string userSignedInErrorText = ""; 2899 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 2900 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; 2901 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 2902 2903 if (Model.LogOnFailed) { 2904 switch (Model.LogOnFailedReason) 2905 { 2906 case LogOnFailedReason.PasswordLengthInvalid: 2907 userSignedInErrorText = Translate("Password length is invalid"); 2908 break; 2909 case LogOnFailedReason.IncorrectLogin: 2910 userSignedInErrorText = Translate("Invalid email or password"); 2911 break; 2912 case LogOnFailedReason.ExceededFailedLogOnLimit: 2913 userSignedInErrorText = Translate("You have exceeded the limit of allowed login attempts. The user account is temporarily locked"); 2914 break; 2915 case LogOnFailedReason.LoginLocked: 2916 userSignedInErrorText = Translate("The user account is temporarily locked"); 2917 break; 2918 case LogOnFailedReason.PasswordExpired: 2919 userSignedInErrorText = Translate("The password has expired and needs to be renewed"); 2920 break; 2921 default: 2922 userSignedInErrorText = Translate("An unknown error occured"); 2923 break; 2924 } 2925 } 2926 2927 <!-- Trigger for the login modal --> 2928 <input type="checkbox" id="SignInModalTrigger" class="modal-trigger" @userSignedInError /> 2929 2930 <!-- Login modal --> 2931 <div class="modal-container"> 2932 <label for="SignInModalTrigger" id="SignInModalOverlay" class="modal-overlay"></label> 2933 <div class="modal modal--xs" id="SignInModal"> 2934 <div class="modal__header"> 2935 <h2>@Translate("Sign in")</h2> 2936 </div> 2937 <div class="modal__body"> 2938 <form method="post" id="LoginForm" class="u-no-margin"> 2939 <input type="hidden" name="ID" value="@pageId" /> 2940 <input type="hidden" name="DWExtranetUsernameRemember" value="True" /> 2941 <input type="hidden" name="DWExtranetPasswordRemember" value="True" /> 2942 <input type="text" class="u-full-width" id="LoginUsername" name="username" placeholder="@Translate("Email")" /> 2943 <input type="password" class="u-full-width" id="LoginPassword" name="password" placeholder="@Translate("Password")" /> 2944 <div class="field-error dw-mod">@userSignedInErrorText</div> 2945 2946 <div class="form__field-group dw-mod"> 2947 <input type="checkbox" id="LoginRememberMe" name="Autologin" checked="checked" value="True" class="form__control"> 2948 <label for="LoginRememberMe"> 2949 @Translate("Remember me", "Remember me") 2950 </label> 2951 </div> 2952 2953 <button type="submit" class="btn btn--primary btn--full dw-mod" name="LoginAction" value="Login" onclick="Buttons.LockButton(event)">@Translate("Sign in")</button> 2954 @{ 2955 ProviderCollection providers = Provider.GetActiveProviders(); 2956 } 2957 2958 @foreach(Provider LoginProvider in providers) 2959 { 2960 var ProviderName = LoginProvider.Name.ToLower(); 2961 <a href="/Admin/Public/Social/ExternalLogin.aspx?action=login&providerID=@LoginProvider.ID" title="@LoginProvider.Name" class="btn btn--clean btn--condensed u-color-@ProviderName dw-mod"><i class="fab fa-@ProviderName fa-1_5x"></i></a> 2962 } 2963 2964 <a class="btn btn--link-clean dw-mod" href="@forgotPasswordPageLink">@Translate("Forgot your password?", "Forgot your password?")</a> 2965 2966 <a class="btn btn--link-clean dw-mod" href="/default.aspx?ID=@createAccountPageId">@Translate("Create account")?</a> 2967 </form> 2968 </div> 2969 </div> 2970 </div> 2971 } 2972 2973 @if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet") 2974 { 2975 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 2976 2977 @using System 2978 @using System.Web 2979 @using System.Collections.Generic 2980 @using Dynamicweb.Rapido.Blocks.Extensibility 2981 @using Dynamicweb.Rapido.Blocks 2982 2983 2984 @functions { 2985 BlocksPage mobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master"); 2986 } 2987 2988 @{ 2989 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"; 2990 bool hideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 2991 bool hideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 2992 bool hideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 2993 2994 2995 Block mobileHeader = new Block() 2996 { 2997 Id = "MobileTop", 2998 SortId = 10, 2999 Template = RenderMobileTop(), 3000 SkipRenderBlocksList = true 3001 }; 3002 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeader); 3003 3004 Block mobileHeaderNavigation = new Block() 3005 { 3006 Id = "MobileHeaderNavigation", 3007 SortId = 10, 3008 Template = RenderMobileHeaderNavigation(), 3009 SkipRenderBlocksList = true, 3010 BlocksList = new List<Block> { 3011 new Block { 3012 Id = "MobileHeaderNavigationTrigger", 3013 SortId = 10, 3014 Template = RenderMobileHeaderNavigationTrigger() 3015 } 3016 } 3017 }; 3018 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderNavigation); 3019 3020 3021 Block mobileHeaderLogo = new Block() 3022 { 3023 Id = "MobileHeaderLogo", 3024 SortId = 20, 3025 Template = RenderMobileHeaderLogo(), 3026 SkipRenderBlocksList = true 3027 }; 3028 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderLogo); 3029 3030 Block mobileHeaderActions = new Block() 3031 { 3032 Id = "MobileHeaderActions", 3033 SortId = 30, 3034 Template = RenderMobileTopActions(), 3035 SkipRenderBlocksList = true 3036 }; 3037 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderActions); 3038 3039 if (hideSearch == false) 3040 { 3041 Block mobileHeaderSearch = new Block 3042 { 3043 Id = "MobileHeaderSearch", 3044 SortId = 10, 3045 Template = RenderMobileTopSearch() 3046 }; 3047 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderSearch); 3048 } 3049 3050 Block mobileHeaderMiniCart; 3051 3052 if (!hideCart) 3053 { 3054 mobileHeaderMiniCart = new Block 3055 { 3056 Id = "MobileHeaderMiniCart", 3057 SortId = 20, 3058 Template = RenderMobileTopMiniCart() 3059 }; 3060 3061 Block miniCartCounterScriptTemplate = new Block 3062 { 3063 Id = "MiniCartCounterScriptTemplate", 3064 Template = RenderMobileMiniCartCounterContent() 3065 }; 3066 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate); 3067 } 3068 else 3069 { 3070 mobileHeaderMiniCart = new Block 3071 { 3072 Id = "MobileHeaderMiniCart", 3073 SortId = 20 3074 }; 3075 } 3076 3077 if (!hideSearch) 3078 { 3079 Block mobileHeaderSearchBar = new Block() 3080 { 3081 Id = "MobileHeaderSearchBar", 3082 SortId = 30, 3083 Template = RenderMobileTopSearchBar() 3084 }; 3085 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeaderSearchBar); 3086 } 3087 3088 switch (mobileTopLayout) 3089 { 3090 case "nav-left": 3091 mobileHeaderNavigation.SortId = 10; 3092 mobileHeaderLogo.SortId = 20; 3093 mobileHeaderActions.SortId = 30; 3094 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart); 3095 break; 3096 case "nav-right": 3097 mobileHeaderLogo.SortId = 10; 3098 mobileHeaderActions.SortId = 20; 3099 mobileHeaderNavigation.SortId = 30; 3100 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart); 3101 break; 3102 case "nav-search-left": 3103 mobileHeaderNavigation.SortId = 10; 3104 mobileHeaderLogo.SortId = 20; 3105 mobileHeaderActions.SortId = 30; 3106 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart); 3107 break; 3108 case "search-left": 3109 mobileHeaderActions.SortId = 10; 3110 mobileHeaderLogo.SortId = 20; 3111 mobileHeaderNavigation.SortId = 30; 3112 mobileHeaderMiniCart.SortId = 0; 3113 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart); 3114 break; 3115 } 3116 } 3117 3118 3119 @helper RenderMobileTop() 3120 { 3121 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileTop").OrderBy(item => item.SortId).ToList(); 3122 3123 <nav class="main-navigation-mobile dw-mod"> 3124 <div class="center-container top-container__center-container dw-mod"> 3125 <div class="grid grid--align-center"> 3126 @RenderBlockList(subBlocks) 3127 </div> 3128 </div> 3129 </nav> 3130 <div class="color-scheme"> 3131 <span class="scheme first"></span> 3132 <span class="scheme second"></span> 3133 <span class="scheme third"></span> 3134 <span class="scheme fourth"></span> 3135 <span class="scheme fifth"></span> 3136 <span class="scheme sixth"></span> 3137 <span class="scheme seventh"></span> 3138 </div> 3139 } 3140 3141 @helper RenderMobileHeaderNavigation() 3142 { 3143 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderNavigation").OrderBy(item => item.SortId).ToList(); 3144 3145 <div class="grid__col-auto-width"> 3146 <ul class="menu dw-mod"> 3147 @RenderBlockList(subBlocks) 3148 </ul> 3149 </div> 3150 } 3151 3152 @helper RenderMobileHeaderNavigationTrigger() 3153 { 3154 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 3155 <label for="MobileNavTrigger" class="mobile-nav-trigger-button menu__link menu__link--icon menu__link--mobile dw-mod"></label> 3156 </li> 3157 } 3158 3159 @helper RenderMobileHeaderLogo() 3160 { 3161 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderLogo").OrderBy(item => item.SortId).ToList(); 3162 3163 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"; 3164 string centeredLogo = mobileTopLayout != "nav-right" ? "u-ta-center" : ""; 3165 string firstPageId = Model.Area.FirstActivePage.ID.ToString(); 3166 string businessName = Model.Area.Item.GetItem("Settings").GetString("BusinessName"); 3167 3168 string mobileLogo = "/Files/Images/logo-dynamicweb.png"; 3169 if (Model.Area.Item.GetItem("Layout").GetItem("MobileTop") != null && Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo") != null) 3170 { 3171 mobileLogo = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo").PathUrlEncoded; 3172 } 3173 3174 if (Path.GetExtension(mobileLogo).ToLower() != ".svg") 3175 { 3176 mobileLogo = "/Admin/Public/GetImage.ashx?height=40&amp;crop=5&amp;Compression=75&amp;image=" + mobileLogo; 3177 } 3178 else 3179 { 3180 mobileLogo = HttpUtility.UrlDecode(mobileLogo); 3181 } 3182 3183 <div class="grid__col-auto grid__col--bleed"> 3184 <div class="grid__cell @centeredLogo"> 3185 <a href="/Default.aspx?ID=@firstPageId" class="logo logo--mobile u-inline-block dw-mod"> 3186 <img class="grid__cell-img logo__img logo__img--mobile dw-mod" src="@mobileLogo" alt="@businessName" /> 3187 </a> 3188 </div> 3189 3190 @RenderBlockList(subBlocks) 3191 </div> 3192 } 3193 3194 @helper RenderMobileTopActions() 3195 { 3196 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderActions").OrderBy(item => item.SortId).ToList(); 3197 3198 <div class="grid__col-auto-width"> 3199 <ul class="menu dw-mod"> 3200 @RenderBlockList(subBlocks) 3201 </ul> 3202 </div> 3203 } 3204 3205 @helper RenderMobileTopSearch() 3206 { 3207 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 3208 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> 3209 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> 3210 </label> 3211 </li> 3212 } 3213 3214 @helper RenderMobileTopMiniCart() 3215 { 3216 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 3217 int cartPageId = GetPageIdByNavigationTag("CartPage"); 3218 double cartProductsCount = Model.Cart.TotalProductsCount; 3219 3220 <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')"> 3221 <div class="mini-cart dw-mod"> 3222 <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"> 3223 <div class="u-inline u-position-relative"> 3224 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue fa-1_5x"></i> 3225 <div class="mini-cart__counter dw-mod"> 3226 <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"> 3227 <div class="js-mini-cart-counter-content"> 3228 @cartProductsCount 3229 </div> 3230 </div> 3231 </div> 3232 </div> 3233 </a> 3234 @if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 3235 { 3236 <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> 3237 } 3238 </div> 3239 </li> 3240 } 3241 3242 @helper RenderMobileTopSearchBar() 3243 { 3244 string searchFeedId = ""; 3245 string searchSecondFeedId = ""; 3246 int groupsFeedId; 3247 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 3248 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 3249 string resultPageLink; 3250 string searchPlaceholder; 3251 string searchType = "product-search"; 3252 string searchTemplate; 3253 string searchContentTemplate = ""; 3254 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; 3255 bool showGroups = true; 3256 3257 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch") 3258 { 3259 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 3260 resultPageLink = contentSearchPageLink; 3261 searchPlaceholder = Translate("Search page"); 3262 groupsFeedId = 0; 3263 searchType = "content-search"; 3264 searchTemplate = "SearchPagesTemplate"; 3265 showGroups = false; 3266 } 3267 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch") 3268 { 3269 searchFeedId = productsPageId + "&feed=true"; 3270 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 3271 resultPageLink = Converter.ToString(productsPageId); 3272 searchPlaceholder = Translate("Search products or pages"); 3273 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 3274 searchType = "combined-search"; 3275 searchTemplate = "SearchProductsTemplateWrap"; 3276 searchContentTemplate = "SearchPagesTemplateWrap"; 3277 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 3278 } 3279 else 3280 { 3281 resultPageLink = Converter.ToString(productsPageId); 3282 searchFeedId = productsPageId + "&feed=true"; 3283 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 3284 searchPlaceholder = Translate("Search products"); 3285 searchTemplate = "SearchProductsTemplate"; 3286 searchType = "product-search"; 3287 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 3288 } 3289 3290 3291 <input type="checkbox" id="MobileSearchTrigger" class="mobile-search-trigger" /> 3292 3293 <div class="main-navigation-mobile typeahead-mobile dw-mod"> 3294 <div class="center-container top-container__center-container dw-mod"> 3295 <div class="grid"> 3296 <div class="grid__col-auto"> 3297 <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"> 3298 <input type="text" class="js-typeahead-search-field u-w160px u-no-margin" placeholder="@searchPlaceholder" value="@searchValue"> 3299 @if (string.IsNullOrEmpty(searchSecondFeedId)) 3300 { 3301 <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> 3302 } 3303 else 3304 { 3305 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--combined-mobile grid"> 3306 <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> 3307 <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> 3308 </div> 3309 } 3310 <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> 3311 </div> 3312 </div> 3313 <div class="grid__col-auto-width"> 3314 <ul class="menu dw-mod"> 3315 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 3316 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> 3317 <i class="fas fa-times fa-1_5x"></i> 3318 </label> 3319 </li> 3320 </ul> 3321 </div> 3322 </div> 3323 </div> 3324 </div> 3325 } 3326 3327 @helper RenderMobileMiniCartCounterContent() 3328 { 3329 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 3330 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right"; 3331 bool showPriceInMiniCartCounter = Pageview.Device.ToString() != "Mobile" && counterPosition == "right" && showPrice; 3332 3333 <script id="MiniCartCounterContent" type="text/x-template"> 3334 {{#.}} 3335 <div class="js-mini-cart-counter-content dw-mod"> 3336 @if (showPriceInMiniCartCounter) 3337 { 3338 @Translate("Cart")<text>({{numberofproducts}}) {{totalprice}}</text> 3339 } 3340 else 3341 { 3342 <text>{{numberofproducts}}</text> 3343 } 3344 </div> 3345 {{/.}} 3346 </script> 3347 } 3348 </text> 3349 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3350 3351 @using System 3352 @using System.Web 3353 @using System.Collections.Generic 3354 @using Dynamicweb.Rapido.Blocks.Extensibility 3355 @using Dynamicweb.Rapido.Blocks 3356 3357 @functions { 3358 BlocksPage mobileNavigationBlocksPage = BlocksPage.GetBlockPage("Master"); 3359 } 3360 3361 @{ 3362 bool navigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 3363 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); 3364 bool hideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); 3365 bool hideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); 3366 bool hideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); 3367 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); 3368 3369 Block mobileNavigation = new Block() 3370 { 3371 Id = "MobileNavigation", 3372 SortId = 10, 3373 Template = MobileNavigation(), 3374 SkipRenderBlocksList = true 3375 }; 3376 mobileNavigationBlocksPage.Add(MasterBlockId.MasterTopSnippets, mobileNavigation); 3377 3378 if (Model.CurrentUser.ID > 0 && !hideMyProfileLink) 3379 { 3380 Block mobileNavigationSignIn = new Block 3381 { 3382 Id = "MobileNavigationSignIn", 3383 SortId = 10, 3384 Template = RenderMobileNavigationSignIn() 3385 }; 3386 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationSignIn); 3387 } 3388 3389 Block mobileNavigationMenu = new Block 3390 { 3391 Id = "MobileNavigationMenu", 3392 SortId = 20, 3393 Template = RenderMobileNavigationMenu() 3394 }; 3395 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationMenu); 3396 3397 Block mobileNavigationActions = new Block 3398 { 3399 Id = "MobileNavigationActions", 3400 SortId = 30, 3401 Template = RenderMobileNavigationActions(), 3402 SkipRenderBlocksList = true 3403 }; 3404 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationActions); 3405 3406 if (!navigationItemsHideSignIn) 3407 { 3408 if (Model.CurrentUser.ID <= 0) 3409 { 3410 Block mobileNavigationSignInAction = new Block 3411 { 3412 Id = "MobileNavigationSignInAction", 3413 SortId = 10, 3414 Template = RenderMobileNavigationSignInAction() 3415 }; 3416 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignInAction); 3417 3418 if (!hideCreateAccountLink) 3419 { 3420 Block mobileNavigationCreateAccountAction = new Block 3421 { 3422 Id = "MobileNavigationCreateAccountAction", 3423 SortId = 20, 3424 Template = RenderMobileNavigationCreateAccountAction() 3425 }; 3426 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationCreateAccountAction); 3427 } 3428 } 3429 else 3430 { 3431 if (!hideMyOrdersLink) 3432 { 3433 Block mobileNavigationOrdersAction = new Block 3434 { 3435 Id = "MobileNavigationOrdersAction", 3436 SortId = 20, 3437 Template = RenderMobileNavigationOrdersAction() 3438 }; 3439 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationOrdersAction); 3440 } 3441 if (!hideMyFavoritesLink) 3442 { 3443 Block mobileNavigationFavoritesAction = new Block 3444 { 3445 Id = "MobileNavigationFavoritesAction", 3446 SortId = 30, 3447 Template = RenderMobileNavigationFavoritesAction() 3448 }; 3449 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationFavoritesAction); 3450 } 3451 if (!hideMySavedCardsLink) 3452 { 3453 Block mobileNavigationSavedCardsAction = new Block 3454 { 3455 Id = "MobileNavigationFavoritesAction", 3456 SortId = 30, 3457 Template = RenderMobileNavigationSavedCardsAction() 3458 }; 3459 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSavedCardsAction); 3460 } 3461 3462 Block mobileNavigationSignOutAction = new Block 3463 { 3464 Id = "MobileNavigationSignOutAction", 3465 SortId = 40, 3466 Template = RenderMobileNavigationSignOutAction() 3467 }; 3468 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignOutAction); 3469 } 3470 } 3471 3472 if (Model.Languages.Count > 1) 3473 { 3474 Block mobileNavigationLanguagesAction = new Block 3475 { 3476 Id = "MobileNavigationLanguagesAction", 3477 SortId = 50, 3478 Template = RenderMobileNavigationLanguagesAction() 3479 }; 3480 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationLanguagesAction); 3481 } 3482 } 3483 3484 3485 @helper MobileNavigation() 3486 { 3487 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigation").OrderBy(item => item.SortId).ToList(); 3488 3489 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 3490 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 3491 int cartFeedPageId = GetPageIdByNavigationTag("CartOrderlinesFeed"); 3492 string mobileTopDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design") != null ? Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design").SelectedValue : "nav-left"; 3493 string position = mobileTopDesign == "nav-left" || mobileTopDesign == "nav-search-left" ? "left" : "right"; 3494 3495 <!-- Trigger for mobile navigation --> 3496 <input type="checkbox" id="MobileNavTrigger" class="mobile-nav-trigger mobile-nav-trigger--@position" autocomplete="off" /> 3497 3498 <!-- Mobile navigation --> 3499 <nav class="mobile-navigation mobile-navigation--@position dw-mod"> 3500 <div class="mobile-navigation__wrapper" id="mobileNavigationWrapper"> 3501 @RenderBlockList(subBlocks) 3502 </div> 3503 </nav> 3504 3505 <label class="mobile-nav-trigger-off" for="MobileNavTrigger"></label> 3506 3507 if (!onlyPreview) 3508 { 3509 <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> 3510 } 3511 } 3512 3513 @helper RenderMobileNavigationSignIn() 3514 { 3515 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 3516 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 3517 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 3518 string myProfilePageLink = linkStart + myProfilePageId; 3519 string userName = Model.CurrentUser.FirstName ?? ""; 3520 userName += " " + (Model.CurrentUser.LastName ?? ""); 3521 userName += userName == "" && Model.CurrentUser.UserName != null ? Model.CurrentUser.UserName : ""; 3522 3523 <ul class="menu menu-mobile"> 3524 <li class="menu-mobile__item"> 3525 <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> 3526 </li> 3527 </ul> 3528 } 3529 3530 @helper RenderMobileNavigationMenu() 3531 { 3532 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides"; 3533 string menuTemplate = isSlidesDesign ? "BaseMenuForMobileSlides.xslt" : "BaseMenuForMobileExpandable.xslt"; 3534 string levels = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels") : "3"; 3535 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 3536 int startLevel = renderPagesInToolBar ? 1 : 0; 3537 3538 @RenderNavigation(new 3539 { 3540 id = "mobilenavigation", 3541 cssclass = "menu menu-mobile dwnavigation", 3542 startLevel = @startLevel, 3543 ecomStartLevel = @startLevel + 1, 3544 endlevel = @levels, 3545 expandmode = "all", 3546 template = @menuTemplate 3547 }) 3548 3549 if (isSlidesDesign) 3550 { 3551 <script> 3552 function goToLevel(level) { 3553 document.getElementById('mobileNavigationWrapper').style.left = -(level * 100) + "%"; 3554 } 3555 3556 document.addEventListener('DOMContentLoaded', function () { 3557 goToLevel(document.getElementById('mobileNavigationWrapper').querySelectorAll('input[type=radio]:checked').length); 3558 }); 3559 </script> 3560 } 3561 3562 if (renderPagesInToolBar) 3563 { 3564 @RenderNavigation(new 3565 { 3566 id = "topToolsMobileNavigation", 3567 cssclass = "menu menu-mobile dwnavigation", 3568 template = "ToolsMenuForMobile.xslt" 3569 }) 3570 } 3571 } 3572 3573 @helper RenderMobileNavigationActions() 3574 { 3575 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigationActions").OrderBy(item => item.SortId).ToList(); ; 3576 3577 <ul class="menu menu-mobile"> 3578 @RenderBlockList(subBlocks) 3579 </ul> 3580 } 3581 3582 @helper RenderMobileNavigationSignInAction() 3583 { 3584 <li class="menu-mobile__item"> 3585 <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> 3586 </li> 3587 } 3588 3589 @helper RenderMobileNavigationCreateAccountAction() 3590 { 3591 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 3592 3593 <li class="menu-mobile__item"> 3594 <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> 3595 </li> 3596 } 3597 3598 @helper RenderMobileNavigationProfileAction() 3599 { 3600 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 3601 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 3602 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 3603 string myProfilePageLink = linkStart + myProfilePageId; 3604 3605 <li class="menu-mobile__item"> 3606 <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> 3607 </li> 3608 } 3609 3610 @helper RenderMobileNavigationOrdersAction() 3611 { 3612 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 3613 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 3614 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); 3615 string myOrdersPageLink = linkStart + myOrdersPageId; 3616 string ordersIcon = "fas fa-list"; 3617 3618 <li class="menu-mobile__item"> 3619 <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> 3620 </li> 3621 } 3622 3623 @helper RenderMobileNavigationFavoritesAction() 3624 { 3625 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 3626 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 3627 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 3628 string myFavoritesPageLink = linkStart + myFavoritesPageId; 3629 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"; 3630 3631 3632 <li class="menu-mobile__item"> 3633 <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> 3634 </li> 3635 } 3636 3637 @helper RenderMobileNavigationSavedCardsAction() 3638 { 3639 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 3640 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 3641 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards"); 3642 string mySavedCardsPageLink = linkStart + mySavedCardsPageId; 3643 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"; 3644 3645 <li class="menu-mobile__item"> 3646 <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> 3647 </li> 3648 } 3649 3650 @helper RenderMobileNavigationSignOutAction() 3651 { 3652 int pageId = Model.TopPage.ID; 3653 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"; 3654 3655 <li class="menu-mobile__item"> 3656 <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> 3657 </li> 3658 } 3659 3660 @helper RenderMobileNavigationLanguagesAction() 3661 { 3662 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides"; 3663 3664 string selectedLanguage = ""; 3665 foreach (var lang in Model.Languages) 3666 { 3667 if (lang.IsCurrent) 3668 { 3669 selectedLanguage = lang.Name; 3670 } 3671 } 3672 3673 <li class="menu-mobile__item dw-mod"> 3674 @if (isSlidesDesign) 3675 { 3676 <input id="MobileMenuCheck_Language" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(1);"> 3677 } 3678 else 3679 { 3680 <input id="MobileMenuCheck_Language" type="checkbox" class="expand-trigger"> 3681 } 3682 <div class="menu-mobile__link__wrap"> 3683 <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> 3684 <label for="MobileMenuCheck_Language" class="menu-mobile__trigger"></label> 3685 </div> 3686 <ul class="menu-mobile menu-mobile__submenu expand-menu"> 3687 @if (isSlidesDesign) 3688 { 3689 <li class="menu-mobile__item dw-mod"> 3690 <div class="menu-mobile__link__wrap"> 3691 <input id="MobileMenuCheck_Language_back" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(0);" /> 3692 <label for="MobileMenuCheck_Language_back" class="menu-mobile__trigger menu-mobile__trigger--back"></label> 3693 <label for="MobileMenuCheck_Language_back" class="menu-mobile__link dw-mod ">@Translate("Back")</label> 3694 </div> 3695 </li> 3696 } 3697 @foreach (var lang in Model.Languages) 3698 { 3699 <li class="menu-mobile__item dw-mod"> 3700 <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> 3701 </li> 3702 } 3703 </ul> 3704 </li> 3705 }</text> 3706 } 3707 else 3708 { 3709 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3710 3711 @using System 3712 @using System.Web 3713 @using System.Collections.Generic 3714 @using Dynamicweb.Rapido.Blocks.Extensibility 3715 @using Dynamicweb.Rapido.Blocks 3716 3717 @functions { 3718 BlocksPage headerBlocksPage = BlocksPage.GetBlockPage("Master"); 3719 } 3720 3721 @{ 3722 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 3723 { 3724 Block masterTools = new Block() 3725 { 3726 Id = "MasterDesktopTools", 3727 SortId = 10, 3728 Template = RenderDesktopTools(), 3729 SkipRenderBlocksList = true, 3730 BlocksList = new List<Block> 3731 { 3732 new Block { 3733 Id = "MasterDesktopToolsText", 3734 SortId = 10, 3735 Template = RenderDesktopToolsText(), 3736 Design = new Design 3737 { 3738 Size = "auto", 3739 HidePadding = true, 3740 RenderType = RenderType.Column 3741 } 3742 }, 3743 new Block { 3744 Id = "MasterDesktopToolsNavigation", 3745 SortId = 20, 3746 Template = RenderDesktopToolsNavigation(), 3747 Design = new Design 3748 { 3749 Size = "auto-width", 3750 HidePadding = true, 3751 RenderType = RenderType.Column 3752 } 3753 } 3754 } 3755 }; 3756 headerBlocksPage.Add("MasterHeader", masterTools); 3757 } 3758 3759 Block masterDesktopExtra = new Block() 3760 { 3761 Id = "MasterDesktopExtra", 3762 SortId = 10, 3763 Template = RenderDesktopExtra(), 3764 SkipRenderBlocksList = true 3765 }; 3766 headerBlocksPage.Add("MasterHeader", masterDesktopExtra); 3767 3768 Block masterDesktopNavigation = new Block() 3769 { 3770 Id = "MasterDesktopNavigation", 3771 SortId = 20, 3772 Template = RenderDesktopNavigation(), 3773 SkipRenderBlocksList = true 3774 }; 3775 headerBlocksPage.Add("MasterHeader", masterDesktopNavigation); 3776 } 3777 3778 @* Include the Blocks for the page *@ 3779 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3780 3781 @using System 3782 @using System.Web 3783 @using Dynamicweb.Rapido.Blocks.Extensibility 3784 @using Dynamicweb.Rapido.Blocks 3785 3786 @{ 3787 Block masterDesktopLogo = new Block 3788 { 3789 Id = "MasterDesktopLogo", 3790 SortId = 10, 3791 Template = RenderDesktopLogo(), 3792 Design = new Design 3793 { 3794 Size = "auto-width", 3795 HidePadding = true, 3796 RenderType = RenderType.Column, 3797 CssClass = "grid--align-self-center" 3798 } 3799 }; 3800 3801 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopLogo); 3802 } 3803 3804 3805 @helper RenderDesktopLogo() 3806 { 3807 string firstPageId = Model.Area.FirstActivePage.ID.ToString(); 3808 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 3809 string alignClass = topLayout == "two-lines-centered" || topLayout == "two-lines" ? "grid--align-self-center" : ""; 3810 string logo = Model.Area.Item.GetItem("Layout").GetFile("LogoImage") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoImage").PathUrlEncoded : "/Files/Images/logo-dynamicweb.png"; 3811 if (Path.GetExtension(logo).ToLower() != ".svg") 3812 { 3813 int logoHeight = Model.Area.Item.GetItem("Layout").GetInt32("LogoHeight"); 3814 logoHeight = logoHeight > 0 && Pageview.Device.ToString() != "Mobile" ? logoHeight : 40; 3815 logo = "/Admin/Public/GetImage.ashx?height=" + Converter.ToString(logoHeight) + "&amp;crop=5&amp;Compression=75&amp;image=" + logo; 3816 } 3817 else 3818 { 3819 logo = HttpUtility.UrlDecode(logo); 3820 } 3821 3822 <div class="logo @alignClass dw-mod"> 3823 <a href="/Default.aspx?ID=@firstPageId" class="logo__img dw-mod u-block"> 3824 <img class="grid__cell-img logo__img dw-mod" src="@logo" alt="@Translate("Logo")" /> 3825 </a> 3826 </div> 3827 } 3828 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3829 3830 @using System 3831 @using System.Web 3832 @using Dynamicweb.Rapido.Blocks.Extensibility 3833 @using Dynamicweb.Rapido.Blocks 3834 3835 @functions { 3836 bool isMegaMenu; 3837 } 3838 3839 @{ 3840 isMegaMenu = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu") != null ? Converter.ToBoolean(Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu").SelectedValue) : false; 3841 Block masterDesktopMenu = new Block 3842 { 3843 Id = "MasterDesktopMenu", 3844 SortId = 10, 3845 Template = RenderDesktopMenu(), 3846 Design = new Design 3847 { 3848 Size = "auto", 3849 HidePadding = true, 3850 RenderType = RenderType.Column 3851 } 3852 }; 3853 3854 if (isMegaMenu) 3855 { 3856 masterDesktopMenu.Design.CssClass = "u-reset-position"; 3857 } 3858 3859 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopMenu); 3860 } 3861 3862 @helper RenderDesktopMenu() 3863 { 3864 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 3865 string menuAlignment = topLayout == "minimal-right" ? "grid--align-self-end" : ""; 3866 string megamenuPromotionImage = Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage").PathUrlEncoded : ""; 3867 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 3868 bool showOnlyHeaders = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowOnlyHeaders"); 3869 int startLevel = renderPagesInToolBar ? 1 : 0; 3870 3871 string promotionLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("MegamenuPromotionLink"); 3872 3873 <div class="grid__cell u-flex @(isMegaMenu ? "u-reset-position" : "") @menuAlignment"> 3874 @if (!isMegaMenu) 3875 { 3876 @RenderNavigation(new 3877 { 3878 id = "topnavigation", 3879 cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap", 3880 startLevel = startLevel, 3881 ecomStartLevel = startLevel + 1, 3882 endlevel = 5, 3883 expandmode = "all", 3884 template = "BaseMenuWithDropdown.xslt" 3885 }); 3886 } 3887 else 3888 { 3889 @RenderNavigation(new 3890 { 3891 id = "topnavigation", 3892 cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap", 3893 startLevel = startLevel, 3894 ecomStartLevel = startLevel + 1, 3895 endlevel = 5, 3896 promotionImage = megamenuPromotionImage, 3897 promotionLink = promotionLink, 3898 expandmode = "all", 3899 showOnlyHeaders = showOnlyHeaders.ToString().ToLower(), 3900 template = "BaseMegaMenu.xslt" 3901 }); 3902 } 3903 </div> 3904 } 3905 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3906 3907 @using System 3908 @using System.Web 3909 @using Dynamicweb.Rapido.Blocks.Extensibility 3910 @using Dynamicweb.Rapido.Blocks 3911 3912 @{ 3913 Block masterDesktopActionsMenu = new Block 3914 { 3915 Id = "MasterDesktopActionsMenu", 3916 SortId = 10, 3917 Template = RenderDesktopActionsMenu(), 3918 Design = new Design 3919 { 3920 CssClass = "u-flex" 3921 }, 3922 SkipRenderBlocksList = true 3923 3924 }; 3925 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopActionsMenu); 3926 3927 if (!string.IsNullOrWhiteSpace(Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink"))) 3928 { 3929 Block masterDesktopActionsHeaderButton = new Block 3930 { 3931 Id = "MasterDesktopActionsHeaderButton", 3932 SortId = 60, 3933 Template = RenderHeaderButton() 3934 }; 3935 masterDesktopActionsMenu.Add(masterDesktopActionsHeaderButton); 3936 } 3937 } 3938 3939 @helper RenderDesktopActionsMenu() 3940 { 3941 List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopActionsMenu").OrderBy(item => item.SortId).ToList(); 3942 3943 <ul class="menu u-flex dw-mod"> 3944 @RenderBlockList(subBlocks) 3945 </ul> 3946 } 3947 3948 @helper RenderHeaderButton() 3949 { 3950 string headerButtonText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonText"); 3951 string headerButtonLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink"); 3952 string headerButtonType = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType") != null ? "btn--" + Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType").SelectedName.ToLower() : ""; 3953 3954 <li class="menu__item menu__item--horizontal menu--clean dw-mod"> 3955 <a class="btn @headerButtonType dw-mod u-no-margin u-margin-top u-margin-left" href="@headerButtonLink">@headerButtonText</a> 3956 </li> 3957 } 3958 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3959 3960 @using System 3961 @using System.Web 3962 @using Dynamicweb.Core; 3963 @using System.Text.RegularExpressions 3964 @using Dynamicweb.Rapido.Blocks.Extensibility 3965 @using Dynamicweb.Rapido.Blocks 3966 3967 @{ 3968 Block masterDesktopActionsMenuLanguageSelector = new Block 3969 { 3970 Id = "MasterDesktopActionsMenuLanguageSelector", 3971 SortId = 40, 3972 Template = RenderLanguageSelector() 3973 }; 3974 3975 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuLanguageSelector); 3976 } 3977 3978 @helper RenderLanguageSelector() 3979 { 3980 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 3981 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 3982 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 3983 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() : ""; 3984 3985 if (Model.Languages.Count > 1) 3986 { 3987 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon is-dropdown is-dropdown--no-icon dw-mod"> 3988 <div class="@menuLinkClass dw-mod"> 3989 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue fa-1_5x"></i> 3990 </div> 3991 <div class="menu menu--dropdown menu--dropdown-right languages-dropdown dw-mod grid__cell"> 3992 @foreach (var lang in Model.Languages) 3993 { 3994 string langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " u-margin-right\"></span>" + lang.Name; 3995 string cultureName = Regex.Replace(Dynamicweb.Services.Areas.GetArea(lang.ID).CultureInfo.NativeName, @" ?\(.*?\)", string.Empty); 3996 cultureName = char.ToUpper(cultureName[0]) + cultureName.Substring(1); 3997 3998 if (languageViewType == "flag-culture") 3999 { 4000 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span> " + cultureName; 4001 } 4002 4003 if (languageViewType == "flag") 4004 { 4005 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span>"; 4006 } 4007 4008 if (languageViewType == "name") 4009 { 4010 langInfo = lang.Name; 4011 } 4012 4013 if (languageViewType == "culture") 4014 { 4015 langInfo = cultureName; 4016 } 4017 4018 <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> 4019 } 4020 </div> 4021 </li> 4022 } 4023 } 4024 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4025 4026 @using System 4027 @using System.Web 4028 @using Dynamicweb.Rapido.Blocks.Extensibility 4029 @using Dynamicweb.Rapido.Blocks 4030 4031 @{ 4032 Block masterDesktopActionsMenuSignIn = new Block 4033 { 4034 Id = "MasterDesktopActionsMenuSignIn", 4035 SortId = 20, 4036 Template = RenderSignIn() 4037 }; 4038 4039 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuSignIn); 4040 } 4041 4042 @helper RenderSignIn() 4043 { 4044 bool navigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 4045 string userInitials = ""; 4046 int pageId = Model.TopPage.ID; 4047 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 4048 int myDashboardPageId = GetPageIdByNavigationTag("CustomerDashboard"); 4049 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 4050 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); 4051 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 4052 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards"); 4053 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 4054 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); 4055 bool hideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); 4056 bool hideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); 4057 bool hideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); 4058 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); 4059 bool hideForgotPasswordLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideForgotPasswordLink"); 4060 4061 string linkStart = "/Default.aspx?ID="; 4062 if (Model.CurrentUser.ID <= 0) 4063 { 4064 linkStart += signInProfilePageId + "&RedirectPageId="; 4065 } 4066 4067 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; 4068 string myProfilePageLink = linkStart + myProfilePageId; 4069 string myOrdersPageLink = linkStart + myOrdersPageId; 4070 string myFavoritesPageLink = linkStart + myFavoritesPageId; 4071 string mySavedCardsPageLink = linkStart + mySavedCardsPageId; 4072 4073 string profileIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue : "fa fa-user"; 4074 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"; 4075 4076 if (Model.CurrentUser.ID != 0) 4077 { 4078 if (!String.IsNullOrEmpty(Model.CurrentUser.Name)) 4079 { 4080 string[] names = Model.CurrentUser.Name.Split(' '); 4081 userInitials += Model.CurrentUser.Name.Substring(0, 1); 4082 4083 if (names.Length > 1) 4084 { 4085 userInitials += names[names.Length - 1].Substring(0, 1); 4086 } 4087 } 4088 else 4089 { 4090 userInitials += Model.CurrentUser.FirstName != null && Model.CurrentUser.FirstName != "" ? Model.CurrentUser.FirstName.Substring(0, 1) : ""; 4091 userInitials += Model.CurrentUser.LastName != null && Model.CurrentUser.LastName != "" ? Model.CurrentUser.LastName.Substring(0, 1) : ""; 4092 userInitials += userInitials.Length == 1 && Model.CurrentUser.FirstName != null && Model.CurrentUser.FirstName.Length > 1 ? Model.CurrentUser.FirstName.Substring(1, 2) : ""; 4093 userInitials += userInitials == "" && Model.CurrentUser.Email != null && Model.CurrentUser.Email.Length > 1 ? Model.CurrentUser.Email.Substring(0, 2) : ""; 4094 userInitials += userInitials == "" ? Model.CurrentUser.UserName.Substring(0, 2) : ""; 4095 } 4096 } 4097 4098 if (!navigationItemsHideSignIn) 4099 { 4100 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4101 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu__item--clean"; 4102 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4103 4104 <li class="menu__item menu__item--horizontal menu__item menu__item--icon @liClasses is-dropdown is-dropdown--no-icon dw-mod"> 4105 <div class="@menuLinkClass dw-mod"> 4106 @if (Model.CurrentUser.ID <= 0) 4107 { 4108 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue fa-1_5x"></i> 4109 } 4110 else 4111 { 4112 <a href="/default.aspx?ID=@myDashboardPageId" class="u-color-inherit"><div class="circle-icon-btn">@userInitials.ToUpper()</div></a> 4113 } 4114 </div> 4115 <div class="menu menu--dropdown menu--dropdown-right menu--sign-in grid__cell dw-mod"> 4116 <ul class="list list--clean dw-mod"> 4117 @if (Model.CurrentUser.ID <= 0) 4118 { 4119 <li> 4120 <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> 4121 </li> 4122 4123 if (!hideCreateAccountLink) 4124 { 4125 @RenderListItem("/default.aspx?ID=" + createAccountPageId, Translate("Create account")); 4126 } 4127 if (!hideForgotPasswordLink) 4128 { 4129 @RenderListItem(forgotPasswordPageLink, Translate("Forgot your password?")) 4130 } 4131 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) 4132 { 4133 @RenderSeparator() 4134 } 4135 } 4136 @if (!hideMyProfileLink) 4137 { 4138 @RenderListItem(myProfilePageLink, Translate("My Profile"), profileIcon) 4139 } 4140 @if (!hideMyOrdersLink) 4141 { 4142 @RenderListItem(myOrdersPageLink, Translate("My Orders"), "fas fa-list") 4143 } 4144 @if (!hideMyFavoritesLink) 4145 { 4146 @RenderListItem(myFavoritesPageLink, Translate("My Favorites"), favoritesIcon) 4147 } 4148 @if (!hideMySavedCardsLink) 4149 { 4150 @RenderListItem(mySavedCardsPageLink, Translate("My Saved cards"), "fas fa-credit-card") 4151 } 4152 @if (Model.CurrentUser.ID > 0) 4153 { 4154 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) 4155 { 4156 @RenderSeparator() 4157 } 4158 4159 @RenderListItem("/Admin/Public/ExtranetLogoff.aspx?ID=" + pageId, Translate("Sign out")) 4160 } 4161 </ul> 4162 </div> 4163 </li> 4164 } 4165 } 4166 4167 @helper RenderListItem(string link, string text, string icon = null) { 4168 <li> 4169 <a href="@link" class="list__link dw-mod"> 4170 @if (!string.IsNullOrEmpty(icon)) 4171 { 4172 <i class="@icon u-margin-right"></i> 4173 } 4174 @text 4175 </a> 4176 </li> 4177 } 4178 4179 @helper RenderSeparator() 4180 { 4181 <li class="list__seperator dw-mod"></li> 4182 } 4183 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4184 4185 @using System 4186 @using System.Web 4187 @using Dynamicweb.Rapido.Blocks.Extensibility 4188 @using Dynamicweb.Rapido.Blocks 4189 4190 @{ 4191 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideFavorites"); 4192 4193 Block masterDesktopActionsMenuFavorites = new Block 4194 { 4195 Id = "MasterDesktopActionsMenuFavorites", 4196 SortId = 30, 4197 Template = RenderFavorites() 4198 }; 4199 4200 if (!hideMyFavoritesLink && Model.CurrentUser.ID > 0) 4201 { 4202 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuFavorites); 4203 } 4204 } 4205 4206 @helper RenderFavorites() 4207 { 4208 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 4209 string myFavoritesPageLink = "/Default.aspx?ID=" + myFavoritesPageId; 4210 4211 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4212 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 4213 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4214 4215 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod"> 4216 <a href="@myFavoritesPageLink" class="@menuLinkClass dw-mod"> 4217 <i class="fas fa-@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue fa-1_5x"></i> 4218 </a> 4219 </li> 4220 } 4221 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4222 4223 @using System 4224 @using System.Web 4225 @using Dynamicweb.Rapido.Blocks.Extensibility 4226 @using Dynamicweb.Rapido.Blocks 4227 4228 @{ 4229 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 4230 bool hideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 4231 string miniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown"; 4232 4233 if (!onlyPreview && !hideCart) 4234 { 4235 Block masterDesktopActionsMenuMiniCart = new Block 4236 { 4237 Id = "MasterDesktopActionsMenuMiniCart", 4238 SortId = 50, 4239 Template = RenderMiniCart(miniCartLayout == "dropdown"), 4240 SkipRenderBlocksList = true, 4241 BlocksList = new List<Block>() 4242 }; 4243 4244 Block miniCartCounterScriptTemplate = new Block 4245 { 4246 Id = "MiniCartCounterScriptTemplate", 4247 Template = RenderMiniCartCounterContent() 4248 }; 4249 4250 //dropdown layout is default 4251 RazorEngine.Templating.TemplateWriter layoutTemplate = RenderMiniCartDropdownLayout(); 4252 RazorEngine.Templating.TemplateWriter miniCartTriggerTemplate = RenderMiniCartTriggerLink(); 4253 4254 switch (miniCartLayout) 4255 { 4256 case "panel": 4257 layoutTemplate = RenderMiniCartPanelLayout(); 4258 miniCartTriggerTemplate = RenderMiniCartTriggerLabel(); 4259 break; 4260 case "modal": 4261 layoutTemplate = RenderMiniCartModalLayout(); 4262 miniCartTriggerTemplate = RenderMiniCartTriggerLabel(); 4263 break; 4264 } 4265 4266 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block 4267 { 4268 Id = "MiniCartTrigger", 4269 Template = miniCartTriggerTemplate 4270 }); 4271 4272 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 4273 { 4274 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block 4275 { 4276 Id = "MiniCartLayout", 4277 Template = layoutTemplate 4278 }); 4279 } 4280 4281 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuMiniCart); 4282 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate); 4283 } 4284 } 4285 4286 @helper RenderMiniCart(bool hasMouseEnterEvent) 4287 { 4288 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterDesktopActionsMenuMiniCart").OrderBy(item => item.SortId).ToList(); 4289 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4290 string liClasses = topLayout != "normal" ? "menu__item--top-level" : "menu--clean"; 4291 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4292 string mouseEvent = ""; 4293 string id = "MiniCart"; 4294 if (hasMouseEnterEvent) { 4295 mouseEvent = "onmouseenter=\"Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=" + miniCartFeedPageId + "&feedType=MiniCart')\""; 4296 id = "miniCartTrigger"; 4297 } 4298 <li class="menu__item menu__item--horizontal menu__item--icon @liClasses dw-mod" id="@id" @mouseEvent> 4299 @RenderBlockList(subBlocks) 4300 </li> 4301 } 4302 4303 @helper RenderMiniCartTriggerLabel() 4304 { 4305 int cartPageId = GetPageIdByNavigationTag("CartPage"); 4306 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart"; 4307 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4308 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4309 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4310 4311 <div class="@menuLinkClass dw-mod js-mini-cart-button" onclick="Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart')"> 4312 <div class="u-inline u-position-relative"> 4313 <i class="@cartIcon fa-1_5x"></i> 4314 @RenderMiniCartCounter() 4315 </div> 4316 </div> 4317 } 4318 4319 @helper RenderMiniCartTriggerLink() 4320 { 4321 int cartPageId = GetPageIdByNavigationTag("CartPage"); 4322 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart"; 4323 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4324 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4325 4326 <a href="/Default.aspx?ID=@cartPageId&Purge=True" class="@menuLinkClass menu__item--icon dw-mod js-mini-cart-button"> 4327 <div class="u-inline u-position-relative"> 4328 <i class="@cartIcon fa-1_5x"></i> 4329 @RenderMiniCartCounter() 4330 </div> 4331 </a> 4332 } 4333 4334 @helper RenderMiniCartCounter() 4335 { 4336 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4337 string cartProductsCount = Model.Cart.TotalProductsCount.ToString(); 4338 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right"; 4339 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 4340 string cartProductsTotalPrice = showPrice && Model.Cart.TotalPrice != null ? Model.Cart.TotalPrice.Price.Formatted : ""; 4341 cartProductsTotalPrice = counterPosition == "right" ? cartProductsTotalPrice : ""; 4342 4343 if (showPrice && counterPosition == "right") 4344 { 4345 cartProductsCount = Translate("Cart") + "(" + cartProductsCount + ")"; 4346 } 4347 4348 <div class="mini-cart__counter dw-mod"> 4349 <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"> 4350 <div class="js-mini-cart-counter-content" data-count="@Model.Cart.TotalProductsCount.ToString()"> 4351 @cartProductsCount 4352 @cartProductsTotalPrice 4353 </div> 4354 </div> 4355 </div> 4356 } 4357 4358 @helper RenderMiniCartCounterContent() 4359 { 4360 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 4361 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right"; 4362 bool showPriceInMiniCartCounter = Pageview.Device.ToString() != "Mobile" && counterPosition == "right" && showPrice; 4363 4364 <script id="MiniCartCounterContent" type="text/x-template"> 4365 {{#.}} 4366 <div class="js-mini-cart-counter-content dw-mod" data-count="{{numberofproducts}}"> 4367 @if (showPriceInMiniCartCounter) 4368 { 4369 @Translate("Cart")<text>({{numberofproducts}}) {{totalprice}}</text> 4370 } 4371 else 4372 { 4373 <text>{{numberofproducts}}</text> 4374 } 4375 </div> 4376 {{/.}} 4377 </script> 4378 } 4379 4380 @helper RenderMiniCartDropdownLayout() 4381 { 4382 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4383 4384 <div class="mini-cart mini-cart-dropdown js-mini-cart grid__cell dw-mod" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="dropdown"> 4385 <div class="mini-cart-dropdown__inner dw-mod"> 4386 <h3 class="u-ta-center dw-mod">@Translate("Shopping cart")</h3> 4387 <div class="mini-cart-dropdown__body u-flex dw-mod"> 4388 <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> 4389 </div> 4390 </div> 4391 </div> 4392 } 4393 4394 @helper RenderMiniCartPanelLayout() 4395 { 4396 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4397 4398 <div class="mini-cart grid__cell dw-mod"> 4399 <input type="checkbox" id="miniCartTrigger" class="panel-trigger" /> 4400 <div class="panel panel--right panel--with-close-btn dw-mod js-mini-cart" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="block"> 4401 <label for="miniCartTrigger" class="panel__close-btn" title="@Translate("Close panel")"><i class="fas fa-times"></i></label> 4402 <div class="panel__content u-full-width dw-mod"> 4403 <h3 class="panel__header dw-mod u-margin-bottom u-ta-center">@Translate("Shopping cart")</h3> 4404 <div class="panel__content-body panel__content-body--cart dw-mod"> 4405 <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> 4406 </div> 4407 </div> 4408 </div> 4409 </div> 4410 } 4411 4412 @helper RenderMiniCartModalLayout() 4413 { 4414 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4415 <div class="mini-cart grid__cell dw-mod"> 4416 <input type="checkbox" id="miniCartTrigger" class="modal-trigger" autocomplete="off" /> 4417 <div class="modal-container dw-mod js-mini-cart" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="block"> 4418 <label for="miniCartTrigger" class="modal-overlay"></label> 4419 <div class="modal modal--top-right dw-mod"> 4420 <div class="modal__body u-flex grid--direction-column dw-mod"> 4421 <h3 class="dw-mod u-ta-center">@Translate("Shopping cart")</h3> 4422 <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> 4423 </div> 4424 <label class="modal__close-btn modal__close-btn--clean dw-mod" for="miniCartTrigger" title="@Translate("Close modal")"></label> 4425 </div> 4426 </div> 4427 </div> 4428 } 4429 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4430 4431 @using System 4432 @using System.Web 4433 @using Dynamicweb.Rapido.Blocks.Extensibility 4434 @using Dynamicweb.Rapido.Blocks 4435 4436 @{ 4437 bool showDownloadCartLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart"); 4438 4439 Block masterDesktopActionsMenuDownloadCart = new Block 4440 { 4441 Id = "MasterDesktopActionsMenuDownloadCart", 4442 SortId = 35, 4443 Template = RenderDownloadCart() 4444 }; 4445 4446 if (showDownloadCartLink && Model.CurrentUser.ID > 0) 4447 { 4448 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuDownloadCart); 4449 } 4450 } 4451 4452 @helper RenderDownloadCart() 4453 { 4454 int downloadCartPageId = GetPageIdByNavigationTag("DownloadCart"); 4455 string downloadCartPageLink = "/Default.aspx?ID=" + downloadCartPageId; 4456 4457 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4458 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 4459 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4460 4461 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod"> 4462 <a href="@downloadCartPageLink" class="@menuLinkClass dw-mod"> 4463 <i class="fas fa-cart-arrow-down fa-1_5x"></i> 4464 </a> 4465 </li> 4466 } 4467 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4468 4469 @using System 4470 @using System.Web 4471 @using Dynamicweb.Rapido.Blocks.Extensibility 4472 @using Dynamicweb.Rapido.Blocks 4473 4474 @functions { 4475 public class SearchConfiguration 4476 { 4477 public string searchFeedId { get; set; } 4478 public string searchSecondFeedId { get; set; } 4479 public int groupsFeedId { get; set; } 4480 public string resultPageLink { get; set; } 4481 public string searchPlaceholder { get; set; } 4482 public string searchType { get; set; } 4483 public string searchTemplate { get; set; } 4484 public string searchContentTemplate { get; set; } 4485 public string searchValue { get; set; } 4486 public bool showGroups { get; set; } 4487 4488 public SearchConfiguration() 4489 { 4490 searchFeedId = ""; 4491 searchSecondFeedId = ""; 4492 searchType = "product-search"; 4493 searchContentTemplate = ""; 4494 showGroups = true; 4495 } 4496 } 4497 } 4498 @{ 4499 Block masterSearchBar = new Block 4500 { 4501 Id = "MasterSearchBar", 4502 SortId = 40, 4503 Template = RenderSearch("bar"), 4504 Design = new Design 4505 { 4506 Size = "auto", 4507 HidePadding = true, 4508 RenderType = RenderType.Column 4509 } 4510 }; 4511 4512 Block masterSearchAction = new Block 4513 { 4514 Id = "MasterDesktopActionsMenuSearch", 4515 SortId = 10, 4516 Template = RenderSearch() 4517 }; 4518 4519 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterSearchBar); 4520 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterSearchAction); 4521 } 4522 4523 @helper RenderSearch(string type = "mini-search") 4524 { 4525 string productsPageId = Converter.ToString(GetPageIdByNavigationTag("ProductsPage")); 4526 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 4527 string searchType = Model.Area.Item.GetItem("Layout").GetList("TopSearch") != null ? Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue : "productSearch"; 4528 4529 SearchConfiguration searchConfiguration = null; 4530 4531 switch (searchType) { 4532 case "contentSearch": 4533 searchConfiguration = new SearchConfiguration() { 4534 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true", 4535 resultPageLink = contentSearchPageLink, 4536 searchPlaceholder = Translate("Search page"), 4537 groupsFeedId = 0, 4538 searchType = "content-search", 4539 searchTemplate = "SearchPagesTemplate", 4540 showGroups = false 4541 }; 4542 break; 4543 case "combinedSearch": 4544 searchConfiguration = new SearchConfiguration() { 4545 searchFeedId = productsPageId + "&feed=true", 4546 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true", 4547 resultPageLink = Converter.ToString(productsPageId), 4548 searchPlaceholder = Translate("Search products or pages"), 4549 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"), 4550 searchType = "combined-search", 4551 searchTemplate = "SearchProductsTemplateWrap", 4552 searchContentTemplate = "SearchPagesTemplateWrap", 4553 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector") 4554 }; 4555 break; 4556 default: //productSearch 4557 searchConfiguration = new SearchConfiguration() { 4558 resultPageLink = Converter.ToString(productsPageId), 4559 searchFeedId = productsPageId + "&feed=true", 4560 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"), 4561 searchPlaceholder = Translate("Search products"), 4562 searchTemplate = "SearchProductsTemplate", 4563 searchType = "product-search", 4564 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector") 4565 }; 4566 break; 4567 } 4568 searchConfiguration.searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; 4569 4570 if (type == "mini-search") { 4571 @RenderMiniSearch(searchConfiguration) 4572 } else { 4573 @RenderSearchBar(searchConfiguration) 4574 } 4575 } 4576 4577 @helper RenderSearchBar(SearchConfiguration options) 4578 { 4579 <div class="typeahead typeahead--centered u-color-inherit js-typeahead dw-mod" id="ProductSearchBar" 4580 data-page-size="7" 4581 data-search-feed-id="@options.searchFeedId" 4582 data-search-second-feed-id="@options.searchSecondFeedId" 4583 data-result-page-id="@options.resultPageLink" 4584 data-groups-page-id="@options.groupsFeedId" 4585 data-search-type="@options.searchType"> 4586 @if (options.showGroups) 4587 { 4588 <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> 4589 <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> 4590 } 4591 <div class="typeahead-search-field"> 4592 <input type="text" class="u-no-margin u-full-width u-full-height js-typeahead-search-field" placeholder="@options.searchPlaceholder" value="@options.searchValue"> 4593 @if (string.IsNullOrEmpty(options.searchSecondFeedId)) 4594 { 4595 <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> 4596 } 4597 else 4598 { 4599 <div class="dropdown dropdown--absolute-position dropdown--combined grid"> 4600 <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> 4601 <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> 4602 </div> 4603 } 4604 </div> 4605 <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> 4606 </div> 4607 } 4608 4609 @helper RenderMiniSearch(SearchConfiguration options) 4610 { 4611 <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()"> 4612 <div class="menu__link menu__link--icon dw-mod"> 4613 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> 4614 </div> 4615 <div class="menu menu--dropdown menu--dropdown-right u-no-padding u-w380px grid__cell dw-mod"> 4616 <div class="typeahead js-typeahead" id="ProductSearchBar" 4617 data-page-size="7" 4618 data-search-feed-id="@options.searchFeedId" 4619 data-search-second-feed-id="@options.searchSecondFeedId" 4620 data-result-page-id="@options.resultPageLink" 4621 data-search-type="@options.searchType"> 4622 <div class="typeahead-search-field"> 4623 <input type="text" class="u-no-margin u-full-width js-typeahead-search-field" id="headerSearch" placeholder="@options.searchPlaceholder" value="@options.searchValue"> 4624 @if (string.IsNullOrEmpty(options.searchSecondFeedId)) 4625 { 4626 <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> 4627 } 4628 else 4629 { 4630 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--right-aligned"> 4631 <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> 4632 <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> 4633 </div> 4634 } 4635 </div> 4636 </div> 4637 </div> 4638 </li> 4639 } 4640 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4641 4642 @using System 4643 @using System.Web 4644 @using Dynamicweb.Rapido.Blocks.Extensibility 4645 @using Dynamicweb.Rapido.Blocks 4646 4647 @{ 4648 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4649 bool hideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 4650 4651 BlocksPage headerConfigurationPage = BlocksPage.GetBlockPage("Master"); 4652 4653 Block configDesktopLogo = headerConfigurationPage.GetBlockById("MasterDesktopLogo"); 4654 headerConfigurationPage.RemoveBlock(configDesktopLogo); 4655 4656 Block configDesktopMenu = headerConfigurationPage.GetBlockById("MasterDesktopMenu"); 4657 headerConfigurationPage.RemoveBlock(configDesktopMenu); 4658 4659 Block configSearchBar = headerConfigurationPage.GetBlockById("MasterSearchBar"); 4660 headerConfigurationPage.RemoveBlock(configSearchBar); 4661 4662 Block configSearchAction = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenuSearch"); 4663 headerConfigurationPage.RemoveBlock(configSearchAction); 4664 4665 Block configDesktopActionsMenu = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenu"); 4666 headerConfigurationPage.RemoveBlock(configDesktopActionsMenu); 4667 4668 Block configDesktopExtra = headerConfigurationPage.GetBlockById("MasterDesktopExtra"); 4669 4670 switch (topLayout) 4671 { 4672 case "condensed": //2 4673 configDesktopLogo.Design.Size = "auto-width"; 4674 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); 4675 4676 configDesktopMenu.SortId = 20; 4677 configDesktopMenu.Design.Size = "auto"; 4678 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 4679 4680 configDesktopActionsMenu.SortId = 30; 4681 configDesktopActionsMenu.Design.Size = "auto-width"; 4682 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 4683 4684 if (!hideSearch) 4685 { 4686 configSearchBar.SortId = 40; 4687 configSearchBar.Design.Size = "12"; 4688 configDesktopExtra.SortId = 50; 4689 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); 4690 } 4691 break; 4692 case "splitted": //3 4693 configDesktopLogo.Design.Size = "auto"; 4694 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 4695 4696 if (!hideSearch) 4697 { 4698 configSearchBar.SortId = 20; 4699 configSearchBar.Design.Size = "auto"; 4700 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); 4701 } 4702 4703 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 4704 4705 configDesktopActionsMenu.SortId = 20; 4706 configDesktopActionsMenu.Design.Size = "auto-width"; 4707 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 4708 break; 4709 case "minimal": //4 4710 configDesktopLogo.Design.Size = "auto-width"; 4711 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); 4712 4713 configDesktopMenu.Design.Size = "auto"; 4714 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 4715 4716 configDesktopActionsMenu.SortId = 20; 4717 configDesktopActionsMenu.Design.Size = "auto-width"; 4718 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 4719 4720 if (!hideSearch) 4721 { 4722 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 4723 } 4724 break; 4725 case "minimal-right": //5 4726 configDesktopLogo.Design.Size = "auto-width"; 4727 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); 4728 4729 configDesktopMenu.Design.Size = "auto"; 4730 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 4731 4732 configDesktopActionsMenu.SortId = 20; 4733 configDesktopActionsMenu.Design.Size = "auto-width"; 4734 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 4735 4736 if (!hideSearch) 4737 { 4738 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 4739 } 4740 break; 4741 case "two-lines": //6 4742 configDesktopLogo.Design.Size = "auto"; 4743 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 4744 4745 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 4746 4747 configDesktopActionsMenu.SortId = 20; 4748 configDesktopActionsMenu.Design.Size = "auto-width"; 4749 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 4750 4751 if (!hideSearch) 4752 { 4753 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 4754 } 4755 break; 4756 case "two-lines-centered": //7 4757 configDesktopLogo.Design.Size = "auto"; 4758 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 4759 4760 configDesktopMenu.Design.Size = "auto-width"; 4761 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 4762 4763 configDesktopActionsMenu.SortId = 20; 4764 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 4765 4766 if (!hideSearch) 4767 { 4768 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 4769 } 4770 break; 4771 case "normal": //1 4772 default: 4773 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 4774 4775 if (!hideSearch) 4776 { 4777 configSearchBar.SortId = 20; 4778 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); 4779 } 4780 4781 configDesktopActionsMenu.SortId = 30; 4782 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopActionsMenu); 4783 4784 configDesktopActionsMenu.Design.Size = "auto-width"; 4785 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 4786 break; 4787 } 4788 } 4789 @if (File.Exists(HttpContext.Current.Server.MapPath("/Files/Templates/Designs/Rapido/MasterBlocks/HeaderBlocks/Custom__Blocks.cshtml"))) 4790 { 4791 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4792 4793 @using System 4794 @using System.Web 4795 @using Dynamicweb.Rapido.Blocks.Extensibility 4796 @using Dynamicweb.Rapido.Blocks 4797 4798 @{ 4799 Block colorSchemaInHeader = new Block 4800 { 4801 Id = "ColorSchemaInHeader", 4802 SortId = 100, 4803 Template = RenderColorSchemaInHeader(), 4804 Design = new Design 4805 { 4806 Size = "max-width", 4807 RenderType = RenderType.Column, 4808 CssClass = "u-no-padding" 4809 } 4810 }; 4811 4812 BlocksPage masterCustomBlocksPage = BlocksPage.GetBlockPage("Master"); 4813 4814 Block CustomMasterSearchAction = new Block 4815 { 4816 Id = "MasterDesktopActionsMenuSearch", 4817 SortId = 10, 4818 Template = CustomRenderSearch() 4819 }; 4820 4821 Block CustomMasterSearchBar = new Block 4822 { 4823 Id = "MasterSearchBar", 4824 SortId = 40, 4825 Template = CustomRenderSearch("bar"), 4826 Design = new Design 4827 { 4828 Size = "auto", 4829 HidePadding = true, 4830 RenderType = RenderType.Column 4831 } 4832 }; 4833 4834 masterCustomBlocksPage.ReplaceBlock(CustomMasterSearchAction); 4835 masterCustomBlocksPage.ReplaceBlock(CustomMasterSearchBar); 4836 4837 BlocksPage.GetBlockPage("Master").Add("MasterHeader", colorSchemaInHeader); 4838 } 4839 4840 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4841 4842 @using System 4843 @using System.Web 4844 @using Dynamicweb.Rapido.Blocks.Extensibility 4845 @using Dynamicweb.Rapido.Blocks 4846 4847 @helper RenderColorSchemaInHeader() 4848 { 4849 <div class="color-scheme"> 4850 <span class="scheme first"></span> 4851 <span class="scheme second"></span> 4852 <span class="scheme third"></span> 4853 <span class="scheme fourth"></span> 4854 <span class="scheme fifth"></span> 4855 <span class="scheme sixth"></span> 4856 <span class="scheme seventh"></span> 4857 </div> 4858 } 4859 @helper CustomRenderSearch(string type = "mini-search") 4860 { 4861 string productsPageId = Converter.ToString(GetPageIdByNavigationTag("ProductsPage")); 4862 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 4863 string searchType = Model.Area.Item.GetItem("Layout").GetList("TopSearch") != null ? Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue : "productSearch"; 4864 4865 SearchConfiguration searchConfiguration = null; 4866 4867 bool hideSearchInProductsForAnonymousUsers = Pageview.AreaSettings.GetItem("Custom").GetItem("CustomSettings").GetBoolean("HideSearchInProductsForAnonymousUsers"); 4868 4869 if (hideSearchInProductsForAnonymousUsers && Model.CurrentUser.ID == 0) 4870 { 4871 searchConfiguration = new SearchConfiguration() 4872 { 4873 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true", 4874 resultPageLink = contentSearchPageLink, 4875 searchPlaceholder = Translate("Search page"), 4876 groupsFeedId = 0, 4877 searchType = "content-search", 4878 searchTemplate = "SearchPagesTemplate", 4879 showGroups = false 4880 }; 4881 } else 4882 { 4883 switch (searchType) 4884 { 4885 case "contentSearch": 4886 searchConfiguration = new SearchConfiguration() 4887 { 4888 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true", 4889 resultPageLink = contentSearchPageLink, 4890 searchPlaceholder = Translate("Search page"), 4891 groupsFeedId = 0, 4892 searchType = "content-search", 4893 searchTemplate = "SearchPagesTemplate", 4894 showGroups = false 4895 }; 4896 break; 4897 case "combinedSearch": 4898 searchConfiguration = new SearchConfiguration() 4899 { 4900 searchFeedId = productsPageId + "&feed=true", 4901 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true", 4902 resultPageLink = Converter.ToString(productsPageId), 4903 searchPlaceholder = Translate("Search products or pages"), 4904 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"), 4905 searchType = "combined-search", 4906 searchTemplate = "SearchProductsTemplateWrap", 4907 searchContentTemplate = "SearchPagesTemplateWrap", 4908 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector") 4909 }; 4910 break; 4911 default: //productSearch 4912 searchConfiguration = new SearchConfiguration() 4913 { 4914 resultPageLink = Converter.ToString(productsPageId), 4915 searchFeedId = productsPageId + "&feed=true", 4916 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"), 4917 searchPlaceholder = Translate("Search products"), 4918 searchTemplate = "SearchProductsTemplate", 4919 searchType = "product-search", 4920 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector") 4921 }; 4922 break; 4923 } 4924 } 4925 4926 searchConfiguration.searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; 4927 4928 if (type == "mini-search") 4929 { 4930 @RenderMiniSearch(searchConfiguration) 4931 } 4932 else 4933 { 4934 @RenderSearchBar(searchConfiguration) 4935 } 4936 }</text> 4937 } 4938 4939 4940 @helper RenderDesktopTools() 4941 { 4942 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopTools").OrderBy(item => item.SortId).ToList(); 4943 4944 <div class="tools-navigation dw-mod"> 4945 <div class="center-container grid top-container__center-container dw-mod"> 4946 @RenderBlockList(subBlocks) 4947 </div> 4948 </div> 4949 } 4950 4951 @helper RenderDesktopToolsText() 4952 { 4953 string toolsText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("ToolsText"); 4954 if (!string.IsNullOrEmpty(toolsText)) 4955 { 4956 <div class="u-margin-top u-margin-bottom">@toolsText</div> 4957 } 4958 } 4959 4960 @helper RenderDesktopToolsNavigation() 4961 { 4962 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 4963 4964 if (renderPagesInToolBar) 4965 { 4966 @RenderNavigation(new 4967 { 4968 id = "topToolsNavigation", 4969 cssclass = "menu menu-tools dw-mod dwnavigation", 4970 template = "TopMenu.xslt" 4971 }) 4972 } 4973 } 4974 4975 @helper RenderDesktopNavigation() 4976 { 4977 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopNavigation").OrderBy(item => item.SortId).ToList(); 4978 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4979 string alignClass = topLayout == "two-lines-centered" ? "grid--justify-center" : ""; 4980 <nav class="main-navigation dw-mod"> 4981 <div class="center-container top-container__center-container grid @alignClass dw-mod"> 4982 @RenderBlockList(subBlocks) 4983 </div> 4984 </nav> 4985 } 4986 4987 @helper RenderDesktopExtra() 4988 { 4989 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopExtra").OrderBy(item => item.SortId).ToList(); 4990 4991 if (subBlocks.Count > 0) 4992 { 4993 <div class="header header-top dw-mod"> 4994 <div class="center-container top-container__center-container grid--justify-space-between grid grid--align-center dw-mod"> 4995 @RenderBlockList(subBlocks) 4996 </div> 4997 </div> 4998 } 4999 }</text> 5000 } 5001 5002 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5003 5004 @using System 5005 @using System.Web 5006 @using Dynamicweb.Rapido.Blocks.Extensibility 5007 @using Dynamicweb.Rapido.Blocks 5008 5009 @{ 5010 Block impersonationBar = new Block 5011 { 5012 Id = "ImpersonationBar", 5013 SortId = 50, 5014 Template = RenderImpersonationBar(), 5015 Design = new Design 5016 { 5017 Size = "auto-width", 5018 HidePadding = true, 5019 RenderType = RenderType.Column 5020 } 5021 }; 5022 5023 if (Model.CurrentUser.ID > 0 && Model.SecondaryUsers.Count > 0) 5024 { 5025 BlocksPage.GetBlockPage("Master").Add("MasterHeader", impersonationBar); 5026 } 5027 } 5028 5029 @helper RenderImpersonationBar() 5030 { 5031 int impersonationPageId = GetPageIdByNavigationTag("Impersonation"); 5032 5033 <div class="u-color-warning--bg"> 5034 <div class="center-container top-container__center-container dw-mod"> 5035 @*Impersonation*@ 5036 <div class="grid"> 5037 <div class="grid--align-self-center grid__col-x"> 5038 @if (Model.CurrentSecondaryUser != null && Model.CurrentSecondaryUser.ID > 0) 5039 { 5040 string stopImpersonateTranslation = Translate("Stop impersonation"); 5041 string username = ""; 5042 if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.FirstName) && !string.IsNullOrEmpty(Model.CurrentSecondaryUser.LastName)) 5043 { 5044 username = Model.CurrentSecondaryUser.FirstName + " " + Model.CurrentSecondaryUser.LastName; 5045 } 5046 else if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.Name)) 5047 { 5048 username = Model.CurrentSecondaryUser.Name; 5049 } 5050 else if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.Email)) 5051 { 5052 username = Model.CurrentSecondaryUser.Email; 5053 } 5054 else 5055 { 5056 username = Model.CurrentSecondaryUser.UserName; 5057 } 5058 <div class="grid-cell"> 5059 <div class="u-pull--left u-bold u-margin-top"> 5060 <i class="fas fa-user-secret"></i> 5061 @Pageview.User.UserName<text>&nbsp;</text>@Translate("is impersonating")<text>&nbsp;</text>@username 5062 </div> 5063 <form method="post" class="u-pull--right u-no-margin"> 5064 <input type="submit" class="btn btn--secondary dw-mod u-no-margin" name="DwExtranetRemoveSecondaryUser" value="@stopImpersonateTranslation"> 5065 </form> 5066 </div> 5067 } 5068 else 5069 { 5070 string viewListTranslation = Translate("View the list of users you can impersonate"); 5071 <div class="grid-cell u-bold"> 5072 <i class="fas fa-user-secret"></i> 5073 <a href="/Default.aspx?ID=@impersonationPageId" title="@viewListTranslation" class="u-color-font-black">@viewListTranslation</a> 5074 </div> 5075 } 5076 </div> 5077 </div> 5078 </div> 5079 </div> 5080 } 5081 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5082 5083 @using System 5084 @using System.Web 5085 @using System.Collections.Generic 5086 @using Dynamicweb.Rapido.Blocks.Extensibility 5087 @using Dynamicweb.Rapido.Blocks 5088 5089 @{ 5090 BlocksPage miniCartBlocksPage = BlocksPage.GetBlockPage("Master"); 5091 string orderlinesView = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView").SelectedValue : "table"; 5092 5093 Block orderLines = new Block 5094 { 5095 Id = "MiniCartOrderLines", 5096 SkipRenderBlocksList = true, 5097 BlocksList = new List<Block> 5098 { 5099 new Block { 5100 Id = "MiniCartOrderLinesList", 5101 SortId = 20, 5102 Template = RenderMiniCartOrderLinesList() 5103 } 5104 } 5105 }; 5106 5107 Block orderlinesScriptTemplates = new Block 5108 { 5109 Id = "OrderlinesScriptTemplates" 5110 }; 5111 5112 if (orderlinesView == "table") 5113 { 5114 orderLines.Template = RenderMiniCartOrderLinesTable(); 5115 orderLines.BlocksList.Add( 5116 new Block { 5117 Id = "MiniCartOrderlinesTableHeader", 5118 SortId = 10, 5119 Template = RenderMiniCartOrderLinesHeader() 5120 } 5121 ); 5122 5123 orderlinesScriptTemplates.Template = RenderMiniCartScriptsTableTemplates(); 5124 } 5125 else 5126 { 5127 orderLines.Template = RenderMiniCartOrderLinesBlocks(); 5128 orderlinesScriptTemplates.Template = RenderMiniCartScriptsListTemplates(); 5129 } 5130 5131 miniCartBlocksPage.Add("MasterBottomSnippets", orderlinesScriptTemplates); 5132 5133 Block miniCartScriptTemplates = new Block() 5134 { 5135 Id = "MasterMiniCartTemplates", 5136 SortId = 1, 5137 Template = RenderMiniCartScriptTemplates(), 5138 SkipRenderBlocksList = true, 5139 BlocksList = new List<Block> 5140 { 5141 orderLines, 5142 new Block { 5143 Id = "MiniCartFooter", 5144 Template = RenderMiniCartFooter(), 5145 SortId = 50, 5146 SkipRenderBlocksList = true, 5147 BlocksList = new List<Block> 5148 { 5149 new Block { 5150 Id = "MiniCartFees", 5151 Template = RenderMiniCartFees(), 5152 SortId = 30 5153 }, 5154 new Block { 5155 Id = "MiniCartPoints", 5156 Template = RenderMiniCartPoints(), 5157 SortId = 40 5158 }, 5159 new Block { 5160 Id = "MiniCartTotal", 5161 Template = RenderMiniCartTotal(), 5162 SortId = 50 5163 }, 5164 new Block { 5165 Id = "MiniCartActions", 5166 Template = RenderMiniCartActions(), 5167 SortId = 60 5168 } 5169 } 5170 } 5171 } 5172 }; 5173 5174 miniCartBlocksPage.Add("MasterBottomSnippets", miniCartScriptTemplates); 5175 } 5176 5177 @helper RenderMiniCartScriptsTableTemplates() 5178 { 5179 <script id="MiniCartOrderline" type="text/x-template"> 5180 {{#unless isEmpty}} 5181 <tr> 5182 <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> 5183 <td class="u-va-middle"> 5184 <a href="{{link}}" class="mini-cart-orderline__name" title="{{name}}">{{name}}</a> 5185 {{#if variantname}} 5186 <a href="{{link}}" class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{variantname}}</a> 5187 {{/if}} 5188 {{#if unitname}} 5189 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{unitname}}</div> 5190 {{/if}} 5191 </td> 5192 <td class="u-ta-right u-va-middle">{{quantity}}</td> 5193 <td class="u-ta-right u-va-middle"> 5194 {{#if pointsTotal}} 5195 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 5196 {{else}} 5197 {{totalprice}} 5198 {{/if}} 5199 </td> 5200 </tr> 5201 {{/unless}} 5202 </script> 5203 5204 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 5205 {{#unless isEmpty}} 5206 <tr class="table__row--no-border"> 5207 <td class="u-w60px">&nbsp;</td> 5208 <td><div class="mini-cart-orderline__name dw-mod">{{name}}</div></td> 5209 <td class="u-ta-right">&nbsp;</td> 5210 <td class="u-ta-right">{{totalprice}}</td> 5211 </tr> 5212 {{/unless}} 5213 </script> 5214 } 5215 5216 @helper RenderMiniCartScriptsListTemplates() 5217 { 5218 int cartOrderlinesFeedPageId = GetPageIdByNavigationTag("CartOrderlinesFeed"); 5219 <script id="MiniCartOrderline" type="text/x-template"> 5220 {{#unless isEmpty}} 5221 <div class="mini-cart-orderline grid dw-mod"> 5222 <div class="grid__col-4"> 5223 <a href="{{link}}" class="{{hideimage}}"> 5224 <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}}"> 5225 </a> 5226 </div> 5227 <div class="grid__col-8"> 5228 <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> 5229 {{#if variantname}} 5230 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Variant"): {{variantname}}</div> 5231 {{/if}} 5232 {{#if unitname}} 5233 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Unit"): {{unitname}}</div> 5234 {{/if}} 5235 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Qty"): {{quantity}}</div> 5236 5237 <div class="grid__cell-footer"> 5238 <div class="grid__cell"> 5239 <div class="u-pull--left mini-cart-orderline__price dw-mod"> 5240 {{#if pointsTotal}} 5241 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 5242 {{else}} 5243 {{totalprice}} 5244 {{/if}} 5245 </div> 5246 <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> 5247 </div> 5248 </div> 5249 </div> 5250 </div> 5251 {{/unless}} 5252 </script> 5253 5254 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 5255 {{#unless isEmpty}} 5256 <div class="mini-cart-orderline mini-cart-orderline--discount grid dw-mod"> 5257 <div class="grid__col-4"> 5258 <div class="mini-cart-orderline__name mini-cart-orderline__name dw-mod">{{name}}</div> 5259 </div> 5260 <div class="grid__col-8">{{totalprice}}</div> 5261 </div> 5262 {{/unless}} 5263 </script> 5264 } 5265 5266 @helper RenderMiniCartScriptTemplates() 5267 { 5268 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMiniCartTemplates").OrderBy(item => item.SortId).ToList(); 5269 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 5270 string cartPageLink = string.Concat("/Default.aspx?ID=", GetPageIdByNavigationTag("CartPage")); 5271 5272 <script id="MiniCartContent" type="text/x-template"> 5273 {{#.}} 5274 {{#unless isEmpty}} 5275 @if (useGoogleTagManager) 5276 { 5277 <text>{{{googleEnchantImpressionEmptyCart OrderLines}}}</text> 5278 } 5279 @RenderBlockList(subBlocks) 5280 {{/unless}} 5281 {{#if isEmpty}} 5282 {{{locationReload '@cartPageLink'}}} 5283 {{/if}} 5284 {{/.}} 5285 </script> 5286 } 5287 5288 @helper RenderMiniCartOrderLinesTable() 5289 { 5290 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList(); 5291 5292 <div class="u-overflow-auto"> 5293 <table class="table mini-cart-table dw-mod"> 5294 @RenderBlockList(subBlocks) 5295 </table> 5296 </div> 5297 } 5298 5299 @helper RenderMiniCartOrderLinesBlocks() 5300 { 5301 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList(); 5302 5303 <div class="u-overflow-auto"> 5304 @RenderBlockList(subBlocks) 5305 </div> 5306 } 5307 5308 @helper RenderMiniCartOrderLinesHeader() 5309 { 5310 <thead> 5311 <tr> 5312 <td>&nbsp;</td> 5313 <td>@Translate("Product")</td> 5314 <td class="u-ta-right">@Translate("Qty")</td> 5315 <td class="u-ta-right" width="120">@Translate("Price")</td> 5316 </tr> 5317 </thead> 5318 } 5319 5320 @helper RenderMiniCartOrderLinesList() 5321 { 5322 <text> 5323 {{#OrderLines}} 5324 {{#ifCond template "===" "CartOrderline"}} 5325 {{>MiniCartOrderline}} 5326 {{/ifCond}} 5327 {{#ifCond template "===" "CartOrderlineMobile"}} 5328 {{>MiniCartOrderline}} 5329 {{/ifCond}} 5330 {{#ifCond template "===" "CartOrderlineDiscount"}} 5331 {{>MiniCartOrderlineDiscount}} 5332 {{/ifCond}} 5333 {{/OrderLines}} 5334 </text> 5335 } 5336 5337 @helper RenderMiniCartFees() 5338 { 5339 <div class="grid u-border-top grid--external-bleed-bottom"> 5340 <div class="grid__col-6"> 5341 {{paymentmethod}} 5342 </div> 5343 <div class="grid__col-6 grid--align-end">{{paymentfee}}</div> 5344 </div> 5345 <div class="grid grid--external-bleed-bottom"> 5346 <div class="grid__col-6"> 5347 {{shippingmethod}} 5348 </div> 5349 <div class="grid__col-6 grid--align-end">{{shippingfee}}</div> 5350 </div> 5351 } 5352 5353 @helper RenderMiniCartFooter() 5354 { 5355 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartFooter").OrderBy(item => item.SortId).ToList(); 5356 5357 <div class="mini-cart__footer dw-mod"> 5358 @RenderBlockList(subBlocks) 5359 </div> 5360 } 5361 5362 @helper RenderMiniCartActions() 5363 { 5364 int cartPageId = GetPageIdByNavigationTag("CartPage"); 5365 5366 <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> 5367 <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> 5368 } 5369 5370 @helper RenderMiniCartPoints() 5371 { 5372 <text> 5373 {{#if earnings}} 5374 <div class="grid grid--external-bleed-bottom"> 5375 <div class="grid__col-6">@Translate("Earnings")</div> 5376 <div class="grid__col-6 grid--align-end"> 5377 <div> 5378 <span class="u-color--loyalty-points">{{earnings}}</span> @Translate("points") 5379 </div> 5380 </div> 5381 </div> 5382 {{/if}} 5383 </text> 5384 } 5385 5386 @helper RenderMiniCartTotal() 5387 { 5388 <div class="mini-cart-totals grid u-margin-bottom dw-mod"> 5389 <div class="grid__col-6">@Translate("Total")</div> 5390 <div class="grid__col-6 grid--align-end">{{totalprice}}</div> 5391 </div> 5392 } 5393 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5394 5395 @using Dynamicweb.Rapido.Blocks.Extensibility 5396 @using Dynamicweb.Rapido.Blocks 5397 5398 @{ 5399 bool addToCartNotificationOnlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 5400 string addToCartNotificationType = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType").SelectedValue : ""; 5401 5402 if (!addToCartNotificationOnlyPreview && !string.IsNullOrEmpty(addToCartNotificationType)) { 5403 if (addToCartNotificationType == "modal") 5404 { 5405 Block addToCartNotificationModal = new Block 5406 { 5407 Id = "AddToCartNotificationModal", 5408 Template = RenderAddToCartNotificationModal() 5409 }; 5410 5411 Block addToCartNotificationScript = new Block 5412 { 5413 Id = "AddToCartNotificationScript", 5414 Template = RenderAddToCartNotificationModalScript() 5415 }; 5416 BlocksPage.GetBlockPage("Master").Add("MasterTopSnippets", addToCartNotificationModal); 5417 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript); 5418 } 5419 else if (addToCartNotificationType == "toggle") 5420 { 5421 Block addToCartNotificationScript = new Block 5422 { 5423 Id = "AddToCartNotificationScript", 5424 Template = RenderAddToCartNotificationToggleScript() 5425 }; 5426 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript); 5427 } 5428 } 5429 } 5430 5431 @helper RenderAddToCartNotificationModal() 5432 { 5433 <div id="LastAddedProductModal" data-template="LastAddedProductTemplate"></div> 5434 } 5435 5436 @helper RenderAddToCartNotificationModalScript() 5437 { 5438 int cartPageId = GetPageIdByNavigationTag("CartPage"); 5439 5440 <script id="LastAddedProductTemplate" type="text/x-template"> 5441 <!-- Trigger for the login modal --> 5442 <input type="checkbox" id="LastAddedProductModalTrigger" class="modal-trigger" /> 5443 5444 <!-- Login modal --> 5445 <div class="modal-container"> 5446 <label for="LastAddedProductModalTrigger" class="modal-overlay"></label> 5447 <div class="modal modal--md"> 5448 <div class="modal__header"> 5449 <h2>@Translate("Product is added to the cart")</h2> 5450 </div> 5451 <div class="modal__body"> 5452 <div class="grid"> 5453 <div class="grid__col-2"> 5454 <a href="{{productInfo.link}}"> 5455 <img src="{{productInfo.image}}" alt="{{productInfo.name}}" class="dw-mod" /> 5456 </a> 5457 </div> 5458 <div class="u-padding grid--align-self-center"> 5459 <span>{{quantity}}</span> x 5460 </div> 5461 <div class="grid__col-auto grid--align-self-center"> 5462 <div>{{productInfo.name}}</div> 5463 {{#if productInfo.variantName}} 5464 <small class="u-margin-bottom-5px">{{productInfo.variantName}}</small> 5465 {{/if}} 5466 {{#if productInfo.unitName}} 5467 <small class="u-margin-bottom-5px">{{productInfo.unitName}}</small> 5468 {{/if}} 5469 </div> 5470 </div> 5471 <div class="modal__footer u-margin-top--lg"> 5472 <label class="btn btn--secondary u-pull--left u-no-margin dw-mod btn--sm" for="LastAddedProductModalTrigger">@Translate("Continue shopping")</label> 5473 <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> 5474 </div> 5475 </div> 5476 <label class="modal__close-btn" for="LastAddedProductModalTrigger"></label> 5477 </div> 5478 </div> 5479 </script> 5480 <script> 5481 document.addEventListener('addToCart', function (event) { 5482 Cart.ShowLastAddedProductModal(event.detail); 5483 }); 5484 </script> 5485 } 5486 5487 @helper RenderAddToCartNotificationToggleScript() 5488 { 5489 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 5490 5491 <script> 5492 document.addEventListener('addToCart', function () { 5493 Cart.ToggleMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '@miniCartFeedPageId'); 5494 }); 5495 </script> 5496 } 5497 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5498 5499 @using System 5500 @using System.Web 5501 @using System.Collections.Generic 5502 @using Dynamicweb.Rapido.Blocks.Extensibility 5503 @using Dynamicweb.Rapido.Blocks 5504 5505 @functions { 5506 BlocksPage footerBlocksPage = BlocksPage.GetBlockPage("Master"); 5507 } 5508 5509 @{ 5510 string footerColumnOneContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Content"); 5511 string footerColumnTwoContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Content"); 5512 string footerColumnThreeContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Content"); 5513 string footerColumnOneHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Header"); 5514 string footerColumnTwoHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Header"); 5515 string footerColumnThreeHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Header"); 5516 5517 Block masterFooterContent = new Block() 5518 { 5519 Id = "MasterFooterContent", 5520 SortId = 10, 5521 Template = RenderFooter(), 5522 SkipRenderBlocksList = true 5523 }; 5524 footerBlocksPage.Add(MasterBlockId.MasterFooter, masterFooterContent); 5525 5526 if (!string.IsNullOrEmpty(footerColumnOneContent) || !string.IsNullOrEmpty(footerColumnOneHeader)) 5527 { 5528 Block masterFooterColumnOne = new Block 5529 { 5530 Id = "MasterFooterColumnOne", 5531 SortId = 10, 5532 Template = RenderFooterColumn(footerColumnOneHeader, footerColumnOneContent), 5533 Design = new Design { 5534 Size = "auto", 5535 RenderType = RenderType.Column 5536 } 5537 }; 5538 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnOne); 5539 } 5540 5541 if (!string.IsNullOrEmpty(footerColumnTwoContent) || !string.IsNullOrEmpty(footerColumnTwoHeader)) 5542 { 5543 Block masterFooterColumnTwo = new Block 5544 { 5545 Id = "MasterFooterColumnTwo", 5546 SortId = 20, 5547 Template = RenderFooterColumn(footerColumnTwoHeader, footerColumnTwoContent), 5548 Design = new Design 5549 { 5550 Size = "auto", 5551 RenderType = RenderType.Column 5552 } 5553 }; 5554 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnTwo); 5555 } 5556 5557 if (!string.IsNullOrEmpty(footerColumnThreeContent) || !string.IsNullOrEmpty(footerColumnThreeHeader)) 5558 { 5559 Block masterFooterColumnThree = new Block 5560 { 5561 Id = "MasterFooterColumnThree", 5562 SortId = 30, 5563 Template = RenderFooterColumn(footerColumnThreeHeader, footerColumnThreeContent), 5564 Design = new Design 5565 { 5566 Size = "auto", 5567 RenderType = RenderType.Column 5568 } 5569 }; 5570 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnThree); 5571 } 5572 5573 if (Model.Area.Item.GetItem("Layout").GetBoolean("FooterNewsletterSignUp")) 5574 { 5575 Block masterFooterNewsletterSignUp = new Block 5576 { 5577 Id = "MasterFooterNewsletterSignUp", 5578 SortId = 40, 5579 Template = RenderFooterNewsletterSignUp(), 5580 Design = new Design 5581 { 5582 Size = "auto", 5583 RenderType = RenderType.Column 5584 } 5585 }; 5586 footerBlocksPage.Add("MasterFooterContent", masterFooterNewsletterSignUp); 5587 } 5588 5589 if (Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks").Count > 0) 5590 { 5591 Block masterFooterSocialLinks = new Block 5592 { 5593 Id = "MasterFooterSocialLinks", 5594 SortId = 50, 5595 Template = RenderFooterSocialLinks(), 5596 Design = new Design 5597 { 5598 Size = "auto", 5599 RenderType = RenderType.Column 5600 } 5601 }; 5602 footerBlocksPage.Add("MasterFooterContent", masterFooterSocialLinks); 5603 } 5604 5605 if (Model.Area.Item.GetItem("Layout").GetItems("FooterPayments") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterPayments").Count > 0) 5606 { 5607 Block masterFooterPayments = new Block 5608 { 5609 Id = "MasterFooterPayments", 5610 SortId = 60, 5611 Template = RenderFooterPayments(), 5612 Design = new Design 5613 { 5614 Size = "12", 5615 RenderType = RenderType.Column 5616 } 5617 }; 5618 footerBlocksPage.Add("MasterFooterContent", masterFooterPayments); 5619 } 5620 5621 Block masterFooterCopyright = new Block 5622 { 5623 Id = "MasterFooterCopyright", 5624 SortId = 70, 5625 Template = RenderFooterCopyright(), 5626 Design = new Design 5627 { 5628 Size = "12", 5629 RenderType = RenderType.Column 5630 } 5631 }; 5632 footerBlocksPage.Add("MasterFooterContent", masterFooterCopyright); 5633 } 5634 5635 @helper RenderFooter() { 5636 List<Block> subBlocks = this.footerBlocksPage.GetBlockListById("MasterFooterContent").OrderBy(item => item.SortId).ToList(); 5637 5638 <footer class="footer dw-mod"> 5639 <div class="center-container top-container__center-container dw-mod"> 5640 <div class="grid grid--external-bleed-x"> 5641 @RenderBlockList(subBlocks) 5642 </div> 5643 </div> 5644 </footer> 5645 } 5646 5647 @helper RenderFooterColumn(string header, string content) { 5648 <h3 class="footer__heading dw-mod">@header</h3> 5649 <div class="footer__content dw-mod"> 5650 @content 5651 </div> 5652 } 5653 5654 @helper RenderFooterNewsletterSignUp() { 5655 string newsletterSignUpPageId = GetPageIdByNavigationTag("NewsletterSignUp").ToString(); 5656 5657 <h3 class="footer__heading dw-mod">@Translate("Mailing list")</h3> 5658 <div class="footer__content dw-mod"> 5659 <form class="form dw-mod" name="NewsletterRedirect" action='/Default.aspx' method="get" enctype="multipart/form-data"> 5660 <input name="ID" value="@newsletterSignUpPageId" type="hidden" /> 5661 <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> 5662 <div class="form__field-combi"> 5663 <input name="NewsletterEmail" id="NewsletterEmail" type="text" placeholder='@Translate("Your email address", "Your email address")' class="u-full-width use-btn-primary-height" /> 5664 <input class="btn btn--primary btn--condensed dw-mod" type="submit" id="Submitter" value='@Translate("Go", "Go")' /> 5665 </div> 5666 </form> 5667 </div> 5668 } 5669 5670 @helper RenderFooterSocialLinks() { 5671 <h3 class="footer__heading dw-mod">@Translate("Social links")</h3> 5672 <div class="footer__content dw-mod"> 5673 <div class="collection dw-mod"> 5674 @foreach (var socialitem in Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks")) 5675 { 5676 var socialIcon = socialitem.GetValue("Icon") as Dynamicweb.Frontend.ListViewModel; 5677 string socialIconClass = socialIcon.SelectedValue; 5678 string socialIconTitle = socialIcon.SelectedName; 5679 string socialLink = socialitem.GetString("Link"); 5680 5681 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px" rel="noopener"><i class="@socialIconClass fa-2x"></i></a> 5682 } 5683 </div> 5684 </div> 5685 } 5686 5687 @helper RenderFooterPayments() { 5688 <div class="footer__content dw-mod"> 5689 <div class="collection dw-mod"> 5690 @foreach (var payment in Model.Area.Item.GetItem("Layout").GetItems("FooterPayments")) 5691 { 5692 var paymentItem = payment.GetValue("CardTypeOrVerifiedPayment") as Dynamicweb.Frontend.ListViewModel; 5693 string paymentImage = null; 5694 string paymentTitle = paymentItem.SelectedName; 5695 ListOptionViewModel selected = paymentItem.SelectedOptions.FirstOrDefault(); 5696 if (selected != null) 5697 { 5698 paymentImage = selected.Icon; 5699 } 5700 5701 <div class="footer__card-type"> 5702 <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" /> 5703 </div> 5704 } 5705 </div> 5706 </div> 5707 } 5708 5709 @helper RenderFooterCopyright() { 5710 <div class="grid__col-12 footer__copyright dw-mod"> 5711 <p>@Model.Area.Item.GetItem("Layout").GetString("FooterCopyrightText")</p> 5712 </div> 5713 } 5714 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 5715 5716 @using System 5717 @using System.Web 5718 @using System.Collections.Generic 5719 @using Dynamicweb.Rapido.Blocks.Extensibility 5720 @using Dynamicweb.Rapido.Blocks 5721 @using Dynamicweb.Ecommerce.Common 5722 5723 @{ 5724 BlocksPage referencesBlocksPage = BlocksPage.GetBlockPage("Master"); 5725 5726 Block masterScriptReferences = new Block() 5727 { 5728 Id = "MasterScriptReferences", 5729 SortId = 1, 5730 Template = RenderMasterScriptReferences() 5731 }; 5732 referencesBlocksPage.Add(MasterBlockId.MasterReferences, masterScriptReferences); 5733 } 5734 5735 @helper RenderMasterScriptReferences() { 5736 <script src="/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js"></script> 5737 <script src="/Files/Templates/Designs/Rapido/js/master.min.js"></script> 5738 5739 if (Model.Area.Item.GetItem("Custom").GetBoolean("UseCustomJavascript")) 5740 { 5741 <script src="/Files/Templates/Designs/Rapido/js/custom.min.js"></script> 5742 PushPromise("/Files/Templates/Designs/Rapido/js/custom.min.js"); 5743 } 5744 5745 PushPromise("/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js"); 5746 PushPromise("/Files/Templates/Designs/Rapido/js/master.min.js"); 5747 } 5748 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5749 5750 @using System 5751 @using System.Web 5752 @using System.Collections.Generic 5753 @using Dynamicweb.Rapido.Blocks.Extensibility 5754 @using Dynamicweb.Rapido.Blocks 5755 5756 @{ 5757 BlocksPage searchBlocksPage = BlocksPage.GetBlockPage("Master"); 5758 bool navigationItemsHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 5759 5760 if (!navigationItemsHideSearch) 5761 { 5762 Block masterSearchScriptTemplates = new Block() 5763 { 5764 Id = "MasterSearchScriptTemplates", 5765 SortId = 1, 5766 Template = RenderSearchScriptTemplates() 5767 }; 5768 5769 searchBlocksPage.Add(MasterBlockId.MasterBottomSnippets, masterSearchScriptTemplates); 5770 } 5771 } 5772 5773 @helper RenderSearchScriptTemplates() 5774 { 5775 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 5776 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 5777 bool useFacebookPixel = !string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID")); 5778 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 5779 bool useGoogleTagManager = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID")); 5780 bool showPrice = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HidePriceInSearchResults"); 5781 bool showAddToCartButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideAddToCartButton"); 5782 bool showViewButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideViewButton"); 5783 bool showAddToDownloadButton = Pageview.AreaSettings.GetItem("Layout").GetBoolean("ShowAddToDownloadButton"); 5784 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 5785 5786 <script id="SearchGroupsTemplate" type="text/x-template"> 5787 {{#.}} 5788 <li class="dropdown__item dw-mod" onclick="Search.UpdateGroupSelection(this)" data-group-id="{{id}}">{{name}}</li> 5789 {{/.}} 5790 </script> 5791 5792 <script id="SearchProductsTemplate" type="text/x-template"> 5793 {{#each .}} 5794 {{#Product}} 5795 {{#ifCond template "!==" "SearchMore"}} 5796 <li class="dropdown__item dropdown__item--seperator dw-mod"> 5797 @if (useFacebookPixel) 5798 { 5799 <text>{{{facebookPixelSearch name number priceDouble currency searchParameter}}}</text> 5800 } 5801 @if (useGoogleTagManager) 5802 { 5803 <text>{{{googleEnchantImpression 'Search results' currency googleImpression}}}</text> 5804 } 5805 <div> 5806 <a href="{{link}}" class="js-typeahead-link u-color-inherit u-pull--left" onclick="{{googleImpressionClick}}" title="{{name}}"> 5807 <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> 5808 <div class="u-pull--left"> 5809 <div class="u-bold u-max-w220px u-truncate-text js-typeahead-name">{{name}}</div> 5810 @if (showPrice && !onlyPreview) 5811 { 5812 if (pointShopOnly) 5813 { 5814 <text> 5815 {{#if havePointPrice}} 5816 <div> 5817 <span class="u-color--loyalty-points">{{points}}</span> @Translate("points") 5818 </div> 5819 {{else}} 5820 <small class="help-text u-no-margin">@Translate("Not available")</small> 5821 {{/if}} 5822 {{#unless canBePurchasedWithPoints}} 5823 {{#if havePointPrice}} 5824 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small> 5825 {{/if}} 5826 {{/unless}} 5827 </text> 5828 } 5829 else 5830 { 5831 <div>{{price}}</div> 5832 } 5833 } 5834 </div> 5835 </a> 5836 <div class="u-margin-left u-pull--right"> 5837 @if (showAddToCartButton && !onlyPreview) { 5838 if (pointShopOnly) 5839 { 5840 <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" 5841 onclick="Cart.AddToCart(event, { 5842 id: '{{productId}}', 5843 quantity: 1, 5844 buyForPoints: true, 5845 productInfo: {{productInfo}} 5846 }); {{facebookPixelAction}}" {{disabledBuyButton}}> 5847 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue js-ignore-click-outside"></i> 5848 </button> 5849 } else { 5850 <button type="button" class="btn btn--primary btn--condensed btn--full u-no-margin dw-mod {{hideBuyOptions}} js-ignore-click-outside" 5851 onclick="Cart.AddToCart(event, { 5852 id: '{{productId}}', 5853 quantity: 1, 5854 productInfo: {{productInfo}} 5855 }); {{facebookPixelAction}}"> 5856 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue js-ignore-click-outside"></i> 5857 </button> 5858 } 5859 <a href="{{link}}" onclick="{{googleImpressionClick}}" class="btn btn--secondary btn--condensed btn--full u-no-margin dw-mod {{hideViewMore}} js-ignore-click-outside" title="@Translate("View")">@Translate("View")</a> 5860 } 5861 else if (showViewButton) 5862 { 5863 <a href="{{link}}" onclick="{{googleImpressionClick}}" class="btn btn--secondary btn--condensed btn--full u-no-margin dw-mod js-ignore-click-outside" title="@Translate("View")">@Translate("View")</a> 5864 } 5865 @if (showAddToDownloadButton) 5866 { 5867 <button type="button" class="btn btn--primary u-no-margin btn--condensed dw-mod js-add-to-downloads" title="@Translate("Add")" data-product-id="{{productId}}"> 5868 <i class="fas fa-plus js-button-icon"></i> 5869 </button> 5870 } 5871 </div> 5872 </div> 5873 </li> 5874 {{/ifCond}} 5875 {{#ifCond template "===" "SearchMore"}} 5876 {{>SearchMoreProducts}} 5877 {{/ifCond}} 5878 {{/Product}} 5879 {{else}} 5880 <li class="dropdown__item dropdown__item--seperator dw-mod"> 5881 @Translate("Your search gave 0 results") 5882 </li> 5883 {{/each}} 5884 </script> 5885 5886 <script id="SearchMoreProducts" type="text/x-template"> 5887 <li class="dropdown__item dropdown__item--not-selectable u-no-margin {{stickToBottom}} dw-mod"> 5888 <a href="/Default.aspx?ID=@productsPageId&Search={{searchParameter}}&GroupID={{groupId}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 5889 @Translate("View all") 5890 </a> 5891 </li> 5892 </script> 5893 5894 <script id="SearchMorePages" type="text/x-template"> 5895 <li class="dropdown__item dropdown__item--not-selectable u-no-margin {{stickToBottom}} dw-mod"> 5896 <a href="/Default.aspx?ID=@contentSearchPageLink&Search={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 5897 @Translate("View all") 5898 </a> 5899 </li> 5900 </script> 5901 5902 <script id="SearchPagesTemplate" type="text/x-template"> 5903 {{#each .}} 5904 {{#ifCond template "!==" "SearchMore"}} 5905 <li class="dropdown__item dropdown__item--seperator dw-mod"> 5906 <div> 5907 <a href="/Default.aspx?ID={{id}}" class="js-typeahead-link u-pull--left u-color-inherit"> 5908 <div class="u-margin-right u-pull--left"><i class="fa {{icon}} u-w20px u-ta-center"></i></div> 5909 <div class="u-pull--left"> 5910 <div class="u-bold u-truncate-text u-max-w220px js-typeahead-name">{{name}}</div> 5911 </div> 5912 </a> 5913 </div> 5914 </li> 5915 {{/ifCond}} 5916 {{#ifCond template "===" "SearchMore"}} 5917 {{>SearchMorePages}} 5918 {{/ifCond}} 5919 {{else}} 5920 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable dw-mod"> 5921 @Translate("Your search gave 0 results") 5922 </li> 5923 {{/each}} 5924 </script> 5925 5926 <script id="SearchPagesTemplateWrap" type="text/x-template"> 5927 <div class="dropdown__column-header">@Translate("Pages")</div> 5928 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom dw-mod"> 5929 {{>SearchPagesTemplate}} 5930 </ul> 5931 </script> 5932 5933 <script id="SearchProductsTemplateWrap" type="text/x-template"> 5934 <div class="dropdown__column-header">@Translate("Products")</div> 5935 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom dw-mod"> 5936 {{>SearchProductsTemplate}} 5937 </ul> 5938 </script> 5939 } 5940 5941 5942 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 5943 5944 @using System 5945 @using System.Web 5946 @using System.Collections.Generic 5947 @using Dynamicweb.Rapido.Blocks.Extensibility 5948 @using Dynamicweb.Rapido.Blocks 5949 5950 @{ 5951 BlocksPage bottomSnippetsBlocksPage = BlocksPage.GetBlockPage("Master"); 5952 5953 Block primaryBottomSnippets = new Block() 5954 { 5955 Id = "MasterJavascriptInitializers", 5956 SortId = 100, 5957 Template = RenderPrimaryBottomSnippets() 5958 }; 5959 bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, primaryBottomSnippets); 5960 } 5961 5962 @helper RenderPrimaryBottomSnippets() { 5963 bool isWireframeMode = Model.Area.Item.GetItem("Settings").GetBoolean("WireframeMode"); 5964 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 5965 5966 if (isWireframeMode) 5967 { 5968 <script> 5969 Wireframe.Init(true); 5970 </script> 5971 } 5972 5973 5974 if (useGoogleTagManager) 5975 { 5976 <script> 5977 document.addEventListener('addToCart', function(event) { 5978 var googleImpression = event.detail.productInfo.googleImpression; 5979 dataLayer.push({ 5980 'event': 'addToCart', 5981 'ecommerce': { 5982 'currencyCode': '@Dynamicweb.Ecommerce.Services.Currencies.GetDefaultCurrency().Code', 5983 'add': { 5984 'products': [{ 5985 'name': googleImpression.name, 5986 'id': googleImpression.id, 5987 'price': googleImpression.price, 5988 'brand': googleImpression.brand, 5989 'category': googleImpression.category, 5990 'variant': googleImpression.variant, 5991 'quantity': event.detail.quantity 5992 }] 5993 } 5994 } 5995 }); 5996 }); 5997 </script> 5998 } 5999 6000 //if digitalwarehouse 6001 if (Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart")) 6002 { 6003 string cartContextId = Converter.ToString(HttpContext.Current.Application["DownloadCartContext"]); 6004 6005 if (string.IsNullOrEmpty(cartContextId)) { 6006 var moduleProps = Dynamicweb.Modules.Properties.GetParagraphModuleSettings(GetPageIdByNavigationTag("DownloadCart"), "eCom_CartV2"); 6007 var cartSettings = new Dynamicweb.Ecommerce.Cart.ModuleSettings(moduleProps); 6008 cartContextId = cartSettings.OrderContextID; 6009 HttpContext.Current.Application["DownloadCartContext"] = cartContextId; 6010 } 6011 6012 <script> 6013 let downloadCart = new DownloadCart({ 6014 cartPageId: @GetPageIdByNavigationTag("MiniCartFeed"), 6015 contextId: "@cartContextId", 6016 addButtonText: "@Translate("Add")", 6017 removeButtonText: "@Translate("Remove")" 6018 }); 6019 </script> 6020 } 6021 6022 <!--@Javascripts--> 6023 } 6024 @if (File.Exists(HttpContext.Current.Server.MapPath("/Files/Templates/Designs/Rapido/MasterBlocks/Custom__Blocks.cshtml"))) 6025 { 6026 <text>@inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 6027 6028 @using System 6029 @using System.Web 6030 @using System.Collections.Generic 6031 @using Dynamicweb.Rapido.Blocks 6032 @using Dynamicweb.Rapido.Blocks.Extensibility 6033 6034 @{ 6035 BlocksPage masterCustomBlocksPage = BlocksPage.GetBlockPage("Master"); 6036 6037 bool navigationItemsSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 6038 6039 if (!navigationItemsSearch) 6040 { 6041 Block customMasterSearchScriptTemplates = new Block() 6042 { 6043 Id = "MasterSearchScriptTemplates", 6044 SortId = 1, 6045 Template = CustomRenderSearchScriptTemplates() 6046 }; 6047 6048 masterCustomBlocksPage.ReplaceBlock(customMasterSearchScriptTemplates); 6049 } 6050 6051 Block customLoginModal = new Block() 6052 { 6053 Id = "LoginModal", 6054 SortId = 10, 6055 Template = CustomLoginModal() 6056 }; 6057 6058 masterCustomBlocksPage.ReplaceBlock(customLoginModal); 6059 6060 Block customMobileNavigationMenu = new Block 6061 { 6062 Id = "MobileNavigationMenu", 6063 SortId = 20, 6064 Template = CustomRenderMobileNavigationMenu() 6065 }; 6066 6067 masterCustomBlocksPage.ReplaceBlock(customMobileNavigationMenu); 6068 6069 Block minicartscriptcustom = masterCustomBlocksPage.GetBlockById("MiniCartFees"); 6070 minicartscriptcustom.Template = CustomRenderMiniCartFees(); 6071 masterCustomBlocksPage.ReplaceBlock(minicartscriptcustom); 6072 } 6073 6074 @helper CustomRenderMiniCartFees() 6075 { 6076 <div class="grid u-border-top grid--external-bleed-bottom"> 6077 <div class="grid__col-6"> 6078 {{paymentmethod}} 6079 </div> 6080 <div class="grid__col-6 grid--align-end">{{paymentfee}}</div> 6081 </div> 6082 <div class="grid grid--external-bleed-bottom"> 6083 <div class="grid__col-6"> 6084 {{shippingmethod}} 6085 </div> 6086 <div class="grid__col-6 grid--align-end">{{shippingfee}}</div> 6087 </div> 6088 <div class="grid grid--external-bleed-bottom"> 6089 <div class="grid__col-6"> 6090 @Translate("VAT") 6091 </div> 6092 <div class="grid__col-6 grid--align-end">{{totalvat}}</div> 6093 </div> 6094 } 6095 6096 @helper CustomRenderMobileNavigationMenu() 6097 { 6098 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides"; 6099 string menuTemplate = isSlidesDesign ? "BaseMenuForMobileSlides.xslt" : "BaseMenuForMobileExpandableCustom.xslt"; 6100 string levels = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels") : "3"; 6101 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 6102 int startLevel = renderPagesInToolBar ? 1 : 0; 6103 6104 @RenderNavigation(new 6105 { 6106 id = "mobilenavigation", 6107 cssclass = "menu menu-mobile dwnavigation", 6108 startLevel = @startLevel, 6109 ecomStartLevel = @startLevel + 1, 6110 endlevel = @levels, 6111 expandmode = "all", 6112 template = @menuTemplate 6113 }) 6114 6115 if (isSlidesDesign) 6116 { 6117 <script> 6118 function goToLevel(level) { 6119 document.getElementById('mobileNavigationWrapper').style.left = -(level * 100) + "%"; 6120 } 6121 6122 document.addEventListener('DOMContentLoaded', function () { 6123 goToLevel(document.getElementById('mobileNavigationWrapper').querySelectorAll('input[type=radio]:checked').length); 6124 }); 6125 </script> 6126 } 6127 6128 if (renderPagesInToolBar) 6129 { 6130 @RenderNavigation(new 6131 { 6132 id = "topToolsMobileNavigation", 6133 cssclass = "menu menu-mobile dwnavigation", 6134 template = "ToolsMenuForMobile.xslt" 6135 }) 6136 } 6137 } 6138 6139 @helper CustomRenderSearchScriptTemplates() 6140 { 6141 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 6142 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 6143 bool useFacebookPixel = !string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID")); 6144 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 6145 bool useGoogleTagManager = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID")); 6146 bool showPrice = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HidePriceInSearchResults"); 6147 bool showAddToCartButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideAddToCartButton"); 6148 bool showViewButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideViewButton"); 6149 bool showAddToDownloadButton = Pageview.AreaSettings.GetItem("Layout").GetBoolean("ShowAddToDownloadButton"); 6150 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 6151 6152 <script id="SearchGroupsTemplate" type="text/x-template"> 6153 {{#.}} 6154 <li class="dropdown__item dw-mod" onclick="Search.UpdateGroupSelection(this)" data-group-id="{{id}}">{{name}}</li> 6155 {{/.}} 6156 </script> 6157 6158 <script id="SearchProductsTemplate" type="text/x-template"> 6159 {{#each .}} 6160 {{#Product}} 6161 {{#ifCond template "!==" "SearchMore"}} 6162 <li class="dropdown__item dropdown__item--seperator dw-mod"> 6163 @if (useFacebookPixel) 6164 { 6165 <text>{{{facebookPixelSearch name number priceDouble currency searchParameter}}}</text> 6166 } 6167 @if (useGoogleTagManager) 6168 { 6169 <text>{{{googleEnchantImpression 'Search results' currency googleImpression}}}</text> 6170 } 6171 <div> 6172 <a href="{{link}}" class="js-typeahead-link u-color-inherit u-pull--left" onclick="{{googleImpressionClick}}" title="{{name}}"> 6173 <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> 6174 <div class="u-pull--left"> 6175 <div class="u-bold u-max-w220px u-truncate-text js-typeahead-name">{{name}}</div> 6176 @if (showPrice && !onlyPreview) 6177 { 6178 if (pointShopOnly) 6179 { 6180 <text> 6181 {{#if havePointPrice}} 6182 <div> 6183 <span class="u-color--loyalty-points">{{points}}</span> @Translate("points") 6184 </div> 6185 {{else}} 6186 <small class="help-text u-no-margin">@Translate("Not available")</small> 6187 {{/if}} 6188 {{#unless canBePurchasedWithPoints}} 6189 {{#if havePointPrice}} 6190 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small> 6191 {{/if}} 6192 {{/unless}} 6193 </text> 6194 } 6195 else 6196 { 6197 <div>{{priceWithoutVAT}}</div> 6198 } 6199 } 6200 </div> 6201 </a> 6202 <div class="u-margin-left u-pull--right"> 6203 @if (showAddToCartButton && !onlyPreview) 6204 { 6205 if (pointShopOnly) 6206 { 6207 <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" 6208 onclick="Cart.AddToCart(event, { 6209 id: '{{productId}}', 6210 variantId: '{{variantid}}', 6211 unitId: '{{unitId}}', 6212 quantity: 1, 6213 buyForPoints: true, 6214 productInfo: {{productInfo}} 6215 }); {{facebookPixelAction}}" {{disabledBuyButton}}> 6216 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue js-ignore-click-outside"></i> 6217 </button> 6218 } 6219 else 6220 { 6221 <button type="button" class="btn btn--primary btn--condensed btn--full u-no-margin dw-mod {{hideBuyOptions}} js-ignore-click-outside" 6222 onclick="Cart.AddToCart(event, { 6223 id: '{{productId}}', 6224 variantId: '{{variantid}}', 6225 unitId: '{{unitId}}', 6226 quantity: 1, 6227 productInfo: {{productInfo}} 6228 }); {{facebookPixelAction}}"> 6229 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue js-ignore-click-outside"></i> 6230 </button> 6231 } 6232 <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> 6233 } 6234 else if (showViewButton) 6235 { 6236 <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> 6237 } 6238 @if (showAddToDownloadButton) 6239 { 6240 <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}}"> 6241 <i class="fas fa-plus js-button-icon"></i> 6242 </button> 6243 } 6244 </div> 6245 </div> 6246 </li> 6247 {{/ifCond}} 6248 {{#ifCond template "===" "SearchMore"}} 6249 {{>SearchMoreProducts}} 6250 {{/ifCond}} 6251 {{/Product}} 6252 {{else}} 6253 <li class="dropdown__item dropdown__item--seperator dw-mod"> 6254 @Translate("Your search gave 0 results") 6255 </li> 6256 {{/each}} 6257 </script> 6258 6259 <script id="SearchMoreProducts" type="text/x-template"> 6260 <li class="dropdown__item dropdown__item--not-selectable u-no-margin {{stickToBottom}} dw-mod"> 6261 <a href="/Default.aspx?ID=@productsPageId&Search={{searchParameter}}&GroupID={{groupId}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 6262 @Translate("View all") 6263 </a> 6264 </li> 6265 </script> 6266 6267 <script id="SearchMorePages" type="text/x-template"> 6268 <li class="dropdown__item dropdown__item--not-selectable u-no-margin {{stickToBottom}} dw-mod"> 6269 <a href="/Default.aspx?ID=@contentSearchPageLink&Search={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 6270 @Translate("View all") 6271 </a> 6272 </li> 6273 </script> 6274 6275 <script id="SearchPagesTemplate" type="text/x-template"> 6276 {{#each .}} 6277 {{#ifCond template "!==" "SearchMore"}} 6278 <li class="dropdown__item dropdown__item--seperator dw-mod"> 6279 <div> 6280 <a href="/Default.aspx?ID={{id}}" class="js-typeahead-link u-pull--left u-color-inherit"> 6281 <div class="u-margin-right u-pull--left"><i class="fa {{icon}} u-w20px u-ta-center"></i></div> 6282 <div class="u-pull--left"> 6283 <div class="u-bold u-truncate-text u-max-w220px js-typeahead-name">{{name}}</div> 6284 </div> 6285 </a> 6286 </div> 6287 </li> 6288 {{/ifCond}} 6289 {{#ifCond template "===" "SearchMore"}} 6290 {{>SearchMorePages}} 6291 {{/ifCond}} 6292 {{else}} 6293 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable dw-mod"> 6294 @Translate("Your search gave 0 results") 6295 </li> 6296 {{/each}} 6297 </script> 6298 6299 <script id="SearchPagesTemplateWrap" type="text/x-template"> 6300 <div class="dropdown__column-header">@Translate("Pages")</div> 6301 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom dw-mod"> 6302 {{>SearchPagesTemplate}} 6303 </ul> 6304 </script> 6305 6306 <script id="SearchProductsTemplateWrap" type="text/x-template"> 6307 <div class="dropdown__column-header">@Translate("Products")</div> 6308 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom dw-mod"> 6309 {{>SearchProductsTemplate}} 6310 </ul> 6311 </script> 6312 } 6313 6314 6315 @helper CustomLoginModal() 6316 { 6317 int pageId = Model.TopPage.ID; 6318 string userSignedInError = !Model.LogOnFailed ? "" : "checked"; 6319 string userSignedInErrorText = ""; 6320 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 6321 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; 6322 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 6323 var isSecondhand = Model.Area.Name.IndexOf("Second") >= 0 ? true : false; 6324 6325 6326 bool hideCreateUserLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); 6327 6328 if (Model.LogOnFailed) 6329 { 6330 switch (Model.LogOnFailedReason) 6331 { 6332 case LogOnFailedReason.PasswordLengthInvalid: 6333 userSignedInErrorText = Translate("Password length is invalid"); 6334 break; 6335 case LogOnFailedReason.IncorrectLogin: 6336 userSignedInErrorText = Translate("Invalid email or password"); 6337 break; 6338 case LogOnFailedReason.ExceededFailedLogOnLimit: 6339 userSignedInErrorText = Translate("You have exceeded the limit of allowed login attempts. The user account is temporarily locked"); 6340 break; 6341 case LogOnFailedReason.LoginLocked: 6342 userSignedInErrorText = Translate("The user account is temporarily locked"); 6343 break; 6344 case LogOnFailedReason.PasswordExpired: 6345 userSignedInErrorText = Translate("The password has expired and needs to be renewed"); 6346 break; 6347 default: 6348 userSignedInErrorText = Translate("An unknown error occured"); 6349 break; 6350 } 6351 } 6352 6353 <!-- Trigger for the login modal --> 6354 <input type="checkbox" id="SignInModalTrigger" class="modal-trigger" @userSignedInError /> 6355 6356 <!-- Login modal --> 6357 <div class="modal-container"> 6358 <label for="SignInModalTrigger" id="SignInModalOverlay" class="modal-overlay"></label> 6359 <div class="modal modal--xs" id="SignInModal"> 6360 <div class="modal__header"> 6361 <h2>@Translate("Sign in")</h2> 6362 </div> 6363 <div class="modal__body"> 6364 <form method="post" id="LoginForm" class="u-no-margin"> 6365 <input type="hidden" name="ID" value="@pageId" /> 6366 <input type="hidden" name="DWExtranetUsernameRemember" value="True" /> 6367 <input type="hidden" name="DWExtranetPasswordRemember" value="True" /> 6368 <input type="text" class="u-full-width" id="LoginUsername" name="username" placeholder="@Translate("Email")" /> 6369 <input type="password" class="u-full-width" id="LoginPassword" name="password" placeholder="@Translate("Password")" /> 6370 <div class="field-error dw-mod">@userSignedInErrorText</div> 6371 <div class="form__field-group dw-mod"> 6372 <input type="checkbox" id="LoginRememberMe" name="Autologin" checked="checked" value="True" class="form__control"> 6373 <label for="LoginRememberMe"> 6374 @Translate("Remember me", "Remember me") 6375 </label> 6376 </div> 6377 6378 <button type="submit" class="btn btn--primary btn--full dw-mod u-hidden login-btn" name="LoginAction" value="Login">@Translate("Sign in")</button> 6379 <button type="submit" class="btn btn--primary btn--full dw-mod fake-login-btn" name="LoginAction" value="Login">@Translate("Sign in")</button> 6380 @{ 6381 ProviderCollection providers = Provider.GetActiveProviders(); 6382 } 6383 6384 @foreach (Provider LoginProvider in providers) 6385 { 6386 var ProviderName = LoginProvider.Name.ToLower(); 6387 <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> 6388 } 6389 6390 <a class="btn btn--link-clean dw-mod" href="@forgotPasswordPageLink">@Translate("Forgot your password?", "Forgot your password?")</a> 6391 6392 @if (!hideCreateUserLink) 6393 { 6394 <a class="btn btn--link-clean dw-mod" href="/default.aspx?ID=@createAccountPageId">@Translate("Create account")?</a> 6395 } 6396 </form> 6397 </div> 6398 </div> 6399 </div> 6400 6401 if (!isSecondhand) 6402 { 6403 <script> 6404 var submitBtn = document.getElementsByClassName("fake-login-btn")[0]; 6405 var emailField = document.getElementById("LoginUsername"); 6406 var realSubmitBtn = document.getElementsByClassName("login-btn")[0]; 6407 var getUserInfoPageId = '@GetPageIdByNavigationTag("GetUserInfo")'; 6408 6409 submitBtn.addEventListener("click", function (e) { 6410 e.preventDefault(); 6411 AedApi.login(getUserInfoPageId, emailField, 'LoginForm', realSubmitBtn); 6412 }) 6413 6414 var loginForm = document.getElementById("LoginForm"); 6415 loginForm.addEventListener('keydown', function (e) { 6416 if (e.keyCode == "13") { 6417 e.preventDefault() 6418 AedApi.login(getUserInfoPageId, emailField, 'LoginForm', realSubmitBtn); 6419 } 6420 }); 6421 </script> 6422 } 6423 }</text> 6424 } 6425 6426 6427 @functions { 6428 public class ManifestIcon 6429 { 6430 public string src { get; set; } 6431 public string type { get; set; } 6432 public string sizes { get; set; } 6433 } 6434 6435 public class Manifest 6436 { 6437 public string name { get; set; } 6438 public string short_name { get; set; } 6439 public string start_url { get; set; } 6440 public string display { get; set; } 6441 public string background_color { get; set; } 6442 public string theme_color { get; set; } 6443 public List<ManifestIcon> icons { get; set; } 6444 } 6445 } 6446 @{ 6447 if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName")) && Model.Area.Item.GetItem("Settings").GetFile("AppIcon") != null) 6448 { 6449 Manifest manifest = new Manifest 6450 { 6451 name = Model.Area.Item.GetItem("Settings").GetString("AppName"), 6452 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"), 6453 start_url = "/", 6454 display = "standalone", 6455 background_color = Model.Area.Item.GetItem("Settings").GetString("AppBackgroundColor"), 6456 theme_color = Model.Area.Item.GetItem("Settings").GetString("AppThemeColor") 6457 }; 6458 6459 manifest.icons = new List<ManifestIcon> { 6460 new ManifestIcon { 6461 src = "/Admin/Public/GetImage.ashx?width=192&height=192&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 6462 sizes = "192x192", 6463 type = "image/png" 6464 }, 6465 new ManifestIcon { 6466 src = "/Admin/Public/GetImage.ashx?width=512&height=512&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 6467 sizes = "512x512", 6468 type = "image/png" 6469 }, 6470 new ManifestIcon { 6471 src = "/Admin/Public/GetImage.ashx?width=1024&height=1024&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 6472 sizes = "1024x1024", 6473 type = "image/png" 6474 } 6475 }; 6476 6477 string manifestFilePath = HttpContext.Current.Request.MapPath("/Files/Templates/Designs/Rapido/manifest.json"); 6478 string manifestJSON = Newtonsoft.Json.JsonConvert.SerializeObject(manifest); 6479 string currentManifest = File.ReadAllText(manifestFilePath); 6480 6481 if (manifestJSON != currentManifest) 6482 { 6483 File.WriteAllText(manifestFilePath, manifestJSON); 6484 } 6485 } 6486 } 6487 6488 @{ 6489 var swatches = new Dynamicweb.Content.Items.ColorSwatchService(); 6490 var brandColors = swatches.GetColorSwatch(1); 6491 string brandColorOne = brandColors.Palette["BrandColor1"]; 6492 } 6493 6494 <!DOCTYPE html> 6495 6496 <html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName"> 6497 <head> 6498 <!-- Rapido version 3.1 --> 6499 <meta charset="utf-8" /> 6500 <title>@Model.Title</title> 6501 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 6502 <meta name="robots" content="index, follow"> 6503 <meta name="theme-color" content="@brandColorOne" /> 6504 6505 @Model.MetaTags 6506 6507 <!-- Favicon --> 6508 <link href="@favicon" rel="icon" type="image/png"> 6509 6510 <!-- Base (Default, wireframe) styles --> 6511 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/base/base.min.css" type="text/css"> 6512 6513 <!-- Rapido Css from Website Settings --> 6514 <link rel="stylesheet" id="rapidoCss" href="@autoCssLink" type="text/css"> 6515 6516 <!-- Ignite Css (Custom site specific styles) --> 6517 <link rel="stylesheet" id="igniteCss" type="text/css" href="/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css"> 6518 6519 <!-- Font awesome --> 6520 <link rel="stylesheet" href="@fontAwesomeCssLink" type="text/css"> 6521 6522 <!-- Flag icon --> 6523 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css" type="text/css"> 6524 6525 <!-- Google fonts --> 6526 @{ 6527 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))); 6528 } 6529 <link href="https://fonts.googleapis.com/css?family=@family" rel="stylesheet"> 6530 @{ 6531 PushPromise(favicon); 6532 PushPromise(fontAwesomeCssLink); 6533 PushPromise("/Files/Templates/Designs/Rapido/css/base/base.min.css"); 6534 PushPromise(autoCssLink); 6535 PushPromise("/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css"); 6536 PushPromise("/Files/Images/placeholder.gif"); 6537 PushPromise("/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css"); 6538 } 6539 6540 @if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName"))) 6541 { 6542 <link rel="manifest" href="/Files/Templates/Designs/Rapido/manifest.json"> 6543 PushPromise("/Files/Templates/Designs/Rapido/manifest.json"); 6544 } 6545 </head> 6546 6547 <body> 6548 6549 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 6550 @RenderBlockList(masterPage.BlocksRoot.BlocksList) 6551 6552 6553 @helper RenderMasterHeader() 6554 { 6555 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterHeader").OrderBy(item => item.SortId).ToList(); 6556 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 6557 string stickyTop = isNavigationStickyMenu ? "top-container--sticky" : ""; 6558 6559 <header class="top-container @stickyTop dw-mod" id="Top"> 6560 @RenderBlockList(subBlocks) 6561 </header> 6562 } 6563 6564 @helper RenderMain() 6565 { 6566 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMain").OrderBy(item => item.SortId).ToList(); 6567 6568 <main class="site dw-mod"> 6569 @RenderBlockList(subBlocks) 6570 </main> 6571 } 6572 6573 @helper RenderPageContent() 6574 { 6575 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 6576 string pagePos = isNavigationStickyMenu ? "js-page-pos" : ""; 6577 6578 <div id="Page" class="page @pagePos"> 6579 <section class="center-container content-container dw-mod" id="content"> 6580 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 6581 6582 6583 @using Dynamicweb.Rapido.Blocks.Components 6584 @using Dynamicweb.Rapido.Blocks.Components.Articles 6585 @using Dynamicweb.Rapido.Blocks.Components.General 6586 @using Dynamicweb.Rapido.Blocks 6587 6588 @functions { 6589 BlocksPage articlePage = BlocksPage.GetBlockPage("NewsArticle"); 6590 } 6591 6592 @{ 6593 ArticleHeader topBanner = new ArticleHeader 6594 { 6595 Layout = ArticleHeaderLayout.Clean, 6596 Image = new Image { Path = Model.Item.GetFile("Image").PathUrlEncoded }, 6597 Heading = Model.Item.GetString("Title"), 6598 Subheading = Model.Item.GetString("Summary"), 6599 TextColor = "#fff", 6600 Category = Model.Item.GetString("Author"), 6601 Date = Model.Item.GetString("Date"), 6602 ButtonLayout = ButtonLayout.Primary, 6603 TextLayout = ArticleHeaderTextLayout.Full 6604 }; 6605 6606 Block articleContainer = new Block 6607 { 6608 Id = "ArticleContainer", 6609 SortId = 10, 6610 Design = new Design 6611 { 6612 RenderType = RenderType.Row 6613 }, 6614 BlocksList = new List<Block> { 6615 new Block { 6616 Id = "ArticleBody", 6617 SortId = 20, 6618 Design = new Design { 6619 RenderType = RenderType.Column, 6620 Size = "8" 6621 }, 6622 BlocksList = new List<Block> { 6623 new Block { 6624 Id = "ArticleBodyRow", 6625 SortId = 10, 6626 Design = new Design { 6627 RenderType = RenderType.Row 6628 }, 6629 BlocksList = new List<Block> { 6630 new Block { 6631 Id = "ArticleHeader", 6632 SortId = 10, 6633 Component = topBanner, 6634 Design = new Design { 6635 RenderType = RenderType.Column, 6636 Size = "12", 6637 HidePadding = true, 6638 CssClass = "article-head" 6639 } 6640 }, 6641 new Block { 6642 Id = "ArticleText", 6643 SortId = 20, 6644 Component = new ArticleText { Text = Model.Item.GetString("Text") }, 6645 Design = new Design { 6646 RenderType = RenderType.Column, 6647 Size = "12", 6648 CssClass = "u-padding--lg" 6649 } 6650 }, 6651 new Block { 6652 Id = "ArticleLink", 6653 SortId = 30, 6654 Component = new ArticleLink { Link = Model.Item.GetString("Link"), Title = Model.Item.GetString("LinkText"), ButtonLayout = ButtonLayout.Primary }, 6655 Design = new Design { 6656 RenderType = RenderType.Column, 6657 Size = "12", 6658 CssClass = "u-padding--lg u-ta-right" 6659 } 6660 } 6661 } 6662 } 6663 } 6664 } 6665 } 6666 }; 6667 articlePage.Add(articleContainer); 6668 6669 if (Model.PropertyItem.GetList("ShowBreadcrumb").SelectedValue == "True") 6670 { 6671 Block breadcrumb = new Block 6672 { 6673 Id = "ArticleBreadcrumb", 6674 SortId = 10, 6675 Component = new BreadcrumbNavigation { }, 6676 Design = new Design 6677 { 6678 RenderType = RenderType.Column, 6679 Size = "12" 6680 } 6681 }; 6682 articlePage.Add("ArticleContainer", breadcrumb); 6683 } 6684 } 6685 6686 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 6687 @RenderBlockList(articlePage.BlocksRoot.BlocksList) 6688 6689 </section> 6690 </div> 6691 } 6692 6693 </body> 6694 </html> 6695 6696