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_bb5ed2c2427749268ad1ff15ba098581.b__202_0(TextWriter __razor_helper_writer) in f:\Domains\Sites\asibrake.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 7921
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_bb5ed2c2427749268ad1ff15ba098581.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in f:\Domains\Sites\asibrake.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 246
   at CompiledRazorTemplates.Dynamic.RazorEngine_bb5ed2c2427749268ad1ff15ba098581.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in f:\Domains\Sites\asibrake.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 156
   at CompiledRazorTemplates.Dynamic.RazorEngine_bb5ed2c2427749268ad1ff15ba098581.b__201_0(TextWriter __razor_helper_writer) in f:\Domains\Sites\asibrake.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 7866
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_bb5ed2c2427749268ad1ff15ba098581.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in f:\Domains\Sites\asibrake.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 246
   at CompiledRazorTemplates.Dynamic.RazorEngine_bb5ed2c2427749268ad1ff15ba098581.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in f:\Domains\Sites\asibrake.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 156
   at CompiledRazorTemplates.Dynamic.RazorEngine_bb5ed2c2427749268ad1ff15ba098581.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in f:\Domains\Sites\asibrake.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 279
   at CompiledRazorTemplates.Dynamic.RazorEngine_bb5ed2c2427749268ad1ff15ba098581.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in f:\Domains\Sites\asibrake.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 156
   at CompiledRazorTemplates.Dynamic.RazorEngine_bb5ed2c2427749268ad1ff15ba098581.Execute() in f:\Domains\Sites\asibrake.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 7856
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

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