Error executing template "Designs/Rapido/_parsed/ContentPage.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_4e95b80818b5418fbec0df00712df632.<RenderMasterBody>b__204_0(TextWriter __razor_helper_writer) in E:\dynamicweb.net\Solutions\staging.nordenta.dk\Application\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 8554
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_4e95b80818b5418fbec0df00712df632.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in E:\dynamicweb.net\Solutions\staging.nordenta.dk\Application\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 254
   at CompiledRazorTemplates.Dynamic.RazorEngine_4e95b80818b5418fbec0df00712df632.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in E:\dynamicweb.net\Solutions\staging.nordenta.dk\Application\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 164
   at CompiledRazorTemplates.Dynamic.RazorEngine_4e95b80818b5418fbec0df00712df632.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in E:\dynamicweb.net\Solutions\staging.nordenta.dk\Application\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 287
   at CompiledRazorTemplates.Dynamic.RazorEngine_4e95b80818b5418fbec0df00712df632.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in E:\dynamicweb.net\Solutions\staging.nordenta.dk\Application\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 164
   at CompiledRazorTemplates.Dynamic.RazorEngine_4e95b80818b5418fbec0df00712df632.Execute() in E:\dynamicweb.net\Solutions\staging.nordenta.dk\Application\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 8393
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

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