Error executing template "Designs/Rapido/_parsed/Page.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_873aae279f2942e9a94550231668f86d.b__192_0(TextWriter __razor_helper_writer) in C:\Solutions\Leftover\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 7410
   at CompiledRazorTemplates.Dynamic.RazorEngine_873aae279f2942e9a94550231668f86d.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in C:\Solutions\Leftover\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 247
   at CompiledRazorTemplates.Dynamic.RazorEngine_873aae279f2942e9a94550231668f86d.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in C:\Solutions\Leftover\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 155
   at CompiledRazorTemplates.Dynamic.RazorEngine_873aae279f2942e9a94550231668f86d.b__191_0(TextWriter __razor_helper_writer) in C:\Solutions\Leftover\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 7348
   at CompiledRazorTemplates.Dynamic.RazorEngine_873aae279f2942e9a94550231668f86d.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in C:\Solutions\Leftover\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 247
   at CompiledRazorTemplates.Dynamic.RazorEngine_873aae279f2942e9a94550231668f86d.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in C:\Solutions\Leftover\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 155
   at CompiledRazorTemplates.Dynamic.RazorEngine_873aae279f2942e9a94550231668f86d.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in C:\Solutions\Leftover\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 278
   at CompiledRazorTemplates.Dynamic.RazorEngine_873aae279f2942e9a94550231668f86d.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in C:\Solutions\Leftover\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 155
   at CompiledRazorTemplates.Dynamic.RazorEngine_873aae279f2942e9a94550231668f86d.Execute() in C:\Solutions\Leftover\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 7337
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

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