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