Error executing template "Designs/Rapido/_parsed/ContentPage.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at S_DW_Thermex.CustomCode.Seo.Canonical.Url(PageView pageView, String domain, String rawUrl)
   at CompiledRazorTemplates.Dynamic.RazorEngine_004ff596b1e444d594c3a5f266e48ba5.<RenderMasterMetadata>b__200_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\S_DW_Thermex\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 7941
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_004ff596b1e444d594c3a5f266e48ba5.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\S_DW_Thermex\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 255
   at CompiledRazorTemplates.Dynamic.RazorEngine_004ff596b1e444d594c3a5f266e48ba5.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\S_DW_Thermex\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 165
   at CompiledRazorTemplates.Dynamic.RazorEngine_004ff596b1e444d594c3a5f266e48ba5.<RenderMasterHead>b__199_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\S_DW_Thermex\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 7922
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_004ff596b1e444d594c3a5f266e48ba5.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\S_DW_Thermex\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 255
   at CompiledRazorTemplates.Dynamic.RazorEngine_004ff596b1e444d594c3a5f266e48ba5.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\S_DW_Thermex\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 165
   at CompiledRazorTemplates.Dynamic.RazorEngine_004ff596b1e444d594c3a5f266e48ba5.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\S_DW_Thermex\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 293
   at CompiledRazorTemplates.Dynamic.RazorEngine_004ff596b1e444d594c3a5f266e48ba5.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\S_DW_Thermex\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 165
   at CompiledRazorTemplates.Dynamic.RazorEngine_004ff596b1e444d594c3a5f266e48ba5.Execute() in D:\dynamicweb.net\Solutions\S_DW_Thermex\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 7911
   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 5 @using Dynamicweb.Frontend 6 @using Dynamicweb.Frontend.Devices 7 @using Dynamicweb.Extensibility 8 @using Dynamicweb.Content 9 @using Dynamicweb.Security 10 @using Dynamicweb.Core 11 @using System 12 @using System.Web 13 @using System.IO 14 @using Dynamicweb.Rapido.Blocks 15 @using System.Net 16 @using S_DW_Thermex.CustomCode.Seo 17 18 19 @functions { 20 BlocksPage masterPage = BlocksPage.GetBlockPage("Master"); 21 22 string getFontFamily(params string[] items) 23 { 24 var itemParent = Pageview.AreaSettings; 25 foreach (var item in items) 26 { 27 itemParent = itemParent.GetItem(item); 28 if (itemParent == null) 29 { 30 return null; 31 } 32 } 33 34 var googleFont = itemParent.GetGoogleFont("FontFamily"); 35 if (googleFont == null) 36 { 37 return null; 38 } 39 return googleFont.Family.Replace(" ", "+"); 40 } 41 } 42 43 @{ 44 Block root = new Block 45 { 46 Id = "Root", 47 SortId = 10, 48 BlocksList = new List<Block> 49 { 50 new Block { 51 Id = "Head", 52 SortId = 10, 53 SkipRenderBlocksList = true, 54 Template = RenderMasterHead(), 55 BlocksList = new List<Block> 56 { 57 new Block { 58 Id = "HeadMetadata", 59 SortId = 10, 60 Template = RenderMasterMetadata(), 61 }, 62 new Block { 63 Id = "HeadCss", 64 SortId = 20, 65 Template = RenderMasterCss(), 66 }, 67 new Block { 68 Id = "HeadManifest", 69 SortId = 30, 70 Template = RenderMasterManifest(), 71 } 72 } 73 }, 74 new Block { 75 Id = "Body", 76 SortId = 20, 77 SkipRenderBlocksList = true, 78 Template = RenderMasterBody(), 79 BlocksList = new List<Block> 80 { 81 new Block() 82 { 83 Id = "Master", 84 SortId = 10, 85 BlocksList = new List<Block> { 86 new Block { 87 Id = "MasterTopSnippets", 88 SortId = 10 89 }, 90 new Block { 91 Id = "MasterMain", 92 SortId = 20, 93 Template = RenderMain(), 94 SkipRenderBlocksList = true, 95 BlocksList = new List<Block> { 96 new Block { 97 Id = "MasterHeader", 98 SortId = 10, 99 Template = RenderMasterHeader(), 100 SkipRenderBlocksList = true 101 }, 102 new Block { 103 Id = "MasterPageContent", 104 SortId = 20, 105 Template = RenderPageContent() 106 } 107 } 108 }, 109 new Block { 110 Id = "MasterFooter", 111 SortId = 30 112 }, 113 new Block { 114 Id = "MasterReferences", 115 SortId = 40 116 }, 117 new Block { 118 Id = "MasterBottomSnippets", 119 SortId = 50, 120 BlocksList = new List<Block> { 121 new Block { 122 Id = "iOsTabletFix", 123 SortId = 10, 124 Template = RenderIosTabletFix() 125 } 126 } 127 } 128 } 129 } 130 } 131 } 132 } 133 }; 134 135 masterPage.Add(root); 136 } 137 138 @* Include the required Grid builder (Contains the methods @RenderBlockList and @RenderBlock) *@ 139 @using System.Text.RegularExpressions 140 @using System.Collections.Generic 141 @using System.Reflection 142 @using System.Web 143 @using System.Web.UI.HtmlControls 144 @using Dynamicweb.Rapido.Blocks.Components 145 @using Dynamicweb.Rapido.Blocks.Components.Articles 146 @using Dynamicweb.Rapido.Blocks.Components.Documentation 147 @using Dynamicweb.Rapido.Blocks 148 149 150 @*--- START: Base block renderers ---*@ 151 152 @helper RenderBlockList(List<Block> blocks) 153 { 154 bool debug = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("debug")) ? Convert.ToBoolean(HttpContext.Current.Request.QueryString.Get("debug")) : false; 155 blocks = blocks.OrderBy(item => item.SortId).ToList(); 156 157 foreach (Block item in blocks) 158 { 159 if (debug) { 160 <!-- Block START: @item.Id --> 161 } 162 163 if (item.Design == null) 164 { 165 @RenderBlock(item) 166 } 167 else if (item.Design.RenderType == RenderType.None) { 168 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : ""; 169 170 <div class="@cssClass dw-mod"> 171 @RenderBlock(item) 172 </div> 173 } 174 else if (item.Design.RenderType != RenderType.Hide) 175 { 176 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : ""; 177 178 if (!item.SkipRenderBlocksList) { 179 if (item.Design.RenderType == RenderType.Row) 180 { 181 <div class="grid grid--align-content-start @cssClass dw-mod" id="Block__@item.Id"> 182 @RenderBlock(item) 183 </div> 184 } 185 186 if (item.Design.RenderType == RenderType.Column) 187 { 188 string hidePadding = item.Design.HidePadding ? "u-no-padding" : ""; 189 string size = item.Design.Size ?? "12"; 190 size = Regex.IsMatch(size, @"\d") ? "md-" + item.Design.Size : item.Design.Size; 191 192 <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"> 193 @RenderBlock(item) 194 </div> 195 } 196 197 if (item.Design.RenderType == RenderType.Table) 198 { 199 <table class="table @cssClass dw-mod" id="Block__@item.Id"> 200 @RenderBlock(item) 201 </table> 202 } 203 204 if (item.Design.RenderType == RenderType.TableRow) 205 { 206 <tr class="@cssClass dw-mod" id="Block__@item.Id"> 207 @RenderBlock(item) 208 </tr> 209 } 210 211 if (item.Design.RenderType == RenderType.TableColumn) 212 { 213 <td class="@cssClass dw-mod" id="Block__@item.Id"> 214 @RenderBlock(item) 215 </td> 216 } 217 218 if (item.Design.RenderType == RenderType.CardHeader) 219 { 220 <div class="card-header @cssClass dw-mod"> 221 @RenderBlock(item) 222 </div> 223 } 224 225 if (item.Design.RenderType == RenderType.CardBody) 226 { 227 <div class="card @cssClass dw-mod"> 228 @RenderBlock(item) 229 </div> 230 } 231 232 if (item.Design.RenderType == RenderType.CardFooter) 233 { 234 <div class="card-footer @cssClass dw-mod"> 235 @RenderBlock(item) 236 </div> 237 } 238 } 239 else 240 { 241 @RenderBlock(item) 242 } 243 } 244 245 if (debug) { 246 <!-- Block END: @item.Id --> 247 } 248 } 249 } 250 251 @helper RenderBlock(Block item) 252 { 253 bool debug = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("debug")) ? Convert.ToBoolean(HttpContext.Current.Request.QueryString.Get("debug")) : false; 254 255 if (item.Template != null) 256 { 257 @BlocksPage.RenderTemplate(item.Template) 258 } 259 260 if (item.Component != null) 261 { 262 string customSufix = "Custom"; 263 string methodName = item.Component.HelperName; 264 265 ComponentBase[] methodParameters = new ComponentBase[1]; 266 methodParameters[0] = item.Component; 267 Type methodType = this.GetType(); 268 269 MethodInfo customMethod = methodType.GetMethod(methodName + customSufix); 270 271 try { 272 if (debug) { 273 <!-- Component: @methodName.Replace("Render", "") --> 274 } 275 if(customMethod != null) { 276 @customMethod.Invoke(this, methodParameters).ToString(); 277 } else { 278 MethodInfo generalMethod = methodType.GetMethod(methodName); 279 @generalMethod.Invoke(this, methodParameters).ToString(); 280 } 281 } catch { 282 try { 283 MethodInfo generalMethod = methodType.GetMethod(methodName); 284 @generalMethod.Invoke(this, methodParameters).ToString(); 285 } catch(Exception ex) { 286 throw new Exception(item.Component.GetType().Name + " method '" + methodName +"' could not be invoked", ex); 287 } 288 } 289 } 290 291 if (item.BlocksList.Count > 0 && !item.SkipRenderBlocksList) 292 { 293 @RenderBlockList(item.BlocksList) 294 } 295 } 296 297 @*--- END: Base block renderers ---*@ 298 299 300 @* Include the components *@ 301 @using Dynamicweb.Rapido.Blocks.Components 302 @using Dynamicweb.Rapido.Blocks.Components.General 303 @using Dynamicweb.Rapido.Blocks 304 @using System.IO 305 306 @* Required *@ 307 @using Dynamicweb.Rapido.Blocks.Components 308 @using Dynamicweb.Rapido.Blocks.Components.General 309 @using Dynamicweb.Rapido.Blocks 310 311 312 @helper Render(ComponentBase component) 313 { 314 if (component != null) 315 { 316 @component.Render(this) 317 } 318 } 319 320 @* Components *@ 321 @using System.Reflection 322 @using Dynamicweb.Rapido.Blocks.Components.General 323 324 325 @* Component *@ 326 327 @helper RenderIcon(Icon settings) 328 { 329 if (settings != null) 330 { 331 string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : ""; 332 333 if (settings.Name != null) 334 { 335 if (string.IsNullOrEmpty(settings.Label)) 336 { 337 <i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i> 338 } 339 else 340 { 341 if (settings.LabelPosition == IconLabelPosition.Before) 342 { 343 <div class="u-flex u-flex--align-items-center @settings.CssClass">@settings.Label <i class="@settings.Prefix @settings.Name u-margin-left" @color></i></div> 344 } 345 else 346 { 347 <div class="u-flex u-flex--align-items-center @settings.CssClass"><i class="@settings.Prefix @settings.Name u-margin-right--lg u-w20px" @color></i>@settings.Label</div> 348 } 349 } 350 } 351 else if (!string.IsNullOrEmpty(settings.Label)) 352 { 353 @settings.Label 354 } 355 } 356 } 357 @using System.Reflection 358 @using Dynamicweb.Rapido.Blocks.Components.General 359 @using Dynamicweb.Rapido.Blocks.Components 360 @using Dynamicweb.Core 361 362 @* Component *@ 363 364 @helper RenderButton(Button settings) 365 { 366 if (settings != null && (!string.IsNullOrEmpty(settings.Title) || settings.Icon != null)) 367 { 368 Dictionary<string, string> attributes = new Dictionary<string, string>(); 369 List<string> classList = settings.CssClass != null ? settings.CssClass.Split(' ').ToList() : new List<string>(); 370 if (settings.Disabled) { 371 attributes.Add("disabled", "true"); 372 classList.Add("disabled"); 373 } 374 375 if (!string.IsNullOrEmpty(settings.ConfirmText) || !string.IsNullOrEmpty(settings.ConfirmTitle)) 376 { 377 settings.Id = !string.IsNullOrEmpty(settings.Id) ? settings.Id : Guid.NewGuid().ToString("N"); 378 @RenderConfirmDialog(settings); 379 settings.OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = true"; 380 } 381 382 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 383 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 384 if (!string.IsNullOrEmpty(settings.AltText)) 385 { 386 attributes.Add("title", settings.AltText); 387 } 388 else if (!string.IsNullOrEmpty(settings.Title)) 389 { 390 string cleanTitle = Regex.Replace(settings.Title, "<.*?>", String.Empty); 391 cleanTitle = cleanTitle.Replace("&nbsp;", " "); 392 attributes.Add("title", cleanTitle); 393 } 394 395 var onClickEvents = new List<string>(); 396 if (!string.IsNullOrEmpty(settings.OnClick)) 397 { 398 onClickEvents.Add(settings.OnClick); 399 } 400 if (!string.IsNullOrEmpty(settings.Href)) 401 { 402 onClickEvents.Add("location.href='" + settings.Href + "'"); 403 } 404 if (onClickEvents.Count > 0) 405 { 406 attributes.Add("onClick", string.Join(";", onClickEvents)); 407 } 408 409 if (settings.ButtonLayout != ButtonLayout.None) 410 { 411 classList.Add("btn"); 412 string btnLayout = Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower(); 413 if (btnLayout == "linkclean") 414 { 415 btnLayout = "link-clean"; //fix 416 } 417 classList.Add("btn--" + btnLayout); 418 } 419 420 if (settings.Icon == null) 421 { 422 settings.Icon = new Icon(); 423 } 424 425 settings.Icon.CssClass += Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower() != "linkclean" ? " u-flex--align-center" : ""; 426 settings.Icon.Label = settings.Title; 427 428 attributes.Add("type", Enum.GetName(typeof(ButtonType), settings.ButtonType).ToLower()); 429 430 <button class="@string.Join(" ", classList) dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@Render(settings.Icon)</button> 431 } 432 } 433 434 @helper RenderConfirmDialog(Button settings) 435 { 436 Modal confirmDialog = new Modal { 437 Id = settings.Id, 438 Width = ModalWidth.Sm, 439 Heading = new Heading 440 { 441 Level = 2, 442 Title = settings.ConfirmTitle 443 }, 444 BodyText = settings.ConfirmText 445 }; 446 447 confirmDialog.AddAction(new Button { Title = Translate("Cancel"), ButtonLayout = ButtonLayout.Secondary, OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = false"}); 448 confirmDialog.AddAction(new Button { Title = Translate("OK"), ButtonLayout = ButtonLayout.Primary, OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = false;" + settings.OnClick }); 449 450 @Render(confirmDialog) 451 } 452 @using Dynamicweb.Rapido.Blocks.Components.General 453 @using Dynamicweb.Rapido.Blocks.Components 454 @using Dynamicweb.Core 455 456 @helper RenderDashboard(Dashboard settings) 457 { 458 var widgets = settings.GetWidgets(); 459 460 if (!string.IsNullOrEmpty(settings.WidgetsBaseBackgroundColor)) 461 { 462 //set bg color for them 463 464 System.Drawing.Color color = System.Drawing.ColorTranslator.FromHtml(settings.WidgetsBaseBackgroundColor); 465 int r = Convert.ToInt16(color.R); 466 int g = Convert.ToInt16(color.G); 467 int b = Convert.ToInt16(color.B); 468 469 var count = widgets.Length; 470 var max = Math.Max(r, Math.Max(g, b)); 471 double step = 255.0 / (max * count); 472 var i = 0; 473 foreach (var widget in widgets) 474 { 475 i++; 476 477 var shade = "rgb(" + Converter.ToString(r * step * i).Replace(",", ".") + ", " + Converter.ToString(g * step * i).Replace(",", ".") + ", " + Converter.ToString(b * step * i).Replace(",", ".") + ")"; 478 widget.BackgroundColor = shade; 479 } 480 } 481 482 <div class="dashboard @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 483 @foreach (var widget in widgets) 484 { 485 <div class="dashboard__widget"> 486 @Render(widget) 487 </div> 488 } 489 </div> 490 } 491 @using Dynamicweb.Rapido.Blocks.Components.General 492 @using Dynamicweb.Rapido.Blocks.Components 493 494 @helper RenderDashboardWidgetLink(DashboardWidgetLink settings) 495 { 496 if (!string.IsNullOrEmpty(settings.Link)) 497 { 498 var backgroundStyles = ""; 499 if (!string.IsNullOrEmpty(settings.BackgroundColor)) 500 { 501 backgroundStyles = "style=\"background-color:" + settings.BackgroundColor + "\""; 502 } 503 504 <a href="@settings.Link" class="widget widget--link @settings.CssClass dw-mod" @backgroundStyles title="@settings.Title" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 505 <div class="u-center-middle u-color-light"> 506 @if (settings.Icon != null) 507 { 508 settings.Icon.CssClass += "widget__icon"; 509 @Render(settings.Icon) 510 } 511 <div class="widget__title">@settings.Title</div> 512 </div> 513 </a> 514 } 515 } 516 @using Dynamicweb.Rapido.Blocks.Components.General 517 @using Dynamicweb.Rapido.Blocks.Components 518 519 @helper RenderDashboardWidgetCounter(DashboardWidgetCounter settings) 520 { 521 var backgroundStyles = ""; 522 if (!string.IsNullOrEmpty(settings.BackgroundColor)) 523 { 524 backgroundStyles = "style='background-color:" + settings.BackgroundColor + "'"; 525 } 526 527 <div class="widget @settings.CssClass dw-mod" @backgroundStyles @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 528 <div class="u-center-middle u-color-light"> 529 @if (settings.Icon != null) 530 { 531 settings.Icon.CssClass += "widget__icon"; 532 @Render(settings.Icon) 533 } 534 <div class="widget__counter">@settings.Count</div> 535 <div class="widget__title">@settings.Title</div> 536 </div> 537 </div> 538 } 539 @using System.Reflection 540 @using Dynamicweb.Rapido.Blocks.Components.General 541 @using Dynamicweb.Rapido.Blocks.Components 542 @using Dynamicweb.Core 543 544 @* Component *@ 545 546 @helper RenderLink(Link settings) 547 { 548 if (settings != null && !string.IsNullOrEmpty(settings.Href) && (!string.IsNullOrEmpty(settings.Title) || settings.Icon != null)) 549 { 550 Dictionary<string, string> attributes = new Dictionary<string, string>(); 551 List<string> classList = settings.CssClass != null ? settings.CssClass.Split(' ').ToList() : new List<string>(); 552 if (settings.Disabled) 553 { 554 attributes.Add("disabled", "true"); 555 classList.Add("disabled"); 556 } 557 558 if (!string.IsNullOrEmpty(settings.AltText)) 559 { 560 attributes.Add("title", settings.AltText); 561 } 562 else if (!string.IsNullOrEmpty(settings.Title)) 563 { 564 attributes.Add("title", settings.Title); 565 } 566 567 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 568 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 569 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onClick", settings.OnClick); } 570 attributes.Add("href", settings.Href); 571 572 if (settings.ButtonLayout != ButtonLayout.None) 573 { 574 classList.Add("btn"); 575 string btnLayout = Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower(); 576 if (btnLayout == "linkclean") 577 { 578 btnLayout = "link-clean"; //fix 579 } 580 classList.Add("btn--" + btnLayout); 581 } 582 583 if (settings.Icon == null) 584 { 585 settings.Icon = new Icon(); 586 } 587 settings.Icon.Label = settings.Title; 588 589 if (settings.Target == LinkTargetType.Blank && settings.Rel == LinkRelType.None) 590 { 591 settings.Rel = LinkRelType.Noopener; 592 } 593 if (settings.Target != LinkTargetType.None) 594 { 595 attributes.Add("target", "_" + Enum.GetName(typeof(LinkTargetType), settings.Target).ToLower()); 596 } 597 if (settings.Download) 598 { 599 attributes.Add("download", "true"); 600 } 601 if (settings.Rel != LinkRelType.None) 602 { 603 attributes.Add("rel", Enum.GetName(typeof(LinkRelType), settings.Rel).ToLower()); 604 } 605 606 <a class="@string.Join(" ", classList) dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@Render(settings.Icon)</a> 607 } 608 } 609 @using System.Reflection 610 @using Dynamicweb.Rapido.Blocks.Components 611 @using Dynamicweb.Rapido.Blocks.Components.General 612 @using Dynamicweb.Rapido.Blocks 613 614 615 @* Component *@ 616 617 @helper RenderRating(Rating settings) 618 { 619 if (settings.Score > 0) 620 { 621 int rating = settings.Score; 622 string iconType = "fa-star"; 623 624 switch (settings.Type.ToString()) { 625 case "Stars": 626 iconType = "fa-star"; 627 break; 628 case "Hearts": 629 iconType = "fa-heart"; 630 break; 631 case "Lemons": 632 iconType = "fa-lemon"; 633 break; 634 case "Bombs": 635 iconType = "fa-bomb"; 636 break; 637 } 638 639 <div class="u-ta-right"> 640 @for (int i = 0; i < settings.OutOf; i++) 641 { 642 <i class="@(rating > i ? "fas" : "far") @iconType"></i> 643 } 644 </div> 645 } 646 } 647 @using System.Reflection 648 @using Dynamicweb.Rapido.Blocks.Components.General 649 @using Dynamicweb.Rapido.Blocks.Components 650 651 652 @* Component *@ 653 654 @helper RenderSelectFieldOption(SelectFieldOption settings) 655 { 656 Dictionary<string, string> attributes = new Dictionary<string, string>(); 657 if (settings.Checked) { attributes.Add("selected", "true"); } 658 if (settings.Disabled) { attributes.Add("disabled", "true"); } 659 if (settings.Value != null) { attributes.Add("value", settings.Value); } 660 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 661 662 <option @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Label</option> 663 } 664 @using System.Reflection 665 @using Dynamicweb.Rapido.Blocks.Components.General 666 @using Dynamicweb.Rapido.Blocks.Components 667 668 669 @* Component *@ 670 671 @helper RenderNavigation(Navigation settings) { 672 @RenderNavigation(new 673 { 674 id = settings.Id, 675 cssclass = settings.CssClass, 676 startLevel = settings.StartLevel, 677 endlevel = settings.EndLevel, 678 expandmode = settings.Expandmode, 679 sitemapmode = settings.SitemapMode, 680 template = settings.Template 681 }) 682 } 683 @using Dynamicweb.Rapido.Blocks.Components.General 684 @using Dynamicweb.Rapido.Blocks.Components 685 686 687 @* Component *@ 688 689 @helper RenderBreadcrumbNavigation(BreadcrumbNavigation settings) { 690 settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id; 691 settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template; 692 settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel; 693 settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel; 694 settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode; 695 settings.SitemapMode = false; 696 697 @RenderNavigation(settings) 698 } 699 @using Dynamicweb.Rapido.Blocks.Components.General 700 @using Dynamicweb.Rapido.Blocks.Components 701 702 703 @* Component *@ 704 705 @helper RenderLeftNavigation(LeftNavigation settings) { 706 settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id; 707 settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template; 708 settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel; 709 settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel; 710 settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode; 711 712 <div class="grid__cell"> 713 @RenderNavigation(settings) 714 </div> 715 } 716 @using System.Reflection 717 @using Dynamicweb.Rapido.Blocks.Components.General 718 @using Dynamicweb.Core 719 720 @* Component *@ 721 722 @helper RenderHeading(Heading settings) 723 { 724 if (settings != null && !string.IsNullOrEmpty(settings.Title)) 725 { 726 string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : ""; 727 string tagName = settings.Level != 0 ? "h" + settings.Level.ToString() : "div"; 728 729 @("<" + tagName + " class=\"" + settings.CssClass + " dw-mod\" " + color + ">") 730 if (!string.IsNullOrEmpty(settings.Link)) 731 { 732 @Render(new Link { Href = settings.Link, Icon = settings.Icon, Title = settings.Title, ButtonLayout = ButtonLayout.None }) 733 } 734 else 735 { 736 if (settings.Icon == null) 737 { 738 settings.Icon = new Icon(); 739 } 740 settings.Icon.Label = settings.Title; 741 @Render(settings.Icon) 742 } 743 @("</" + tagName + ">"); 744 } 745 } 746 @using Dynamicweb.Rapido.Blocks.Components 747 @using Dynamicweb.Rapido.Blocks.Components.General 748 @using Dynamicweb.Rapido.Blocks 749 750 751 @* Component *@ 752 753 @helper RenderImage(Image settings) 754 { 755 if (settings.FilterPrimary != ImageFilter.None || settings.FilterSecondary != ImageFilter.None) 756 { 757 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>(); 758 if (!string.IsNullOrEmpty(settings.FilterColor)) { optionalAttributes.Add("style", "background-color: " + settings.FilterColor); } 759 760 if (settings.Caption != null) 761 { 762 @:<div> 763 } 764 765 var primaryFilterClass = settings.FilterPrimary.ToString().ToLower(); 766 var secondaryFilterClass = settings.FilterSecondary.ToString().ToLower(); 767 768 <div class="image-filter image-filter--@primaryFilterClass u-position-relative dw-mod" @ComponentMethods.AddAttributes(optionalAttributes)> 769 <div class="image-filter image-filter--@secondaryFilterClass dw-mod"> 770 @if (settings.Link != null) 771 { 772 <a href="@settings.Link"> 773 @RenderTheImage(settings) 774 </a> 775 } 776 else 777 { 778 @RenderTheImage(settings) 779 } 780 </div> 781 </div> 782 783 if (settings.Caption != null) 784 { 785 <span class="image-caption dw-mod">@settings.Caption</span> 786 @:</div> 787 } 788 } 789 else 790 { 791 if (settings.Caption != null) 792 { 793 @:<div> 794 } 795 if (!string.IsNullOrEmpty(settings.Link)) 796 { 797 <a href="@settings.Link"> 798 @RenderTheImage(settings) 799 </a> 800 } 801 else 802 { 803 @RenderTheImage(settings) 804 } 805 806 if (settings.Caption != null) 807 { 808 <span class="image-caption dw-mod">@settings.Caption</span> 809 @:</div> 810 } 811 } 812 } 813 814 @helper RenderTheImage(Image settings) 815 { 816 if (settings != null) 817 { 818 string alternativeImage = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("AlternativeImage")) ? Pageview.AreaSettings.GetItem("Settings").GetFile("AlternativeImage").PathUrlEncoded : "/Images/missing_image.jpg"; 819 string placeholderImage = "/Files/Images/placeholder.gif"; 820 string imageEngine = "/Admin/Public/GetImage.ashx?"; 821 822 string imageStyle = ""; 823 824 switch (settings.Style) 825 { 826 case ImageStyle.Ball: 827 imageStyle = "grid__cell-img--ball"; 828 break; 829 830 case ImageStyle.Triangle: 831 imageStyle = "grid__cell-img--triangle"; 832 break; 833 } 834 835 if (settings.Style == ImageStyle.Ball || settings.Style == ImageStyle.Circle || settings.Style == ImageStyle.Triangle) 836 { 837 settings.ImageDefault.Crop = settings.ImageDefault.Crop == 5 ? settings.ImageDefault.Crop = 0 : settings.ImageDefault.Crop; 838 839 if (settings.ImageDefault != null) 840 { 841 settings.ImageDefault.Height = settings.ImageDefault.Width; 842 } 843 if (settings.ImageMedium != null) 844 { 845 settings.ImageMedium.Height = settings.ImageMedium.Width; 846 } 847 if (settings.ImageSmall != null) 848 { 849 settings.ImageSmall.Height = settings.ImageSmall.Width; 850 } 851 } 852 853 string defaultImage = imageEngine; 854 string imageSmall = ""; 855 string imageMedium = ""; 856 857 if (settings.DisableImageEngine) 858 { 859 defaultImage = settings.Path; 860 } 861 else 862 { 863 if (settings.ImageDefault != null) 864 { 865 defaultImage += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageDefault); 866 867 if (settings.Path.GetType() != typeof(string)) 868 { 869 defaultImage += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 870 defaultImage += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 871 } 872 else 873 { 874 defaultImage += settings.Path != null ? "Image=" + settings.Path : ""; 875 } 876 877 defaultImage += "&AlternativeImage=" + alternativeImage; 878 } 879 880 if (settings.ImageSmall != null) 881 { 882 imageSmall = "data-src-small=\"" + imageEngine; 883 imageSmall += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageSmall); 884 885 if (settings.Path.GetType() != typeof(string)) 886 { 887 imageSmall += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 888 imageSmall += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 889 } 890 else 891 { 892 imageSmall += settings.Path != null ? "Image=" + settings.Path : ""; 893 } 894 895 imageSmall += "&alternativeImage=" + alternativeImage; 896 897 imageSmall += "\""; 898 } 899 900 if (settings.ImageMedium != null) 901 { 902 imageMedium = "data-src-medium=\"" + imageEngine; 903 imageMedium += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageMedium); 904 905 if (settings.Path.GetType() != typeof(string)) 906 { 907 imageMedium += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 908 imageMedium += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 909 } 910 else 911 { 912 imageMedium += settings.Path != null ? "Image=" + settings.Path : ""; 913 } 914 915 imageMedium += "&alternativeImage=" + alternativeImage; 916 917 imageMedium += "\""; 918 } 919 } 920 921 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>(); 922 if (!string.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick); } 923 if (!string.IsNullOrEmpty(settings.Title)) 924 { 925 optionalAttributes.Add("alt", settings.Title); 926 optionalAttributes.Add("title", settings.Title); 927 } 928 929 if (settings.DisableLazyLoad) 930 { 931 <img id="@settings.Id" class="@imageStyle @settings.CssClass dw-mod" src="@defaultImage" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 932 } 933 else 934 { 935 <img id="@settings.Id" class="b-lazy @imageStyle @settings.CssClass dw-mod" src="@placeholderImage" data-src="@defaultImage" @imageSmall @imageMedium @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 936 } 937 } 938 } 939 @using System.Reflection 940 @using Dynamicweb.Rapido.Blocks.Components.General 941 @using Dynamicweb.Rapido.Blocks.Components 942 943 @* Component *@ 944 945 @helper RenderFileField(FileField settings) 946 { 947 var attributes = new Dictionary<string, string>(); 948 if (string.IsNullOrEmpty(settings.Id)) 949 { 950 settings.Id = Guid.NewGuid().ToString("N"); 951 } 952 953 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 954 if (settings.Disabled) { attributes.Add("disabled", "true"); } 955 if (settings.Required) { attributes.Add("required", "true"); } 956 if (settings.Multiple) { attributes.Add("multiple", "true"); } 957 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 958 if (string.IsNullOrEmpty(settings.ChooseFileText)) 959 { 960 settings.ChooseFileText = Translate("Choose file"); 961 } 962 if (string.IsNullOrEmpty(settings.NoFilesChosenText)) 963 { 964 settings.NoFilesChosenText = Translate("No files chosen..."); 965 } 966 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 967 968 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; } 969 970 string setValueToFakeInput = "FileUpload.setValueToFakeInput(this)"; 971 attributes.Add("onchange", setValueToFakeInput + (!string.IsNullOrEmpty(settings.OnChange) ? settings.OnChange : "")); 972 973 attributes.Add("type", "file"); 974 if (settings.Value != null) { attributes.Add("value", settings.Value); } 975 settings.CssClass = "u-full-width " + settings.CssClass; 976 977 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 978 979 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod"> 980 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null ) 981 { 982 <div class="u-full-width"> 983 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } 984 @if (settings.Link != null) { 985 <div class="u-pull--right"> 986 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } 987 @Render(settings.Link) 988 </div> 989 } 990 </div> 991 992 } 993 994 @if (!string.IsNullOrEmpty(settings.HelpText)) 995 { 996 <small class="form__help-text">@settings.HelpText</small> 997 } 998 999 <div class="form__field-combi file-input u-no-margin dw-mod"> 1000 <input @ComponentMethods.AddAttributes(resultAttributes) class="file-input__real-input" data-no-files-text="@settings.NoFilesChosenText" data-many-files-text="@Translate("files")" /> 1001 <label for="@settings.Id" class="file-input__btn btn--secondary btn dw-mod">@settings.ChooseFileText</label> 1002 <label for="@settings.Id" class="@settings.CssClass file-input__fake-input js-fake-input dw-mod">@settings.NoFilesChosenText</label> 1003 @if (settings.UploadButton != null) 1004 { 1005 settings.UploadButton.CssClass += " btn--condensed u-no-margin"; 1006 @Render(settings.UploadButton) 1007 } 1008 </div> 1009 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1010 </div> 1011 } 1012 @using System.Reflection 1013 @using Dynamicweb.Rapido.Blocks.Components.General 1014 @using Dynamicweb.Rapido.Blocks.Components 1015 @using Dynamicweb.Core 1016 @using System.Linq 1017 1018 @* Component *@ 1019 1020 @helper RenderDateTimeField(DateTimeField settings) 1021 { 1022 if (string.IsNullOrEmpty(settings.Id)) 1023 { 1024 settings.Id = Guid.NewGuid().ToString("N"); 1025 } 1026 1027 var textField = new TextField { 1028 Name = settings.Name, 1029 Id = settings.Id, 1030 Label = settings.Label, 1031 HelpText = settings.HelpText, 1032 Value = settings.Value, 1033 Disabled = settings.Disabled, 1034 Required = settings.Required, 1035 ErrorMessage = settings.ErrorMessage, 1036 CssClass = settings.CssClass, 1037 WrapperCssClass = settings.WrapperCssClass, 1038 OnChange = settings.OnChange, 1039 OnClick = settings.OnClick, 1040 Link = settings.Link, 1041 ExtraAttributes = settings.ExtraAttributes, 1042 // 1043 Placeholder = settings.Placeholder 1044 }; 1045 1046 @Render(textField) 1047 1048 List<string> jsAttributes = new List<string>(); 1049 1050 jsAttributes.Add("mode: '" + Enum.GetName(typeof(DateTimeFieldMode), settings.Mode).ToLower() + "'"); 1051 1052 if (!string.IsNullOrEmpty(settings.DateFormat)) 1053 { 1054 jsAttributes.Add("dateFormat: '" + settings.DateFormat + "'"); 1055 } 1056 if (!string.IsNullOrEmpty(settings.MinDate)) 1057 { 1058 jsAttributes.Add("minDate: '" + settings.MinDate + "'"); 1059 } 1060 if (!string.IsNullOrEmpty(settings.MaxDate)) 1061 { 1062 jsAttributes.Add("maxDate: '" + settings.MaxDate + "'"); 1063 } 1064 if (settings.IsInline) 1065 { 1066 jsAttributes.Add("inline: " + Converter.ToString(settings.IsInline).ToLower()); 1067 } 1068 if (settings.EnableTime) 1069 { 1070 jsAttributes.Add("enableTime: " + Converter.ToString(settings.EnableTime).ToLower()); 1071 } 1072 if (settings.EnableWeekNumbers) 1073 { 1074 jsAttributes.Add("weekNumbers: " + Converter.ToString(settings.EnableWeekNumbers).ToLower()); 1075 } 1076 1077 jsAttributes.AddRange(settings.GetFlatPickrOptions().Select(x => x.Key + ": " + x.Value)); 1078 1079 <script> 1080 document.addEventListener("DOMContentLoaded", function () { 1081 flatpickr("#@textField.Id", { 1082 @string.Join(",", jsAttributes) 1083 }); 1084 }); 1085 </script> 1086 } 1087 @using System.Reflection 1088 @using Dynamicweb.Rapido.Blocks.Components.General 1089 @using Dynamicweb.Rapido.Blocks.Components 1090 1091 @* Component *@ 1092 1093 @helper RenderTextField(TextField settings) 1094 { 1095 var attributes = new Dictionary<string, string>(); 1096 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1097 { 1098 settings.Id = Guid.NewGuid().ToString("N"); 1099 } 1100 1101 /*base settings*/ 1102 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1103 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1104 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1105 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1106 if (settings.Required) { attributes.Add("required", "true"); } 1107 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1108 /*end*/ 1109 1110 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 1111 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 1112 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 1113 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 1114 if (settings.MaxLength != 0) { attributes.Add("maxlength", settings.MaxLength.ToString()); } 1115 if (!string.IsNullOrEmpty(settings.Placeholder)) { attributes.Add("placeholder", settings.Placeholder); } 1116 attributes.Add("type", Enum.GetName(typeof(TextFieldType), settings.Type).ToLower()); 1117 if (settings.Type == TextFieldType.Password) { attributes.Add("autocomplete", "off"); }; 1118 if (settings.Value != null) { attributes.Add("value", settings.Value); } 1119 1120 settings.CssClass = "u-full-width " + settings.CssClass; 1121 1122 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; } 1123 1124 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1125 1126 string noMargin = "u-no-margin"; 1127 if (!settings.ReadOnly) { 1128 noMargin = ""; 1129 } 1130 1131 <div class="form__field-group u-full-width @noMargin @settings.WrapperCssClass dw-mod"> 1132 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null ) 1133 { 1134 <div class="u-full-width"> 1135 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } 1136 @if (settings.Link != null) { 1137 settings.Link.ButtonLayout = ButtonLayout.LinkClean; 1138 1139 <div class="u-pull--right"> 1140 @Render(settings.Link) 1141 </div> 1142 } 1143 </div> 1144 1145 } 1146 1147 @if (!string.IsNullOrEmpty(settings.HelpText)) 1148 { 1149 <small class="form__help-text">@settings.HelpText</small> 1150 } 1151 1152 @if (settings.ActionButton != null) 1153 { 1154 settings.ActionButton.CssClass += " btn--condensed u-no-margin"; 1155 <div class="form__field-combi u-no-margin dw-mod"> 1156 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1157 @Render(settings.ActionButton) 1158 </div> 1159 } 1160 else 1161 { 1162 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1163 } 1164 1165 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1166 </div> 1167 } 1168 @using System.Reflection 1169 @using Dynamicweb.Rapido.Blocks.Components.General 1170 @using Dynamicweb.Rapido.Blocks.Components 1171 1172 @* Component *@ 1173 1174 @helper RenderNumberField(NumberField settings) 1175 { 1176 var attributes = new Dictionary<string, string>(); 1177 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1178 { 1179 settings.Id = Guid.NewGuid().ToString("N"); 1180 } 1181 1182 /*base settings*/ 1183 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1184 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1185 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1186 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1187 if (settings.Required) { attributes.Add("required", "true"); } 1188 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1189 /*end*/ 1190 1191 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 1192 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 1193 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 1194 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 1195 if (settings.Max != null) { attributes.Add("max", settings.Max.ToString()); } 1196 if (settings.Min != null) { attributes.Add("min", settings.Min.ToString()); } 1197 if (settings.Step != 0) { attributes.Add("step", settings.Step.ToString()); } 1198 if (settings.Value != null && !string.IsNullOrEmpty(settings.Value.ToString())) { attributes.Add("value", settings.Value.ToString()); } 1199 attributes.Add("type", "number"); 1200 1201 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1202 1203 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod"> 1204 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null ) 1205 { 1206 <div class="u-full-width"> 1207 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } 1208 @if (settings.Link != null) { 1209 <div class="u-pull--right"> 1210 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } 1211 @Render(settings.Link) 1212 </div> 1213 } 1214 </div> 1215 1216 } 1217 1218 @if (!string.IsNullOrEmpty(settings.HelpText)) 1219 { 1220 <small class="form__help-text">@settings.HelpText</small> 1221 } 1222 1223 @if (settings.ActionButton != null) 1224 { 1225 settings.ActionButton.CssClass += " btn--condensed u-no-margin"; 1226 <div class="form__field-combi u-no-margin dw-mod"> 1227 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1228 @Render(settings.ActionButton) 1229 </div> 1230 } 1231 else 1232 { 1233 <div class="form__field-combi u-no-margin dw-mod"> 1234 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1235 </div> 1236 } 1237 1238 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1239 </div> 1240 } 1241 @using System.Reflection 1242 @using Dynamicweb.Rapido.Blocks.Components.General 1243 @using Dynamicweb.Rapido.Blocks.Components 1244 1245 1246 @* Component *@ 1247 1248 @helper RenderTextareaField(TextareaField settings) 1249 { 1250 Dictionary<string, string> attributes = new Dictionary<string, string>(); 1251 string id = settings.Id; 1252 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(id)) 1253 { 1254 id = Guid.NewGuid().ToString("N"); 1255 } 1256 1257 if (!string.IsNullOrEmpty(id)) { attributes.Add("id", id); } 1258 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1259 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 1260 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 1261 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 1262 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1263 if (!string.IsNullOrEmpty(settings.Placeholder)) { attributes.Add("placeholder", settings.Placeholder); } 1264 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1265 if (settings.Required) { attributes.Add("required", "true"); } 1266 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 1267 if (settings.MaxLength != 0) { attributes.Add("maxlength", settings.MaxLength.ToString()); } 1268 if (settings.Rows != 0) { attributes.Add("rows", settings.Rows.ToString()); } 1269 attributes.Add("name", settings.Name); 1270 1271 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; } 1272 1273 <div class="form__field-group @settings.WrapperCssClass dw-mod"> 1274 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null ) 1275 { 1276 <div class="u-full-width"> 1277 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } 1278 @if (settings.Link != null) { 1279 <div class="u-pull--right"> 1280 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } 1281 @Render(settings.Link) 1282 </div> 1283 } 1284 </div> 1285 } 1286 1287 @if (!string.IsNullOrEmpty(settings.HelpText)) 1288 { 1289 <small class="form__help-text">@settings.HelpText</small> 1290 } 1291 1292 <textarea class="u-full-width @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Value</textarea> 1293 1294 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1295 </div> 1296 } 1297 @using System.Reflection 1298 @using Dynamicweb.Rapido.Blocks.Components.General 1299 @using Dynamicweb.Rapido.Blocks.Components 1300 1301 1302 @* Component *@ 1303 1304 @helper RenderHiddenField(HiddenField settings) { 1305 var attributes = new Dictionary<string, string>(); 1306 attributes.Add("type", "hidden"); 1307 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1308 if (settings.Value != null) { attributes.Add("value", settings.Value); } 1309 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1310 1311 <input @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)/> 1312 } 1313 @using System.Reflection 1314 @using Dynamicweb.Rapido.Blocks.Components.General 1315 @using Dynamicweb.Rapido.Blocks.Components 1316 1317 @* Component *@ 1318 1319 @helper RenderCheckboxField(CheckboxField settings) 1320 { 1321 var attributes = new Dictionary<string, string>(); 1322 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1323 { 1324 settings.Id = Guid.NewGuid().ToString("N"); 1325 } 1326 1327 /*base settings*/ 1328 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1329 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1330 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1331 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1332 if (settings.Required) { attributes.Add("required", "true"); } 1333 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1334 /*end*/ 1335 1336 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; } 1337 1338 attributes.Add("type", "checkbox"); 1339 if (settings.Checked) { attributes.Add("checked", "true"); } 1340 settings.CssClass = "form__control " + settings.CssClass; 1341 if (settings.Value != null) { attributes.Add("value", settings.Value); } 1342 1343 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1344 1345 <div class="form__field-group @settings.WrapperCssClass dw-mod"> 1346 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1347 @if (!string.IsNullOrEmpty(settings.Label)) 1348 { 1349 <label for="@settings.Id" class="dw-mod">@settings.Label</label> 1350 } 1351 1352 @if (settings.Link != null) { 1353 <span> 1354 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } 1355 @Render(settings.Link) 1356 </span> 1357 } 1358 1359 @if (!string.IsNullOrEmpty(settings.HelpText)) 1360 { 1361 <small class="form__help-text checkbox-help dw-mod">@settings.HelpText</small> 1362 } 1363 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1364 </div> 1365 } 1366 @using System.Reflection 1367 @using Dynamicweb.Rapido.Blocks.Components.General 1368 @using Dynamicweb.Rapido.Blocks.Components 1369 1370 1371 @* Component *@ 1372 1373 @helper RenderCheckboxListField(CheckboxListField settings) 1374 { 1375 <div class="form__field-group @settings.WrapperCssClass u-margin-bottom dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1376 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null ) 1377 { 1378 <div class="u-full-width"> 1379 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } 1380 @if (settings.Link != null) { 1381 <div class="u-pull--right"> 1382 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } 1383 @Render(settings.Link) 1384 </div> 1385 } 1386 </div> 1387 1388 } 1389 1390 <div class="u-pull--left"> 1391 @if (!string.IsNullOrEmpty(settings.HelpText)) 1392 { 1393 <small class="form__help-text">@settings.HelpText</small> 1394 } 1395 1396 @foreach (var item in settings.Options) 1397 { 1398 if (settings.Required) 1399 { 1400 item.Required = true; 1401 } 1402 if (settings.Disabled) 1403 { 1404 item.Disabled = true; 1405 } 1406 if (!string.IsNullOrEmpty(settings.Name)) 1407 { 1408 item.Name = settings.Name; 1409 } 1410 if (!string.IsNullOrEmpty(settings.CssClass)) 1411 { 1412 item.CssClass += settings.CssClass; 1413 } 1414 1415 /* value is not supported */ 1416 1417 if (!string.IsNullOrEmpty(settings.OnClick)) 1418 { 1419 item.OnClick += settings.OnClick; 1420 } 1421 if (!string.IsNullOrEmpty(settings.OnChange)) 1422 { 1423 item.OnChange += settings.OnChange; 1424 } 1425 @Render(item) 1426 } 1427 1428 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1429 </div> 1430 1431 </div> 1432 } 1433 @using Dynamicweb.Rapido.Blocks.Components.General 1434 1435 @* Component *@ 1436 1437 @helper RenderSearch(Search settings) 1438 { 1439 var searchValue = HttpContext.Current.Request.QueryString.Get(settings.SearchParameter) ?? ""; 1440 var groupValue = HttpContext.Current.Request.QueryString.Get(settings.GroupsParameter) ?? ""; 1441 1442 if (string.IsNullOrEmpty(settings.Id)) 1443 { 1444 settings.Id = Guid.NewGuid().ToString("N"); 1445 } 1446 1447 var resultAttributes = new Dictionary<string, string>(); 1448 1449 if (settings.PageSize != 0) 1450 { 1451 resultAttributes.Add("data-page-size", settings.PageSize.ToString()); 1452 } 1453 if (!string.IsNullOrEmpty(settings.GroupItemsFeedUrl)) 1454 { 1455 resultAttributes.Add("data-groups-feed-url", settings.GroupItemsFeedUrl); 1456 if (!string.IsNullOrEmpty(groupValue)) 1457 { 1458 resultAttributes.Add("data-selected-group", groupValue); 1459 } 1460 if (!string.IsNullOrEmpty(settings.GroupsParameter)) 1461 { 1462 resultAttributes.Add("data-groups-parameter", settings.GroupsParameter); 1463 } 1464 } 1465 resultAttributes.Add("data-force-init", "true"); 1466 if (settings.GoToFirstSearchResultOnEnter) 1467 { 1468 resultAttributes.Add("data-go-to-first-search-result-on-enter", settings.GoToFirstSearchResultOnEnter.ToString().ToLower()); 1469 } 1470 if (!string.IsNullOrEmpty(settings.SearchParameter)) 1471 { 1472 resultAttributes.Add("data-search-parameter", settings.SearchParameter); 1473 } 1474 resultAttributes.Add("data-search-feed-url", settings.SearchData.SearchFeedUrl); 1475 resultAttributes.Add("data-results-template-id", settings.SearchData.ResultsTemplateId); 1476 1477 if (settings.SecondSearchData != null) 1478 { 1479 resultAttributes.Add("data-second-search-feed-url", settings.SecondSearchData.SearchFeedUrl); 1480 resultAttributes.Add("data-second-results-template-id", settings.SecondSearchData.ResultsTemplateId); 1481 } 1482 if (!string.IsNullOrEmpty(settings.ResultsPageUrl)) 1483 { 1484 resultAttributes.Add("data-results-page-url", settings.ResultsPageUrl); 1485 } 1486 1487 resultAttributes = resultAttributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1488 1489 string searchFieldCss = (settings.SearchButton == null) ? "search--with-icon" : ""; 1490 1491 <div class="search @settings.CssClass @searchFieldCss js-search-data-source dw-mod" id="@settings.Id" @ComponentMethods.AddAttributes(resultAttributes)> 1492 @if (!string.IsNullOrEmpty(settings.GroupItemsFeedUrl)) 1493 { 1494 <button type="button" class="search__groups-btn dw-mod js-search-groups-btn">@Translate("All")</button> 1495 <ul class="dropdown dropdown--absolute-position dw-mod search__groups-results js-search-groups-list"></ul> 1496 } 1497 1498 <input type="text" class="search__field dw-mod js-search-field" placeholder="@settings.Placeholder" value="@searchValue"> 1499 1500 <div class="dropdown dropdown--absolute-position search__results dw-mod js-search-results @(settings.SecondSearchData != null ? "search__results--combined" : "")"> 1501 @if (settings.SecondSearchData != null) 1502 { 1503 <div class="search__column search__column--products dw-mod"> 1504 <div class="search__column-header dw-mod">@Translate("Products")</div> 1505 <ul class="search__results-list dw-mod js-search-results-list" id="@(settings.Id)_ResultsList"></ul> 1506 @if (!string.IsNullOrEmpty(settings.SearchData.ResultsPageUrl)) 1507 { 1508 @Render(new Link { 1509 Title = Translate("View all"), 1510 CssClass = "js-view-all-button u-margin", 1511 Href = settings.SearchData.ResultsPageUrl 1512 }); 1513 } 1514 </div> 1515 <div class="search__column search__column--pages dw-mod"> 1516 <div class="search__column-header">@Translate("Pages")</div> 1517 <ul class="search__results-list dw-mod js-search-results-second-list" id="@(settings.Id)_SecondResultsList"></ul> 1518 @if (!string.IsNullOrEmpty(settings.SecondSearchData.ResultsPageUrl)) 1519 { 1520 @Render(new Link 1521 { 1522 Title = Translate("View all"), 1523 CssClass = "js-view-all-button u-margin", 1524 Href = settings.SecondSearchData.ResultsPageUrl 1525 }); 1526 } 1527 </div> 1528 } 1529 else 1530 { 1531 <div class="search__column search__column--only dw-mod"> 1532 <ul class="search__results-list dw-mod js-search-results-list" id="@(settings.Id)_ResultsList"></ul> 1533 @if (!string.IsNullOrEmpty(settings.SearchData.ResultsPageUrl)) 1534 { 1535 @Render(new Link { 1536 Title = Translate("View all"), 1537 CssClass = "js-view-all-button u-margin", 1538 Href = settings.SearchData.ResultsPageUrl 1539 }); 1540 } 1541 </div> 1542 } 1543 </div> 1544 1545 @if (settings.SearchButton != null) 1546 { 1547 settings.SearchButton.CssClass += " search__btn js-search-btn"; 1548 if (settings.RenderDefaultSearchIcon) 1549 { 1550 settings.SearchButton.Icon = new Icon { Name = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue }; 1551 } 1552 @Render(settings.SearchButton); 1553 } 1554 </div> 1555 } 1556 @using System.Reflection 1557 @using Dynamicweb.Rapido.Blocks.Components.General 1558 @using Dynamicweb.Rapido.Blocks.Components 1559 1560 1561 @* Component *@ 1562 1563 @helper RenderSelectField(SelectField settings) 1564 { 1565 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1566 { 1567 settings.Id = Guid.NewGuid().ToString("N"); 1568 } 1569 1570 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod"> 1571 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null ) 1572 { 1573 <div class="u-full-width"> 1574 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } 1575 @if (settings.Link != null) { 1576 <div class="u-pull--right"> 1577 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } 1578 @Render(settings.Link) 1579 </div> 1580 } 1581 </div> 1582 } 1583 1584 @if (!string.IsNullOrEmpty(settings.HelpText)) 1585 { 1586 <small class="form__help-text">@settings.HelpText</small> 1587 } 1588 1589 @if (settings.ActionButton != null) 1590 { 1591 settings.ActionButton.CssClass += " btn--condensed u-no-margin"; 1592 <div class="form__field-combi u-no-margin dw-mod"> 1593 @RenderSelectBase(settings) 1594 @Render(settings.ActionButton) 1595 </div> 1596 } 1597 else 1598 { 1599 @RenderSelectBase(settings) 1600 } 1601 1602 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1603 </div> 1604 } 1605 1606 @helper RenderSelectBase(SelectField settings) 1607 { 1608 var attributes = new Dictionary<string, string>(); 1609 1610 /*base settings*/ 1611 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1612 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1613 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1614 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1615 if (settings.Required) { attributes.Add("required", "true"); } 1616 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1617 /*end*/ 1618 1619 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1620 1621 <select @ComponentMethods.AddAttributes(resultAttributes) class="u-full-width @settings.CssClass dw-mod"> 1622 @if (settings.Default != null) 1623 { 1624 @Render(settings.Default) 1625 } 1626 1627 @foreach (var item in settings.Options) 1628 { 1629 if (settings.Value != null) { 1630 item.Checked = item.Value == settings.Value; 1631 } 1632 @Render(item) 1633 } 1634 </select> 1635 } 1636 @using System.Reflection 1637 @using Dynamicweb.Rapido.Blocks.Components.General 1638 @using Dynamicweb.Rapido.Blocks.Components 1639 1640 @* Component *@ 1641 1642 @helper RenderRadioButtonField(RadioButtonField settings) 1643 { 1644 var attributes = new Dictionary<string, string>(); 1645 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1646 { 1647 settings.Id = Guid.NewGuid().ToString("N"); 1648 } 1649 1650 /*base settings*/ 1651 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1652 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1653 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1654 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1655 if (settings.Required) { attributes.Add("required", "true"); } 1656 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1657 /*end*/ 1658 1659 attributes.Add("type", "radio"); 1660 if (settings.Checked) { attributes.Add("checked", "true"); } 1661 settings.CssClass = "form__control " + settings.CssClass; 1662 if (settings.Value != null) { attributes.Add("value", settings.Value); } 1663 1664 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1665 1666 <div class="form__field-group @settings.WrapperCssClass dw-mod"> 1667 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1668 @if (!string.IsNullOrEmpty(settings.Label)) 1669 { 1670 <label for="@settings.Id" class="dw-mod">@settings.Label</label> 1671 } 1672 @if (!string.IsNullOrEmpty(settings.HelpText)) 1673 { 1674 <small class="form__help-text">@settings.HelpText</small> 1675 } 1676 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1677 </div> 1678 } 1679 @using System.Reflection 1680 @using Dynamicweb.Rapido.Blocks.Components.General 1681 @using Dynamicweb.Rapido.Blocks.Components 1682 1683 1684 @* Component *@ 1685 1686 @helper RenderRadioButtonListField(RadioButtonListField settings) 1687 { 1688 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; } 1689 1690 <div class="form__field-group @settings.WrapperCssClass u-margin-bottom dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1691 @if (!string.IsNullOrEmpty(settings.Label)) 1692 { 1693 <label>@settings.Label</label> 1694 } 1695 @if (!string.IsNullOrEmpty(settings.HelpText)) 1696 { 1697 <small class="form__help-text">@settings.HelpText</small> 1698 } 1699 1700 @foreach (var item in settings.Options) 1701 { 1702 if (settings.Required) 1703 { 1704 item.Required = true; 1705 } 1706 if (settings.Disabled) 1707 { 1708 item.Disabled = true; 1709 } 1710 if (!string.IsNullOrEmpty(settings.Name)) 1711 { 1712 item.Name = settings.Name; 1713 } 1714 if (settings.Value != null && settings.Value == item.Value) 1715 { 1716 item.Checked = true; 1717 } 1718 if (!string.IsNullOrEmpty(settings.OnClick)) 1719 { 1720 item.OnClick += settings.OnClick; 1721 } 1722 if (!string.IsNullOrEmpty(settings.OnChange)) 1723 { 1724 item.OnChange += settings.OnChange; 1725 } 1726 if (!string.IsNullOrEmpty(settings.CssClass)) 1727 { 1728 item.CssClass += settings.CssClass; 1729 } 1730 @Render(item) 1731 } 1732 1733 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1734 </div> 1735 } 1736 @using System.Reflection 1737 @using Dynamicweb.Rapido.Blocks.Components.General 1738 @using Dynamicweb.Rapido.Blocks.Components 1739 1740 1741 @* Component *@ 1742 1743 @helper RenderNotificationMessage(NotificationMessage settings) 1744 { 1745 if (!string.IsNullOrEmpty(settings.Message)) 1746 { 1747 var attributes = new Dictionary<string, string>(); 1748 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1749 1750 string messageTypeClass = Enum.GetName(typeof(NotificationMessageType), settings.MessageType).ToLower(); 1751 string messageLayoutClass = Enum.GetName(typeof(NotificationMessageLayout), settings.MessageLayout).ToLower(); 1752 string minHeightClass = settings.Icon != null ? "u-min-h70px" : ""; 1753 1754 <div class="notification-message-@messageTypeClass notification-message-@messageLayoutClass @messageLayoutClass @minHeightClass @settings.CssClass u-full-width dw-mod" @ComponentMethods.AddAttributes(attributes)> 1755 @if (settings.Icon != null) { 1756 settings.Icon.Label = !string.IsNullOrEmpty(settings.Icon.Label) ? settings.Message + settings.Icon.Label : settings.Message; 1757 @Render(settings.Icon) 1758 } else { 1759 @settings.Message 1760 } 1761 </div> 1762 } 1763 } 1764 @using Dynamicweb.Rapido.Blocks.Components.General 1765 1766 1767 @* Component *@ 1768 1769 @helper RenderHandlebarsRoot(HandlebarsRoot settings) { 1770 string preRender = !String.IsNullOrEmpty(settings.PreRenderScriptTemplate) ? "data-pre-render-template=\"" + settings.PreRenderScriptTemplate + "\"" : ""; 1771 1772 <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> 1773 @if (settings.SubBlocks != null) { 1774 @RenderBlockList(settings.SubBlocks) 1775 } 1776 </div> 1777 } 1778 @using System.Reflection 1779 @using Dynamicweb.Rapido.Blocks.Components.General 1780 @using Dynamicweb.Rapido.Blocks.Components 1781 @using System.Text.RegularExpressions 1782 1783 1784 @* Component *@ 1785 1786 @helper RenderSticker(Sticker settings) { 1787 if (!String.IsNullOrEmpty(settings.Title)) { 1788 string size = settings.Size.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Size.ToString().ToLower() : ""; 1789 string style = settings.Style.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Style.ToString().ToLower() : ""; 1790 1791 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>(); 1792 if (!String.IsNullOrEmpty(settings.Color) || !String.IsNullOrEmpty(settings.BackgroundColor)) { 1793 string styleTag = !String.IsNullOrEmpty(settings.Color) ? "color: " + settings.Color + "; " : ""; 1794 styleTag += !String.IsNullOrEmpty(settings.BackgroundColor) ? "background-color: " + settings.BackgroundColor + "; " : ""; 1795 optionalAttributes.Add("style", styleTag); 1796 } 1797 1798 <div class="stickers-container__tag @size @style @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Title</div> 1799 } 1800 } 1801 1802 @using System.Reflection 1803 @using Dynamicweb.Rapido.Blocks.Components.General 1804 @using Dynamicweb.Rapido.Blocks.Components 1805 1806 1807 @* Component *@ 1808 1809 @helper RenderStickersCollection(StickersCollection settings) 1810 { 1811 if (settings.Stickers.Count > 0) 1812 { 1813 string position = "stickers-container--" + Regex.Replace(settings.Position.ToString(), "([a-z])([A-Z])", "$1-$2").ToLower(); 1814 1815 <div class="stickers-container @position @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1816 @foreach (Sticker sticker in settings.Stickers) 1817 { 1818 @Render(sticker) 1819 } 1820 </div> 1821 } 1822 } 1823 1824 @using Dynamicweb.Rapido.Blocks.Components.General 1825 1826 1827 @* Component *@ 1828 1829 @helper RenderForm(Form settings) { 1830 if (settings != null) 1831 { 1832 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>(); 1833 if (!string.IsNullOrEmpty(settings.Action)) { optionalAttributes.Add("action", settings.Action); }; 1834 if (!string.IsNullOrEmpty(settings.Name)) { optionalAttributes.Add("name", settings.Name); }; 1835 if (!string.IsNullOrEmpty(settings.OnSubmit)) { optionalAttributes.Add("onsubmit", settings.OnSubmit); }; 1836 var enctypes = new Dictionary<string, string> 1837 { 1838 { "multipart", "multipart/form-data" }, 1839 { "text", "text/plain" }, 1840 { "application", "application/x-www-form-urlencoded" } 1841 }; 1842 if (settings.Enctype != FormEnctype.none) { optionalAttributes.Add("enctype", enctypes[Enum.GetName(typeof(FormEnctype), settings.Enctype).ToLower()]); }; 1843 optionalAttributes.Add("method", settings.Method.ToString()); 1844 1845 if (!string.IsNullOrEmpty(settings.FormStartMarkup)) 1846 { 1847 @settings.FormStartMarkup 1848 } 1849 else 1850 { 1851 @:<form class="@settings.CssClass u-no-margin dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1852 } 1853 1854 foreach (var field in settings.GetFields()) 1855 { 1856 @Render(field) 1857 } 1858 1859 @:</form> 1860 } 1861 } 1862 @using System.Reflection 1863 @using Dynamicweb.Rapido.Blocks.Components.General 1864 @using Dynamicweb.Rapido.Blocks.Components 1865 1866 1867 @* Component *@ 1868 1869 @helper RenderText(Text settings) 1870 { 1871 @settings.Content 1872 } 1873 @using System.Reflection 1874 @using Dynamicweb.Rapido.Blocks.Components.General 1875 @using Dynamicweb.Rapido.Blocks.Components 1876 1877 1878 @* Component *@ 1879 1880 @helper RenderContentModule(ContentModule settings) { 1881 if (!string.IsNullOrEmpty(settings.Content)) 1882 { 1883 @settings.Content 1884 } 1885 } 1886 @using System.Reflection 1887 @using Dynamicweb.Rapido.Blocks.Components.General 1888 @using Dynamicweb.Rapido.Blocks.Components 1889 1890 1891 @* Component *@ 1892 1893 @helper RenderModal(Modal settings) { 1894 if (settings != null) 1895 { 1896 string modalId = !string.IsNullOrEmpty(settings.Id) ? settings.Id : Guid.NewGuid().ToString("N"); 1897 1898 string onchange = !string.IsNullOrEmpty(settings.OnClose) ? "onchange=\"if(!this.checked){" + settings.OnClose + "}\"" : ""; 1899 1900 <input type="checkbox" id="@(modalId)ModalTrigger" class="modal-trigger" @onchange /> 1901 1902 <div class="modal-container"> 1903 @if (!settings.DisableDarkOverlay) 1904 { 1905 <label for="@(modalId)ModalTrigger" id="@(modalId)ModalOverlay" class="modal-overlay"></label> 1906 } 1907 <div class="modal modal--@settings.Width.ToString().ToLower() modal-height--@settings.Height.ToString().ToLower()" id="@(modalId)Modal"> 1908 @if (settings.Heading != null) 1909 { 1910 if (!string.IsNullOrEmpty(settings.Heading.Title)) 1911 { 1912 <div class="modal__header"> 1913 @Render(settings.Heading) 1914 </div> 1915 } 1916 } 1917 <div class="modal__body @(settings.Width.ToString().ToLower() == "full" ? "modal__body--full" : "")"> 1918 @if (!string.IsNullOrEmpty(settings.BodyText)) 1919 { 1920 @settings.BodyText 1921 } 1922 @if (settings.BodyTemplate != null) 1923 { 1924 @settings.BodyTemplate 1925 } 1926 @{ 1927 var actions = settings.GetActions(); 1928 } 1929 </div> 1930 @if (actions.Length > 0) 1931 { 1932 <div class="modal__footer"> 1933 @foreach (var action in actions) 1934 { 1935 if (Pageview.Device.ToString() != "Mobile") { 1936 action.CssClass += " u-no-margin"; 1937 } else { 1938 action.CssClass += " u-full-width u-margin-bottom"; 1939 } 1940 1941 @Render(action) 1942 } 1943 </div> 1944 } 1945 <label class="modal__close-btn" for="@(modalId)ModalTrigger"></label> 1946 </div> 1947 </div> 1948 } 1949 } 1950 @using Dynamicweb.Rapido.Blocks.Components.General 1951 1952 @* Component *@ 1953 1954 @helper RenderMediaListItem(MediaListItem settings) 1955 { 1956 <div class="media-list-item @settings.CssClass dw-mod" @(!string.IsNullOrEmpty(settings.Id) ? "id=\"" + settings.Id + "\"" : "")> 1957 @if (!string.IsNullOrEmpty(settings.Label)) 1958 { 1959 if (!string.IsNullOrEmpty(settings.Link)) 1960 { 1961 @Render(new Link 1962 { 1963 Href = settings.Link, 1964 CssClass = "media-list-item__sticker dw-mod", 1965 ButtonLayout = ButtonLayout.None, 1966 Title = settings.Label, 1967 OnClick = !string.IsNullOrEmpty(settings.OnClick) ? settings.OnClick : "" 1968 }) 1969 } 1970 else if (!string.IsNullOrEmpty(settings.OnClick)) 1971 { 1972 <span class="media-list-item__sticker dw-mod" onclick="@(settings.OnClick)"> 1973 <span class="u-uppercase">@settings.Label</span> 1974 </span> 1975 } 1976 else 1977 { 1978 <span class="media-list-item__sticker media-list-item__sticker--no-link dw-mod"> 1979 <span class="u-uppercase">@settings.Label</span> 1980 </span> 1981 } 1982 } 1983 <div class="media-list-item__wrap"> 1984 <div class="media-list-item__info dw-mod"> 1985 <div class="media-list-item__header dw-mod"> 1986 @if (!string.IsNullOrEmpty(settings.Title)) 1987 { 1988 if (!string.IsNullOrEmpty(settings.Link)) 1989 { 1990 @Render(new Link 1991 { 1992 Href = settings.Link, 1993 CssClass = "media-list-item__name dw-mod", 1994 ButtonLayout = ButtonLayout.None, 1995 Title = settings.Title, 1996 OnClick = !string.IsNullOrEmpty(settings.OnClick) ? settings.OnClick : "" 1997 }) 1998 } 1999 else if (!string.IsNullOrEmpty(settings.OnClick)) 2000 { 2001 <span class="media-list-item__name dw-mod" onclick="@(settings.OnClick)">@settings.Title</span> 2002 } 2003 else 2004 { 2005 <span class="media-list-item__name media-list-item__name--no-link dw-mod">@settings.Title</span> 2006 } 2007 } 2008 2009 @if (!string.IsNullOrEmpty(settings.Status)) 2010 { 2011 <div class="media-list-item__state dw-mod">@settings.Status</div> 2012 } 2013 </div> 2014 @{ 2015 settings.InfoTable.CssClass += " media-list-item__parameters-table"; 2016 } 2017 2018 @Render(settings.InfoTable) 2019 </div> 2020 <div class="media-list-item__actions dw-mod"> 2021 <div class="media-list-item__actions-list dw-mod"> 2022 @{ 2023 var actions = settings.GetActions(); 2024 2025 foreach (ButtonBase action in actions) 2026 { 2027 action.ButtonLayout = ButtonLayout.None; 2028 action.CssClass += " media-list-item__action link"; 2029 2030 @Render(action) 2031 } 2032 } 2033 </div> 2034 2035 @if (settings.SelectButton != null && !string.IsNullOrEmpty(settings.SelectButton.Title)) 2036 { 2037 settings.SelectButton.CssClass += " u-no-margin"; 2038 2039 <div class="media-list-item__action-button"> 2040 @Render(settings.SelectButton) 2041 </div> 2042 } 2043 </div> 2044 </div> 2045 </div> 2046 } 2047 @using Dynamicweb.Rapido.Blocks.Components.General 2048 @using Dynamicweb.Rapido.Blocks.Components 2049 2050 @helper RenderTable(Table settings) 2051 { 2052 Dictionary<string, string> attributes = new Dictionary<string, string>(); 2053 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 2054 2055 var enumToClasses = new Dictionary<TableDesign, string> 2056 { 2057 { TableDesign.Clean, "table--clean" }, 2058 { TableDesign.Bordered, "table--bordered" }, 2059 { TableDesign.Striped, "table--striped" }, 2060 { TableDesign.Hover, "table--hover" }, 2061 { TableDesign.Compact, "table--compact" }, 2062 { TableDesign.Condensed, "table--condensed" }, 2063 { TableDesign.NoTopBorder, "table--no-top-border" } 2064 }; 2065 string tableDesignClass = ""; 2066 if (settings.Design != TableDesign.None) 2067 { 2068 tableDesignClass = enumToClasses[settings.Design]; 2069 } 2070 2071 if (!string.IsNullOrEmpty(settings.CssClass) || settings.Design != TableDesign.None) { attributes.Add("class", "table " + tableDesignClass + " " + settings.CssClass + " dw-mod"); } 2072 2073 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value); 2074 2075 <table @ComponentMethods.AddAttributes(resultAttributes)> 2076 @if (settings.Header != null) 2077 { 2078 <thead> 2079 @Render(settings.Header) 2080 </thead> 2081 } 2082 <tbody> 2083 @foreach (var row in settings.Rows) 2084 { 2085 @Render(row) 2086 } 2087 </tbody> 2088 @if (settings.Footer != null) 2089 { 2090 <tfoot> 2091 @Render(settings.Footer) 2092 </tfoot> 2093 } 2094 </table> 2095 } 2096 @using Dynamicweb.Rapido.Blocks.Components.General 2097 @using Dynamicweb.Rapido.Blocks.Components 2098 2099 @helper RenderTableRow(TableRow settings) 2100 { 2101 Dictionary<string, string> attributes = new Dictionary<string, string>(); 2102 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 2103 2104 var enumToClasses = new Dictionary<TableRowDesign, string> 2105 { 2106 { TableRowDesign.NoBorder, "table__row--no-border" }, 2107 { TableRowDesign.Border, "table__row--border" }, 2108 { TableRowDesign.TopBorder, "table__row--top-line" }, 2109 { TableRowDesign.BottomBorder, "table__row--bottom-line" }, 2110 { TableRowDesign.Solid, "table__row--solid" } 2111 }; 2112 2113 string tableRowDesignClass = ""; 2114 if (settings.Design != TableRowDesign.None) 2115 { 2116 tableRowDesignClass = enumToClasses[settings.Design]; 2117 } 2118 2119 if (!string.IsNullOrEmpty(settings.CssClass) || settings.Design != TableRowDesign.None) { attributes.Add("class", "table__row " + tableRowDesignClass + " " + settings.CssClass + " dw-mod"); } 2120 2121 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value); 2122 2123 <tr @ComponentMethods.AddAttributes(resultAttributes)> 2124 @foreach (var cell in settings.Cells) 2125 { 2126 if (settings.IsHeaderRow) 2127 { 2128 cell.IsHeader = true; 2129 } 2130 @Render(cell) 2131 } 2132 </tr> 2133 } 2134 @using Dynamicweb.Rapido.Blocks.Components.General 2135 @using Dynamicweb.Rapido.Blocks.Components 2136 @using Dynamicweb.Core 2137 2138 @helper RenderTableCell(TableCell settings) 2139 { 2140 Dictionary<string, string> attributes = new Dictionary<string, string>(); 2141 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 2142 if (settings.Colspan != 0) { attributes.Add("colspan", Converter.ToString(settings.Colspan)); } 2143 if (settings.Rowspan != 0) { attributes.Add("rowspan", Converter.ToString(settings.Rowspan)); } 2144 if (!string.IsNullOrEmpty(settings.CssClass)) { attributes.Add("class", settings.CssClass + " dw-mod"); } 2145 2146 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value); 2147 2148 string tagName = settings.IsHeader ? "th" : "td"; 2149 2150 @("<" + tagName + " " + ComponentMethods.AddAttributes(resultAttributes) + ">") 2151 @settings.Content 2152 @("</" + tagName + ">"); 2153 } 2154 @using System.Linq 2155 @using Dynamicweb.Rapido.Blocks.Components.General 2156 2157 @* Component *@ 2158 2159 @helper RenderPagination(Dynamicweb.Rapido.Blocks.Components.General.Pagination settings) 2160 { 2161 var pageNumberQueryStringName = Dynamicweb.Rapido.Services.Pagination.GetPageNumberQueryStringName(settings); // Get the proper 'page number' query string parameter 2162 var queryParameters = Dynamicweb.Rapido.Services.Url.GetQueryParameters(pageNumberQueryStringName); // Get the NameValueCollection from the querystring 2163 2164 if (settings.NumberOfPages > 1) 2165 { 2166 string url = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + "/Default.aspx"; 2167 string ariaLabel = !string.IsNullOrWhiteSpace(settings.AriaLabel) ? settings.AriaLabel : Translate("Page navigation"); 2168 Dictionary<string, int> startAndEndPageNumber = Dynamicweb.Rapido.Services.Pagination.GetStartAndEndPageNumber(settings); 2169 2170 <div class="pager u-margin-top dw-mod @settings.CssClass" aria-label="@ariaLabel"> 2171 @if (settings.ShowPagingInfo) 2172 { 2173 <div class="pager__info dw-mod"> 2174 @Translate("Page") @settings.CurrentPageNumber @Translate("of") @settings.NumberOfPages 2175 </div> 2176 } 2177 <ul class="pager__list dw-mod"> 2178 @if (!string.IsNullOrWhiteSpace(settings.FirstPageUrl) && settings.ShowFirstAndLastControls) 2179 { 2180 @Render(new PaginationItem { Link = settings.FirstPageUrl, Icon = settings.FirstIcon }) 2181 } 2182 @if (!string.IsNullOrWhiteSpace(settings.PreviousPageUrl) && settings.ShowNextAndPrevControls) 2183 { 2184 @Render(new PaginationItem { Link = settings.PreviousPageUrl, Icon = settings.PrevIcon }) 2185 } 2186 @if (settings.GetPages().Any()) 2187 { 2188 foreach (var page in settings.GetPages()) 2189 { 2190 @Render(page) 2191 } 2192 } 2193 else 2194 { 2195 for (var page = startAndEndPageNumber["StartPage"]; page <= startAndEndPageNumber["EndPage"]; page++) 2196 { 2197 queryParameters = Dynamicweb.Rapido.Services.Url.UpdateQueryStringParameter(queryParameters, pageNumberQueryStringName, page.ToString()); 2198 @Render(new PaginationItem { Label = page.ToString(), Link = Dynamicweb.Rapido.Services.Url.BuildUri(url, queryParameters).PathAndQuery, IsActive = (settings.CurrentPageNumber == page) }); 2199 } 2200 } 2201 @if (!string.IsNullOrWhiteSpace(settings.NextPageUrl) && settings.ShowNextAndPrevControls) 2202 { 2203 @Render(new PaginationItem { Link = settings.NextPageUrl, Icon = settings.NextIcon }) 2204 } 2205 @if (!string.IsNullOrWhiteSpace(settings.LastPageUrl) && settings.ShowFirstAndLastControls) 2206 { 2207 @Render(new PaginationItem { Link = settings.LastPageUrl, Icon = settings.LastIcon }) 2208 } 2209 </ul> 2210 </div> 2211 } 2212 } 2213 2214 @helper RenderPaginationItem(PaginationItem settings) 2215 { 2216 if (settings.Icon == null) 2217 { 2218 settings.Icon = new Icon(); 2219 } 2220 2221 settings.Icon.Label = settings.Label; 2222 <li class="pager__btn dw-mod"> 2223 @if (settings.IsActive) 2224 { 2225 <span class="pager__num pager__num--current dw-mod"> 2226 @Render(settings.Icon) 2227 </span> 2228 } 2229 else 2230 { 2231 <a href="@settings.Link" class="pager__num dw-mod"> 2232 @Render(settings.Icon) 2233 </a> 2234 } 2235 </li> 2236 } 2237 2238 2239 @using Dynamicweb.Rapido.Blocks.Components.General 2240 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 2241 2242 2243 @using Dynamicweb.Frontend 2244 @using System.Reflection 2245 @using Dynamicweb.Content.Items 2246 @using System.Web.UI.HtmlControls 2247 @using Dynamicweb.Rapido.Blocks.Components 2248 @using Dynamicweb.Rapido.Blocks 2249 @using Dynamicweb.Rapido.Blocks.Components.Articles 2250 2251 @* Components for the articles *@ 2252 @using System.Reflection 2253 @using Dynamicweb.Rapido.Blocks.Components.Articles 2254 2255 2256 @* Component for the articles *@ 2257 2258 @helper RenderArticleBanner(dynamic settings) { 2259 string filterClasses = "image-filter image-filter--darken"; 2260 settings.Layout = ArticleHeaderLayout.Banner; 2261 2262 if (settings.Image != null) 2263 { 2264 if (settings.Image.Path != null) 2265 { 2266 <section class="multiple-paragraphs-container u-color-light paragraph-container--full-width"> 2267 <div class="background-image @filterClasses dw-mod"> 2268 <div class="background-image__wrapper @filterClasses dw-mod"> 2269 @{ 2270 settings.Image.CssClass += "background-image__cover dw-mod"; 2271 } 2272 @Render(settings.Image) 2273 </div> 2274 </div> 2275 <div class="center-container dw-mod"> 2276 <div class="grid grid--align-content-start grid--justify-center dw-mod"> 2277 <div class="grid__col-md-8 grid__col-xs-12 paragraph-container paragraph-container--height-lg"> 2278 <div class="u-left-middle"> 2279 <div> 2280 @if (!String.IsNullOrEmpty(settings.Heading)) 2281 { 2282 <h1 class="article__header article__header--giant dw-mod" style="color: @settings.TextColor">@settings.Heading</h1> 2283 } 2284 @if (!String.IsNullOrEmpty(settings.Subheading)) 2285 { 2286 <div class="article__leadtext dw-mod" style="color: @settings.TextColor">@settings.Subheading</div> 2287 } 2288 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 2289 { 2290 <small class="article__post-info u-margin-bottom--lg dw-mod" style="color: @settings.TextColor">@settings.Author @settings.Date</small> 2291 } 2292 @if (!String.IsNullOrEmpty(settings.Link)) { 2293 <div class="grid__cell"> 2294 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 2295 </div> 2296 } 2297 </div> 2298 </div> 2299 </div> 2300 @if (settings.ExternalParagraphId != 0) 2301 { 2302 <div class="grid__col-md-4 grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-auto dw-mod"> 2303 <div class="u-color-light-gray--bg u-color-dark dw-mod"> 2304 @RenderParagraphContent(settings.ExternalParagraphId) 2305 </div> 2306 </div> 2307 } 2308 2309 </div> 2310 </div> 2311 </section> 2312 if (!String.IsNullOrEmpty(settings.Image.Caption)) { 2313 <div class="image-caption dw-mod">@settings.Image.Caption</div> 2314 } 2315 } 2316 else 2317 { 2318 settings.Layout = ArticleHeaderLayout.Clean; 2319 @RenderArticleCleanHeader(settings); 2320 } 2321 } 2322 else 2323 { 2324 settings.Layout = ArticleHeaderLayout.Clean; 2325 @RenderArticleCleanHeader(settings); 2326 } 2327 } 2328 @using System.Reflection 2329 @using Dynamicweb.Rapido.Blocks.Components 2330 @using Dynamicweb.Rapido.Blocks.Components.General 2331 @using Dynamicweb.Rapido.Blocks.Components.Articles 2332 @using Dynamicweb.Rapido.Blocks 2333 2334 2335 @* Component for the articles *@ 2336 2337 @helper RenderArticleHeader(ArticleHeader settings) { 2338 dynamic[] methodParameters = new dynamic[1]; 2339 methodParameters[0] = settings; 2340 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleHeaderCustom"); 2341 2342 if (customMethod != null) 2343 { 2344 @customMethod.Invoke(this, methodParameters).ToString(); 2345 } else { 2346 switch (settings.Layout) 2347 { 2348 case ArticleHeaderLayout.Clean: 2349 @RenderArticleCleanHeader(settings); 2350 break; 2351 case ArticleHeaderLayout.Split: 2352 @RenderArticleSplitHeader(settings); 2353 break; 2354 case ArticleHeaderLayout.Banner: 2355 @RenderArticleBannerHeader(settings); 2356 break; 2357 case ArticleHeaderLayout.Overlay: 2358 @RenderArticleOverlayHeader(settings); 2359 break; 2360 default: 2361 @RenderArticleCleanHeader(settings); 2362 break; 2363 } 2364 } 2365 } 2366 2367 @helper RenderArticleCleanHeader(ArticleHeader settings) { 2368 dynamic[] methodParameters = new dynamic[1]; 2369 methodParameters[0] = settings; 2370 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleCleanHeaderCustom"); 2371 2372 if (customMethod != null) 2373 { 2374 @customMethod.Invoke(this, methodParameters).ToString(); 2375 } 2376 else 2377 { 2378 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12"; 2379 2380 <div class="grid grid--align-content-start grid--justify-start"> 2381 <div class="grid__col-md-@contentColumns grid__col-sm-12 u-padding--lg dw-mod"> 2382 @if (!String.IsNullOrEmpty(settings.Category) || !String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date) || settings.RatingOutOf != 0) 2383 { 2384 <div class="u-border-bottom u-padding-bottom"> 2385 @if (!String.IsNullOrEmpty(settings.Category)) 2386 { 2387 <div class="u-pull--left"> 2388 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div> 2389 </div> 2390 } 2391 <div class="u-pull--right"> 2392 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 2393 { 2394 <small class="article__post-info dw-mod">@settings.Author @settings.Date</small> 2395 } 2396 @if (settings.RatingOutOf != 0) 2397 { 2398 @Render(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) 2399 } 2400 </div> 2401 </div> 2402 } 2403 2404 <div class="grid__cell"> 2405 @if (!String.IsNullOrEmpty(settings.Heading)) 2406 { 2407 <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1> 2408 } 2409 @if (settings.Image != null) 2410 { 2411 if (settings.Image.Path != null) 2412 { 2413 <div class="u-padding-bottom--lg"> 2414 @Render(settings.Image) 2415 </div> 2416 } 2417 } 2418 @if (!String.IsNullOrEmpty(settings.Subheading)) 2419 { 2420 <div class="article__leadtext dw-mod">@settings.Subheading</div> 2421 } 2422 @if (!String.IsNullOrEmpty(settings.Link)) 2423 { 2424 <div class="grid__cell"> 2425 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 2426 </div> 2427 } 2428 </div> 2429 </div> 2430 @if (settings.ExternalParagraphId != 0) 2431 { 2432 <div class="grid__col-md-4 grid__col-sm-12 u-padding--lg u-color-light-gray--bg dw-mod"> 2433 @RenderParagraphContent(settings.ExternalParagraphId) 2434 </div> 2435 } 2436 </div> 2437 } 2438 } 2439 2440 @helper RenderArticleSplitHeader(ArticleHeader settings) { 2441 dynamic[] methodParameters = new dynamic[1]; 2442 methodParameters[0] = settings; 2443 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSplitHeaderCustom"); 2444 2445 if (customMethod != null) 2446 { 2447 @customMethod.Invoke(this, methodParameters).ToString(); 2448 } 2449 else 2450 { 2451 string headerColumnWidth = settings.ExternalParagraphId != 0 ? "4" : "6"; 2452 2453 if (settings.Image != null) 2454 { 2455 if (settings.Image.Path != null) 2456 { 2457 <section class="multiple-paragraphs-container paragraph-container--full-width"> 2458 <div class="grid"> 2459 <div class="grid__col-md-@headerColumnWidth grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-xl dw-mod"> 2460 <div class="u-left-middle u-padding--lg"> 2461 <div> 2462 @if (!String.IsNullOrEmpty(settings.Category)) 2463 { 2464 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div> 2465 } 2466 @if (!String.IsNullOrEmpty(settings.Heading)) 2467 { 2468 <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1> 2469 } 2470 @if (!String.IsNullOrEmpty(settings.Subheading)) 2471 { 2472 <div class="article__leadtext dw-mod">@settings.Subheading</div> 2473 } 2474 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 2475 { 2476 <small class="article__post-info u-pull--left dw-mod">@settings.Author @settings.Date</small> 2477 } 2478 @if (settings.RatingOutOf != 0) 2479 { 2480 <div class="u-pull--right"> 2481 @Render(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) 2482 </div> 2483 } 2484 @if (!String.IsNullOrEmpty(settings.Link)) { 2485 <div class="u-full-width u-pull--left u-margin-top"> 2486 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 2487 </div> 2488 } 2489 </div> 2490 </div> 2491 </div> 2492 <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> 2493 @if (settings.ExternalParagraphId != 0) 2494 { 2495 <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"> 2496 @RenderParagraphContent(settings.ExternalParagraphId) 2497 </div> 2498 } 2499 </div> 2500 </section> 2501 } 2502 } 2503 else 2504 { 2505 @RenderArticleCleanHeader(settings); 2506 } 2507 } 2508 } 2509 2510 @helper RenderArticleOverlayHeader(ArticleHeader settings) { 2511 dynamic[] methodParameters = new dynamic[1]; 2512 methodParameters[0] = settings; 2513 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleOverlayHeaderCustom"); 2514 2515 if (customMethod != null) 2516 { 2517 @customMethod.Invoke(this, methodParameters).ToString(); 2518 } 2519 else 2520 { 2521 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12"; 2522 string contentAlignment = settings.TextLayout == ArticleHeaderTextLayout.Center ? "grid--justify-center" : ""; 2523 2524 if (settings.Image != null) 2525 { 2526 if (settings.Image.Path != null) 2527 { 2528 if (settings.ExternalParagraphId == 0) 2529 { 2530 <section class="multiple-paragraphs-container u-color-light paragraph-container--full-width"> 2531 <div class="background-image image-filter image-filter--darken dw-mod"> 2532 <div class="background-image__wrapper image-filter image-filter--darken dw-mod"> 2533 @{ 2534 settings.Image.CssClass += "background-image__cover dw-mod"; 2535 } 2536 @Render(settings.Image) 2537 </div> 2538 </div> 2539 <div class="center-container dw-mod"> 2540 <div class="grid @contentAlignment"> 2541 <div class="grid__col-md-@contentColumns grid__col-xs-12 paragraph-container paragraph-container--height-xl dw-mod"> 2542 @if (!string.IsNullOrEmpty(settings.Heading)) 2543 { 2544 <h1 class="article__header article__header--giant u-padding-top--lg dw-mod" style="color: @settings.TextColor">@settings.Heading</h1> 2545 } 2546 @if (!String.IsNullOrEmpty(settings.Subheading)) 2547 { 2548 <div class="article__leadtext dw-mod" style="color: @settings.TextColor">@settings.Subheading</div> 2549 } 2550 <div class="u-margin-top"> 2551 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 2552 { 2553 <small class="article__post-info u-pull--left dw-mod" style="color: @settings.TextColor">@settings.Author @settings.Date</small> 2554 } 2555 @if (settings.RatingOutOf != 0) 2556 { 2557 <div class="u-pull--right"> 2558 @Render(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) 2559 </div> 2560 } 2561 </div> 2562 @if (!String.IsNullOrEmpty(settings.Link)) 2563 { 2564 <div class="grid__cell"> 2565 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 2566 </div> 2567 } 2568 </div> 2569 </div> 2570 </div> 2571 </section> 2572 } 2573 else 2574 { 2575 @RenderArticleBanner(settings); 2576 } 2577 } 2578 } 2579 else 2580 { 2581 @RenderArticleCleanHeader(settings); 2582 } 2583 } 2584 } 2585 2586 @helper RenderArticleBannerHeader(dynamic settings) { 2587 dynamic[] methodParameters = new dynamic[1]; 2588 methodParameters[0] = settings; 2589 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleBannerHeaderCustom"); 2590 2591 if (customMethod != null) 2592 { 2593 @customMethod.Invoke(this, methodParameters).ToString(); 2594 } 2595 else 2596 { 2597 @RenderArticleBanner(settings); 2598 } 2599 } 2600 @using System.Reflection 2601 @using System.Text.RegularExpressions; 2602 @using Dynamicweb.Frontend 2603 @using Dynamicweb.Content.Items 2604 @using Dynamicweb.Rapido.Blocks.Components 2605 @using Dynamicweb.Rapido.Blocks.Components.Articles 2606 @using Dynamicweb.Rapido.Blocks 2607 2608 @* Component for the articles *@ 2609 2610 @helper RenderArticleBodyRow(ArticleBodyRow settings) 2611 { 2612 string position = settings.TopLayout == "overlay" ? "article__overlay-offset" : ""; 2613 string contentAlignment = settings.TextLayout == "center" ? "grid--justify-center" : ""; 2614 2615 <div class="grid grid--align-content-start body-row @contentAlignment @position dw-mod"> 2616 @RenderBlockList(settings.SubBlocks) 2617 </div> 2618 } 2619 @using System.Reflection 2620 @using Dynamicweb.Rapido.Blocks.Components 2621 @using Dynamicweb.Rapido.Blocks.Components.General 2622 @using Dynamicweb.Rapido.Blocks.Components.Articles 2623 @using Dynamicweb.Rapido.Blocks 2624 2625 @* Component for the articles *@ 2626 2627 @helper RenderArticleImage(ArticleImage settings) 2628 { 2629 if (settings.Image != null) 2630 { 2631 if (settings.Image.Path != null) 2632 { 2633 <div class="u-margin-bottom--lg"> 2634 @Render(settings.Image) 2635 </div> 2636 } 2637 } 2638 } 2639 @using System.Reflection 2640 @using Dynamicweb.Rapido.Blocks.Components 2641 @using Dynamicweb.Rapido.Blocks.Components.Articles 2642 2643 2644 @* Component for the articles *@ 2645 2646 @helper RenderArticleSubHeader(ArticleSubHeader settings) 2647 { 2648 if (!String.IsNullOrEmpty(settings.Title)) 2649 { 2650 <h2 class="article__header">@settings.Title</h2> 2651 } 2652 } 2653 @using System.Reflection 2654 @using Dynamicweb.Rapido.Blocks.Components 2655 @using Dynamicweb.Rapido.Blocks.Components.Articles 2656 @using Dynamicweb.Rapido.Blocks 2657 2658 2659 @* Component for the articles *@ 2660 2661 @helper RenderArticleText(ArticleText settings) 2662 { 2663 if (!String.IsNullOrEmpty(settings.Text)) 2664 { 2665 string greatTextClass = settings.EnableLargeText == true ? "article__paragraph--great-text" : ""; 2666 2667 <div class="article__paragraph @greatTextClass dw-mod"> 2668 @settings.Text 2669 </div> 2670 } 2671 } 2672 @using System.Reflection 2673 @using Dynamicweb.Rapido.Blocks.Components 2674 @using Dynamicweb.Rapido.Blocks.Components.Articles 2675 @using Dynamicweb.Rapido.Blocks 2676 2677 2678 @* Component for the articles *@ 2679 2680 @helper RenderArticleQuote(ArticleQuote settings) 2681 { 2682 string text = Regex.Replace(settings.Text, "<.*?>", String.Empty); 2683 2684 <div class="grid u-padding-bottom--lg"> 2685 @if (settings.Image != null) 2686 { 2687 if (settings.Image.Path != null) { 2688 <div class="grid__col-3"> 2689 <div class="grid__cell-img"> 2690 @{ 2691 settings.Image.Title = !String.IsNullOrEmpty(settings.Image.Title) ? settings.Image.Title : settings.Author; 2692 settings.Image.CssClass += " article__image article__image--ball"; 2693 settings.Image.ImageDefault.Width = 200; 2694 settings.Image.ImageDefault.Height = 200; 2695 } 2696 @Render(settings.Image) 2697 </div> 2698 </div> 2699 } 2700 } 2701 <div class="grid__col-auto"> 2702 @if (!String.IsNullOrEmpty(settings.Text)) 2703 { 2704 <div class="article__quote dw-mod"> 2705 <i class="fas fa-quote-right u-margin-bottom--lg"></i> 2706 @settings.Text 2707 <i class="fas fa-quote-right"></i> 2708 </div> 2709 } 2710 @if (!String.IsNullOrEmpty(settings.Author)) 2711 { 2712 <div class="article__quote-author dw-mod"> 2713 - @settings.Author 2714 </div> 2715 } 2716 </div> 2717 </div> 2718 } 2719 @using System.Reflection 2720 @using Dynamicweb.Rapido.Blocks.Components 2721 @using Dynamicweb.Rapido.Blocks.Components.Articles 2722 @using Dynamicweb.Rapido.Blocks 2723 2724 @* Component for the articles *@ 2725 2726 @helper RenderArticleInfoTable(ArticleInfoTable settings) 2727 { 2728 <table class="table table--clean"> 2729 @foreach (var row in settings.Rows) 2730 { 2731 string iconColor = row.IconColor != null ? row.IconColor : "u-brand-color-two"; 2732 2733 <tr> 2734 @if (!String.IsNullOrEmpty(row.Icon)) 2735 { 2736 <td class="u-w32px"><i class="@row.Icon fa-2x @row.IconColor"></i></td> 2737 } 2738 <td class="u-no-margin-on-p-elements"> 2739 <div class="u-bold">@row.Title</div> 2740 @if (!String.IsNullOrEmpty(row.SubTitle)) 2741 { 2742 if (row.Link == null) 2743 { 2744 <div>@row.SubTitle</div> 2745 } 2746 else 2747 { 2748 <a href="@row.Link" class="u-color-inherit">@row.SubTitle</a> 2749 } 2750 } 2751 </td> 2752 </tr> 2753 } 2754 </table> 2755 } 2756 @using System.Reflection 2757 @using Dynamicweb.Rapido.Blocks.Components 2758 @using Dynamicweb.Rapido.Blocks.Components.General 2759 @using Dynamicweb.Rapido.Blocks.Components.Articles 2760 @using Dynamicweb.Rapido.Blocks 2761 2762 @* Component for the articles *@ 2763 2764 @helper RenderArticleGalleryModal(ArticleGalleryModal settings) 2765 { 2766 Modal galleryModal = new Modal 2767 { 2768 Id = "ParagraphGallery", 2769 Width = ModalWidth.Full, 2770 BodyTemplate = RenderArticleGalleryModalContent() 2771 }; 2772 2773 @Render(galleryModal) 2774 } 2775 2776 @helper RenderArticleGalleryModalContent() { 2777 <div class="modal__image-min-size-wrapper"> 2778 @Render(new Image { 2779 Id = "ParagraphGallery", 2780 Path = "#", 2781 CssClass = "modal--full__img", 2782 DisableLazyLoad = true, 2783 DisableImageEngine = true 2784 }) 2785 </div> 2786 2787 <div class="modal__images-counter" id="ParagraphGallery_counter"></div> 2788 2789 @Render(new Button { 2790 Id = "ParagraphGallery_prev", 2791 ButtonType = ButtonType.Button, 2792 ButtonLayout = ButtonLayout.None, 2793 CssClass = "modal__prev-btn", 2794 Icon = new Icon { Prefix = "far", Name = "fa-angle-left", LabelPosition = IconLabelPosition.After }, 2795 OnClick = "Gallery.prevImage('ParagraphGallery')" 2796 }) 2797 2798 @Render(new Button { 2799 Id = "ParagraphGallery_next", 2800 ButtonType = ButtonType.Button, 2801 ButtonLayout = ButtonLayout.None, 2802 CssClass = "modal__next-btn", 2803 Icon = new Icon { Prefix = "far", Name = "fa-angle-right", LabelPosition = IconLabelPosition.After }, 2804 OnClick = "Gallery.nextImage('ParagraphGallery')" 2805 }) 2806 } 2807 @using System.Reflection 2808 @using Dynamicweb.Rapido.Blocks.Components 2809 @using Dynamicweb.Rapido.Blocks.Components.Articles 2810 @using Dynamicweb.Rapido.Blocks 2811 2812 2813 @* Component for the articles *@ 2814 2815 @helper RenderArticleRelated(ArticleRelated settings) 2816 { 2817 string cardClass = Pageview.Device.ToString() != "Tablet" ? "card u-color-light--bg u-full-height" : ""; 2818 string cardFooterClass = Pageview.Device.ToString() != "Tablet" ? "card-footer u-color-light--bg" : ""; 2819 2820 <section class="multiple-paragraphs-container u-color-light-gray--bg paragraph-container--full-width"> 2821 <div class="center-container dw-mod"> 2822 <div class="grid u-padding"> 2823 <div class="grid__col-md-12 grid__col-xs-12"> 2824 <h2 class="article__header u-no-margin u-margin-top">@settings.Title</h2> 2825 </div> 2826 </div> 2827 2828 <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> 2829 2830 <script id="RelatedSimpleTemplate" type="text/x-template"> 2831 {{#.}} 2832 <div class="grid u-padding-bottom--lg"> 2833 {{#Cases}} 2834 <div class="grid__col-lg-3 grid__col-sm-6 image-hover--zoom dw-mod"> 2835 <a href="{{link}}" class="u-full-height u-color-light--bg u-flex u-flex--column"> 2836 {{#if image}} 2837 <div class="u-color-light--bg u-no-padding dw-mod"> 2838 <div class="flex-img image-hover__wrapper"> 2839 <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}}" /> 2840 </div> 2841 </div> 2842 {{/if}} 2843 2844 <div class="card u-color-light--bg u-full-height dw-mod"> 2845 <h3 class="article-list__item-header u-truncate-text dw-mod">{{title}}</h3> 2846 <p class="article__short-summary dw-mod">{{summary}}</p> 2847 </div> 2848 </a> 2849 </div> 2850 {{/Cases}} 2851 </div> 2852 {{/.}} 2853 </script> 2854 </div> 2855 </section> 2856 } 2857 @using System.Reflection 2858 @using Dynamicweb.Rapido.Blocks.Components 2859 @using Dynamicweb.Rapido.Blocks.Components.Articles 2860 @using Dynamicweb.Rapido.Blocks 2861 2862 2863 @* Component for the articles *@ 2864 2865 @helper RenderArticleMenu(ArticleMenu settings) 2866 { 2867 if (!String.IsNullOrEmpty(settings.Title)) { 2868 <div class="u-margin u-border-bottom"> 2869 <h3 class="u-no-margin">@settings.Title</h3> 2870 </div> 2871 } 2872 2873 <ul class="menu-left u-margin-bottom dw-mod"> 2874 @foreach (var item in settings.Items) 2875 { 2876 @Render(item) 2877 } 2878 </ul> 2879 } 2880 2881 @helper RenderArticleMenuItem(ArticleMenuItem settings) 2882 { 2883 string link = !String.IsNullOrEmpty(settings.Link) ? settings.Link : "#"; 2884 2885 if (!String.IsNullOrEmpty(settings.Title)) { 2886 <li class="menu-left__item dw-mod"> 2887 <a href="@link" onclick="@settings.OnClick" class="menu-left__link dw-mod">@settings.Title</a> 2888 </li> 2889 } 2890 } 2891 @using System.Reflection 2892 @using Dynamicweb.Rapido.Blocks.Components 2893 @using Dynamicweb.Rapido.Blocks.Components.Articles 2894 @using Dynamicweb.Rapido.Blocks 2895 2896 @* Component for the articles *@ 2897 2898 @helper RenderArticleList(ArticleList settings) 2899 { 2900 if (Pageview != null) 2901 { 2902 bool isParagraph = Pageview.CurrentParagraph != null ? true : false; 2903 string[] sortArticlesListBy = new string[2]; 2904 2905 if (isParagraph) { 2906 sortArticlesListBy = Pageview.CurrentParagraph.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString()) ? Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" }; 2907 } 2908 else { 2909 sortArticlesListBy = Pageview.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.Item["SortArticlesListBy"].ToString()) ? Pageview.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" }; 2910 } 2911 2912 string sourcePage = settings.SourcePage != null ? settings.SourcePage : Pageview.ID.ToString(); 2913 2914 if (!settings.DisablePagination) { 2915 @RenderItemList(new 2916 { 2917 ItemType = !String.IsNullOrEmpty(settings.ItemType) ? settings.ItemType : "DynamicArticle", 2918 ListSourceType = settings.SourceType, 2919 ListSourcePage = sourcePage, 2920 ItemFieldsList = "*", 2921 Filter = settings.Filter, 2922 ListOrderBy = sortArticlesListBy[0], 2923 ListOrderByDirection = sortArticlesListBy[1], 2924 ListSecondOrderBy = sortArticlesListBy[0] == "Date" ? "InFocusSortId" : "Date", 2925 ListSecondOrderByDirection = "ASC", 2926 IncludeAllChildItems = true, 2927 ListTemplate = settings.Template, 2928 ListPageSize = settings.PageSize.ToString() 2929 }); 2930 } else { 2931 @RenderItemList(new 2932 { 2933 ItemType = !String.IsNullOrEmpty(settings.ItemType) ? settings.ItemType : "DynamicArticle", 2934 ListSourceType = settings.SourceType, 2935 ListSourcePage = sourcePage, 2936 ItemFieldsList = "*", 2937 Filter = settings.Filter, 2938 ListOrderBy = sortArticlesListBy[0], 2939 ListOrderByDirection = sortArticlesListBy[1], 2940 ListSecondOrderBy = sortArticlesListBy[0] == "Date" ? "InFocusSortId" : "Date", 2941 ListSecondOrderByDirection = "ASC", 2942 IncludeAllChildItems = true, 2943 ListTemplate = settings.Template, 2944 ListPageSize = settings.PageSize.ToString(), 2945 ListViewMode = "Partial", 2946 ListShowTo = settings.PageSize + 1 2947 }); 2948 } 2949 } 2950 } 2951 @using System.Reflection 2952 @using Dynamicweb.Rapido.Blocks.Components.Articles 2953 2954 2955 @* Component for the articles *@ 2956 2957 @helper RenderArticleSummary(ArticleSummary settings) 2958 { 2959 if (!String.IsNullOrEmpty(settings.Text)) 2960 { 2961 <div class="article__summary dw-mod">@settings.Text</div> 2962 } 2963 } 2964 @using System.Reflection 2965 @using Dynamicweb.Rapido.Blocks.Components 2966 @using Dynamicweb.Rapido.Blocks.Components.Articles 2967 @using Dynamicweb.Rapido.Blocks 2968 2969 @* Component for the articles *@ 2970 2971 @helper RenderArticleListCategoryFilter(ArticleListCategoryFilter settings) 2972 { 2973 string pageId = Pageview.ID.ToString(); 2974 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("sourcePage")) ? HttpContext.Current.Request.QueryString.Get("sourcePage") : Translate("All"); 2975 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString()); 2976 2977 foreach (var option in settings.Categories) 2978 { 2979 selectedFilter = selectedFilter == option.Value ? option.Key : selectedFilter; 2980 } 2981 2982 if (selectedFilter == pageId) 2983 { 2984 selectedFilter = Translate("All"); 2985 } 2986 2987 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 2988 { 2989 <div class="u-pull--right u-margin-left"> 2990 <div class="collection u-no-margin"> 2991 <h5>@Translate("Category")</h5> 2992 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" /> 2993 <div class="dropdown u-w180px dw-mod"> 2994 <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label> 2995 <div class="dropdown__content dw-mod"> 2996 @foreach (var option in settings.Categories) 2997 { 2998 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div> 2999 } 3000 </div> 3001 <label class="dropdown-trigger-off" for="CategorySelector"></label> 3002 </div> 3003 </div> 3004 </div> 3005 } 3006 else 3007 { 3008 <div class="u-full-width u-margin-bottom"> 3009 <h5 class="u-no-margin">@Translate("Category")</h5> 3010 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" /> 3011 <div class="dropdown u-full-width dw-mod"> 3012 <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label> 3013 <div class="dropdown__content dw-mod"> 3014 @foreach (var option in settings.Categories) 3015 { 3016 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div> 3017 } 3018 </div> 3019 <label class="dropdown-trigger-off" for="CategorySelector"></label> 3020 </div> 3021 </div> 3022 } 3023 } 3024 @using System.Reflection 3025 @using Dynamicweb.Rapido.Blocks.Components 3026 @using Dynamicweb.Rapido.Blocks.Components.Articles 3027 @using Dynamicweb.Rapido.Blocks 3028 @using System.Collections.Generic 3029 3030 @* Component for the articles *@ 3031 3032 @helper RenderArticleListFilter(ArticleListFilter settings) 3033 { 3034 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get(settings.SystemName)) ? HttpContext.Current.Request.QueryString.Get(settings.SystemName) : Translate("All"); 3035 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString()); 3036 3037 if (settings.Options != null) 3038 { 3039 if (settings.Options is IEnumerable<dynamic>) 3040 { 3041 var options = (IEnumerable<dynamic>) settings.Options; 3042 settings.Options = options.OrderBy(item => item.Name); 3043 } 3044 3045 foreach (var option in settings.Options) 3046 { 3047 selectedFilter = selectedFilter == option.Value ? option.Name : selectedFilter; 3048 } 3049 3050 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 3051 { 3052 <div class="u-pull--right u-margin-left"> 3053 <div class="collection u-no-margin"> 3054 <h5>@settings.Label</h5> 3055 <input type="checkbox" id="@(settings.SystemName)Selector" class="dropdown-trigger" /> 3056 <div class="dropdown u-w180px dw-mod"> 3057 <label class="dropdown__header dropdown__btn dw-mod" for="@(settings.SystemName)Selector">@Translate(selectedFilter)</label> 3058 <div class="dropdown__content dw-mod"> 3059 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')">@Translate("All")</div> 3060 @foreach (var option in settings.Options) 3061 { 3062 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')">@Translate(option.Name)</div> 3063 } 3064 </div> 3065 <label class="dropdown-trigger-off" for="@(settings.SystemName)Selector"></label> 3066 </div> 3067 </div> 3068 </div> 3069 } 3070 else 3071 { 3072 <div class="u-full-width u-margin-bottom"> 3073 <h5 class="u-no-margin">@settings.Label</h5> 3074 <input type="checkbox" id="@(settings.SystemName)Selector" class="dropdown-trigger" /> 3075 <div class="dropdown u-full-width w-mod"> 3076 <label class="dropdown__header dropdown__btn dw-mod" for="@(settings.SystemName)Selector">@Translate(selectedFilter)</label> 3077 <div class="dropdown__content dw-mod"> 3078 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')">@Translate("All")</div> 3079 @foreach (var option in settings.Options) 3080 { 3081 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')">@Translate(option.Name)</div> 3082 } 3083 </div> 3084 <label class="dropdown-trigger-off" for="@(settings.SystemName)Selector"></label> 3085 </div> 3086 </div> 3087 } 3088 } 3089 } 3090 @using System.Reflection 3091 @using Dynamicweb.Rapido.Blocks.Components 3092 @using Dynamicweb.Rapido.Blocks.Components.Articles 3093 @using Dynamicweb.Rapido.Blocks 3094 3095 @* Component for the articles *@ 3096 3097 @helper RenderArticleListSearch(ArticleListSearch settings) 3098 { 3099 string searchParameter = !string.IsNullOrEmpty(settings.SearchParameter) ? settings.SearchParameter : "Title"; 3100 string searchWord = HttpContext.Current.Request.QueryString.Get(searchParameter); 3101 string searchString = !string.IsNullOrEmpty(searchWord) ? searchWord.Trim('*') : ""; 3102 string className = "u-w340px u-pull--right u-margin-left"; 3103 3104 if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet") 3105 { 3106 className = "u-full-width"; 3107 } 3108 3109 <div class="typeahead u-color-inherit u-margin-bottom dw-mod @className"> 3110 <input type="text" class="typeahead-search-field u-no-margin dw-mod" placeholder="@Translate("Search in list")" value="@searchString" id="ArticleListSearchInput" onchange="QueryArray.setParameterInCurrentURL('@searchParameter', '*' + document.getElementById('ArticleListSearchInput').value + '*')"> 3111 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod"><i class="fas fa-search"></i></button> 3112 </div> 3113 } 3114 @using System.Reflection 3115 @using Dynamicweb.Rapido.Blocks.Components 3116 @using Dynamicweb.Rapido.Blocks.Components.Articles 3117 @using Dynamicweb.Rapido.Blocks 3118 3119 @* Component for the articles *@ 3120 3121 @helper RenderArticleListNoResultsInfo(ArticleListNoResultsInfo settings) 3122 { 3123 <div class="u-margin-top--lg u-bold u-ta-center u-bold">@Translate(settings.Message)</div> 3124 } 3125 @using System.Reflection 3126 @using Dynamicweb.Rapido.Blocks.Components 3127 @using Dynamicweb.Rapido.Blocks.Components.General 3128 @using Dynamicweb.Rapido.Blocks.Components.Articles 3129 @using Dynamicweb.Rapido.Blocks 3130 @using System.Text.RegularExpressions 3131 3132 @* Component for the articles *@ 3133 3134 @helper RenderArticleListItem(ArticleListItem settings) 3135 { 3136 switch (settings.Type) { 3137 case ArticleListItemType.Card: 3138 @RenderArticleListItemCard(settings); 3139 break; 3140 case ArticleListItemType.List: 3141 @RenderArticleListItemList(settings); 3142 break; 3143 case ArticleListItemType.Simple: 3144 @RenderArticleListItemSimple(settings); 3145 break; 3146 default: 3147 @RenderArticleListItemCard(settings); 3148 break; 3149 } 3150 } 3151 3152 @helper RenderArticleListItemCard(ArticleListItem settings) { 3153 <a href="@settings.Link" class="u-full-height u-color-light--bg u-flex u-flex--column"> 3154 <div class="u-color-light--bg u-no-padding dw-mod"> 3155 @if (settings.Logo != null) 3156 { 3157 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;" : ""; 3158 settings.Logo.ImageDefault.Crop = 5; 3159 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width; 3160 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height; 3161 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage"> 3162 @if (settings.Stickers != null) 3163 { 3164 if (settings.Stickers.Position != StickersListPosition.Custom && settings.Stickers.Position != StickersListPosition.None) 3165 { 3166 @Render(settings.Stickers); 3167 } 3168 } 3169 @RenderImage(settings.Logo) 3170 </div> 3171 } else if (settings.Image != null) 3172 { 3173 <div class="flex-img image-hover__wrapper u-position-relative dw-mod"> 3174 @if (settings.Stickers != null) 3175 { 3176 if (settings.Stickers.Position != StickersListPosition.Custom && settings.Stickers.Position != StickersListPosition.None) 3177 { 3178 @Render(settings.Stickers); 3179 } 3180 } 3181 @Render(settings.Image) 3182 </div> 3183 } 3184 </div> 3185 3186 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary)) 3187 { 3188 <div class="card u-color-light--bg u-full-height dw-mod"> 3189 @if (settings.Stickers != null) 3190 { 3191 if (settings.Stickers.Position == StickersListPosition.Custom) 3192 { 3193 @Render(settings.Stickers); 3194 } 3195 } 3196 @if (!String.IsNullOrEmpty(settings.Title)) 3197 { 3198 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3> 3199 } 3200 @if (!String.IsNullOrEmpty(settings.SubTitle)) 3201 { 3202 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 3203 } 3204 @if (!String.IsNullOrEmpty(settings.Summary)) 3205 { 3206 <p class="article__short-summary dw-mod">@settings.Summary</p> 3207 } 3208 </div> 3209 } 3210 </a> 3211 } 3212 3213 @helper RenderArticleListItemList(ArticleListItem settings) { 3214 <a href="@settings.Link"> 3215 <div class="grid u-color-light--bg u-no-padding dw-mod"> 3216 <div class="grid__col-md-3"> 3217 <div class="u-color-light--bg u-no-padding dw-mod"> 3218 @if (settings.Logo != null) 3219 { 3220 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;" : ""; 3221 settings.Logo.ImageDefault.Crop = 5; 3222 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width; 3223 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height; 3224 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage"> 3225 @if (settings.Stickers != null) 3226 { 3227 if (settings.Stickers.Position != StickersListPosition.Custom) 3228 { 3229 @Render(settings.Stickers); 3230 } 3231 } 3232 @RenderImage(settings.Logo) 3233 </div> 3234 } else if (settings.Image != null) 3235 { 3236 <div class="flex-img image-hover__wrapper dw-mod"> 3237 @if (settings.Stickers != null) 3238 { 3239 if (settings.Stickers.Position != StickersListPosition.Custom) 3240 { 3241 @Render(settings.Stickers); 3242 } 3243 } 3244 @Render(settings.Image) 3245 </div> 3246 } 3247 </div> 3248 </div> 3249 3250 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary)) 3251 { 3252 <div class="grid__col-md-9"> 3253 @if (!String.IsNullOrEmpty(settings.Title)) 3254 { 3255 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3> 3256 } 3257 @if (settings.Stickers != null) 3258 { 3259 if (settings.Stickers.Position == StickersListPosition.Custom) 3260 { 3261 @Render(settings.Stickers); 3262 } 3263 } 3264 @if (!String.IsNullOrEmpty(settings.SubTitle)) 3265 { 3266 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 3267 } 3268 @if (!String.IsNullOrEmpty(settings.Summary)) 3269 { 3270 <p class="article__short-summary dw-mod">@settings.Summary</p> 3271 } 3272 </div> 3273 } 3274 </div> 3275 </a> 3276 } 3277 3278 @helper RenderArticleListItemSimple(ArticleListItem settings) { 3279 <a href="@settings.Link" class="u-color-inherit"> 3280 <div class="grid u-color-light--bg u-no-padding dw-mod"> 3281 <div class="grid__col-md-12"> 3282 @if (!String.IsNullOrEmpty(settings.Title)) 3283 { 3284 <div class="article-list-item__header u-truncate-text u-no-margin dw-mod">@settings.Title</div> 3285 } 3286 @if (!String.IsNullOrEmpty(settings.SubTitle)) 3287 { 3288 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 3289 } 3290 </div> 3291 </div> 3292 </a> 3293 } 3294 @using System.Reflection 3295 @using Dynamicweb.Rapido.Blocks.Components.Articles 3296 3297 3298 @* Component for the articles *@ 3299 3300 @helper RenderArticleAuthorAndDate(ArticleAuthorAndDate settings) 3301 { 3302 <small class="article__subscription"> 3303 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date))) 3304 { 3305 <text>@Translate("Written")</text> 3306 } 3307 @if (!string.IsNullOrWhiteSpace(settings.Author)) 3308 { 3309 <text>@Translate("by") @settings.Author</text> 3310 } 3311 @if (!string.IsNullOrWhiteSpace(settings.Date)) 3312 { 3313 <text>@Translate("on") @settings.Date</text> 3314 } 3315 </small> 3316 } 3317 @using System.Reflection 3318 @using Dynamicweb.Rapido.Blocks.Components.Articles 3319 @using Dynamicweb.Rapido.Blocks.Components.General 3320 3321 3322 @* Component for the articles *@ 3323 3324 @helper RenderArticleLink(ArticleLink settings) 3325 { 3326 if (!string.IsNullOrEmpty(settings.Title)) 3327 { 3328 Button link = new Button { 3329 ConfirmText = settings.ConfirmText, 3330 ConfirmTitle = settings.ConfirmTitle, 3331 ButtonType = settings.ButtonType, 3332 Id = settings.Id, 3333 Title = settings.Title, 3334 AltText = settings.AltText, 3335 OnClick = settings.OnClick, 3336 CssClass = settings.CssClass, 3337 Disabled = settings.Disabled, 3338 Icon = settings.Icon, 3339 Name = settings.Name, 3340 Href = settings.Href, 3341 ButtonLayout = settings.ButtonLayout, 3342 ExtraAttributes = settings.ExtraAttributes 3343 }; 3344 <div class="grid__cell"> 3345 @Render(link) 3346 </div> 3347 } 3348 } 3349 @using System.Reflection 3350 @using Dynamicweb.Rapido.Blocks 3351 @using Dynamicweb.Rapido.Blocks.Components.Articles 3352 @using Dynamicweb.Rapido.Blocks.Components.General 3353 3354 3355 @* Component for the articles *@ 3356 3357 @helper RenderArticleCarousel(ArticleCarousel settings) 3358 { 3359 <div class="grid"> 3360 <div class="grid__col-12 u-no-padding u-margin-bottom"> 3361 <div class="carousel" id="carousel_@settings.Id"> 3362 <div class="carousel__container js-carousel-slides dw-mod"> 3363 @RenderBlockList(settings.SubBlocks) 3364 </div> 3365 </div> 3366 </div> 3367 </div> 3368 3369 <script> 3370 document.addEventListener("DOMContentLoaded", function () { 3371 new CarouselModule("#carousel_@settings.Id", { 3372 slideTime: 0, 3373 dots: true 3374 }); 3375 }); 3376 </script> 3377 } 3378 3379 @helper RenderArticleCarouselSlide(ArticleCarouselSlide settings) 3380 { 3381 string imageEngine = "/Admin/Public/GetImage.ashx?"; 3382 3383 string defaultImage = settings.ImageSettings != null ? imageEngine : settings.Image; 3384 if (settings.ImageSettings != null) 3385 { 3386 defaultImage += settings.ImageSettings.Width != 0 ? "Width=" + settings.ImageSettings.Width + "&" : ""; 3387 defaultImage += settings.ImageSettings.Height != 0 ? "Height=" + settings.ImageSettings.Height + "&" : ""; 3388 defaultImage += "Crop=" + settings.ImageSettings.Crop + "&"; 3389 defaultImage += "Compression=" + settings.ImageSettings.Compression + "&"; 3390 defaultImage += "DoNotUpscale=" + settings.ImageSettings.DoNotUpscale.ToString() + "&"; 3391 defaultImage += "FillCanvas=" + settings.ImageSettings.FillCanvas.ToString() + "&"; 3392 } 3393 defaultImage += "&Image=" + settings.Image; 3394 3395 <div class="carousel__slide u-min-h300px u-flex dw-mod" style="background-size:cover; background-image:url('@defaultImage')"> 3396 <a class="article-carousel-item__wrap" href="@settings.Link" title="@settings.Title"> 3397 <h2 class="article-list__item-header u-truncate-text u-color-light dw-mod">@settings.Title</h2> 3398 <div class="article-list__item-info"> 3399 @if (settings.Stickers != null) 3400 { 3401 settings.Stickers.Position = StickersListPosition.Custom; 3402 @Render(settings.Stickers); 3403 } 3404 3405 <small class="u-margin-top--lg u-color-light"> 3406 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date))) 3407 { 3408 <text>@Translate("Written")</text> 3409 } 3410 @if (!string.IsNullOrWhiteSpace(settings.Author)) 3411 { 3412 <text>@Translate("by") @settings.Author</text> 3413 } 3414 @if (!string.IsNullOrWhiteSpace(settings.Date)) 3415 { 3416 <text>@Translate("on") @settings.Date</text> 3417 } 3418 </small> 3419 </div> 3420 3421 <h3 class="article__short-summary u-color-light">@settings.Summary</h3> 3422 </a> 3423 @if (settings.UseFilters == true) 3424 { 3425 <div class="background-image image-filter image-filter--darken dw-mod"></div> 3426 } 3427 </div> 3428 } 3429 @using System.Text.RegularExpressions 3430 @using Dynamicweb.Rapido.Blocks.Components 3431 @using Dynamicweb.Rapido.Blocks.Components.General 3432 @using Dynamicweb.Rapido.Blocks.Components.Articles 3433 @using Dynamicweb.Rapido.Blocks 3434 3435 @* Component for the articles *@ 3436 3437 @helper RenderArticleVideo(ArticleVideo settings) 3438 { 3439 if (settings.Url != null) 3440 { 3441 //getting video ID from youtube URL 3442 string videoCode = settings.Url; 3443 Regex regex = new Regex(@".be\/(.[^?]*)"); 3444 Match match = regex.Match(videoCode); 3445 string videoId = ""; 3446 if (match.Success) 3447 { 3448 videoId = match.Groups[1].Value; 3449 } 3450 else 3451 { 3452 regex = new Regex(@"v=([^&]+)"); 3453 match = regex.Match(videoCode); 3454 if (match.Success) 3455 { 3456 videoId = match.Groups[1].Value; 3457 } 3458 } 3459 3460 int autoPlay = settings.AutoPlay == "true" ? 1 : 0; 3461 3462 <div class="video-wrapper"> 3463 <div class="js-youtube-video" data-video="@videoId" id="ytPlayer@(Guid.NewGuid().ToString("N"))" data-auto-play="@autoPlay" data-enable-controls="1"></div> 3464 </div> 3465 } 3466 } 3467 3468 3469 3470 @* Simple helpers *@ 3471 3472 @*Requires the Gallery ItemType that comes with Rapido*@ 3473 @helper RenderArticleItemGallery(IList<ItemViewModel> gallery) { 3474 if (gallery != null && gallery.Count > 0) 3475 { 3476 int count = 1; 3477 3478 foreach (var item in gallery) 3479 { 3480 if (item.GetFile("ImagePath") != null) 3481 { 3482 string image = item.GetFile("ImagePath").PathUrlEncoded; 3483 string imagePrefix = "/Admin/Public/GetImage.ashx?width=1200&amp;height=820&amp;crop=5&amp;Compression=75&amp;DoNotUpscale=1&amp;image="; 3484 int imagesCount = gallery.Count; 3485 3486 if (count == 1) 3487 { 3488 <label class="gallery" for="ParagraphGalleryModalTrigger" onclick="Gallery.openImage(this.querySelector('.js-gallery'))"> 3489 <span class="gallery__main-image"> 3490 <img src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=992&amp;height=760&amp;crop=0&amp;Compression=75&amp;DoNotUpscale=1&amp;image=@image" class="b-lazy flex-img js-gallery" alt="" data-for="ParagraphGallery" data-image="@imagePrefix@image" /> 3491 </span> 3492 <span class="gallery__image-counter"> 3493 <i class="fas fa-camera fa-2x"></i> <span class="gallery__image-counter__number">@imagesCount</span> 3494 <span class="gallery__image-counter__text">@Translate("See all") <i class="fas fa-angle-right"></i></span> 3495 </span> 3496 </label> 3497 } 3498 else 3499 { 3500 <div class="u-hidden js-gallery" data-for="ParagraphGallery" data-image="@imagePrefix@image"></div> 3501 } 3502 3503 count++; 3504 } 3505 } 3506 3507 @Render(new ArticleGalleryModal()) 3508 } 3509 } 3510 3511 @helper RenderMobileFilters(List<Block> subBlocks) 3512 { 3513 if (subBlocks.Count > 0) 3514 { 3515 <div class="grid__col-12"> 3516 <input type="checkbox" id="CheckFilters" class="js-remember-state u-hidden" data-expand="CheckFilters" /> 3517 <div class="grid u-margin-bottom dw-mod" data-trigger="CheckFilters"> 3518 @RenderBlockList(subBlocks) 3519 </div> 3520 <label for="CheckFilters" class="btn btn--secondary btn--full dw-mod js-expand-hide" data-trigger="CheckFilters">@Translate("Select filters")</label> 3521 <label for="CheckFilters" class="btn btn--secondary btn--full dw-mod expandable--collapsed" data-trigger="CheckFilters">@Translate("Close filters")</label> 3522 </div> 3523 } 3524 } 3525 3526 3527 @* Include the Blocks for the page *@ 3528 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 3529 3530 @using System 3531 @using System.Web 3532 @using System.Collections.Generic 3533 @using Dynamicweb.Rapido.Blocks.Extensibility 3534 @using Dynamicweb.Rapido.Blocks 3535 3536 @functions { 3537 string GoogleTagManagerID = ""; 3538 string GoogleAnalyticsID = ""; 3539 } 3540 3541 @{ 3542 GoogleTagManagerID = Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID"); 3543 GoogleAnalyticsID = Model.Area.Item.GetItem("Settings").GetString("GoogleAnalyticsTrackingID"); 3544 3545 BlocksPage topSnippetsBlocksPage = BlocksPage.GetBlockPage("Master"); 3546 3547 if (!string.IsNullOrWhiteSpace(GoogleAnalyticsID)) 3548 { 3549 Block tagManager = new Block() 3550 { 3551 Id = "GoogleAnalytics", 3552 SortId = 0, 3553 Template = RenderGoogleAnalyticsSnippet() 3554 }; 3555 topSnippetsBlocksPage.Add("Head", tagManager); 3556 } 3557 3558 if (!string.IsNullOrWhiteSpace(GoogleTagManagerID)) 3559 { 3560 Block tagManager = new Block() 3561 { 3562 Id = "TagManager", 3563 SortId = 1, 3564 Template = RenderGoogleTagManager() 3565 }; 3566 topSnippetsBlocksPage.Add("Head", tagManager); 3567 3568 Block tagManagerBodySnippet = new Block() 3569 { 3570 Id = "TagManagerBodySnippet", 3571 SortId = 1, 3572 Template = RenderGoogleTagManagerBodySnippet() 3573 }; 3574 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, tagManagerBodySnippet); 3575 } 3576 3577 Block facebookPixel = new Block() 3578 { 3579 Id = "FacebookPixel", 3580 SortId = 2, 3581 Template = RenderFacebookPixel() 3582 }; 3583 3584 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, facebookPixel); 3585 } 3586 3587 @helper RenderGoogleAnalyticsSnippet() 3588 { 3589 <!-- Global site tag (gtag.js) - Google Analytics --> 3590 <script async src="https://www.googletagmanager.com/gtag/js?id=@GoogleAnalyticsID"></script> 3591 <script> 3592 window.dataLayer = window.dataLayer || []; 3593 function gtag(){dataLayer.push(arguments);} 3594 gtag('js', new Date()); 3595 3596 gtag('config', '@GoogleAnalyticsID'); 3597 </script> 3598 3599 } 3600 3601 @helper RenderGoogleTagManager() 3602 { 3603 <script> 3604 (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': 3605 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], 3606 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 3607 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); 3608 })(window,document,'script','dataLayer','@GoogleTagManagerID'); 3609 </script> 3610 } 3611 3612 @helper RenderGoogleTagManagerBodySnippet() 3613 { 3614 <!-- Google Tag Manager (noscript) --> 3615 <noscript> 3616 <iframe src="https://www.googletagmanager.com/ns.html?id=@GoogleTagManagerID" 3617 height="0" width="0" style="display:none;visibility:hidden"></iframe> 3618 </noscript> 3619 <!-- End Google Tag Manager (noscript) --> 3620 } 3621 3622 @helper RenderFacebookPixel() 3623 { 3624 string FacebookPixelID = Model.Area.Item.GetItem("Settings").GetString("FacebookPixelID"); 3625 3626 if (!string.IsNullOrWhiteSpace(FacebookPixelID)) 3627 { 3628 <!-- Facebook Pixel Code --> 3629 <script> 3630 !function(f,b,e,v,n,t,s) 3631 {if(f.fbq)return;n=f.fbq=function(){n.callMethod? 3632 n.callMethod.apply(n,arguments):n.queue.push(arguments)}; 3633 if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0'; 3634 n.queue=[];t=b.createElement(e);t.async=!0; 3635 t.src=v;s=b.getElementsByTagName(e)[0]; 3636 s.parentNode.insertBefore(t,s)}(window, document,'script', 3637 'https://connect.facebook.net/en_US/fbevents.js'); 3638 fbq('init', '@FacebookPixelID'); 3639 fbq('track', 'PageView'); 3640 </script> 3641 <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=@FacebookPixelID&ev=PageView&noscript=1" alt="" /></noscript> 3642 } 3643 } 3644 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 3645 3646 @using System 3647 @using System.Web 3648 @using System.Collections.Generic 3649 @using Dynamicweb.Rapido.Blocks 3650 @using Dynamicweb.Rapido.Blocks.Extensibility 3651 @using Dynamicweb.Security.UserManagement 3652 @using Dynamicweb.Security.UserManagement.ExternalAuthentication 3653 @using Dynamicweb.Rapido.Blocks.Components.General 3654 3655 @{ 3656 BlocksPage loginBlocksPage = BlocksPage.GetBlockPage("Master"); 3657 3658 Block loginModal = new Block() 3659 { 3660 Id = "LoginModal", 3661 SortId = 10, 3662 Component = new Modal 3663 { 3664 Id = "SignIn", 3665 Heading = new Heading 3666 { 3667 Level = 0, 3668 Title = Translate("Sign in") 3669 }, 3670 Width = ModalWidth.Sm, 3671 BodyTemplate = RenderLoginForm() 3672 } 3673 }; 3674 3675 loginBlocksPage.Add(MasterBlockId.MasterTopSnippets, loginModal); 3676 } 3677 3678 @helper RenderLoginForm() 3679 { 3680 int pageId = Model.TopPage.ID; 3681 string userSignedInErrorText = ""; 3682 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 3683 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; 3684 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 3685 bool showModalOnStart = pageId != GetPageIdByNavigationTag("CustomerCenter") && Pageview.Page.ID != GetPageIdByNavigationTag("SignInPage") && Model.LogOnFailed; 3686 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); 3687 bool hideForgotPasswordLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideForgotPasswordLink"); 3688 3689 ProviderCollection providers = Provider.GetActiveProviders(); 3690 3691 if (Model.LogOnFailed) 3692 { 3693 switch (Model.LogOnFailedReason) 3694 { 3695 case LogOnFailedReason.PasswordLengthInvalid: 3696 userSignedInErrorText = Translate("Password length is invalid"); 3697 break; 3698 case LogOnFailedReason.IncorrectLogin: 3699 userSignedInErrorText = Translate("Invalid email or password"); 3700 break; 3701 case LogOnFailedReason.ExceededFailedLogOnLimit: 3702 userSignedInErrorText = Translate("You have exceeded the limit of allowed login attempts. The user account is temporarily locked"); 3703 break; 3704 case LogOnFailedReason.LoginLocked: 3705 userSignedInErrorText = Translate("The user account is temporarily locked"); 3706 break; 3707 case LogOnFailedReason.PasswordExpired: 3708 userSignedInErrorText = Translate("The password has expired and needs to be renewed"); 3709 break; 3710 default: 3711 userSignedInErrorText = Translate("An unknown error occured"); 3712 break; 3713 } 3714 } 3715 3716 Form form = new Form { Method = FormMethod.Post, Name = "LoginModalForm" }; 3717 3718 TextField passwordField = new TextField { Id = "login-password", Type = TextFieldType.Password, Name = "password", Label = Translate("Password"), Required = true }; 3719 3720 if (!hideForgotPasswordLink) { 3721 passwordField.Link = new Link { Title = Translate("Forgot password?"), Href = "/Default.aspx?id=" + signInProfilePageId + "&LoginAction=Recovery" }; 3722 } 3723 3724 form.Add(new HiddenField { Name = "ID", Value = Converter.ToString(pageId) }); 3725 form.Add(new HiddenField { Name = "DWExtranetUsernameRemember", Value = "True" }); 3726 form.Add(new HiddenField { Name = "DWExtranetPasswordRemember", Value = "True" }); 3727 form.Add(new HiddenField { Name = "LoginAction", Value = "Login" }); 3728 form.Add(new TextField { Id = "LoginUsername", Name = "username", Label = Translate("Email"), CssClass = "u-full-width", Required = true }); 3729 form.Add(passwordField); 3730 form.Add(new NotificationMessage { Message = userSignedInErrorText, MessageType = NotificationMessageType.Error }); 3731 form.Add(new CheckboxField { Id = "LoginRememberMe", Value = "True", Name = "Autologin", Label = Translate("Remember me") }); 3732 form.Add(new Button { ButtonType = ButtonType.Submit, Title = Translate("Sign in"), CssClass = "btn--full", OnClick = "Buttons.LockButton(event)" }); 3733 3734 foreach (Provider LoginProvider in providers) 3735 { 3736 var ProviderName = LoginProvider.Name.ToLower(); 3737 form.Add(new Link { 3738 Href = "/Admin/Public/Social/ExternalLogin.aspx?action=login&providerID=" + LoginProvider.ID, 3739 Icon = new Icon { Prefix = "fab", Name = "fa-" + ProviderName, CssClass = "fa-1_5x", LabelPosition = IconLabelPosition.After }, 3740 ButtonLayout = ButtonLayout.LinkClean, 3741 CssClass = "btn--condensed u-margin-bottom u-margin-right u-inline-block u-color-" + ProviderName, 3742 AltText = ProviderName 3743 }); 3744 } 3745 3746 if (!hideCreateAccountLink) { 3747 form.Add(new Text { Content = "<div class=\"u-border-top u-full-width u-margin-bottom--lg\"></div>" }); 3748 form.Add(new Link 3749 { 3750 Href = "/Default.aspx?id=" + createAccountPageId, 3751 ButtonLayout = ButtonLayout.LinkClean, 3752 Title = Translate("Create account"), 3753 CssClass = "u-full-width u-ta-center" 3754 }); 3755 } 3756 3757 @Render(form) 3758 3759 if (showModalOnStart) 3760 { 3761 <script> 3762 document.getElementById("SignInModalTrigger").checked = true; 3763 </script> 3764 } 3765 } 3766 3767 3768 3769 3770 3771 @if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet") 3772 { 3773 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3774 3775 @using System 3776 @using System.Web 3777 @using System.Collections.Generic 3778 @using Dynamicweb.Rapido.Blocks.Extensibility 3779 @using Dynamicweb.Rapido.Blocks 3780 @using Dynamicweb.Rapido.Services 3781 3782 3783 @functions { 3784 BlocksPage mobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master"); 3785 } 3786 3787 @{ 3788 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"; 3789 bool mobileHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 3790 bool mobileHideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart") || !Dynamicweb.Rapido.Services.User.IsBuyingAllowed(); 3791 3792 Block mobileHeader = new Block() 3793 { 3794 Id = "MobileTop", 3795 SortId = 10, 3796 Template = RenderMobileTop(), 3797 SkipRenderBlocksList = true 3798 }; 3799 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeader); 3800 3801 Block mobileHeaderNavigation = new Block() 3802 { 3803 Id = "MobileHeaderNavigation", 3804 SortId = 10, 3805 Template = RenderMobileHeaderNavigation(), 3806 SkipRenderBlocksList = true, 3807 BlocksList = new List<Block> { 3808 new Block { 3809 Id = "MobileHeaderNavigationTrigger", 3810 SortId = 10, 3811 Template = RenderMobileHeaderNavigationTrigger() 3812 } 3813 } 3814 }; 3815 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderNavigation); 3816 3817 Block mobileHeaderLogo = new Block() 3818 { 3819 Id = "MobileHeaderLogo", 3820 SortId = 20, 3821 Template = RenderMobileHeaderLogo(), 3822 SkipRenderBlocksList = true 3823 }; 3824 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderLogo); 3825 3826 Block mobileHeaderActions = new Block() 3827 { 3828 Id = "MobileHeaderActions", 3829 SortId = 30, 3830 Template = RenderMobileTopActions(), 3831 SkipRenderBlocksList = true 3832 }; 3833 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderActions); 3834 3835 if (!mobileHideSearch) 3836 { 3837 Block mobileHeaderSearch = new Block 3838 { 3839 Id = "MobileHeaderSearch", 3840 SortId = 10, 3841 Template = RenderMobileTopSearch() 3842 }; 3843 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderSearch); 3844 } 3845 3846 Block mobileHeaderMiniCart; 3847 3848 if (!mobileHideCart) 3849 { 3850 mobileHeaderMiniCart = new Block 3851 { 3852 Id = "MobileHeaderMiniCart", 3853 SortId = 20, 3854 Template = RenderMobileTopMiniCart() 3855 }; 3856 3857 Block miniCartCounterScriptTemplate = new Block 3858 { 3859 Id = "MiniCartCounterScriptTemplate", 3860 Template = RenderMobileMiniCartCounterContent() 3861 }; 3862 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate); 3863 } 3864 else 3865 { 3866 mobileHeaderMiniCart = new Block 3867 { 3868 Id = "MobileHeaderMiniCart", 3869 SortId = 20 3870 }; 3871 } 3872 3873 if (!mobileHideSearch) 3874 { 3875 Block mobileHeaderSearchBar = new Block() 3876 { 3877 Id = "MobileHeaderSearchBar", 3878 SortId = 30, 3879 Template = RenderMobileTopSearchBar() 3880 }; 3881 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeaderSearchBar); 3882 } 3883 3884 switch (mobileTopLayout) 3885 { 3886 case "nav-left": 3887 mobileHeaderNavigation.SortId = 10; 3888 mobileHeaderLogo.SortId = 20; 3889 mobileHeaderActions.SortId = 30; 3890 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart); 3891 break; 3892 case "nav-right": 3893 mobileHeaderLogo.SortId = 10; 3894 mobileHeaderActions.SortId = 20; 3895 mobileHeaderNavigation.SortId = 30; 3896 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart); 3897 break; 3898 case "nav-search-left": 3899 mobileHeaderNavigation.SortId = 10; 3900 mobileHeaderLogo.SortId = 20; 3901 mobileHeaderActions.SortId = 30; 3902 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart); 3903 break; 3904 case "search-left": 3905 mobileHeaderActions.SortId = 10; 3906 mobileHeaderLogo.SortId = 20; 3907 mobileHeaderNavigation.SortId = 30; 3908 mobileHeaderMiniCart.SortId = 0; 3909 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart); 3910 break; 3911 } 3912 } 3913 3914 3915 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3916 3917 @using System 3918 @using System.Web 3919 @using Dynamicweb.Rapido.Blocks.Extensibility 3920 @using Dynamicweb.Rapido.Blocks 3921 3922 @{ 3923 BlocksPage customMobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master"); 3924 } 3925 3926 3927 3928 3929 @helper RenderMobileTop() { 3930 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileTop").OrderBy(item => item.SortId).ToList(); 3931 3932 <nav class="main-navigation-mobile dw-mod"> 3933 <div class="center-container top-container__center-container dw-mod"> 3934 <div class="grid grid--align-center"> 3935 @RenderBlockList(subBlocks) 3936 </div> 3937 </div> 3938 </nav> 3939 } 3940 3941 @helper RenderMobileHeaderNavigation() { 3942 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderNavigation").OrderBy(item => item.SortId).ToList(); 3943 3944 <div class="grid__col-auto-width"> 3945 <ul class="menu dw-mod"> 3946 @RenderBlockList(subBlocks) 3947 </ul> 3948 </div> 3949 } 3950 3951 @helper RenderMobileHeaderNavigationTrigger() { 3952 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 3953 <label for="MobileNavTrigger" class="mobile-nav-trigger-button menu__link menu__link--icon menu__link--mobile dw-mod"></label> 3954 </li> 3955 } 3956 3957 @helper RenderMobileHeaderLogo() { 3958 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderLogo").OrderBy(item => item.SortId).ToList(); 3959 3960 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"; 3961 string centeredLogo = mobileTopLayout != "nav-right" ? "u-ta-center" : ""; 3962 string firstPageId = Model.Area.FirstActivePage.ID.ToString(); 3963 string businessName = Model.Area.Item.GetItem("Settings").GetString("BusinessName"); 3964 3965 string mobileLogo = "/Files/Images/logo-dynamicweb.png"; 3966 if (Model.Area.Item.GetItem("Layout").GetItem("MobileTop") != null && Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo") != null) 3967 { 3968 mobileLogo = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo").PathUrlEncoded; 3969 } 3970 3971 if (Path.GetExtension(mobileLogo).ToLower() != ".svg") 3972 { 3973 mobileLogo = "/Admin/Public/GetImage.ashx?height=40&amp;width=100&amp;crop=5&amp;Compression=75&amp;image=" + mobileLogo; 3974 } 3975 else 3976 { 3977 mobileLogo = HttpUtility.UrlDecode(mobileLogo); 3978 } 3979 3980 <div class="grid__col-auto grid__col--bleed"> 3981 <div class="grid__cell @centeredLogo"> 3982 <a href="/Default.aspx?ID=@firstPageId" class="logo logo--mobile u-inline-block dw-mod"> 3983 <img class="grid__cell-img logo__img logo__img--mobile dw-mod" src="@mobileLogo" alt="@businessName" /> 3984 </a> 3985 </div> 3986 3987 @RenderBlockList(subBlocks) 3988 </div> 3989 } 3990 3991 @helper RenderMobileTopActions() { 3992 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderActions").OrderBy(item => item.SortId).ToList(); 3993 3994 <div class="grid__col-auto-width"> 3995 <ul class="menu dw-mod"> 3996 @RenderBlockList(subBlocks) 3997 </ul> 3998 </div> 3999 } 4000 4001 @helper RenderMobileTopSearch() { 4002 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 4003 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> 4004 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> 4005 </label> 4006 </li> 4007 } 4008 4009 @helper RenderMobileTopMiniCart() { 4010 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4011 int cartPageId = GetPageIdByNavigationTag("CartPage"); 4012 double cartProductsCount = Model.Cart.TotalProductsCount; 4013 4014 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod" id="miniCartWrapper"> 4015 <div class="mini-cart dw-mod"> 4016 <a href="/Default.aspx?ID=@cartPageId&Purge=True" id="miniCartCounterWrap" class="menu__link menu__link--icon menu__link--mobile dw-mod js-mini-cart-button"> 4017 <div class="u-inline u-position-relative"> 4018 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue fa-1_5x"></i> 4019 <div class="mini-cart__counter dw-mod"> 4020 <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"> 4021 <div class="js-mini-cart-counter-content" data-count="@cartProductsCount"> 4022 @cartProductsCount 4023 </div> 4024 </div> 4025 </div> 4026 </div> 4027 </a> 4028 </div> 4029 </li> 4030 } 4031 4032 @helper RenderMobileTopSearchBar() 4033 { 4034 string searchFeedId = ""; 4035 string searchSecondFeedId = ""; 4036 int groupsFeedId; 4037 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 4038 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 4039 string resultPageLink; 4040 string searchPlaceholder; 4041 string searchType = "product-search"; 4042 string searchTemplate; 4043 string searchContentTemplate = ""; 4044 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; 4045 bool showGroups = true; 4046 4047 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch") 4048 { 4049 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 4050 resultPageLink = contentSearchPageLink; 4051 searchPlaceholder = Translate("Search page"); 4052 groupsFeedId = 0; 4053 searchType = "content-search"; 4054 searchTemplate = "SearchPagesTemplate"; 4055 showGroups = false; 4056 } 4057 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch") 4058 { 4059 searchFeedId = productsPageId + "&feed=true"; 4060 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 4061 resultPageLink = Converter.ToString(productsPageId); 4062 searchPlaceholder = Translate("Search products or pages"); 4063 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 4064 searchType = "combined-search"; 4065 searchTemplate = "SearchProductsTemplateWrap"; 4066 searchContentTemplate = "SearchPagesTemplateWrap"; 4067 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 4068 } 4069 else 4070 { 4071 resultPageLink = Converter.ToString(productsPageId); 4072 searchFeedId = productsPageId + "&feed=true"; 4073 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 4074 searchPlaceholder = Translate("Search products"); 4075 searchTemplate = "SearchProductsTemplate"; 4076 searchType = "product-search"; 4077 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 4078 } 4079 4080 <input type="checkbox" id="MobileSearchTrigger" class="mobile-search-trigger" /> 4081 4082 <div class="main-navigation-mobile typeahead-mobile dw-mod"> 4083 <div class="center-container top-container__center-container dw-mod"> 4084 <div class="grid"> 4085 <div class="grid__col-auto"> 4086 <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"> 4087 <input type="text" class="js-typeahead-search-field u-w160px u-no-margin" placeholder="@searchPlaceholder" value="@searchValue"> 4088 @if (string.IsNullOrEmpty(searchSecondFeedId)) 4089 { 4090 <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> 4091 } 4092 else 4093 { 4094 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--combined-mobile grid"> 4095 <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> 4096 <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> 4097 </div> 4098 } 4099 <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> 4100 </div> 4101 </div> 4102 <div class="grid__col-auto-width"> 4103 <ul class="menu dw-mod"> 4104 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 4105 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> 4106 <i class="fas fa-times fa-1_5x"></i> 4107 </label> 4108 </li> 4109 </ul> 4110 </div> 4111 </div> 4112 </div> 4113 </div> 4114 } 4115 4116 @helper RenderMobileMiniCartCounterContent() 4117 { 4118 <script id="MiniCartCounterContent" type="text/x-template"> 4119 {{#.}} 4120 <div class="js-mini-cart-counter-content dw-mod" data-count="{{numberofproducts}}"> 4121 {{numberofproducts}} 4122 </div> 4123 {{/.}} 4124 </script> 4125 } 4126 </text> 4127 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4128 4129 @using System 4130 @using System.Web 4131 @using System.Collections.Generic 4132 @using Dynamicweb.Rapido.Blocks.Extensibility 4133 @using Dynamicweb.Rapido.Blocks 4134 4135 @functions { 4136 BlocksPage mobileNavigationBlocksPage = BlocksPage.GetBlockPage("Master"); 4137 } 4138 4139 @{ 4140 bool mobileNavigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 4141 bool mobileHideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); 4142 bool mobileHideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); 4143 bool mobileHideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); 4144 bool mobileHideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); 4145 bool mobileHideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); 4146 4147 Block mobileNavigation = new Block() 4148 { 4149 Id = "MobileNavigation", 4150 SortId = 10, 4151 Template = MobileNavigation(), 4152 SkipRenderBlocksList = true 4153 }; 4154 mobileNavigationBlocksPage.Add(MasterBlockId.MasterTopSnippets, mobileNavigation); 4155 4156 if (Model.CurrentUser.ID > 0 && !mobileHideMyProfileLink) 4157 { 4158 Block mobileNavigationSignIn = new Block 4159 { 4160 Id = "MobileNavigationSignIn", 4161 SortId = 10, 4162 Template = RenderMobileNavigationSignIn() 4163 }; 4164 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationSignIn); 4165 } 4166 4167 Block mobileNavigationMenu = new Block 4168 { 4169 Id = "MobileNavigationMenu", 4170 SortId = 20, 4171 Template = RenderMobileNavigationMenu() 4172 }; 4173 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationMenu); 4174 4175 Block mobileNavigationActions = new Block 4176 { 4177 Id = "MobileNavigationActions", 4178 SortId = 30, 4179 Template = RenderMobileNavigationActions(), 4180 SkipRenderBlocksList = true 4181 }; 4182 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationActions); 4183 4184 if (!mobileNavigationItemsHideSignIn) 4185 { 4186 if (Model.CurrentUser.ID <= 0) 4187 { 4188 Block mobileNavigationSignInAction = new Block 4189 { 4190 Id = "MobileNavigationSignInAction", 4191 SortId = 10, 4192 Template = RenderMobileNavigationSignInAction() 4193 }; 4194 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignInAction); 4195 4196 if (!mobileHideCreateAccountLink) 4197 { 4198 Block mobileNavigationCreateAccountAction = new Block 4199 { 4200 Id = "MobileNavigationCreateAccountAction", 4201 SortId = 20, 4202 Template = RenderMobileNavigationCreateAccountAction() 4203 }; 4204 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationCreateAccountAction); 4205 } 4206 } 4207 else 4208 { 4209 if (!mobileHideMyOrdersLink) 4210 { 4211 Block mobileNavigationOrdersAction = new Block 4212 { 4213 Id = "MobileNavigationOrdersAction", 4214 SortId = 20, 4215 Template = RenderMobileNavigationOrdersAction() 4216 }; 4217 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationOrdersAction); 4218 } 4219 if (!mobileHideMyFavoritesLink) 4220 { 4221 Block mobileNavigationFavoritesAction = new Block 4222 { 4223 Id = "MobileNavigationFavoritesAction", 4224 SortId = 30, 4225 Template = RenderMobileNavigationFavoritesAction() 4226 }; 4227 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationFavoritesAction); 4228 } 4229 if (!mobileHideMySavedCardsLink) 4230 { 4231 Block mobileNavigationSavedCardsAction = new Block 4232 { 4233 Id = "MobileNavigationFavoritesAction", 4234 SortId = 30, 4235 Template = RenderMobileNavigationSavedCardsAction() 4236 }; 4237 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSavedCardsAction); 4238 } 4239 4240 Block mobileNavigationSignOutAction = new Block 4241 { 4242 Id = "MobileNavigationSignOutAction", 4243 SortId = 40, 4244 Template = RenderMobileNavigationSignOutAction() 4245 }; 4246 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignOutAction); 4247 } 4248 } 4249 4250 if (Model.Languages.Count > 1) 4251 { 4252 Block mobileNavigationLanguagesAction = new Block 4253 { 4254 Id = "MobileNavigationLanguagesAction", 4255 SortId = 50, 4256 Template = RenderMobileNavigationLanguagesAction() 4257 }; 4258 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationLanguagesAction); 4259 } 4260 } 4261 4262 4263 @helper MobileNavigation() 4264 { 4265 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigation").OrderBy(item => item.SortId).ToList(); 4266 string mobileTopDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design") != null ? Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design").SelectedValue : "nav-left"; 4267 string position = mobileTopDesign == "nav-left" || mobileTopDesign == "nav-search-left" ? "left" : "right"; 4268 4269 <!-- Trigger for mobile navigation --> 4270 <input type="checkbox" id="MobileNavTrigger" class="mobile-nav-trigger mobile-nav-trigger--@position" autocomplete="off" /> 4271 4272 <!-- Mobile navigation --> 4273 <nav class="mobile-navigation mobile-navigation--@position dw-mod"> 4274 <div class="mobile-navigation__wrapper" id="mobileNavigationWrapper"> 4275 @RenderBlockList(subBlocks) 4276 </div> 4277 </nav> 4278 4279 <label class="mobile-nav-trigger-off" for="MobileNavTrigger"></label> 4280 } 4281 4282 @helper RenderMobileNavigationSignIn() 4283 { 4284 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 4285 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 4286 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 4287 string myProfilePageLink = linkStart + myProfilePageId; 4288 string userName = Model.CurrentUser.FirstName; 4289 if (!string.IsNullOrEmpty(userName) && !string.IsNullOrEmpty(Model.CurrentUser.LastName)) 4290 { 4291 userName += " " + Model.CurrentUser.LastName; 4292 } 4293 if (string.IsNullOrEmpty(userName)) 4294 { 4295 userName = Model.CurrentUser.Name; 4296 } 4297 if (string.IsNullOrEmpty(userName)) 4298 { 4299 userName = Model.CurrentUser.UserName; 4300 } 4301 if (string.IsNullOrEmpty(userName)) 4302 { 4303 userName = Model.CurrentUser.Email; 4304 } 4305 4306 <ul class="menu menu-mobile"> 4307 <li class="menu-mobile__item"> 4308 <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> 4309 </li> 4310 </ul> 4311 } 4312 4313 @helper RenderMobileNavigationMenu() 4314 { 4315 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides"; 4316 string menuTemplate = isSlidesDesign ? "BaseMenuForMobileSlides.xslt" : "BaseMenuForMobileExpandable.xslt"; 4317 string levels = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels") : "3"; 4318 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 4319 int startLevel = 0; 4320 4321 @RenderNavigation(new 4322 { 4323 id = "mobilenavigation", 4324 cssclass = "menu menu-mobile dwnavigation", 4325 startLevel = @startLevel, 4326 ecomStartLevel = @startLevel + 1, 4327 endlevel = @levels, 4328 expandmode = "all", 4329 template = @menuTemplate 4330 }) 4331 4332 if (isSlidesDesign) 4333 { 4334 <script> 4335 function goToLevel(level) { 4336 document.getElementById('mobileNavigationWrapper').style.left = -(level * 100) + "%"; 4337 } 4338 4339 document.addEventListener('DOMContentLoaded', function () { 4340 goToLevel(document.getElementById('mobileNavigationWrapper').querySelectorAll('input[type=radio]:checked').length); 4341 }); 4342 </script> 4343 } 4344 4345 if (renderPagesInToolBar) 4346 { 4347 @RenderNavigation(new 4348 { 4349 id = "topToolsMobileNavigation", 4350 cssclass = "menu menu-mobile dwnavigation", 4351 template = "ToolsMenuForMobile.xslt" 4352 }) 4353 } 4354 } 4355 4356 @helper RenderMobileNavigationActions() 4357 { 4358 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigationActions").OrderBy(item => item.SortId).ToList(); ; 4359 4360 <ul class="menu menu-mobile"> 4361 @RenderBlockList(subBlocks) 4362 </ul> 4363 } 4364 4365 @helper RenderMobileNavigationSignInAction() 4366 { 4367 <li class="menu-mobile__item"> 4368 <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> 4369 </li> 4370 } 4371 4372 @helper RenderMobileNavigationCreateAccountAction() 4373 { 4374 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 4375 4376 <li class="menu-mobile__item"> 4377 <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> 4378 </li> 4379 } 4380 4381 @helper RenderMobileNavigationProfileAction() 4382 { 4383 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 4384 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 4385 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 4386 string myProfilePageLink = linkStart + myProfilePageId; 4387 4388 <li class="menu-mobile__item"> 4389 <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> 4390 </li> 4391 } 4392 4393 @helper RenderMobileNavigationOrdersAction() 4394 { 4395 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 4396 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 4397 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); 4398 string myOrdersPageLink = linkStart + myOrdersPageId; 4399 string ordersIcon = "fas fa-list"; 4400 4401 <li class="menu-mobile__item"> 4402 <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> 4403 </li> 4404 } 4405 4406 @helper RenderMobileNavigationFavoritesAction() 4407 { 4408 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 4409 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 4410 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 4411 string myFavoritesPageLink = linkStart + myFavoritesPageId; 4412 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"; 4413 4414 4415 <li class="menu-mobile__item"> 4416 <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> 4417 </li> 4418 } 4419 4420 @helper RenderMobileNavigationSavedCardsAction() 4421 { 4422 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 4423 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 4424 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards"); 4425 string mySavedCardsPageLink = linkStart + mySavedCardsPageId; 4426 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"; 4427 4428 <li class="menu-mobile__item"> 4429 <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> 4430 </li> 4431 } 4432 4433 @helper RenderMobileNavigationSignOutAction() 4434 { 4435 int pageId = Model.TopPage.ID; 4436 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"; 4437 4438 <li class="menu-mobile__item"> 4439 <a class="menu-mobile__link menu-mobile__link--highlighted dw-mod" href="/Admin/Public/ExtranetLogoff.aspx?ID=@pageId" onclick="RememberState.SetCookie('useAnotherAddress', false)"><i class="@signOutIcon menu-mobile__link-icon"></i> @Translate("Sign out")</a> 4440 </li> 4441 } 4442 4443 @helper RenderMobileNavigationLanguagesAction() 4444 { 4445 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides"; 4446 4447 string selectedLanguage = ""; 4448 foreach (var lang in Model.Languages) 4449 { 4450 if (lang.IsCurrent) 4451 { 4452 selectedLanguage = lang.Name; 4453 } 4454 } 4455 4456 <li class="menu-mobile__item dw-mod"> 4457 @if (isSlidesDesign) 4458 { 4459 <input id="MobileMenuCheck_Language" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(1);"> 4460 } 4461 else 4462 { 4463 <input id="MobileMenuCheck_Language" type="checkbox" class="expand-trigger"> 4464 } 4465 <div class="menu-mobile__link__wrap"> 4466 <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> 4467 <label for="MobileMenuCheck_Language" class="menu-mobile__trigger"></label> 4468 </div> 4469 <ul class="menu-mobile menu-mobile__submenu expand-menu"> 4470 @if (isSlidesDesign) 4471 { 4472 <li class="menu-mobile__item dw-mod"> 4473 <div class="menu-mobile__link__wrap"> 4474 <input id="MobileMenuCheck_Language_back" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(0);" /> 4475 <label for="MobileMenuCheck_Language_back" class="menu-mobile__trigger menu-mobile__trigger--back"></label> 4476 <label for="MobileMenuCheck_Language_back" class="menu-mobile__link dw-mod ">@Translate("Back")</label> 4477 </div> 4478 </li> 4479 } 4480 @foreach (var lang in Model.Languages) 4481 { 4482 <li class="menu-mobile__item dw-mod"> 4483 <a class="menu-mobile__link menu-mobile__link--highlighted dw-mod menu-mobile__link--level-1" href="/Default.aspx?AreaID=@Dynamicweb.Services.Pages.GetPage(lang.Page.ID).Area.ID">@lang.Name</a> 4484 </li> 4485 } 4486 </ul> 4487 </li> 4488 }</text> 4489 } 4490 else 4491 { 4492 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4493 4494 @using System 4495 @using System.Web 4496 @using System.Collections.Generic 4497 @using Dynamicweb.Rapido.Blocks.Extensibility 4498 @using Dynamicweb.Rapido.Blocks 4499 4500 @functions { 4501 BlocksPage headerBlocksPage = BlocksPage.GetBlockPage("Master"); 4502 } 4503 4504 @{ 4505 Block masterTools = new Block() 4506 { 4507 Id = "MasterDesktopTools", 4508 SortId = 10, 4509 Template = RenderDesktopTools(), 4510 SkipRenderBlocksList = true, 4511 BlocksList = new List<Block> 4512 { 4513 new Block { 4514 Id = "MasterDesktopToolsText", 4515 SortId = 10, 4516 Template = RenderDesktopToolsText(), 4517 Design = new Design 4518 { 4519 Size = "auto", 4520 HidePadding = true, 4521 RenderType = RenderType.Column 4522 } 4523 }, 4524 new Block { 4525 Id = "MasterDesktopToolsNavigation", 4526 SortId = 20, 4527 Template = RenderDesktopToolsNavigation(), 4528 Design = new Design 4529 { 4530 Size = "auto-width", 4531 HidePadding = true, 4532 RenderType = RenderType.Column 4533 } 4534 } 4535 } 4536 }; 4537 headerBlocksPage.Add("MasterHeader", masterTools); 4538 4539 Block masterDesktopExtra = new Block() 4540 { 4541 Id = "MasterDesktopExtra", 4542 SortId = 10, 4543 Template = RenderDesktopExtra(), 4544 SkipRenderBlocksList = true 4545 }; 4546 headerBlocksPage.Add("MasterHeader", masterDesktopExtra); 4547 4548 Block masterDesktopNavigation = new Block() 4549 { 4550 Id = "MasterDesktopNavigation", 4551 SortId = 20, 4552 Template = RenderDesktopNavigation(), 4553 SkipRenderBlocksList = true 4554 }; 4555 headerBlocksPage.Add("MasterHeader", masterDesktopNavigation); 4556 } 4557 4558 @* Include the Blocks for the page *@ 4559 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4560 4561 @using System 4562 @using System.Web 4563 @using Dynamicweb.Rapido.Blocks.Extensibility 4564 @using Dynamicweb.Rapido.Blocks 4565 4566 @{ 4567 Block masterDesktopLogo = new Block 4568 { 4569 Id = "MasterDesktopLogo", 4570 SortId = 10, 4571 Template = RenderDesktopLogo(), 4572 Design = new Design 4573 { 4574 Size = "auto-width", 4575 HidePadding = true, 4576 RenderType = RenderType.Column, 4577 CssClass = "grid--align-self-center" 4578 } 4579 }; 4580 4581 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopLogo); 4582 } 4583 4584 4585 @helper RenderDesktopLogo() 4586 { 4587 string firstPageId = Model.Area.FirstActivePage.ID.ToString(); 4588 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4589 string alignClass = topLayout == "two-lines-centered" || topLayout == "two-lines" ? "grid--align-self-center" : ""; 4590 alignClass = topLayout == "splitted-center" ? "u-middle" : alignClass; 4591 string logo = Model.Area.Item.GetItem("Layout").GetFile("LogoImage") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoImage").PathUrlEncoded : "/Files/Images/logo-dynamicweb.png"; 4592 if (Path.GetExtension(logo).ToLower() != ".svg") 4593 { 4594 int logoHeight = Model.Area.Item.GetItem("Layout").GetInt32("LogoHeight"); 4595 logoHeight = logoHeight > 0 && Pageview.Device.ToString() != "Mobile" ? logoHeight : 40; 4596 logo = "/Admin/Public/GetImage.ashx?height=" + Converter.ToString(logoHeight) + "&amp;crop=5&amp;Compression=75&amp;image=" + logo; 4597 } 4598 else 4599 { 4600 logo = HttpUtility.UrlDecode(logo); 4601 } 4602 4603 <div class="logo @alignClass dw-mod"> 4604 <a href="/Default.aspx?ID=@firstPageId" class="logo__img dw-mod u-block"> 4605 <img class="grid__cell-img logo__img dw-mod" src="@logo" alt="@Translate("Logo")" /> 4606 </a> 4607 </div> 4608 } 4609 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4610 4611 @using System 4612 @using System.Web 4613 @using Dynamicweb.Rapido.Blocks.Extensibility 4614 @using Dynamicweb.Rapido.Blocks 4615 4616 @functions { 4617 bool isMegaMenu; 4618 } 4619 4620 @{ 4621 isMegaMenu = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu") != null ? Converter.ToBoolean(Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu").SelectedValue) : false; 4622 Block masterDesktopMenu = new Block 4623 { 4624 Id = "MasterDesktopMenu", 4625 SortId = 10, 4626 Template = RenderDesktopMenu(), 4627 Design = new Design 4628 { 4629 Size = "auto", 4630 HidePadding = true, 4631 RenderType = RenderType.Column 4632 } 4633 }; 4634 4635 if (isMegaMenu) 4636 { 4637 masterDesktopMenu.Design.CssClass = "u-reset-position"; 4638 } 4639 4640 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopMenu); 4641 } 4642 4643 @helper RenderDesktopMenu() 4644 { 4645 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4646 string menuAlignment = topLayout == "minimal-right" ? "grid--align-self-end" : ""; 4647 menuAlignment = topLayout == "minimal-center" ? "grid--align-self-center" : topLayout; 4648 string megamenuPromotionImage = Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage").PathUrlEncoded : ""; 4649 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 4650 bool showOnlyHeaders = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowOnlyHeaders"); 4651 int startLevel = renderPagesInToolBar ? 1 : 0; 4652 4653 string promotionLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("MegamenuPromotionLink"); 4654 4655 <div class="grid__cell u-flex @(isMegaMenu ? "u-reset-position" : "") @menuAlignment"> 4656 @if (!isMegaMenu) 4657 { 4658 @RenderNavigation(new 4659 { 4660 id = "topnavigation", 4661 cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap", 4662 startLevel = startLevel, 4663 ecomStartLevel = startLevel + 1, 4664 endlevel = 5, 4665 expandmode = "all", 4666 template = "BaseMenuWithDropdown.xslt" 4667 }); 4668 } 4669 else 4670 { 4671 @RenderNavigation(new 4672 { 4673 id = "topnavigation", 4674 cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap", 4675 startLevel = startLevel, 4676 ecomStartLevel = startLevel + 1, 4677 endlevel = 5, 4678 promotionImage = megamenuPromotionImage, 4679 promotionLink = promotionLink, 4680 expandmode = "all", 4681 showOnlyHeaders = showOnlyHeaders.ToString().ToLower(), 4682 template = "BaseMegaMenu.xslt" 4683 }); 4684 } 4685 </div> 4686 } 4687 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4688 4689 @using System 4690 @using System.Web 4691 @using Dynamicweb.Rapido.Blocks.Extensibility 4692 @using Dynamicweb.Rapido.Blocks 4693 4694 @{ 4695 Block masterDesktopActionsMenu = new Block 4696 { 4697 Id = "MasterDesktopActionsMenu", 4698 SortId = 10, 4699 Template = RenderDesktopActionsMenu(), 4700 Design = new Design 4701 { 4702 CssClass = "u-flex" 4703 }, 4704 SkipRenderBlocksList = true 4705 4706 }; 4707 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopActionsMenu); 4708 4709 if (!string.IsNullOrWhiteSpace(Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink"))) 4710 { 4711 Block masterDesktopActionsHeaderButton = new Block 4712 { 4713 Id = "MasterDesktopActionsHeaderButton", 4714 SortId = 60, 4715 Template = RenderHeaderButton() 4716 }; 4717 masterDesktopActionsMenu.Add(masterDesktopActionsHeaderButton); 4718 } 4719 } 4720 4721 @helper RenderDesktopActionsMenu() 4722 { 4723 List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopActionsMenu").OrderBy(item => item.SortId).ToList(); 4724 4725 <ul class="menu u-flex dw-mod"> 4726 @RenderBlockList(subBlocks) 4727 </ul> 4728 } 4729 4730 @helper RenderHeaderButton() 4731 { 4732 string headerButtonText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonText"); 4733 string headerButtonLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink"); 4734 string headerButtonType = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType") != null ? "btn--" + Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType").SelectedName.ToLower() : ""; 4735 4736 <li class="menu__item menu__item--horizontal menu--clean dw-mod"> 4737 <a class="btn @headerButtonType dw-mod u-no-margin u-margin-left" href="@headerButtonLink">@headerButtonText</a> 4738 </li> 4739 } 4740 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4741 4742 @using System 4743 @using System.Web 4744 @using Dynamicweb.Core; 4745 @using System.Text.RegularExpressions 4746 @using Dynamicweb.Rapido.Blocks.Extensibility 4747 @using Dynamicweb.Rapido.Blocks 4748 4749 @{ 4750 Block masterDesktopActionsMenuLanguageSelector = new Block 4751 { 4752 Id = "MasterDesktopActionsMenuLanguageSelector", 4753 SortId = 40, 4754 Template = RenderLanguageSelector() 4755 }; 4756 4757 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuLanguageSelector); 4758 } 4759 4760 @helper RenderLanguageSelector() 4761 { 4762 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4763 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 4764 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4765 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() : ""; 4766 4767 if (Model.Languages.Count > 1) 4768 { 4769 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon is-dropdown is-dropdown--no-icon dw-mod"> 4770 <div class="@menuLinkClass dw-mod" title="@Translate("Language")"> 4771 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue fa-1_5x"></i> 4772 </div> 4773 <div class="menu menu--dropdown menu--dropdown-right languages-dropdown dw-mod grid__cell"> 4774 @foreach (var lang in Model.Languages) 4775 { 4776 string widthClass = "menu__item--fixed-width"; 4777 string langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " u-margin-right\"></span>" + lang.Name; 4778 string cultureName = Regex.Replace(Dynamicweb.Services.Areas.GetArea(lang.ID).CultureInfo.NativeName, @" ?\(.*?\)", string.Empty); 4779 cultureName = char.ToUpper(cultureName[0]) + cultureName.Substring(1); 4780 4781 if (languageViewType == "flag-culture") 4782 { 4783 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span> " + cultureName; 4784 } 4785 4786 if (languageViewType == "flag") 4787 { 4788 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span>"; 4789 widthClass = ""; 4790 } 4791 4792 if (languageViewType == "name") 4793 { 4794 langInfo = lang.Name; 4795 } 4796 4797 if (languageViewType == "culture") 4798 { 4799 langInfo = cultureName; 4800 widthClass = ""; 4801 } 4802 4803 <div class="menu__item dw-mod @widthClass"> 4804 <a href="/Default.aspx?AreaID=@Dynamicweb.Services.Pages.GetPage(lang.Page.ID).Area.ID" class="menu-dropdown__link dw-mod">@langInfo</a> 4805 </div> 4806 } 4807 </div> 4808 </li> 4809 } 4810 } 4811 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4812 4813 @using System 4814 @using System.Web 4815 @using Dynamicweb.Rapido.Blocks.Extensibility 4816 @using Dynamicweb.Rapido.Blocks 4817 4818 @{ 4819 Block masterDesktopActionsMenuSignIn = new Block 4820 { 4821 Id = "MasterDesktopActionsMenuSignIn", 4822 SortId = 20, 4823 Template = RenderSignIn() 4824 }; 4825 4826 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuSignIn); 4827 } 4828 4829 @helper RenderSignIn() 4830 { 4831 bool navigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 4832 string userInitials = ""; 4833 int pageId = Model.TopPage.ID; 4834 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 4835 int myDashboardPageId = GetPageIdByNavigationTag("CustomerDashboard"); 4836 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 4837 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); 4838 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 4839 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards"); 4840 int myOrderDraftsPageId = GetPageIdByNavigationTag("OrderDraft"); 4841 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 4842 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); 4843 bool hideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); 4844 bool hideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); 4845 bool hideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); 4846 bool hideMyOrderDraftsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrderDrafts"); 4847 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); 4848 bool hideForgotPasswordLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideForgotPasswordLink"); 4849 4850 string linkStart = "/Default.aspx?ID="; 4851 if (Model.CurrentUser.ID <= 0) 4852 { 4853 linkStart += signInProfilePageId + "&RedirectPageId="; 4854 } 4855 4856 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; 4857 string myProfilePageLink = linkStart + myProfilePageId; 4858 string myOrdersPageLink = linkStart + myOrdersPageId; 4859 string myFavoritesPageLink = linkStart + myFavoritesPageId; 4860 string mySavedCardsPageLink = linkStart + mySavedCardsPageId; 4861 string myOrderDraftsLink = linkStart + myOrderDraftsPageId; 4862 4863 string profileIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue : "fa fa-user"; 4864 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"; 4865 string orderDraftsIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("DraftIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("DraftIcon").SelectedValue : "fa fa-clipboard"; 4866 4867 if (Model.CurrentUser.ID != 0) 4868 { 4869 userInitials = Dynamicweb.Rapido.Services.User.GetInitials(Model.CurrentUser.Name, Model.CurrentUser.FirstName, Model.CurrentUser.LastName, Model.CurrentUser.Email, Model.CurrentUser.UserName); 4870 } 4871 4872 if (!navigationItemsHideSignIn) 4873 { 4874 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4875 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu__item--clean"; 4876 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4877 4878 <li class="menu__item menu__item--horizontal menu__item menu__item--icon @liClasses is-dropdown is-dropdown--no-icon dw-mod"> 4879 <div class="@menuLinkClass dw-mod"> 4880 @if (Model.CurrentUser.ID <= 0) 4881 { 4882 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue fa-1_5x" title="@Translate("Sign in")"></i> 4883 } 4884 else 4885 { 4886 <a href="/default.aspx?ID=@myDashboardPageId" class="u-color-inherit" title="@Translate("Customer center")"><div class="circle-icon-btn">@userInitials.ToUpper()</div></a> 4887 } 4888 </div> 4889 <div class="menu menu--dropdown menu--dropdown-right menu--sign-in grid__cell dw-mod"> 4890 <ul class="list list--clean dw-mod"> 4891 @if (Model.CurrentUser.ID <= 0) 4892 { 4893 <li> 4894 <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> 4895 </li> 4896 4897 if (!hideCreateAccountLink) 4898 { 4899 @RenderListItem("/default.aspx?ID=" + createAccountPageId, Translate("Create account")); 4900 } 4901 if (!hideForgotPasswordLink) 4902 { 4903 @RenderListItem(forgotPasswordPageLink, Translate("Forgot your password?")) 4904 } 4905 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) 4906 { 4907 @RenderSeparator() 4908 } 4909 } 4910 @if (!hideMyProfileLink) 4911 { 4912 @RenderListItem(myProfilePageLink, Translate("My Profile"), profileIcon) 4913 } 4914 @if (!hideMyOrdersLink) 4915 { 4916 @RenderListItem(myOrdersPageLink, Translate("My Orders"), "fas fa-list") 4917 } 4918 @if (!hideMyFavoritesLink) 4919 { 4920 @RenderListItem(myFavoritesPageLink, Translate("My Favorites"), favoritesIcon) 4921 } 4922 @if (!hideMySavedCardsLink) 4923 { 4924 @RenderListItem(mySavedCardsPageLink, Translate("My Saved cards"), "fas fa-credit-card") 4925 } 4926 @if (!hideMyOrderDraftsLink) 4927 { 4928 @RenderListItem(myOrderDraftsLink, Translate("My Order drafts"), orderDraftsIcon) 4929 } 4930 @if (Model.CurrentUser.ID > 0) 4931 { 4932 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) 4933 { 4934 @RenderSeparator() 4935 } 4936 4937 //Check if impersonation is on 4938 if (Model.CurrentSecondaryUser != null && Model.CurrentSecondaryUser.ID > 0) 4939 { 4940 <li> 4941 <div class="list__link dw-mod" onclick="document.getElementById('StopImpersonationModalTrigger').checked = true;"> 4942 @Translate("Sign out") 4943 </div> 4944 </li> 4945 } else { 4946 @RenderListItem("/Admin/Public/ExtranetLogoff.aspx?ID=" + pageId, Translate("Sign out")) 4947 } 4948 } 4949 </ul> 4950 </div> 4951 </li> 4952 } 4953 } 4954 4955 @helper RenderListItem(string link, string text, string icon = null) { 4956 <li> 4957 <a href="@link" class="list__link dw-mod" onclick="RememberState.SetCookie('useAnotherAddress', false)"> 4958 @if (!string.IsNullOrEmpty(icon)){<i class="@icon u-margin-right"></i>}@text 4959 </a> 4960 </li> 4961 } 4962 4963 @helper RenderSeparator() 4964 { 4965 <li class="list__seperator dw-mod"></li> 4966 } 4967 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4968 4969 @using System 4970 @using System.Web 4971 @using Dynamicweb.Rapido.Blocks.Extensibility 4972 @using Dynamicweb.Rapido.Blocks 4973 4974 @{ 4975 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideFavorites"); 4976 4977 Block masterDesktopActionsMenuFavorites = new Block 4978 { 4979 Id = "MasterDesktopActionsMenuFavorites", 4980 SortId = 30, 4981 Template = RenderFavorites() 4982 }; 4983 4984 if (!hideMyFavoritesLink && Model.CurrentUser.ID > 0) 4985 { 4986 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuFavorites); 4987 } 4988 } 4989 4990 @helper RenderFavorites() 4991 { 4992 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 4993 string myFavoritesPageLink = "/Default.aspx?ID=" + myFavoritesPageId; 4994 4995 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4996 string liClasses = topLayout != "normal" && topLayout != "splitted-center" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 4997 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4998 4999 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod"> 5000 <a href="@myFavoritesPageLink" class="@menuLinkClass dw-mod" title="@Translate("Favorites")"> 5001 <i class="fas fa-@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue fa-1_5x"></i> 5002 </a> 5003 </li> 5004 } 5005 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5006 5007 @using System 5008 @using System.Web 5009 @using Dynamicweb.Rapido.Blocks.Extensibility 5010 @using Dynamicweb.Rapido.Blocks 5011 @using Dynamicweb.Rapido.Services 5012 5013 @{ 5014 bool hideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 5015 string miniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown"; 5016 5017 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed() && !hideCart) 5018 { 5019 Block masterDesktopActionsMenuMiniCart = new Block 5020 { 5021 Id = "MasterDesktopActionsMenuMiniCart", 5022 SortId = 60, 5023 Template = RenderMiniCart(miniCartLayout == "dropdown"), 5024 SkipRenderBlocksList = true, 5025 BlocksList = new List<Block>() 5026 }; 5027 5028 Block miniCartCounterScriptTemplate = new Block 5029 { 5030 Id = "MiniCartCounterScriptTemplate", 5031 Template = RenderMiniCartCounterContent() 5032 }; 5033 5034 //dropdown layout is default 5035 RazorEngine.Templating.TemplateWriter layoutTemplate; 5036 RazorEngine.Templating.TemplateWriter miniCartTriggerTemplate; 5037 5038 switch (miniCartLayout) 5039 { 5040 case "dropdown": 5041 layoutTemplate = RenderMiniCartDropdownLayout(); 5042 miniCartTriggerTemplate = RenderMiniCartTriggerLink(); 5043 break; 5044 case "panel": 5045 layoutTemplate = RenderMiniCartPanelLayout(); 5046 miniCartTriggerTemplate = RenderMiniCartTriggerLabel(); 5047 break; 5048 case "modal": 5049 layoutTemplate = RenderMiniCartModalLayout(); 5050 miniCartTriggerTemplate = RenderMiniCartTriggerLabel(); 5051 break; 5052 case "none": 5053 default: 5054 layoutTemplate = RenderMiniCartDropdownLayout(); 5055 miniCartTriggerTemplate = RenderMiniCartTriggerLink(); 5056 break; 5057 } 5058 5059 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block 5060 { 5061 Id = "MiniCartTrigger", 5062 Template = miniCartTriggerTemplate 5063 }); 5064 5065 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 5066 { 5067 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block 5068 { 5069 Id = "MiniCartLayout", 5070 Template = layoutTemplate 5071 }); 5072 } 5073 5074 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuMiniCart); 5075 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate); 5076 } 5077 5078 if (hideCart && Dynamicweb.Rapido.Services.User.IsBuyingAllowed()) 5079 { 5080 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", new Block { 5081 Id = "CartInitialization" 5082 }); 5083 } 5084 } 5085 5086 @helper RenderMiniCart(bool hasMouseEnterEvent) 5087 { 5088 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterDesktopActionsMenuMiniCart").OrderBy(item => item.SortId).ToList(); 5089 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5090 string liClasses = topLayout != "normal" ? "menu__item--top-level" : "menu--clean"; 5091 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 5092 string mouseEvent = ""; 5093 string id = "MiniCart"; 5094 if (hasMouseEnterEvent) 5095 { 5096 mouseEvent = "onmouseenter=\"Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=" + miniCartFeedPageId + "&feedType=MiniCart')\""; 5097 id = "miniCartTrigger"; 5098 } 5099 <li class="menu__item menu__item--horizontal menu__item--icon @liClasses dw-mod" id="@id" @mouseEvent> 5100 @RenderBlockList(subBlocks) 5101 </li> 5102 } 5103 5104 @helper RenderMiniCartTriggerLabel() 5105 { 5106 int cartPageId = GetPageIdByNavigationTag("CartPage"); 5107 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart"; 5108 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5109 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 5110 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 5111 5112 <div class="@menuLinkClass dw-mod js-mini-cart-button" onclick="Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart')" title="@Translate("Cart")"> 5113 <div class="u-inline u-position-relative"> 5114 <i class="@cartIcon fa-1_5x"></i> 5115 @RenderMiniCartCounter() 5116 </div> 5117 </div> 5118 } 5119 5120 @helper RenderMiniCartTriggerLink() 5121 { 5122 int cartPageId = GetPageIdByNavigationTag("CartPage"); 5123 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart"; 5124 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5125 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 5126 5127 <a href="/Default.aspx?ID=@cartPageId&Purge=True" class="@menuLinkClass menu__item--icon dw-mod js-mini-cart-button" title="@Translate("Cart")"> 5128 <span class="u-inline u-position-relative"> 5129 <i class="@cartIcon fa-1_5x"></i> 5130 @RenderMiniCartCounter() 5131 </span> 5132 </a> 5133 } 5134 5135 @helper RenderMiniCartCounter() 5136 { 5137 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 5138 string cartProductsCount = Model.Cart.TotalProductsCount.ToString(); 5139 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right"; 5140 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 5141 string cartProductsTotalPrice = showPrice && Model.Cart.TotalPrice != null ? Model.Cart.TotalPrice.Price.Formatted : ""; 5142 cartProductsTotalPrice = counterPosition == "right" ? cartProductsTotalPrice : ""; 5143 5144 if (showPrice && counterPosition == "right") 5145 { 5146 cartProductsCount = Translate("Cart") + " (" + cartProductsCount + ")"; 5147 } 5148 5149 <span class="mini-cart__counter @(counterPosition == "right" ? "mini-cart__counter--inline" : "") dw-mod"> 5150 <span 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"> 5151 <span class="js-mini-cart-counter-content" data-count="@Model.Cart.TotalProductsCount.ToString()"> 5152 @cartProductsCount @cartProductsTotalPrice 5153 </span> 5154 </span> 5155 </span> 5156 } 5157 5158 @helper RenderMiniCartCounterContent() 5159 { 5160 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 5161 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right"; 5162 bool showPriceInMiniCartCounter = Pageview.Device.ToString() != "Mobile" && counterPosition == "right" && showPrice; 5163 5164 <script id="MiniCartCounterContent" type="text/x-template"> 5165 {{#.}} 5166 <span class="js-mini-cart-counter-content dw-mod" data-count="{{numberofproducts}}"> 5167 @if (showPriceInMiniCartCounter) 5168 { 5169 @Translate("Cart")<text>({{numberofproducts}}) {{totalprice}}</text> 5170 } 5171 else 5172 { 5173 <text>{{numberofproducts}}</text> 5174 } 5175 </span> 5176 {{/.}} 5177 </script> 5178 } 5179 5180 @helper RenderMiniCartDropdownLayout() 5181 { 5182 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 5183 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage"); 5184 5185 <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"> 5186 <div class="mini-cart-dropdown__inner dw-mod"> 5187 <span class="u-ta-center u-block dw-mod h3">@Translate("Shopping cart")</span> 5188 <div class="mini-cart-dropdown__body u-flex dw-mod"> 5189 <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> 5190 </div> 5191 </div> 5192 </div> 5193 } 5194 5195 @helper RenderMiniCartPanelLayout() 5196 { 5197 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 5198 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage"); 5199 5200 <div class="mini-cart grid__cell dw-mod"> 5201 <input type="checkbox" id="miniCartTrigger" class="panel-trigger" /> 5202 <div class="panel panel--right panel--with-close-btn dw-mod js-mini-cart" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="block" data-cart-page-link="@cartPageLink"> 5203 <label for="miniCartTrigger" class="panel__close-btn" title="@Translate("Close panel")"><i class="fas fa-times"></i></label> 5204 <div class="panel__content u-full-width dw-mod"> 5205 <h3 class="panel__header dw-mod u-margin-bottom u-ta-center">@Translate("Shopping cart")</h3> 5206 <div class="panel__content-body panel__content-body--cart dw-mod"> 5207 <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> 5208 </div> 5209 </div> 5210 </div> 5211 </div> 5212 } 5213 5214 @helper RenderMiniCartModalLayout() 5215 { 5216 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 5217 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage"); 5218 5219 <div class="mini-cart grid__cell dw-mod"> 5220 <input type="checkbox" id="miniCartTrigger" class="modal-trigger" autocomplete="off" /> 5221 <div class="modal-container dw-mod js-mini-cart" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="block" data-cart-page-link="@cartPageLink"> 5222 <label for="miniCartTrigger" class="modal-overlay"></label> 5223 <div class="modal modal--md modal--top-right dw-mod"> 5224 <div class="modal__body u-flex grid--direction-column dw-mod"> 5225 <h3 class="dw-mod u-ta-center">@Translate("Shopping cart")</h3> 5226 <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> 5227 </div> 5228 <label class="modal__close-btn modal__close-btn--clean dw-mod" for="miniCartTrigger" title="@Translate("Close modal")"></label> 5229 </div> 5230 </div> 5231 </div> 5232 } 5233 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5234 5235 @using System 5236 @using System.Web 5237 @using Dynamicweb.Rapido.Blocks.Extensibility 5238 @using Dynamicweb.Rapido.Blocks 5239 5240 @{ 5241 bool showOrderDraftLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowOrderDraftIcon"); 5242 5243 Block masterDesktopActionsMenuOrderDraft = new Block 5244 { 5245 Id = "MasterDesktopActionsMenuOrderDraft", 5246 SortId = 40, 5247 Template = RenderOrderDraft() 5248 }; 5249 5250 if (showOrderDraftLink && Model.CurrentUser.ID > 0) 5251 { 5252 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuOrderDraft); 5253 } 5254 } 5255 5256 @helper RenderOrderDraft() 5257 { 5258 int OrderDraftPageId = GetPageIdByNavigationTag("OrderDraft"); 5259 string OrderDraftPageLink = "/Default.aspx?ID=" + OrderDraftPageId; 5260 string draftIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("DraftIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("DraftIcon").SelectedValue : "fa fa-clipboard"; 5261 5262 5263 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5264 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 5265 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 5266 5267 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod"> 5268 <a href="@OrderDraftPageLink" class="@menuLinkClass dw-mod" title="@Translate("My order drafts")"> 5269 <span class="u-inline u-position-relative"> 5270 <i class="@draftIcon fa-1_5x"></i> 5271 </span> 5272 </a> 5273 </li> 5274 } 5275 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5276 5277 @using System 5278 @using System.Web 5279 @using Dynamicweb.Rapido.Blocks.Extensibility 5280 @using Dynamicweb.Rapido.Blocks 5281 5282 @{ 5283 bool showDownloadCartLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart"); 5284 5285 Block masterDesktopActionsMenuDownloadCart = new Block 5286 { 5287 Id = "MasterDesktopActionsMenuDownloadCart", 5288 SortId = 50, 5289 Template = RenderDownloadCart() 5290 }; 5291 5292 if (showDownloadCartLink && Model.CurrentUser.ID > 0) 5293 { 5294 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuDownloadCart); 5295 } 5296 } 5297 5298 @helper RenderDownloadCart() 5299 { 5300 int downloadCartPageId = GetPageIdByNavigationTag("DownloadCart"); 5301 string downloadCartPageLink = "/Default.aspx?ID=" + downloadCartPageId; 5302 5303 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5304 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 5305 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 5306 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right"; 5307 5308 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod"> 5309 <a href="@downloadCartPageLink" class="@menuLinkClass dw-mod" title="@Translate("Download cart")"> 5310 <span class="u-inline u-position-relative"> 5311 <i class="fas fa-cart-arrow-down fa-1_5x"></i> 5312 <span class="mini-cart__counter u-hidden @(counterPosition == "right" ? "mini-cart__counter--inline" : "") dw-mod js-download-cart-counter"></span> 5313 </span> 5314 </a> 5315 </li> 5316 } 5317 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5318 5319 @using System 5320 @using System.Web 5321 @using Dynamicweb.Rapido.Blocks.Extensibility 5322 @using Dynamicweb.Rapido.Blocks 5323 5324 @functions { 5325 public class SearchConfiguration 5326 { 5327 public string searchFeedId { get; set; } 5328 public string searchSecondFeedId { get; set; } 5329 public int groupsFeedId { get; set; } 5330 public string resultPageLink { get; set; } 5331 public string searchPlaceholder { get; set; } 5332 public string searchType { get; set; } 5333 public string searchTemplate { get; set; } 5334 public string searchContentTemplate { get; set; } 5335 public string searchValue { get; set; } 5336 public bool showGroups { get; set; } 5337 5338 public SearchConfiguration() 5339 { 5340 searchFeedId = ""; 5341 searchSecondFeedId = ""; 5342 searchType = "product-search"; 5343 searchContentTemplate = ""; 5344 showGroups = true; 5345 } 5346 } 5347 } 5348 @{ 5349 Block masterSearchBar = new Block 5350 { 5351 Id = "MasterSearchBar", 5352 SortId = 40, 5353 Template = RenderSearch("bar"), 5354 Design = new Design 5355 { 5356 Size = "auto", 5357 HidePadding = true, 5358 RenderType = RenderType.Column 5359 } 5360 }; 5361 5362 Block masterSearchAction = new Block 5363 { 5364 Id = "MasterDesktopActionsMenuSearch", 5365 SortId = 10, 5366 Template = RenderSearch() 5367 }; 5368 5369 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterSearchBar); 5370 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterSearchAction); 5371 } 5372 5373 @helper RenderSearch(string type = "mini-search") 5374 { 5375 string productsPageId = Converter.ToString(GetPageIdByNavigationTag("ProductsPage")); 5376 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 5377 string searchType = Model.Area.Item.GetItem("Layout").GetList("TopSearch") != null ? Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue : "productSearch"; 5378 5379 SearchConfiguration searchConfiguration = null; 5380 5381 switch (searchType) { 5382 case "contentSearch": 5383 searchConfiguration = new SearchConfiguration() { 5384 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true", 5385 resultPageLink = contentSearchPageLink, 5386 searchPlaceholder = Translate("Search page"), 5387 groupsFeedId = 0, 5388 searchType = "content-search", 5389 searchTemplate = "SearchPagesTemplate", 5390 showGroups = false 5391 }; 5392 break; 5393 case "combinedSearch": 5394 searchConfiguration = new SearchConfiguration() { 5395 searchFeedId = productsPageId + "&feed=true", 5396 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true", 5397 resultPageLink = Converter.ToString(productsPageId), 5398 searchPlaceholder = Translate("Search products or pages"), 5399 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"), 5400 searchType = "combined-search", 5401 searchTemplate = "SearchProductsTemplateWrap", 5402 searchContentTemplate = "SearchPagesTemplateWrap", 5403 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector") 5404 }; 5405 break; 5406 default: //productSearch 5407 searchConfiguration = new SearchConfiguration() { 5408 resultPageLink = Converter.ToString(productsPageId), 5409 searchFeedId = productsPageId + "&feed=true", 5410 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"), 5411 searchPlaceholder = Translate("Search products"), 5412 searchTemplate = "SearchProductsTemplate", 5413 searchType = "product-search", 5414 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector") 5415 }; 5416 break; 5417 } 5418 searchConfiguration.searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; 5419 5420 if (type == "mini-search") { 5421 @RenderMiniSearch(searchConfiguration) 5422 } else { 5423 @RenderSearchBar(searchConfiguration) 5424 } 5425 } 5426 5427 @helper RenderSearchBar(SearchConfiguration options) 5428 { 5429 <div class="typeahead typeahead--centered u-color-inherit js-typeahead dw-mod" id="ProductSearchBar" 5430 data-page-size="7" 5431 data-search-feed-id="@options.searchFeedId" 5432 data-search-second-feed-id="@options.searchSecondFeedId" 5433 data-result-page-id="@options.resultPageLink" 5434 data-groups-page-id="@options.groupsFeedId" 5435 data-search-type="@options.searchType"> 5436 @if (options.showGroups) 5437 { 5438 <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> 5439 <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> 5440 } 5441 <div class="typeahead-search-field"> 5442 <input type="text" class="u-no-margin u-full-width u-full-height js-typeahead-search-field" placeholder="@options.searchPlaceholder" value="@options.searchValue"> 5443 @if (string.IsNullOrEmpty(options.searchSecondFeedId)) 5444 { 5445 <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> 5446 } 5447 else 5448 { 5449 <div class="dropdown dropdown--absolute-position dropdown--combined grid"> 5450 <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> 5451 <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> 5452 </div> 5453 } 5454 </div> 5455 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod js-typeahead-enter-btn" title="@Translate("Search")"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue"></i></button> 5456 </div> 5457 } 5458 5459 @helper RenderMiniSearch(SearchConfiguration options) 5460 { 5461 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5462 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 5463 5464 <li class="menu__item menu__item--horizontal menu__item--top-level menu__item--icon u-hidden-xxs is-dropdown is-dropdown--no-icon mini-search dw-mod" id="miniSearchIcon"> 5465 <div class="typeahead js-typeahead" id="ProductSearchBar" 5466 data-page-size="7" 5467 data-search-feed-id="@options.searchFeedId" 5468 data-search-second-feed-id="@options.searchSecondFeedId" 5469 data-result-page-id="@options.resultPageLink" 5470 data-search-type="@options.searchType"> 5471 <div class="typeahead-search-field"> 5472 <input type="text" class="u-no-margin u-full-width js-typeahead-search-field" id="headerSearch" placeholder="@options.searchPlaceholder" value="@options.searchValue"> 5473 @if (string.IsNullOrEmpty(options.searchSecondFeedId)) 5474 { 5475 <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> 5476 } 5477 else 5478 { 5479 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--right-aligned"> 5480 <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> 5481 <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> 5482 </div> 5483 } 5484 </div> 5485 </div> 5486 <div class="@menuLinkClass dw-mod" title="@Translate("Search")"> 5487 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> 5488 </div> 5489 </li> 5490 } 5491 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5492 5493 @using System 5494 @using System.Web 5495 @using Dynamicweb.Rapido.Blocks.Extensibility 5496 @using Dynamicweb.Rapido.Blocks 5497 5498 @{ 5499 string headerConfigurationTopLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5500 bool headerConfigurationHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 5501 5502 BlocksPage headerConfigurationPage = BlocksPage.GetBlockPage("Master"); 5503 5504 Block configDesktopLogo = headerConfigurationPage.GetBlockById("MasterDesktopLogo"); 5505 headerConfigurationPage.RemoveBlock(configDesktopLogo); 5506 5507 Block configDesktopMenu = headerConfigurationPage.GetBlockById("MasterDesktopMenu"); 5508 headerConfigurationPage.RemoveBlock(configDesktopMenu); 5509 5510 Block configSearchBar = headerConfigurationPage.GetBlockById("MasterSearchBar"); 5511 headerConfigurationPage.RemoveBlock(configSearchBar); 5512 5513 Block configSearchAction = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenuSearch"); 5514 headerConfigurationPage.RemoveBlock(configSearchAction); 5515 5516 Block configDesktopActionsMenu = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenu"); 5517 headerConfigurationPage.RemoveBlock(configDesktopActionsMenu); 5518 5519 Block configDesktopExtra = headerConfigurationPage.GetBlockById("MasterDesktopExtra"); 5520 5521 switch (headerConfigurationTopLayout) 5522 { 5523 case "condensed": //2 5524 configDesktopLogo.Design.Size = "auto-width"; 5525 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); 5526 5527 configDesktopMenu.SortId = 20; 5528 configDesktopMenu.Design.Size = "auto"; 5529 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5530 5531 configDesktopActionsMenu.SortId = 30; 5532 configDesktopActionsMenu.Design.Size = "auto-width"; 5533 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 5534 5535 if (!headerConfigurationHideSearch) 5536 { 5537 configSearchBar.SortId = 40; 5538 configSearchBar.Design.Size = "12"; 5539 configDesktopExtra.SortId = 50; 5540 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); 5541 } 5542 break; 5543 case "splitted": //3 5544 configDesktopLogo.Design.Size = "auto"; 5545 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 5546 5547 if (!headerConfigurationHideSearch) 5548 { 5549 configSearchBar.SortId = 20; 5550 configSearchBar.Design.Size = "auto"; 5551 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); 5552 } 5553 5554 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5555 5556 configDesktopActionsMenu.SortId = 20; 5557 configDesktopActionsMenu.Design.Size = "auto-width"; 5558 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 5559 break; 5560 case "splitted-center": //4 5561 configDesktopLogo.Design.Size = "auto"; 5562 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 5563 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5564 5565 configDesktopActionsMenu.SortId = 30; 5566 configDesktopActionsMenu.Design.Size = "auto-width"; 5567 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopActionsMenu); 5568 5569 if (!headerConfigurationHideSearch) 5570 { 5571 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 5572 } 5573 break; 5574 case "minimal": //5 5575 configDesktopLogo.Design.Size = "auto-width"; 5576 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); 5577 5578 configDesktopMenu.Design.Size = "auto"; 5579 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5580 5581 configDesktopActionsMenu.SortId = 20; 5582 configDesktopActionsMenu.Design.Size = "auto-width"; 5583 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 5584 5585 if (!headerConfigurationHideSearch) 5586 { 5587 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 5588 } 5589 break; 5590 case "minimal-center": //6 5591 configDesktopLogo.Design.Size = "auto-width"; 5592 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); 5593 5594 configDesktopMenu.Design.Size = "auto"; 5595 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5596 5597 configDesktopActionsMenu.SortId = 20; 5598 configDesktopActionsMenu.Design.Size = "auto-width"; 5599 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 5600 5601 if (!headerConfigurationHideSearch) 5602 { 5603 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 5604 } 5605 break; 5606 case "minimal-right": //7 5607 configDesktopLogo.Design.Size = "auto-width"; 5608 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); 5609 5610 configDesktopMenu.Design.Size = "auto"; 5611 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5612 5613 configDesktopActionsMenu.SortId = 20; 5614 configDesktopActionsMenu.Design.Size = "auto-width"; 5615 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 5616 5617 if (!headerConfigurationHideSearch) 5618 { 5619 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 5620 } 5621 break; 5622 case "two-lines": //8 5623 configDesktopLogo.Design.Size = "auto"; 5624 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 5625 5626 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5627 5628 configDesktopActionsMenu.SortId = 20; 5629 configDesktopActionsMenu.Design.Size = "auto-width"; 5630 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 5631 5632 if (!headerConfigurationHideSearch) 5633 { 5634 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 5635 } 5636 break; 5637 case "two-lines-centered": //9 5638 configDesktopLogo.Design.Size = "auto"; 5639 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 5640 5641 configDesktopMenu.Design.Size = "auto-width"; 5642 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5643 5644 configDesktopActionsMenu.SortId = 20; 5645 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 5646 5647 if (!headerConfigurationHideSearch) 5648 { 5649 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 5650 } 5651 break; 5652 case "normal": //1 5653 default: 5654 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 5655 5656 if (!headerConfigurationHideSearch) 5657 { 5658 configSearchBar.SortId = 20; 5659 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); 5660 } 5661 5662 configDesktopActionsMenu.SortId = 30; 5663 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopActionsMenu); 5664 5665 configDesktopActionsMenu.Design.Size = "auto-width"; 5666 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5667 break; 5668 } 5669 } 5670 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5671 5672 @using System 5673 @using System.Web 5674 @using Dynamicweb.Rapido.Blocks.Extensibility 5675 @using Dynamicweb.Rapido.Blocks 5676 5677 @{ 5678 5679 } 5680 5681 5682 @helper RenderDesktopTools() 5683 { 5684 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopTools").OrderBy(item => item.SortId).ToList(); 5685 5686 <div class="tools-navigation dw-mod"> 5687 <div class="center-container grid top-container__center-container dw-mod"> 5688 @RenderBlockList(subBlocks) 5689 </div> 5690 </div> 5691 } 5692 5693 @helper RenderDesktopToolsText() 5694 { 5695 string toolsText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("ToolsText"); 5696 if (!string.IsNullOrEmpty(toolsText)) 5697 { 5698 <div class="u-margin-top u-margin-bottom">@toolsText</div> 5699 } 5700 } 5701 5702 @helper RenderDesktopToolsNavigation() 5703 { 5704 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 5705 5706 if (renderPagesInToolBar) 5707 { 5708 @RenderNavigation(new 5709 { 5710 id = "topToolsNavigation", 5711 cssclass = "menu menu-tools dw-mod dwnavigation", 5712 template = "TopMenu.xslt" 5713 }) 5714 } 5715 } 5716 5717 @helper RenderDesktopNavigation() 5718 { 5719 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopNavigation").OrderBy(item => item.SortId).ToList(); 5720 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5721 string alignClass = topLayout == "two-lines-centered" ? "grid--justify-center" : ""; 5722 <nav class="main-navigation dw-mod"> 5723 <div class="center-container top-container__center-container grid @alignClass dw-mod"> 5724 @RenderBlockList(subBlocks) 5725 </div> 5726 </nav> 5727 } 5728 5729 @helper RenderDesktopExtra() 5730 { 5731 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopExtra").OrderBy(item => item.SortId).ToList(); 5732 5733 if (subBlocks.Count > 0) 5734 { 5735 <div class="header header-top dw-mod"> 5736 <div class="center-container top-container__center-container grid--justify-space-between grid grid--align-center dw-mod"> 5737 @RenderBlockList(subBlocks) 5738 </div> 5739 </div> 5740 } 5741 }</text> 5742 } 5743 5744 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5745 5746 @using System 5747 @using System.Web 5748 @using Dynamicweb.Rapido.Blocks.Extensibility 5749 @using Dynamicweb.Rapido.Blocks 5750 @using Dynamicweb.Rapido.Blocks.Components.General 5751 @using Dynamicweb.Frontend 5752 5753 @functions { 5754 int impersonationPageId; 5755 string impersonationLayout; 5756 int impersonationFeed; 5757 Block impersonationBar; 5758 5759 string getUserNameFromParams(string firstName, string middleName, string lastName, string name, string email, string userName) 5760 { 5761 string username = ""; 5762 5763 if (!string.IsNullOrEmpty(firstName) && !string.IsNullOrEmpty(lastName)) 5764 { 5765 username = firstName + " " + (!string.IsNullOrEmpty(middleName) ? middleName + " " : "") + lastName; 5766 } 5767 else if (!string.IsNullOrEmpty(name)) 5768 { 5769 username = name; 5770 } 5771 else if (!string.IsNullOrEmpty(email)) 5772 { 5773 username = email; 5774 } 5775 else 5776 { 5777 username = userName; 5778 } 5779 return username; 5780 } 5781 5782 string getUserName(UserViewModel user) 5783 { 5784 return getUserNameFromParams(user.FirstName, user.MiddleName, user.LastName, user.Name, user.Email, user.UserName); 5785 } 5786 5787 string getUserName(Dynamicweb.Security.UserManagement.User user) 5788 { 5789 return getUserNameFromParams(user.FirstName, user.MiddleName, user.LastName, user.Name, user.Email, user.UserName); 5790 } 5791 } 5792 5793 @{ 5794 impersonationPageId = GetPageIdByNavigationTag("Impersonation"); 5795 impersonationLayout = Model.Area.Item.GetItem("Ecommerce").GetList("ImpersonationLayout") != null ? Model.Area.Item.GetItem("Ecommerce").GetList("ImpersonationLayout").SelectedValue : "bar"; 5796 impersonationFeed = GetPageIdByNavigationTag("UsersFeed"); 5797 5798 if (Model.CurrentUser.ID > 0 && Model.SecondaryUsers.Count > 0) 5799 { 5800 impersonationBar = new Block 5801 { 5802 Id = "ImpersonationBar", 5803 SortId = 50, 5804 Template = RenderImpersonation(), 5805 SkipRenderBlocksList = true, 5806 Design = new Design 5807 { 5808 Size = "auto-width", 5809 HidePadding = true, 5810 RenderType = RenderType.Column 5811 } 5812 }; 5813 5814 if (impersonationLayout == "top-bar") { 5815 impersonationBar.SortId = 9; 5816 } 5817 5818 Block impersonationContent = new Block 5819 { 5820 Id = "ImpersonationContent", 5821 SortId = 20 5822 }; 5823 5824 if (Model.CurrentSecondaryUser != null && Model.CurrentSecondaryUser.ID > 0) 5825 { 5826 //Render stop impersonation view 5827 impersonationContent.Template = RenderStopImpersonationView(); 5828 5829 5830 Modal stopImpersonation = new Modal 5831 { 5832 Id = "StopImpersonation", 5833 Heading = new Heading { 5834 Level = 2, 5835 Title = Translate("Sign out"), 5836 Icon = new Icon { 5837 Name = "fa-sign-out", 5838 Prefix = "fas", 5839 LabelPosition = IconLabelPosition.After 5840 } 5841 }, 5842 Width = ModalWidth.Sm, 5843 BodyTemplate = RenderStopImpersonationForm() 5844 }; 5845 5846 Block stopImpersonationBlock = new Block 5847 { 5848 Id = "StopImpersonationBlock", 5849 SortId = 10, 5850 Component = stopImpersonation 5851 }; 5852 impersonationBar.BlocksList.Add(stopImpersonationBlock); 5853 } 5854 else 5855 { 5856 //Render main view 5857 switch (impersonationLayout) 5858 { 5859 case "right-lower-box": 5860 impersonationContent.BlocksList.Add( 5861 new Block { 5862 Id = "RightLowerBoxHeader", 5863 SortId = 10, 5864 Component = new Heading { 5865 Level = 5, 5866 Title = Translate("View the list of users you can sign in as"), 5867 CssClass = "impersonation-text" 5868 } 5869 } 5870 ); 5871 impersonationContent.BlocksList.Add( 5872 new Block { 5873 Id = "RightLowerBoxContent", 5874 SortId = 20, 5875 Template = RenderImpersonationControls() 5876 } 5877 ); 5878 break; 5879 case "right-lower-bar": 5880 impersonationContent.BlocksList.Add( 5881 new Block { 5882 Id = "RightLowerBarContent", 5883 SortId = 10, 5884 Template = RenderImpersonationControls() 5885 } 5886 ); 5887 break; 5888 case "bar": 5889 default: 5890 impersonationContent.BlocksList.Add( 5891 new Block { 5892 Id = "ViewListLink", 5893 SortId = 20, 5894 Template = RenderViewListLink() 5895 } 5896 ); 5897 impersonationContent.BlocksList.Add( 5898 new Block { 5899 Id = "BarTypeaheadSearch", 5900 SortId = 30, 5901 Template = RenderTypeaheadSearch() 5902 } 5903 ); 5904 break; 5905 } 5906 } 5907 impersonationBar.BlocksList.Add(impersonationContent); 5908 5909 impersonationBar.BlocksList.Add( 5910 new Block 5911 { 5912 Id = "ImpersonationSearchTemplates", 5913 SortId = 30, 5914 Template = RenderSearchResultTemplate() 5915 } 5916 ); 5917 if (impersonationLayout != "bar" && impersonationLayout != "top-bar") 5918 { 5919 impersonationBar.BlocksList.Add( 5920 new Block 5921 { 5922 Id = "ImpersonationSearchScripts", 5923 SortId = 40, 5924 Template = RenderSearchScripts() 5925 } 5926 ); 5927 } 5928 BlocksPage.GetBlockPage("Master").Add("MasterHeader", impersonationBar); 5929 } 5930 } 5931 5932 @helper RenderImpersonation() 5933 { 5934 List<Block> subBlocks = impersonationBar.BlocksList.OrderBy(item => item.SortId).ToList(); 5935 <input type="checkbox" class="impersonation-trigger js-remember-state" id="ImpersonationMinimizeTrigger" /> 5936 <div class="impersonation impersonation--@(impersonationLayout)-layout dw-mod" id="Impersonation"> 5937 @if (impersonationLayout == "right-lower-box") 5938 { 5939 @RenderRightLowerBoxHeader() 5940 } 5941 <div class="center-container top-container__center-container impersonation__container @(impersonationLayout != "bar" && impersonationLayout != "top-bar" ? "impersonation__container--box" : "") dw-mod"> 5942 @*Impersonation*@ 5943 @RenderBlockList(subBlocks) 5944 </div> 5945 </div> 5946 } 5947 5948 @helper RenderRightLowerBoxHeader() 5949 { 5950 <div class="impersonation__header dw-mod"> 5951 <div class="impersonation__title">@Translate("Impersonation")</div> 5952 <label for="ImpersonationMinimizeTrigger" class="btn btn--impersonation impersonation__minimize-btn dw-mod" onclick="this.blur();"> 5953 @Render(new Icon 5954 { 5955 Prefix = "fas", 5956 Name = "fa-window-minimize" 5957 }) 5958 </label> 5959 </div> 5960 } 5961 5962 @helper RenderStopImpersonationView() 5963 { 5964 string secondaryUserName = getUserName(Model.CurrentSecondaryUser); 5965 string userName = getUserName(Pageview.User); 5966 string impersonationText = "<span class=\"impersonation-light-text dw-mod\">" + Translate("Logged in as") + "</span> <b>" + secondaryUserName + "</b> <span class=\"impersonation-light-text dw-mod\">" + Translate("by") + "</span> <b>" + userName + "</b> "; 5967 impersonationText = Dynamicweb.Security.UserManagement.User.ImpersonationMode == Dynamicweb.Security.UserManagement.UserImpersonation.Full ? "<span class=\"impersonation-light-text dw-mod\">" + Translate("Logged in as") + "</span> <b>" + userName + "</b> <span class=\"impersonation-light-text dw-mod\">" + Translate("by") + "</span> <b>" + secondaryUserName + "</b> " : impersonationText; 5968 5969 if (impersonationLayout == "right-lower-box") 5970 { 5971 <div class="u-margin-bottom--lg u-ta-center"> 5972 @impersonationText 5973 </div> 5974 <div class="u-margin-bottom--lg u-ta-center"> 5975 @RenderSwitchAccountButton() 5976 </div> 5977 @RenderStopImpersonationButton() 5978 } 5979 else 5980 { 5981 <div class="grid grid--align-center impersonation__stop-wrap"> 5982 <div class="impersonation-bar-item dw-mod"> 5983 @impersonationText 5984 </div> 5985 <div class="impersonation-bar-item dw-mod"> 5986 @RenderSwitchAccountButton() 5987 </div> 5988 <div class="impersonation-bar-item dw-mod"> 5989 @RenderStopImpersonationButton() 5990 </div> 5991 </div> 5992 } 5993 } 5994 5995 @helper RenderSwitchAccountButton() { 5996 @Render(new Button 5997 { 5998 Href = "/Default.aspx?ID=" + impersonationPageId, 5999 ButtonType = ButtonType.Button, 6000 ButtonLayout = ButtonLayout.Clean, 6001 Title = Translate("Switch account"), 6002 Icon = new Icon { 6003 Name = "fa-users", 6004 Prefix = "fal", 6005 LabelPosition = IconLabelPosition.After 6006 }, 6007 CssClass = "u-no-margin u-color-inherit" 6008 }) 6009 } 6010 6011 @helper RenderStopImpersonationForm() 6012 { 6013 string secondaryUserName = getUserName(Model.CurrentSecondaryUser); 6014 string userName = getUserName(Pageview.User); 6015 int pageId = Model.TopPage.ID; 6016 6017 <form method="post" class="u-no-margin"> 6018 @Render(new Button 6019 { 6020 ButtonType = ButtonType.Submit, 6021 ButtonLayout = ButtonLayout.Secondary, 6022 Title = Translate("Sign out as") + " " + userName, 6023 Href = "/Default.aspx?ID=" + impersonationPageId, 6024 CssClass = "btn--full", 6025 Name = "DwExtranetRemoveSecondaryUser" 6026 }) 6027 6028 @Render(new Button 6029 { 6030 ButtonType = ButtonType.Submit, 6031 ButtonLayout = ButtonLayout.Secondary, 6032 Title = Translate("Sign out as") + " " + secondaryUserName, 6033 Href = "/Admin/Public/ExtranetLogoff.aspx?ID=" + pageId, 6034 CssClass = "btn--full", 6035 Name = "DwExtranetRemoveSecondaryUser" 6036 }) 6037 </form> 6038 } 6039 6040 @helper RenderStopImpersonationButton() { 6041 @Render(new Button 6042 { 6043 ButtonType = ButtonType.Button, 6044 ButtonLayout = ButtonLayout.Clean, 6045 Title = Translate("Sign out"), 6046 Icon = new Icon { 6047 Name = "fa-sign-out", 6048 Prefix = "fal", 6049 LabelPosition = IconLabelPosition.After 6050 }, 6051 OnClick = "document.getElementById('StopImpersonationModalTrigger').checked = true", 6052 CssClass = "u-no-margin" 6053 }) 6054 } 6055 6056 @helper RenderImpersonationControls() 6057 { 6058 <div class="impersonation__controls"> 6059 @RenderViewListLink() 6060 @RenderSearchBox() 6061 </div> 6062 @RenderResultsList() 6063 } 6064 6065 @helper RenderViewListLink() 6066 { 6067 string title = impersonationLayout == "right-lower-box" ? Translate("View the list") : Translate("View the list of users you can sign in as"); 6068 string buttonClasses = impersonationLayout == "right-lower-box" ? "impersonation__button btn btn--impersonation" : "impersonation__link impersonation__link"; 6069 6070 @Render(new Link { 6071 ButtonLayout = ButtonLayout.None, 6072 Title = title, 6073 Href = "/Default.aspx?ID=" + impersonationPageId, 6074 CssClass = buttonClasses 6075 }) 6076 } 6077 6078 @helper RenderSearchBox() 6079 { 6080 <div class="impersonation__search-wrap"> 6081 <input placeholder="@Translate("Search users")" type="text" class="impersonation__search-field dw-mod" onkeyup="searchKeyUpHandler(event)" id="ImpersonationBoxSearchField"> 6082 <div id="ImpersonationBoxSearchFind" class="impersonation__search-icon dw-mod" onclick="updateResults(document.getElementById('ImpersonationBoxSearchField').value)"> 6083 <i class="fal fa-search"></i> 6084 </div> 6085 <div id="ImpersonationBoxSearchClear" class="impersonation__search-icon u-hidden dw-mod" onclick="clearResults();"> 6086 <i class="fal fa-times"></i> 6087 </div> 6088 </div> 6089 } 6090 6091 @helper RenderTypeaheadSearch() 6092 { 6093 <div class="typeahead u-ta-right impersonation__typeahead js-typeahead dw-mod" id="ImpersonationSearchBar" 6094 data-page-size="5" 6095 data-search-feed-id="@impersonationFeed" 6096 data-result-page-id="@impersonationPageId" 6097 data-search-type="user-search" 6098 data-search-parameter-name="q"> 6099 6100 <div class="typeahead-search-field"> 6101 <input type="text" class="u-no-margin u-full-width js-typeahead-search-field" placeholder="@Translate("Search users")"> 6102 <ul class="dropdown dropdown--absolute-position u-min-w220px u-full-width js-handlebars-root js-typeahead-search-content dw-mod" id="ImpersonationSearchBarContent" data-template="ImpersonationSearchResult" data-json-feed="/Default.aspx?ID=@impersonationFeed" data-init-onload="false"></ul> 6103 </div> 6104 </div> 6105 } 6106 6107 @helper RenderResultsList() 6108 { 6109 <ul id="ImpersonationBoxSearchResults" class="impersonation__search-results js-handlebars-root dw-mod" data-template="ImpersonationSearchResult" data-json-feed="/Default.aspx?ID=@impersonationFeed" data-init-onload="false" data-preloader="minimal"></ul> 6110 } 6111 6112 @helper RenderSearchResultTemplate() 6113 { 6114 <script id="ImpersonationSearchResult" type="text/x-template"> 6115 {{#.}} 6116 {{#Users}} 6117 <li class="impersonation__search-results-item impersonation-user"> 6118 <form method="post" class="impersonation-user__form" name="account{{id}}"> 6119 <input type="hidden" id="DWExtranetSecondaryUserSelector" name="DWExtranetSecondaryUserSelector" value="{{id}}"> 6120 <div class="impersonation-user__info"> 6121 <div class="impersonation-user__name">{{userName}}</div> 6122 <div class="impersonation-user__number">{{customerNumber}}</div> 6123 </div> 6124 @Render(new Button 6125 { 6126 ButtonType = ButtonType.Submit, 6127 ButtonLayout = ButtonLayout.Secondary, 6128 Title = Translate("Sign in as"), 6129 CssClass = "impersonation-user__sign-in-btn" + (impersonationLayout != "bar" ? " btn--impersonation" : "") 6130 }) 6131 </form> 6132 </li> 6133 {{/Users}} 6134 {{#unless Users}} 6135 <li class="impersonation__search-results-item impersonation__search-results-item--not-found"> 6136 @Translate("Your search gave 0 results") 6137 </li> 6138 {{/unless}} 6139 {{/.}} 6140 </script> 6141 } 6142 6143 @helper RenderSearchScripts() 6144 { 6145 <script> 6146 let inputDelayTimer; 6147 function searchKeyUpHandler(e) { 6148 clearTimeout(inputDelayTimer); 6149 let value = e.target.value; 6150 if (value != "") { 6151 inputDelayTimer = setTimeout(function () { 6152 updateResults(value); 6153 }, 500); 6154 } else { 6155 clearResults(); 6156 } 6157 }; 6158 6159 function updateResults(value) { 6160 if (value == "") { 6161 return null; 6162 } 6163 HandlebarsBolt.UpdateContent("ImpersonationBoxSearchResults", "/Default.aspx?ID=@impersonationFeed&q=" + value); 6164 document.getElementById("ImpersonationBoxSearchFind").classList.add("u-hidden"); 6165 document.getElementById("ImpersonationBoxSearchClear").classList.remove("u-hidden"); 6166 } 6167 6168 function clearResults() { 6169 document.getElementById("ImpersonationBoxSearchField").value = ""; 6170 HandlebarsBolt.CleanContainer("ImpersonationBoxSearchResults"); 6171 document.getElementById("ImpersonationBoxSearchFind").classList.remove("u-hidden"); 6172 document.getElementById("ImpersonationBoxSearchClear").classList.add("u-hidden"); 6173 } 6174 </script> 6175 } 6176 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 6177 6178 @using System 6179 @using System.Web 6180 @using System.Collections.Generic 6181 @using Dynamicweb.Rapido.Blocks.Extensibility 6182 @using Dynamicweb.Rapido.Blocks 6183 6184 @{ 6185 BlocksPage miniCartBlocksPage = BlocksPage.GetBlockPage("Master"); 6186 string orderlinesView = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView").SelectedValue : "table"; 6187 6188 Block orderLines = new Block 6189 { 6190 Id = "MiniCartOrderLines", 6191 SkipRenderBlocksList = true, 6192 BlocksList = new List<Block> 6193 { 6194 new Block { 6195 Id = "MiniCartOrderLinesList", 6196 SortId = 20, 6197 Template = RenderMiniCartOrderLinesList() 6198 } 6199 } 6200 }; 6201 6202 Block orderlinesScriptTemplates = new Block 6203 { 6204 Id = "OrderlinesScriptTemplates" 6205 }; 6206 6207 if (orderlinesView == "table") 6208 { 6209 orderLines.Template = RenderMiniCartOrderLinesTable(); 6210 orderLines.BlocksList.Add( 6211 new Block 6212 { 6213 Id = "MiniCartOrderlinesTableHeader", 6214 SortId = 10, 6215 Template = RenderMiniCartOrderLinesHeader() 6216 } 6217 ); 6218 6219 orderlinesScriptTemplates.Template = RenderMiniCartScriptsTableTemplates(); 6220 } 6221 else 6222 { 6223 orderLines.Template = RenderMiniCartOrderLinesBlocks(); 6224 orderlinesScriptTemplates.Template = RenderMiniCartScriptsListTemplates(); 6225 } 6226 6227 miniCartBlocksPage.Add("MasterBottomSnippets", orderlinesScriptTemplates); 6228 6229 Block miniCartScriptTemplates = new Block() 6230 { 6231 Id = "MasterMiniCartTemplates", 6232 SortId = 1, 6233 Template = RenderMiniCartScriptTemplates(), 6234 SkipRenderBlocksList = true, 6235 BlocksList = new List<Block> 6236 { 6237 orderLines, 6238 new Block { 6239 Id = "MiniCartFooter", 6240 Template = RenderMiniCartFooter(), 6241 SortId = 50, 6242 SkipRenderBlocksList = true, 6243 BlocksList = new List<Block> 6244 { 6245 new Block { 6246 Id = "MiniCartSubTotal", 6247 Template = RenderMiniCartSubTotal(), 6248 SortId = 30 6249 }, 6250 new Block { 6251 Id = "MiniCartFees", 6252 Template = RenderMiniCartFees(), 6253 SortId = 40 6254 }, 6255 new Block { 6256 Id = "MiniCartPoints", 6257 Template = RenderMiniCartPoints(), 6258 SortId = 50 6259 }, 6260 new Block { 6261 Id = "MiniCartTotal", 6262 Template = RenderMiniCartTotal(), 6263 SortId = 60 6264 }, 6265 new Block { 6266 Id = "MiniCartDisclaimer", 6267 Template = RenderMiniCartDisclaimer(), 6268 SortId = 70 6269 }, 6270 new Block { 6271 Id = "MiniCartActions", 6272 Template = RenderMiniCartActions(), 6273 SortId = 80 6274 } 6275 } 6276 } 6277 } 6278 }; 6279 6280 miniCartBlocksPage.Add("MasterBottomSnippets", miniCartScriptTemplates); 6281 } 6282 6283 @helper RenderMiniCartScriptsTableTemplates() 6284 { 6285 <script id="MiniCartOrderline" type="text/x-template"> 6286 {{#unless isEmpty}} 6287 <tr> 6288 <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> 6289 <td class="u-va-middle"> 6290 <a href="{{link}}" class="mini-cart-orderline__name" title="{{name}}">{{name}}</a> 6291 {{#if variantname}} 6292 <a href="{{link}}" class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{variantname}}</a> 6293 {{/if}} 6294 {{#if unitname}} 6295 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{unitname}}</div> 6296 {{/if}} 6297 </td> 6298 <td class="u-ta-right u-va-middle">{{quantity}}</td> 6299 <td class="u-ta-right u-va-middle"> 6300 {{#if pointsTotal}} 6301 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 6302 {{else}} 6303 {{totalprice}} 6304 {{/if}} 6305 </td> 6306 </tr> 6307 {{/unless}} 6308 </script> 6309 6310 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 6311 {{#unless isEmpty}} 6312 <tr class="table__row--no-border"> 6313 <td class="u-w60px">&nbsp;</td> 6314 <td><div class="mini-cart-orderline__name dw-mod">{{name}}</div></td> 6315 <td class="u-ta-right">&nbsp;</td> 6316 <td class="u-ta-right">{{totalprice}}</td> 6317 </tr> 6318 {{/unless}} 6319 </script> 6320 } 6321 6322 @helper RenderMiniCartScriptsListTemplates() 6323 { 6324 int cartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 6325 6326 <script id="MiniCartOrderline" type="text/x-template"> 6327 {{#unless isEmpty}} 6328 <div class="mini-cart-orderline grid dw-mod"> 6329 <div class="grid__col-4"> 6330 <a href="{{link}}" class="{{hideimage}}"> 6331 <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}}"> 6332 </a> 6333 </div> 6334 <div class="grid__col-8"> 6335 <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> 6336 {{#if variantname}} 6337 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Variant"): {{variantname}}</div> 6338 {{/if}} 6339 {{#if unitname}} 6340 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Unit"): {{unitname}}</div> 6341 {{/if}} 6342 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Qty"): {{quantity}}</div> 6343 6344 <div class="grid__cell-footer"> 6345 <div class="grid__cell"> 6346 <div class="u-pull--left mini-cart-orderline__price dw-mod"> 6347 {{#if pointsTotal}} 6348 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 6349 {{else}} 6350 {{totalprice}} 6351 {{/if}} 6352 </div> 6353 <button type="button" 6354 title="@Translate("Remove orderline")" 6355 class="btn btn--clean btn--condensed u-pull--right mini-cart-orderline__remove-btn dw-mod" 6356 onclick="{{#if googleImpression}}googleImpressionRemoveFromCart({{googleImpression}});{{/if}}Cart.UpdateCart('miniCartContent', '/Default.aspx?ID=@cartFeedPageId', 'CartCmd=DelOrderLine&key={{orderLineId}}&redirect=false', true);">@Translate("Remove")</button> 6357 </div> 6358 </div> 6359 </div> 6360 </div> 6361 {{/unless}} 6362 </script> 6363 6364 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 6365 {{#unless isEmpty}} 6366 <div class="mini-cart-orderline mini-cart-orderline--discount grid dw-mod"> 6367 <div class="grid__col-4"> 6368 <div class="mini-cart-orderline__name mini-cart-orderline__name dw-mod">{{name}}</div> 6369 </div> 6370 <div class="grid__col-8">{{totalprice}}</div> 6371 </div> 6372 {{/unless}} 6373 </script> 6374 } 6375 6376 @helper RenderMiniCartScriptTemplates() 6377 { 6378 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMiniCartTemplates").OrderBy(item => item.SortId).ToList(); 6379 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 6380 string cartPageLink = string.Concat("/Default.aspx?ID=", GetPageIdByNavigationTag("CartPage")); 6381 bool miniCartUseGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 6382 6383 <script id="MiniCartContent" type="text/x-template"> 6384 {{#.}} 6385 {{#unless isEmpty}} 6386 @if (miniCartUseGoogleTagManager) 6387 { 6388 <text>{{{googleEnchantImpressionEmptyCart OrderLines}}}</text> 6389 } 6390 @RenderBlockList(subBlocks) 6391 {{/unless}} 6392 {{/.}} 6393 </script> 6394 } 6395 6396 @helper RenderMiniCartOrderLinesTable() 6397 { 6398 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList(); 6399 6400 <div class="u-overflow-auto"> 6401 <table class="table mini-cart-table dw-mod"> 6402 @RenderBlockList(subBlocks) 6403 </table> 6404 </div> 6405 } 6406 6407 @helper RenderMiniCartOrderLinesBlocks() 6408 { 6409 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList(); 6410 6411 <div class="u-overflow-auto"> 6412 @RenderBlockList(subBlocks) 6413 </div> 6414 } 6415 6416 @helper RenderMiniCartOrderLinesHeader() 6417 { 6418 <thead> 6419 <tr> 6420 <td>&nbsp;</td> 6421 <td>@Translate("Product")</td> 6422 <td class="u-ta-right">@Translate("Qty")</td> 6423 <td class="u-ta-right" width="120">@Translate("Price")</td> 6424 </tr> 6425 </thead> 6426 } 6427 6428 @helper RenderMiniCartOrderLinesList() 6429 { 6430 <text> 6431 {{#OrderLines}} 6432 {{#ifCond template "===" "CartOrderline"}} 6433 {{>MiniCartOrderline}} 6434 {{/ifCond}} 6435 {{#ifCond template "===" "CartOrderlineMobile"}} 6436 {{>MiniCartOrderline}} 6437 {{/ifCond}} 6438 {{#ifCond template "===" "CartOrderlineDiscount"}} 6439 {{>MiniCartOrderlineDiscount}} 6440 {{/ifCond}} 6441 {{/OrderLines}} 6442 </text> 6443 } 6444 6445 @helper RenderMiniCartFees() 6446 { 6447 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 6448 if (!pointShop) 6449 { 6450 <text> 6451 {{#unless hidePaymentfee}} 6452 <div class="grid"> 6453 <div class="grid__col-6 grid__col--bleed-y"> 6454 {{paymentmethod}} 6455 </div> 6456 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{paymentfee}}</div> 6457 </div> 6458 {{/unless}} 6459 </text> 6460 } 6461 <text> 6462 {{#unless hideShippingfee}} 6463 <div class="grid"> 6464 <div class="grid__col-6 grid__col--bleed-y"> 6465 {{shippingmethod}} 6466 </div> 6467 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{shippingfee}}</div> 6468 </div> 6469 {{/unless}} 6470 </text> 6471 <text> 6472 {{#if hasTaxSettings}} 6473 <div class="grid"> 6474 <div class="grid__col-6 grid__col--bleed-y">@Translate("Sales Tax")</div> 6475 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{totaltaxes}}</div> 6476 </div> 6477 {{/if}} 6478 </text> 6479 } 6480 6481 @helper RenderMiniCartFooter() 6482 { 6483 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartFooter").OrderBy(item => item.SortId).ToList(); 6484 6485 <div class="mini-cart__footer u-border-top u-padding-top dw-mod"> 6486 @RenderBlockList(subBlocks) 6487 </div> 6488 } 6489 6490 @helper RenderMiniCartActions() 6491 { 6492 int cartPageId = GetPageIdByNavigationTag("CartPage"); 6493 6494 <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> 6495 <a href="/Default.aspx?ID=@cartPageId" title="@Translate("Go to cart")" class="btn btn--primary u-full-width u-no-margin dw-mod">@Translate("Go to cart")</a> 6496 } 6497 6498 @helper RenderMiniCartPoints() 6499 { 6500 <text> 6501 {{#if earnings}} 6502 <div class="grid"> 6503 <div class="grid__col-6 grid__col--bleed-y">@Translate("Earnings")</div> 6504 <div class="grid__col-6 grid__col--bleed-y grid--align-end"> 6505 <div> 6506 <span class="u-color--loyalty-points">{{earnings}}</span> @Translate("points") 6507 </div> 6508 </div> 6509 </div> 6510 {{/if}} 6511 </text> 6512 } 6513 6514 @helper RenderMiniCartSubTotal() 6515 { 6516 bool hasTaxSettings = Dynamicweb.Rapido.Services.Countries.HasTaxSettings(Model.Cart.ID); 6517 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 6518 if (!pointShop) 6519 { 6520 <text> 6521 {{#unless hideSubTotal}} 6522 <div class="grid dw-mod u-bold"> 6523 <div class="grid__col-6 grid__col--bleed-y">@Translate("Subtotal")</div> 6524 <div class="grid__col-6 grid__col--bleed-y grid--align-end"> 6525 @if (hasTaxSettings) 6526 { 6527 <text>{{subtotalpricewithouttaxes}}</text> 6528 } 6529 else 6530 { 6531 <text>{{subtotalprice}}</text> 6532 } 6533 </div> 6534 </div> 6535 {{/unless}} 6536 </text> 6537 } 6538 } 6539 6540 @helper RenderMiniCartTotal() 6541 { 6542 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 6543 6544 <div class="mini-cart-totals grid u-border-top u-margin-top dw-mod"> 6545 <div class="grid__col-6">@Translate("Total")</div> 6546 <div class="grid__col-6 grid--align-end"> 6547 <div> 6548 @if (pointShop) 6549 { 6550 <span class="u-color--loyalty-points">{{pointsUsedInCart}}</span> @Translate("points") 6551 } 6552 else 6553 { 6554 <text>{{totalprice}}</text> 6555 } 6556 </div> 6557 </div> 6558 </div> 6559 } 6560 6561 @helper RenderMiniCartDisclaimer() 6562 { 6563 <text> 6564 {{#if showCheckoutDisclaimer}} 6565 <div class="grid u-margin-bottom u-ta-right"> 6566 <small class="grid__col-12">{{checkoutDisclaimer}}</small> 6567 </div> 6568 {{/if}} 6569 </text> 6570 } 6571 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 6572 6573 @using Dynamicweb.Rapido.Blocks.Extensibility 6574 @using Dynamicweb.Rapido.Blocks 6575 @using Dynamicweb.Rapido.Blocks.Components.General 6576 @using Dynamicweb.Rapido.Blocks.Components 6577 @using Dynamicweb.Rapido.Services 6578 6579 @{ 6580 string addToCartNotificationType = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType").SelectedValue : ""; 6581 string addToCartNotificationMiniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown"; 6582 bool addToCartHideCartIcon = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 6583 6584 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed() && !string.IsNullOrEmpty(addToCartNotificationType)) 6585 { 6586 if (addToCartNotificationType == "modal") 6587 { 6588 Block addToCartNotificationModal = new Block 6589 { 6590 Id = "AddToCartNotificationModal", 6591 Template = RenderAddToCartNotificationModal() 6592 }; 6593 6594 Block addToCartNotificationScript = new Block 6595 { 6596 Id = "AddToCartNotificationScript", 6597 Template = RenderAddToCartNotificationModalScript() 6598 }; 6599 BlocksPage.GetBlockPage("Master").Add("MasterTopSnippets", addToCartNotificationModal); 6600 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript); 6601 } 6602 else if (addToCartNotificationType == "toggle" && addToCartNotificationMiniCartLayout != "none" && !addToCartHideCartIcon && Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 6603 { 6604 Block addToCartNotificationScript = new Block 6605 { 6606 Id = "AddToCartNotificationScript", 6607 Template = RenderAddToCartNotificationToggleScript() 6608 }; 6609 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript); 6610 } 6611 } 6612 } 6613 6614 @helper RenderAddToCartNotificationModal() 6615 { 6616 <div id="LastAddedProductModal" data-template="LastAddedProductTemplate"></div> 6617 } 6618 6619 @helper RenderAddToCartNotificationModalScript() 6620 { 6621 int cartPageId = GetPageIdByNavigationTag("CartPage"); 6622 6623 <script id="LastAddedProductTemplate" type="text/x-template"> 6624 @{ 6625 6626 Modal lastAddedProduct = new Modal 6627 { 6628 Id = "LastAddedProduct", 6629 Heading = new Heading 6630 { 6631 Level = 2, 6632 Title = Translate("Product is added to the cart") 6633 }, 6634 Width = ModalWidth.Md, 6635 BodyTemplate = RenderModalContent() 6636 }; 6637 6638 lastAddedProduct.AddActions( 6639 new Button 6640 { 6641 ButtonType = ButtonType.Button, 6642 ButtonLayout = ButtonLayout.Secondary, 6643 Title = Translate("Continue shopping"), 6644 CssClass = "u-pull--left u-no-margin btn--sm", 6645 OnClick = "document.getElementById('LastAddedProductModalTrigger').checked = false" 6646 }, 6647 new Link 6648 { 6649 Href = "/Default.aspx?ID=" + cartPageId, 6650 ButtonLayout = ButtonLayout.Secondary, 6651 CssClass = "u-pull--right u-no-margin btn--sm", 6652 Title = Translate("Proceed to checkout"), 6653 OnClick = "document.getElementById('LastAddedProductModalTrigger').checked = false" 6654 } 6655 ); 6656 6657 @Render(lastAddedProduct) 6658 } 6659 </script> 6660 <script> 6661 document.addEventListener('addToCart', function (event) { 6662 Cart.ShowLastAddedProductModal(event.detail); 6663 }); 6664 </script> 6665 } 6666 6667 @helper RenderModalContent() 6668 { 6669 <div class="grid"> 6670 <div class="grid__col-2"> 6671 @Render(new Image { Path = "{{ productInfo.image }}", Link = "{{ productInfo.link }}", Title = "{{ productInfo.name }}", DisableImageEngine = true }) 6672 </div> 6673 <div class="u-padding grid--align-self-center"> 6674 <span>{{quantity}}</span> x 6675 </div> 6676 <div class="grid__col-auto grid--align-self-center"> 6677 <div>{{productInfo.name}}</div> 6678 {{#if productInfo.variantName}} 6679 <small class="u-margin-bottom-5px">{{productInfo.variantName}}</small> 6680 {{/if}} 6681 {{#if productInfo.unitName}} 6682 <small class="u-margin-bottom-5px">{{productInfo.unitName}}</small> 6683 {{/if}} 6684 </div> 6685 </div> 6686 } 6687 6688 @helper RenderAddToCartNotificationToggleScript() 6689 { 6690 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 6691 6692 <script> 6693 document.addEventListener('addToCart', function () { 6694 Cart.ToggleMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '@miniCartFeedPageId'); 6695 }); 6696 </script> 6697 } 6698 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 6699 6700 @using System 6701 @using System.Web 6702 @using System.Collections.Generic 6703 @using Dynamicweb.Rapido.Blocks.Extensibility 6704 @using Dynamicweb.Rapido.Blocks 6705 @using Dynamicweb.Rapido.Blocks.Components.General 6706 6707 @functions { 6708 BlocksPage footerBlocksPage = BlocksPage.GetBlockPage("Master"); 6709 } 6710 6711 @{ 6712 string footerColumnOneContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Content"); 6713 string footerColumnTwoContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Content"); 6714 string footerColumnThreeContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Content"); 6715 string footerColumnOneHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Header"); 6716 string footerColumnTwoHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Header"); 6717 string footerColumnThreeHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Header"); 6718 6719 Block masterFooterContent = new Block() 6720 { 6721 Id = "MasterFooterContent", 6722 SortId = 10, 6723 Template = RenderFooter(), 6724 SkipRenderBlocksList = true 6725 }; 6726 footerBlocksPage.Add(MasterBlockId.MasterFooter, masterFooterContent); 6727 6728 if (!string.IsNullOrEmpty(footerColumnOneContent) || !string.IsNullOrEmpty(footerColumnOneHeader)) 6729 { 6730 Block masterFooterColumnOne = new Block 6731 { 6732 Id = "MasterFooterColumnOne", 6733 SortId = 10, 6734 Template = RenderFooterColumn(footerColumnOneHeader, footerColumnOneContent), 6735 Design = new Design 6736 { 6737 Size = "auto", 6738 RenderType = RenderType.Column 6739 } 6740 }; 6741 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnOne); 6742 } 6743 6744 if (!string.IsNullOrEmpty(footerColumnTwoContent) || !string.IsNullOrEmpty(footerColumnTwoHeader)) 6745 { 6746 Block masterFooterColumnTwo = new Block 6747 { 6748 Id = "MasterFooterColumnTwo", 6749 SortId = 20, 6750 Template = RenderFooterColumn(footerColumnTwoHeader, footerColumnTwoContent), 6751 Design = new Design 6752 { 6753 Size = "auto", 6754 RenderType = RenderType.Column 6755 } 6756 }; 6757 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnTwo); 6758 } 6759 6760 if (!string.IsNullOrEmpty(footerColumnThreeContent) || !string.IsNullOrEmpty(footerColumnThreeHeader)) 6761 { 6762 Block masterFooterColumnThree = new Block 6763 { 6764 Id = "MasterFooterColumnThree", 6765 SortId = 30, 6766 Template = RenderFooterColumn(footerColumnThreeHeader, footerColumnThreeContent), 6767 Design = new Design 6768 { 6769 Size = "auto", 6770 RenderType = RenderType.Column 6771 } 6772 }; 6773 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnThree); 6774 } 6775 6776 if (Model.Area.Item.GetItem("Layout").GetBoolean("FooterNewsletterSignUp")) 6777 { 6778 Block masterFooterNewsletterSignUp = new Block 6779 { 6780 Id = "MasterFooterNewsletterSignUp", 6781 SortId = 40, 6782 Template = RenderFooterNewsletterSignUp(), 6783 Design = new Design 6784 { 6785 Size = "auto", 6786 RenderType = RenderType.Column 6787 } 6788 }; 6789 footerBlocksPage.Add("MasterFooterContent", masterFooterNewsletterSignUp); 6790 } 6791 6792 if (Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks").Count > 0) 6793 { 6794 Block masterFooterSocialLinks = new Block 6795 { 6796 Id = "MasterFooterSocialLinks", 6797 SortId = 50, 6798 Template = RenderFooterSocialLinks(), 6799 Design = new Design 6800 { 6801 Size = "auto", 6802 RenderType = RenderType.Column 6803 } 6804 }; 6805 footerBlocksPage.Add("MasterFooterContent", masterFooterSocialLinks); 6806 } 6807 6808 if (Model.Area.Item.GetItem("Layout").GetItems("FooterPayments") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterPayments").Count > 0) 6809 { 6810 Block masterFooterPayments = new Block 6811 { 6812 Id = "MasterFooterPayments", 6813 SortId = 60, 6814 Template = RenderFooterPayments(), 6815 Design = new Design 6816 { 6817 Size = "12", 6818 RenderType = RenderType.Column 6819 } 6820 }; 6821 footerBlocksPage.Add("MasterFooterContent", masterFooterPayments); 6822 } 6823 6824 Block masterFooterCopyright = new Block 6825 { 6826 Id = "MasterFooterCopyright", 6827 SortId = 70, 6828 Template = RenderFooterCopyright(), 6829 Design = new Design 6830 { 6831 Size = "12", 6832 RenderType = RenderType.Column 6833 } 6834 }; 6835 footerBlocksPage.Add("MasterFooterContent", masterFooterCopyright); 6836 } 6837 6838 @helper RenderFooter() 6839 { 6840 List<Block> subBlocks = this.footerBlocksPage.GetBlockListById("MasterFooterContent").OrderBy(item => item.SortId).ToList(); 6841 6842 <footer class="footer no-print dw-mod"> 6843 <div class="center-container top-container__center-container dw-mod"> 6844 <div class="grid grid--external-bleed-x"> 6845 @RenderBlockList(subBlocks) 6846 </div> 6847 </div> 6848 </footer> 6849 } 6850 6851 @helper RenderFooterColumn(string header, string content) 6852 { 6853 <span class="footer__heading dw-mod">@header</span> 6854 <div class="footer__content dw-mod"> 6855 @content 6856 </div> 6857 } 6858 6859 @helper RenderFooterNewsletterSignUp() 6860 { 6861 string newsletterSignUpPageId = GetPageIdByNavigationTag("NewsletterSignUp").ToString(); 6862 Form form = new Form { Action = "/Default.aspx", Method = FormMethod.Get, Enctype = FormEnctype.multipart }; 6863 6864 form.Add(new HiddenField { Name = "ID", Value = newsletterSignUpPageId }); 6865 form.Add(new Text { Content = "<p>" + Translate("Sign up if you would like to receive occasional treats from us") + "</p>" }); 6866 form.Add(new TextField { 6867 Id = "NewsletterEmail", Name = "NewsletterEmail", Placeholder = Translate("Your email address"), 6868 Type = TextFieldType.Email, 6869 ActionButton = new Button { 6870 ButtonType = ButtonType.Submit, Id="Submitter", Title = Translate("Go"), OnClick = "Buttons.LockButton(event)", CssClass = "btn--condensed" 6871 } 6872 }); 6873 6874 <h3 class="footer__heading dw-mod">@Translate("Mailing list")</h3> 6875 <div class="footer__content dw-mod"> 6876 @Render(form) 6877 </div> 6878 } 6879 6880 @helper RenderFooterSocialLinks() 6881 { 6882 <h3 class="footer__heading dw-mod">@Translate("Social links")</h3> 6883 <div class="footer__content dw-mod"> 6884 <div class="collection dw-mod"> 6885 @foreach (var socialitem in Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks")) 6886 { 6887 var socialIcon = socialitem.GetValue("Icon") as Dynamicweb.Frontend.ListViewModel; 6888 string socialIconClass = socialIcon.SelectedValue; 6889 string socialIconTitle = socialIcon.SelectedName; 6890 string socialLink = socialitem.GetString("Link"); 6891 6892 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px" rel="noopener"><i class="@socialIconClass fa-2x"></i></a> 6893 } 6894 </div> 6895 </div> 6896 } 6897 6898 @helper RenderFooterPayments() 6899 { 6900 <div class="footer__content dw-mod"> 6901 <div class="collection dw-mod"> 6902 @foreach (var payment in Model.Area.Item.GetItem("Layout").GetItems("FooterPayments")) 6903 { 6904 var paymentItem = payment.GetValue("CardTypeOrVerifiedPayment") as Dynamicweb.Frontend.ListViewModel; 6905 string paymentImage = null; 6906 string paymentTitle = paymentItem.SelectedName; 6907 ListOptionViewModel selected = paymentItem.SelectedOptions.FirstOrDefault(); 6908 if (selected != null) 6909 { 6910 paymentImage = selected.Icon; 6911 } 6912 6913 <div class="footer__card-type"> 6914 <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" /> 6915 </div> 6916 } 6917 </div> 6918 </div> 6919 } 6920 6921 @helper RenderFooterCopyright() 6922 { 6923 <div class="grid__col-12 footer__copyright dw-mod"> 6924 <p>@Model.Area.Item.GetItem("Layout").GetString("FooterCopyrightText")</p> 6925 </div> 6926 } 6927 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 6928 6929 @using System 6930 @using System.Web 6931 @using System.Collections.Generic 6932 @using Dynamicweb.Rapido.Blocks.Extensibility 6933 @using Dynamicweb.Rapido.Blocks 6934 @using Dynamicweb.Ecommerce.Common 6935 6936 @{ 6937 BlocksPage referencesBlocksPage = BlocksPage.GetBlockPage("Master"); 6938 6939 Block masterScriptReferences = new Block() 6940 { 6941 Id = "MasterScriptReferences", 6942 SortId = 1, 6943 Template = RenderMasterScriptReferences() 6944 }; 6945 referencesBlocksPage.Add(MasterBlockId.MasterReferences, masterScriptReferences); 6946 } 6947 6948 @helper RenderMasterScriptReferences() { 6949 <script src="/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js"></script> 6950 <script src="/Files/Templates/Designs/Rapido/js/master.min.js"></script> 6951 6952 if (Model.Area.Item.GetItem("Custom").GetBoolean("UseCustomJavascript")) 6953 { 6954 <script src="/Files/Templates/Designs/Rapido/js/custom.min.js"></script> 6955 PushPromise("/Files/Templates/Designs/Rapido/js/custom.min.js"); 6956 } 6957 6958 PushPromise("/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js"); 6959 PushPromise("/Files/Templates/Designs/Rapido/js/master.min.js"); 6960 } 6961 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 6962 6963 @using System 6964 @using System.Web 6965 @using System.Collections.Generic 6966 @using Dynamicweb.Rapido.Blocks.Extensibility 6967 @using Dynamicweb.Rapido.Blocks 6968 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 6969 @using Dynamicweb.Rapido.Services 6970 6971 @{ 6972 BlocksPage searchBlocksPage = BlocksPage.GetBlockPage("Master"); 6973 bool navigationItemsHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 6974 bool isFavoriteList = !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("ListID")); 6975 6976 if (!navigationItemsHideSearch || isFavoriteList) 6977 { 6978 Block masterSearchScriptTemplates = new Block() 6979 { 6980 Id = "MasterSearchScriptTemplates", 6981 SortId = 1, 6982 Template = RenderSearchScriptTemplates() 6983 }; 6984 6985 searchBlocksPage.Add(MasterBlockId.MasterBottomSnippets, masterSearchScriptTemplates); 6986 } 6987 } 6988 6989 @helper RenderSearchScriptTemplates() 6990 { 6991 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 6992 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 6993 bool useFacebookPixel = !string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID")); 6994 bool useGoogleTagManager = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID")); 6995 bool showPrice = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HidePriceInSearchResults"); 6996 bool showAddToCartButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideAddToCartButton"); 6997 bool showViewButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideViewButton"); 6998 bool showAddToDownloadButton = Pageview.AreaSettings.GetItem("Layout").GetBoolean("ShowAddToDownloadButton"); 6999 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 7000 7001 <script id="SearchGroupsTemplate" type="text/x-template"> 7002 {{#.}} 7003 <li class="dropdown__item dw-mod" onclick="Search.UpdateGroupSelection(this)" data-group-id="{{id}}">{{name}}</li> 7004 {{/.}} 7005 </script> 7006 7007 <script id="SearchProductsTemplate" type="text/x-template"> 7008 {{#each .}} 7009 {{#Product}} 7010 {{#ifCond template "!==" "SearchMore"}} 7011 <li class="dropdown__item dropdown__item--seperator dw-mod"> 7012 @if (useFacebookPixel) 7013 { 7014 <text>{{{facebookPixelSearch name number priceDouble currency searchParameter}}}</text> 7015 } 7016 @if (useGoogleTagManager) 7017 { 7018 <text>{{{googleEnchantImpression googleImpression}}}</text> 7019 } 7020 <div> 7021 <a href="{{link}}" 7022 class="js-typeahead-link u-color-inherit u-pull--left" 7023 onclick="{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}" 7024 title="{{name}}{{#if variantName}}, {{variantName}}{{/if}}"> 7025 <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}}{{#if variantName}}, {{variantName}}{{/if}}"></div> 7026 <div class="u-pull--left"> 7027 <div class="u-bold u-max-w220px u-truncate-text js-typeahead-name">{{name}}{{#if variantName}}, {{variantName}}{{/if}}</div> 7028 @if (showPrice && Dynamicweb.Rapido.Services.User.IsPricesAllowed()) 7029 { 7030 if (pointShopOnly) 7031 { 7032 <text> 7033 {{#if havePointPrice}} 7034 <div> 7035 <span class="u-color--loyalty-points">{{points}}</span> @Translate("points") 7036 </div> 7037 {{else}} 7038 <small class="help-text u-no-margin">@Translate("Not available")</small> 7039 {{/if}} 7040 {{#unless canBePurchasedWithPoints}} 7041 {{#if havePointPrice}} 7042 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small> 7043 {{/if}} 7044 {{/unless}} 7045 </text> 7046 } 7047 else 7048 { 7049 <div>{{price}}</div> 7050 } 7051 } 7052 </div> 7053 </a> 7054 <div class="u-margin-left u-pull--right"> 7055 @{ 7056 var viewBtn = new Link 7057 { 7058 Href = "{{link}}", 7059 OnClick = "{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}", 7060 ButtonLayout = ButtonLayout.Secondary, 7061 CssClass = "btn--condensed u-no-margin u-w80px js-ignore-click-outside", 7062 Title = Translate("View") 7063 }; 7064 } 7065 @if (showAddToCartButton && Dynamicweb.Rapido.Services.User.IsBuyingAllowed()) 7066 { 7067 <text>{{#if hideAddToCartButton}}</text> 7068 @Render(viewBtn) 7069 <text>{{else}}</text> 7070 @Render(new AddToCartButton 7071 { 7072 HideTitle = true, 7073 ProductId = "{{productId}}", 7074 ProductInfo = "{{productInfo}}", 7075 BuyForPoints = pointShopOnly, 7076 OnClick = "{{facebookPixelAction}}", 7077 CssClass = "u-w80px u-no-margin js-ignore-click-outside", 7078 Icon = new Icon { 7079 CssClass = "js-ignore-click-outside" 7080 }, 7081 ExtraAttributes = new Dictionary<string, string> 7082 { 7083 { "{{disabledBuyButton}}", "" } 7084 } 7085 }) 7086 <text>{{/if}}</text> 7087 } 7088 else if (showViewButton) 7089 { 7090 @Render(viewBtn) 7091 } 7092 @if (showAddToDownloadButton) 7093 { 7094 <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}}"> 7095 <i class="fas fa-plus js-button-icon"></i> 7096 </button> 7097 } 7098 </div> 7099 </div> 7100 </li> 7101 {{/ifCond}} 7102 {{#ifCond template "===" "SearchMore"}} 7103 {{>SearchMoreProducts}} 7104 {{/ifCond}} 7105 {{/Product}} 7106 {{else}} 7107 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod"> 7108 @Translate("Your search gave 0 results") 7109 </li> 7110 {{/each}} 7111 </script> 7112 7113 <script id="SearchMoreProducts" type="text/x-template"> 7114 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 7115 <a href="/Default.aspx?ID=@productsPageId&Search={{searchParameter}}&GroupID={{groupId}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 7116 @Translate("View all") 7117 </a> 7118 </li> 7119 </script> 7120 7121 <script id="SearchMorePages" type="text/x-template"> 7122 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 7123 <a href="/Default.aspx?ID=@contentSearchPageLink&Search={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 7124 @Translate("View all") 7125 </a> 7126 </li> 7127 </script> 7128 7129 <script id="SearchPagesTemplate" type="text/x-template"> 7130 {{#each .}} 7131 {{#ifCond template "!==" "SearchMore"}} 7132 <li class="dropdown__item dropdown__item--seperator dropdown__item--no-padding dw-mod"> 7133 <a href="/Default.aspx?ID={{id}}" class="js-typeahead-link dropdown__link u-color-inherit"> 7134 <div class="u-margin-right u-inline"><i class="fa {{icon}} u-w20px u-ta-center"></i></div> 7135 <div class="u-inline u-va-middle"><div class="u-bold u-truncate-text u-max-w210px u-inline-block js-typeahead-name">{{name}}</div></div> 7136 </a> 7137 </li> 7138 {{/ifCond}} 7139 {{#ifCond template "===" "SearchMore"}} 7140 {{>SearchMorePages}} 7141 {{/ifCond}} 7142 {{else}} 7143 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod"> 7144 @Translate("Your search gave 0 results") 7145 </li> 7146 {{/each}} 7147 </script> 7148 7149 <script id="SearchPagesTemplateWrap" type="text/x-template"> 7150 <div class="dropdown__column-header">@Translate("Pages")</div> 7151 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod"> 7152 {{>SearchPagesTemplate}} 7153 </ul> 7154 </script> 7155 7156 <script id="SearchProductsTemplateWrap" type="text/x-template"> 7157 <div class="dropdown__column-header">@Translate("Products")</div> 7158 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod"> 7159 {{>SearchProductsTemplate}} 7160 </ul> 7161 </script> 7162 } 7163 7164 @using Dynamicweb.Rapido.Blocks.Components 7165 @using Dynamicweb.Rapido.Blocks.Components.General 7166 @using Dynamicweb.Rapido.Blocks 7167 @using System.IO 7168 7169 7170 @using Dynamicweb.Rapido.Blocks.Components.General 7171 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 7172 7173 7174 @* Component *@ 7175 7176 @helper RenderVariantMatrix(VariantMatrix settings) { 7177 if (settings != null) 7178 { 7179 int productLoopCounter = 0; 7180 int groupCount = 0; 7181 List<VariantOption> firstDimension = new List<VariantOption>(); 7182 List<VariantOption> secondDimension = new List<VariantOption>(); 7183 List<VariantOption> thirdDimension = new List<VariantOption>(); 7184 7185 foreach (VariantGroup variantGroup in settings.GetVariantGroups()) 7186 { 7187 foreach (VariantOption variantOptions in variantGroup.GetVariantOptions()) 7188 { 7189 if (groupCount == 0) { 7190 firstDimension.Add(variantOptions); 7191 } 7192 if (groupCount == 1) 7193 { 7194 secondDimension.Add(variantOptions); 7195 } 7196 if (groupCount == 2) 7197 { 7198 thirdDimension.Add(variantOptions); 7199 } 7200 } 7201 groupCount++; 7202 } 7203 7204 int rowCount = 0; 7205 int columnCount = 0; 7206 7207 <script> 7208 var variantsCollection = []; 7209 </script> 7210 7211 <table class="table table--compact js-variants-matrix dw-mod" id="VariantMatrixTable_@settings.ProductId"> 7212 @if (groupCount == 1) 7213 { 7214 <tbody> 7215 @foreach (VariantOption firstVariantOption in firstDimension) 7216 { 7217 var variantId = firstVariantOption.Id; 7218 <tr> 7219 <td class="u-bold"> 7220 @firstVariantOption.Name 7221 </td> 7222 <td> 7223 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount) 7224 </td> 7225 </tr> 7226 productLoopCounter++; 7227 } 7228 7229 <tr> 7230 <td>&nbsp;</td> 7231 <td> 7232 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div> 7233 </td> 7234 </tr> 7235 </tbody> 7236 } 7237 @if (groupCount == 2) 7238 { 7239 <thead> 7240 <tr> 7241 <td>&nbsp;</td> 7242 @foreach (VariantOption variant in secondDimension) 7243 { 7244 <td>@variant.Name</td> 7245 } 7246 </tr> 7247 </thead> 7248 <tbody> 7249 @foreach (VariantOption firstVariantOption in firstDimension) 7250 { 7251 string variantId = ""; 7252 columnCount = 0; 7253 7254 <tr> 7255 <td class="u-min-w120px">@firstVariantOption.Name</td> 7256 7257 @foreach (VariantOption secondVariantOption in secondDimension) 7258 { 7259 variantId = firstVariantOption.Id + "." + secondVariantOption.Id; 7260 <td> 7261 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount) 7262 </td> 7263 7264 columnCount++; 7265 7266 productLoopCounter++; 7267 } 7268 7269 <td> 7270 <div class="qty-field js-total-qty-row-@rowCount dw-mod">0</div> 7271 </td> 7272 </tr> 7273 7274 rowCount++; 7275 } 7276 7277 @{ 7278 columnCount = 0; 7279 } 7280 7281 <tr> 7282 <td>&nbsp;</td> 7283 @foreach (VariantOption secondVariantOption in secondDimension) 7284 { 7285 <td> 7286 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div> 7287 </td> 7288 7289 columnCount++; 7290 } 7291 <td>&nbsp;</td> 7292 </tr> 7293 </tbody> 7294 } 7295 @if (groupCount == 3) 7296 { 7297 <thead> 7298 <tr> 7299 <td>&nbsp;</td> 7300 @foreach (VariantOption thirdVariantOption in thirdDimension) 7301 { 7302 <td>@thirdVariantOption.Name</td> 7303 } 7304 </tr> 7305 </thead> 7306 <tbody> 7307 @foreach (VariantOption firstVariantOption in firstDimension) 7308 { 7309 int colspan = (thirdDimension.Count + 1); 7310 7311 <tr> 7312 <td colspan="@colspan" class="u-color-light-gray--bg u-bold">@firstVariantOption.Name</td> 7313 </tr> 7314 7315 foreach (VariantOption secondVariantOption in secondDimension) 7316 { 7317 string variantId = ""; 7318 columnCount = 0; 7319 7320 <tr> 7321 <td class="u-min-w120px">@secondVariantOption.Name</td> 7322 7323 @foreach (VariantOption thirdVariantOption in thirdDimension) 7324 { 7325 variantId = firstVariantOption.Id + "." + secondVariantOption.Id + "." + thirdVariantOption.Id; 7326 7327 <td> 7328 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount) 7329 </td> 7330 7331 columnCount++; 7332 productLoopCounter++; 7333 } 7334 7335 <td> 7336 <div class="qty-field js-total-qty-row-@rowCount dw-mod">0</div> 7337 </td> 7338 </tr> 7339 rowCount++; 7340 } 7341 } 7342 7343 @{ 7344 columnCount = 0; 7345 } 7346 7347 <tr> 7348 <td>&nbsp;</td> 7349 @foreach (VariantOption thirdVariantOption in thirdDimension) 7350 { 7351 <td> 7352 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div> 7353 </td> 7354 7355 columnCount++; 7356 } 7357 <td>&nbsp;</td> 7358 </tr> 7359 </tbody> 7360 } 7361 </table> 7362 7363 <script> 7364 document.addEventListener("DOMContentLoaded", function (event) { 7365 MatrixUpdateQuantity("@settings.ProductId"); 7366 }); 7367 7368 MatrixUpdateQuantity = function (productId) { 7369 var currentMatrix = document.getElementById("VariantMatrixTable_" + productId); 7370 var allQtyFields = currentMatrix.getElementsByClassName("js-qty"); 7371 7372 var qtyRowArr = []; 7373 var qtyColumnArr = []; 7374 7375 var totalQty = 0; 7376 7377 for (var i = 0; i < allQtyFields.length; i++) { 7378 qtyRowArr[allQtyFields[i].getAttribute("data-qty-row-group")] = 0; 7379 qtyColumnArr[allQtyFields[i].getAttribute("data-qty-column-group")] = 0; 7380 } 7381 7382 for (var i = 0; i < allQtyFields.length; i++) { 7383 qtyRowArr[allQtyFields[i].getAttribute("data-qty-row-group")] += parseFloat(allQtyFields[i].value); 7384 qtyColumnArr[allQtyFields[i].getAttribute("data-qty-column-group")] += parseFloat(allQtyFields[i].value); 7385 totalQty += parseFloat(allQtyFields[i].value); 7386 } 7387 7388 //Update row counters 7389 for (var i = 0; i < qtyRowArr.length; i++) { 7390 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-row-" + i)[0]; 7391 7392 if (qtyRowArr[i] != undefined && qtyCounter != null) { 7393 var currentCount = qtyCounter.innerHTML; 7394 qtyCounter.innerHTML = qtyRowArr[i]; 7395 7396 if (currentCount != qtyCounter.innerHTML) { 7397 qtyCounter.classList.add("qty-field--active"); 7398 } 7399 } 7400 7401 } 7402 7403 //Update column counters 7404 for (var i = 0; i < qtyColumnArr.length; i++) { 7405 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-column-" + i)[0]; 7406 7407 if (qtyColumnArr[i] != undefined && qtyCounter != null) { 7408 var currentCount = qtyCounter.innerHTML; 7409 qtyCounter.innerHTML = qtyColumnArr[i]; 7410 7411 if (currentCount != qtyCounter.innerHTML) { 7412 qtyCounter.classList.add("qty-field--active"); 7413 } 7414 } 7415 } 7416 7417 if (document.getElementById("TotalQtyCount_" + productId)) { 7418 document.getElementById("TotalQtyCount_" + productId).innerHTML = totalQty; 7419 } 7420 7421 //Clean up animations 7422 setTimeout(function () { 7423 for (var i = 0; i < qtyRowArr.length; i++) { 7424 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-row-" + i)[0]; 7425 if (qtyCounter != null) { 7426 qtyCounter.classList.remove("qty-field--active"); 7427 } 7428 } 7429 for (var i = 0; i < qtyColumnArr.length; i++) { 7430 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-column-" + i)[0]; 7431 if (qtyCounter != null) { 7432 qtyCounter.classList.remove("qty-field--active"); 7433 } 7434 } 7435 }, 1000); 7436 } 7437 </script> 7438 } 7439 } 7440 7441 @helper RenderVariantMatrixQuantityField(string variantId, VariantMatrix settings, int productLoopCounter, int rowCount, int columnCount) 7442 { 7443 string loopCount = productLoopCounter.ToString(); 7444 7445 bool combinationFound = false; 7446 double stock = 0; 7447 double quantityValue = 0; 7448 string note = ""; 7449 7450 VariantProduct variantProduct = null; 7451 7452 if (settings.GetVariantProducts().TryGetValue(variantId, out variantProduct)) 7453 { 7454 stock = variantProduct.Stock; 7455 quantityValue = variantProduct.Quantity; 7456 combinationFound = true; 7457 } 7458 7459 if (combinationFound) 7460 { 7461 <input type="hidden" name="ProductLoopCounter@(loopCount)" value="@loopCount" /> 7462 <input type="hidden" name="ProductID@(loopCount)" value="@settings.ProductId" /> 7463 <input type="hidden" name="VariantID@(loopCount)" value="@variantId" /> 7464 <input type="hidden" name="CurrentNote@(loopCount)" id="CurrentNote_@(settings.ProductId)_@variantId" value="@note" /> 7465 <input type="number" name="Quantity@(loopCount)" id="Quantity_@(settings.ProductId)_@variantId" value="@quantityValue" min="0" class="js-qty u-no-margin u-full-max-width" style="width: 100%; max-width: 100%" onkeyup="MatrixUpdateQuantity('@settings.ProductId')" onmouseup="MatrixUpdateQuantity('@settings.ProductId')" data-qty-row-group="@rowCount" data-qty-column-group="@columnCount"> 7466 7467 if (stock != 0) 7468 { 7469 <small>@Translate("Stock") @stock</small> 7470 } 7471 7472 <script> 7473 var variants = '{ "ProductId" :' + '"@settings.ProductId"' + ', "VariantId": ' + '"@variantId"' +'}'; 7474 variantsCollection.push(variants); 7475 document.getElementById("Quantity_@(settings.ProductId)_@variantId").closest(".js-variants-matrix").setAttribute("data-variants-collection", "[" + variantsCollection + "]" ); 7476 </script> 7477 } 7478 else 7479 { 7480 <div class="use-btn-height" style="background-color: #a8a8a8"></div> 7481 } 7482 } 7483 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 7484 7485 @* Component *@ 7486 7487 @helper RenderAddToCart(AddToCart settings) 7488 { 7489 //set Id for quantity selector to get it's value from button 7490 if (settings.QuantitySelector != null) 7491 { 7492 if (string.IsNullOrEmpty(settings.QuantitySelector.Id)) 7493 { 7494 settings.QuantitySelector.Id = Guid.NewGuid().ToString("N"); 7495 } 7496 7497 settings.AddButton.QuantitySelectorId = settings.QuantitySelector.Id; 7498 7499 if (settings.Disabled) 7500 { 7501 settings.QuantitySelector.Disabled = true; 7502 } 7503 7504 if (string.IsNullOrEmpty(settings.QuantitySelector.Name)) 7505 { 7506 settings.QuantitySelector.Name = settings.QuantitySelector.Id; 7507 } 7508 } 7509 7510 if (settings.Disabled) 7511 { 7512 settings.AddButton.Disabled = true; 7513 } 7514 7515 settings.AddButton.CssClass += " btn--condensed"; 7516 7517 //unitsSelector 7518 if (settings.UnitSelector != null) 7519 { 7520 if (settings.Disabled) 7521 { 7522 settings.QuantitySelector.Disabled = true; 7523 } 7524 } 7525 7526 if (Pageview.Device.ToString() == "Mobile") { 7527 if (settings.UnitSelector != null) 7528 { 7529 <div class="margin-sm margin-position-bottom"> 7530 @Render(settings.UnitSelector) 7531 </div> 7532 } 7533 } 7534 7535 <div class="buttons-collection @settings.WrapperCssClass" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 7536 @if (Pageview.Device.ToString() != "Mobile") { 7537 if (settings.UnitSelector != null) 7538 { 7539 @Render(settings.UnitSelector) 7540 } 7541 } 7542 @if (settings.QuantitySelector != null) 7543 { 7544 @Render(settings.QuantitySelector) 7545 } 7546 @Render(settings.AddButton) 7547 </div> 7548 } 7549 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 7550 7551 @* Component *@ 7552 7553 @helper RenderAddToCartButton(AddToCartButton settings) 7554 { 7555 if (!settings.HideTitle) 7556 { 7557 if (string.IsNullOrEmpty(settings.Title)) 7558 { 7559 if (settings.BuyForPoints) 7560 { 7561 settings.Title = Translate("Buy with points"); 7562 } 7563 else 7564 { 7565 settings.Title = Translate("Add to cart"); 7566 } 7567 } 7568 } 7569 else 7570 { 7571 settings.Title = ""; 7572 } 7573 7574 if (settings.Icon == null) 7575 { 7576 settings.Icon = new Icon(); 7577 settings.Icon.LabelPosition = Dynamicweb.Rapido.Blocks.Components.General.IconLabelPosition.After; 7578 } 7579 7580 if (string.IsNullOrEmpty(settings.Icon.Name)) 7581 { 7582 settings.Icon.Name = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue; 7583 } 7584 7585 if (settings.CssClass.Contains("required-fields-true")) 7586 { 7587 settings.ExtraAttributes = new Dictionary<string, string> 7588 { 7589 {"addtocart", "Cart.AddToCart(event, { " + 7590 "id: '" + settings.ProductId + "'," + 7591 (!string.IsNullOrEmpty(settings.VariantId) ? "variantId: '" + settings.VariantId + "'," : "") + 7592 (!string.IsNullOrEmpty(settings.UnitId) ? "unitId: '" + settings.UnitId + "'," : "") + 7593 (settings.BuyForPoints ? "buyForPoints: true," : "") + 7594 "productName: '#ProductName#',itemNumber: '#ItemNumber#',seriesNumber: '#SeriesNumber#',dateOfPurchase: '#DateOfPurchase#',thermexOrderNumber: '#ThermexOrderNumber#',invoiceCopy: '#InvoiceCopy#'," + 7595 (!string.IsNullOrEmpty(settings.ProductInfo) ? "productInfo: " + settings.ProductInfo + "," : "") + 7596 "quantity: " + (string.IsNullOrEmpty(settings.QuantitySelectorId) ? "1" : "parseFloat(document.getElementById('" + settings.QuantitySelectorId + "').value)") + 7597 "});" + settings.OnClick} 7598 }; 7599 settings.OnClick = "document.getElementById('WarrantyProductBlockComponentModalTrigger').checked = true;"; 7600 } 7601 else 7602 { 7603 settings.OnClick = "Cart.AddToCart(event, { " + 7604 "id: '" + settings.ProductId + "'," + 7605 (!string.IsNullOrEmpty(settings.VariantId) ? "variantId: '" + settings.VariantId + "'," : "") + 7606 (!string.IsNullOrEmpty(settings.UnitId) ? "unitId: '" + settings.UnitId + "'," : "") + 7607 (settings.BuyForPoints ? "buyForPoints: true," : "") + 7608 (!string.IsNullOrEmpty(settings.ProductInfo) ? "productInfo: " + settings.ProductInfo + "," : "") + 7609 "quantity: " + (string.IsNullOrEmpty(settings.QuantitySelectorId) ? "1" : "parseFloat(document.getElementById('" + settings.QuantitySelectorId + "').value)") + 7610 "});" + settings.OnClick; 7611 } 7612 7613 @RenderButton(settings) 7614 } 7615 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 7616 7617 @* Component *@ 7618 7619 @helper RenderUnitSelector(UnitSelector settings) 7620 { 7621 if (string.IsNullOrEmpty(settings.Id)) 7622 { 7623 settings.Id = Guid.NewGuid().ToString("N"); 7624 } 7625 var disabledClass = settings.Disabled ? "disabled" : ""; 7626 7627 <input type="checkbox" id="@settings.Id" class="dropdown-trigger" /> 7628 <div class="dropdown unit-selector @settings.CssClass @disabledClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 7629 <label class="dropdown__header dropdown__btn dropdown__btn--unit-selector dw-mod" for="@settings.Id">@settings.SelectedOption</label> 7630 <div class="dropdown__content dw-mod"> 7631 @settings.OptionsContent 7632 </div> 7633 <label class="dropdown-trigger-off" for="@settings.Id"></label> 7634 </div> 7635 } 7636 @using System.Reflection 7637 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 7638 7639 @* Component *@ 7640 7641 @helper RenderQuantitySelector(QuantitySelector settings) 7642 { 7643 var attributes = new Dictionary<string, string>(); 7644 7645 /*base settings*/ 7646 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 7647 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 7648 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 7649 if (settings.Disabled) { attributes.Add("disabled", "true"); } 7650 if (settings.Required) { attributes.Add("required", "true"); } 7651 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 7652 /*end*/ 7653 7654 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 7655 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 7656 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 7657 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 7658 if (settings.Max != null) { attributes.Add("max", settings.Max.ToString()); } 7659 if (settings.Min == null) { settings.Min = 1; } 7660 attributes.Add("min", settings.Min.ToString()); 7661 if (settings.Step != null && !string.IsNullOrEmpty(settings.Step.ToString())) { attributes.Add("step", settings.Step.ToString()); } 7662 if (settings.Value == null) { settings.Value = 1; } 7663 attributes.Add("value", settings.Value.ToString()); 7664 attributes.Add("type", "number"); 7665 7666 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 7667 7668 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 7669 } 7670 @using Dynamicweb.Rapido.Blocks.Components 7671 7672 @using Dynamicweb.Frontend 7673 @using Dynamicweb.Frontend.Devices 7674 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 7675 @using Dynamicweb.Rapido.Blocks.Components.General 7676 @using System.Collections.Generic; 7677 7678 @* Component *@ 7679 7680 @helper RenderCustomerCenterList(CustomerCenterList settings) 7681 { 7682 bool isTouchDevice = Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet" ? true : false; 7683 string hideActions = isTouchDevice ? "u-block" : ""; 7684 7685 <table class="table data-list dw-mod"> 7686 @if (settings.GetHeaders().Length > 0) { 7687 <thead> 7688 <tr class="u-bold"> 7689 @foreach (CustomerCenterListHeaderItem header in settings.GetHeaders()) 7690 { 7691 var attributes = new Dictionary<string, string>(); 7692 if (!string.IsNullOrEmpty(header.Id)) { attributes.Add("id", header.Id); } 7693 if (!string.IsNullOrEmpty(header.CssClass)) { attributes.Add("class", header.CssClass); } 7694 attributes.Add("align", header.Align.ToString()); 7695 attributes = attributes.Concat(header.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 7696 7697 <td @ComponentMethods.AddAttributes(attributes)>@header.Title</td> 7698 } 7699 </tr> 7700 </thead> 7701 } 7702 @foreach (CustomerCenterListItem listItem in settings.GetItems()) 7703 { 7704 int columnCount = 0; 7705 int totalColumns = listItem.GetInfoItems().Length; 7706 string rowHasActions = listItem.GetActions().Length > 0 ? "data-list__item--has-actions" : ""; 7707 listItem.Id = !string.IsNullOrEmpty(listItem.Id) ? listItem.Id : Guid.NewGuid().ToString("N"); 7708 7709 var attributes = new Dictionary<string, string>(); 7710 if (!string.IsNullOrEmpty(listItem.Title)) { attributes.Add("title", listItem.Title); }; 7711 7712 attributes = attributes.Concat(listItem.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 7713 <tbody class="data-list__item @rowHasActions @listItem.CssClass dw-mod" @ComponentMethods.AddAttributes(attributes)> 7714 <tr> 7715 @if (!string.IsNullOrEmpty(listItem.Title) || !string.IsNullOrEmpty(listItem.Description)) { 7716 string onClick = !string.IsNullOrEmpty(listItem.OnClick) ? "onclick=\"" + listItem.OnClick + "\"" : ""; 7717 7718 <td rowspan="2" @onClick class="data-list__main-item dw-mod"> 7719 @if (!string.IsNullOrEmpty(listItem.Title)) { 7720 <div class="u-bold">@listItem.Title</div> 7721 } 7722 @if (!string.IsNullOrEmpty(listItem.Description)) { 7723 <div>@listItem.Description</div> 7724 } 7725 </td> 7726 } 7727 7728 @foreach (CustomerCenterListInfoItem infoItem in listItem.GetInfoItems()) 7729 { 7730 var infoAttributes = new Dictionary<string, string>(); 7731 if (!string.IsNullOrEmpty(infoItem.Id)) { infoAttributes.Add("id", infoItem.Id); }; 7732 if (!string.IsNullOrEmpty(infoItem.OnClick)) { infoAttributes.Add("onclick", infoItem.OnClick); }; 7733 infoAttributes.Add("align", infoItem.Align.ToString()); 7734 7735 infoAttributes = infoAttributes.Concat(infoItem.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 7736 string columnClick = columnCount < (totalColumns-1) && !string.IsNullOrEmpty(listItem.OnClick) ? "onclick=\"" + listItem.OnClick + "\"" : ""; 7737 7738 <td @ComponentMethods.AddAttributes(infoAttributes) @columnClick class="data-list__info-item dw-mod"> 7739 @if (!string.IsNullOrEmpty(infoItem.Title)) { 7740 <div>@infoItem.Title</div> 7741 } 7742 @if (!string.IsNullOrEmpty(infoItem.Subtitle)) { 7743 <div><small>@infoItem.Subtitle</small></div> 7744 } 7745 </td> 7746 7747 columnCount++; 7748 } 7749 </tr> 7750 <tr> 7751 <td colspan="7" align="right" class="u-va-bottom u-no-border"> 7752 <div class="data-list__actions @hideActions dw-mod" id="ActionsMenu_@listItem.Id"> 7753 @foreach (ButtonBase action in listItem.GetActions()) 7754 { 7755 action.ButtonLayout = ButtonLayout.LinkClean; 7756 action.Icon.CssClass += " u-full-height"; 7757 action.CssClass += " data-list__action-button link"; 7758 7759 @Render(action) 7760 } 7761 </div> 7762 </td> 7763 </tr> 7764 </tbody> 7765 } 7766 </table> 7767 } 7768 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 7769 7770 @using System 7771 @using System.Web 7772 @using System.Collections.Generic 7773 @using Dynamicweb.Rapido.Blocks.Extensibility 7774 @using Dynamicweb.Rapido.Blocks 7775 7776 @{ 7777 BlocksPage bottomSnippetsBlocksPage = BlocksPage.GetBlockPage("Master"); 7778 7779 Block primaryBottomSnippets = new Block() 7780 { 7781 Id = "MasterJavascriptInitializers", 7782 SortId = 100, 7783 Template = RenderPrimaryBottomSnippets() 7784 }; 7785 bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, primaryBottomSnippets); 7786 7787 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed()) 7788 { 7789 Block miniCartPageId = new Block 7790 { 7791 Id = "MiniCartPageId", 7792 Template = RenderMiniCartPageId() 7793 }; 7794 bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, miniCartPageId); 7795 } 7796 } 7797 7798 @helper RenderPrimaryBottomSnippets() 7799 { 7800 bool isWireframeMode = Model.Area.Item.GetItem("Settings").GetBoolean("WireframeMode"); 7801 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 7802 7803 if (isWireframeMode) 7804 { 7805 <script> 7806 Wireframe.Init(true); 7807 </script> 7808 } 7809 7810 7811 if (useGoogleTagManager) 7812 { 7813 <script> 7814 document.addEventListener('addToCart', function(event) { 7815 var googleImpression = JSON.parse(event.detail.productInfo.googleImpression); 7816 if (typeof googleImpression == "string") { 7817 googleImpression = JSON.parse(event.detail.productInfo.googleImpression); 7818 } 7819 dataLayer.push({ 7820 'event': 'addToCart', 7821 'ecommerce': { 7822 'currencyCode': googleImpression.currency, 7823 'add': { 7824 'products': [{ 7825 'name': googleImpression.name, 7826 'id': googleImpression.id, 7827 'price': googleImpression.price, 7828 'brand': googleImpression.brand, 7829 'category': googleImpression.category, 7830 'variant': googleImpression.variant, 7831 'quantity': event.detail.quantity 7832 }] 7833 } 7834 } 7835 }); 7836 }); 7837 </script> 7838 } 7839 7840 //if digitalwarehouse 7841 if (Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart")) 7842 { 7843 string cartContextId = Converter.ToString(HttpContext.Current.Application["DownloadCartContext"]); 7844 7845 if (string.IsNullOrEmpty(cartContextId)) 7846 { 7847 var moduleProps = Dynamicweb.Modules.Properties.GetParagraphModuleSettings(GetPageIdByNavigationTag("DownloadCart"), "eCom_CartV2"); 7848 var cartSettings = new Dynamicweb.Ecommerce.Cart.ModuleSettings(moduleProps); 7849 cartContextId = cartSettings.OrderContextID; 7850 HttpContext.Current.Application["DownloadCartContext"] = cartContextId; 7851 } 7852 7853 <script> 7854 let downloadCart = new DownloadCart({ 7855 cartPageId: @GetPageIdByNavigationTag("MiniCartFeed"), 7856 contextId: "@cartContextId", 7857 addButtonText: "@Translate("Add")", 7858 removeButtonText: "@Translate("Remove")" 7859 }); 7860 </script> 7861 } 7862 7863 <!--$$Javascripts--> 7864 } 7865 7866 @helper RenderMiniCartPageId() 7867 { 7868 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 7869 <script> 7870 window.cartId = "@miniCartFeedPageId"; 7871 </script> 7872 } 7873 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 7874 7875 @using System 7876 @using System.Web 7877 @using System.Collections.Generic 7878 @using Dynamicweb.Rapido.Blocks 7879 7880 @{ 7881 BlocksPage masterCustomBlocksPage = BlocksPage.GetBlockPage("Master"); 7882 7883 } 7884 7885 7886 @functions { 7887 public class ManifestIcon 7888 { 7889 public string src { get; set; } 7890 public string type { get; set; } 7891 public string sizes { get; set; } 7892 } 7893 7894 public class Manifest 7895 { 7896 public string name { get; set; } 7897 public string short_name { get; set; } 7898 public string start_url { get; set; } 7899 public string display { get; set; } 7900 public string background_color { get; set; } 7901 public string theme_color { get; set; } 7902 public List<ManifestIcon> icons { get; set; } 7903 } 7904 } 7905 7906 <!DOCTYPE html> 7907 7908 <html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName"> 7909 7910 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 7911 @RenderBlockList(masterPage.BlocksRoot.BlocksList) 7912 7913 7914 7915 @helper RenderMasterHead() 7916 { 7917 List<Block> subBlocks = this.masterPage.GetBlockListById("Head").OrderBy(item => item.SortId).ToList(); 7918 7919 <head> 7920 <!-- Rapido version 3.4.3 --> 7921 7922 @RenderBlockList(subBlocks) 7923 </head> 7924 7925 } 7926 7927 @helper RenderMasterMetadata() 7928 { 7929 var swatches = new Dynamicweb.Content.Items.ColorSwatchService(); 7930 var brandColors = swatches.GetColorSwatch(1); 7931 string brandColorOne = brandColors.Palette["BrandColor1"]; 7932 7933 string domainUrl = Dynamicweb.Context.Current.Request.Url.Scheme + "://" + Dynamicweb.Context.Current.Request.Url.Host; 7934 7935 // SEO workaround to avoid multiple urls for frontpage 7936 if (Model.Area.FirstActivePage.ID == Model.ID && (Dynamicweb.Context.Current.Request.Url.ToString() != domainUrl && Dynamicweb.Context.Current.Request.Url.ToString() != domainUrl + "/") && !Dynamicweb.Context.Current.Request.Url.ToString().Contains("&visualedit")) 7937 { 7938 HttpContext.Current.Response.RedirectPermanent(domainUrl, true); 7939 } 7940 7941 string canonical = Canonical.Url(Pageview, domainUrl, Dynamicweb.Context.Current.Request.Url.ToString()); 7942 int queryIndex = canonical.IndexOf("?"); 7943 if (queryIndex > 0) 7944 { 7945 canonical = canonical.Substring(0, queryIndex); 7946 } 7947 7948 if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName")) && Model.Area.Item.GetItem("Settings").GetFile("AppIcon") != null) 7949 { 7950 Manifest manifest = new Manifest 7951 { 7952 name = Model.Area.Item.GetItem("Settings").GetString("AppName"), 7953 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"), 7954 start_url = "/", 7955 display = "standalone", 7956 background_color = Model.Area.Item.GetItem("Settings").GetString("AppBackgroundColor"), 7957 theme_color = Model.Area.Item.GetItem("Settings").GetString("AppThemeColor") 7958 }; 7959 7960 manifest.icons = new List<ManifestIcon> { 7961 new ManifestIcon { 7962 src = "/Admin/Public/GetImage.ashx?width=192&height=192&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 7963 sizes = "192x192", 7964 type = "image/png" 7965 }, 7966 new ManifestIcon { 7967 src = "/Admin/Public/GetImage.ashx?width=512&height=512&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 7968 sizes = "512x512", 7969 type = "image/png" 7970 }, 7971 new ManifestIcon { 7972 src = "/Admin/Public/GetImage.ashx?width=1024&height=1024&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 7973 sizes = "1024x1024", 7974 type = "image/png" 7975 } 7976 }; 7977 7978 string manifestFilePath = HttpContext.Current.Request.MapPath("/Files/Templates/Designs/Rapido/manifest.json"); 7979 string manifestJSON = Newtonsoft.Json.JsonConvert.SerializeObject(manifest); 7980 string currentManifest = File.ReadAllText(manifestFilePath); 7981 7982 if (manifestJSON != currentManifest) 7983 { 7984 File.WriteAllText(manifestFilePath, manifestJSON); 7985 } 7986 } 7987 7988 <meta charset="utf-8" /> 7989 <title>@Model.Title</title> 7990 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 7991 <meta name="theme-color" content="@brandColorOne" /> 7992 7993 if (!Model.MetaTags.Contains("noindex,nofollow")) 7994 { 7995 string index = "index"; 7996 string follow = "follow"; 7997 if (Model.MetaTags.Contains("noindex")) 7998 { 7999 index = "noindex"; 8000 } 8001 if (Model.MetaTags.Contains("nofollow")) 8002 { 8003 follow = "nofollow"; 8004 } 8005 <meta name="robots" content="@index,@follow"> 8006 } 8007 8008 if (Model.MetaTags != null && !Model.MetaTags.Contains("og:image") && Model.PropertyItem != null && Model.PropertyItem.GetFile("OpenGraphImage") != null) 8009 { 8010 Pageview.Meta.AddTag("og:image", string.Format("{0}://{1}{2}", Dynamicweb.Context.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, Model.PropertyItem.GetFile("OpenGraphImage"))); 8011 } 8012 8013 if (!Model.MetaTags.Contains("og:description") && !string.IsNullOrEmpty(Model.Description)) 8014 { 8015 Pageview.Meta.AddTag("og:description", Model.Description); 8016 } 8017 8018 Pageview.Meta.AddTag("og:title", Model.Title); 8019 Pageview.Meta.AddTag("og:site_name", Model.Name); 8020 Pageview.Meta.AddTag("og:url", HttpContext.Current.Request.Url.ToString()); 8021 Pageview.Meta.AddTag("og:type", "Website"); 8022 8023 if (!string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("FacebookAppID"))) 8024 { 8025 Pageview.Meta.AddTag("fb:app_id", Model.Area.Item.GetItem("Settings").GetString("FacebookAppID")); 8026 } 8027 8028 @Model.MetaTags.Replace("<meta name=\"robots\" content=\"noindex\">", "").Replace("<meta name=\"robots\" content=\"nofollow\">", "") 8029 <link rel="canonical" href="@canonical" /> 8030 } 8031 8032 @helper RenderMasterCss() 8033 { 8034 var fonts = new string[] { 8035 getFontFamily("Layout", "HeaderFont"), 8036 getFontFamily("Layout", "SubheaderFont"), 8037 getFontFamily("Layout", "TertiaryHeaderFont"), 8038 getFontFamily("Layout", "BodyText"), 8039 getFontFamily("Layout", "Header", "ToolsFont"), 8040 getFontFamily("Layout", "Header", "NavigationFont"), 8041 getFontFamily("Layout", "MobileNavigation", "Font"), 8042 getFontFamily("ProductList", "Facets", "HeaderFont"), 8043 getFontFamily("ProductPage", "PriceFontDesign"), 8044 getFontFamily("Ecommerce", "SaleSticker", "Font"), 8045 getFontFamily("Ecommerce", "NewSticker", "Font"), 8046 getFontFamily("Ecommerce", "CustomSticker", "Font") 8047 }; 8048 8049 string autoCssLink = "/Files/Templates/Designs/Rapido/css/rapido/rapido_" + Model.Area.ID.ToString() + ".min.css?ticks=" + Model.Area.UpdatedDate.Ticks; 8050 string favicon = Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon").Path : "/Files/Images/favicon.png"; 8051 bool useFontAwesomePro = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetBoolean("UseFontAwesomePro"); 8052 string fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomeFree/css/fontawesome-all.min.css"; 8053 string noZebraCssLink = "/Files/Templates/Designs/Rapido/css/nz/main.css?ticks=" + Model.Area.UpdatedDate.Ticks; 8054 if (useFontAwesomePro) 8055 { 8056 fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomePro/css/fontawesome-all.min.css"; 8057 } 8058 8059 //Favicon 8060 <link href="@favicon" rel="icon" type="image/png"> 8061 8062 //Base (Default, wireframe) styles 8063 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/base/base.min.css" type="text/css"> 8064 8065 //Rapido Css from Website Settings 8066 <link rel="stylesheet" id="rapidoCss" href="@autoCssLink" type="text/css"> 8067 8068 //NZ Custom stylesheet 8069 <link rel="stylesheet" id="igniteCss" type="text/css" href="@noZebraCssLink"> 8070 8071 //Font awesome 8072 <link rel="stylesheet" href="@fontAwesomeCssLink" type="text/css"> 8073 8074 //Flag icon 8075 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css" type="text/css"> 8076 8077 //Google fonts 8078 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))); 8079 8080 <link href="https://fonts.googleapis.com/css?family=@family" rel="stylesheet"> 8081 8082 PushPromise(favicon); 8083 PushPromise(fontAwesomeCssLink); 8084 PushPromise("/Files/Templates/Designs/Rapido/css/base/base.min.css"); 8085 PushPromise(autoCssLink); 8086 PushPromise("/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css"); 8087 PushPromise("/Files/Images/placeholder.gif"); 8088 PushPromise("/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css"); 8089 8090 @*HREF LANG*@ 8091 List<HypertextReference> References = HypertextReference.GetReferences(Model.Languages, Dynamicweb.Context.Current.Request.Url.ToString()); 8092 8093 if (References.Any()) 8094 { 8095 foreach (HypertextReference reference in References) 8096 { 8097 <link rel="alternate" href='@reference.Url' hreflang='@reference.Culture' /> 8098 } 8099 } 8100 } 8101 8102 @helper RenderMasterManifest() 8103 { 8104 if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName"))) 8105 { 8106 <link rel="manifest" href="/Files/Templates/Designs/Rapido/manifest.json"> 8107 PushPromise("/Files/Templates/Designs/Rapido/manifest.json"); 8108 } 8109 } 8110 8111 @helper RenderMasterBody() 8112 { 8113 List<Block> subBlocks = this.masterPage.GetBlockListById("Body").OrderBy(item => item.SortId).ToList(); 8114 string designLayout = Model.PropertyItem.GetItem("CustomSettings") != null ? Model.PropertyItem.GetItem("CustomSettings").GetString("DesignLayout") != null ? Model.PropertyItem.GetItem("CustomSettings").GetList("DesignLayout").SelectedValue : "" : ""; 8115 if (!String.IsNullOrEmpty(designLayout)) 8116 { 8117 designLayout = "class=\"" + designLayout + "\""; 8118 } 8119 8120 <body @designLayout> 8121 @RenderBlockList(subBlocks) 8122 </body> 8123 8124 } 8125 8126 @helper RenderMasterHeader() 8127 { 8128 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterHeader").OrderBy(item => item.SortId).ToList(); 8129 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 8130 string stickyTop = isNavigationStickyMenu ? "top-container--sticky" : ""; 8131 8132 <header class="top-container @stickyTop no-print dw-mod" id="Top"> 8133 @RenderBlockList(subBlocks) 8134 </header> 8135 } 8136 8137 @helper RenderMain() 8138 { 8139 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMain").OrderBy(item => item.SortId).ToList(); 8140 8141 <main class="site dw-mod"> 8142 @RenderBlockList(subBlocks) 8143 </main> 8144 } 8145 8146 @helper RenderPageContent() 8147 { 8148 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 8149 string pagePos = isNavigationStickyMenu ? "js-page-pos" : ""; 8150 8151 <div id="Page" class="page @pagePos"> 8152 <div id="content"> 8153 @RenderSnippet("Content") 8154 </div> 8155 </div> 8156 } 8157 8158 @* Hack to support nested helpers *@ 8159 @SnippetStart("Content") 8160 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 8161 8162 8163 8164 @* Render the grid *@ 8165 @Model.Grid("Grid", "Grid", "default:true;sort:1", "Pages") 8166 8167 @SnippetEnd("Content") 8168 8169 @helper RenderIosTabletFix() 8170 { 8171 if (Pageview.Device != Dynamicweb.Frontend.Devices.DeviceType.Tablet && Pageview.Platform != Dynamicweb.Frontend.Devices.PlatformType.Ios) 8172 { 8173 <script> 8174 let isIpadIOS = (/iPad/.test(navigator.platform) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1)) && !window.MSStream; 8175 if (isIpadIOS) { 8176 var separator = (window.location.href.indexOf("?") === -1) ? "?" : "&"; 8177 window.location.href = window.location.href + separator + "DeviceType=Tablet&PlatformType=Ios"; 8178 } 8179 </script> 8180 } 8181 } 8182 8183 </html> 8184 8185