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_b56b18b67cb1472abb4ac89d8ab483fb.<RenderPageContent>b__157_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\ElbiElectric.cloud.dynamicweb-cms.com\files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 6615
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_b56b18b67cb1472abb4ac89d8ab483fb.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\ElbiElectric.cloud.dynamicweb-cms.com\files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 227
   at CompiledRazorTemplates.Dynamic.RazorEngine_b56b18b67cb1472abb4ac89d8ab483fb.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\ElbiElectric.cloud.dynamicweb-cms.com\files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 141
   at CompiledRazorTemplates.Dynamic.RazorEngine_b56b18b67cb1472abb4ac89d8ab483fb.<RenderMain>b__156_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\ElbiElectric.cloud.dynamicweb-cms.com\files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 6597
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_b56b18b67cb1472abb4ac89d8ab483fb.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\ElbiElectric.cloud.dynamicweb-cms.com\files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 227
   at CompiledRazorTemplates.Dynamic.RazorEngine_b56b18b67cb1472abb4ac89d8ab483fb.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\ElbiElectric.cloud.dynamicweb-cms.com\files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 141
   at CompiledRazorTemplates.Dynamic.RazorEngine_b56b18b67cb1472abb4ac89d8ab483fb.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\ElbiElectric.cloud.dynamicweb-cms.com\files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 249
   at CompiledRazorTemplates.Dynamic.RazorEngine_b56b18b67cb1472abb4ac89d8ab483fb.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\ElbiElectric.cloud.dynamicweb-cms.com\files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 141
   at CompiledRazorTemplates.Dynamic.RazorEngine_b56b18b67cb1472abb4ac89d8ab483fb.Execute() in D:\dynamicweb.net\Solutions\Dynamicweb\ElbiElectric.cloud.dynamicweb-cms.com\files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 6578
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

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