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_2775628a03534a9a9c1727bd950a09ea.b__203_0(TextWriter __razor_helper_writer) in f:\Domains\Sites\asibrake.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 7983
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_2775628a03534a9a9c1727bd950a09ea.<>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_2775628a03534a9a9c1727bd950a09ea.<>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_2775628a03534a9a9c1727bd950a09ea.b__202_0(TextWriter __razor_helper_writer) in f:\Domains\Sites\asibrake.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 7928
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_2775628a03534a9a9c1727bd950a09ea.<>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_2775628a03534a9a9c1727bd950a09ea.<>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_2775628a03534a9a9c1727bd950a09ea.<>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_2775628a03534a9a9c1727bd950a09ea.<>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_2775628a03534a9a9c1727bd950a09ea.Execute() in f:\Domains\Sites\asibrake.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 7918
   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 @using System.Linq 1992 @using Dna.Rizzo.Components 1993 @using Dynamicweb.Core 1994 @using Dynamicweb.Rapido.Blocks.Components.General 1995 1996 @helper RenderMonthYearField(DateTimeField settings) 1997 { 1998 if (string.IsNullOrEmpty(settings.Id)) 1999 { 2000 settings.Id = Guid.NewGuid().ToString("N"); 2001 } 2002 2003 var textField = new TextField { 2004 Name = settings.Name, 2005 Id = settings.Id, 2006 Label = settings.Label, 2007 HelpText = settings.HelpText, 2008 Value = settings.Value, 2009 Disabled = settings.Disabled, 2010 Required = settings.Required, 2011 ErrorMessage = settings.ErrorMessage, 2012 CssClass = settings.CssClass, 2013 WrapperCssClass = settings.WrapperCssClass, 2014 OnChange = settings.OnChange, 2015 OnClick = settings.OnClick, 2016 ExtraAttributes = settings.ExtraAttributes, 2017 // 2018 Placeholder = settings.Placeholder 2019 }; 2020 2021 @Render(textField) 2022 2023 List<string> jsAttributes = new List<string>(); 2024 2025 jsAttributes.Add("mode: '" + Enum.GetName(typeof(DateTimeFieldMode), settings.Mode).ToLower() + "'"); 2026 2027 if (!string.IsNullOrEmpty(settings.DateFormat)) 2028 { 2029 jsAttributes.Add("dateFormat: '" + settings.DateFormat + "'"); 2030 } 2031 if (!string.IsNullOrEmpty(settings.MinDate)) 2032 { 2033 jsAttributes.Add("minDate: '" + settings.MinDate + "'"); 2034 } 2035 if (!string.IsNullOrEmpty(settings.MaxDate)) 2036 { 2037 jsAttributes.Add("maxDate: '" + settings.MaxDate + "'"); 2038 } 2039 if (settings.IsInline) 2040 { 2041 jsAttributes.Add("inline: " + Converter.ToString(settings.IsInline).ToLower()); 2042 } 2043 if (settings.EnableTime) 2044 { 2045 jsAttributes.Add("enableTime: " + Converter.ToString(settings.EnableTime).ToLower()); 2046 } 2047 if (settings.EnableWeekNumbers) 2048 { 2049 jsAttributes.Add("weekNumbers: " + Converter.ToString(settings.EnableWeekNumbers).ToLower()); 2050 } 2051 jsAttributes.Add("plugins: " + "[new monthSelectPlugin({shorthand: true, dateFormat: 'F Y', altFormat: 'F Y'})]"); 2052 2053 jsAttributes.AddRange(settings.GetFlatPickrOptions().Select(x => x.Key + ": " + x.Value)); 2054 2055 <script> 2056 document.addEventListener("DOMContentLoaded", function () { 2057 flatpickr("#@textField.Id", { 2058 @string.Join(",", jsAttributes) 2059 }); 2060 }); 2061 </script> 2062 } 2063 2064 @using Dynamicweb.Frontend 2065 @using System.Reflection 2066 @using Dynamicweb.Content.Items 2067 @using System.Web.UI.HtmlControls 2068 @using Dynamicweb.Rapido.Blocks.Components 2069 @using Dynamicweb.Rapido.Blocks 2070 @using Dynamicweb.Rapido.Blocks.Components.Articles 2071 2072 @* Components for the articles *@ 2073 @using System.Reflection 2074 @using Dynamicweb.Rapido.Blocks.Components.Articles 2075 2076 2077 @* Component for the articles *@ 2078 2079 @helper RenderArticleBanner(dynamic settings) { 2080 string filterClasses = "image-filter image-filter--darken"; 2081 settings.Layout = ArticleHeaderLayout.Banner; 2082 2083 if (settings.Image != null) 2084 { 2085 if (settings.Image.Path != null) 2086 { 2087 <section class="multiple-paragraphs-container u-color-light paragraph-container--full-width"> 2088 <div class="background-image @filterClasses dw-mod"> 2089 <div class="background-image__wrapper @filterClasses dw-mod"> 2090 @{ 2091 settings.Image.CssClass += "background-image__cover dw-mod"; 2092 } 2093 @Render(settings.Image) 2094 </div> 2095 </div> 2096 <div class="center-container dw-mod"> 2097 <div class="grid"> 2098 <div class="grid__col-md-8 grid__col-xs-12 paragraph-container paragraph-container--height-lg"> 2099 <div class="u-left-middle"> 2100 <div> 2101 @if (!String.IsNullOrEmpty(settings.Heading)) 2102 { 2103 <h1 class="article__header article__header--giant dw-mod" style="color: @settings.TextColor">@settings.Heading</h1> 2104 } 2105 @if (!String.IsNullOrEmpty(settings.Subheading)) 2106 { 2107 <div class="article__leadtext dw-mod" style="color: @settings.TextColor">@settings.Subheading</div> 2108 } 2109 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 2110 { 2111 <small class="article__post-info u-margin-bottom--lg dw-mod" style="color: @settings.TextColor">@settings.Author @settings.Date</small> 2112 } 2113 @if (!String.IsNullOrEmpty(settings.Link)) { 2114 <div class="grid__cell"> 2115 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 2116 </div> 2117 } 2118 </div> 2119 </div> 2120 </div> 2121 @if (settings.ExternalParagraphId != 0) 2122 { 2123 <div class="grid__col-md-4 grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-auto dw-mod"> 2124 <div class="u-color-light-gray--bg u-color-dark dw-mod"> 2125 @RenderParagraphContent(settings.ExternalParagraphId) 2126 </div> 2127 </div> 2128 } 2129 2130 </div> 2131 </div> 2132 </section> 2133 if (!String.IsNullOrEmpty(settings.Image.Caption)) { 2134 <div class="image-caption dw-mod">@settings.Image.Caption</div> 2135 } 2136 } 2137 else 2138 { 2139 settings.Layout = ArticleHeaderLayout.Clean; 2140 @RenderArticleCleanHeader(settings); 2141 } 2142 } 2143 else 2144 { 2145 settings.Layout = ArticleHeaderLayout.Clean; 2146 @RenderArticleCleanHeader(settings); 2147 } 2148 } 2149 @using System.Reflection 2150 @using Dynamicweb.Rapido.Blocks.Components 2151 @using Dynamicweb.Rapido.Blocks.Components.General 2152 @using Dynamicweb.Rapido.Blocks.Components.Articles 2153 @using Dynamicweb.Rapido.Blocks 2154 2155 2156 @* Component for the articles *@ 2157 2158 @helper RenderArticleHeader(ArticleHeader settings) { 2159 dynamic[] methodParameters = new dynamic[1]; 2160 methodParameters[0] = settings; 2161 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleHeaderCustom"); 2162 2163 if (customMethod != null) 2164 { 2165 @customMethod.Invoke(this, methodParameters).ToString(); 2166 } else { 2167 switch (settings.Layout) 2168 { 2169 case ArticleHeaderLayout.Clean: 2170 @RenderArticleCleanHeader(settings); 2171 break; 2172 case ArticleHeaderLayout.Split: 2173 @RenderArticleSplitHeader(settings); 2174 break; 2175 case ArticleHeaderLayout.Banner: 2176 @RenderArticleBannerHeader(settings); 2177 break; 2178 case ArticleHeaderLayout.Overlay: 2179 @RenderArticleOverlayHeader(settings); 2180 break; 2181 default: 2182 @RenderArticleCleanHeader(settings); 2183 break; 2184 } 2185 } 2186 } 2187 2188 @helper RenderArticleCleanHeader(ArticleHeader settings) { 2189 dynamic[] methodParameters = new dynamic[1]; 2190 methodParameters[0] = settings; 2191 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleCleanHeaderCustom"); 2192 2193 if (customMethod != null) 2194 { 2195 @customMethod.Invoke(this, methodParameters).ToString(); 2196 } 2197 else 2198 { 2199 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12"; 2200 2201 <div class="grid grid--align-content-start grid--justify-start"> 2202 <div class="grid__col-md-@contentColumns grid__col-sm-12 u-padding--lg dw-mod"> 2203 @if (!String.IsNullOrEmpty(settings.Category) || !String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date) || settings.RatingOutOf != 0) 2204 { 2205 <div class="u-border-bottom u-padding-bottom"> 2206 @if (!String.IsNullOrEmpty(settings.Category)) 2207 { 2208 <div class="u-pull--left"> 2209 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div> 2210 </div> 2211 } 2212 <div class="u-pull--right"> 2213 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 2214 { 2215 <small class="article__post-info dw-mod">@settings.Author @settings.Date</small> 2216 } 2217 @if (settings.RatingOutOf != 0) 2218 { 2219 @Render(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) 2220 } 2221 </div> 2222 </div> 2223 } 2224 2225 <div class="grid__cell"> 2226 @if (!String.IsNullOrEmpty(settings.Heading)) 2227 { 2228 <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1> 2229 } 2230 @if (settings.Image != null) 2231 { 2232 if (settings.Image.Path != null) 2233 { 2234 <div class="u-padding-bottom--lg"> 2235 @Render(settings.Image) 2236 </div> 2237 } 2238 } 2239 @if (!String.IsNullOrEmpty(settings.Subheading)) 2240 { 2241 <div class="article__leadtext dw-mod">@settings.Subheading</div> 2242 } 2243 @if (!String.IsNullOrEmpty(settings.Link)) 2244 { 2245 <div class="grid__cell"> 2246 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 2247 </div> 2248 } 2249 </div> 2250 </div> 2251 @if (settings.ExternalParagraphId != 0) 2252 { 2253 <div class="grid__col-md-4 grid__col-sm-12 u-padding--lg u-color-light-gray--bg dw-mod"> 2254 @RenderParagraphContent(settings.ExternalParagraphId) 2255 </div> 2256 } 2257 </div> 2258 } 2259 } 2260 2261 @helper RenderArticleSplitHeader(ArticleHeader settings) { 2262 dynamic[] methodParameters = new dynamic[1]; 2263 methodParameters[0] = settings; 2264 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSplitHeaderCustom"); 2265 2266 if (customMethod != null) 2267 { 2268 @customMethod.Invoke(this, methodParameters).ToString(); 2269 } 2270 else 2271 { 2272 string headerColumnWidth = settings.ExternalParagraphId != 0 ? "4" : "6"; 2273 2274 if (settings.Image != null) 2275 { 2276 if (settings.Image.Path != null) 2277 { 2278 <section class="multiple-paragraphs-container paragraph-container--full-width"> 2279 <div class="grid"> 2280 <div class="grid__col-md-@headerColumnWidth grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-xl dw-mod"> 2281 <div class="u-left-middle u-padding--lg"> 2282 <div> 2283 @if (!String.IsNullOrEmpty(settings.Category)) 2284 { 2285 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div> 2286 } 2287 @if (!String.IsNullOrEmpty(settings.Heading)) 2288 { 2289 <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1> 2290 } 2291 @if (!String.IsNullOrEmpty(settings.Subheading)) 2292 { 2293 <div class="article__leadtext dw-mod">@settings.Subheading</div> 2294 } 2295 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 2296 { 2297 <small class="article__post-info u-pull--left dw-mod">@settings.Author @settings.Date</small> 2298 } 2299 @if (settings.RatingOutOf != 0) 2300 { 2301 <div class="u-pull--right"> 2302 @Render(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) 2303 </div> 2304 } 2305 @if (!String.IsNullOrEmpty(settings.Link)) { 2306 <div class="u-full-width u-pull--left u-margin-top"> 2307 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 2308 </div> 2309 } 2310 </div> 2311 </div> 2312 </div> 2313 <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> 2314 @if (settings.ExternalParagraphId != 0) 2315 { 2316 <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"> 2317 @RenderParagraphContent(settings.ExternalParagraphId) 2318 </div> 2319 } 2320 </div> 2321 </section> 2322 } 2323 } 2324 else 2325 { 2326 @RenderArticleCleanHeader(settings); 2327 } 2328 } 2329 } 2330 2331 @helper RenderArticleOverlayHeader(ArticleHeader settings) { 2332 dynamic[] methodParameters = new dynamic[1]; 2333 methodParameters[0] = settings; 2334 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleOverlayHeaderCustom"); 2335 2336 if (customMethod != null) 2337 { 2338 @customMethod.Invoke(this, methodParameters).ToString(); 2339 } 2340 else 2341 { 2342 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12"; 2343 string contentAlignment = settings.TextLayout == ArticleHeaderTextLayout.Center ? "grid--justify-center" : ""; 2344 2345 if (settings.Image != null) 2346 { 2347 if (settings.Image.Path != null) 2348 { 2349 if (settings.ExternalParagraphId == 0) 2350 { 2351 <section class="multiple-paragraphs-container u-color-light paragraph-container--full-width"> 2352 <div class="background-image image-filter image-filter--darken dw-mod"> 2353 <div class="background-image__wrapper image-filter image-filter--darken dw-mod"> 2354 @{ 2355 settings.Image.CssClass += "background-image__cover dw-mod"; 2356 } 2357 @Render(settings.Image) 2358 </div> 2359 </div> 2360 <div class="center-container dw-mod"> 2361 <div class="grid @contentAlignment"> 2362 <div class="grid__col-md-@contentColumns grid__col-xs-12 paragraph-container paragraph-container--height-xl u-no-padding dw-mod"> 2363 @if (!String.IsNullOrEmpty(settings.Heading)) 2364 { 2365 <h1 class="article__header article__header--giant u-padding-top--lg dw-mod" style="color: @settings.TextColor">@settings.Heading</h1> 2366 } 2367 @if (!String.IsNullOrEmpty(settings.Subheading)) 2368 { 2369 <div class="article__leadtext dw-mod" style="color: @settings.TextColor">@settings.Subheading</div> 2370 } 2371 <div class="u-margin-top"> 2372 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 2373 { 2374 <small class="article__post-info u-pull--left dw-mod" style="color: @settings.TextColor">@settings.Author @settings.Date</small> 2375 } 2376 @if (settings.RatingOutOf != 0) 2377 { 2378 <div class="u-pull--right"> 2379 @Render(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) 2380 </div> 2381 } 2382 </div> 2383 @if (!String.IsNullOrEmpty(settings.Link)) 2384 { 2385 <div class="grid__cell"> 2386 @Render(new Link { Href = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 2387 </div> 2388 } 2389 </div> 2390 </div> 2391 </div> 2392 </section> 2393 } 2394 else 2395 { 2396 @RenderArticleBanner(settings); 2397 } 2398 } 2399 } 2400 else 2401 { 2402 @RenderArticleCleanHeader(settings); 2403 } 2404 } 2405 } 2406 2407 @helper RenderArticleBannerHeader(dynamic settings) { 2408 dynamic[] methodParameters = new dynamic[1]; 2409 methodParameters[0] = settings; 2410 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleBannerHeaderCustom"); 2411 2412 if (customMethod != null) 2413 { 2414 @customMethod.Invoke(this, methodParameters).ToString(); 2415 } 2416 else 2417 { 2418 @RenderArticleBanner(settings); 2419 } 2420 } 2421 @using System.Reflection 2422 @using System.Text.RegularExpressions; 2423 @using Dynamicweb.Frontend 2424 @using Dynamicweb.Content.Items 2425 @using Dynamicweb.Rapido.Blocks.Components 2426 @using Dynamicweb.Rapido.Blocks.Components.Articles 2427 @using Dynamicweb.Rapido.Blocks 2428 2429 @* Component for the articles *@ 2430 2431 @helper RenderArticleBodyRow(ArticleBodyRow settings) 2432 { 2433 string position = settings.TopLayout == "overlay" ? "article__overlay-offset" : ""; 2434 string contentAlignment = settings.TextLayout == "center" ? "grid--justify-center" : ""; 2435 2436 <div class="grid grid--align-content-start @contentAlignment @position dw-mod"> 2437 @RenderBlockList(settings.SubBlocks) 2438 </div> 2439 } 2440 @using System.Reflection 2441 @using Dynamicweb.Rapido.Blocks.Components 2442 @using Dynamicweb.Rapido.Blocks.Components.General 2443 @using Dynamicweb.Rapido.Blocks.Components.Articles 2444 @using Dynamicweb.Rapido.Blocks 2445 2446 @* Component for the articles *@ 2447 2448 @helper RenderArticleImage(ArticleImage settings) 2449 { 2450 if (settings.Image != null) 2451 { 2452 if (settings.Image.Path != null) 2453 { 2454 <div class="u-margin-bottom--lg"> 2455 @Render(settings.Image) 2456 </div> 2457 } 2458 } 2459 } 2460 @using System.Reflection 2461 @using Dynamicweb.Rapido.Blocks.Components 2462 @using Dynamicweb.Rapido.Blocks.Components.Articles 2463 2464 2465 @* Component for the articles *@ 2466 2467 @helper RenderArticleSubHeader(ArticleSubHeader settings) 2468 { 2469 if (!String.IsNullOrEmpty(settings.Title)) 2470 { 2471 <h2 class="article__header">@settings.Title</h2> 2472 } 2473 } 2474 @using System.Reflection 2475 @using Dynamicweb.Rapido.Blocks.Components 2476 @using Dynamicweb.Rapido.Blocks.Components.Articles 2477 @using Dynamicweb.Rapido.Blocks 2478 2479 2480 @* Component for the articles *@ 2481 2482 @helper RenderArticleText(ArticleText settings) 2483 { 2484 if (!String.IsNullOrEmpty(settings.Text)) 2485 { 2486 string greatTextClass = settings.EnableLargeText == true ? "article__paragraph--great-text" : ""; 2487 2488 <div class="article__paragraph @greatTextClass"> 2489 @settings.Text 2490 </div> 2491 } 2492 } 2493 @using System.Reflection 2494 @using Dynamicweb.Rapido.Blocks.Components 2495 @using Dynamicweb.Rapido.Blocks.Components.Articles 2496 @using Dynamicweb.Rapido.Blocks 2497 2498 2499 @* Component for the articles *@ 2500 2501 @helper RenderArticleQuote(ArticleQuote settings) 2502 { 2503 string text = Regex.Replace(settings.Text, "<.*?>", String.Empty); 2504 2505 <div class="grid u-padding-bottom--lg"> 2506 @if (settings.Image != null) 2507 { 2508 if (settings.Image.Path != null) { 2509 <div class="grid__col-3"> 2510 <div class="grid__cell-img"> 2511 @{ 2512 settings.Image.Title = !String.IsNullOrEmpty(settings.Image.Title) ? settings.Image.Title : settings.Author; 2513 settings.Image.CssClass += " article__image article__image--ball"; 2514 settings.Image.ImageDefault.Width = 200; 2515 settings.Image.ImageDefault.Height = 200; 2516 } 2517 @Render(settings.Image) 2518 </div> 2519 </div> 2520 } 2521 } 2522 <div class="grid__col-auto"> 2523 @if (!String.IsNullOrEmpty(settings.Text)) 2524 { 2525 <div class="article__quote dw-mod"> 2526 <i class="fas fa-quote-right u-margin-bottom--lg"></i> 2527 @settings.Text 2528 <i class="fas fa-quote-right"></i> 2529 </div> 2530 } 2531 @if (!String.IsNullOrEmpty(settings.Author)) 2532 { 2533 <div class="article__quote-author dw-mod"> 2534 - @settings.Author 2535 </div> 2536 } 2537 </div> 2538 </div> 2539 } 2540 @using System.Reflection 2541 @using Dynamicweb.Rapido.Blocks.Components 2542 @using Dynamicweb.Rapido.Blocks.Components.Articles 2543 @using Dynamicweb.Rapido.Blocks 2544 2545 @* Component for the articles *@ 2546 2547 @helper RenderArticleInfoTable(ArticleInfoTable settings) 2548 { 2549 <table class="table table--clean"> 2550 @foreach (var row in settings.Rows) 2551 { 2552 string iconColor = row.IconColor != null ? row.IconColor : "u-brand-color-two"; 2553 2554 <tr> 2555 @if (!String.IsNullOrEmpty(row.Icon)) 2556 { 2557 <td class="u-w32px"><i class="@row.Icon fa-2x @row.IconColor"></i></td> 2558 } 2559 <td class="u-no-margin-on-p-elements"> 2560 <div class="u-bold">@row.Title</div> 2561 @if (!String.IsNullOrEmpty(row.SubTitle)) 2562 { 2563 if (row.Link == null) 2564 { 2565 <div>@row.SubTitle</div> 2566 } 2567 else 2568 { 2569 <a href="@row.Link" class="u-color-inherit">@row.SubTitle</a> 2570 } 2571 } 2572 </td> 2573 </tr> 2574 } 2575 </table> 2576 } 2577 @using System.Reflection 2578 @using Dynamicweb.Rapido.Blocks.Components 2579 @using Dynamicweb.Rapido.Blocks.Components.General 2580 @using Dynamicweb.Rapido.Blocks.Components.Articles 2581 @using Dynamicweb.Rapido.Blocks 2582 2583 @* Component for the articles *@ 2584 2585 @helper RenderArticleGalleryModal(ArticleGalleryModal settings) 2586 { 2587 Modal galleryModal = new Modal 2588 { 2589 Id = "ParagraphGallery", 2590 Width = ModalWidth.Full, 2591 BodyTemplate = RenderArticleGalleryModalContent() 2592 }; 2593 2594 @Render(galleryModal) 2595 } 2596 2597 @helper RenderArticleGalleryModalContent() { 2598 <div class="modal__image-min-size-wrapper"> 2599 @Render(new Image { 2600 Id = "ParagraphGallery", 2601 Path = "#", 2602 CssClass = "modal--full__img", 2603 DisableLazyLoad = true, 2604 DisableImageEngine = true 2605 }) 2606 </div> 2607 2608 <div class="modal__images-counter" id="ParagraphGallery_counter"></div> 2609 2610 @Render(new Button { 2611 Id = "ParagraphGallery_prev", 2612 ButtonType = ButtonType.Button, 2613 ButtonLayout = ButtonLayout.None, 2614 CssClass = "modal__prev-btn", 2615 Icon = new Icon { Prefix = "far", Name = "fa-angle-left", LabelPosition = IconLabelPosition.After }, 2616 OnClick = "Gallery.prevImage('ParagraphGallery')" 2617 }) 2618 2619 @Render(new Button { 2620 Id = "ParagraphGallery_next", 2621 ButtonType = ButtonType.Button, 2622 ButtonLayout = ButtonLayout.None, 2623 CssClass = "modal__next-btn", 2624 Icon = new Icon { Prefix = "far", Name = "fa-angle-right", LabelPosition = IconLabelPosition.After }, 2625 OnClick = "Gallery.nextImage('ParagraphGallery')" 2626 }) 2627 } 2628 @using System.Reflection 2629 @using Dynamicweb.Rapido.Blocks.Components 2630 @using Dynamicweb.Rapido.Blocks.Components.Articles 2631 @using Dynamicweb.Rapido.Blocks 2632 2633 2634 @* Component for the articles *@ 2635 2636 @helper RenderArticleRelated(ArticleRelated settings) 2637 { 2638 string cardClass = Pageview.Device.ToString() != "Tablet" ? "card u-color-light--bg u-full-height" : ""; 2639 string cardFooterClass = Pageview.Device.ToString() != "Tablet" ? "card-footer u-color-light--bg" : ""; 2640 2641 <section class="multiple-paragraphs-container u-color-light-gray--bg paragraph-container--full-width"> 2642 <div class="center-container dw-mod"> 2643 <div class="grid u-padding"> 2644 <div class="grid__col-md-12 grid__col-xs-12"> 2645 <h2 class="article__header u-no-margin u-margin-top">@settings.Title</h2> 2646 </div> 2647 </div> 2648 2649 <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> 2650 2651 <script id="RelatedSimpleTemplate" type="text/x-template"> 2652 {{#.}} 2653 <div class="grid u-padding-bottom--lg"> 2654 {{#Cases}} 2655 <div class="grid__col-3 image-hover--zoom dw-mod"> 2656 <a href="{{link}}" class="u-full-height u-color-light--bg"> 2657 {{#if image}} 2658 <div class="u-color-light--bg u-no-padding dw-mod"> 2659 <div class="flex-img image-hover__wrapper"> 2660 <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}}" /> 2661 </div> 2662 </div> 2663 {{/if}} 2664 2665 <div class="card u-color-light--bg dw-mod"> 2666 <h3 class="article-list__item-header u-truncate-text dw-mod">{{title}}</h3> 2667 <p class="article__short-summary dw-mod">{{summary}}</p> 2668 </div> 2669 </a> 2670 </div> 2671 {{/Cases}} 2672 </div> 2673 {{/.}} 2674 </script> 2675 </div> 2676 </section> 2677 } 2678 @using System.Reflection 2679 @using Dynamicweb.Rapido.Blocks.Components 2680 @using Dynamicweb.Rapido.Blocks.Components.Articles 2681 @using Dynamicweb.Rapido.Blocks 2682 2683 2684 @* Component for the articles *@ 2685 2686 @helper RenderArticleMenu(ArticleMenu settings) 2687 { 2688 if (!String.IsNullOrEmpty(settings.Title)) { 2689 <div class="u-margin u-border-bottom"> 2690 <h3 class="u-no-margin">@settings.Title</h3> 2691 </div> 2692 } 2693 2694 <ul class="menu-left u-margin-bottom dw-mod"> 2695 @foreach (var item in settings.Items) 2696 { 2697 @Render(item) 2698 } 2699 </ul> 2700 } 2701 2702 @helper RenderArticleMenuItem(ArticleMenuItem settings) 2703 { 2704 string link = !String.IsNullOrEmpty(settings.Link) ? settings.Link : "#"; 2705 2706 if (!String.IsNullOrEmpty(settings.Title)) { 2707 <li class="menu-left__item dw-mod"> 2708 <a href="@link" onclick="@settings.OnClick" class="menu-left__link dw-mod">@settings.Title</a> 2709 </li> 2710 } 2711 } 2712 @using System.Reflection 2713 @using Dynamicweb.Rapido.Blocks.Components 2714 @using Dynamicweb.Rapido.Blocks.Components.Articles 2715 @using Dynamicweb.Rapido.Blocks 2716 2717 @* Component for the articles *@ 2718 2719 @helper RenderArticleList(ArticleList settings) 2720 { 2721 if (Pageview != null) 2722 { 2723 bool isParagraph = Pageview.CurrentParagraph != null ? true : false; 2724 string[] sortArticlesListBy = new string[2]; 2725 2726 if (isParagraph) { 2727 sortArticlesListBy = Pageview.CurrentParagraph.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString()) ? Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" }; 2728 } 2729 else { 2730 sortArticlesListBy = Pageview.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.Item["SortArticlesListBy"].ToString()) ? Pageview.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" }; 2731 } 2732 2733 string sourcePage = settings.SourcePage != null ? settings.SourcePage : Pageview.ID.ToString(); 2734 2735 if (!settings.DisablePagination) { 2736 @RenderItemList(new 2737 { 2738 ItemType = !String.IsNullOrEmpty(settings.ItemType) ? settings.ItemType : "DynamicArticle", 2739 ListSourceType = settings.SourceType, 2740 ListSourcePage = sourcePage, 2741 ItemFieldsList = "*", 2742 Filter = settings.Filter, 2743 ListOrderBy = sortArticlesListBy[0], 2744 ListOrderByDirection = sortArticlesListBy[1], 2745 ListSecondOrderBy = sortArticlesListBy[0] == "Date" ? "InFocusSortId" : "Date", 2746 ListSecondOrderByDirection = "ASC", 2747 IncludeAllChildItems = true, 2748 ListTemplate = settings.Template, 2749 ListPageSize = settings.PageSize.ToString() 2750 }); 2751 } else { 2752 @RenderItemList(new 2753 { 2754 ItemType = !String.IsNullOrEmpty(settings.ItemType) ? settings.ItemType : "DynamicArticle", 2755 ListSourceType = settings.SourceType, 2756 ListSourcePage = sourcePage, 2757 ItemFieldsList = "*", 2758 Filter = settings.Filter, 2759 ListOrderBy = sortArticlesListBy[0], 2760 ListOrderByDirection = sortArticlesListBy[1], 2761 ListSecondOrderBy = sortArticlesListBy[0] == "Date" ? "InFocusSortId" : "Date", 2762 ListSecondOrderByDirection = "ASC", 2763 IncludeAllChildItems = true, 2764 ListTemplate = settings.Template, 2765 ListPageSize = settings.PageSize.ToString(), 2766 ListViewMode = "Partial", 2767 ListShowTo = settings.PageSize + 1 2768 }); 2769 } 2770 } 2771 } 2772 @using System.Reflection 2773 @using Dynamicweb.Rapido.Blocks.Components.Articles 2774 2775 2776 @* Component for the articles *@ 2777 2778 @helper RenderArticleSummary(ArticleSummary settings) 2779 { 2780 if (!String.IsNullOrEmpty(settings.Text)) 2781 { 2782 <div class="article__summary dw-mod">@settings.Text</div> 2783 } 2784 } 2785 @using System.Reflection 2786 @using Dynamicweb.Rapido.Blocks.Components 2787 @using Dynamicweb.Rapido.Blocks.Components.Articles 2788 @using Dynamicweb.Rapido.Blocks 2789 2790 @* Component for the articles *@ 2791 2792 @helper RenderArticleListCategoryFilter(ArticleListCategoryFilter settings) 2793 { 2794 string pageId = Pageview.ID.ToString(); 2795 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("sourcePage")) ? HttpContext.Current.Request.QueryString.Get("sourcePage") : Translate("All"); 2796 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString()); 2797 2798 foreach (var option in settings.Categories) 2799 { 2800 selectedFilter = selectedFilter == option.Value ? option.Key : selectedFilter; 2801 } 2802 2803 if (selectedFilter == pageId) 2804 { 2805 selectedFilter = Translate("All"); 2806 } 2807 2808 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 2809 { 2810 <div class="u-pull--right u-margin-left"> 2811 <div class="collection u-no-margin"> 2812 <h5>@Translate("Category")</h5> 2813 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" /> 2814 <div class="dropdown u-w180px dw-mod"> 2815 <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label> 2816 <div class="dropdown__content dw-mod"> 2817 @foreach (var option in settings.Categories) 2818 { 2819 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div> 2820 } 2821 </div> 2822 <label class="dropdown-trigger-off" for="CategorySelector"></label> 2823 </div> 2824 </div> 2825 </div> 2826 } 2827 else 2828 { 2829 <div class="u-full-width u-margin-bottom"> 2830 <h5 class="u-no-margin">@Translate("Category")</h5> 2831 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" /> 2832 <div class="dropdown u-full-width dw-mod"> 2833 <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label> 2834 <div class="dropdown__content dw-mod"> 2835 @foreach (var option in settings.Categories) 2836 { 2837 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div> 2838 } 2839 </div> 2840 <label class="dropdown-trigger-off" for="CategorySelector"></label> 2841 </div> 2842 </div> 2843 } 2844 } 2845 @using System.Reflection 2846 @using Dynamicweb.Rapido.Blocks.Components 2847 @using Dynamicweb.Rapido.Blocks.Components.Articles 2848 @using Dynamicweb.Rapido.Blocks 2849 @using System.Collections.Generic 2850 2851 @* Component for the articles *@ 2852 2853 @helper RenderArticleListFilter(ArticleListFilter settings) 2854 { 2855 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get(settings.SystemName)) ? HttpContext.Current.Request.QueryString.Get(settings.SystemName) : Translate("All"); 2856 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString()); 2857 2858 if (settings.Options != null) 2859 { 2860 if (settings.Options is IEnumerable<dynamic>) 2861 { 2862 var options = (IEnumerable<dynamic>) settings.Options; 2863 settings.Options = options.OrderBy(item => item.Name); 2864 } 2865 2866 foreach (var option in settings.Options) 2867 { 2868 selectedFilter = selectedFilter == option.Value ? option.Name : selectedFilter; 2869 } 2870 2871 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 2872 { 2873 <div class="u-pull--right u-margin-left"> 2874 <div class="collection u-no-margin"> 2875 <h5>@settings.Label</h5> 2876 <input type="checkbox" id="@(settings.SystemName)Selector" class="dropdown-trigger" /> 2877 <div class="dropdown u-w180px dw-mod"> 2878 <label class="dropdown__header dropdown__btn dw-mod" for="@(settings.SystemName)Selector">@Translate(selectedFilter)</label> 2879 <div class="dropdown__content dw-mod"> 2880 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')">@Translate("All")</div> 2881 @foreach (var option in settings.Options) 2882 { 2883 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')">@Translate(option.Name)</div> 2884 } 2885 </div> 2886 <label class="dropdown-trigger-off" for="@(settings.SystemName)Selector"></label> 2887 </div> 2888 </div> 2889 </div> 2890 } 2891 else 2892 { 2893 <div class="u-full-width u-margin-bottom"> 2894 <h5 class="u-no-margin">@settings.Label</h5> 2895 <input type="checkbox" id="@(settings.SystemName)Selector" class="dropdown-trigger" /> 2896 <div class="dropdown u-full-width w-mod"> 2897 <label class="dropdown__header dropdown__btn dw-mod" for="@(settings.SystemName)Selector">@Translate(selectedFilter)</label> 2898 <div class="dropdown__content dw-mod"> 2899 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')">@Translate("All")</div> 2900 @foreach (var option in settings.Options) 2901 { 2902 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')">@Translate(option.Name)</div> 2903 } 2904 </div> 2905 <label class="dropdown-trigger-off" for="@(settings.SystemName)Selector"></label> 2906 </div> 2907 </div> 2908 } 2909 } 2910 } 2911 @using System.Reflection 2912 @using Dynamicweb.Rapido.Blocks.Components 2913 @using Dynamicweb.Rapido.Blocks.Components.Articles 2914 @using Dynamicweb.Rapido.Blocks 2915 2916 @* Component for the articles *@ 2917 2918 @helper RenderArticleListSearch(ArticleListSearch settings) 2919 { 2920 string searchParameter = !string.IsNullOrEmpty(settings.SearchParameter) ? settings.SearchParameter : "Title"; 2921 string searchWord = HttpContext.Current.Request.QueryString.Get(searchParameter); 2922 string searchString = !string.IsNullOrEmpty(searchWord) ? searchWord.Trim('*') : ""; 2923 string className = "u-w340px u-pull--right u-margin-left"; 2924 2925 if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet") 2926 { 2927 className = "u-full-width"; 2928 } 2929 2930 <div class="typeahead u-color-inherit u-margin-bottom dw-mod @className"> 2931 <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 + '*')"> 2932 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod"><i class="fas fa-search"></i></button> 2933 </div> 2934 } 2935 @using System.Reflection 2936 @using Dynamicweb.Rapido.Blocks.Components 2937 @using Dynamicweb.Rapido.Blocks.Components.Articles 2938 @using Dynamicweb.Rapido.Blocks 2939 2940 @* Component for the articles *@ 2941 2942 @helper RenderArticleListNoResultsInfo(ArticleListNoResultsInfo settings) 2943 { 2944 <div class="u-margin-top--lg u-bold u-ta-center u-bold">@Translate(settings.Message)</div> 2945 } 2946 @using System.Reflection 2947 @using Dynamicweb.Rapido.Blocks.Components 2948 @using Dynamicweb.Rapido.Blocks.Components.General 2949 @using Dynamicweb.Rapido.Blocks.Components.Articles 2950 @using Dynamicweb.Rapido.Blocks 2951 @using System.Text.RegularExpressions 2952 2953 @* Component for the articles *@ 2954 2955 @helper RenderArticleListItem(ArticleListItem settings) 2956 { 2957 switch (settings.Type) { 2958 case ArticleListItemType.Card: 2959 @RenderArticleListItemCard(settings); 2960 break; 2961 case ArticleListItemType.List: 2962 @RenderArticleListItemList(settings); 2963 break; 2964 case ArticleListItemType.Simple: 2965 @RenderArticleListItemSimple(settings); 2966 break; 2967 default: 2968 @RenderArticleListItemCard(settings); 2969 break; 2970 } 2971 } 2972 2973 @helper RenderArticleListItemCard(ArticleListItem settings) { 2974 <a href="@settings.Link" class="u-full-height u-color-light--bg"> 2975 <div class="u-color-light--bg u-no-padding dw-mod"> 2976 @if (settings.Logo != null) 2977 { 2978 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;" : ""; 2979 settings.Logo.ImageDefault.Crop = 5; 2980 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width; 2981 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height; 2982 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage"> 2983 @if (settings.Stickers != null) 2984 { 2985 if (settings.Stickers.Position != StickersListPosition.Custom) 2986 { 2987 @Render(settings.Stickers); 2988 } 2989 } 2990 @RenderImage(settings.Logo) 2991 </div> 2992 } else if (settings.Image != null) 2993 { 2994 <div class="flex-img image-hover__wrapper u-position-relative dw-mod"> 2995 @if (settings.Stickers != null) 2996 { 2997 if (settings.Stickers.Position != StickersListPosition.Custom) 2998 { 2999 @Render(settings.Stickers); 3000 } 3001 } 3002 @Render(settings.Image) 3003 </div> 3004 } 3005 </div> 3006 3007 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary)) 3008 { 3009 <div class="card u-color-light--bg dw-mod"> 3010 @if (settings.Stickers != null) 3011 { 3012 if (settings.Stickers.Position == StickersListPosition.Custom) 3013 { 3014 @Render(settings.Stickers); 3015 } 3016 } 3017 @if (!String.IsNullOrEmpty(settings.Title)) 3018 { 3019 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3> 3020 } 3021 @if (!String.IsNullOrEmpty(settings.SubTitle)) 3022 { 3023 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 3024 } 3025 @if (!String.IsNullOrEmpty(settings.Summary)) 3026 { 3027 <p class="article__short-summary dw-mod">@settings.Summary</p> 3028 } 3029 </div> 3030 } 3031 </a> 3032 } 3033 3034 @helper RenderArticleListItemList(ArticleListItem settings) { 3035 <a href="@settings.Link"> 3036 <div class="grid u-color-light--bg u-no-padding dw-mod"> 3037 <div class="grid__col-md-3"> 3038 <div class="u-color-light--bg u-no-padding dw-mod"> 3039 @if (settings.Logo != null) 3040 { 3041 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;" : ""; 3042 settings.Logo.ImageDefault.Crop = 5; 3043 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width; 3044 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height; 3045 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage"> 3046 @if (settings.Stickers != null) 3047 { 3048 if (settings.Stickers.Position != StickersListPosition.Custom) 3049 { 3050 @Render(settings.Stickers); 3051 } 3052 } 3053 @RenderImage(settings.Logo) 3054 </div> 3055 } else if (settings.Image != null) 3056 { 3057 <div class="flex-img image-hover__wrapper dw-mod"> 3058 @if (settings.Stickers != null) 3059 { 3060 if (settings.Stickers.Position != StickersListPosition.Custom) 3061 { 3062 @Render(settings.Stickers); 3063 } 3064 } 3065 @Render(settings.Image) 3066 </div> 3067 } 3068 </div> 3069 </div> 3070 3071 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary)) 3072 { 3073 <div class="grid__col-md-9"> 3074 @if (!String.IsNullOrEmpty(settings.Title)) 3075 { 3076 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3> 3077 } 3078 @if (settings.Stickers != null) 3079 { 3080 if (settings.Stickers.Position == StickersListPosition.Custom) 3081 { 3082 @Render(settings.Stickers); 3083 } 3084 } 3085 @if (!String.IsNullOrEmpty(settings.SubTitle)) 3086 { 3087 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 3088 } 3089 @if (!String.IsNullOrEmpty(settings.Summary)) 3090 { 3091 <p class="article__short-summary dw-mod">@settings.Summary</p> 3092 } 3093 </div> 3094 } 3095 </div> 3096 </a> 3097 } 3098 3099 @helper RenderArticleListItemSimple(ArticleListItem settings) { 3100 <a href="@settings.Link" class="u-color-inherit"> 3101 <div class="grid u-color-light--bg u-no-padding dw-mod"> 3102 <div class="grid__col-md-12"> 3103 @if (!String.IsNullOrEmpty(settings.Title)) 3104 { 3105 <div class="article-list-item__header u-truncate-text u-no-margin dw-mod">@settings.Title</div> 3106 } 3107 @if (!String.IsNullOrEmpty(settings.SubTitle)) 3108 { 3109 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 3110 } 3111 </div> 3112 </div> 3113 </a> 3114 } 3115 @using System.Reflection 3116 @using Dynamicweb.Rapido.Blocks.Components.Articles 3117 3118 3119 @* Component for the articles *@ 3120 3121 @helper RenderArticleAuthorAndDate(ArticleAuthorAndDate settings) 3122 { 3123 <small class="article__subscription"> 3124 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date))) 3125 { 3126 <text>@Translate("Written")</text> 3127 } 3128 @if (!string.IsNullOrWhiteSpace(settings.Author)) 3129 { 3130 <text>@Translate("by") @settings.Author</text> 3131 } 3132 @if (!string.IsNullOrWhiteSpace(settings.Date)) 3133 { 3134 <text>@Translate("on") @settings.Date</text> 3135 } 3136 </small> 3137 } 3138 @using System.Reflection 3139 @using Dynamicweb.Rapido.Blocks.Components.Articles 3140 @using Dynamicweb.Rapido.Blocks.Components.General 3141 3142 3143 @* Component for the articles *@ 3144 3145 @helper RenderArticleLink(ArticleLink settings) 3146 { 3147 if (!string.IsNullOrEmpty(settings.Title)) 3148 { 3149 Button link = new Button { 3150 ConfirmText = settings.ConfirmText, 3151 ConfirmTitle = settings.ConfirmTitle, 3152 ButtonType = settings.ButtonType, 3153 Id = settings.Id, 3154 Title = settings.Title, 3155 AltText = settings.AltText, 3156 OnClick = settings.OnClick, 3157 CssClass = settings.CssClass, 3158 Disabled = settings.Disabled, 3159 Icon = settings.Icon, 3160 Name = settings.Name, 3161 Href = settings.Href, 3162 ButtonLayout = settings.ButtonLayout, 3163 ExtraAttributes = settings.ExtraAttributes 3164 }; 3165 <div class="grid__cell"> 3166 @Render(link) 3167 </div> 3168 } 3169 } 3170 @using System.Reflection 3171 @using Dynamicweb.Rapido.Blocks 3172 @using Dynamicweb.Rapido.Blocks.Components.Articles 3173 @using Dynamicweb.Rapido.Blocks.Components.General 3174 3175 3176 @* Component for the articles *@ 3177 3178 @helper RenderArticleCarousel(ArticleCarousel settings) 3179 { 3180 <div class="grid"> 3181 <div class="grid__col-12"> 3182 <div class="carousel" id="carousel_@settings.Id"> 3183 <div class="carousel__container js-carousel-slides dw-mod"> 3184 @RenderBlockList(settings.SubBlocks) 3185 </div> 3186 </div> 3187 </div> 3188 </div> 3189 3190 <script> 3191 document.addEventListener("DOMContentLoaded", function () { 3192 new CarouselModule("#carousel_@settings.Id", { 3193 slideTime: 0, 3194 dots: true 3195 }); 3196 }); 3197 </script> 3198 } 3199 3200 @helper RenderArticleCarouselSlide(ArticleCarouselSlide settings) 3201 { 3202 string imageEngine = "/Admin/Public/GetImage.ashx?"; 3203 3204 string defaultImage = settings.ImageSettings != null ? imageEngine : settings.Image; 3205 if (settings.ImageSettings != null) 3206 { 3207 defaultImage += settings.ImageSettings.Width != 0 ? "Width=" + settings.ImageSettings.Width + "&" : ""; 3208 defaultImage += settings.ImageSettings.Height != 0 ? "Height=" + settings.ImageSettings.Height + "&" : ""; 3209 defaultImage += "Crop=" + settings.ImageSettings.Crop + "&"; 3210 defaultImage += "Compression=" + settings.ImageSettings.Compression + "&"; 3211 defaultImage += "DoNotUpscale=" + settings.ImageSettings.DoNotUpscale.ToString() + "&"; 3212 defaultImage += "FillCanvas=" + settings.ImageSettings.FillCanvas.ToString() + "&"; 3213 } 3214 defaultImage += "&Image=" + settings.Image; 3215 3216 <div class="carousel__slide u-min-h300px u-flex dw-mod" style="background-size:cover; background-image:url('@defaultImage')"> 3217 <a class="article-carousel-item__wrap" href="@settings.Link" title="@settings.Title"> 3218 <h2 class="article-list__item-header u-truncate-text u-color-light dw-mod">@settings.Title</h2> 3219 <div class="article-list__item-info"> 3220 @if (settings.Stickers != null) 3221 { 3222 settings.Stickers.Position = StickersListPosition.Custom; 3223 @Render(settings.Stickers); 3224 } 3225 3226 <small class="u-margin-top--lg u-color-light"> 3227 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date))) 3228 { 3229 <text>@Translate("Written")</text> 3230 } 3231 @if (!string.IsNullOrWhiteSpace(settings.Author)) 3232 { 3233 <text>@Translate("by") @settings.Author</text> 3234 } 3235 @if (!string.IsNullOrWhiteSpace(settings.Date)) 3236 { 3237 <text>@Translate("on") @settings.Date</text> 3238 } 3239 </small> 3240 </div> 3241 3242 <h3 class="article__short-summary u-color-light">@settings.Summary</h3> 3243 </a> 3244 @if (settings.UseFilters == true) 3245 { 3246 <div class="background-image image-filter image-filter--darken dw-mod"></div> 3247 } 3248 </div> 3249 } 3250 @using System.Text.RegularExpressions 3251 @using Dynamicweb.Rapido.Blocks.Components 3252 @using Dynamicweb.Rapido.Blocks.Components.General 3253 @using Dynamicweb.Rapido.Blocks.Components.Articles 3254 @using Dynamicweb.Rapido.Blocks 3255 3256 @* Component for the articles *@ 3257 3258 @helper RenderArticleVideo(ArticleVideo settings) 3259 { 3260 if (settings.Url != null) 3261 { 3262 //getting video ID from youtube URL 3263 string videoCode = settings.Url; 3264 Regex regex = new Regex(@".be\/(.[^?]*)"); 3265 Match match = regex.Match(videoCode); 3266 string videoId = ""; 3267 if (match.Success) 3268 { 3269 videoId = match.Groups[1].Value; 3270 } 3271 else 3272 { 3273 regex = new Regex(@"v=([^&]+)"); 3274 match = regex.Match(videoCode); 3275 if (match.Success) 3276 { 3277 videoId = match.Groups[1].Value; 3278 } 3279 } 3280 3281 int autoPlay = settings.AutoPlay == "true" ? 1 : 0; 3282 3283 <div class="video-wrapper"> 3284 <div class="js-youtube-video" data-video="@videoId" id="ytPlayer@(Guid.NewGuid().ToString("N"))" data-auto-play="@autoPlay" data-enable-controls="1"></div> 3285 </div> 3286 } 3287 } 3288 3289 3290 3291 @* Simple helpers *@ 3292 3293 @*Requires the Gallery ItemType that comes with Rapido*@ 3294 @helper RenderArticleItemGallery(IList<ItemViewModel> gallery) { 3295 if (gallery != null && gallery.Count > 0) 3296 { 3297 int count = 1; 3298 3299 foreach (var item in gallery) 3300 { 3301 if (item.GetFile("ImagePath") != null) 3302 { 3303 string image = item.GetFile("ImagePath").PathUrlEncoded; 3304 string imagePrefix = "/Admin/Public/GetImage.ashx?width=1200&amp;height=820&amp;crop=5&amp;Compression=75&amp;DoNotUpscale=1&amp;image="; 3305 int imagesCount = gallery.Count; 3306 3307 if (count == 1) 3308 { 3309 <label class="gallery" for="ParagraphGalleryModalTrigger" onclick="Gallery.openImage(this.querySelector('.js-gallery'))"> 3310 <span class="gallery__main-image"> 3311 <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" /> 3312 </span> 3313 <span class="gallery__image-counter"> 3314 <i class="fas fa-camera fa-2x"></i> <span class="gallery__image-counter__number">@imagesCount</span> 3315 <span class="gallery__image-counter__text">@Translate("See all") <i class="fas fa-angle-right"></i></span> 3316 </span> 3317 </label> 3318 } 3319 else 3320 { 3321 <div class="u-hidden js-gallery" data-for="ParagraphGallery" data-image="@imagePrefix@image"></div> 3322 } 3323 3324 count++; 3325 } 3326 } 3327 3328 @Render(new ArticleGalleryModal()) 3329 } 3330 } 3331 3332 @helper RenderMobileFilters(List<Block> subBlocks) 3333 { 3334 if (subBlocks.Count > 0) 3335 { 3336 <div class="grid__col-12"> 3337 <input type="checkbox" id="CheckFilters" class="js-remember-state u-hidden" data-expand="CheckFilters" /> 3338 <div class="grid u-margin-bottom dw-mod" data-trigger="CheckFilters"> 3339 @RenderBlockList(subBlocks) 3340 </div> 3341 <label for="CheckFilters" class="btn btn--secondary btn--full dw-mod js-expand-hide" data-trigger="CheckFilters">@Translate("Select filters")</label> 3342 <label for="CheckFilters" class="btn btn--secondary btn--full dw-mod expandable--collapsed" data-trigger="CheckFilters">@Translate("Close filters")</label> 3343 </div> 3344 } 3345 } 3346 3347 3348 @* Include the Blocks for the page *@ 3349 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 3350 3351 @using System 3352 @using System.Web 3353 @using System.Collections.Generic 3354 @using Dynamicweb.Rapido.Blocks.Extensibility 3355 @using Dynamicweb.Rapido.Blocks 3356 3357 @{ 3358 BlocksPage topSnippetsBlocksPage = BlocksPage.GetBlockPage("Master"); 3359 3360 Block tagManager = new Block() 3361 { 3362 Id = "TagManager", 3363 SortId = 1, 3364 Template = RenderGoogleTagManager() 3365 }; 3366 3367 Block facebookPixel = new Block() 3368 { 3369 Id = "FacebookPixel", 3370 SortId = 2, 3371 Template = RenderFacebookPixel() 3372 }; 3373 3374 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, tagManager); 3375 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, facebookPixel); 3376 } 3377 3378 @helper RenderGoogleTagManager() { 3379 string GoogleTagManagerID = Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID"); 3380 3381 if (!string.IsNullOrWhiteSpace(GoogleTagManagerID)) 3382 { 3383 <script> 3384 (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': 3385 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], 3386 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 3387 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); 3388 })(window,document,'script','dataLayer','@GoogleTagManagerID'); 3389 </script> 3390 <!-- Google Tag Manager (noscript) --> 3391 <noscript> 3392 <iframe src="https://www.googletagmanager.com/ns.html?id=@GoogleTagManagerID" 3393 height="0" width="0" style="display:none;visibility:hidden"></iframe> 3394 </noscript> 3395 <!-- End Google Tag Manager (noscript) --> 3396 } 3397 } 3398 3399 @helper RenderFacebookPixel() { 3400 string FacebookPixelID = Model.Area.Item.GetItem("Settings").GetString("FacebookPixelID"); 3401 3402 if (!string.IsNullOrWhiteSpace(FacebookPixelID)) 3403 { 3404 <!-- Facebook Pixel Code --> 3405 <script> 3406 !function(f,b,e,v,n,t,s) 3407 {if(f.fbq)return;n=f.fbq=function(){n.callMethod? 3408 n.callMethod.apply(n,arguments):n.queue.push(arguments)}; 3409 if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0'; 3410 n.queue=[];t=b.createElement(e);t.async=!0; 3411 t.src=v;s=b.getElementsByTagName(e)[0]; 3412 s.parentNode.insertBefore(t,s)}(window, document,'script', 3413 'https://connect.facebook.net/en_US/fbevents.js'); 3414 fbq('init', '@FacebookPixelID'); 3415 fbq('track', 'PageView'); 3416 </script> 3417 <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=@FacebookPixelID&ev=PageView&noscript=1" alt="" /></noscript> 3418 } 3419 } 3420 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 3421 3422 @using System 3423 @using System.Web 3424 @using System.Collections.Generic 3425 @using Dynamicweb.Rapido.Blocks 3426 @using Dynamicweb.Rapido.Blocks.Extensibility 3427 @using Dynamicweb.Security.UserManagement 3428 @using Dynamicweb.Security.UserManagement.ExternalAuthentication 3429 @using Dynamicweb.Rapido.Blocks.Components.General 3430 3431 @{ 3432 BlocksPage loginBlocksPage = BlocksPage.GetBlockPage("Master"); 3433 3434 Block loginModal = new Block() 3435 { 3436 Id = "LoginModal", 3437 SortId = 10, 3438 Component = new Modal 3439 { 3440 Id = "SignIn", 3441 Heading = new Heading 3442 { 3443 Level = 0, 3444 Title = Translate("Sign in") 3445 }, 3446 Width = ModalWidth.Xs, 3447 BodyTemplate = RenderLoginForm() 3448 } 3449 }; 3450 3451 loginBlocksPage.Add(MasterBlockId.MasterTopSnippets, loginModal); 3452 } 3453 3454 @helper RenderLoginForm() 3455 { 3456 int pageId = Model.TopPage.ID; 3457 string userSignedInErrorText = ""; 3458 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 3459 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; 3460 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 3461 bool showModalOnStart = pageId != GetPageIdByNavigationTag("CustomerCenter") && Model.LogOnFailed; 3462 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); 3463 bool hideForgotPasswordLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideForgotPasswordLink"); 3464 3465 ProviderCollection providers = Provider.GetActiveProviders(); 3466 3467 if (Model.LogOnFailed) 3468 { 3469 switch (Model.LogOnFailedReason) 3470 { 3471 case LogOnFailedReason.PasswordLengthInvalid: 3472 userSignedInErrorText = Translate("Password length is invalid"); 3473 break; 3474 case LogOnFailedReason.IncorrectLogin: 3475 userSignedInErrorText = Translate("Invalid email or password"); 3476 break; 3477 case LogOnFailedReason.ExceededFailedLogOnLimit: 3478 userSignedInErrorText = Translate("You have exceeded the limit of allowed login attempts. The user account is temporarily locked"); 3479 break; 3480 case LogOnFailedReason.LoginLocked: 3481 userSignedInErrorText = Translate("The user account is temporarily locked"); 3482 break; 3483 case LogOnFailedReason.PasswordExpired: 3484 userSignedInErrorText = Translate("The password has expired and needs to be renewed"); 3485 break; 3486 default: 3487 userSignedInErrorText = Translate("An unknown error occured"); 3488 break; 3489 } 3490 } 3491 3492 Form form = new Form { Method = FormMethod.Post, Name = "LoginModalForm" }; 3493 3494 form.Add(new HiddenField { Name = "ID", Value = Converter.ToString(pageId) }); 3495 form.Add(new HiddenField { Name = "DWExtranetUsernameRemember", Value = "True" }); 3496 form.Add(new HiddenField { Name = "DWExtranetPasswordRemember", Value = "True" }); 3497 form.Add(new HiddenField { Name = "LoginAction", Value = "Login" }); 3498 form.Add(new TextField { Id = "LoginUsername", Name = "username", Label = Translate("Email"), CssClass = "u-full-width", Required = true }); 3499 form.Add(new TextField { Id = "LoginPassword", Name = "password", Type = TextFieldType.Password, Label = Translate("Password"), CssClass = "u-full-width", Required = true }); 3500 form.Add(new NotificationMessage { Message = userSignedInErrorText, MessageType = NotificationMessageType.Error }); 3501 form.Add(new CheckboxField { Id = "LoginRememberMe", Value = "True", Name = "Autologin", Label = Translate("Remember me") }); 3502 form.Add(new Button { ButtonType = ButtonType.Submit, Title = Translate("Sign in"), CssClass = "btn--full", OnClick = "Buttons.LockButton(event)" }); 3503 3504 foreach (Provider LoginProvider in providers) 3505 { 3506 var ProviderName = LoginProvider.Name.ToLower(); 3507 form.Add(new Link { 3508 Href = "/Admin/Public/Social/ExternalLogin.aspx?action=login&providerID=" + LoginProvider.ID, 3509 Icon = new Icon { Prefix = "fab", Name = "fa-" + ProviderName, CssClass = "fa-1_5x", LabelPosition = IconLabelPosition.After }, 3510 ButtonLayout = ButtonLayout.LinkClean, 3511 CssClass = "btn--condensed u-margin-bottom u-margin-right u-inline-block u-color-" + ProviderName, 3512 AltText = ProviderName 3513 }); 3514 } 3515 3516 if (!hideCreateAccountLink) { 3517 form.Add(new Link { Href = "/default.aspx?ID=" + createAccountPageId, Title = Translate("Create account?"), ButtonLayout = ButtonLayout.None, CssClass = "u-block u-padding-bottom" }); 3518 } 3519 3520 if (!hideForgotPasswordLink) { 3521 form.Add(new Link { Href = forgotPasswordPageLink, Title = Translate("Forgot your password?"), ButtonLayout = ButtonLayout.None, CssClass = "u-block u-padding-bottom" }); 3522 } 3523 3524 @Render(form) 3525 3526 if (showModalOnStart) 3527 { 3528 <script> 3529 document.getElementById("SignInModalTrigger").checked = true; 3530 </script> 3531 } 3532 } 3533 3534 @if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet") 3535 { 3536 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3537 3538 @using System 3539 @using System.Web 3540 @using System.Collections.Generic 3541 @using Dynamicweb.Rapido.Blocks.Extensibility 3542 @using Dynamicweb.Rapido.Blocks 3543 @using Dynamicweb.Rapido.Services 3544 3545 3546 @functions { 3547 BlocksPage mobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master"); 3548 } 3549 3550 @{ 3551 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"; 3552 bool mobileHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 3553 bool mobileHideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart") || !Dynamicweb.Rapido.Services.User.IsBuyingAllowed(); 3554 3555 Block mobileHeader = new Block() 3556 { 3557 Id = "MobileTop", 3558 SortId = 10, 3559 Template = RenderMobileTop(), 3560 SkipRenderBlocksList = true 3561 }; 3562 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeader); 3563 3564 Block mobileHeaderNavigation = new Block() 3565 { 3566 Id = "MobileHeaderNavigation", 3567 SortId = 10, 3568 Template = RenderMobileHeaderNavigation(), 3569 SkipRenderBlocksList = true, 3570 BlocksList = new List<Block> { 3571 new Block { 3572 Id = "MobileHeaderNavigationTrigger", 3573 SortId = 10, 3574 Template = RenderMobileHeaderNavigationTrigger() 3575 } 3576 } 3577 }; 3578 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderNavigation); 3579 3580 Block mobileHeaderLogo = new Block() 3581 { 3582 Id = "MobileHeaderLogo", 3583 SortId = 20, 3584 Template = RenderMobileHeaderLogo(), 3585 SkipRenderBlocksList = true 3586 }; 3587 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderLogo); 3588 3589 Block mobileHeaderActions = new Block() 3590 { 3591 Id = "MobileHeaderActions", 3592 SortId = 30, 3593 Template = RenderMobileTopActions(), 3594 SkipRenderBlocksList = true 3595 }; 3596 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderActions); 3597 3598 if (!mobileHideSearch) 3599 { 3600 Block mobileHeaderSearch = new Block 3601 { 3602 Id = "MobileHeaderSearch", 3603 SortId = 10, 3604 Template = RenderMobileTopSearch() 3605 }; 3606 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderSearch); 3607 } 3608 3609 Block mobileHeaderMiniCart; 3610 3611 if (!mobileHideCart) 3612 { 3613 mobileHeaderMiniCart = new Block 3614 { 3615 Id = "MobileHeaderMiniCart", 3616 SortId = 20, 3617 Template = RenderMobileTopMiniCart() 3618 }; 3619 3620 Block miniCartCounterScriptTemplate = new Block 3621 { 3622 Id = "MiniCartCounterScriptTemplate", 3623 Template = RenderMobileMiniCartCounterContent() 3624 }; 3625 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate); 3626 } 3627 else 3628 { 3629 mobileHeaderMiniCart = new Block 3630 { 3631 Id = "MobileHeaderMiniCart", 3632 SortId = 20 3633 }; 3634 } 3635 3636 if (!mobileHideSearch) 3637 { 3638 Block mobileHeaderSearchBar = new Block() 3639 { 3640 Id = "MobileHeaderSearchBar", 3641 SortId = 30, 3642 Template = RenderMobileTopSearchBar() 3643 }; 3644 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeaderSearchBar); 3645 } 3646 3647 switch (mobileTopLayout) 3648 { 3649 case "nav-left": 3650 mobileHeaderNavigation.SortId = 10; 3651 mobileHeaderLogo.SortId = 20; 3652 mobileHeaderActions.SortId = 30; 3653 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart); 3654 break; 3655 case "nav-right": 3656 mobileHeaderLogo.SortId = 10; 3657 mobileHeaderActions.SortId = 20; 3658 mobileHeaderNavigation.SortId = 30; 3659 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart); 3660 break; 3661 case "nav-search-left": 3662 mobileHeaderNavigation.SortId = 10; 3663 mobileHeaderLogo.SortId = 20; 3664 mobileHeaderActions.SortId = 30; 3665 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart); 3666 break; 3667 case "search-left": 3668 mobileHeaderActions.SortId = 10; 3669 mobileHeaderLogo.SortId = 20; 3670 mobileHeaderNavigation.SortId = 30; 3671 mobileHeaderMiniCart.SortId = 0; 3672 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart); 3673 break; 3674 } 3675 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed()) 3676 { 3677 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", new Block { 3678 Id = "CartInitialization", 3679 Template = RenderMobileCartInitialization() 3680 }); 3681 } 3682 } 3683 3684 3685 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3686 3687 @using System 3688 @using System.Web 3689 @using Dynamicweb.Rapido.Blocks.Extensibility 3690 @using Dynamicweb.Rapido.Blocks 3691 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 3692 @using Dynamicweb.Rapido.Blocks 3693 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 3694 @using Dynamicweb.Rapido.Blocks 3695 @{ 3696 BlocksPage customMobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master"); 3697 } 3698 3699 3700 3701 @helper RenderMobileCartInitialization() 3702 { 3703 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 3704 <script> 3705 window.cartId = "@miniCartFeedPageId"; 3706 </script> 3707 } 3708 3709 @helper RenderMobileTop() { 3710 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileTop").OrderBy(item => item.SortId).ToList(); 3711 3712 <nav class="main-navigation-mobile dw-mod"> 3713 <div class="center-container top-container__center-container dw-mod"> 3714 <div class="grid grid--align-center"> 3715 @RenderBlockList(subBlocks) 3716 </div> 3717 </div> 3718 </nav> 3719 } 3720 3721 @helper RenderMobileHeaderNavigation() { 3722 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderNavigation").OrderBy(item => item.SortId).ToList(); 3723 3724 <div class="grid__col-auto-width"> 3725 <ul class="menu dw-mod"> 3726 @RenderBlockList(subBlocks) 3727 </ul> 3728 </div> 3729 } 3730 3731 @helper RenderMobileHeaderNavigationTrigger() { 3732 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 3733 <label for="MobileNavTrigger" class="mobile-nav-trigger-button menu__link menu__link--icon menu__link--mobile dw-mod"></label> 3734 </li> 3735 } 3736 3737 @helper RenderMobileHeaderLogo() { 3738 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderLogo").OrderBy(item => item.SortId).ToList(); 3739 3740 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"; 3741 string centeredLogo = mobileTopLayout != "nav-right" ? "u-ta-center" : ""; 3742 string firstPageId = Model.Area.FirstActivePage.ID.ToString(); 3743 string businessName = Model.Area.Item.GetItem("Settings").GetString("BusinessName"); 3744 3745 string mobileLogo = "/Files/Images/logo-dynamicweb.png"; 3746 if (Model.Area.Item.GetItem("Layout").GetItem("MobileTop") != null && Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo") != null) 3747 { 3748 mobileLogo = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo").PathUrlEncoded; 3749 } 3750 3751 if (Path.GetExtension(mobileLogo).ToLower() != ".svg") 3752 { 3753 mobileLogo = "/Admin/Public/GetImage.ashx?height=40&amp;width=100&amp;crop=5&amp;Compression=75&amp;image=" + mobileLogo; 3754 } 3755 else 3756 { 3757 mobileLogo = HttpUtility.UrlDecode(mobileLogo); 3758 } 3759 3760 <div class="grid__col-auto grid__col--bleed"> 3761 <div class="grid__cell @centeredLogo"> 3762 <a href="/Default.aspx?ID=@firstPageId" class="logo logo--mobile u-inline-block dw-mod"> 3763 <img class="grid__cell-img logo__img logo__img--mobile dw-mod" src="@mobileLogo" alt="@businessName" /> 3764 </a> 3765 </div> 3766 3767 @RenderBlockList(subBlocks) 3768 </div> 3769 } 3770 3771 @helper RenderMobileTopActions() { 3772 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderActions").OrderBy(item => item.SortId).ToList(); 3773 3774 <div class="grid__col-auto-width"> 3775 <ul class="menu dw-mod"> 3776 @RenderBlockList(subBlocks) 3777 </ul> 3778 </div> 3779 } 3780 3781 @helper RenderMobileTopSearch() { 3782 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 3783 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> 3784 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> 3785 </label> 3786 </li> 3787 } 3788 3789 @helper RenderMobileTopMiniCart() { 3790 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 3791 int cartPageId = GetPageIdByNavigationTag("CartPage"); 3792 double cartProductsCount = Model.Cart.TotalProductsCount; 3793 3794 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod" id="miniCartWrapper"> 3795 <div class="mini-cart dw-mod"> 3796 <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"> 3797 <div class="u-inline u-position-relative"> 3798 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue fa-1_5x"></i> 3799 <div class="mini-cart__counter dw-mod"> 3800 <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"> 3801 <div class="js-mini-cart-counter-content" data-count="@cartProductsCount"> 3802 @cartProductsCount 3803 </div> 3804 </div> 3805 </div> 3806 </div> 3807 </a> 3808 </div> 3809 </li> 3810 } 3811 3812 @helper RenderMobileTopSearchBar() 3813 { 3814 string searchFeedId = ""; 3815 string searchSecondFeedId = ""; 3816 int groupsFeedId; 3817 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 3818 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 3819 string resultPageLink; 3820 string searchPlaceholder; 3821 string searchType = "product-search"; 3822 string searchTemplate; 3823 string searchContentTemplate = ""; 3824 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; 3825 bool showGroups = true; 3826 3827 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch") 3828 { 3829 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 3830 resultPageLink = contentSearchPageLink; 3831 searchPlaceholder = Translate("Search page"); 3832 groupsFeedId = 0; 3833 searchType = "content-search"; 3834 searchTemplate = "SearchPagesTemplate"; 3835 showGroups = false; 3836 } 3837 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch") 3838 { 3839 searchFeedId = productsPageId + "&feed=true"; 3840 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 3841 resultPageLink = Converter.ToString(productsPageId); 3842 searchPlaceholder = Translate("Search products or pages"); 3843 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 3844 searchType = "combined-search"; 3845 searchTemplate = "SearchProductsTemplateWrap"; 3846 searchContentTemplate = "SearchPagesTemplateWrap"; 3847 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 3848 } 3849 else 3850 { 3851 resultPageLink = Converter.ToString(productsPageId); 3852 searchFeedId = productsPageId + "&feed=true"; 3853 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 3854 searchPlaceholder = Translate("Search products"); 3855 searchTemplate = "SearchProductsTemplate"; 3856 searchType = "product-search"; 3857 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 3858 } 3859 3860 <input type="checkbox" id="MobileSearchTrigger" class="mobile-search-trigger" /> 3861 3862 <div class="main-navigation-mobile typeahead-mobile dw-mod"> 3863 <div class="center-container top-container__center-container dw-mod"> 3864 <div class="grid"> 3865 <div class="grid__col-auto"> 3866 <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"> 3867 <input type="text" class="js-typeahead-search-field u-w160px u-no-margin" placeholder="@searchPlaceholder" value="@searchValue"> 3868 @if (string.IsNullOrEmpty(searchSecondFeedId)) 3869 { 3870 <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> 3871 } 3872 else 3873 { 3874 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--combined-mobile grid"> 3875 <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> 3876 <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> 3877 </div> 3878 } 3879 <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> 3880 </div> 3881 </div> 3882 <div class="grid__col-auto-width"> 3883 <ul class="menu dw-mod"> 3884 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 3885 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> 3886 <i class="fas fa-times fa-1_5x"></i> 3887 </label> 3888 </li> 3889 </ul> 3890 </div> 3891 </div> 3892 </div> 3893 </div> 3894 } 3895 3896 @helper RenderMobileMiniCartCounterContent() 3897 { 3898 <script id="MiniCartCounterContent" type="text/x-template"> 3899 {{#.}} 3900 <div class="js-mini-cart-counter-content dw-mod" data-count="{{numberofproducts}}"> 3901 {{numberofproducts}} 3902 </div> 3903 {{/.}} 3904 </script> 3905 } 3906 </text> 3907 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3908 3909 @using System 3910 @using System.Web 3911 @using System.Collections.Generic 3912 @using Dynamicweb.Rapido.Blocks.Extensibility 3913 @using Dynamicweb.Rapido.Blocks 3914 3915 @functions { 3916 BlocksPage mobileNavigationBlocksPage = BlocksPage.GetBlockPage("Master"); 3917 } 3918 3919 @{ 3920 bool mobileNavigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 3921 bool mobileHideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); 3922 bool mobileHideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); 3923 bool mobileHideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); 3924 bool mobileHideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); 3925 bool mobileHideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); 3926 3927 Block mobileNavigation = new Block() 3928 { 3929 Id = "MobileNavigation", 3930 SortId = 10, 3931 Template = MobileNavigation(), 3932 SkipRenderBlocksList = true 3933 }; 3934 mobileNavigationBlocksPage.Add(MasterBlockId.MasterTopSnippets, mobileNavigation); 3935 3936 if (Model.CurrentUser.ID > 0 && !mobileHideMyProfileLink) 3937 { 3938 Block mobileNavigationSignIn = new Block 3939 { 3940 Id = "MobileNavigationSignIn", 3941 SortId = 10, 3942 Template = RenderMobileNavigationSignIn() 3943 }; 3944 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationSignIn); 3945 } 3946 3947 Block mobileNavigationMenu = new Block 3948 { 3949 Id = "MobileNavigationMenu", 3950 SortId = 20, 3951 Template = RenderMobileNavigationMenu() 3952 }; 3953 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationMenu); 3954 3955 Block mobileNavigationActions = new Block 3956 { 3957 Id = "MobileNavigationActions", 3958 SortId = 30, 3959 Template = RenderMobileNavigationActions(), 3960 SkipRenderBlocksList = true 3961 }; 3962 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationActions); 3963 3964 if (!mobileNavigationItemsHideSignIn) 3965 { 3966 if (Model.CurrentUser.ID <= 0) 3967 { 3968 Block mobileNavigationSignInAction = new Block 3969 { 3970 Id = "MobileNavigationSignInAction", 3971 SortId = 10, 3972 Template = RenderMobileNavigationSignInAction() 3973 }; 3974 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignInAction); 3975 3976 if (!mobileHideCreateAccountLink) 3977 { 3978 Block mobileNavigationCreateAccountAction = new Block 3979 { 3980 Id = "MobileNavigationCreateAccountAction", 3981 SortId = 20, 3982 Template = RenderMobileNavigationCreateAccountAction() 3983 }; 3984 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationCreateAccountAction); 3985 } 3986 } 3987 else 3988 { 3989 if (!mobileHideMyOrdersLink) 3990 { 3991 Block mobileNavigationOrdersAction = new Block 3992 { 3993 Id = "MobileNavigationOrdersAction", 3994 SortId = 20, 3995 Template = RenderMobileNavigationOrdersAction() 3996 }; 3997 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationOrdersAction); 3998 } 3999 if (!mobileHideMyFavoritesLink) 4000 { 4001 Block mobileNavigationFavoritesAction = new Block 4002 { 4003 Id = "MobileNavigationFavoritesAction", 4004 SortId = 30, 4005 Template = RenderMobileNavigationFavoritesAction() 4006 }; 4007 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationFavoritesAction); 4008 } 4009 if (!mobileHideMySavedCardsLink) 4010 { 4011 Block mobileNavigationSavedCardsAction = new Block 4012 { 4013 Id = "MobileNavigationFavoritesAction", 4014 SortId = 30, 4015 Template = RenderMobileNavigationSavedCardsAction() 4016 }; 4017 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSavedCardsAction); 4018 } 4019 4020 Block mobileNavigationSignOutAction = new Block 4021 { 4022 Id = "MobileNavigationSignOutAction", 4023 SortId = 40, 4024 Template = RenderMobileNavigationSignOutAction() 4025 }; 4026 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignOutAction); 4027 } 4028 } 4029 4030 if (Model.Languages.Count > 1) 4031 { 4032 Block mobileNavigationLanguagesAction = new Block 4033 { 4034 Id = "MobileNavigationLanguagesAction", 4035 SortId = 50, 4036 Template = RenderMobileNavigationLanguagesAction() 4037 }; 4038 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationLanguagesAction); 4039 } 4040 } 4041 4042 4043 @helper MobileNavigation() 4044 { 4045 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigation").OrderBy(item => item.SortId).ToList(); 4046 string mobileTopDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design") != null ? Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design").SelectedValue : "nav-left"; 4047 string position = mobileTopDesign == "nav-left" || mobileTopDesign == "nav-search-left" ? "left" : "right"; 4048 4049 <!-- Trigger for mobile navigation --> 4050 <input type="checkbox" id="MobileNavTrigger" class="mobile-nav-trigger mobile-nav-trigger--@position" autocomplete="off" /> 4051 4052 <!-- Mobile navigation --> 4053 <nav class="mobile-navigation mobile-navigation--@position dw-mod"> 4054 <div class="mobile-navigation__wrapper" id="mobileNavigationWrapper"> 4055 @RenderBlockList(subBlocks) 4056 </div> 4057 </nav> 4058 4059 <label class="mobile-nav-trigger-off" for="MobileNavTrigger"></label> 4060 } 4061 4062 @helper RenderMobileNavigationSignIn() 4063 { 4064 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 4065 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 4066 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 4067 string myProfilePageLink = linkStart + myProfilePageId; 4068 string userName = Model.CurrentUser.FirstName ?? ""; 4069 userName += " " + (Model.CurrentUser.LastName ?? ""); 4070 userName += userName == "" && Model.CurrentUser.UserName != null ? Model.CurrentUser.UserName : ""; 4071 4072 <ul class="menu menu-mobile"> 4073 <li class="menu-mobile__item"> 4074 <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> 4075 </li> 4076 </ul> 4077 } 4078 4079 @helper RenderMobileNavigationMenu() 4080 { 4081 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides"; 4082 string menuTemplate = isSlidesDesign ? "BaseMenuForMobileSlides.xslt" : "BaseMenuForMobileExpandable.xslt"; 4083 string levels = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels") : "3"; 4084 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 4085 int startLevel = renderPagesInToolBar ? 1 : 0; 4086 4087 @RenderNavigation(new 4088 { 4089 id = "mobilenavigation", 4090 cssclass = "menu menu-mobile dwnavigation", 4091 startLevel = @startLevel, 4092 ecomStartLevel = @startLevel + 1, 4093 endlevel = @levels, 4094 expandmode = "all", 4095 template = @menuTemplate 4096 }) 4097 4098 if (isSlidesDesign) 4099 { 4100 <script> 4101 function goToLevel(level) { 4102 document.getElementById('mobileNavigationWrapper').style.left = -(level * 100) + "%"; 4103 } 4104 4105 document.addEventListener('DOMContentLoaded', function () { 4106 goToLevel(document.getElementById('mobileNavigationWrapper').querySelectorAll('input[type=radio]:checked').length); 4107 }); 4108 </script> 4109 } 4110 4111 if (renderPagesInToolBar) 4112 { 4113 @RenderNavigation(new 4114 { 4115 id = "topToolsMobileNavigation", 4116 cssclass = "menu menu-mobile dwnavigation", 4117 template = "ToolsMenuForMobile.xslt" 4118 }) 4119 } 4120 } 4121 4122 @helper RenderMobileNavigationActions() 4123 { 4124 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigationActions").OrderBy(item => item.SortId).ToList(); ; 4125 4126 <ul class="menu menu-mobile"> 4127 @RenderBlockList(subBlocks) 4128 </ul> 4129 } 4130 4131 @helper RenderMobileNavigationSignInAction() 4132 { 4133 <li class="menu-mobile__item"> 4134 <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> 4135 </li> 4136 } 4137 4138 @helper RenderMobileNavigationCreateAccountAction() 4139 { 4140 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 4141 4142 <li class="menu-mobile__item"> 4143 <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> 4144 </li> 4145 } 4146 4147 @helper RenderMobileNavigationProfileAction() 4148 { 4149 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 4150 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 4151 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 4152 string myProfilePageLink = linkStart + myProfilePageId; 4153 4154 <li class="menu-mobile__item"> 4155 <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> 4156 </li> 4157 } 4158 4159 @helper RenderMobileNavigationOrdersAction() 4160 { 4161 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 4162 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 4163 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); 4164 string myOrdersPageLink = linkStart + myOrdersPageId; 4165 string ordersIcon = "fas fa-list"; 4166 4167 <li class="menu-mobile__item"> 4168 <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> 4169 </li> 4170 } 4171 4172 @helper RenderMobileNavigationFavoritesAction() 4173 { 4174 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 4175 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 4176 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 4177 string myFavoritesPageLink = linkStart + myFavoritesPageId; 4178 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"; 4179 4180 4181 <li class="menu-mobile__item"> 4182 <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> 4183 </li> 4184 } 4185 4186 @helper RenderMobileNavigationSavedCardsAction() 4187 { 4188 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 4189 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 4190 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards"); 4191 string mySavedCardsPageLink = linkStart + mySavedCardsPageId; 4192 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"; 4193 4194 <li class="menu-mobile__item"> 4195 <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> 4196 </li> 4197 } 4198 4199 @helper RenderMobileNavigationSignOutAction() 4200 { 4201 int pageId = Model.TopPage.ID; 4202 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"; 4203 4204 <li class="menu-mobile__item"> 4205 <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> 4206 </li> 4207 } 4208 4209 @helper RenderMobileNavigationLanguagesAction() 4210 { 4211 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides"; 4212 4213 string selectedLanguage = ""; 4214 foreach (var lang in Model.Languages) 4215 { 4216 if (lang.IsCurrent) 4217 { 4218 selectedLanguage = lang.Name; 4219 } 4220 } 4221 4222 <li class="menu-mobile__item dw-mod"> 4223 @if (isSlidesDesign) 4224 { 4225 <input id="MobileMenuCheck_Language" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(1);"> 4226 } 4227 else 4228 { 4229 <input id="MobileMenuCheck_Language" type="checkbox" class="expand-trigger"> 4230 } 4231 <div class="menu-mobile__link__wrap"> 4232 <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> 4233 <label for="MobileMenuCheck_Language" class="menu-mobile__trigger"></label> 4234 </div> 4235 <ul class="menu-mobile menu-mobile__submenu expand-menu"> 4236 @if (isSlidesDesign) 4237 { 4238 <li class="menu-mobile__item dw-mod"> 4239 <div class="menu-mobile__link__wrap"> 4240 <input id="MobileMenuCheck_Language_back" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(0);" /> 4241 <label for="MobileMenuCheck_Language_back" class="menu-mobile__trigger menu-mobile__trigger--back"></label> 4242 <label for="MobileMenuCheck_Language_back" class="menu-mobile__link dw-mod ">@Translate("Back")</label> 4243 </div> 4244 </li> 4245 } 4246 @foreach (var lang in Model.Languages) 4247 { 4248 <li class="menu-mobile__item dw-mod"> 4249 <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> 4250 </li> 4251 } 4252 </ul> 4253 </li> 4254 }</text> 4255 } 4256 else 4257 { 4258 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4259 4260 @using System 4261 @using System.Web 4262 @using System.Collections.Generic 4263 @using Dynamicweb.Rapido.Blocks.Extensibility 4264 @using Dynamicweb.Rapido.Blocks 4265 4266 @functions { 4267 BlocksPage headerBlocksPage = BlocksPage.GetBlockPage("Master"); 4268 } 4269 4270 @{ 4271 Block masterTools = new Block() 4272 { 4273 Id = "MasterDesktopTools", 4274 SortId = 10, 4275 Template = RenderDesktopTools(), 4276 SkipRenderBlocksList = true, 4277 BlocksList = new List<Block> 4278 { 4279 new Block { 4280 Id = "MasterDesktopToolsText", 4281 SortId = 10, 4282 Template = RenderDesktopToolsText(), 4283 Design = new Design 4284 { 4285 Size = "auto", 4286 HidePadding = true, 4287 RenderType = RenderType.Column 4288 } 4289 }, 4290 new Block { 4291 Id = "MasterDesktopToolsNavigation", 4292 SortId = 20, 4293 Template = RenderDesktopToolsNavigation(), 4294 Design = new Design 4295 { 4296 Size = "auto-width", 4297 HidePadding = true, 4298 RenderType = RenderType.Column 4299 } 4300 } 4301 } 4302 }; 4303 headerBlocksPage.Add("MasterHeader", masterTools); 4304 4305 Block masterDesktopExtra = new Block() 4306 { 4307 Id = "MasterDesktopExtra", 4308 SortId = 10, 4309 Template = RenderDesktopExtra(), 4310 SkipRenderBlocksList = true 4311 }; 4312 headerBlocksPage.Add("MasterHeader", masterDesktopExtra); 4313 4314 Block masterDesktopNavigation = new Block() 4315 { 4316 Id = "MasterDesktopNavigation", 4317 SortId = 20, 4318 Template = RenderDesktopNavigation(), 4319 SkipRenderBlocksList = true 4320 }; 4321 headerBlocksPage.Add("MasterHeader", masterDesktopNavigation); 4322 } 4323 4324 @* Include the Blocks for the page *@ 4325 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4326 4327 @using System 4328 @using System.Web 4329 @using Dynamicweb.Rapido.Blocks.Extensibility 4330 @using Dynamicweb.Rapido.Blocks 4331 4332 @{ 4333 Block masterDesktopLogo = new Block 4334 { 4335 Id = "MasterDesktopLogo", 4336 SortId = 10, 4337 Template = RenderDesktopLogo(), 4338 Design = new Design 4339 { 4340 Size = "auto-width", 4341 HidePadding = true, 4342 RenderType = RenderType.Column, 4343 CssClass = "grid--align-self-center" 4344 } 4345 }; 4346 4347 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopLogo); 4348 } 4349 4350 4351 @helper RenderDesktopLogo() 4352 { 4353 string firstPageId = Model.Area.FirstActivePage.ID.ToString(); 4354 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4355 string alignClass = topLayout == "two-lines-centered" || topLayout == "two-lines" ? "grid--align-self-center" : ""; 4356 string logo = Model.Area.Item.GetItem("Layout").GetFile("LogoImage") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoImage").PathUrlEncoded : "/Files/Images/logo-dynamicweb.png"; 4357 if (Path.GetExtension(logo).ToLower() != ".svg") 4358 { 4359 int logoHeight = Model.Area.Item.GetItem("Layout").GetInt32("LogoHeight"); 4360 logoHeight = logoHeight > 0 && Pageview.Device.ToString() != "Mobile" ? logoHeight : 40; 4361 logo = "/Admin/Public/GetImage.ashx?height=" + Converter.ToString(logoHeight) + "&amp;crop=5&amp;Compression=75&amp;image=" + logo; 4362 } 4363 else 4364 { 4365 logo = HttpUtility.UrlDecode(logo); 4366 } 4367 4368 <div class="logo @alignClass dw-mod"> 4369 <a href="/Default.aspx?ID=@firstPageId" class="logo__img dw-mod u-block"> 4370 <img class="grid__cell-img logo__img dw-mod" src="@logo" alt="@Translate("Logo")" /> 4371 </a> 4372 </div> 4373 } 4374 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4375 4376 @using System 4377 @using System.Web 4378 @using Dynamicweb.Rapido.Blocks.Extensibility 4379 @using Dynamicweb.Rapido.Blocks 4380 4381 @functions { 4382 bool isMegaMenu; 4383 } 4384 4385 @{ 4386 isMegaMenu = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu") != null ? Converter.ToBoolean(Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu").SelectedValue) : false; 4387 Block masterDesktopMenu = new Block 4388 { 4389 Id = "MasterDesktopMenu", 4390 SortId = 10, 4391 Template = RenderDesktopMenu(), 4392 Design = new Design 4393 { 4394 Size = "auto", 4395 HidePadding = true, 4396 RenderType = RenderType.Column 4397 } 4398 }; 4399 4400 if (isMegaMenu) 4401 { 4402 masterDesktopMenu.Design.CssClass = "u-reset-position"; 4403 } 4404 4405 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopMenu); 4406 } 4407 4408 @helper RenderDesktopMenu() 4409 { 4410 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4411 string menuAlignment = topLayout == "minimal-right" ? "grid--align-self-end" : ""; 4412 string megamenuPromotionImage = Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage").PathUrlEncoded : ""; 4413 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 4414 bool showOnlyHeaders = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowOnlyHeaders"); 4415 int startLevel = renderPagesInToolBar ? 1 : 0; 4416 4417 string promotionLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("MegamenuPromotionLink"); 4418 4419 <div class="grid__cell u-flex @(isMegaMenu ? "u-reset-position" : "") @menuAlignment"> 4420 @if (!isMegaMenu) 4421 { 4422 @RenderNavigation(new 4423 { 4424 id = "topnavigation", 4425 cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap", 4426 startLevel = startLevel, 4427 ecomStartLevel = startLevel + 1, 4428 endlevel = 5, 4429 expandmode = "all", 4430 template = "BaseMenuWithDropdown.xslt" 4431 }); 4432 } 4433 else 4434 { 4435 @RenderNavigation(new 4436 { 4437 id = "topnavigation", 4438 cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap", 4439 startLevel = startLevel, 4440 ecomStartLevel = startLevel + 1, 4441 endlevel = 5, 4442 promotionImage = megamenuPromotionImage, 4443 promotionLink = promotionLink, 4444 expandmode = "all", 4445 showOnlyHeaders = showOnlyHeaders.ToString().ToLower(), 4446 template = "BaseMegaMenu.xslt" 4447 }); 4448 } 4449 </div> 4450 } 4451 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4452 4453 @using System 4454 @using System.Web 4455 @using Dynamicweb.Rapido.Blocks.Extensibility 4456 @using Dynamicweb.Rapido.Blocks 4457 4458 @{ 4459 Block masterDesktopActionsMenu = new Block 4460 { 4461 Id = "MasterDesktopActionsMenu", 4462 SortId = 10, 4463 Template = RenderDesktopActionsMenu(), 4464 Design = new Design 4465 { 4466 CssClass = "u-flex" 4467 }, 4468 SkipRenderBlocksList = true 4469 4470 }; 4471 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopActionsMenu); 4472 4473 if (!string.IsNullOrWhiteSpace(Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink"))) 4474 { 4475 Block masterDesktopActionsHeaderButton = new Block 4476 { 4477 Id = "MasterDesktopActionsHeaderButton", 4478 SortId = 60, 4479 Template = RenderHeaderButton() 4480 }; 4481 masterDesktopActionsMenu.Add(masterDesktopActionsHeaderButton); 4482 } 4483 } 4484 4485 @helper RenderDesktopActionsMenu() 4486 { 4487 List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopActionsMenu").OrderBy(item => item.SortId).ToList(); 4488 4489 <ul class="menu u-flex dw-mod"> 4490 @RenderBlockList(subBlocks) 4491 </ul> 4492 } 4493 4494 @helper RenderHeaderButton() 4495 { 4496 string headerButtonText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonText"); 4497 string headerButtonLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink"); 4498 string headerButtonType = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType") != null ? "btn--" + Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType").SelectedName.ToLower() : ""; 4499 4500 <li class="menu__item menu__item--horizontal menu--clean dw-mod"> 4501 <a class="btn @headerButtonType dw-mod u-no-margin u-margin-top u-margin-left" href="@headerButtonLink">@headerButtonText</a> 4502 </li> 4503 } 4504 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4505 4506 @using System 4507 @using System.Web 4508 @using Dynamicweb.Core; 4509 @using System.Text.RegularExpressions 4510 @using Dynamicweb.Rapido.Blocks.Extensibility 4511 @using Dynamicweb.Rapido.Blocks 4512 4513 @{ 4514 Block masterDesktopActionsMenuLanguageSelector = new Block 4515 { 4516 Id = "MasterDesktopActionsMenuLanguageSelector", 4517 SortId = 40, 4518 Template = RenderLanguageSelector() 4519 }; 4520 4521 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuLanguageSelector); 4522 } 4523 4524 @helper RenderLanguageSelector() 4525 { 4526 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4527 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 4528 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4529 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() : ""; 4530 4531 if (Model.Languages.Count > 1) 4532 { 4533 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon is-dropdown is-dropdown--no-icon dw-mod"> 4534 <div class="@menuLinkClass dw-mod" title="@Translate("Language")"> 4535 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue fa-1_5x"></i> 4536 </div> 4537 <div class="menu menu--dropdown menu--dropdown-right languages-dropdown dw-mod grid__cell"> 4538 @foreach (var lang in Model.Languages) 4539 { 4540 string widthClass = "menu__item--fixed-width"; 4541 string langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " u-margin-right\"></span>" + lang.Name; 4542 string cultureName = Regex.Replace(Dynamicweb.Services.Areas.GetArea(lang.ID).CultureInfo.NativeName, @" ?\(.*?\)", string.Empty); 4543 cultureName = char.ToUpper(cultureName[0]) + cultureName.Substring(1); 4544 4545 if (languageViewType == "flag-culture") 4546 { 4547 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span> " + cultureName; 4548 } 4549 4550 if (languageViewType == "flag") 4551 { 4552 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span>"; 4553 widthClass = ""; 4554 } 4555 4556 if (languageViewType == "name") 4557 { 4558 langInfo = lang.Name; 4559 } 4560 4561 if (languageViewType == "culture") 4562 { 4563 langInfo = cultureName; 4564 widthClass = ""; 4565 } 4566 4567 <div class="menu__item dw-mod @widthClass"> 4568 <a href="/Default.aspx?AreaID=@Dynamicweb.Services.Pages.GetPage(lang.Page.ID).Area.ID" class="menu-dropdown__link dw-mod">@langInfo</a> 4569 </div> 4570 } 4571 </div> 4572 </li> 4573 } 4574 } 4575 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4576 4577 @using System 4578 @using System.Web 4579 @using Dynamicweb.Rapido.Blocks.Extensibility 4580 @using Dynamicweb.Rapido.Blocks 4581 4582 @{ 4583 Block masterDesktopActionsMenuSignIn = new Block 4584 { 4585 Id = "MasterDesktopActionsMenuSignIn", 4586 SortId = 20, 4587 Template = RenderSignIn() 4588 }; 4589 4590 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuSignIn); 4591 } 4592 4593 @helper RenderSignIn() 4594 { 4595 bool navigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 4596 string userInitials = ""; 4597 int pageId = Model.TopPage.ID; 4598 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 4599 int myDashboardPageId = GetPageIdByNavigationTag("CustomerDashboard"); 4600 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 4601 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); 4602 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 4603 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards"); 4604 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 4605 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); 4606 bool hideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); 4607 bool hideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); 4608 bool hideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); 4609 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); 4610 bool hideForgotPasswordLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideForgotPasswordLink"); 4611 4612 string linkStart = "/Default.aspx?ID="; 4613 if (Model.CurrentUser.ID <= 0) 4614 { 4615 linkStart += signInProfilePageId + "&RedirectPageId="; 4616 } 4617 4618 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; 4619 string myProfilePageLink = linkStart + myProfilePageId; 4620 string myOrdersPageLink = linkStart + myOrdersPageId; 4621 string myFavoritesPageLink = linkStart + myFavoritesPageId; 4622 string mySavedCardsPageLink = linkStart + mySavedCardsPageId; 4623 4624 string profileIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue : "fa fa-user"; 4625 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"; 4626 4627 if (Model.CurrentUser.ID != 0) 4628 { 4629 userInitials = Dynamicweb.Rapido.Services.User.GetInitials(Model.CurrentUser.Name, Model.CurrentUser.FirstName, Model.CurrentUser.LastName, Model.CurrentUser.Email, Model.CurrentUser.UserName); 4630 } 4631 4632 if (!navigationItemsHideSignIn) 4633 { 4634 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4635 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu__item--clean"; 4636 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4637 4638 <li class="menu__item menu__item--horizontal menu__item menu__item--icon @liClasses is-dropdown is-dropdown--no-icon dw-mod"> 4639 <div class="@menuLinkClass dw-mod"> 4640 @if (Model.CurrentUser.ID <= 0) 4641 { 4642 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue fa-1_5x" title="@Translate("Sign in")"></i> 4643 } 4644 else 4645 { 4646 <a href="/default.aspx?ID=@myDashboardPageId" class="u-color-inherit" title="@Translate("Customer center")"><div class="circle-icon-btn">@userInitials.ToUpper()</div></a> 4647 } 4648 </div> 4649 <div class="menu menu--dropdown menu--dropdown-right menu--sign-in grid__cell dw-mod"> 4650 <ul class="list list--clean dw-mod"> 4651 @if (Model.CurrentUser.ID <= 0) 4652 { 4653 <li> 4654 <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> 4655 </li> 4656 4657 if (!hideCreateAccountLink) 4658 { 4659 @RenderListItem("/default.aspx?ID=" + createAccountPageId, Translate("Create account")); 4660 } 4661 if (!hideForgotPasswordLink) 4662 { 4663 @RenderListItem(forgotPasswordPageLink, Translate("Forgot your password?")) 4664 } 4665 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) 4666 { 4667 @RenderSeparator() 4668 } 4669 } 4670 @if (!hideMyProfileLink) 4671 { 4672 @RenderListItem(myProfilePageLink, Translate("My Profile"), profileIcon) 4673 } 4674 @if (!hideMyOrdersLink) 4675 { 4676 @RenderListItem(myOrdersPageLink, Translate("My Orders"), "fas fa-list") 4677 } 4678 @if (!hideMyFavoritesLink) 4679 { 4680 @RenderListItem(myFavoritesPageLink, Translate("My Favorites"), favoritesIcon) 4681 } 4682 @if (!hideMySavedCardsLink) 4683 { 4684 @RenderListItem(mySavedCardsPageLink, Translate("My Saved cards"), "fas fa-credit-card") 4685 } 4686 @if (Model.CurrentUser.ID > 0) 4687 { 4688 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) 4689 { 4690 @RenderSeparator() 4691 } 4692 4693 @RenderListItem("/Admin/Public/ExtranetLogoff.aspx?ID=" + pageId, Translate("Sign out")) 4694 } 4695 </ul> 4696 </div> 4697 </li> 4698 } 4699 } 4700 4701 @helper RenderListItem(string link, string text, string icon = null) { 4702 <li> 4703 <a href="@link" class="list__link dw-mod"> 4704 @if (!string.IsNullOrEmpty(icon)){<i class="@icon u-margin-right"></i>}@text 4705 </a> 4706 </li> 4707 } 4708 4709 @helper RenderSeparator() 4710 { 4711 <li class="list__seperator dw-mod"></li> 4712 } 4713 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4714 4715 @using System 4716 @using System.Web 4717 @using Dynamicweb.Rapido.Blocks.Extensibility 4718 @using Dynamicweb.Rapido.Blocks 4719 4720 @{ 4721 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideFavorites"); 4722 4723 Block masterDesktopActionsMenuFavorites = new Block 4724 { 4725 Id = "MasterDesktopActionsMenuFavorites", 4726 SortId = 30, 4727 Template = RenderFavorites() 4728 }; 4729 4730 if (!hideMyFavoritesLink && Model.CurrentUser.ID > 0) 4731 { 4732 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuFavorites); 4733 } 4734 } 4735 4736 @helper RenderFavorites() 4737 { 4738 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 4739 string myFavoritesPageLink = "/Default.aspx?ID=" + myFavoritesPageId; 4740 4741 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4742 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 4743 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4744 4745 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod"> 4746 <a href="@myFavoritesPageLink" class="@menuLinkClass dw-mod" title="@Translate("Favorites")"> 4747 <i class="fas fa-@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue fa-1_5x"></i> 4748 </a> 4749 </li> 4750 } 4751 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4752 4753 @using System 4754 @using System.Web 4755 @using Dynamicweb.Rapido.Blocks.Extensibility 4756 @using Dynamicweb.Rapido.Blocks 4757 @using Dynamicweb.Rapido.Services 4758 4759 @{ 4760 bool hideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 4761 string miniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown"; 4762 4763 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed() && !hideCart) 4764 { 4765 Block masterDesktopActionsMenuMiniCart = new Block 4766 { 4767 Id = "MasterDesktopActionsMenuMiniCart", 4768 SortId = 50, 4769 Template = RenderMiniCart(miniCartLayout == "dropdown"), 4770 SkipRenderBlocksList = true, 4771 BlocksList = new List<Block>() 4772 }; 4773 4774 Block miniCartCounterScriptTemplate = new Block 4775 { 4776 Id = "MiniCartCounterScriptTemplate", 4777 Template = RenderMiniCartCounterContent() 4778 }; 4779 4780 //dropdown layout is default 4781 RazorEngine.Templating.TemplateWriter layoutTemplate; 4782 RazorEngine.Templating.TemplateWriter miniCartTriggerTemplate; 4783 4784 switch (miniCartLayout) 4785 { 4786 case "dropdown": 4787 layoutTemplate = RenderMiniCartDropdownLayout(); 4788 miniCartTriggerTemplate = RenderMiniCartTriggerLink(); 4789 break; 4790 case "panel": 4791 layoutTemplate = RenderMiniCartPanelLayout(); 4792 miniCartTriggerTemplate = RenderMiniCartTriggerLabel(); 4793 break; 4794 case "modal": 4795 layoutTemplate = RenderMiniCartModalLayout(); 4796 miniCartTriggerTemplate = RenderMiniCartTriggerLabel(); 4797 break; 4798 case "none": 4799 default: 4800 layoutTemplate = RenderNoLayoutMiniCart(); 4801 miniCartTriggerTemplate = RenderMiniCartTriggerLink(); 4802 break; 4803 } 4804 4805 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block 4806 { 4807 Id = "MiniCartTrigger", 4808 Template = miniCartTriggerTemplate 4809 }); 4810 4811 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 4812 { 4813 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block 4814 { 4815 Id = "MiniCartLayout", 4816 Template = layoutTemplate 4817 }); 4818 } 4819 4820 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuMiniCart); 4821 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate); 4822 } 4823 4824 if (hideCart && Dynamicweb.Rapido.Services.User.IsBuyingAllowed()) 4825 { 4826 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", new Block { 4827 Id = "CartInitialization", 4828 Template = RenderNoLayoutMiniCart() 4829 }); 4830 } 4831 } 4832 4833 @helper RenderMiniCart(bool hasMouseEnterEvent) 4834 { 4835 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterDesktopActionsMenuMiniCart").OrderBy(item => item.SortId).ToList(); 4836 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4837 string liClasses = topLayout != "normal" ? "menu__item--top-level" : "menu--clean"; 4838 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4839 string mouseEvent = ""; 4840 string id = "MiniCart"; 4841 if (hasMouseEnterEvent) 4842 { 4843 mouseEvent = "onmouseenter=\"Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=" + miniCartFeedPageId + "&feedType=MiniCart')\""; 4844 id = "miniCartTrigger"; 4845 } 4846 <li class="menu__item menu__item--horizontal menu__item--icon @liClasses dw-mod" id="@id" @mouseEvent> 4847 @RenderBlockList(subBlocks) 4848 </li> 4849 } 4850 4851 @helper RenderNoLayoutMiniCart() 4852 { 4853 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4854 <script> 4855 window.cartId = "@miniCartFeedPageId"; 4856 </script> 4857 } 4858 4859 @helper RenderMiniCartTriggerLabel() 4860 { 4861 int cartPageId = GetPageIdByNavigationTag("CartPage"); 4862 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart"; 4863 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4864 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4865 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4866 4867 <div class="@menuLinkClass dw-mod js-mini-cart-button" onclick="Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart')"> 4868 <div class="u-inline u-position-relative" title="@Translate("Cart")"> 4869 <i class="@cartIcon fa-1_5x"></i> 4870 @RenderMiniCartCounter() 4871 </div> 4872 </div> 4873 } 4874 4875 @helper RenderMiniCartTriggerLink() 4876 { 4877 int cartPageId = GetPageIdByNavigationTag("CartPage"); 4878 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart"; 4879 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4880 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4881 4882 <a href="/Default.aspx?ID=@cartPageId&Purge=True" class="@menuLinkClass menu__item--icon dw-mod js-mini-cart-button"> 4883 <div class="u-inline u-position-relative" title="@Translate("Cart")"> 4884 <i class="@cartIcon fa-1_5x"></i> 4885 @RenderMiniCartCounter() 4886 </div> 4887 </a> 4888 } 4889 4890 @helper RenderMiniCartCounter() 4891 { 4892 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4893 string cartProductsCount = Model.Cart.TotalProductsCount.ToString(); 4894 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right"; 4895 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 4896 string cartProductsTotalPrice = showPrice && Model.Cart.TotalPrice != null ? Model.Cart.TotalPrice.Price.Formatted : ""; 4897 cartProductsTotalPrice = counterPosition == "right" ? cartProductsTotalPrice : ""; 4898 4899 if (showPrice && counterPosition == "right") 4900 { 4901 cartProductsCount = Translate("Cart") + "(" + cartProductsCount + ")"; 4902 } 4903 4904 <div class="mini-cart__counter @(counterPosition == "right" ? "mini-cart__counter--inline" : "") dw-mod"> 4905 <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"> 4906 <div class="js-mini-cart-counter-content" data-count="@Model.Cart.TotalProductsCount.ToString()"> 4907 @cartProductsCount 4908 @cartProductsTotalPrice 4909 </div> 4910 </div> 4911 </div> 4912 } 4913 4914 @helper RenderMiniCartCounterContent() 4915 { 4916 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 4917 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right"; 4918 bool showPriceInMiniCartCounter = Pageview.Device.ToString() != "Mobile" && counterPosition == "right" && showPrice; 4919 4920 <script id="MiniCartCounterContent" type="text/x-template"> 4921 {{#.}} 4922 <div class="js-mini-cart-counter-content dw-mod" data-count="{{numberofproducts}}"> 4923 @if (showPriceInMiniCartCounter) 4924 { 4925 @Translate("Cart")<text>({{numberofproducts}}) {{totalprice}}</text> 4926 } 4927 else 4928 { 4929 <text>{{numberofproducts}}</text> 4930 } 4931 </div> 4932 {{/.}} 4933 </script> 4934 } 4935 4936 @helper RenderMiniCartDropdownLayout() 4937 { 4938 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4939 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage"); 4940 4941 <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"> 4942 <div class="mini-cart-dropdown__inner dw-mod"> 4943 <h3 class="u-ta-center dw-mod">@Translate("Shopping cart")</h3> 4944 <div class="mini-cart-dropdown__body u-flex dw-mod"> 4945 <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> 4946 </div> 4947 </div> 4948 </div> 4949 } 4950 4951 @helper RenderMiniCartPanelLayout() 4952 { 4953 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4954 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage"); 4955 4956 <div class="mini-cart grid__cell dw-mod"> 4957 <input type="checkbox" id="miniCartTrigger" class="panel-trigger" /> 4958 <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"> 4959 <label for="miniCartTrigger" class="panel__close-btn" title="@Translate("Close panel")"><i class="fas fa-times"></i></label> 4960 <div class="panel__content u-full-width dw-mod"> 4961 <h3 class="panel__header dw-mod u-margin-bottom u-ta-center">@Translate("Shopping cart")</h3> 4962 <div class="panel__content-body panel__content-body--cart dw-mod"> 4963 <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> 4964 </div> 4965 </div> 4966 </div> 4967 </div> 4968 } 4969 4970 @helper RenderMiniCartModalLayout() 4971 { 4972 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4973 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage"); 4974 4975 <div class="mini-cart grid__cell dw-mod"> 4976 <input type="checkbox" id="miniCartTrigger" class="modal-trigger" autocomplete="off" /> 4977 <div class="modal-container dw-mod js-mini-cart" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="block" data-cart-page-link="@cartPageLink"> 4978 <label for="miniCartTrigger" class="modal-overlay"></label> 4979 <div class="modal modal--md modal--top-right dw-mod"> 4980 <div class="modal__body u-flex grid--direction-column dw-mod"> 4981 <h3 class="dw-mod u-ta-center">@Translate("Shopping cart")</h3> 4982 <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> 4983 </div> 4984 <label class="modal__close-btn modal__close-btn--clean dw-mod" for="miniCartTrigger" title="@Translate("Close modal")"></label> 4985 </div> 4986 </div> 4987 </div> 4988 } 4989 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4990 4991 @using System 4992 @using System.Web 4993 @using Dynamicweb.Rapido.Blocks.Extensibility 4994 @using Dynamicweb.Rapido.Blocks 4995 4996 @{ 4997 bool showDownloadCartLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart"); 4998 4999 Block masterDesktopActionsMenuDownloadCart = new Block 5000 { 5001 Id = "MasterDesktopActionsMenuDownloadCart", 5002 SortId = 35, 5003 Template = RenderDownloadCart() 5004 }; 5005 5006 if (showDownloadCartLink && Model.CurrentUser.ID > 0) 5007 { 5008 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuDownloadCart); 5009 } 5010 } 5011 5012 @helper RenderDownloadCart() 5013 { 5014 int downloadCartPageId = GetPageIdByNavigationTag("DownloadCart"); 5015 string downloadCartPageLink = "/Default.aspx?ID=" + downloadCartPageId; 5016 5017 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5018 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 5019 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 5020 5021 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod"> 5022 <a href="@downloadCartPageLink" class="@menuLinkClass dw-mod" title="@Translate("Download cart")"> 5023 <i class="fas fa-cart-arrow-down fa-1_5x"></i> 5024 </a> 5025 </li> 5026 } 5027 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5028 5029 @using System 5030 @using System.Web 5031 @using Dynamicweb.Rapido.Blocks.Extensibility 5032 @using Dynamicweb.Rapido.Blocks 5033 5034 @functions { 5035 public class SearchConfiguration 5036 { 5037 public string searchFeedId { get; set; } 5038 public string searchSecondFeedId { get; set; } 5039 public int groupsFeedId { get; set; } 5040 public string resultPageLink { get; set; } 5041 public string searchPlaceholder { get; set; } 5042 public string searchType { get; set; } 5043 public string searchTemplate { get; set; } 5044 public string searchContentTemplate { get; set; } 5045 public string searchValue { get; set; } 5046 public bool showGroups { get; set; } 5047 5048 public SearchConfiguration() 5049 { 5050 searchFeedId = ""; 5051 searchSecondFeedId = ""; 5052 searchType = "product-search"; 5053 searchContentTemplate = ""; 5054 showGroups = true; 5055 } 5056 } 5057 } 5058 @{ 5059 Block masterSearchBar = new Block 5060 { 5061 Id = "MasterSearchBar", 5062 SortId = 40, 5063 Template = RenderSearch("bar"), 5064 Design = new Design 5065 { 5066 Size = "auto", 5067 HidePadding = true, 5068 RenderType = RenderType.Column 5069 } 5070 }; 5071 5072 Block masterSearchAction = new Block 5073 { 5074 Id = "MasterDesktopActionsMenuSearch", 5075 SortId = 10, 5076 Template = RenderSearch() 5077 }; 5078 5079 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterSearchBar); 5080 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterSearchAction); 5081 } 5082 5083 @helper RenderSearch(string type = "mini-search") 5084 { 5085 string productsPageId = Converter.ToString(GetPageIdByNavigationTag("ProductsPage")); 5086 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 5087 string searchType = Model.Area.Item.GetItem("Layout").GetList("TopSearch") != null ? Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue : "productSearch"; 5088 5089 SearchConfiguration searchConfiguration = null; 5090 5091 switch (searchType) { 5092 case "contentSearch": 5093 searchConfiguration = new SearchConfiguration() { 5094 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true", 5095 resultPageLink = contentSearchPageLink, 5096 searchPlaceholder = Translate("Search page"), 5097 groupsFeedId = 0, 5098 searchType = "content-search", 5099 searchTemplate = "SearchPagesTemplate", 5100 showGroups = false 5101 }; 5102 break; 5103 case "combinedSearch": 5104 searchConfiguration = new SearchConfiguration() { 5105 searchFeedId = productsPageId + "&feed=true", 5106 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true", 5107 resultPageLink = Converter.ToString(productsPageId), 5108 searchPlaceholder = Translate("Search products or pages"), 5109 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"), 5110 searchType = "combined-search", 5111 searchTemplate = "SearchProductsTemplateWrap", 5112 searchContentTemplate = "SearchPagesTemplateWrap", 5113 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector") 5114 }; 5115 break; 5116 default: //productSearch 5117 searchConfiguration = new SearchConfiguration() { 5118 resultPageLink = Converter.ToString(productsPageId), 5119 searchFeedId = productsPageId + "&feed=true", 5120 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"), 5121 searchPlaceholder = Translate("Search products"), 5122 searchTemplate = "SearchProductsTemplate", 5123 searchType = "product-search", 5124 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector") 5125 }; 5126 break; 5127 } 5128 searchConfiguration.searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; 5129 5130 if (type == "mini-search") { 5131 @RenderMiniSearch(searchConfiguration) 5132 } else { 5133 @RenderSearchBar(searchConfiguration) 5134 } 5135 } 5136 5137 @helper RenderSearchBar(SearchConfiguration options) 5138 { 5139 bool isLiveProductInfoActive = Dynamicweb.Core.Converter.ToBoolean(Pageview.GlobalTags.GetTagByName("Global:LiveIntegration.IsLazyLoadingForProductInfoEnabled")?.Value ?? string.Empty); 5140 5141 <div class="typeahead typeahead--centered u-color-inherit js-typeahead dw-mod" id="ProductSearchBar" 5142 data-page-size="7" 5143 data-search-feed-id="@options.searchFeedId" 5144 data-search-second-feed-id="@options.searchSecondFeedId" 5145 data-result-page-id="@options.resultPageLink" 5146 data-groups-page-id="@options.groupsFeedId" 5147 data-search-type="@options.searchType" 5148 data-live-price="@(isLiveProductInfoActive.ToString().ToLowerInvariant())"> 5149 @if (options.showGroups) 5150 { 5151 <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> 5152 <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> 5153 } 5154 <div class="typeahead-search-field"> 5155 <input type="text" class="u-no-margin u-full-width u-full-height js-typeahead-search-field" placeholder="@options.searchPlaceholder" value="@options.searchValue"> 5156 @if (string.IsNullOrEmpty(options.searchSecondFeedId)) 5157 { 5158 <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> 5159 } 5160 else 5161 { 5162 <div class="dropdown dropdown--absolute-position dropdown--combined grid"> 5163 <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> 5164 <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> 5165 </div> 5166 } 5167 </div> 5168 <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> 5169 </div> 5170 } 5171 5172 @helper RenderMiniSearch(SearchConfiguration options) 5173 { 5174 bool isLiveProductInfoActive = Dynamicweb.Core.Converter.ToBoolean(Pageview.GlobalTags.GetTagByName("Global:LiveIntegration.IsLazyLoadingForProductInfoEnabled")?.Value ?? string.Empty); 5175 5176 <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"> 5177 <div class="menu__link menu__link--icon dw-mod" title="@Translate("Search")"> 5178 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> 5179 </div> 5180 <div class="menu menu--dropdown menu--dropdown-right u-no-padding u-w380px grid__cell dw-mod"> 5181 <div class="typeahead js-typeahead" id="ProductSearchBar" 5182 data-page-size="7" 5183 data-search-feed-id="@options.searchFeedId" 5184 data-search-second-feed-id="@options.searchSecondFeedId" 5185 data-result-page-id="@options.resultPageLink" 5186 data-search-type="@options.searchType" 5187 data-live-price="@(isLiveProductInfoActive.ToString().ToLowerInvariant())"> 5188 <div class="typeahead-search-field"> 5189 <input type="text" class="u-no-margin u-full-width js-typeahead-search-field" id="headerSearch" placeholder="@options.searchPlaceholder" value="@options.searchValue"> 5190 @if (string.IsNullOrEmpty(options.searchSecondFeedId)) 5191 { 5192 <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> 5193 } 5194 else 5195 { 5196 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--right-aligned"> 5197 <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> 5198 <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> 5199 </div> 5200 } 5201 </div> 5202 </div> 5203 </div> 5204 </li> 5205 } 5206 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5207 5208 @using System 5209 @using System.Web 5210 @using Dynamicweb.Rapido.Blocks.Extensibility 5211 @using Dynamicweb.Rapido.Blocks 5212 5213 @{ 5214 string headerConfigurationTopLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5215 bool headerConfigurationHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 5216 5217 BlocksPage headerConfigurationPage = BlocksPage.GetBlockPage("Master"); 5218 5219 Block configDesktopLogo = headerConfigurationPage.GetBlockById("MasterDesktopLogo"); 5220 headerConfigurationPage.RemoveBlock(configDesktopLogo); 5221 5222 Block configDesktopMenu = headerConfigurationPage.GetBlockById("MasterDesktopMenu"); 5223 headerConfigurationPage.RemoveBlock(configDesktopMenu); 5224 5225 Block configSearchBar = headerConfigurationPage.GetBlockById("MasterSearchBar"); 5226 headerConfigurationPage.RemoveBlock(configSearchBar); 5227 5228 Block configSearchAction = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenuSearch"); 5229 headerConfigurationPage.RemoveBlock(configSearchAction); 5230 5231 Block configDesktopActionsMenu = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenu"); 5232 headerConfigurationPage.RemoveBlock(configDesktopActionsMenu); 5233 5234 Block configDesktopExtra = headerConfigurationPage.GetBlockById("MasterDesktopExtra"); 5235 5236 switch (headerConfigurationTopLayout) 5237 { 5238 case "condensed": //2 5239 configDesktopLogo.Design.Size = "auto-width"; 5240 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); 5241 5242 configDesktopMenu.SortId = 20; 5243 configDesktopMenu.Design.Size = "auto"; 5244 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5245 5246 configDesktopActionsMenu.SortId = 30; 5247 configDesktopActionsMenu.Design.Size = "auto-width"; 5248 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 5249 5250 if (!headerConfigurationHideSearch) 5251 { 5252 configSearchBar.SortId = 40; 5253 configSearchBar.Design.Size = "12"; 5254 configDesktopExtra.SortId = 50; 5255 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); 5256 } 5257 break; 5258 case "splitted": //3 5259 configDesktopLogo.Design.Size = "auto"; 5260 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 5261 5262 if (!headerConfigurationHideSearch) 5263 { 5264 configSearchBar.SortId = 20; 5265 configSearchBar.Design.Size = "auto"; 5266 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); 5267 } 5268 5269 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5270 5271 configDesktopActionsMenu.SortId = 20; 5272 configDesktopActionsMenu.Design.Size = "auto-width"; 5273 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 5274 break; 5275 case "minimal": //4 5276 configDesktopLogo.Design.Size = "auto-width"; 5277 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); 5278 5279 configDesktopMenu.Design.Size = "auto"; 5280 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5281 5282 configDesktopActionsMenu.SortId = 20; 5283 configDesktopActionsMenu.Design.Size = "auto-width"; 5284 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 5285 5286 if (!headerConfigurationHideSearch) 5287 { 5288 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 5289 } 5290 break; 5291 case "minimal-right": //5 5292 configDesktopLogo.Design.Size = "auto-width"; 5293 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); 5294 5295 configDesktopMenu.Design.Size = "auto"; 5296 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5297 5298 configDesktopActionsMenu.SortId = 20; 5299 configDesktopActionsMenu.Design.Size = "auto-width"; 5300 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 5301 5302 if (!headerConfigurationHideSearch) 5303 { 5304 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 5305 } 5306 break; 5307 case "two-lines": //6 5308 configDesktopLogo.Design.Size = "auto"; 5309 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 5310 5311 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5312 5313 configDesktopActionsMenu.SortId = 20; 5314 configDesktopActionsMenu.Design.Size = "auto-width"; 5315 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 5316 5317 if (!headerConfigurationHideSearch) 5318 { 5319 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 5320 } 5321 break; 5322 case "two-lines-centered": //7 5323 configDesktopLogo.Design.Size = "auto"; 5324 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 5325 5326 configDesktopMenu.Design.Size = "auto-width"; 5327 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5328 5329 configDesktopActionsMenu.SortId = 20; 5330 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 5331 5332 if (!headerConfigurationHideSearch) 5333 { 5334 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 5335 } 5336 break; 5337 case "normal": //1 5338 default: 5339 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 5340 5341 if (!headerConfigurationHideSearch) 5342 { 5343 configSearchBar.SortId = 20; 5344 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); 5345 } 5346 5347 configDesktopActionsMenu.SortId = 30; 5348 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopActionsMenu); 5349 5350 configDesktopActionsMenu.Design.Size = "auto-width"; 5351 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5352 break; 5353 } 5354 } 5355 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5356 5357 @using System 5358 @using System.Web 5359 @using Dynamicweb.Rapido.Blocks.Extensibility 5360 @using Dynamicweb.Rapido.Blocks 5361 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5362 @using Dynamicweb.Rapido.Blocks 5363 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5364 @using Dynamicweb.Rapido.Blocks 5365 @{ 5366 5367 } 5368 5369 5370 @helper RenderDesktopTools() 5371 { 5372 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopTools").OrderBy(item => item.SortId).ToList(); 5373 5374 <div class="tools-navigation dw-mod"> 5375 <div class="center-container grid top-container__center-container dw-mod"> 5376 @RenderBlockList(subBlocks) 5377 </div> 5378 </div> 5379 } 5380 5381 @helper RenderDesktopToolsText() 5382 { 5383 string toolsText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("ToolsText"); 5384 if (!string.IsNullOrEmpty(toolsText)) 5385 { 5386 <div class="u-margin-top u-margin-bottom">@toolsText</div> 5387 } 5388 } 5389 5390 @helper RenderDesktopToolsNavigation() 5391 { 5392 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 5393 5394 if (renderPagesInToolBar) 5395 { 5396 @RenderNavigation(new 5397 { 5398 id = "topToolsNavigation", 5399 cssclass = "menu menu-tools dw-mod dwnavigation", 5400 template = "TopMenu.xslt" 5401 }) 5402 } 5403 } 5404 5405 @helper RenderDesktopNavigation() 5406 { 5407 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopNavigation").OrderBy(item => item.SortId).ToList(); 5408 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5409 string alignClass = topLayout == "two-lines-centered" ? "grid--justify-center" : ""; 5410 <nav class="main-navigation dw-mod"> 5411 <div class="center-container top-container__center-container grid @alignClass dw-mod"> 5412 @RenderBlockList(subBlocks) 5413 </div> 5414 </nav> 5415 } 5416 5417 @helper RenderDesktopExtra() 5418 { 5419 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopExtra").OrderBy(item => item.SortId).ToList(); 5420 5421 if (subBlocks.Count > 0) 5422 { 5423 <div class="header header-top dw-mod"> 5424 <div class="center-container top-container__center-container grid--justify-space-between grid grid--align-center dw-mod"> 5425 @RenderBlockList(subBlocks) 5426 </div> 5427 </div> 5428 } 5429 }</text> 5430 } 5431 5432 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5433 5434 @using System 5435 @using System.Web 5436 @using Dynamicweb.Rapido.Blocks.Extensibility 5437 @using Dynamicweb.Rapido.Blocks 5438 @using Dynamicweb.Rapido.Blocks.Components.General 5439 @using Dynamicweb.Frontend 5440 5441 @functions { 5442 int impersonationPageId; 5443 string impersonationLayout; 5444 int impersonationFeed; 5445 Block impersonationBar; 5446 5447 string getUserNameFromParams(string firstName, string middleName, string lastName, string name, string email, string userName) 5448 { 5449 string username = ""; 5450 5451 if (!string.IsNullOrEmpty(firstName) && !string.IsNullOrEmpty(lastName)) 5452 { 5453 username = firstName + " " + (!string.IsNullOrEmpty(middleName) ? middleName + " " : "") + lastName; 5454 } 5455 else if (!string.IsNullOrEmpty(name)) 5456 { 5457 username = name; 5458 } 5459 else if (!string.IsNullOrEmpty(email)) 5460 { 5461 username = email; 5462 } 5463 else 5464 { 5465 username = userName; 5466 } 5467 return username; 5468 } 5469 5470 string getUserName(UserViewModel user) 5471 { 5472 return getUserNameFromParams(user.FirstName, user.MiddleName, user.LastName, user.Name, user.Email, user.UserName); 5473 } 5474 5475 string getUserName(Dynamicweb.Security.UserManagement.User user) 5476 { 5477 return getUserNameFromParams(user.FirstName, user.MiddleName, user.LastName, user.Name, user.Email, user.UserName); 5478 } 5479 } 5480 5481 @{ 5482 impersonationPageId = GetPageIdByNavigationTag("Impersonation"); 5483 impersonationLayout = Model.Area.Item.GetItem("Ecommerce").GetList("ImpersonationLayout") != null ? Model.Area.Item.GetItem("Ecommerce").GetList("ImpersonationLayout").SelectedValue : "bar"; 5484 impersonationFeed = GetPageIdByNavigationTag("UsersFeed"); 5485 5486 if (Model.CurrentUser.ID > 0 && Model.SecondaryUsers.Count > 0) 5487 { 5488 impersonationBar = new Block 5489 { 5490 Id = "ImpersonationBar", 5491 SortId = 50, 5492 Template = RenderImpersonation(), 5493 SkipRenderBlocksList = true, 5494 Design = new Design 5495 { 5496 Size = "auto-width", 5497 HidePadding = true, 5498 RenderType = RenderType.Column 5499 } 5500 }; 5501 5502 Block impersonationContent = new Block 5503 { 5504 Id = "ImpersonationContent", 5505 SortId = 10 5506 }; 5507 5508 if (Model.CurrentSecondaryUser != null && Model.CurrentSecondaryUser.ID > 0) 5509 { 5510 //Render stop impersonation view 5511 impersonationContent.Template = RenderStopImpersonationView(); 5512 } 5513 else 5514 { 5515 //Render main view 5516 switch (impersonationLayout) 5517 { 5518 case "right-lower-box": 5519 impersonationContent.BlocksList.Add( 5520 new Block { 5521 Id = "RightLowerBoxHeader", 5522 SortId = 10, 5523 Component = new Heading { 5524 Level = 5, 5525 Title = Translate("View the list of users you can impersonate"), 5526 CssClass = "impersonation-text" 5527 } 5528 } 5529 ); 5530 impersonationContent.BlocksList.Add( 5531 new Block { 5532 Id = "RightLowerBoxContent", 5533 SortId = 20, 5534 Template = RenderImpersonationControls() 5535 } 5536 ); 5537 break; 5538 case "right-lower-bar": 5539 impersonationContent.BlocksList.Add( 5540 new Block { 5541 Id = "RightLowerBarContent", 5542 SortId = 10, 5543 Template = RenderImpersonationControls() 5544 } 5545 ); 5546 break; 5547 case "bar": 5548 default: 5549 impersonationContent.BlocksList.Add( 5550 new Block { 5551 Id = "ViewListLink", 5552 SortId = 20, 5553 Template = RenderViewListLink() 5554 } 5555 ); 5556 impersonationContent.BlocksList.Add( 5557 new Block { 5558 Id = "BarTypeaheadSearch", 5559 SortId = 30, 5560 Template = RenderTypeaheadSearch() 5561 } 5562 ); 5563 break; 5564 } 5565 } 5566 impersonationBar.BlocksList.Add(impersonationContent); 5567 5568 impersonationBar.BlocksList.Add( 5569 new Block 5570 { 5571 Id = "ImpersonationSearchTemplates", 5572 SortId = 20, 5573 Template = RenderSearchResultTemplate() 5574 } 5575 ); 5576 if (impersonationLayout != "bar") 5577 { 5578 impersonationBar.BlocksList.Add( 5579 new Block 5580 { 5581 Id = "ImpersonationSearchScripts", 5582 SortId = 30, 5583 Template = RenderSearchScripts() 5584 } 5585 ); 5586 } 5587 BlocksPage.GetBlockPage("Master").Add("MasterHeader", impersonationBar); 5588 } 5589 } 5590 5591 @helper RenderImpersonation() 5592 { 5593 List<Block> subBlocks = impersonationBar.BlocksList.OrderBy(item => item.SortId).ToList(); 5594 <input type="checkbox" class="impersonation-trigger js-remember-state" id="ImpersonationMinimizeTrigger" /> 5595 <div class="impersonation impersonation--@(impersonationLayout)-layout dw-mod" id="Impersonation"> 5596 @if (impersonationLayout == "right-lower-box") 5597 { 5598 @RenderRightLowerBoxHeader() 5599 } 5600 <div class="center-container top-container__center-container u-padding--lg impersonation__container @(impersonationLayout != "bar" ? "impersonation__container--box" : "") dw-mod"> 5601 @*Impersonation*@ 5602 @RenderBlockList(subBlocks) 5603 </div> 5604 </div> 5605 } 5606 5607 @helper RenderRightLowerBoxHeader() 5608 { 5609 <div class="impersonation__header dw-mod"> 5610 <div class="impersonation__title">@Translate("Impersonation")</div> 5611 <label for="ImpersonationMinimizeTrigger" class="btn btn--impersonation impersonation__minimize-btn dw-mod" onclick="this.blur();"> 5612 @Render(new Icon 5613 { 5614 Prefix = "fas", 5615 Name = "fa-window-minimize" 5616 }) 5617 </label> 5618 </div> 5619 } 5620 5621 @helper RenderStopImpersonationView() 5622 { 5623 string secondaryUserName = getUserName(Model.CurrentSecondaryUser); 5624 string userName = getUserName(Pageview.User); 5625 string impersonationText = "<b>" + userName + "</b> " + Translate("is impersonating") + " <b>" + secondaryUserName + "</b>"; 5626 impersonationText = Dynamicweb.Security.UserManagement.User.ImpersonationMode == Dynamicweb.Security.UserManagement.UserImpersonation.Full ? "<b>" + secondaryUserName + "</b> " + Translate("is impersonating") + " <b>" + userName + "</b>" : impersonationText; 5627 5628 if (impersonationLayout == "right-lower-box") 5629 { 5630 <div class="u-margin-bottom--lg u-ta-center"> 5631 @impersonationText 5632 </div> 5633 @RenderStopImpersonationForm() 5634 } 5635 else 5636 { 5637 <div class="grid grid--align-center grid--justify-space-between impersonation__stop-wrap"> 5638 <div class="u-margin-right--lg impersonation__stop-text"> 5639 <i class="fas fa-user-secret"></i> 5640 @impersonationText 5641 </div> 5642 @RenderStopImpersonationForm() 5643 </div> 5644 } 5645 } 5646 5647 @helper RenderStopImpersonationForm() 5648 { 5649 <form method="post" class="u-no-margin"> 5650 @Render(new Button 5651 { 5652 ButtonType = ButtonType.Submit, 5653 ButtonLayout = ButtonLayout.None, 5654 Title = Translate("Stop impersonation"), 5655 Href = "/Default.aspx?ID=" + impersonationPageId, 5656 CssClass = "impersonation__button btn btn--impersonation", 5657 Name = "DwExtranetRemoveSecondaryUser" 5658 }) 5659 </form> 5660 } 5661 5662 @helper RenderImpersonationControls() 5663 { 5664 <div class="impersonation__controls"> 5665 @RenderViewListLink() 5666 @RenderSearchBox() 5667 </div> 5668 @RenderResultsList() 5669 } 5670 5671 @helper RenderViewListLink() 5672 { 5673 string title = impersonationLayout == "right-lower-box" ? Translate("View the list") : Translate("View the list of users you can impersonate"); 5674 string buttonClasses = impersonationLayout == "right-lower-box" ? "impersonation__button btn btn--impersonation" : "impersonation__link impersonation__link"; 5675 5676 @Render(new Link { 5677 ButtonLayout = ButtonLayout.None, 5678 Title = title, 5679 Href = "/Default.aspx?ID=" + impersonationPageId, 5680 CssClass = buttonClasses 5681 }) 5682 } 5683 5684 @helper RenderSearchBox() 5685 { 5686 <div class="impersonation__search-wrap"> 5687 <input placeholder="@Translate("Search users")" type="text" class="impersonation__search-field dw-mod" onkeyup="searchKeyUpHandler(event)" id="ImpersonationBoxSearchField"> 5688 <div id="ImpersonationBoxSearchFind" class="impersonation__search-icon dw-mod" onclick="updateResults(document.getElementById('ImpersonationBoxSearchField').value)"> 5689 <i class="fal fa-search"></i> 5690 </div> 5691 <div id="ImpersonationBoxSearchClear" class="impersonation__search-icon u-hidden dw-mod" onclick="clearResults();"> 5692 <i class="fal fa-times"></i> 5693 </div> 5694 </div> 5695 } 5696 5697 @helper RenderTypeaheadSearch() 5698 { 5699 <div class="typeahead u-ta-right impersonation__typeahead js-typeahead dw-mod" id="ImpersonationSearchBar" 5700 data-page-size="5" 5701 data-search-feed-id="@impersonationFeed" 5702 data-result-page-id="@impersonationPageId" 5703 data-search-type="user-search" 5704 data-search-parameter-name="q"> 5705 5706 <div class="typeahead-search-field"> 5707 <input type="text" class="u-no-margin js-typeahead-search-field" placeholder="@Translate("Search users")"> 5708 <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> 5709 </div> 5710 </div> 5711 } 5712 5713 @helper RenderResultsList() 5714 { 5715 <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> 5716 } 5717 5718 @helper RenderSearchResultTemplate() 5719 { 5720 <script id="ImpersonationSearchResult" type="text/x-template"> 5721 {{#.}} 5722 {{#Users}} 5723 <li class="impersonation__search-results-item impersonation-user"> 5724 <form method="post" class="impersonation-user__form" name="account{{id}}"> 5725 <input type="hidden" id="DWExtranetSecondaryUserSelector" name="DWExtranetSecondaryUserSelector" value="{{id}}"> 5726 <div class="impersonation-user__info"> 5727 <div class="impersonation-user__name">{{userName}}</div> 5728 <div class="impersonation-user__number">{{customerNumber}}</div> 5729 </div> 5730 @Render(new Button 5731 { 5732 ButtonType = ButtonType.Submit, 5733 ButtonLayout = ButtonLayout.Secondary, 5734 Title = Translate("Sign in as"), 5735 CssClass = "impersonation-user__sign-in-btn" + (impersonationLayout != "bar" ? " btn--impersonation" : "") 5736 }) 5737 </form> 5738 </li> 5739 {{/Users}} 5740 {{#unless Users}} 5741 <li class="impersonation__search-results-item impersonation__search-results-item--not-found"> 5742 @Translate("Your search gave 0 results") 5743 </li> 5744 {{/unless}} 5745 {{/.}} 5746 </script> 5747 } 5748 5749 @helper RenderSearchScripts() 5750 { 5751 <script> 5752 let inputDelayTimer; 5753 function searchKeyUpHandler(e) { 5754 clearTimeout(inputDelayTimer); 5755 let value = e.target.value; 5756 if (value != "") { 5757 inputDelayTimer = setTimeout(function () { 5758 updateResults(value); 5759 }, 500); 5760 } else { 5761 clearResults(); 5762 } 5763 }; 5764 5765 function updateResults(value) { 5766 if (value == "") { 5767 return null; 5768 } 5769 HandlebarsBolt.UpdateContent("ImpersonationBoxSearchResults", "/Default.aspx?ID=@impersonationFeed&q=" + value); 5770 document.getElementById("ImpersonationBoxSearchFind").classList.add("u-hidden"); 5771 document.getElementById("ImpersonationBoxSearchClear").classList.remove("u-hidden"); 5772 } 5773 5774 function clearResults() { 5775 document.getElementById("ImpersonationBoxSearchField").value = ""; 5776 HandlebarsBolt.CleanContainer("ImpersonationBoxSearchResults"); 5777 document.getElementById("ImpersonationBoxSearchFind").classList.remove("u-hidden"); 5778 document.getElementById("ImpersonationBoxSearchClear").classList.add("u-hidden"); 5779 } 5780 </script> 5781 } 5782 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5783 5784 @using System 5785 @using System.Web 5786 @using System.Collections.Generic 5787 @using Dynamicweb.Rapido.Blocks.Extensibility 5788 @using Dynamicweb.Rapido.Blocks 5789 5790 @{ 5791 BlocksPage miniCartBlocksPage = BlocksPage.GetBlockPage("Master"); 5792 string orderlinesView = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView").SelectedValue : "table"; 5793 5794 Block orderLines = new Block 5795 { 5796 Id = "MiniCartOrderLines", 5797 SkipRenderBlocksList = true, 5798 BlocksList = new List<Block> 5799 { 5800 new Block { 5801 Id = "MiniCartOrderLinesList", 5802 SortId = 20, 5803 Template = RenderMiniCartOrderLinesList() 5804 } 5805 } 5806 }; 5807 5808 Block orderlinesScriptTemplates = new Block 5809 { 5810 Id = "OrderlinesScriptTemplates" 5811 }; 5812 5813 if (orderlinesView == "table") 5814 { 5815 orderLines.Template = RenderMiniCartOrderLinesTable(); 5816 orderLines.BlocksList.Add( 5817 new Block 5818 { 5819 Id = "MiniCartOrderlinesTableHeader", 5820 SortId = 10, 5821 Template = RenderMiniCartOrderLinesHeader() 5822 } 5823 ); 5824 5825 orderlinesScriptTemplates.Template = RenderMiniCartScriptsTableTemplates(); 5826 } 5827 else 5828 { 5829 orderLines.Template = RenderMiniCartOrderLinesBlocks(); 5830 orderlinesScriptTemplates.Template = RenderMiniCartScriptsListTemplates(); 5831 } 5832 5833 miniCartBlocksPage.Add("MasterBottomSnippets", orderlinesScriptTemplates); 5834 5835 Block miniCartScriptTemplates = new Block() 5836 { 5837 Id = "MasterMiniCartTemplates", 5838 SortId = 1, 5839 Template = RenderMiniCartScriptTemplates(), 5840 SkipRenderBlocksList = true, 5841 BlocksList = new List<Block> 5842 { 5843 orderLines, 5844 new Block { 5845 Id = "MiniCartFooter", 5846 Template = RenderMiniCartFooter(), 5847 SortId = 50, 5848 SkipRenderBlocksList = true, 5849 BlocksList = new List<Block> 5850 { 5851 new Block { 5852 Id = "MiniCartSubTotal", 5853 Template = RenderMiniCartSubTotal(), 5854 SortId = 30 5855 }, 5856 new Block { 5857 Id = "MiniCartFees", 5858 Template = RenderMiniCartFees(), 5859 SortId = 40 5860 }, 5861 new Block { 5862 Id = "MiniCartPoints", 5863 Template = RenderMiniCartPoints(), 5864 SortId = 50 5865 }, 5866 new Block { 5867 Id = "MiniCartTotal", 5868 Template = RenderMiniCartTotal(), 5869 SortId = 60 5870 }, 5871 new Block { 5872 Id = "MiniCartDisclaimer", 5873 Template = RenderMiniCartDisclaimer(), 5874 SortId = 70 5875 }, 5876 new Block { 5877 Id = "MiniCartActions", 5878 Template = RenderMiniCartActions(), 5879 SortId = 80 5880 } 5881 } 5882 } 5883 } 5884 }; 5885 5886 miniCartBlocksPage.Add("MasterBottomSnippets", miniCartScriptTemplates); 5887 } 5888 5889 @helper RenderMiniCartScriptsTableTemplates() 5890 { 5891 <script id="MiniCartOrderline" type="text/x-template"> 5892 {{#unless isEmpty}} 5893 <tr> 5894 <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> 5895 <td class="u-va-middle"> 5896 <a href="{{link}}" class="mini-cart-orderline__name" title="{{name}}">{{name}}</a> 5897 {{#if variantname}} 5898 <a href="{{link}}" class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{variantname}}</a> 5899 {{/if}} 5900 {{#if unitname}} 5901 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{unitname}}</div> 5902 {{/if}} 5903 </td> 5904 <td class="u-ta-right u-va-middle">{{quantity}}</td> 5905 <td class="u-ta-right u-va-middle"> 5906 {{#if pointsTotal}} 5907 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 5908 {{else}} 5909 {{totalprice}} 5910 {{/if}} 5911 </td> 5912 </tr> 5913 {{/unless}} 5914 </script> 5915 5916 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 5917 {{#unless isEmpty}} 5918 <tr class="table__row--no-border"> 5919 <td class="u-w60px">&nbsp;</td> 5920 <td><div class="mini-cart-orderline__name dw-mod">{{name}}</div></td> 5921 <td class="u-ta-right">&nbsp;</td> 5922 <td class="u-ta-right">{{totalprice}}</td> 5923 </tr> 5924 {{/unless}} 5925 </script> 5926 } 5927 5928 @helper RenderMiniCartScriptsListTemplates() 5929 { 5930 int cartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 5931 5932 <script id="MiniCartOrderline" type="text/x-template"> 5933 {{#unless isEmpty}} 5934 <div class="mini-cart-orderline grid dw-mod"> 5935 <div class="grid__col-4"> 5936 <a href="{{link}}" class="{{hideimage}}"> 5937 <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}}"> 5938 </a> 5939 </div> 5940 <div class="grid__col-8"> 5941 <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> 5942 {{#if variantname}} 5943 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Variant"): {{variantname}}</div> 5944 {{/if}} 5945 {{#if unitname}} 5946 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Unit"): {{unitname}}</div> 5947 {{/if}} 5948 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Qty"): {{quantity}}</div> 5949 5950 <div class="grid__cell-footer"> 5951 <div class="grid__cell"> 5952 <div class="u-pull--left mini-cart-orderline__price dw-mod"> 5953 {{#if pointsTotal}} 5954 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 5955 {{else}} 5956 {{totalprice}} 5957 {{/if}} 5958 </div> 5959 <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> 5960 </div> 5961 </div> 5962 </div> 5963 </div> 5964 {{/unless}} 5965 </script> 5966 5967 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 5968 {{#unless isEmpty}} 5969 <div class="mini-cart-orderline mini-cart-orderline--discount grid dw-mod"> 5970 <div class="grid__col-4"> 5971 <div class="mini-cart-orderline__name mini-cart-orderline__name dw-mod">{{name}}</div> 5972 </div> 5973 <div class="grid__col-8">{{totalprice}}</div> 5974 </div> 5975 {{/unless}} 5976 </script> 5977 } 5978 5979 @helper RenderMiniCartScriptTemplates() 5980 { 5981 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMiniCartTemplates").OrderBy(item => item.SortId).ToList(); 5982 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 5983 string cartPageLink = string.Concat("/Default.aspx?ID=", GetPageIdByNavigationTag("CartPage")); 5984 5985 <script id="MiniCartContent" type="text/x-template"> 5986 {{#.}} 5987 {{#unless isEmpty}} 5988 @RenderBlockList(subBlocks) 5989 {{/unless}} 5990 {{/.}} 5991 </script> 5992 } 5993 5994 @helper RenderMiniCartOrderLinesTable() 5995 { 5996 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList(); 5997 5998 <div class="u-overflow-auto"> 5999 <table class="table mini-cart-table dw-mod"> 6000 @RenderBlockList(subBlocks) 6001 </table> 6002 </div> 6003 } 6004 6005 @helper RenderMiniCartOrderLinesBlocks() 6006 { 6007 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList(); 6008 6009 <div class="u-overflow-auto"> 6010 @RenderBlockList(subBlocks) 6011 </div> 6012 } 6013 6014 @helper RenderMiniCartOrderLinesHeader() 6015 { 6016 <thead> 6017 <tr> 6018 <td>&nbsp;</td> 6019 <td>@Translate("Product")</td> 6020 <td class="u-ta-right">@Translate("Qty")</td> 6021 <td class="u-ta-right" width="120">@Translate("Price")</td> 6022 </tr> 6023 </thead> 6024 } 6025 6026 @helper RenderMiniCartOrderLinesList() 6027 { 6028 <text> 6029 {{#OrderLines}} 6030 {{#ifCond template "===" "CartOrderline"}} 6031 {{>MiniCartOrderline}} 6032 {{/ifCond}} 6033 {{#ifCond template "===" "CartOrderlineMobile"}} 6034 {{>MiniCartOrderline}} 6035 {{/ifCond}} 6036 {{#ifCond template "===" "CartOrderlineDiscount"}} 6037 {{>MiniCartOrderlineDiscount}} 6038 {{/ifCond}} 6039 {{/OrderLines}} 6040 </text> 6041 } 6042 6043 @helper RenderMiniCartFees() 6044 { 6045 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 6046 if (!pointShop) 6047 { 6048 <text> 6049 {{#unless hidePaymentfee}} 6050 <div class="grid"> 6051 <div class="grid__col-6 grid__col--bleed-y"> 6052 {{paymentmethod}} 6053 </div> 6054 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{paymentfee}}</div> 6055 </div> 6056 {{/unless}} 6057 </text> 6058 } 6059 <text> 6060 {{#unless hideShippingfee}} 6061 <div class="grid"> 6062 <div class="grid__col-6 grid__col--bleed-y"> 6063 {{shippingmethod}} 6064 </div> 6065 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{shippingfee}}</div> 6066 </div> 6067 {{/unless}} 6068 </text> 6069 <text> 6070 {{#if hasTaxSettings}} 6071 <div class="grid"> 6072 <div class="grid__col-6 grid__col--bleed-y">@Translate("Sales Tax")</div> 6073 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{totaltaxes}}</div> 6074 </div> 6075 {{/if}} 6076 </text> 6077 } 6078 6079 @helper RenderMiniCartFooter() 6080 { 6081 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartFooter").OrderBy(item => item.SortId).ToList(); 6082 6083 <div class="mini-cart__footer u-border-top u-padding-top dw-mod"> 6084 @RenderBlockList(subBlocks) 6085 </div> 6086 } 6087 6088 @helper RenderMiniCartActions() 6089 { 6090 int cartPageId = GetPageIdByNavigationTag("CartPage"); 6091 6092 <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> 6093 <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> 6094 } 6095 6096 @helper RenderMiniCartPoints() 6097 { 6098 <text> 6099 {{#if earnings}} 6100 <div class="grid"> 6101 <div class="grid__col-6 grid__col--bleed-y">@Translate("Earnings")</div> 6102 <div class="grid__col-6 grid__col--bleed-y grid--align-end"> 6103 <div> 6104 <span class="u-color--loyalty-points">{{earnings}}</span> @Translate("points") 6105 </div> 6106 </div> 6107 </div> 6108 {{/if}} 6109 </text> 6110 } 6111 6112 @helper RenderMiniCartSubTotal() 6113 { 6114 bool hasTaxSettings = Dynamicweb.Rapido.Services.Countries.HasTaxSettings(Model.Cart.ID); 6115 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 6116 if (!pointShop) 6117 { 6118 <text> 6119 {{#unless hideSubTotal}} 6120 <div class="grid dw-mod u-bold"> 6121 <div class="grid__col-6 grid__col--bleed-y">@Translate("Subtotal")</div> 6122 <div class="grid__col-6 grid__col--bleed-y grid--align-end"> 6123 @if (hasTaxSettings) 6124 { 6125 <text>{{subtotalpricewithouttaxes}}</text> 6126 } 6127 else 6128 { 6129 <text>{{subtotalprice}}</text> 6130 } 6131 </div> 6132 </div> 6133 {{/unless}} 6134 </text> 6135 } 6136 } 6137 6138 @helper RenderMiniCartTotal() 6139 { 6140 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 6141 6142 <div class="mini-cart-totals grid u-border-top u-margin-top dw-mod"> 6143 <div class="grid__col-6">@Translate("Total")</div> 6144 <div class="grid__col-6 grid--align-end"> 6145 <div> 6146 @if (pointShop) 6147 { 6148 <span class="u-color--loyalty-points">{{pointsUsedInCart}}</span> @Translate("points") 6149 } 6150 else 6151 { 6152 <text>{{totalprice}}</text> 6153 } 6154 </div> 6155 </div> 6156 </div> 6157 } 6158 6159 @helper RenderMiniCartDisclaimer() 6160 { 6161 <text> 6162 {{#if showCheckoutDisclaimer}} 6163 <div class="grid u-margin-bottom u-ta-right"> 6164 <small class="grid__col-12">{{checkoutDisclaimer}}</small> 6165 </div> 6166 {{/if}} 6167 </text> 6168 } 6169 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 6170 6171 @using Dynamicweb.Rapido.Blocks.Extensibility 6172 @using Dynamicweb.Rapido.Blocks 6173 @using Dynamicweb.Rapido.Blocks.Components.General 6174 @using Dynamicweb.Rapido.Blocks.Components 6175 @using Dynamicweb.Rapido.Services 6176 6177 @{ 6178 string addToCartNotificationType = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType").SelectedValue : ""; 6179 string addToCartNotificationMiniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown"; 6180 bool addToCartHideCartIcon = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 6181 6182 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed() && !string.IsNullOrEmpty(addToCartNotificationType)) 6183 { 6184 if (addToCartNotificationType == "modal") 6185 { 6186 Block addToCartNotificationModal = new Block 6187 { 6188 Id = "AddToCartNotificationModal", 6189 Template = RenderAddToCartNotificationModal() 6190 }; 6191 6192 Block addToCartNotificationScript = new Block 6193 { 6194 Id = "AddToCartNotificationScript", 6195 Template = RenderAddToCartNotificationModalScript() 6196 }; 6197 BlocksPage.GetBlockPage("Master").Add("MasterTopSnippets", addToCartNotificationModal); 6198 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript); 6199 } 6200 else if (addToCartNotificationType == "toggle" && addToCartNotificationMiniCartLayout != "none" && !addToCartHideCartIcon && Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 6201 { 6202 Block addToCartNotificationScript = new Block 6203 { 6204 Id = "AddToCartNotificationScript", 6205 Template = RenderAddToCartNotificationToggleScript() 6206 }; 6207 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript); 6208 } 6209 } 6210 } 6211 6212 @helper RenderAddToCartNotificationModal() 6213 { 6214 <div id="LastAddedProductModal" data-template="LastAddedProductTemplate"></div> 6215 } 6216 6217 @helper RenderAddToCartNotificationModalScript() 6218 { 6219 int cartPageId = GetPageIdByNavigationTag("CartPage"); 6220 6221 <script id="LastAddedProductTemplate" type="text/x-template"> 6222 @{ 6223 6224 Modal lastAddedProduct = new Modal 6225 { 6226 Id = "LastAddedProduct", 6227 Heading = new Heading 6228 { 6229 Level = 2, 6230 Title = Translate("Product is added to the cart") 6231 }, 6232 Width = ModalWidth.Md, 6233 BodyTemplate = RenderModalContent() 6234 }; 6235 6236 lastAddedProduct.AddActions( 6237 new Button 6238 { 6239 ButtonType = ButtonType.Button, 6240 ButtonLayout = ButtonLayout.Secondary, 6241 Title = Translate("Continue shopping"), 6242 CssClass = "u-pull--left u-no-margin btn--sm", 6243 OnClick = "document.getElementById('LastAddedProductModalTrigger').checked = false" 6244 }, 6245 new Link 6246 { 6247 Href = "/Default.aspx?ID=" + cartPageId, 6248 ButtonLayout = ButtonLayout.Secondary, 6249 CssClass = "u-pull--right u-no-margin btn--sm", 6250 Title = Translate("Proceed to checkout") 6251 } 6252 ); 6253 6254 @Render(lastAddedProduct) 6255 } 6256 </script> 6257 <script> 6258 document.addEventListener('addToCart', function (event) { 6259 Cart.ShowLastAddedProductModal(event.detail); 6260 }); 6261 </script> 6262 } 6263 6264 @helper RenderModalContent() 6265 { 6266 <div class="grid"> 6267 <div class="grid__col-2"> 6268 @Render(new Image { Path = "{{ productInfo.image }}", Link = "{{ productInfo.link }}", Title = "{{ productInfo.name }}", DisableImageEngine = true }) 6269 </div> 6270 <div class="u-padding grid--align-self-center"> 6271 <span>{{quantity}}</span> x 6272 </div> 6273 <div class="grid__col-auto grid--align-self-center"> 6274 <div>{{productInfo.name}}</div> 6275 {{#if productInfo.variantName}} 6276 <small class="u-margin-bottom-5px">{{productInfo.variantName}}</small> 6277 {{/if}} 6278 {{#if productInfo.unitName}} 6279 <small class="u-margin-bottom-5px">{{productInfo.unitName}}</small> 6280 {{/if}} 6281 </div> 6282 </div> 6283 } 6284 6285 @helper RenderAddToCartNotificationToggleScript() 6286 { 6287 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 6288 6289 <script> 6290 document.addEventListener('addToCart', function () { 6291 Cart.ToggleMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '@miniCartFeedPageId'); 6292 }); 6293 </script> 6294 } 6295 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 6296 6297 @using System 6298 @using System.Web 6299 @using System.Collections.Generic 6300 @using Dynamicweb.Rapido.Blocks.Extensibility 6301 @using Dynamicweb.Rapido.Blocks 6302 @using Dynamicweb.Rapido.Blocks.Components.General 6303 6304 @functions { 6305 BlocksPage footerBlocksPage = BlocksPage.GetBlockPage("Master"); 6306 } 6307 6308 @{ 6309 string footerColumnOneContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Content"); 6310 string footerColumnTwoContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Content"); 6311 string footerColumnThreeContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Content"); 6312 string footerColumnOneHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Header"); 6313 string footerColumnTwoHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Header"); 6314 string footerColumnThreeHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Header"); 6315 6316 Block masterFooterContent = new Block() 6317 { 6318 Id = "MasterFooterContent", 6319 SortId = 10, 6320 Template = RenderFooter(), 6321 SkipRenderBlocksList = true 6322 }; 6323 footerBlocksPage.Add(MasterBlockId.MasterFooter, masterFooterContent); 6324 6325 if (!string.IsNullOrEmpty(footerColumnOneContent) || !string.IsNullOrEmpty(footerColumnOneHeader)) 6326 { 6327 Block masterFooterColumnOne = new Block 6328 { 6329 Id = "MasterFooterColumnOne", 6330 SortId = 10, 6331 Template = RenderFooterColumn(footerColumnOneHeader, footerColumnOneContent), 6332 Design = new Design 6333 { 6334 Size = "auto", 6335 RenderType = RenderType.Column 6336 } 6337 }; 6338 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnOne); 6339 } 6340 6341 if (!string.IsNullOrEmpty(footerColumnTwoContent) || !string.IsNullOrEmpty(footerColumnTwoHeader)) 6342 { 6343 Block masterFooterColumnTwo = new Block 6344 { 6345 Id = "MasterFooterColumnTwo", 6346 SortId = 20, 6347 Template = RenderFooterColumn(footerColumnTwoHeader, footerColumnTwoContent), 6348 Design = new Design 6349 { 6350 Size = "auto", 6351 RenderType = RenderType.Column 6352 } 6353 }; 6354 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnTwo); 6355 } 6356 6357 if (!string.IsNullOrEmpty(footerColumnThreeContent) || !string.IsNullOrEmpty(footerColumnThreeHeader)) 6358 { 6359 Block masterFooterColumnThree = new Block 6360 { 6361 Id = "MasterFooterColumnThree", 6362 SortId = 30, 6363 Template = RenderFooterColumn(footerColumnThreeHeader, footerColumnThreeContent), 6364 Design = new Design 6365 { 6366 Size = "auto", 6367 RenderType = RenderType.Column 6368 } 6369 }; 6370 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnThree); 6371 } 6372 6373 if (Model.Area.Item.GetItem("Layout").GetBoolean("FooterNewsletterSignUp")) 6374 { 6375 Block masterFooterNewsletterSignUp = new Block 6376 { 6377 Id = "MasterFooterNewsletterSignUp", 6378 SortId = 40, 6379 Template = RenderFooterNewsletterSignUp(), 6380 Design = new Design 6381 { 6382 Size = "auto", 6383 RenderType = RenderType.Column 6384 } 6385 }; 6386 footerBlocksPage.Add("MasterFooterContent", masterFooterNewsletterSignUp); 6387 } 6388 6389 if (Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks").Count > 0) 6390 { 6391 Block masterFooterSocialLinks = new Block 6392 { 6393 Id = "MasterFooterSocialLinks", 6394 SortId = 50, 6395 Template = RenderFooterSocialLinks(), 6396 Design = new Design 6397 { 6398 Size = "auto", 6399 RenderType = RenderType.Column 6400 } 6401 }; 6402 footerBlocksPage.Add("MasterFooterContent", masterFooterSocialLinks); 6403 } 6404 6405 if (Model.Area.Item.GetItem("Layout").GetItems("FooterPayments") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterPayments").Count > 0) 6406 { 6407 Block masterFooterPayments = new Block 6408 { 6409 Id = "MasterFooterPayments", 6410 SortId = 60, 6411 Template = RenderFooterPayments(), 6412 Design = new Design 6413 { 6414 Size = "12", 6415 RenderType = RenderType.Column 6416 } 6417 }; 6418 footerBlocksPage.Add("MasterFooterContent", masterFooterPayments); 6419 } 6420 6421 Block masterFooterCopyright = new Block 6422 { 6423 Id = "MasterFooterCopyright", 6424 SortId = 70, 6425 Template = RenderFooterCopyright(), 6426 Design = new Design 6427 { 6428 Size = "12", 6429 RenderType = RenderType.Column 6430 } 6431 }; 6432 footerBlocksPage.Add("MasterFooterContent", masterFooterCopyright); 6433 } 6434 6435 @helper RenderFooter() 6436 { 6437 List<Block> subBlocks = this.footerBlocksPage.GetBlockListById("MasterFooterContent").OrderBy(item => item.SortId).ToList(); 6438 6439 <footer class="footer dw-mod"> 6440 <div class="center-container top-container__center-container dw-mod"> 6441 <div class="grid grid--external-bleed-x"> 6442 @RenderBlockList(subBlocks) 6443 </div> 6444 </div> 6445 </footer> 6446 } 6447 6448 @helper RenderFooterColumn(string header, string content) 6449 { 6450 <h3 class="footer__heading dw-mod">@header</h3> 6451 <div class="footer__content dw-mod"> 6452 @content 6453 </div> 6454 } 6455 6456 @helper RenderFooterNewsletterSignUp() 6457 { 6458 string newsletterSignUpPageId = GetPageIdByNavigationTag("NewsletterSignUp").ToString(); 6459 Form form = new Form { Action = "/Default.aspx", Method = FormMethod.Get, Enctype = FormEnctype.multipart }; 6460 6461 form.Add(new HiddenField { Name = "ID", Value = newsletterSignUpPageId }); 6462 form.Add(new Text { Content = "<p>" + Translate("Sign up if you would like to receive occasional treats from us") + "</p>" }); 6463 form.Add(new TextField { 6464 Id = "NewsletterEmail", Name = "NewsletterEmail", Placeholder = Translate("Your email address"), 6465 Type = TextFieldType.Email, 6466 ActionButton = new Button { 6467 ButtonType = ButtonType.Submit, Id="Submitter", Title = Translate("Go"), OnClick = "Buttons.LockButton(event)", CssClass = "btn--condensed" 6468 } 6469 }); 6470 6471 <h3 class="footer__heading dw-mod">@Translate("Mailing list")</h3> 6472 <div class="footer__content dw-mod"> 6473 @Render(form) 6474 </div> 6475 } 6476 6477 @helper RenderFooterSocialLinks() 6478 { 6479 <h3 class="footer__heading dw-mod">@Translate("Social links")</h3> 6480 <div class="footer__content dw-mod"> 6481 <div class="collection dw-mod"> 6482 @foreach (var socialitem in Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks")) 6483 { 6484 var socialIcon = socialitem.GetValue("Icon") as Dynamicweb.Frontend.ListViewModel; 6485 string socialIconClass = socialIcon.SelectedValue; 6486 string socialIconTitle = socialIcon.SelectedName; 6487 string socialLink = socialitem.GetString("Link"); 6488 6489 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px" rel="noopener"><i class="@socialIconClass fa-2x"></i></a> 6490 } 6491 </div> 6492 </div> 6493 } 6494 6495 @helper RenderFooterPayments() 6496 { 6497 <div class="footer__content dw-mod"> 6498 <div class="collection dw-mod"> 6499 @foreach (var payment in Model.Area.Item.GetItem("Layout").GetItems("FooterPayments")) 6500 { 6501 var paymentItem = payment.GetValue("CardTypeOrVerifiedPayment") as Dynamicweb.Frontend.ListViewModel; 6502 string paymentImage = null; 6503 string paymentTitle = paymentItem.SelectedName; 6504 ListOptionViewModel selected = paymentItem.SelectedOptions.FirstOrDefault(); 6505 if (selected != null) 6506 { 6507 paymentImage = selected.Icon; 6508 } 6509 6510 <div class="footer__card-type"> 6511 <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" /> 6512 </div> 6513 } 6514 </div> 6515 </div> 6516 } 6517 6518 @helper RenderFooterCopyright() 6519 { 6520 <div class="grid__col-12 footer__copyright dw-mod"> 6521 <p>@Model.Area.Item.GetItem("Layout").GetString("FooterCopyrightText")</p> 6522 </div> 6523 } 6524 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 6525 6526 @using System 6527 @using System.Web 6528 @using System.Collections.Generic 6529 @using Dynamicweb.Rapido.Blocks.Extensibility 6530 @using Dynamicweb.Rapido.Blocks 6531 @using Dynamicweb.Ecommerce.Common 6532 6533 @{ 6534 BlocksPage referencesBlocksPage = BlocksPage.GetBlockPage("Master"); 6535 6536 Block masterScriptReferences = new Block() 6537 { 6538 Id = "MasterScriptReferences", 6539 SortId = 1, 6540 Template = RenderMasterScriptReferences() 6541 }; 6542 referencesBlocksPage.Add(MasterBlockId.MasterReferences, masterScriptReferences); 6543 } 6544 6545 @helper RenderMasterScriptReferences() { 6546 <script src="/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js"></script> 6547 <script src="/Files/Templates/Designs/Rapido/js/master.min.js"></script> 6548 6549 if (Model.Area.Item.GetItem("Custom").GetBoolean("UseCustomJavascript")) 6550 { 6551 var minify = Model.Area.Item.GetItem("Rizzo").GetBoolean("MinifyJavascript"); 6552 const string folderName = "custom"; 6553 var customBundle = Dna.Optimizer.Renderer.RenderScripts($"/Files/Templates/Designs/Rapido/js/{folderName}", $"-{folderName}-scripts", new List<string>(), new List<string>(), minify, false, false); 6554 <script src="@customBundle"></script> 6555 PushPromise(customBundle); 6556 } 6557 6558 PushPromise("/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js"); 6559 PushPromise("/Files/Templates/Designs/Rapido/js/master.min.js"); 6560 } 6561 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 6562 6563 @using System 6564 @using System.Web 6565 @using System.Collections.Generic 6566 @using Dynamicweb.Rapido.Blocks.Extensibility 6567 @using Dynamicweb.Rapido.Blocks 6568 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 6569 @using Dynamicweb.Rapido.Services 6570 6571 @{ 6572 BlocksPage searchBlocksPage = BlocksPage.GetBlockPage("Master"); 6573 bool navigationItemsHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 6574 bool isFavoriteList = !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("ListID")); 6575 6576 if (!navigationItemsHideSearch || isFavoriteList) 6577 { 6578 Block masterSearchScriptTemplates = new Block() 6579 { 6580 Id = "MasterSearchScriptTemplates", 6581 SortId = 1, 6582 Template = RenderSearchScriptTemplates() 6583 }; 6584 6585 searchBlocksPage.Add(MasterBlockId.MasterBottomSnippets, masterSearchScriptTemplates); 6586 } 6587 } 6588 6589 @helper RenderSearchScriptTemplates() 6590 { 6591 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 6592 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 6593 bool useFacebookPixel = !string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID")); 6594 bool useGoogleTagManager = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID")); 6595 bool showPrice = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HidePriceInSearchResults"); 6596 bool showAddToCartButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideAddToCartButton"); 6597 bool showViewButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideViewButton"); 6598 bool showAddToDownloadButton = Pageview.AreaSettings.GetItem("Layout").GetBoolean("ShowAddToDownloadButton"); 6599 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 6600 6601 <script id="SearchGroupsTemplate" type="text/x-template"> 6602 {{#.}} 6603 <li class="dropdown__item dw-mod" onclick="Search.UpdateGroupSelection(this)" data-group-id="{{id}}">{{name}}</li> 6604 {{/.}} 6605 </script> 6606 6607 <script id="SearchProductsTemplate" type="text/x-template"> 6608 {{#each .}} 6609 {{#Product}} 6610 {{#ifCond template "!==" "SearchMore"}} 6611 <li class="dropdown__item dropdown__item--seperator dw-mod"> 6612 @if (useFacebookPixel) 6613 { 6614 <text>{{{facebookPixelSearch name number priceDouble currency searchParameter}}}</text> 6615 } 6616 @if (useGoogleTagManager) 6617 { 6618 <text>{{{googleEnchantImpression 'Search results' currency googleImpression}}}</text> 6619 } 6620 <div> 6621 <a href="{{link}}" class="js-typeahead-link u-color-inherit u-pull--left" onclick="{{googleImpressionClick}}" title="{{name}}{{#if variantName}}, {{variantName}}{{/if}}"> 6622 <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> 6623 <div class="u-pull--left"> 6624 <div class="u-bold u-max-w220px u-truncate-text js-typeahead-name">{{name}}{{#if variantName}}, {{variantName}}{{/if}}</div> 6625 @if (showPrice && Dynamicweb.Rapido.Services.User.IsPricesAllowed()) 6626 { 6627 if (pointShopOnly) 6628 { 6629 <text> 6630 {{#if havePointPrice}} 6631 <div> 6632 <span class="u-color--loyalty-points">{{points}}</span> @Translate("points") 6633 </div> 6634 {{else}} 6635 <small class="help-text u-no-margin">@Translate("Not available")</small> 6636 {{/if}} 6637 {{#unless canBePurchasedWithPoints}} 6638 {{#if havePointPrice}} 6639 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small> 6640 {{/if}} 6641 {{/unless}} 6642 </text> 6643 } 6644 else 6645 { 6646 <div>{{price}}</div> 6647 } 6648 } 6649 </div> 6650 </a> 6651 <div class="u-margin-left u-pull--right"> 6652 @{ 6653 var viewBtn = new Link 6654 { 6655 Href = "{{link}}", 6656 OnClick = "{{googleImpressionClick}}", 6657 ButtonLayout = ButtonLayout.Secondary, 6658 CssClass = "btn--condensed u-no-margin u-w80px js-ignore-click-outside", 6659 Title = Translate("View") 6660 }; 6661 } 6662 @if (showAddToCartButton && Dynamicweb.Rapido.Services.User.IsBuyingAllowed()) 6663 { 6664 <text>{{#if hideAddToCartButton}}</text> 6665 @Render(viewBtn) 6666 <text>{{else}}</text> 6667 @Render(new AddToCartButton 6668 { 6669 HideTitle = true, 6670 ProductId = "{{productId}}", 6671 ProductInfo = "{{productInfo}}", 6672 BuyForPoints = pointShopOnly, 6673 OnClick = "{{facebookPixelAction}}", 6674 CssClass = "u-w80px js-ignore-click-outside", 6675 Icon = new Icon { 6676 CssClass = "js-ignore-click-outside" 6677 }, 6678 ExtraAttributes = new Dictionary<string, string> 6679 { 6680 { "{{disabledBuyButton}}", "" }, 6681 { "{{outOfStock}}", "" } 6682 } 6683 }) 6684 <text>{{/if}}</text> 6685 } 6686 else if (showViewButton) 6687 { 6688 @Render(viewBtn) 6689 } 6690 @if (showAddToDownloadButton) 6691 { 6692 <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}}"> 6693 <i class="fas fa-plus js-button-icon"></i> 6694 </button> 6695 } 6696 </div> 6697 </div> 6698 </li> 6699 {{/ifCond}} 6700 {{#ifCond template "===" "SearchMore"}} 6701 {{>SearchMoreProducts}} 6702 {{/ifCond}} 6703 {{/Product}} 6704 {{else}} 6705 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod"> 6706 @Translate("Your search gave 0 results") 6707 </li> 6708 {{/each}} 6709 </script> 6710 6711 <script id="SearchMoreProducts" type="text/x-template"> 6712 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 6713 <a href="/Default.aspx?ID=@productsPageId&Search={{searchParameter}}&GroupID={{groupId}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 6714 @Translate("View all") 6715 </a> 6716 </li> 6717 </script> 6718 6719 <script id="SearchMorePages" type="text/x-template"> 6720 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 6721 <a href="/Default.aspx?ID=@contentSearchPageLink&Search={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 6722 @Translate("View all") 6723 </a> 6724 </li> 6725 </script> 6726 6727 <script id="SearchPagesTemplate" type="text/x-template"> 6728 {{#each .}} 6729 {{#ifCond template "!==" "SearchMore"}} 6730 <li class="dropdown__item dropdown__item--seperator dw-mod"> 6731 <div> 6732 <a href="/Default.aspx?ID={{id}}" class="js-typeahead-link u-pull--left u-color-inherit"> 6733 <div class="u-margin-right u-pull--left"><i class="fa {{icon}} u-w20px u-ta-center"></i></div> 6734 <div class="u-pull--left"> 6735 <div class="u-bold u-truncate-text u-max-w220px js-typeahead-name">{{name}}</div> 6736 </div> 6737 </a> 6738 </div> 6739 </li> 6740 {{/ifCond}} 6741 {{#ifCond template "===" "SearchMore"}} 6742 {{>SearchMorePages}} 6743 {{/ifCond}} 6744 {{else}} 6745 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod"> 6746 @Translate("Your search gave 0 results") 6747 </li> 6748 {{/each}} 6749 </script> 6750 6751 <script id="SearchPagesTemplateWrap" type="text/x-template"> 6752 <div class="dropdown__column-header">@Translate("Pages")</div> 6753 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod"> 6754 {{>SearchPagesTemplate}} 6755 </ul> 6756 </script> 6757 6758 <script id="SearchProductsTemplateWrap" type="text/x-template"> 6759 <div class="dropdown__column-header">@Translate("Products")</div> 6760 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod"> 6761 {{>SearchProductsTemplate}} 6762 </ul> 6763 </script> 6764 } 6765 6766 @using Dynamicweb.Rapido.Blocks.Components 6767 @using Dynamicweb.Rapido.Blocks.Components.General 6768 @using Dynamicweb.Rapido.Blocks 6769 @using System.IO 6770 6771 6772 @using Dynamicweb.Rapido.Blocks.Components.General 6773 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 6774 6775 6776 @* Component *@ 6777 6778 @helper RenderVariantMatrix(VariantMatrix settings) { 6779 if (settings != null) 6780 { 6781 int productLoopCounter = 0; 6782 int groupCount = 0; 6783 List<VariantOption> firstDimension = new List<VariantOption>(); 6784 List<VariantOption> secondDimension = new List<VariantOption>(); 6785 List<VariantOption> thirdDimension = new List<VariantOption>(); 6786 6787 foreach (VariantGroup variantGroup in settings.GetVariantGroups()) 6788 { 6789 foreach (VariantOption variantOptions in variantGroup.GetVariantOptions()) 6790 { 6791 if (groupCount == 0) { 6792 firstDimension.Add(variantOptions); 6793 } 6794 if (groupCount == 1) 6795 { 6796 secondDimension.Add(variantOptions); 6797 } 6798 if (groupCount == 2) 6799 { 6800 thirdDimension.Add(variantOptions); 6801 } 6802 } 6803 groupCount++; 6804 } 6805 6806 int rowCount = 0; 6807 int columnCount = 0; 6808 6809 <script> 6810 var variantsCollection = []; 6811 </script> 6812 6813 <table class="table table--compact js-variants-matrix dw-mod" id="VariantMatrixTable_@settings.ProductId"> 6814 @if (groupCount == 1) 6815 { 6816 <tbody> 6817 @foreach (VariantOption firstVariantOption in firstDimension) 6818 { 6819 var variantId = firstVariantOption.Id; 6820 <tr> 6821 <td class="u-bold"> 6822 @firstVariantOption.Name 6823 </td> 6824 <td> 6825 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount) 6826 </td> 6827 </tr> 6828 productLoopCounter++; 6829 } 6830 6831 <tr> 6832 <td>&nbsp;</td> 6833 <td> 6834 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div> 6835 </td> 6836 </tr> 6837 </tbody> 6838 } 6839 @if (groupCount == 2) 6840 { 6841 <thead> 6842 <tr> 6843 <td>&nbsp;</td> 6844 @foreach (VariantOption variant in secondDimension) 6845 { 6846 <td>@variant.Name</td> 6847 } 6848 </tr> 6849 </thead> 6850 <tbody> 6851 @foreach (VariantOption firstVariantOption in firstDimension) 6852 { 6853 string variantId = ""; 6854 columnCount = 0; 6855 6856 <tr> 6857 <td class="u-min-w120px">@firstVariantOption.Name</td> 6858 6859 @foreach (VariantOption secondVariantOption in secondDimension) 6860 { 6861 variantId = firstVariantOption.Id + "." + secondVariantOption.Id; 6862 <td> 6863 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount) 6864 </td> 6865 6866 columnCount++; 6867 6868 productLoopCounter++; 6869 } 6870 6871 <td> 6872 <div class="qty-field js-total-qty-row-@rowCount dw-mod">0</div> 6873 </td> 6874 </tr> 6875 6876 rowCount++; 6877 } 6878 6879 @{ 6880 columnCount = 0; 6881 } 6882 6883 <tr> 6884 <td>&nbsp;</td> 6885 @foreach (VariantOption secondVariantOption in secondDimension) 6886 { 6887 <td> 6888 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div> 6889 </td> 6890 6891 columnCount++; 6892 } 6893 <td>&nbsp;</td> 6894 </tr> 6895 </tbody> 6896 } 6897 @if (groupCount == 3) 6898 { 6899 <thead> 6900 <tr> 6901 <td>&nbsp;</td> 6902 @foreach (VariantOption thirdVariantOption in thirdDimension) 6903 { 6904 <td>@thirdVariantOption.Name</td> 6905 } 6906 </tr> 6907 </thead> 6908 <tbody> 6909 @foreach (VariantOption firstVariantOption in firstDimension) 6910 { 6911 int colspan = (thirdDimension.Count + 1); 6912 6913 <tr> 6914 <td colspan="@colspan" class="u-color-light-gray--bg u-bold">@firstVariantOption.Name</td> 6915 </tr> 6916 6917 foreach (VariantOption secondVariantOption in secondDimension) 6918 { 6919 string variantId = ""; 6920 columnCount = 0; 6921 6922 <tr> 6923 <td class="u-min-w120px">@secondVariantOption.Name</td> 6924 6925 @foreach (VariantOption thirdVariantOption in thirdDimension) 6926 { 6927 variantId = firstVariantOption.Id + "." + secondVariantOption.Id + "." + thirdVariantOption.Id; 6928 6929 <td> 6930 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount) 6931 </td> 6932 6933 columnCount++; 6934 productLoopCounter++; 6935 } 6936 6937 <td> 6938 <div class="qty-field js-total-qty-row-@rowCount dw-mod">0</div> 6939 </td> 6940 </tr> 6941 rowCount++; 6942 } 6943 } 6944 6945 @{ 6946 columnCount = 0; 6947 } 6948 6949 <tr> 6950 <td>&nbsp;</td> 6951 @foreach (VariantOption thirdVariantOption in thirdDimension) 6952 { 6953 <td> 6954 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div> 6955 </td> 6956 6957 columnCount++; 6958 } 6959 <td>&nbsp;</td> 6960 </tr> 6961 </tbody> 6962 } 6963 </table> 6964 6965 <script> 6966 document.addEventListener("DOMContentLoaded", function (event) { 6967 MatrixUpdateQuantity("@settings.ProductId"); 6968 }); 6969 6970 MatrixUpdateQuantity = function (productId) { 6971 var currentMatrix = document.getElementById("VariantMatrixTable_" + productId); 6972 var allQtyFields = currentMatrix.getElementsByClassName("js-qty"); 6973 6974 var qtyRowArr = []; 6975 var qtyColumnArr = []; 6976 6977 var totalQty = 0; 6978 6979 for (var i = 0; i < allQtyFields.length; i++) { 6980 qtyRowArr[allQtyFields[i].getAttribute("data-qty-row-group")] = 0; 6981 qtyColumnArr[allQtyFields[i].getAttribute("data-qty-column-group")] = 0; 6982 } 6983 6984 for (var i = 0; i < allQtyFields.length; i++) { 6985 qtyRowArr[allQtyFields[i].getAttribute("data-qty-row-group")] += parseFloat(allQtyFields[i].value); 6986 qtyColumnArr[allQtyFields[i].getAttribute("data-qty-column-group")] += parseFloat(allQtyFields[i].value); 6987 totalQty += parseFloat(allQtyFields[i].value); 6988 } 6989 6990 //Update row counters 6991 for (var i = 0; i < qtyRowArr.length; i++) { 6992 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-row-" + i)[0]; 6993 6994 if (qtyRowArr[i] != undefined && qtyCounter != null) { 6995 var currentCount = qtyCounter.innerHTML; 6996 qtyCounter.innerHTML = qtyRowArr[i]; 6997 6998 if (currentCount != qtyCounter.innerHTML) { 6999 qtyCounter.classList.add("qty-field--active"); 7000 } 7001 } 7002 7003 } 7004 7005 //Update column counters 7006 for (var i = 0; i < qtyColumnArr.length; i++) { 7007 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-column-" + i)[0]; 7008 7009 if (qtyColumnArr[i] != undefined && qtyCounter != null) { 7010 var currentCount = qtyCounter.innerHTML; 7011 qtyCounter.innerHTML = qtyColumnArr[i]; 7012 7013 if (currentCount != qtyCounter.innerHTML) { 7014 qtyCounter.classList.add("qty-field--active"); 7015 } 7016 } 7017 } 7018 7019 if (document.getElementById("TotalQtyCount_" + productId)) { 7020 document.getElementById("TotalQtyCount_" + productId).innerHTML = totalQty; 7021 } 7022 7023 //Clean up animations 7024 setTimeout(function () { 7025 for (var i = 0; i < qtyRowArr.length; i++) { 7026 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-row-" + i)[0]; 7027 if (qtyCounter != null) { 7028 qtyCounter.classList.remove("qty-field--active"); 7029 } 7030 } 7031 for (var i = 0; i < qtyColumnArr.length; i++) { 7032 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-column-" + i)[0]; 7033 if (qtyCounter != null) { 7034 qtyCounter.classList.remove("qty-field--active"); 7035 } 7036 } 7037 }, 1000); 7038 } 7039 </script> 7040 } 7041 } 7042 7043 @helper RenderVariantMatrixQuantityField(string variantId, VariantMatrix settings, int productLoopCounter, int rowCount, int columnCount) 7044 { 7045 string loopCount = productLoopCounter.ToString(); 7046 7047 bool combinationFound = false; 7048 double stock = 0; 7049 double quantityValue = 0; 7050 string note = ""; 7051 7052 VariantProduct variantProduct = null; 7053 7054 if (settings.GetVariantProducts().TryGetValue(variantId, out variantProduct)) 7055 { 7056 stock = variantProduct.Stock; 7057 quantityValue = variantProduct.Quantity; 7058 combinationFound = true; 7059 } 7060 7061 if (combinationFound) 7062 { 7063 <input type="hidden" name="ProductLoopCounter@(loopCount)" value="@loopCount" /> 7064 <input type="hidden" name="ProductID@(loopCount)" value="@settings.ProductId" /> 7065 <input type="hidden" name="VariantID@(loopCount)" value="@variantId" /> 7066 <input type="hidden" name="CurrentNote@(loopCount)" id="CurrentNote_@(settings.ProductId)_@variantId" value="@note" /> 7067 <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"> 7068 7069 if (stock != 0) 7070 { 7071 <small>@Translate("Stock") @stock</small> 7072 } 7073 7074 <script> 7075 var variants = '{ "ProductId" :' + '"@settings.ProductId"' + ', "VariantId": ' + '"@variantId"' +'}'; 7076 variantsCollection.push(variants); 7077 document.getElementById("Quantity_@(settings.ProductId)_@variantId").closest(".js-variants-matrix").setAttribute("data-variants-collection", "[" + variantsCollection + "]" ); 7078 </script> 7079 } 7080 else 7081 { 7082 <div class="use-btn-height" style="background-color: #a8a8a8"></div> 7083 } 7084 } 7085 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 7086 7087 @* Component *@ 7088 7089 @helper RenderAddToCart(AddToCart settings) 7090 { 7091 //set Id for quantity selector to get it's value from button 7092 if (settings.QuantitySelector != null) 7093 { 7094 if (string.IsNullOrEmpty(settings.QuantitySelector.Id)) 7095 { 7096 settings.QuantitySelector.Id = Guid.NewGuid().ToString("N"); 7097 } 7098 7099 settings.AddButton.QuantitySelectorId = settings.QuantitySelector.Id; 7100 7101 if (settings.Disabled) 7102 { 7103 settings.QuantitySelector.Disabled = true; 7104 } 7105 7106 if (string.IsNullOrEmpty(settings.QuantitySelector.Name)) 7107 { 7108 settings.QuantitySelector.Name = settings.QuantitySelector.Id; 7109 } 7110 7111 settings.QuantitySelector.Max = "{{availableAmount}}"; 7112 } 7113 7114 if (settings.Disabled) 7115 { 7116 settings.AddButton.Disabled = true; 7117 } 7118 7119 settings.AddButton.CssClass += " btn--condensed"; 7120 7121 //unitsSelector 7122 if (settings.UnitSelector != null) 7123 { 7124 if (settings.Disabled) 7125 { 7126 settings.QuantitySelector.Disabled = true; 7127 } 7128 } 7129 7130 <div class="buttons-collection @settings.WrapperCssClass" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 7131 @if (settings.UnitSelector != null) 7132 { 7133 @Render(settings.UnitSelector) 7134 } 7135 @if (settings.QuantitySelector != null) 7136 { 7137 @Render(settings.QuantitySelector) 7138 } 7139 @Render(settings.AddButton) 7140 </div> 7141 } 7142 @using Dynamicweb.Core 7143 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 7144 @using Dynamicweb.Rapido.Blocks.Components.General 7145 7146 @* Component *@ 7147 7148 @helper RenderAddToCartButton(AddToCartButton settings) 7149 { 7150 if (!settings.HideTitle) 7151 { 7152 if (string.IsNullOrEmpty(settings.Title)) 7153 { 7154 if (settings.BuyForPoints) 7155 { 7156 settings.Title = Translate("Buy with points"); 7157 } 7158 else 7159 { 7160 settings.Title = Translate("Add to cart"); 7161 } 7162 } 7163 } 7164 else 7165 { 7166 settings.Title = ""; 7167 } 7168 7169 var webServiceConnectionAvailableTag = Pageview.GlobalTags.GetTagByName("Global:LiveIntegration.IsWebServiceConnectionAvailable"); 7170 var disableAddToCart = Pageview.AreaSettings.GetItem("Rizzo").GetBoolean("DisableAddToCarButton"); 7171 if (webServiceConnectionAvailableTag != null && !Converter.ToBoolean(webServiceConnectionAvailableTag.Value) && disableAddToCart) 7172 { 7173 settings.Disabled = true; 7174 settings.AltText = Translate("Temporarily unavailable"); 7175 } 7176 7177 if (settings.Icon == null) 7178 { 7179 settings.Icon = new Icon(); 7180 settings.Icon.LabelPosition = Dynamicweb.Rapido.Blocks.Components.General.IconLabelPosition.After; 7181 } 7182 7183 if (string.IsNullOrEmpty(settings.Icon.Name)) 7184 { 7185 settings.Icon.Name = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue; 7186 } 7187 7188 string cartArgs = "{ " + 7189 "id: '" + settings.ProductId + "'," + 7190 (!string.IsNullOrEmpty(settings.VariantId) ? "variantId: '" + settings.VariantId + "'," : "") + 7191 (!string.IsNullOrEmpty(settings.UnitId) ? "unitId: '" + settings.UnitId + "'," : "") + 7192 (settings.BuyForPoints ? "buyForPoints: true," : "") + 7193 (!string.IsNullOrEmpty(settings.ProductInfo) ? "productInfo: " + settings.ProductInfo + "," : "") + 7194 "quantity: " + (string.IsNullOrEmpty(settings.QuantitySelectorId) ? "1" : "parseFloat(document.getElementById('" + settings.QuantitySelectorId + "').value)") + 7195 "}"; 7196 string stockValidationUrl = Dna.StockValidation.Product.GetValidationUrl(GetPageIdByNavigationTag("StockValidation"), settings.ProductId, settings.VariantId, settings.UnitId, Pageview.Area.EcomLanguageId); 7197 7198 settings.OnClick = "StockValidation.AddToCartValidation(event, " + cartArgs + ", '" + stockValidationUrl + "');" + settings.OnClick; 7199 7200 @RenderButton(settings) 7201 } 7202 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 7203 7204 @* Component *@ 7205 7206 @helper RenderUnitSelector(UnitSelector settings) 7207 { 7208 var id = settings.Id; 7209 var disabledClass = settings.Disabled ? "disabled" : ""; 7210 7211 <input type="checkbox" id="@id" class="dropdown-trigger" /> 7212 <div class="dropdown unit-selector @settings.CssClass @disabledClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 7213 <label class="dropdown__header dropdown__btn dropdown__btn--unit-selector dw-mod" for="@id">@settings.SelectedOption</label> 7214 <div class="dropdown__content dw-mod"> 7215 @settings.OptionsContent 7216 </div> 7217 <label class="dropdown-trigger-off" for="@id"></label> 7218 </div> 7219 } 7220 @using System.Reflection 7221 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 7222 7223 @* Component *@ 7224 7225 @helper RenderQuantitySelector(QuantitySelector settings) 7226 { 7227 var attributes = new Dictionary<string, string>(); 7228 7229 /*base settings*/ 7230 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 7231 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 7232 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 7233 if (settings.Disabled) { attributes.Add("disabled", "true"); } 7234 if (settings.Required) { attributes.Add("required", "true"); } 7235 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 7236 /*end*/ 7237 7238 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 7239 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 7240 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 7241 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 7242 if (settings.Max != null) { attributes.Add("max", settings.Max.ToString()); } 7243 if (settings.Min == null) { settings.Min = 1; } 7244 attributes.Add("min", settings.Min.ToString()); 7245 if (settings.Step != null && !string.IsNullOrEmpty(settings.Step.ToString())) { attributes.Add("step", settings.Step.ToString()); } 7246 if (settings.Value == null) { settings.Value = 1; } 7247 attributes.Add("value", settings.Value.ToString()); 7248 attributes.Add("type", "number"); 7249 7250 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 7251 7252 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 7253 } 7254 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 7255 7256 @using System 7257 @using System.Web 7258 @using System.Collections.Generic 7259 @using Dynamicweb.Rapido.Blocks.Extensibility 7260 @using Dynamicweb.Rapido.Blocks 7261 7262 @{ 7263 BlocksPage bottomSnippetsBlocksPage = BlocksPage.GetBlockPage("Master"); 7264 7265 Block primaryBottomSnippets = new Block() 7266 { 7267 Id = "MasterJavascriptInitializers", 7268 SortId = 100, 7269 Template = RenderPrimaryBottomSnippets() 7270 }; 7271 bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, primaryBottomSnippets); 7272 } 7273 7274 @helper RenderPrimaryBottomSnippets() { 7275 bool isWireframeMode = Model.Area.Item.GetItem("Settings").GetBoolean("WireframeMode"); 7276 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 7277 7278 if (isWireframeMode) 7279 { 7280 <script> 7281 Wireframe.Init(true); 7282 </script> 7283 } 7284 7285 7286 if (useGoogleTagManager) 7287 { 7288 <script> 7289 document.addEventListener('addToCart', function(event) { 7290 var googleImpression = event.detail.productInfo.googleImpression; 7291 dataLayer.push({ 7292 'event': 'addToCart', 7293 'ecommerce': { 7294 'currencyCode': '@Dynamicweb.Ecommerce.Services.Currencies.GetDefaultCurrency().Code', 7295 'add': { 7296 'products': [{ 7297 'name': googleImpression.name, 7298 'id': googleImpression.id, 7299 'price': googleImpression.price, 7300 'brand': googleImpression.brand, 7301 'category': googleImpression.category, 7302 'variant': googleImpression.variant, 7303 'quantity': event.detail.quantity 7304 }] 7305 } 7306 } 7307 }); 7308 }); 7309 </script> 7310 } 7311 7312 //if digitalwarehouse 7313 if (Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart")) 7314 { 7315 string cartContextId = Converter.ToString(HttpContext.Current.Application["DownloadCartContext"]); 7316 7317 if (string.IsNullOrEmpty(cartContextId)) { 7318 var moduleProps = Dynamicweb.Modules.Properties.GetParagraphModuleSettings(GetPageIdByNavigationTag("DownloadCart"), "eCom_CartV2"); 7319 var cartSettings = new Dynamicweb.Ecommerce.Cart.ModuleSettings(moduleProps); 7320 cartContextId = cartSettings.OrderContextID; 7321 HttpContext.Current.Application["DownloadCartContext"] = cartContextId; 7322 } 7323 7324 <script> 7325 let downloadCart = new DownloadCart({ 7326 cartPageId: @GetPageIdByNavigationTag("MiniCartFeed"), 7327 contextId: "@cartContextId", 7328 addButtonText: "@Translate("Add")", 7329 removeButtonText: "@Translate("Remove")" 7330 }); 7331 </script> 7332 } 7333 7334 <!--@Javascripts--> 7335 } 7336 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 7337 7338 @using System 7339 @using System.Web 7340 @using System.Collections.Generic 7341 @using Dynamicweb.Rapido.Blocks 7342 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 7343 @using Dynamicweb.Rapido.Blocks 7344 @using Dynamicweb.Rapido.Blocks.Extensibility 7345 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 7346 @using System.Collections.Generic 7347 @using Dynamicweb.Core 7348 @using Dynamicweb.Rapido.Blocks 7349 @using Dynamicweb.Rapido.Blocks.Components.General 7350 @using Dynamicweb.Rapido.Blocks.Extensibility 7351 @{ 7352 BlocksPage masterBlockPage = BlocksPage.GetBlockPage("Master"); 7353 masterBlockPage.RemoveBlockById("ImpersonationBar"); 7354 7355 if (Model.CurrentUser.ID > 0 && Dna.AutoImpersonate.Helpers.AmountOfUserICanSetAsSecondary > 1) 7356 { 7357 masterBlockPage.Add(MasterBlockId.MasterHeader, new Block() 7358 { 7359 Id = "RizzoImpersonationBarContainer", 7360 SortId = 5, 7361 Design = new Design() 7362 { 7363 CssClass = "center-container", 7364 RenderType = RenderType.None 7365 }, 7366 BlocksList = new List<Block>() 7367 { 7368 new Block() 7369 { 7370 Id = "RizzoImpersonationBar", 7371 SortId = 5, 7372 Design = new Design() 7373 { 7374 Size = "12", 7375 CssClass = "grid--justify-end", 7376 RenderType = RenderType.Column 7377 }, 7378 Template = RenderRizzoImpersonationBar() 7379 } 7380 } 7381 }); 7382 7383 if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request[Dna.AutoImpersonate.Constants.Parameters.RequireManaging])) 7384 { 7385 masterBlockPage.Add(MasterBlockId.MasterMain, new Block() 7386 { 7387 Id = "RizzoRequireManageAccount", 7388 SortId = 15, 7389 Design = new Design() 7390 { 7391 Size = "width-auto", 7392 HidePadding = true, 7393 CssClass = "u-color-warning--bg", 7394 RenderType = RenderType.Column 7395 }, 7396 Template = RenderRizzoRequireManageAccount() 7397 }); 7398 } 7399 } 7400 } 7401 @helper RenderRizzoImpersonationBar() 7402 { 7403 bool isManagingAccount = Model.CurrentSecondaryUser.ID > 0; 7404 string switchAccountUrl = string.Format("Default.aspx?Id={0}", GetPageIdByNavigationTag(Dna.AutoImpersonate.Constants.PageProperties.NavigationTags.Impersonation)); 7405 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; 7406 7407 <div class="u-font-size--sm"> 7408 @string.Format("{0}: {1}", isManagingAccount ? Translate("Managing Account") : Translate("Welcome Back"), userName) 7409 @Render(new Link() 7410 { 7411 Href = switchAccountUrl, 7412 CssClass = "u-margin-left", 7413 ButtonLayout = ButtonLayout.None, 7414 Title = Translate("Manage Account"), 7415 Icon = new Icon() 7416 { 7417 Prefix = "fas", 7418 Name = "fa-address-book", 7419 LabelPosition = IconLabelPosition.After 7420 } 7421 }) 7422 @Render(new Link() 7423 { 7424 Href = "/Admin/Public/ExtranetLogoff.aspx", 7425 CssClass = "u-margin-left", 7426 ButtonLayout = ButtonLayout.None, 7427 Title = Translate("Logout"), 7428 Icon = new Icon() 7429 { 7430 Prefix = "fas", 7431 Name = "fa-sign-out", 7432 LabelPosition = IconLabelPosition.After 7433 } 7434 }) 7435 </div> 7436 } 7437 7438 @helper RenderRizzoRequireManageAccount() 7439 { 7440 <div class="center-container"> 7441 <div class="grid"> 7442 <div class="grid--align-self-center grid__col-x"> 7443 <div class="grid-cell u-bold"> 7444 @Render(new Icon 7445 { 7446 Prefix = "fas", 7447 Name = "fa-exclamation-triangle", 7448 Label = Translate("Please select an account to manage before continuing"), 7449 LabelPosition = IconLabelPosition.After 7450 }) 7451 </div> 7452 </div> 7453 </div> 7454 </div> 7455 } 7456 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 7457 @using Dynamicweb.Rapido.Blocks 7458 7459 @{ 7460 BlocksPage.GetBlockPage("Master").GetBlockById("MiniCartOrderLinesList").Template = RenderRizzoMiniCartOrderLinesList(); 7461 } 7462 7463 @helper RenderRizzoMiniCartOrderLinesList() 7464 { 7465 <text> 7466 {{#OrderLines}} 7467 {{#ifCond template "===" "CartOrderline"}} 7468 {{>MiniCartOrderline}} 7469 {{/ifCond}} 7470 {{#ifCond template "===" "CartOrderlineMobile"}} 7471 {{>MiniCartOrderline}}t 7472 {{/ifCond}} 7473 {{#ifCond template "===" "CartOrderlineDiscount"}} 7474 {{>MiniCartOrderlineDiscount}} 7475 {{/ifCond}} 7476 {{/OrderLines}} 7477 {{#OrderLinesOutOfStock}} 7478 {{#ifCond template "===" "CartOrderline"}} 7479 {{>MiniCartOrderline}} 7480 {{/ifCond}} 7481 {{#ifCond template "===" "CartOrderlineMobile"}} 7482 {{>MiniCartOrderline}} 7483 {{/ifCond}} 7484 {{#ifCond template "===" "CartOrderlineDiscount"}} 7485 {{>MiniCartOrderlineDiscount}} 7486 {{/ifCond}} 7487 {{/OrderLinesOutOfStock}} 7488 </text> 7489 } 7490 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 7491 @using System.Collections.Generic 7492 @using Dynamicweb.Rapido.Blocks.Components.General 7493 @using Dynamicweb.Rapido.Blocks.Extensibility 7494 @using Dynamicweb.Rapido.Blocks 7495 @using Dynamicweb.Core 7496 @functions{ 7497 BlocksPage rizzoErpConnectionBlocksPage = BlocksPage.GetBlockPage("Master"); 7498 } 7499 @{ 7500 var webServiceConnectionAvailableTag = Pageview.GlobalTags.GetTagByName("Global:LiveIntegration.IsWebServiceConnectionAvailable"); 7501 var showErpDownMessage = Model.Area.Item.GetItem("Rizzo").GetBoolean("ShowErpDownMessage"); 7502 if (webServiceConnectionAvailableTag != null && !Converter.ToBoolean(webServiceConnectionAvailableTag.Value) && showErpDownMessage) 7503 { 7504 rizzoErpConnectionBlocksPage.Add(MasterBlockId.MasterMain, new Block() 7505 { 7506 Id = "RizzoNoErpConnection", 7507 SortId = 15, 7508 Design = new Design { Size = "width-auto", HidePadding = true, CssClass = "u-color-danger--bg", RenderType = RenderType.Column }, 7509 BlocksList = new List<Block> 7510 { 7511 new Block 7512 { 7513 Id = "RizzoNoErpConnectionContainer", 7514 SortId = 10, 7515 Design = new Design { RenderType = RenderType.None, CssClass = "center-container content-container"}, 7516 SkipRenderBlocksList = true, 7517 Template = RenderRizzoNoErpConnectionContainer(), 7518 BlocksList = new List<Block> 7519 { 7520 new Block 7521 { 7522 Id = "RizzoNoErpConnectionMessage", 7523 SortId = 10, 7524 Design = new Design { Size = "12", RenderType = RenderType.Column, CssClass = "u-padding--lg"}, 7525 Component = new Heading { 7526 Level = 0, 7527 CssClass = "grid-cell u-bold", 7528 Title = Translate("Currently we are down for maintenance. We expect to be back soon."), 7529 Icon = new Icon {Prefix = "fas", Name = "fa-exclamation-triangle", LabelPosition = IconLabelPosition.After} 7530 } 7531 } 7532 } 7533 } 7534 } 7535 }); 7536 } 7537 } 7538 7539 @helper RenderRizzoNoErpConnectionContainer() 7540 { 7541 @RenderBlockList(rizzoErpConnectionBlocksPage.GetBlockById("RizzoNoErpConnectionContainer").BlocksList) 7542 } 7543 @{ 7544 var rizzoReferencesBlocksPage = BlocksPage.GetBlockPage("Master"); 7545 var masterScriptRizzoReferences = new Block() 7546 { 7547 Id = "MasterScriptRizzoReferences", 7548 SortId = 2, 7549 Template = RenderMasterScriptRizzoReferences() 7550 }; 7551 rizzoReferencesBlocksPage.Add(MasterBlockId.MasterReferences, masterScriptRizzoReferences); 7552 } 7553 @helper RenderMasterScriptRizzoReferences() { 7554 if (Model.Area.Item.GetItem("Rizzo").GetBoolean("UseRizzoJavascript")) 7555 { 7556 var minify = Model.Area.Item.GetItem("Rizzo").GetBoolean("MinifyJavascript");; 7557 const string folderName = "rizzo"; 7558 var rizzoBundle = Dna.Optimizer.Renderer.RenderScripts($"/Files/Templates/Designs/Rapido/js/{folderName}", $"-{folderName}-scripts", new List<string>(), new List<string>(), minify, false, false); 7559 <script src="@rizzoBundle"></script> 7560 PushPromise(rizzoBundle); 7561 } 7562 } 7563 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 7564 @using Dynamicweb.Rapido.Blocks 7565 @using Dynamicweb.Rapido.Blocks.Extensibility 7566 @{ 7567 var rizzoPackagesReferencesBlocksPage = BlocksPage.GetBlockPage("Master"); 7568 var masterScriptRizzoPackagesReferences = new Block() 7569 { 7570 Id = "MasterScriptRizzoPackagesReferences", 7571 SortId = 2, 7572 Template = RenderMasterScriptRizzoPackagesReferences() 7573 }; 7574 rizzoPackagesReferencesBlocksPage.Add(MasterBlockId.MasterReferences, masterScriptRizzoPackagesReferences); 7575 } 7576 @helper RenderMasterScriptRizzoPackagesReferences() { 7577 if (Model.Area.Item.GetItem("RizzoPackages").GetBoolean("UseRizzoJavascript")) 7578 { 7579 var minify = Model.Area.Item.GetItem("Rizzo").GetBoolean("MinifyJavascript");; 7580 const string folderName = "rizzoPackages"; 7581 var rizzoPackagesBundle = Dna.Optimizer.Renderer.RenderScripts($"/Files/Templates/Designs/Rapido/js/{folderName}", $"-{folderName}-scripts", new List<string>(), new List<string>(), minify, false, false); 7582 <script src="@rizzoPackagesBundle"></script> 7583 PushPromise(rizzoPackagesBundle); 7584 } 7585 } 7586 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 7587 7588 @using System.Collections.Generic 7589 @using Dynamicweb.Rapido.Blocks 7590 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 7591 7592 @{ 7593 BlocksPage customSearchBlocksPage = BlocksPage.GetBlockPage("Master"); 7594 7595 if (customSearchBlocksPage.GetBlockById("MasterSearchScriptTemplates") != null) 7596 { 7597 customSearchBlocksPage.GetBlockById("MasterSearchScriptTemplates").Template = RenderSearchScriptTemplatesCustom(); 7598 } 7599 } 7600 7601 @helper RenderSearchScriptTemplatesCustom() 7602 { 7603 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 7604 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 7605 bool useFacebookPixel = !string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID")); 7606 bool useGoogleTagManager = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID")); 7607 bool showPrice = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HidePriceInSearchResults"); 7608 bool showAddToCartButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideAddToCartButton"); 7609 bool showViewButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideViewButton"); 7610 bool showAddToDownloadButton = Pageview.AreaSettings.GetItem("Layout").GetBoolean("ShowAddToDownloadButton"); 7611 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 7612 7613 <script id="SearchGroupsTemplate" type="text/x-template"> 7614 {{#.}} 7615 <li class="dropdown__item dw-mod" onclick="Search.UpdateGroupSelection(this)" data-group-id="{{id}}">{{name}}</li> 7616 {{/.}} 7617 </script> 7618 7619 <script id="SearchProductsTemplate" type="text/x-template"> 7620 {{#each .}} 7621 {{#Product}} 7622 {{#ifCond template "!==" "SearchMore"}} 7623 <li class="dropdown__item dropdown__item--seperator dw-mod"> 7624 @if (useFacebookPixel) 7625 { 7626 <text>{{{facebookPixelSearch name number priceDouble currency searchParameter}}}</text> 7627 } 7628 @if (useGoogleTagManager) 7629 { 7630 <text>{{{googleEnchantImpression 'Search results' currency googleImpression}}}</text> 7631 } 7632 <div> 7633 <a href="{{link}}" class="js-typeahead-link u-color-inherit u-pull--left" onclick="{{googleImpressionClick}}" title="{{name}}{{#if variantName}}, {{variantName}}{{/if}}"> 7634 <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> 7635 <div class="u-pull--left"> 7636 @*START CUSTOM CODE*@ 7637 <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> 7638 @*END CUSTOM CODE*@ 7639 @if (showPrice && Dynamicweb.Rapido.Services.User.IsPricesAllowed()) 7640 { 7641 if (pointShopOnly) 7642 { 7643 <text> 7644 {{#if havePointPrice}} 7645 <div> 7646 <span class="u-color--loyalty-points">{{points}}</span> @Translate("points") 7647 </div> 7648 {{else}} 7649 <small class="help-text u-no-margin">@Translate("Not available")</small> 7650 {{/if}} 7651 {{#unless canBePurchasedWithPoints}} 7652 {{#if havePointPrice}} 7653 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small> 7654 {{/if}} 7655 {{/unless}} 7656 </text> 7657 } 7658 else 7659 { 7660 <div>{{price}}</div> 7661 } 7662 } 7663 </div> 7664 </a> 7665 <div class="u-margin-left u-pull--right"> 7666 @{ 7667 var viewBtn = new Link 7668 { 7669 Href = "{{link}}", 7670 OnClick = "{{googleImpressionClick}}", 7671 ButtonLayout = ButtonLayout.Secondary, 7672 CssClass = "btn--condensed u-no-margin u-w80px js-ignore-click-outside", 7673 Title = Translate("View") 7674 }; 7675 } 7676 @if (showAddToCartButton && Dynamicweb.Rapido.Services.User.IsBuyingAllowed()) 7677 { 7678 <text>{{#if hideAddToCartButton}}</text> 7679 @Render(viewBtn) 7680 <text>{{else}}</text> 7681 @Render(new AddToCartButton 7682 { 7683 HideTitle = true, 7684 ProductId = "{{productId}}", 7685 ProductInfo = "{{productInfo}}", 7686 BuyForPoints = pointShopOnly, 7687 OnClick = "{{facebookPixelAction}}", 7688 CssClass = "u-w80px js-ignore-click-outside", 7689 Icon = new Icon { 7690 CssClass = "js-ignore-click-outside" 7691 }, 7692 ExtraAttributes = new Dictionary<string, string> 7693 { 7694 { "{{disabledBuyButton}}", "" }, 7695 { "{{outOfStock}}", "" } 7696 } 7697 }) 7698 <text>{{/if}}</text> 7699 } 7700 else if (showViewButton) 7701 { 7702 @Render(viewBtn) 7703 } 7704 @if (showAddToDownloadButton) 7705 { 7706 <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}}"> 7707 <i class="fas fa-plus js-button-icon"></i> 7708 </button> 7709 } 7710 </div> 7711 </div> 7712 </li> 7713 {{/ifCond}} 7714 {{#ifCond template "===" "SearchMore"}} 7715 {{>SearchMoreProducts}} 7716 {{/ifCond}} 7717 {{/Product}} 7718 {{else}} 7719 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod"> 7720 @Translate("Your search gave 0 results") 7721 </li> 7722 {{/each}} 7723 </script> 7724 7725 <script id="SearchMoreProducts" type="text/x-template"> 7726 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 7727 <a href="/Default.aspx?ID=@productsPageId&Search={{searchParameter}}&GroupID={{groupId}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 7728 @Translate("View all") 7729 </a> 7730 </li> 7731 </script> 7732 7733 <script id="SearchMorePages" type="text/x-template"> 7734 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 7735 <a href="/Default.aspx?ID=@contentSearchPageLink&Search={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 7736 @Translate("View all") 7737 </a> 7738 </li> 7739 </script> 7740 7741 <script id="SearchPagesTemplate" type="text/x-template"> 7742 {{#each .}} 7743 {{#ifCond template "!==" "SearchMore"}} 7744 <li class="dropdown__item dropdown__item--seperator dw-mod"> 7745 <div> 7746 <a href="/Default.aspx?ID={{id}}" class="js-typeahead-link u-pull--left u-color-inherit"> 7747 <div class="u-margin-right u-pull--left"><i class="fa {{icon}} u-w20px u-ta-center"></i></div> 7748 <div class="u-pull--left"> 7749 <div class="u-bold u-truncate-text u-max-w220px js-typeahead-name">{{name}}</div> 7750 </div> 7751 </a> 7752 </div> 7753 </li> 7754 {{/ifCond}} 7755 {{#ifCond template "===" "SearchMore"}} 7756 {{>SearchMorePages}} 7757 {{/ifCond}} 7758 {{else}} 7759 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod"> 7760 @Translate("Your search gave 0 results") 7761 </li> 7762 {{/each}} 7763 </script> 7764 7765 <script id="SearchPagesTemplateWrap" type="text/x-template"> 7766 <div class="dropdown__column-header">@Translate("Pages")</div> 7767 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod"> 7768 {{>SearchPagesTemplate}} 7769 </ul> 7770 </script> 7771 7772 <script id="SearchProductsTemplateWrap" type="text/x-template"> 7773 <div class="dropdown__column-header">@Translate("Products")</div> 7774 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod"> 7775 {{>SearchProductsTemplate}} 7776 </ul> 7777 </script> 7778 } 7779 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 7780 7781 @using Dynamicweb.Rapido.Blocks 7782 7783 @{ 7784 var customMiniCartBlocksPage = BlocksPage.GetBlockPage("Master"); 7785 var orderlinesViewCustom = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView").SelectedValue : "table"; 7786 var orderLinesScriptTemplates = customMiniCartBlocksPage.GetBlockById("OrderlinesScriptTemplates"); 7787 7788 if (orderlinesViewCustom == "table") 7789 { 7790 orderLinesScriptTemplates.Template = RenderMiniCartScriptsTableTemplatesCustom(); 7791 } 7792 else 7793 { 7794 orderLinesScriptTemplates.Template = RenderMiniCartScriptsListTemplatesCustom(); 7795 } 7796 } 7797 7798 @helper RenderMiniCartScriptsTableTemplatesCustom() 7799 { 7800 <script id="MiniCartOrderline" type="text/x-template"> 7801 {{#unless isEmpty}} 7802 <tr> 7803 <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="{{productnumber}}" title="{{productnumber}}"></a></td> 7804 <td class="u-va-middle"> 7805 @*START CUSTOM CODE*@ 7806 <a href="{{link}}" class="mini-cart-orderline__name" title="{{productnumber}}"><span class="u-clearfix">{{productnumber}}</span>{{#unless variantname}}{{name}}{{/unless}}</a> 7807 @*END CUSTOM CODE*@ 7808 </td> 7809 <td class="u-ta-right u-va-middle">{{quantity}}</td> 7810 <td class="u-ta-right u-va-middle"> 7811 {{#if pointsTotal}} 7812 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 7813 {{else}} 7814 {{totalprice}} 7815 {{/if}} 7816 </td> 7817 </tr> 7818 {{/unless}} 7819 </script> 7820 7821 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 7822 {{#unless isEmpty}} 7823 <tr class="table__row--no-border"> 7824 <td class="u-w60px">&nbsp;</td> 7825 @*START CUSTOM CODE*@ 7826 <td><div class="mini-cart-orderline__name dw-mod"><span class="u-clearfix">{{productnumber}}</span>{{#unless variantname}}{{name}}{{/unless}}</div></td> 7827 @*END CUSTOM CODE*@ 7828 <td class="u-ta-right">&nbsp;</td> 7829 <td class="u-ta-right">{{totalprice}}</td> 7830 </tr> 7831 {{/unless}} 7832 </script> 7833 } 7834 7835 @helper RenderMiniCartScriptsListTemplatesCustom() 7836 { 7837 int cartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 7838 7839 <script id="MiniCartOrderline" type="text/x-template"> 7840 {{#unless isEmpty}} 7841 <div class="mini-cart-orderline grid dw-mod"> 7842 <div class="grid__col-4"> 7843 <a href="{{link}}" class="{{hideimage}}"> 7844 <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="{{productnumber}}"> 7845 </a> 7846 </div> 7847 <div class="grid__col-8"> 7848 @*START CUSTOM CODE*@ 7849 <a href="{{link}}" class="mini-cart-orderline__name mini-cart-orderline__name--truncate mini-cart-orderline__name--md u-padding-right--lg" title="{{productnumber}}"><span class="u-clearfix">{{productnumber}}</span>{{#unless variantname}}{{name}}{{/unless}}</a> 7850 @*END CUSTOM CODE*@ 7851 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Qty"): {{quantity}}</div> 7852 7853 <div class="grid__cell-footer"> 7854 <div class="grid__cell"> 7855 <div class="u-pull--left mini-cart-orderline__price dw-mod"> 7856 {{#if pointsTotal}} 7857 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 7858 {{else}} 7859 {{totalprice}} 7860 {{/if}} 7861 </div> 7862 @* ASI CUSTOM CODE START *@ 7863 <button type="button" title="@Translate("Remove line")" 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> 7864 @* ASI CUSTOM CODE END *@ 7865 </div> 7866 </div> 7867 </div> 7868 </div> 7869 {{/unless}} 7870 </script> 7871 7872 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 7873 {{#unless isEmpty}} 7874 <div class="mini-cart-orderline mini-cart-orderline--discount grid dw-mod"> 7875 <div class="grid__col-4"> 7876 @*START CUSTOM CODE*@ 7877 <div class="mini-cart-orderline__name mini-cart-orderline__name dw-mod"><span class="u-clearfix">{{productnumber}}</span>{{#unless variantname}}{{name}}{{/unless}}</div> 7878 @*END CUSTOM CODE*@ 7879 </div> 7880 <div class="grid__col-8">{{totalprice}}</div> 7881 </div> 7882 {{/unless}} 7883 </script> 7884 } 7885 @{ 7886 BlocksPage masterCustomBlocksPage = BlocksPage.GetBlockPage("Master"); 7887 7888 } 7889 7890 7891 @functions { 7892 public class ManifestIcon 7893 { 7894 public string src { get; set; } 7895 public string type { get; set; } 7896 public string sizes { get; set; } 7897 } 7898 7899 public class Manifest 7900 { 7901 public string name { get; set; } 7902 public string short_name { get; set; } 7903 public string start_url { get; set; } 7904 public string display { get; set; } 7905 public string background_color { get; set; } 7906 public string theme_color { get; set; } 7907 public List<ManifestIcon> icons { get; set; } 7908 } 7909 } 7910 7911 <!DOCTYPE html> 7912 7913 <html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName"> 7914 7915 7916 7917 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 7918 @RenderBlockList(masterPage.BlocksRoot.BlocksList) 7919 7920 7921 7922 @helper RenderMasterHead() { 7923 List<Block> subBlocks = this.masterPage.GetBlockListById("Head").OrderBy(item => item.SortId).ToList(); 7924 7925 <head> 7926 <!-- Rapido version 3.2 --> 7927 7928 @RenderBlockList(subBlocks) 7929 </head> 7930 } 7931 7932 @helper RenderMasterMetadata() { 7933 var swatches = new Dynamicweb.Content.Items.ColorSwatchService(); 7934 var brandColors = swatches.GetColorSwatch(1); 7935 string brandColorOne = brandColors.Palette["BrandColor1"]; 7936 7937 if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName")) && Model.Area.Item.GetItem("Settings").GetFile("AppIcon") != null) { 7938 Manifest manifest = new Manifest 7939 { 7940 name = Model.Area.Item.GetItem("Settings").GetString("AppName"), 7941 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"), 7942 start_url = "/", 7943 display = "standalone", 7944 background_color = Model.Area.Item.GetItem("Settings").GetString("AppBackgroundColor"), 7945 theme_color = Model.Area.Item.GetItem("Settings").GetString("AppThemeColor") 7946 }; 7947 7948 manifest.icons = new List<ManifestIcon> { 7949 new ManifestIcon { 7950 src = "/Admin/Public/GetImage.ashx?width=192&height=192&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 7951 sizes = "192x192", 7952 type = "image/png" 7953 }, 7954 new ManifestIcon { 7955 src = "/Admin/Public/GetImage.ashx?width=512&height=512&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 7956 sizes = "512x512", 7957 type = "image/png" 7958 }, 7959 new ManifestIcon { 7960 src = "/Admin/Public/GetImage.ashx?width=1024&height=1024&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 7961 sizes = "1024x1024", 7962 type = "image/png" 7963 } 7964 }; 7965 7966 string manifestFilePath = HttpContext.Current.Request.MapPath("/Files/Templates/Designs/Rapido/manifest.json"); 7967 string manifestJSON = Newtonsoft.Json.JsonConvert.SerializeObject(manifest); 7968 string currentManifest = File.ReadAllText(manifestFilePath); 7969 7970 if (manifestJSON != currentManifest) 7971 { 7972 File.WriteAllText(manifestFilePath, manifestJSON); 7973 } 7974 } 7975 7976 <meta charset="utf-8" /> 7977 <title>@Model.Title</title> 7978 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 7979 <meta name="robots" content="index, follow"> 7980 <meta name="theme-color" content="@brandColorOne" /> 7981 7982 if (!Model.MetaTags.Contains("og:image")) { 7983 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"))); 7984 } 7985 7986 if (!Model.MetaTags.Contains("og:description")) { 7987 Pageview.Meta.AddTag("og:description", Model.Description); 7988 } 7989 7990 Pageview.Meta.AddTag("og:title", Model.Title); 7991 Pageview.Meta.AddTag("og:site_name", Model.Name); 7992 Pageview.Meta.AddTag("og:url", HttpContext.Current.Request.Url.ToString()); 7993 Pageview.Meta.AddTag("og:type", "Website"); 7994 Pageview.Meta.AddTag("fb:page_id", Model.ID.ToString()); 7995 7996 @Model.MetaTags 7997 } 7998 7999 @helper RenderMasterCss() { 8000 var fonts = new string[] { 8001 getFontFamily("Layout", "HeaderFont"), 8002 getFontFamily("Layout", "SubheaderFont"), 8003 getFontFamily("Layout", "TertiaryHeaderFont"), 8004 getFontFamily("Layout", "BodyText"), 8005 getFontFamily("Layout", "Header", "ToolsFont"), 8006 getFontFamily("Layout", "Header", "NavigationFont"), 8007 getFontFamily("Layout", "MobileNavigation", "Font"), 8008 getFontFamily("ProductList", "Facets", "HeaderFont"), 8009 getFontFamily("ProductPage", "PriceFontDesign"), 8010 getFontFamily("Ecommerce", "SaleSticker", "Font"), 8011 getFontFamily("Ecommerce", "NewSticker", "Font"), 8012 getFontFamily("Ecommerce", "CustomSticker", "Font") 8013 }; 8014 8015 string autoCssLink = "/Files/Templates/Designs/Rapido/css/rapido/rapido_" + Model.Area.ID.ToString() + ".min.css?ticks=" + Model.Area.UpdatedDate.Ticks; 8016 string favicon = Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon").Path : "/Files/Images/favicon.png"; 8017 bool useFontAwesomePro = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetBoolean("UseFontAwesomePro"); 8018 string fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomeFree/css/fontawesome-all.min.css"; 8019 if (useFontAwesomePro) 8020 { 8021 fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomePro/css/fontawesome-all.min.css"; 8022 } 8023 8024 /* Optimizer variables */ 8025 var minify = Model.Area.Item.GetItem("Rizzo").GetBoolean("MinifyCss");; 8026 var folderName = string.Empty; 8027 var rizzoBundle = string.Empty; 8028 var rizzoPackagesBundle = string.Empty; 8029 var igniteBundle = string.Empty; 8030 var variablesFile = "/Files/Templates/Designs/Rapido/css/rapido/_variables_" + Model.Area.ID + ".auto.less"; 8031 8032 //Favicon 8033 <link href="@favicon" rel="icon" type="image/png"> 8034 8035 //Base (Default, wireframe) styles 8036 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/base/base.min.css" type="text/css"> 8037 8038 //Rapido Css from Website Settings 8039 <link rel="stylesheet" id="rapidoCss" href="@autoCssLink" type="text/css"> 8040 8041 if (Model.Area.Item.GetItem("Rizzo").GetBoolean("UseRizzoCss")) 8042 { 8043 <!-- Rizzo Css (DWNA specific styles) --> 8044 folderName = "rizzo"; 8045 rizzoBundle = Dna.Optimizer.Renderer.RenderStyles($"/Files/Templates/Designs/Rapido/css/{folderName}", $"-{folderName}-styles", new [] {variablesFile}, new[] { $"{folderName}.css", $"{folderName}.min.css" }, minify, false, false); 8046 <link id="rizzoCss" type="text/css" rel="stylesheet" href="@rizzoBundle" /> 8047 } 8048 if (Model.Area.Item.GetItem("RizzoPackages").GetBoolean("UseRizzoCss")) 8049 { 8050 <!-- Rizzo Packages Css (DWNA packages specific styles) --> 8051 folderName = "rizzoPackages"; 8052 rizzoPackagesBundle = Dna.Optimizer.Renderer.RenderStyles($"/Files/Templates/Designs/Rapido/css/{folderName}", $"-{folderName}-styles", new [] {variablesFile}, new[] { $"{folderName}.css", $"{folderName}.min.css" }, minify, false, false); 8053 <link id="rizzoPackagesCss" type="text/css" rel="stylesheet" href="@rizzoPackagesBundle" /> 8054 } 8055 8056 //Ignite Css (Custom site specific styles) 8057 folderName = "ignite"; 8058 igniteBundle = Dna.Optimizer.Renderer.RenderStyles($"/Files/Templates/Designs/Rapido/css/{folderName}", $"-{folderName}-styles", new [] {variablesFile}, new[] { $"{folderName}.css", $"{folderName}.min.css" }, minify, false, false); 8059 <link id="igniteCss" type="text/css" rel="stylesheet" href="@igniteBundle" /> 8060 8061 //Font awesome 8062 <link rel="stylesheet" href="@fontAwesomeCssLink" type="text/css"> 8063 8064 //Flag icon 8065 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css" type="text/css"> 8066 8067 //Google fonts 8068 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))); 8069 8070 <link href="https://fonts.googleapis.com/css?family=@family" rel="stylesheet"> 8071 8072 PushPromise(favicon); 8073 PushPromise(fontAwesomeCssLink); 8074 PushPromise("/Files/Templates/Designs/Rapido/css/base/base.min.css"); 8075 PushPromise(autoCssLink); 8076 if (Model.Area.Item.GetItem("Rizzo").GetBoolean("UseRizzoCss")) 8077 { 8078 PushPromise(rizzoBundle); 8079 } 8080 if (Model.Area.Item.GetItem("RizzoPackages").GetBoolean("UseRizzoCss")) 8081 { 8082 PushPromise(rizzoPackagesBundle); 8083 } 8084 PushPromise(igniteBundle); 8085 PushPromise("/Files/Images/placeholder.gif"); 8086 PushPromise("/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css"); 8087 } 8088 8089 @helper RenderMasterManifest() { 8090 if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName"))) 8091 { 8092 <link rel="manifest" href="/Files/Templates/Designs/Rapido/manifest.json"> 8093 PushPromise("/Files/Templates/Designs/Rapido/manifest.json"); 8094 } 8095 } 8096 8097 @helper RenderMasterBody() { 8098 List<Block> subBlocks = this.masterPage.GetBlockListById("Body").OrderBy(item => item.SortId).ToList(); 8099 string designLayout = Model.PropertyItem.GetItem("CustomSettings") != null ? Model.PropertyItem.GetItem("CustomSettings").GetString("DesignLayout") != null ? Model.PropertyItem.GetItem("CustomSettings").GetList("DesignLayout").SelectedValue : "" : ""; 8100 if (!String.IsNullOrEmpty(designLayout)) { 8101 designLayout = "class=\"" + designLayout + "\""; 8102 } 8103 8104 <body @designLayout> 8105 @RenderBlockList(subBlocks) 8106 </body> 8107 } 8108 8109 @helper RenderMasterHeader() 8110 { 8111 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterHeader").OrderBy(item => item.SortId).ToList(); 8112 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 8113 string stickyTop = isNavigationStickyMenu ? "top-container--sticky" : ""; 8114 8115 <header class="top-container @stickyTop dw-mod" id="Top"> 8116 @RenderBlockList(subBlocks) 8117 </header> 8118 } 8119 8120 @helper RenderMain() 8121 { 8122 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMain").OrderBy(item => item.SortId).ToList(); 8123 8124 <main class="site dw-mod"> 8125 @RenderBlockList(subBlocks) 8126 </main> 8127 } 8128 8129 @helper RenderPageContent() 8130 { 8131 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 8132 string pagePos = isNavigationStickyMenu ? "js-page-pos" : ""; 8133 8134 <div id="Page" class="page @pagePos"> 8135 <section class="center-container content-container dw-mod" id="content"> 8136 8137 @RenderSnippet("Content") 8138 </section> 8139 </div> 8140 } 8141 8142 @* Hack to support nested helpers *@ 8143 @SnippetStart("Content") 8144 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 8145 8146 8147 8148 @using Dynamicweb.Rapido.Blocks.Components.General 8149 @using Dynamicweb.Rapido.Blocks 8150 8151 @functions { 8152 BlocksPage page = BlocksPage.GetBlockPage("Page"); 8153 } 8154 8155 @{ 8156 bool isProductPage = HttpContext.Current.Request.QueryString.Get("ProductID") != null; 8157 string backgroundColorClass = Model.PropertyItem.GetList("BackgroundColor") != null && !isProductPage ? "u-" + Model.PropertyItem.GetList("BackgroundColor").SelectedValue + "--bg" : ""; 8158 string navigationMarkup = ""; 8159 8160 Block pageContainer = new Block 8161 { 8162 Id = "PageContainer", 8163 SortId = 10, 8164 BlocksList = new List<Block> { 8165 new Block { 8166 Id = "PageRow", 8167 SortId = 20, 8168 Design = new Design { 8169 RenderType = RenderType.Row 8170 } 8171 } 8172 } 8173 }; 8174 page.Add(pageContainer); 8175 8176 if (Model.PropertyItem.GetList("ShowBreadcrumb") != null && Model.PropertyItem.GetList("ShowBreadcrumb").SelectedValue == "True") 8177 { 8178 Block breadcrumbNavigation = new Block 8179 { 8180 Id = "PageBreadcrumbNavigation", 8181 SortId = 10, 8182 Component = new BreadcrumbNavigation { Id = "breadcrumb", Template = "Breadcrumb.xslt", SitemapMode = true } 8183 }; 8184 page.Add("PageContainer", breadcrumbNavigation); 8185 } 8186 8187 if (Model.PropertyItem.GetList("LeftMenu") != null && Model.PropertyItem.GetList("LeftMenu").SelectedValue == "True" && (Pageview.Page.NavigationSettings == null || !Pageview.Page.NavigationSettings.UseEcomGroups)) 8188 { 8189 navigationMarkup = RenderNavigation(new 8190 { 8191 id = "leftnav", 8192 cssclass = "dwnavigation", 8193 startLevel = 2, 8194 expandmode = "all", 8195 endlevel = 5, 8196 template = "LeftNavigation.xslt" 8197 }); 8198 8199 if (!string.IsNullOrEmpty(navigationMarkup)) 8200 { 8201 Block leftNavigation = new Block 8202 { 8203 Id = "PageLeftNavigation", 8204 SortId = 10, 8205 Component = new LeftNavigation { Id = "leftnav", CssClass = "dwnavigation", StartLevel = 2, EndLevel = 5, Expandmode = "all", Template = "LeftNavigation.xslt" }, 8206 Design = new Design 8207 { 8208 RenderType = RenderType.Column, 8209 Size = "3" 8210 } 8211 }; 8212 page.Add("PageRow", leftNavigation); 8213 } 8214 } 8215 8216 string contentColumnSize = !string.IsNullOrEmpty(navigationMarkup) ? "9" : "12"; 8217 8218 Block pageContent = new Block 8219 { 8220 Id = "PageContent", 8221 SortId = 20, 8222 Design = new Design 8223 { 8224 RenderType = RenderType.Column, 8225 Size = contentColumnSize, 8226 CssClass = "grid__col--bleed" 8227 }, 8228 BlocksList = new List<Block> { 8229 new Block { 8230 Id = "PageContentRow", 8231 SortId = 10, 8232 Component = new Text { Content = @Model.Placeholder("dwcontent", "content", "default:true;sort:1") }, 8233 Design = new Design { 8234 RenderType = RenderType.Row 8235 } 8236 } 8237 } 8238 }; 8239 page.Add("PageRow", pageContent); 8240 } 8241 8242 @using System 8243 @using System.Web 8244 @using System.Collections.Generic 8245 @using Dynamicweb.Rapido.Blocks 8246 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 8247 @using Dynamicweb.Rapido.Blocks 8248 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 8249 @using Dynamicweb.Rapido.Blocks 8250 @{ 8251 BlocksPage pageCustomBlocksPage = BlocksPage.GetBlockPage("Page"); 8252 8253 } 8254 8255 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 8256 @RenderBlockList(page.BlocksRoot.BlocksList) 8257 8258 8259 @* Very small hack to make it cleanly, and easily possible to change the background color on a single page *@ 8260 @if (backgroundColorClass != "") 8261 { 8262 <script> 8263 document.getElementById("Page").classList.add("@backgroundColorClass"); 8264 </script> 8265 } 8266 @SnippetEnd("Content") 8267 8268 </html> 8269 8270