Error executing template "Designs/Rapido/eCom/Productlist/ProductsRender.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
at Dynamicweb.Ecommerce.Products.GroupService.GetSubgroups(Group group, Boolean showUnTranslated)
at Dynamicweb.Ecommerce.Products.GroupService.HasSubgroups(Group group)
at CompiledRazorTemplates.Dynamic.RazorEngine_92fda890f80543e5888ada44d834dbb4.<RenderPageContainer>b__97_0(TextWriter __razor_helper_writer) in D:\wwwroot\nevotex\Files\Templates\Designs\Rapido\eCom\Productlist\ProductsRender.cshtml:line 4316
at RazorEngine.Templating.TemplateWriter.ToString()
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at CompiledRazorTemplates.Dynamic.RazorEngine_92fda890f80543e5888ada44d834dbb4.<>c__DisplayClass5_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\wwwroot\nevotex\Files\Templates\Designs\Rapido\eCom\Productlist\ProductsRender.cshtml:line 226
at CompiledRazorTemplates.Dynamic.RazorEngine_92fda890f80543e5888ada44d834dbb4.<>c__DisplayClass4_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\wwwroot\nevotex\Files\Templates\Designs\Rapido\eCom\Productlist\ProductsRender.cshtml:line 136
at CompiledRazorTemplates.Dynamic.RazorEngine_92fda890f80543e5888ada44d834dbb4.Execute() in D:\wwwroot\nevotex\Files\Templates\Designs\Rapido\eCom\Productlist\ProductsRender.cshtml:line 4297
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.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2 @using Dynamicweb.Frontend.Devices 3 @using Dynamicweb.Extensibility 4 @using Dynamicweb.Content 5 @using Dynamicweb.Core 6 @using System 7 @using System.IO 8 @using System.Web 9 @using System.Collections.Generic; 10 @using System.Linq 11 @using System.Text.RegularExpressions 12 @using Dynamicweb.Ecommerce; 13 @using Dynamicweb.Rapido.Blocks 14 @using Dynamicweb.Rapido.Blocks.Components.General 15 @using Services = Dynamicweb.Ecommerce.Services; 16 17 @functions { 18 BlocksPage productListPage = BlocksPage.GetBlockPage("ProductList"); 19 Dynamicweb.Frontend.ItemViewModel productListSettings = null; 20 21 string favoriteListId = HttpContext.Current.Request.QueryString.Get("ListID"); 22 bool isFavoriteList = !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("ListID")); 23 24 } 25 26 @{ 27 28 productListSettings = Pageview.AreaSettings.GetItem("ProductList"); 29 30 31 32 // productlistTemplate 33 34 Block pageContainer = new Block() 35 { 36 Id = "PageContainer", 37 Template = RenderPageContainer(), 38 SkipRenderBlocksList = true, 39 BlocksList = new List<Block> { 40 new Block 41 { 42 Id = "ProductListHeader", 43 SortId = 10, 44 Template = RenderProductListHeader(), 45 SkipRenderBlocksList = true, 46 BlocksList = new List<Block> { 47 new Block 48 { 49 Id = "ProductListTitle", 50 SortId = 10, 51 Design = new Design 52 { 53 CssClass = isFavoriteList ? "grid__col-xs-12 grid__col-md-4" : "grid__col-xs-12 grid__col-md-6" 54 }, 55 Template = RenderProductListTitle() 56 } 57 } 58 } 59 } 60 }; 61 productListPage.Add(pageContainer); 62 63 Block productListNavigation = new Block() 64 { 65 Id = "Navigation", 66 SortId = 20, 67 Design = new Design 68 { 69 RenderType = RenderType.Column, 70 Size = "3" 71 } 72 }; 73 productListPage.Add("PageContainer", productListNavigation); 74 75 Block productListContainer = new Block() 76 { 77 Id = "ProductList", 78 SortId = 30, 79 Template = RenderProductList(), 80 SkipRenderBlocksList = true 81 }; 82 productListPage.Add("PageContainer", productListContainer); 83 84 if (isFavoriteList) 85 { 86 productListPage.Add("ProductListHeader", new Block 87 { 88 Id = "FavoriteListSearch", 89 SortId = 20, 90 Template = RenderFavoriteListSearch(), 91 Design = new Design 92 { 93 CssClass = "grid__col-sm-4 u-margin-bottom u-margin-top grid--align-self-center" 94 } 95 }); 96 } 97 98 Block productListSnippets = new Block() 99 { 100 Id = "BottomSnippets", 101 SortId = 40 102 }; 103 productListPage.Add(productListSnippets); 104 } 105106 @* This is required for the product list feed to work *@ 107 @GetValue("DoNotRenderProductListTemplate") 108109 @* Include the required Grid builder (Contains the methods @RenderBlockList and @RenderBlock) *@ 110 @using System.Text.RegularExpressions 111 @using System.Collections.Generic 112 @using System.Reflection 113 @using System.Web 114 @using System.Web.UI.HtmlControls 115 @using Dynamicweb.Rapido.Blocks.Components 116 @using Dynamicweb.Rapido.Blocks.Components.Articles 117 @using Dynamicweb.Rapido.Blocks.Components.Documentation 118 @using Dynamicweb.Rapido.Blocks 119120121 @*--- START: Base block renderers ---*@ 122123 @helper RenderBlockList(List<Block> blocks) 124 { 125 bool debug = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("debug")) ? Convert.ToBoolean(HttpContext.Current.Request.QueryString.Get("debug")) : false; 126 blocks = blocks.OrderBy(item => item.SortId).ToList(); 127128 foreach (Block item in blocks) 129 { 130 if (debug) { 131 <!-- Block START: @item.Id --> 132 } 133134 if (item.Design == null) 135 { 136 @RenderBlock(item) 137 } 138 else if (item.Design.RenderType == RenderType.None) { 139 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : ""; 140141 <div class="@cssClass dw-mod"> 142 @RenderBlock(item) 143 </div> 144 } 145 else if (item.Design.RenderType != RenderType.Hide) 146 { 147 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : ""; 148149 if (!item.SkipRenderBlocksList) { 150 if (item.Design.RenderType == RenderType.Row) 151 { 152 <div class="grid grid--align-content-start @cssClass dw-mod" id="Block__@item.Id"> 153 @RenderBlock(item) 154 </div> 155 } 156157 if (item.Design.RenderType == RenderType.Column) 158 { 159 string hidePadding = item.Design.HidePadding ? "u-no-padding" : ""; 160 string size = item.Design.Size ?? "12"; 161 size = Regex.IsMatch(size, @"\d") ? "md-" + item.Design.Size : item.Design.Size; 162163 <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"> 164 @RenderBlock(item) 165 </div> 166 } 167168 if (item.Design.RenderType == RenderType.Table) 169 { 170 <table class="table @cssClass dw-mod" id="Block__@item.Id"> 171 @RenderBlock(item) 172 </table> 173 } 174175 if (item.Design.RenderType == RenderType.TableRow) 176 { 177 <tr class="@cssClass dw-mod" id="Block__@item.Id"> 178 @RenderBlock(item) 179 </tr> 180 } 181182 if (item.Design.RenderType == RenderType.TableColumn) 183 { 184 <td class="@cssClass dw-mod" id="Block__@item.Id"> 185 @RenderBlock(item) 186 </td> 187 } 188189 if (item.Design.RenderType == RenderType.CardHeader) 190 { 191 <div class="card-header @cssClass dw-mod"> 192 @RenderBlock(item) 193 </div> 194 } 195196 if (item.Design.RenderType == RenderType.CardBody) 197 { 198 <div class="card @cssClass dw-mod"> 199 @RenderBlock(item) 200 </div> 201 } 202203 if (item.Design.RenderType == RenderType.CardFooter) 204 { 205 <div class="card-footer @cssClass dw-mod"> 206 @RenderBlock(item) 207 </div> 208 } 209 } 210 else 211 { 212 @RenderBlock(item) 213 } 214 } 215216 if (debug) { 217 <!-- Block END: @item.Id --> 218 } 219 } 220 } 221222 @helper RenderBlock(Block item) 223 { 224 bool debug = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("debug")) ? Convert.ToBoolean(HttpContext.Current.Request.QueryString.Get("debug")) : false; 225226 if (item.Template != null) 227 { 228 @BlocksPage.RenderTemplate(item.Template) 229 } 230231 if (item.Component != null) 232 { 233 string customSufix = "Custom"; 234 string methodName = item.Component.HelperName; 235236 ComponentBase[] methodParameters = new ComponentBase[1]; 237 methodParameters[0] = item.Component; 238 Type methodType = this.GetType(); 239240 MethodInfo customMethod = methodType.GetMethod(methodName + customSufix); 241 MethodInfo generalMethod = methodType.GetMethod(methodName); 242243 try { 244 if (debug) { 245 <!-- Component: @methodName.Replace("Render", "") --> 246 } 247 @customMethod.Invoke(this, methodParameters).ToString(); 248 } catch { 249 try { 250 @generalMethod.Invoke(this, methodParameters).ToString(); 251 } catch(Exception ex) { 252 throw new Exception(item.Component.GetType().Name + " method '" + methodName +"' could not be invoked", ex); 253 } 254 } 255 } 256257 if (item.BlocksList.Count > 0 && !item.SkipRenderBlocksList) 258 { 259 @RenderBlockList(item.BlocksList) 260 } 261 } 262263 @*--- END: Base block renderers ---*@ 264265 @using Dynamicweb.Rapido.Blocks.Components 266 @using Dynamicweb.Rapido.Blocks.Components.General 267 @using Dynamicweb.Rapido.Blocks 268 @using System.IO 269270 @* Required *@ 271 @using Dynamicweb.Rapido.Blocks.Components 272 @using Dynamicweb.Rapido.Blocks.Components.General 273 @using Dynamicweb.Rapido.Blocks 274275276 @helper Render(ComponentBase component) 277 { 278 if (component != null) 279 { 280 @component.Render(this) 281 } 282 } 283284 @* Components *@ 285 @using System.Reflection 286 @using Dynamicweb.Rapido.Blocks.Components.General 287288289 @* Component *@ 290291 @helper RenderIcon(Icon settings) 292 { 293 if (settings != null) 294 { 295 string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : ""; 296297 if (settings.Name != null) 298 { 299 if (string.IsNullOrEmpty(settings.Label)) 300 { 301 <i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i> 302 } 303 else 304 { 305 if (settings.LabelPosition == IconLabelPosition.Before) 306 { 307 <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> 308 } 309 else 310 { 311 <div class="u-flex u-flex--align-items-center @settings.CssClass"><i class="@settings.Prefix @settings.Name u-margin-right--lg u-w20px" @color></i>@settings.Label</div> 312 } 313 } 314 } 315 else if (!string.IsNullOrEmpty(settings.Label)) 316 { 317 @settings.Label 318 } 319 } 320 } 321 @using System.Reflection 322 @using Dynamicweb.Rapido.Blocks.Components.General 323 @using Dynamicweb.Rapido.Blocks.Components 324 @using Dynamicweb.Core 325326 @* Component *@ 327328 @helper RenderButton(Button settings) 329 { 330 if (settings != null && (!string.IsNullOrEmpty(settings.Title) || settings.Icon != null)) 331 { 332 Dictionary<string, string> attributes = new Dictionary<string, string>(); 333 List<string> classList = settings.CssClass != null ? settings.CssClass.Split(' ').ToList() : new List<string>(); 334 if (settings.Disabled) { 335 attributes.Add("disabled", "true"); 336 classList.Add("disabled"); 337 } 338339 if (!string.IsNullOrEmpty(settings.ConfirmText) || !string.IsNullOrEmpty(settings.ConfirmTitle)) 340 { 341 settings.Id = !string.IsNullOrEmpty(settings.Id) ? settings.Id : Guid.NewGuid().ToString("N"); 342 @RenderConfirmDialog(settings); 343 settings.OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = true"; 344 } 345346 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 347 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 348 if (!string.IsNullOrEmpty(settings.AltText)) 349 { 350 attributes.Add("title", settings.AltText); 351 } 352 else if (!string.IsNullOrEmpty(settings.Title)) 353 { 354 string cleanTitle = Regex.Replace(settings.Title, "<.*?>", String.Empty); 355 cleanTitle = cleanTitle.Replace("&nbsp;", " "); 356 attributes.Add("title", cleanTitle); 357 } 358359 var onClickEvents = new List<string>(); 360 if (!string.IsNullOrEmpty(settings.OnClick)) 361 { 362 onClickEvents.Add(settings.OnClick); 363 } 364 if (!string.IsNullOrEmpty(settings.Href)) 365 { 366 onClickEvents.Add("location.href='" + settings.Href + "'"); 367 } 368 if (onClickEvents.Count > 0) 369 { 370 attributes.Add("onClick", string.Join(";", onClickEvents)); 371 } 372373 if (settings.ButtonLayout != ButtonLayout.None) 374 { 375 classList.Add("btn"); 376 string btnLayout = Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower(); 377 if (btnLayout == "linkclean") 378 { 379 btnLayout = "link-clean"; //fix 380 } 381 classList.Add("btn--" + btnLayout); 382 } 383384 if (settings.Icon == null) 385 { 386 settings.Icon = new Icon(); 387 } 388389 settings.Icon.CssClass += Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower() != "linkclean" ? " u-flex--align-center" : ""; 390 settings.Icon.Label = settings.Title; 391392 attributes.Add("type", Enum.GetName(typeof(ButtonType), settings.ButtonType).ToLower()); 393394 <button class="@string.Join(" ", classList) dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@Render(settings.Icon)</button> 395 } 396 } 397398 @helper RenderConfirmDialog(Button settings) 399 { 400 Modal confirmDialog = new Modal { 401 Id = settings.Id, 402 Width = ModalWidth.Sm, 403 Heading = new Heading 404 { 405 Level = 2, 406 Title = settings.ConfirmTitle 407 }, 408 BodyText = settings.ConfirmText 409 }; 410411 confirmDialog.AddAction(new Button { Title = Translate("Cancel"), ButtonLayout = ButtonLayout.Secondary, OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = false"}); 412 confirmDialog.AddAction(new Button { Title = Translate("OK"), ButtonLayout = ButtonLayout.Primary, OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = false;" + settings.OnClick }); 413414 @Render(confirmDialog) 415 } 416 @using Dynamicweb.Rapido.Blocks.Components.General 417 @using Dynamicweb.Rapido.Blocks.Components 418 @using Dynamicweb.Core 419420 @helper RenderDashboard(Dashboard settings) 421 { 422 var widgets = settings.GetWidgets(); 423424 if (!string.IsNullOrEmpty(settings.WidgetsBaseBackgroundColor)) 425 { 426 //set bg color for them 427428 System.Drawing.Color color = System.Drawing.ColorTranslator.FromHtml(settings.WidgetsBaseBackgroundColor); 429 int r = Convert.ToInt16(color.R); 430 int g = Convert.ToInt16(color.G); 431 int b = Convert.ToInt16(color.B); 432433 var count = widgets.Length; 434 var max = Math.Max(r, Math.Max(g, b)); 435 double step = 255.0 / (max * count); 436 var i = 0; 437 foreach (var widget in widgets) 438 { 439 i++; 440441 var shade = "rgb(" + Converter.ToString(r * step * i).Replace(",", ".") + ", " + Converter.ToString(g * step * i).Replace(",", ".") + ", " + Converter.ToString(b * step * i).Replace(",", ".") + ")"; 442 widget.BackgroundColor = shade; 443 } 444 } 445446 <div class="dashboard @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 447 @foreach (var widget in widgets) 448 { 449 <div class="dashboard__widget"> 450 @Render(widget) 451 </div> 452 } 453 </div> 454 } 455 @using Dynamicweb.Rapido.Blocks.Components.General 456 @using Dynamicweb.Rapido.Blocks.Components 457458 @helper RenderDashboardWidgetLink(DashboardWidgetLink settings) 459 { 460 if (!string.IsNullOrEmpty(settings.Link)) 461 { 462 var backgroundStyles = ""; 463 if (!string.IsNullOrEmpty(settings.BackgroundColor)) 464 { 465 backgroundStyles = "style=\"background-color:" + settings.BackgroundColor + "\""; 466 } 467468 <a href="@settings.Link" class="widget widget--link @settings.CssClass dw-mod" @backgroundStyles title="@settings.Title" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 469 <div class="u-center-middle u-color-light"> 470 @if (settings.Icon != null) 471 { 472 settings.Icon.CssClass += "widget__icon"; 473 @Render(settings.Icon) 474 } 475 <div class="widget__title">@settings.Title</div> 476 </div> 477 </a> 478 } 479 } 480 @using Dynamicweb.Rapido.Blocks.Components.General 481 @using Dynamicweb.Rapido.Blocks.Components 482483 @helper RenderDashboardWidgetCounter(DashboardWidgetCounter settings) 484 { 485 var backgroundStyles = ""; 486 if (!string.IsNullOrEmpty(settings.BackgroundColor)) 487 { 488 backgroundStyles = "style='background-color:" + settings.BackgroundColor + "'"; 489 } 490491 <div class="widget @settings.CssClass dw-mod" @backgroundStyles @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 492 <div class="u-center-middle u-color-light"> 493 @if (settings.Icon != null) 494 { 495 settings.Icon.CssClass += "widget__icon"; 496 @Render(settings.Icon) 497 } 498 <div class="widget__counter">@settings.Count</div> 499 <div class="widget__title">@settings.Title</div> 500 </div> 501 </div> 502 } 503 @using System.Reflection 504 @using Dynamicweb.Rapido.Blocks.Components.General 505 @using Dynamicweb.Rapido.Blocks.Components 506 @using Dynamicweb.Core 507508 @* Component *@ 509510 @helper RenderLink(Link settings) 511 { 512 if (settings != null && !string.IsNullOrEmpty(settings.Href) && (!string.IsNullOrEmpty(settings.Title) || settings.Icon != null)) 513 { 514 Dictionary<string, string> attributes = new Dictionary<string, string>(); 515 List<string> classList = settings.CssClass != null ? settings.CssClass.Split(' ').ToList() : new List<string>(); 516 if (settings.Disabled) 517 { 518 attributes.Add("disabled", "true"); 519 classList.Add("disabled"); 520 } 521522 if (!string.IsNullOrEmpty(settings.AltText)) 523 { 524 attributes.Add("title", settings.AltText); 525 } 526 else if (!string.IsNullOrEmpty(settings.Title)) 527 { 528 attributes.Add("title", settings.Title); 529 } 530531 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 532 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 533 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onClick", settings.OnClick); } 534 attributes.Add("href", settings.Href); 535536 if (settings.ButtonLayout != ButtonLayout.None) 537 { 538 classList.Add("btn"); 539 string btnLayout = Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower(); 540 if (btnLayout == "linkclean") 541 { 542 btnLayout = "link-clean"; //fix 543 } 544 classList.Add("btn--" + btnLayout); 545 } 546547 if (settings.Icon == null) 548 { 549 settings.Icon = new Icon(); 550 } 551 settings.Icon.Label = settings.Title; 552553 if (settings.Target == LinkTargetType.Blank && settings.Rel == LinkRelType.None) 554 { 555 settings.Rel = LinkRelType.Noopener; 556 } 557 if (settings.Target != LinkTargetType.None) 558 { 559 attributes.Add("target", "_" + Enum.GetName(typeof(LinkTargetType), settings.Target).ToLower()); 560 } 561 if (settings.Download) 562 { 563 attributes.Add("download", "true"); 564 } 565 if (settings.Rel != LinkRelType.None) 566 { 567 attributes.Add("rel", Enum.GetName(typeof(LinkRelType), settings.Rel).ToLower()); 568 } 569570 <a class="@string.Join(" ", classList) dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@Render(settings.Icon)</a> 571 } 572 } 573 @using System.Reflection 574 @using Dynamicweb.Rapido.Blocks.Components 575 @using Dynamicweb.Rapido.Blocks.Components.General 576 @using Dynamicweb.Rapido.Blocks 577578579 @* Component *@ 580581 @helper RenderRating(Rating settings) 582 { 583 if (settings.Score > 0) 584 { 585 int rating = settings.Score; 586 string iconType = "fa-star"; 587588 switch (settings.Type.ToString()) { 589 case "Stars": 590 iconType = "fa-star"; 591 break; 592 case "Hearts": 593 iconType = "fa-heart"; 594 break; 595 case "Lemons": 596 iconType = "fa-lemon"; 597 break; 598 case "Bombs": 599 iconType = "fa-bomb"; 600 break; 601 } 602603 <div class="u-ta-right"> 604 @for (int i = 0; i < settings.OutOf; i++) 605 { 606 <i class="@(rating > i ? "fas" : "far") @iconType"></i> 607 } 608 </div> 609 } 610 } 611 @using System.Reflection 612 @using Dynamicweb.Rapido.Blocks.Components.General 613 @using Dynamicweb.Rapido.Blocks.Components 614615616 @* Component *@ 617618 @helper RenderSelectFieldOption(SelectFieldOption settings) 619 { 620 Dictionary<string, string> attributes = new Dictionary<string, string>(); 621 if (settings.Checked) { attributes.Add("selected", "true"); } 622 if (settings.Disabled) { attributes.Add("disabled", "true"); } 623 if (settings.Value != null) { attributes.Add("value", settings.Value); } 624 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 625626 <option @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Label</option> 627 } 628 @using System.Reflection 629 @using Dynamicweb.Rapido.Blocks.Components.General 630 @using Dynamicweb.Rapido.Blocks.Components 631632633 @* Component *@ 634635 @helper RenderNavigation(Navigation settings) { 636 @RenderNavigation(new 637 { 638 id = settings.Id, 639 cssclass = settings.CssClass, 640 startLevel = settings.StartLevel, 641 endlevel = settings.EndLevel, 642 expandmode = settings.Expandmode, 643 sitemapmode = settings.SitemapMode, 644 template = settings.Template 645 }) 646 } 647 @using Dynamicweb.Rapido.Blocks.Components.General 648 @using Dynamicweb.Rapido.Blocks.Components 649650651 @* Component *@ 652653 @helper RenderBreadcrumbNavigation(BreadcrumbNavigation settings) { 654 settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id; 655 settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template; 656 settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel; 657 settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel; 658 settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode; 659 settings.SitemapMode = false; 660661 @RenderNavigation(settings) 662 } 663 @using Dynamicweb.Rapido.Blocks.Components.General 664 @using Dynamicweb.Rapido.Blocks.Components 665666667 @* Component *@ 668669 @helper RenderLeftNavigation(LeftNavigation settings) { 670 settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id; 671 settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template; 672 settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel; 673 settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel; 674 settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode; 675676 <div class="grid__cell"> 677 @RenderNavigation(settings) 678 </div> 679 } 680 @using System.Reflection 681 @using Dynamicweb.Rapido.Blocks.Components.General 682 @using Dynamicweb.Core 683684 @* Component *@ 685686 @helper RenderHeading(Heading settings) 687 { 688 if (settings != null && !string.IsNullOrEmpty(settings.Title)) 689 { 690 string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : ""; 691 string tagName = settings.Level != 0 ? "h" + settings.Level.ToString() : "div"; 692693 @("<" + tagName + " class=\"" + settings.CssClass + " dw-mod\" " + color + ">") 694 if (!string.IsNullOrEmpty(settings.Link)) 695 { 696 @Render(new Link { Href = settings.Link, Icon = settings.Icon, Title = settings.Title, ButtonLayout = ButtonLayout.None }) 697 } 698 else 699 { 700 if (settings.Icon == null) 701 { 702 settings.Icon = new Icon(); 703 } 704 settings.Icon.Label = settings.Title; 705 @Render(settings.Icon) 706 } 707 @("</" + tagName + ">"); 708 } 709 } 710 @using Dynamicweb.Rapido.Blocks.Components 711 @using Dynamicweb.Rapido.Blocks.Components.General 712 @using Dynamicweb.Rapido.Blocks 713714715 @* Component *@ 716717 @helper RenderImage(Image settings) 718 { 719 if (settings.FilterPrimary != ImageFilter.None || settings.FilterSecondary != ImageFilter.None) 720 { 721 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>(); 722 if (!string.IsNullOrEmpty(settings.FilterColor)) { optionalAttributes.Add("style", "background-color: " + settings.FilterColor); } 723724 if (settings.Caption != null) 725 { 726 @:<div> 727 } 728729 var primaryFilterClass = settings.FilterPrimary.ToString().ToLower(); 730 var secondaryFilterClass = settings.FilterSecondary.ToString().ToLower(); 731732 <div class="image-filter image-filter--@primaryFilterClass u-position-relative dw-mod" @ComponentMethods.AddAttributes(optionalAttributes)> 733 <div class="image-filter image-filter--@secondaryFilterClass dw-mod"> 734 @if (settings.Link != null) 735 { 736 <a href="@settings.Link"> 737 @RenderTheImage(settings) 738 </a> 739 } 740 else 741 { 742 @RenderTheImage(settings) 743 } 744 </div> 745 </div> 746747 if (settings.Caption != null) 748 { 749 <span class="image-caption dw-mod">@settings.Caption</span> 750 @:</div> 751 } 752 } 753 else 754 { 755 if (settings.Caption != null) 756 { 757 @:<div> 758 } 759 if (!string.IsNullOrEmpty(settings.Link)) 760 { 761 <a href="@settings.Link"> 762 @RenderTheImage(settings) 763 </a> 764 } 765 else 766 { 767 @RenderTheImage(settings) 768 } 769770 if (settings.Caption != null) 771 { 772 <span class="image-caption dw-mod">@settings.Caption</span> 773 @:</div> 774 } 775 } 776 } 777778 @helper RenderTheImage(Image settings) 779 { 780 if (settings != null) 781 { 782 string alternativeImage = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("AlternativeImage")) ? Pageview.AreaSettings.GetItem("Settings").GetFile("AlternativeImage").PathUrlEncoded : "/Images/missing_image.jpg"; 783 string placeholderImage = "/Files/Images/placeholder.gif"; 784 string imageEngine = "/Admin/Public/GetImage.ashx?"; 785786 string imageStyle = ""; 787788 switch (settings.Style) 789 { 790 case ImageStyle.Ball: 791 imageStyle = "grid__cell-img--ball"; 792 break; 793794 case ImageStyle.Triangle: 795 imageStyle = "grid__cell-img--triangle"; 796 break; 797 } 798799 if (settings.Style == ImageStyle.Ball || settings.Style == ImageStyle.Circle || settings.Style == ImageStyle.Triangle) 800 { 801 settings.ImageDefault.Crop = settings.ImageDefault.Crop == 5 ? settings.ImageDefault.Crop = 0 : settings.ImageDefault.Crop; 802803 if (settings.ImageDefault != null) 804 { 805 settings.ImageDefault.Height = settings.ImageDefault.Width; 806 } 807 if (settings.ImageMedium != null) 808 { 809 settings.ImageMedium.Height = settings.ImageMedium.Width; 810 } 811 if (settings.ImageSmall != null) 812 { 813 settings.ImageSmall.Height = settings.ImageSmall.Width; 814 } 815 } 816817 string defaultImage = imageEngine; 818 string imageSmall = ""; 819 string imageMedium = ""; 820821 if (settings.DisableImageEngine) 822 { 823 defaultImage = settings.Path; 824 } 825 else 826 { 827 if (settings.ImageDefault != null) 828 { 829 defaultImage += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageDefault); 830831 if (settings.Path.GetType() != typeof(string)) 832 { 833 defaultImage += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 834 defaultImage += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 835 } 836 else 837 { 838 defaultImage += settings.Path != null ? "Image=" + settings.Path : ""; 839 } 840841 defaultImage += "&AlternativeImage=" + alternativeImage; 842 } 843844 if (settings.ImageSmall != null) 845 { 846 imageSmall = "data-src-small=\"" + imageEngine; 847 imageSmall += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageSmall); 848849 if (settings.Path.GetType() != typeof(string)) 850 { 851 imageSmall += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 852 imageSmall += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 853 } 854 else 855 { 856 imageSmall += settings.Path != null ? "Image=" + settings.Path : ""; 857 } 858859 imageSmall += "&alternativeImage=" + alternativeImage; 860861 imageSmall += "\""; 862 } 863864 if (settings.ImageMedium != null) 865 { 866 imageMedium = "data-src-medium=\"" + imageEngine; 867 imageMedium += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageMedium); 868869 if (settings.Path.GetType() != typeof(string)) 870 { 871 imageMedium += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 872 imageMedium += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 873 } 874 else 875 { 876 imageMedium += settings.Path != null ? "Image=" + settings.Path : ""; 877 } 878879 imageMedium += "&alternativeImage=" + alternativeImage; 880881 imageMedium += "\""; 882 } 883 } 884885 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>(); 886 if (!string.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick); } 887 if (!string.IsNullOrEmpty(settings.Title)) 888 { 889 optionalAttributes.Add("alt", settings.Title); 890 optionalAttributes.Add("title", settings.Title); 891 } 892893 if (settings.DisableLazyLoad) 894 { 895 <img id="@settings.Id" class="@imageStyle @settings.CssClass dw-mod" src="@defaultImage" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 896 } 897 else 898 { 899 <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) /> 900 } 901 } 902 } 903 @using System.Reflection 904 @using Dynamicweb.Rapido.Blocks.Components.General 905 @using Dynamicweb.Rapido.Blocks.Components 906907 @* Component *@ 908909 @helper RenderFileField(FileField settings) 910 { 911 var attributes = new Dictionary<string, string>(); 912 if (string.IsNullOrEmpty(settings.Id)) 913 { 914 settings.Id = Guid.NewGuid().ToString("N"); 915 } 916917 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 918 if (settings.Disabled) { attributes.Add("disabled", "true"); } 919 if (settings.Required) { attributes.Add("required", "true"); } 920 if (settings.Multiple) { attributes.Add("multiple", "true"); } 921 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 922 if (string.IsNullOrEmpty(settings.ChooseFileText)) 923 { 924 settings.ChooseFileText = Translate("Choose file"); 925 } 926 if (string.IsNullOrEmpty(settings.NoFilesChosenText)) 927 { 928 settings.NoFilesChosenText = Translate("No files chosen..."); 929 } 930 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 931932 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; } 933934 string setValueToFakeInput = "FileUpload.setValueToFakeInput(this)"; 935 attributes.Add("onchange", setValueToFakeInput + (!string.IsNullOrEmpty(settings.OnChange) ? settings.OnChange : "")); 936937 attributes.Add("type", "file"); 938 if (settings.Value != null) { attributes.Add("value", settings.Value); } 939 settings.CssClass = "u-full-width " + settings.CssClass; 940941 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 942943 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod"> 944 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null ) 945 { 946 <div class="u-full-width"> 947 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } 948 @if (settings.Link != null) { 949 <div class="u-pull--right"> 950 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } 951 @Render(settings.Link) 952 </div> 953 } 954 </div> 955956 } 957958 @if (!string.IsNullOrEmpty(settings.HelpText)) 959 { 960 <small class="form__help-text">@settings.HelpText</small> 961 } 962963 <div class="form__field-combi file-input u-no-margin dw-mod"> 964 <input @ComponentMethods.AddAttributes(resultAttributes) class="file-input__real-input" data-no-files-text="@settings.NoFilesChosenText" data-many-files-text="@Translate("files")" /> 965 <label for="@settings.Id" class="file-input__btn btn--secondary btn dw-mod">@settings.ChooseFileText</label> 966 <label for="@settings.Id" class="@settings.CssClass file-input__fake-input js-fake-input dw-mod">@settings.NoFilesChosenText</label> 967 @if (settings.UploadButton != null) 968 { 969 settings.UploadButton.CssClass += " btn--condensed u-no-margin"; 970 @Render(settings.UploadButton) 971 } 972 </div> 973 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 974 </div> 975 } 976 @using System.Reflection 977 @using Dynamicweb.Rapido.Blocks.Components.General 978 @using Dynamicweb.Rapido.Blocks.Components 979 @using Dynamicweb.Core 980 @using System.Linq 981982 @* Component *@ 983984 @helper RenderDateTimeField(DateTimeField settings) 985 { 986 if (string.IsNullOrEmpty(settings.Id)) 987 { 988 settings.Id = Guid.NewGuid().ToString("N"); 989 } 990991 var textField = new TextField { 992 Name = settings.Name, 993 Id = settings.Id, 994 Label = settings.Label, 995 HelpText = settings.HelpText, 996 Value = settings.Value, 997 Disabled = settings.Disabled, 998 Required = settings.Required, 999 ErrorMessage = settings.ErrorMessage, 1000 CssClass = settings.CssClass, 1001 WrapperCssClass = settings.WrapperCssClass, 1002 OnChange = settings.OnChange, 1003 OnClick = settings.OnClick, 1004 Link = settings.Link, 1005 ExtraAttributes = settings.ExtraAttributes, 1006 // 1007 Placeholder = settings.Placeholder 1008 }; 10091010 @Render(textField) 10111012 List<string> jsAttributes = new List<string>(); 10131014 jsAttributes.Add("mode: '" + Enum.GetName(typeof(DateTimeFieldMode), settings.Mode).ToLower() + "'"); 10151016 if (!string.IsNullOrEmpty(settings.DateFormat)) 1017 { 1018 jsAttributes.Add("dateFormat: '" + settings.DateFormat + "'"); 1019 } 1020 if (!string.IsNullOrEmpty(settings.MinDate)) 1021 { 1022 jsAttributes.Add("minDate: '" + settings.MinDate + "'"); 1023 } 1024 if (!string.IsNullOrEmpty(settings.MaxDate)) 1025 { 1026 jsAttributes.Add("maxDate: '" + settings.MaxDate + "'"); 1027 } 1028 if (settings.IsInline) 1029 { 1030 jsAttributes.Add("inline: " + Converter.ToString(settings.IsInline).ToLower()); 1031 } 1032 if (settings.EnableTime) 1033 { 1034 jsAttributes.Add("enableTime: " + Converter.ToString(settings.EnableTime).ToLower()); 1035 } 1036 if (settings.EnableWeekNumbers) 1037 { 1038 jsAttributes.Add("weekNumbers: " + Converter.ToString(settings.EnableWeekNumbers).ToLower()); 1039 } 10401041 jsAttributes.AddRange(settings.GetFlatPickrOptions().Select(x => x.Key + ": " + x.Value)); 10421043 <script> 1044 document.addEventListener("DOMContentLoaded", function () { 1045 flatpickr("#@textField.Id", { 1046 @string.Join(",", jsAttributes) 1047 }); 1048 }); 1049 </script> 1050 } 1051 @using System.Reflection 1052 @using Dynamicweb.Rapido.Blocks.Components.General 1053 @using Dynamicweb.Rapido.Blocks.Components 10541055 @* Component *@ 10561057 @helper RenderTextField(TextField settings) 1058 { 1059 var attributes = new Dictionary<string, string>(); 1060 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1061 { 1062 settings.Id = Guid.NewGuid().ToString("N"); 1063 } 10641065 /*base settings*/ 1066 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1067 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1068 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1069 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1070 if (settings.Required) { attributes.Add("required", "true"); } 1071 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1072 /*end*/ 10731074 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 1075 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 1076 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 1077 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 1078 if (settings.MaxLength != 0) { attributes.Add("maxlength", settings.MaxLength.ToString()); } 1079 if (!string.IsNullOrEmpty(settings.Placeholder)) { attributes.Add("placeholder", settings.Placeholder); } 1080 attributes.Add("type", Enum.GetName(typeof(TextFieldType), settings.Type).ToLower()); 1081 if (settings.Type == TextFieldType.Password) { attributes.Add("autocomplete", "off"); }; 1082 if (settings.Value != null) { attributes.Add("value", settings.Value); } 10831084 settings.CssClass = "u-full-width " + settings.CssClass; 10851086 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; } 10871088 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 10891090 string noMargin = "u-no-margin"; 1091 if (!settings.ReadOnly) { 1092 noMargin = ""; 1093 } 10941095 <div class="form__field-group u-full-width @noMargin @settings.WrapperCssClass dw-mod"> 1096 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null ) 1097 { 1098 <div class="u-full-width"> 1099 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } 1100 @if (settings.Link != null) { 1101 settings.Link.ButtonLayout = ButtonLayout.LinkClean; 11021103 <div class="u-pull--right"> 1104 @Render(settings.Link) 1105 </div> 1106 } 1107 </div> 11081109 } 11101111 @if (!string.IsNullOrEmpty(settings.HelpText)) 1112 { 1113 <small class="form__help-text">@settings.HelpText</small> 1114 } 11151116 @if (settings.ActionButton != null) 1117 { 1118 settings.ActionButton.CssClass += " btn--condensed u-no-margin"; 1119 <div class="form__field-combi u-no-margin dw-mod"> 1120 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1121 @Render(settings.ActionButton) 1122 </div> 1123 } 1124 else 1125 { 1126 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1127 } 11281129 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1130 </div> 1131 } 1132 @using System.Reflection 1133 @using Dynamicweb.Rapido.Blocks.Components.General 1134 @using Dynamicweb.Rapido.Blocks.Components 11351136 @* Component *@ 11371138 @helper RenderNumberField(NumberField settings) 1139 { 1140 var attributes = new Dictionary<string, string>(); 1141 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1142 { 1143 settings.Id = Guid.NewGuid().ToString("N"); 1144 } 11451146 /*base settings*/ 1147 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1148 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1149 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1150 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1151 if (settings.Required) { attributes.Add("required", "true"); } 1152 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1153 /*end*/ 11541155 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 1156 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 1157 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 1158 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 1159 if (settings.Max != null) { attributes.Add("max", settings.Max.ToString()); } 1160 if (settings.Min != null) { attributes.Add("min", settings.Min.ToString()); } 1161 if (settings.Step != 0) { attributes.Add("step", settings.Step.ToString()); } 1162 if (settings.Value != null && !string.IsNullOrEmpty(settings.Value.ToString())) { attributes.Add("value", settings.Value.ToString()); } 1163 attributes.Add("type", "number"); 11641165 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 11661167 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod"> 1168 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null ) 1169 { 1170 <div class="u-full-width"> 1171 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } 1172 @if (settings.Link != null) { 1173 <div class="u-pull--right"> 1174 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } 1175 @Render(settings.Link) 1176 </div> 1177 } 1178 </div> 11791180 } 11811182 @if (!string.IsNullOrEmpty(settings.HelpText)) 1183 { 1184 <small class="form__help-text">@settings.HelpText</small> 1185 } 11861187 @if (settings.ActionButton != null) 1188 { 1189 settings.ActionButton.CssClass += " btn--condensed u-no-margin"; 1190 <div class="form__field-combi u-no-margin dw-mod"> 1191 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1192 @Render(settings.ActionButton) 1193 </div> 1194 } 1195 else 1196 { 1197 <div class="form__field-combi u-no-margin dw-mod"> 1198 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1199 </div> 1200 } 12011202 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1203 </div> 1204 } 1205 @using System.Reflection 1206 @using Dynamicweb.Rapido.Blocks.Components.General 1207 @using Dynamicweb.Rapido.Blocks.Components 120812091210 @* Component *@ 12111212 @helper RenderTextareaField(TextareaField settings) 1213 { 1214 Dictionary<string, string> attributes = new Dictionary<string, string>(); 1215 string id = settings.Id; 1216 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(id)) 1217 { 1218 id = Guid.NewGuid().ToString("N"); 1219 } 12201221 if (!string.IsNullOrEmpty(id)) { attributes.Add("id", id); } 1222 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1223 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 1224 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 1225 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 1226 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1227 if (!string.IsNullOrEmpty(settings.Placeholder)) { attributes.Add("placeholder", settings.Placeholder); } 1228 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1229 if (settings.Required) { attributes.Add("required", "true"); } 1230 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 1231 if (settings.MaxLength != 0) { attributes.Add("maxlength", settings.MaxLength.ToString()); } 1232 if (settings.Rows != 0) { attributes.Add("rows", settings.Rows.ToString()); } 1233 attributes.Add("name", settings.Name); 12341235 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; } 12361237 <div class="form__field-group @settings.WrapperCssClass dw-mod"> 1238 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null ) 1239 { 1240 <div class="u-full-width"> 1241 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } 1242 @if (settings.Link != null) { 1243 <div class="u-pull--right"> 1244 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } 1245 @Render(settings.Link) 1246 </div> 1247 } 1248 </div> 1249 } 12501251 @if (!string.IsNullOrEmpty(settings.HelpText)) 1252 { 1253 <small class="form__help-text">@settings.HelpText</small> 1254 } 12551256 <textarea class="u-full-width @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Value</textarea> 12571258 @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 126412651266 @* Component *@ 12671268 @helper RenderHiddenField(HiddenField settings) { 1269 var attributes = new Dictionary<string, string>(); 1270 attributes.Add("type", "hidden"); 1271 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1272 if (settings.Value != null) { attributes.Add("value", settings.Value); } 1273 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 12741275 <input @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)/> 1276 } 1277 @using System.Reflection 1278 @using Dynamicweb.Rapido.Blocks.Components.General 1279 @using Dynamicweb.Rapido.Blocks.Components 12801281 @* Component *@ 12821283 @helper RenderCheckboxField(CheckboxField settings) 1284 { 1285 var attributes = new Dictionary<string, string>(); 1286 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1287 { 1288 settings.Id = Guid.NewGuid().ToString("N"); 1289 } 12901291 /*base settings*/ 1292 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1293 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1294 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1295 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1296 if (settings.Required) { attributes.Add("required", "true"); } 1297 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1298 /*end*/ 12991300 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; } 13011302 attributes.Add("type", "checkbox"); 1303 if (settings.Checked) { attributes.Add("checked", "true"); } 1304 settings.CssClass = "form__control " + settings.CssClass; 1305 if (settings.Value != null) { attributes.Add("value", settings.Value); } 13061307 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 13081309 <div class="form__field-group @settings.WrapperCssClass dw-mod"> 1310 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1311 @if (!string.IsNullOrEmpty(settings.Label)) 1312 { 1313 <label for="@settings.Id" class="dw-mod">@settings.Label</label> 1314 } 13151316 @if (settings.Link != null) { 1317 <span> 1318 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } 1319 @Render(settings.Link) 1320 </span> 1321 } 13221323 @if (!string.IsNullOrEmpty(settings.HelpText)) 1324 { 1325 <small class="form__help-text checkbox-help dw-mod">@settings.HelpText</small> 1326 } 1327 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1328 </div> 1329 } 1330 @using System.Reflection 1331 @using Dynamicweb.Rapido.Blocks.Components.General 1332 @using Dynamicweb.Rapido.Blocks.Components 133313341335 @* Component *@ 13361337 @helper RenderCheckboxListField(CheckboxListField settings) 1338 { 1339 <div class="form__field-group @settings.WrapperCssClass u-margin-bottom dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1340 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null ) 1341 { 1342 <div class="u-full-width"> 1343 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } 1344 @if (settings.Link != null) { 1345 <div class="u-pull--right"> 1346 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } 1347 @Render(settings.Link) 1348 </div> 1349 } 1350 </div> 13511352 } 13531354 <div class="u-pull--left"> 1355 @if (!string.IsNullOrEmpty(settings.HelpText)) 1356 { 1357 <small class="form__help-text">@settings.HelpText</small> 1358 } 13591360 @foreach (var item in settings.Options) 1361 { 1362 if (settings.Required) 1363 { 1364 item.Required = true; 1365 } 1366 if (settings.Disabled) 1367 { 1368 item.Disabled = true; 1369 } 1370 if (!string.IsNullOrEmpty(settings.Name)) 1371 { 1372 item.Name = settings.Name; 1373 } 1374 if (!string.IsNullOrEmpty(settings.CssClass)) 1375 { 1376 item.CssClass += settings.CssClass; 1377 } 13781379 /* value is not supported */ 13801381 if (!string.IsNullOrEmpty(settings.OnClick)) 1382 { 1383 item.OnClick += settings.OnClick; 1384 } 1385 if (!string.IsNullOrEmpty(settings.OnChange)) 1386 { 1387 item.OnChange += settings.OnChange; 1388 } 1389 @Render(item) 1390 } 13911392 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1393 </div> 13941395 </div> 1396 } 1397 @using Dynamicweb.Rapido.Blocks.Components.General 13981399 @* Component *@ 14001401 @helper RenderSearch(Search settings) 1402 { 1403 var searchValue = HttpContext.Current.Request.QueryString.Get(settings.SearchParameter) ?? ""; 1404 var groupValue = HttpContext.Current.Request.QueryString.Get(settings.GroupsParameter) ?? ""; 14051406 if (string.IsNullOrEmpty(settings.Id)) 1407 { 1408 settings.Id = Guid.NewGuid().ToString("N"); 1409 } 14101411 var resultAttributes = new Dictionary<string, string>(); 14121413 if (settings.PageSize != 0) 1414 { 1415 resultAttributes.Add("data-page-size", settings.PageSize.ToString()); 1416 } 1417 if (!string.IsNullOrEmpty(settings.GroupItemsFeedUrl)) 1418 { 1419 resultAttributes.Add("data-groups-feed-url", settings.GroupItemsFeedUrl); 1420 if (!string.IsNullOrEmpty(groupValue)) 1421 { 1422 resultAttributes.Add("data-selected-group", groupValue); 1423 } 1424 if (!string.IsNullOrEmpty(settings.GroupsParameter)) 1425 { 1426 resultAttributes.Add("data-groups-parameter", settings.GroupsParameter); 1427 } 1428 } 1429 resultAttributes.Add("data-force-init", "true"); 1430 if (settings.GoToFirstSearchResultOnEnter) 1431 { 1432 resultAttributes.Add("data-go-to-first-search-result-on-enter", settings.GoToFirstSearchResultOnEnter.ToString().ToLower()); 1433 } 1434 if (!string.IsNullOrEmpty(settings.SearchParameter)) 1435 { 1436 resultAttributes.Add("data-search-parameter", settings.SearchParameter); 1437 } 1438 resultAttributes.Add("data-search-feed-url", settings.SearchData.SearchFeedUrl); 1439 resultAttributes.Add("data-results-template-id", settings.SearchData.ResultsTemplateId); 14401441 if (settings.SecondSearchData != null) 1442 { 1443 resultAttributes.Add("data-second-search-feed-url", settings.SecondSearchData.SearchFeedUrl); 1444 resultAttributes.Add("data-second-results-template-id", settings.SecondSearchData.ResultsTemplateId); 1445 } 1446 if (!string.IsNullOrEmpty(settings.ResultsPageUrl)) 1447 { 1448 resultAttributes.Add("data-results-page-url", settings.ResultsPageUrl); 1449 } 14501451 resultAttributes = resultAttributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 14521453 string searchFieldCss = (settings.SearchButton == null) ? "search--with-icon" : ""; 14541455 <div class="search @settings.CssClass @searchFieldCss js-search-data-source dw-mod" id="@settings.Id" @ComponentMethods.AddAttributes(resultAttributes)> 1456 @if (!string.IsNullOrEmpty(settings.GroupItemsFeedUrl)) 1457 { 1458 <button type="button" class="search__groups-btn dw-mod js-search-groups-btn">@Translate("All")</button> 1459 <ul class="dropdown dropdown--absolute-position dw-mod search__groups-results js-search-groups-list"></ul> 1460 } 14611462 <input type="text" class="search__field dw-mod js-search-field" placeholder="@settings.Placeholder" value="@searchValue"> 14631464 <div class="dropdown dropdown--absolute-position search__results dw-mod js-search-results @(settings.SecondSearchData != null ? "search__results--combined" : "")"> 1465 @if (settings.SecondSearchData != null) 1466 { 1467 <div class="search__column search__column--products dw-mod"> 1468 <div class="search__column-header dw-mod">@Translate("Products")</div> 1469 <ul class="search__results-list dw-mod js-search-results-list" id="@(settings.Id)_ResultsList"></ul> 1470 @if (!string.IsNullOrEmpty(settings.SearchData.ResultsPageUrl)) 1471 { 1472 @Render(new Link { 1473 Title = Translate("View all"), 1474 CssClass = "js-view-all-button u-margin", 1475 Href = settings.SearchData.ResultsPageUrl 1476 }); 1477 } 1478 </div> 1479 <div class="search__column search__column--pages dw-mod"> 1480 <div class="search__column-header">@Translate("Pages")</div> 1481 <ul class="search__results-list dw-mod js-search-results-second-list" id="@(settings.Id)_SecondResultsList"></ul> 1482 @if (!string.IsNullOrEmpty(settings.SecondSearchData.ResultsPageUrl)) 1483 { 1484 @Render(new Link 1485 { 1486 Title = Translate("View all"), 1487 CssClass = "js-view-all-button u-margin", 1488 Href = settings.SecondSearchData.ResultsPageUrl 1489 }); 1490 } 1491 </div> 1492 } 1493 else 1494 { 1495 <div class="search__column search__column--only dw-mod"> 1496 <ul class="search__results-list dw-mod js-search-results-list" id="@(settings.Id)_ResultsList"></ul> 1497 @if (!string.IsNullOrEmpty(settings.SearchData.ResultsPageUrl)) 1498 { 1499 @Render(new Link { 1500 Title = Translate("View all"), 1501 CssClass = "js-view-all-button u-margin", 1502 Href = settings.SearchData.ResultsPageUrl 1503 }); 1504 } 1505 </div> 1506 } 1507 </div> 15081509 @if (settings.SearchButton != null) 1510 { 1511 settings.SearchButton.CssClass += " search__btn js-search-btn"; 1512 if (settings.RenderDefaultSearchIcon) 1513 { 1514 settings.SearchButton.Icon = new Icon { Name = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue }; 1515 } 1516 @Render(settings.SearchButton); 1517 } 1518 </div> 1519 } 1520 @using System.Reflection 1521 @using Dynamicweb.Rapido.Blocks.Components.General 1522 @using Dynamicweb.Rapido.Blocks.Components 152315241525 @* Component *@ 15261527 @helper RenderSelectField(SelectField settings) 1528 { 1529 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1530 { 1531 settings.Id = Guid.NewGuid().ToString("N"); 1532 } 15331534 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod"> 1535 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null ) 1536 { 1537 <div class="u-full-width"> 1538 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } 1539 @if (settings.Link != null) { 1540 <div class="u-pull--right"> 1541 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } 1542 @Render(settings.Link) 1543 </div> 1544 } 1545 </div> 1546 } 15471548 @if (!string.IsNullOrEmpty(settings.HelpText)) 1549 { 1550 <small class="form__help-text">@settings.HelpText</small> 1551 } 15521553 @if (settings.ActionButton != null) 1554 { 1555 settings.ActionButton.CssClass += " btn--condensed u-no-margin"; 1556 <div class="form__field-combi u-no-margin dw-mod"> 1557 @RenderSelectBase(settings) 1558 @Render(settings.ActionButton) 1559 </div> 1560 } 1561 else 1562 { 1563 @RenderSelectBase(settings) 1564 } 15651566 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1567 </div> 1568 } 15691570 @helper RenderSelectBase(SelectField settings) 1571 { 1572 var attributes = new Dictionary<string, string>(); 15731574 /*base settings*/ 1575 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1576 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1577 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1578 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1579 if (settings.Required) { attributes.Add("required", "true"); } 1580 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1581 /*end*/ 15821583 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 15841585 <select @ComponentMethods.AddAttributes(resultAttributes) class="u-full-width @settings.CssClass dw-mod"> 1586 @if (settings.Default != null) 1587 { 1588 @Render(settings.Default) 1589 } 15901591 @foreach (var item in settings.Options) 1592 { 1593 if (settings.Value != null) { 1594 item.Checked = item.Value == settings.Value; 1595 } 1596 @Render(item) 1597 } 1598 </select> 1599 } 1600 @using System.Reflection 1601 @using Dynamicweb.Rapido.Blocks.Components.General 1602 @using Dynamicweb.Rapido.Blocks.Components 16031604 @* Component *@ 16051606 @helper RenderRadioButtonField(RadioButtonField settings) 1607 { 1608 var attributes = new Dictionary<string, string>(); 1609 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1610 { 1611 settings.Id = Guid.NewGuid().ToString("N"); 1612 } 16131614 /*base settings*/ 1615 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1616 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1617 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1618 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1619 if (settings.Required) { attributes.Add("required", "true"); } 1620 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1621 /*end*/ 16221623 attributes.Add("type", "radio"); 1624 if (settings.Checked) { attributes.Add("checked", "true"); } 1625 settings.CssClass = "form__control " + settings.CssClass; 1626 if (settings.Value != null) { attributes.Add("value", settings.Value); } 16271628 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 16291630 <div class="form__field-group @settings.WrapperCssClass dw-mod"> 1631 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1632 @if (!string.IsNullOrEmpty(settings.Label)) 1633 { 1634 <label for="@settings.Id" class="dw-mod">@settings.Label</label> 1635 } 1636 @if (!string.IsNullOrEmpty(settings.HelpText)) 1637 { 1638 <small class="form__help-text">@settings.HelpText</small> 1639 } 1640 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1641 </div> 1642 } 1643 @using System.Reflection 1644 @using Dynamicweb.Rapido.Blocks.Components.General 1645 @using Dynamicweb.Rapido.Blocks.Components 164616471648 @* Component *@ 16491650 @helper RenderRadioButtonListField(RadioButtonListField settings) 1651 { 1652 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; } 16531654 <div class="form__field-group @settings.WrapperCssClass u-margin-bottom dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1655 @if (!string.IsNullOrEmpty(settings.Label)) 1656 { 1657 <label>@settings.Label</label> 1658 } 1659 @if (!string.IsNullOrEmpty(settings.HelpText)) 1660 { 1661 <small class="form__help-text">@settings.HelpText</small> 1662 } 16631664 @foreach (var item in settings.Options) 1665 { 1666 if (settings.Required) 1667 { 1668 item.Required = true; 1669 } 1670 if (settings.Disabled) 1671 { 1672 item.Disabled = true; 1673 } 1674 if (!string.IsNullOrEmpty(settings.Name)) 1675 { 1676 item.Name = settings.Name; 1677 } 1678 if (settings.Value != null && settings.Value == item.Value) 1679 { 1680 item.Checked = true; 1681 } 1682 if (!string.IsNullOrEmpty(settings.OnClick)) 1683 { 1684 item.OnClick += settings.OnClick; 1685 } 1686 if (!string.IsNullOrEmpty(settings.OnChange)) 1687 { 1688 item.OnChange += settings.OnChange; 1689 } 1690 if (!string.IsNullOrEmpty(settings.CssClass)) 1691 { 1692 item.CssClass += settings.CssClass; 1693 } 1694 @Render(item) 1695 } 16961697 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1698 </div> 1699 } 1700 @using System.Reflection 1701 @using Dynamicweb.Rapido.Blocks.Components.General 1702 @using Dynamicweb.Rapido.Blocks.Components 170317041705 @* Component *@ 17061707 @helper RenderNotificationMessage(NotificationMessage settings) 1708 { 1709 if (!string.IsNullOrEmpty(settings.Message)) 1710 { 1711 var attributes = new Dictionary<string, string>(); 1712 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 17131714 string messageTypeClass = Enum.GetName(typeof(NotificationMessageType), settings.MessageType).ToLower(); 1715 string messageLayoutClass = Enum.GetName(typeof(NotificationMessageLayout), settings.MessageLayout).ToLower(); 1716 string minHeightClass = settings.Icon != null ? "u-min-h70px" : ""; 17171718 <div class="notification-message-@messageTypeClass notification-message-@messageLayoutClass @messageLayoutClass @minHeightClass @settings.CssClass u-full-width dw-mod" @ComponentMethods.AddAttributes(attributes)> 1719 @if (settings.Icon != null) { 1720 settings.Icon.Label = !string.IsNullOrEmpty(settings.Icon.Label) ? settings.Message + settings.Icon.Label : settings.Message; 1721 @Render(settings.Icon) 1722 } else { 1723 @settings.Message 1724 } 1725 </div> 1726 } 1727 } 1728 @using Dynamicweb.Rapido.Blocks.Components.General 172917301731 @* Component *@ 17321733 @helper RenderHandlebarsRoot(HandlebarsRoot settings) { 1734 string preRender = !String.IsNullOrEmpty(settings.PreRenderScriptTemplate) ? "data-pre-render-template=\"" + settings.PreRenderScriptTemplate + "\"" : ""; 17351736 <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> 1737 @if (settings.SubBlocks != null) { 1738 @RenderBlockList(settings.SubBlocks) 1739 } 1740 </div> 1741 } 1742 @using System.Reflection 1743 @using Dynamicweb.Rapido.Blocks.Components.General 1744 @using Dynamicweb.Rapido.Blocks.Components 1745 @using System.Text.RegularExpressions 174617471748 @* Component *@ 17491750 @helper RenderSticker(Sticker settings) { 1751 if (!String.IsNullOrEmpty(settings.Title)) { 1752 string size = settings.Size.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Size.ToString().ToLower() : ""; 1753 string style = settings.Style.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Style.ToString().ToLower() : ""; 17541755 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>(); 1756 if (!String.IsNullOrEmpty(settings.Color) || !String.IsNullOrEmpty(settings.BackgroundColor)) { 1757 string styleTag = !String.IsNullOrEmpty(settings.Color) ? "color: " + settings.Color + "; " : ""; 1758 styleTag += !String.IsNullOrEmpty(settings.BackgroundColor) ? "background-color: " + settings.BackgroundColor + "; " : ""; 1759 optionalAttributes.Add("style", styleTag); 1760 } 17611762 <div class="stickers-container__tag @size @style @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Title</div> 1763 } 1764 } 17651766 @using System.Reflection 1767 @using Dynamicweb.Rapido.Blocks.Components.General 1768 @using Dynamicweb.Rapido.Blocks.Components 176917701771 @* Component *@ 17721773 @helper RenderStickersCollection(StickersCollection settings) 1774 { 1775 if (settings.Stickers.Count > 0) 1776 { 1777 string position = "stickers-container--" + Regex.Replace(settings.Position.ToString(), "([a-z])([A-Z])", "$1-$2").ToLower(); 17781779 <div class="stickers-container @position @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1780 @foreach (Sticker sticker in settings.Stickers) 1781 { 1782 @Render(sticker) 1783 } 1784 </div> 1785 } 1786 } 17871788 @using Dynamicweb.Rapido.Blocks.Components.General 178917901791 @* Component *@ 17921793 @helper RenderForm(Form settings) { 1794 if (settings != null) 1795 { 1796 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>(); 1797 if (!string.IsNullOrEmpty(settings.Action)) { optionalAttributes.Add("action", settings.Action); }; 1798 if (!string.IsNullOrEmpty(settings.Name)) { optionalAttributes.Add("name", settings.Name); }; 1799 if (!string.IsNullOrEmpty(settings.OnSubmit)) { optionalAttributes.Add("onsubmit", settings.OnSubmit); }; 1800 var enctypes = new Dictionary<string, string> 1801 { 1802 { "multipart", "multipart/form-data" }, 1803 { "text", "text/plain" }, 1804 { "application", "application/x-www-form-urlencoded" } 1805 }; 1806 if (settings.Enctype != FormEnctype.none) { optionalAttributes.Add("enctype", enctypes[Enum.GetName(typeof(FormEnctype), settings.Enctype).ToLower()]); }; 1807 optionalAttributes.Add("method", settings.Method.ToString()); 18081809 if (!string.IsNullOrEmpty(settings.FormStartMarkup)) 1810 { 1811 @settings.FormStartMarkup 1812 } 1813 else 1814 { 1815 @:<form class="@settings.CssClass u-no-margin dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1816 } 18171818 foreach (var field in settings.GetFields()) 1819 { 1820 @Render(field) 1821 } 18221823 @:</form> 1824 } 1825 } 1826 @using System.Reflection 1827 @using Dynamicweb.Rapido.Blocks.Components.General 1828 @using Dynamicweb.Rapido.Blocks.Components 182918301831 @* Component *@ 18321833 @helper RenderText(Text settings) 1834 { 1835 @settings.Content 1836 } 1837 @using System.Reflection 1838 @using Dynamicweb.Rapido.Blocks.Components.General 1839 @using Dynamicweb.Rapido.Blocks.Components 184018411842 @* Component *@ 18431844 @helper RenderContentModule(ContentModule settings) { 1845 if (!string.IsNullOrEmpty(settings.Content)) 1846 { 1847 @settings.Content 1848 } 1849 } 1850 @using System 1851 @using System.Reflection 1852 @using Dynamicweb.Rapido.Blocks.Components.General 1853 @using Dynamicweb.Rapido.Blocks.Components 185418551856 @* Component *@ 18571858 @helper RenderModal(Modal settings) { 1859 if (settings != null) 1860 { 1861 string modalId = !string.IsNullOrEmpty(settings.Id) ? settings.Id : Guid.NewGuid().ToString("N"); 18621863 string onchange = !string.IsNullOrEmpty(settings.OnClose) ? "onchange=\"if(!this.checked){" + settings.OnClose + "}\"" : ""; 18641865 <input type="checkbox" id="@(modalId)ModalTrigger" class="modal-trigger" @onchange /> 18661867 <div class="modal-container"> 1868 @if (!settings.DisableDarkOverlay) 1869 { 1870 <label for="@(modalId)ModalTrigger" id="@(modalId)ModalOverlay" class="modal-overlay"></label> 1871 } 1872 <div class="modal modal--@settings.Width.ToString().ToLower() modal-height--@settings.Height.ToString().ToLower()" id="@(modalId)Modal"> 1873 @if (settings.Heading != null) 1874 { 1875 if (!string.IsNullOrEmpty(settings.Heading.Title)) 1876 { 1877 <div class="modal__header"> 1878 @Render(settings.Heading) 1879 </div> 1880 } 1881 } 1882 <div class="modal__body @(settings.Width.ToString().ToLower() == "full" ? "modal__body--full" : "")"> 1883 @if (settings.BodyText != "LOGIN_MODAL_BODY") 1884 { 1885 <div class="modal__body_text">@settings.BodyText</div> 18861887 } 1888 @if (settings.BodyTemplate != null) 1889 { 1890 @settings.BodyTemplate 1891 } 1892 @{ 1893 var actions = settings.GetActions(); 1894 } 1895 </div> 1896 @if (actions.Length > 0) 1897 { 1898 <div class="modal__footer"> 1899 @foreach (var action in actions) 1900 { 1901 if (Pageview.Device.ToString() != "Mobile") { 1902 action.CssClass += " u-no-margin"; 1903 } else { 1904 action.CssClass += " u-full-width u-margin-bottom"; 1905 } 19061907 @Render(action) 1908 } 1909 </div> 1910 } 1911 <label class="modal__close-btn" for="@(modalId)ModalTrigger"></label> 1912 </div> 1913 </div> 1914 } 1915 } 1916 @using Dynamicweb.Rapido.Blocks.Components.General 19171918 @* Component *@ 19191920 @helper RenderMediaListItem(MediaListItem settings) 1921 { 1922 <div class="media-list-item @settings.CssClass dw-mod" @(!string.IsNullOrEmpty(settings.Id) ? "id=\"" + settings.Id + "\"" : "")> 1923 @if (!string.IsNullOrEmpty(settings.Label)) 1924 { 1925 if (!string.IsNullOrEmpty(settings.Link)) 1926 { 1927 @Render(new Link 1928 { 1929 Href = settings.Link, 1930 CssClass = "media-list-item__sticker dw-mod", 1931 ButtonLayout = ButtonLayout.None, 1932 Title = settings.Label, 1933 OnClick = !string.IsNullOrEmpty(settings.OnClick) ? settings.OnClick : "" 1934 }) 1935 } 1936 else if (!string.IsNullOrEmpty(settings.OnClick)) 1937 { 1938 <span class="media-list-item__sticker dw-mod" onclick="@(settings.OnClick)"> 1939 <span class="u-uppercase">@settings.Label</span> 1940 </span> 1941 } 1942 else 1943 { 1944 <span class="media-list-item__sticker media-list-item__sticker--no-link dw-mod"> 1945 <span class="u-uppercase">@settings.Label</span> 1946 </span> 1947 } 1948 } 1949 <div class="media-list-item__wrap"> 1950 <div class="media-list-item__info dw-mod"> 1951 <div class="media-list-item__header dw-mod"> 1952 @if (!string.IsNullOrEmpty(settings.Title)) 1953 { 1954 if (!string.IsNullOrEmpty(settings.Link)) 1955 { 1956 @Render(new Link 1957 { 1958 Href = settings.Link, 1959 CssClass = "media-list-item__name dw-mod", 1960 ButtonLayout = ButtonLayout.None, 1961 Title = settings.Title, 1962 OnClick = !string.IsNullOrEmpty(settings.OnClick) ? settings.OnClick : "" 1963 }) 1964 } 1965 else if (!string.IsNullOrEmpty(settings.OnClick)) 1966 { 1967 <span class="media-list-item__name dw-mod" onclick="@(settings.OnClick)">@settings.Title</span> 1968 } 1969 else 1970 { 1971 <span class="media-list-item__name media-list-item__name--no-link dw-mod">@settings.Title</span> 1972 } 1973 } 19741975 @if (!string.IsNullOrEmpty(settings.Status)) 1976 { 1977 <div class="media-list-item__state dw-mod">@settings.Status</div> 1978 } 1979 </div> 1980 @{ 1981 settings.InfoTable.CssClass += " media-list-item__parameters-table"; 1982 } 19831984 @Render(settings.InfoTable) 1985 </div> 1986 <div class="media-list-item__actions dw-mod"> 1987 <div class="media-list-item__actions-list dw-mod"> 1988 @{ 1989 var actions = settings.GetActions(); 19901991 foreach (ButtonBase action in actions) 1992 { 1993 action.ButtonLayout = ButtonLayout.None; 1994 action.CssClass += " media-list-item__action link"; 19951996 @Render(action) 1997 } 1998 } 1999 </div> 20002001 @if (settings.SelectButton != null && !string.IsNullOrEmpty(settings.SelectButton.Title)) 2002 { 2003 settings.SelectButton.CssClass += " u-no-margin"; 20042005 <div class="media-list-item__action-button"> 2006 @Render(settings.SelectButton) 2007 </div> 2008 } 2009 </div> 2010 </div> 2011 </div> 2012 } 2013 @using Dynamicweb.Rapido.Blocks.Components.General 2014 @using Dynamicweb.Rapido.Blocks.Components 20152016 @helper RenderTable(Table settings) 2017 { 2018 Dictionary<string, string> attributes = new Dictionary<string, string>(); 2019 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 20202021 var enumToClasses = new Dictionary<TableDesign, string> 2022 { 2023 { TableDesign.Clean, "table--clean" }, 2024 { TableDesign.Bordered, "table--bordered" }, 2025 { TableDesign.Striped, "table--striped" }, 2026 { TableDesign.Hover, "table--hover" }, 2027 { TableDesign.Compact, "table--compact" }, 2028 { TableDesign.Condensed, "table--condensed" }, 2029 { TableDesign.NoTopBorder, "table--no-top-border" } 2030 }; 2031 string tableDesignClass = ""; 2032 if (settings.Design != TableDesign.None) 2033 { 2034 tableDesignClass = enumToClasses[settings.Design]; 2035 } 20362037 if (!string.IsNullOrEmpty(settings.CssClass) || settings.Design != TableDesign.None) { attributes.Add("class", "table " + tableDesignClass + " " + settings.CssClass + " dw-mod"); } 20382039 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value); 20402041 <table @ComponentMethods.AddAttributes(resultAttributes)> 2042 @if (settings.Header != null) 2043 { 2044 <thead> 2045 @Render(settings.Header) 2046 </thead> 2047 } 2048 <tbody> 2049 @foreach (var row in settings.Rows) 2050 { 2051 @Render(row) 2052 } 2053 </tbody> 2054 @if (settings.Footer != null) 2055 { 2056 <tfoot> 2057 @Render(settings.Footer) 2058 </tfoot> 2059 } 2060 </table> 2061 } 2062 @using Dynamicweb.Rapido.Blocks.Components.General 2063 @using Dynamicweb.Rapido.Blocks.Components 20642065 @helper RenderTableRow(TableRow settings) 2066 { 2067 Dictionary<string, string> attributes = new Dictionary<string, string>(); 2068 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 20692070 var enumToClasses = new Dictionary<TableRowDesign, string> 2071 { 2072 { TableRowDesign.NoBorder, "table__row--no-border" }, 2073 { TableRowDesign.Border, "table__row--border" }, 2074 { TableRowDesign.TopBorder, "table__row--top-line" }, 2075 { TableRowDesign.BottomBorder, "table__row--bottom-line" }, 2076 { TableRowDesign.Solid, "table__row--solid" } 2077 }; 20782079 string tableRowDesignClass = ""; 2080 if (settings.Design != TableRowDesign.None) 2081 { 2082 tableRowDesignClass = enumToClasses[settings.Design]; 2083 } 20842085 if (!string.IsNullOrEmpty(settings.CssClass) || settings.Design != TableRowDesign.None) { attributes.Add("class", "table__row " + tableRowDesignClass + " " + settings.CssClass + " dw-mod"); } 20862087 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value); 20882089 <tr @ComponentMethods.AddAttributes(resultAttributes)> 2090 @foreach (var cell in settings.Cells) 2091 { 2092 if (settings.IsHeaderRow) 2093 { 2094 cell.IsHeader = true; 2095 } 2096 @Render(cell) 2097 } 2098 </tr> 2099 } 2100 @using Dynamicweb.Rapido.Blocks.Components.General 2101 @using Dynamicweb.Rapido.Blocks.Components 2102 @using Dynamicweb.Core 21032104 @helper RenderTableCell(TableCell settings) 2105 { 2106 Dictionary<string, string> attributes = new Dictionary<string, string>(); 2107 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 2108 if (settings.Colspan != 0) { attributes.Add("colspan", Converter.ToString(settings.Colspan)); } 2109 if (settings.Rowspan != 0) { attributes.Add("rowspan", Converter.ToString(settings.Rowspan)); } 2110 if (!string.IsNullOrEmpty(settings.CssClass)) { attributes.Add("class", settings.CssClass + " dw-mod"); } 21112112 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value); 21132114 string tagName = settings.IsHeader ? "th" : "td"; 21152116 @("<" + tagName + " " + ComponentMethods.AddAttributes(resultAttributes) + ">") 2117 @settings.Content 2118 @("</" + tagName + ">"); 2119 } 2120 @using System.Linq 2121 @using Dynamicweb.Rapido.Blocks.Components.General 21222123 @* Component *@ 21242125 @helper RenderPagination(Dynamicweb.Rapido.Blocks.Components.General.Pagination settings) 2126 { 2127 var pageNumberQueryStringName = Dynamicweb.Rapido.Services.Pagination.GetPageNumberQueryStringName(settings); // Get the proper 'page number' query string parameter 2128 var queryParameters = Dynamicweb.Rapido.Services.Url.GetQueryParameters(pageNumberQueryStringName); // Get the NameValueCollection from the querystring 21292130 if (settings.NumberOfPages > 1) 2131 { 2132 string url = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + "/Default.aspx"; 2133 string ariaLabel = !string.IsNullOrWhiteSpace(settings.AriaLabel) ? settings.AriaLabel : Translate("Page navigation"); 2134 Dictionary<string, int> startAndEndPageNumber = Dynamicweb.Rapido.Services.Pagination.GetStartAndEndPageNumber(settings); 21352136 <div class="pager u-margin-top dw-mod @settings.CssClass" aria-label="@ariaLabel"> 2137 @if (settings.ShowPagingInfo) 2138 { 2139 <div class="pager__info dw-mod"> 2140 @Translate("Page") @settings.CurrentPageNumber @Translate("of") @settings.NumberOfPages 2141 </div> 2142 } 2143 <ul class="pager__list dw-mod"> 2144 @if (!string.IsNullOrWhiteSpace(settings.FirstPageUrl) && settings.ShowFirstAndLastControls) 2145 { 2146 @Render(new PaginationItem { Link = settings.FirstPageUrl, Icon = settings.FirstIcon }) 2147 } 2148 @if (!string.IsNullOrWhiteSpace(settings.PreviousPageUrl) && settings.ShowNextAndPrevControls) 2149 { 2150 @Render(new PaginationItem { Link = settings.PreviousPageUrl, Icon = settings.PrevIcon }) 2151 } 2152 @if (settings.GetPages().Any()) 2153 { 2154 foreach (var page in settings.GetPages()) 2155 { 2156 @Render(page) 2157 } 2158 } 2159 else 2160 { 2161 for (var page = startAndEndPageNumber["StartPage"]; page <= startAndEndPageNumber["EndPage"]; page++) 2162 { 2163 queryParameters = Dynamicweb.Rapido.Services.Url.UpdateQueryStringParameter(queryParameters, pageNumberQueryStringName, page.ToString()); 2164 @Render(new PaginationItem { Label = page.ToString(), Link = Dynamicweb.Rapido.Services.Url.BuildUri(url, queryParameters).PathAndQuery, IsActive = (settings.CurrentPageNumber == page) }); 2165 } 2166 } 2167 @if (!string.IsNullOrWhiteSpace(settings.NextPageUrl) && settings.ShowNextAndPrevControls) 2168 { 2169 @Render(new PaginationItem { Link = settings.NextPageUrl, Icon = settings.NextIcon }) 2170 } 2171 @if (!string.IsNullOrWhiteSpace(settings.LastPageUrl) && settings.ShowFirstAndLastControls) 2172 { 2173 @Render(new PaginationItem { Link = settings.LastPageUrl, Icon = settings.LastIcon }) 2174 } 2175 </ul> 2176 </div> 2177 } 2178 } 21792180 @helper RenderPaginationItem(PaginationItem settings) 2181 { 2182 if (settings.Icon == null) 2183 { 2184 settings.Icon = new Icon(); 2185 } 21862187 settings.Icon.Label = settings.Label; 2188 <li class="pager__btn dw-mod"> 2189 @if (settings.IsActive) 2190 { 2191 <span class="pager__num pager__num--current dw-mod"> 2192 @Render(settings.Icon) 2193 </span> 2194 } 2195 else 2196 { 2197 <a href="@settings.Link" class="pager__num dw-mod"> 2198 @Render(settings.Icon) 2199 </a> 2200 } 2201 </li> 2202 } 220322042205 @using Dynamicweb.Rapido.Blocks.Components.General 2206 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 220722082209 @using Dynamicweb.Rapido.Blocks.Components 2210 @using Dynamicweb.Rapido.Blocks.Components.General 2211 @using Dynamicweb.Rapido.Blocks 2212 @using System.IO 221322142215 @using Dynamicweb.Rapido.Blocks.Components.General 2216 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 221722182219 @* Component *@ 22202221 @helper RenderVariantMatrix(VariantMatrix settings) { 2222 if (settings != null) 2223 { 2224 int productLoopCounter = 0; 2225 int groupCount = 0; 2226 List<VariantOption> firstDimension = new List<VariantOption>(); 2227 List<VariantOption> secondDimension = new List<VariantOption>(); 2228 List<VariantOption> thirdDimension = new List<VariantOption>(); 22292230 foreach (VariantGroup variantGroup in settings.GetVariantGroups()) 2231 { 2232 foreach (VariantOption variantOptions in variantGroup.GetVariantOptions()) 2233 { 2234 if (groupCount == 0) { 2235 firstDimension.Add(variantOptions); 2236 } 2237 if (groupCount == 1) 2238 { 2239 secondDimension.Add(variantOptions); 2240 } 2241 if (groupCount == 2) 2242 { 2243 thirdDimension.Add(variantOptions); 2244 } 2245 } 2246 groupCount++; 2247 } 22482249 int rowCount = 0; 2250 int columnCount = 0; 22512252 <script> 2253 var variantsCollection = []; 2254 </script> 22552256 <table class="table table--compact js-variants-matrix dw-mod" id="VariantMatrixTable_@settings.ProductId"> 2257 @if (groupCount == 1) 2258 { 2259 <tbody> 2260 @foreach (VariantOption firstVariantOption in firstDimension) 2261 { 2262 var variantId = firstVariantOption.Id; 2263 <tr> 2264 <td class="u-bold"> 2265 @firstVariantOption.Name 2266 </td> 2267 <td> 2268 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount) 2269 </td> 2270 </tr> 2271 productLoopCounter++; 2272 } 22732274 <tr> 2275 <td>&nbsp;</td> 2276 <td> 2277 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div> 2278 </td> 2279 </tr> 2280 </tbody> 2281 } 2282 @if (groupCount == 2) 2283 { 2284 <thead> 2285 <tr> 2286 <td>&nbsp;</td> 2287 @foreach (VariantOption variant in secondDimension) 2288 { 2289 <td>@variant.Name</td> 2290 } 2291 </tr> 2292 </thead> 2293 <tbody> 2294 @foreach (VariantOption firstVariantOption in firstDimension) 2295 { 2296 string variantId = ""; 2297 columnCount = 0; 22982299 <tr> 2300 <td class="u-min-w120px">@firstVariantOption.Name</td> 23012302 @foreach (VariantOption secondVariantOption in secondDimension) 2303 { 2304 variantId = firstVariantOption.Id + "." + secondVariantOption.Id; 2305 <td> 2306 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount) 2307 </td> 23082309 columnCount++; 23102311 productLoopCounter++; 2312 } 23132314 <td> 2315 <div class="qty-field js-total-qty-row-@rowCount dw-mod">0</div> 2316 </td> 2317 </tr> 23182319 rowCount++; 2320 } 23212322 @{ 2323 columnCount = 0; 2324 } 23252326 <tr> 2327 <td>&nbsp;</td> 2328 @foreach (VariantOption secondVariantOption in secondDimension) 2329 { 2330 <td> 2331 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div> 2332 </td> 23332334 columnCount++; 2335 } 2336 <td>&nbsp;</td> 2337 </tr> 2338 </tbody> 2339 } 2340 @if (groupCount == 3) 2341 { 2342 <thead> 2343 <tr> 2344 <td>&nbsp;</td> 2345 @foreach (VariantOption thirdVariantOption in thirdDimension) 2346 { 2347 <td>@thirdVariantOption.Name</td> 2348 } 2349 </tr> 2350 </thead> 2351 <tbody> 2352 @foreach (VariantOption firstVariantOption in firstDimension) 2353 { 2354 int colspan = (thirdDimension.Count + 1); 23552356 <tr> 2357 <td colspan="@colspan" class="u-color-light-gray--bg u-bold">@firstVariantOption.Name</td> 2358 </tr> 23592360 foreach (VariantOption secondVariantOption in secondDimension) 2361 { 2362 string variantId = ""; 2363 columnCount = 0; 23642365 <tr> 2366 <td class="u-min-w120px">@secondVariantOption.Name</td> 23672368 @foreach (VariantOption thirdVariantOption in thirdDimension) 2369 { 2370 variantId = firstVariantOption.Id + "." + secondVariantOption.Id + "." + thirdVariantOption.Id; 23712372 <td> 2373 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount) 2374 </td> 23752376 columnCount++; 2377 productLoopCounter++; 2378 } 23792380 <td> 2381 <div class="qty-field js-total-qty-row-@rowCount dw-mod">0</div> 2382 </td> 2383 </tr> 2384 rowCount++; 2385 } 2386 } 23872388 @{ 2389 columnCount = 0; 2390 } 23912392 <tr> 2393 <td>&nbsp;</td> 2394 @foreach (VariantOption thirdVariantOption in thirdDimension) 2395 { 2396 <td> 2397 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div> 2398 </td> 23992400 columnCount++; 2401 } 2402 <td>&nbsp;</td> 2403 </tr> 2404 </tbody> 2405 } 2406 </table> 24072408 <script> 2409 document.addEventListener("DOMContentLoaded", function (event) { 2410 MatrixUpdateQuantity("@settings.ProductId"); 2411 }); 24122413 MatrixUpdateQuantity = function (productId) { 2414 var currentMatrix = document.getElementById("VariantMatrixTable_" + productId); 2415 var allQtyFields = currentMatrix.getElementsByClassName("js-qty"); 24162417 var qtyRowArr = []; 2418 var qtyColumnArr = []; 24192420 var totalQty = 0; 24212422 for (var i = 0; i < allQtyFields.length; i++) { 2423 qtyRowArr[allQtyFields[i].getAttribute("data-qty-row-group")] = 0; 2424 qtyColumnArr[allQtyFields[i].getAttribute("data-qty-column-group")] = 0; 2425 } 24262427 for (var i = 0; i < allQtyFields.length; i++) { 2428 qtyRowArr[allQtyFields[i].getAttribute("data-qty-row-group")] += parseFloat(allQtyFields[i].value); 2429 qtyColumnArr[allQtyFields[i].getAttribute("data-qty-column-group")] += parseFloat(allQtyFields[i].value); 2430 totalQty += parseFloat(allQtyFields[i].value); 2431 } 24322433 //Update row counters 2434 for (var i = 0; i < qtyRowArr.length; i++) { 2435 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-row-" + i)[0]; 24362437 if (qtyRowArr[i] != undefined && qtyCounter != null) { 2438 var currentCount = qtyCounter.innerHTML; 2439 qtyCounter.innerHTML = qtyRowArr[i]; 24402441 if (currentCount != qtyCounter.innerHTML) { 2442 qtyCounter.classList.add("qty-field--active"); 2443 } 2444 } 24452446 } 24472448 //Update column counters 2449 for (var i = 0; i < qtyColumnArr.length; i++) { 2450 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-column-" + i)[0]; 24512452 if (qtyColumnArr[i] != undefined && qtyCounter != null) { 2453 var currentCount = qtyCounter.innerHTML; 2454 qtyCounter.innerHTML = qtyColumnArr[i]; 24552456 if (currentCount != qtyCounter.innerHTML) { 2457 qtyCounter.classList.add("qty-field--active"); 2458 } 2459 } 2460 } 24612462 if (document.getElementById("TotalQtyCount_" + productId)) { 2463 document.getElementById("TotalQtyCount_" + productId).innerHTML = totalQty; 2464 } 24652466 //Clean up animations 2467 setTimeout(function () { 2468 for (var i = 0; i < qtyRowArr.length; i++) { 2469 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-row-" + i)[0]; 2470 if (qtyCounter != null) { 2471 qtyCounter.classList.remove("qty-field--active"); 2472 } 2473 } 2474 for (var i = 0; i < qtyColumnArr.length; i++) { 2475 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-column-" + i)[0]; 2476 if (qtyCounter != null) { 2477 qtyCounter.classList.remove("qty-field--active"); 2478 } 2479 } 2480 }, 1000); 2481 } 2482 </script> 2483 } 2484 } 24852486 @helper RenderVariantMatrixQuantityField(string variantId, VariantMatrix settings, int productLoopCounter, int rowCount, int columnCount) 2487 { 2488 string loopCount = productLoopCounter.ToString(); 24892490 bool combinationFound = false; 2491 double stock = 0; 2492 double quantityValue = 0; 2493 string note = ""; 24942495 VariantProduct variantProduct = null; 24962497 if (settings.GetVariantProducts().TryGetValue(variantId, out variantProduct)) 2498 { 2499 stock = variantProduct.Stock; 2500 quantityValue = variantProduct.Quantity; 2501 combinationFound = true; 2502 } 25032504 if (combinationFound) 2505 { 2506 <input type="hidden" name="ProductLoopCounter@(loopCount)" value="@loopCount" /> 2507 <input type="hidden" name="ProductID@(loopCount)" value="@settings.ProductId" /> 2508 <input type="hidden" name="VariantID@(loopCount)" value="@variantId" /> 2509 <input type="hidden" name="CurrentNote@(loopCount)" id="CurrentNote_@(settings.ProductId)_@variantId" value="@note" /> 2510 <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"> 25112512 if (stock != 0) 2513 { 2514 <small>@Translate("Stock") @stock</small> 2515 } 25162517 <script> 2518 var variants = '{ "ProductId" :' + '"@settings.ProductId"' + ', "VariantId": ' + '"@variantId"' +'}'; 2519 variantsCollection.push(variants); 2520 document.getElementById("Quantity_@(settings.ProductId)_@variantId").closest(".js-variants-matrix").setAttribute("data-variants-collection", "[" + variantsCollection + "]" ); 2521 </script> 2522 } 2523 else 2524 { 2525 <div class="use-btn-height" style="background-color: #a8a8a8"></div> 2526 } 2527 } 2528 @using System 2529 @using Dynamicweb.Rapido.Blocks.Components 2530 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 2531 @using Nevotex.Data.Entities 2532 @* Component *@ 25332534 @helper RenderAddToCart(CustomAddToCart settings) 2535 { 2536 //set Id for quantity selector to get it's value from button 2537 if (settings.QuantitySelector != null) 2538 { 2539 if (string.IsNullOrEmpty(settings.QuantitySelector.Id)) 2540 { 2541 settings.QuantitySelector.Id = Guid.NewGuid().ToString("N"); 2542 } 25432544 settings.AddButton.QuantitySelectorId = settings.QuantitySelector.Id; 25452546 if (settings.Disabled) 2547 { 2548 settings.QuantitySelector.Disabled = true; 2549 } 25502551 if (string.IsNullOrEmpty(settings.QuantitySelector.Name)) 2552 { 2553 settings.QuantitySelector.Name = settings.QuantitySelector.Id; 2554 } 2555 } 25562557 if (settings.Disabled) 2558 { 2559 settings.AddButton.Disabled = true; 2560 } 25612562 settings.AddButton.CssClass += " btn--condensed"; 25632564 //unitsSelector 2565 if (settings.UnitSelector != null) 2566 { 2567 if (settings.Disabled) 2568 { 2569 settings.QuantitySelector.Disabled = true; 2570 } 2571 } 25722573 <div class="buttons-collection @settings.WrapperCssClass" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 2574 @if (settings.UnitSelector != null) 2575 { 2576 @Render(settings.UnitSelector) 2577 } 2578 @if (settings.QuantitySelector != null) 2579 { 2580 @Render(settings.QuantitySelector) 2581 } 2582 @Render(settings.AddButton) 2583 </div> 2584 } 2585 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 2586 @using Dynamicweb.Rapido.Blocks.Components.General 2587 @using Nevotex.Data.Entities 25882589 @* Component *@ 25902591 @helper RenderAddToCartButton(CustomAddToCartBtn settings) 2592 { 2593 if (!settings.HideTitle) 2594 { 2595 if (string.IsNullOrEmpty(settings.Title)) 2596 { 2597 if (settings.BuyForPoints) 2598 { 2599 settings.Title = Translate("Buy with points"); 2600 } 2601 else 2602 { 2603 settings.Title = Translate("Add to cart"); 2604 } 2605 } 2606 } 2607 else 2608 { 2609 settings.Title = ""; 2610 } 26112612 if (settings.Icon == null) 2613 { 2614 settings.Icon = new Icon(); 2615 settings.Icon.LabelPosition = Dynamicweb.Rapido.Blocks.Components.General.IconLabelPosition.After; 2616 } 26172618 if (string.IsNullOrEmpty(settings.Icon.Name)) 2619 { 2620 settings.Icon.Name = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue; 2621 } 26222623 var errorMessage = Translate("Felaktigt antal, köp kan endast göras i jämt antal av"); 26242625 settings.OnClick = "if(CheckMultiple('Quantity_" + settings.ProductId + "', '{{multiple}}'))Cart.AddToCart(event, { " + 2626 "id: '" + settings.ProductId + "'," + 2627 (!string.IsNullOrEmpty(settings.VariantId) ? "variantId: '" + settings.VariantId + "'," : "") + 2628 (!string.IsNullOrEmpty(settings.UnitId) ? "unitId: '" + settings.UnitId + "'," : "") + 2629 (settings.BuyForPoints ? "buyForPoints: true," : "") + 2630 (!string.IsNullOrEmpty(settings.ProductInfo) ? "productInfo: " + settings.ProductInfo + "," : "") + 2631 "quantity: " + (string.IsNullOrEmpty(settings.QuantitySelectorId) ? "1" : "parseFloat(document.getElementById('" + settings.QuantitySelectorId + "').value)") + 2632 "});" + settings.OnClick; 26332634 @RenderButton(settings) 2635 } 2636 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 26372638 @* Component *@ 26392640 @helper RenderUnitSelector(UnitSelector settings) 2641 { 2642 if (string.IsNullOrEmpty(settings.Id)) 2643 { 2644 settings.Id = Guid.NewGuid().ToString("N"); 2645 } 2646 var disabledClass = settings.Disabled ? "disabled" : ""; 26472648 <input type="checkbox" id="@settings.Id" class="dropdown-trigger" /> 2649 <div class="dropdown unit-selector @settings.CssClass @disabledClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 2650 <label class="dropdown__header dropdown__btn dropdown__btn--unit-selector dw-mod" for="@settings.Id">@settings.SelectedOption</label> 2651 <div class="dropdown__content dw-mod"> 2652 @settings.OptionsContent 2653 </div> 2654 <label class="dropdown-trigger-off" for="@settings.Id"></label> 2655 </div> 2656 } 2657 @using System.Reflection 2658 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 26592660 @* Component *@ 26612662 @helper RenderQuantitySelector(QuantitySelector settings) 2663 { 2664 var attributes = new Dictionary<string, string>(); 26652666 /*base settings*/ 2667 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 2668 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 2669 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 2670 if (settings.Disabled) { attributes.Add("disabled", "true"); } 2671 if (settings.Required) { attributes.Add("required", "true"); } 2672 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 2673 /*end*/ 26742675 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 2676 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 2677 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 2678 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 2679 if (settings.Max != null) { attributes.Add("max", settings.Max.ToString()); } 2680 if (settings.Min == null) { settings.Min = 1; } 2681 attributes.Add("min", settings.Min.ToString()); 2682 if (settings.Step != null && !string.IsNullOrEmpty(settings.Step.ToString())) { attributes.Add("step", settings.Step.ToString()); } 2683 if (settings.Value == null) { settings.Value = 1; } 2684 attributes.Add("value", settings.Value.ToString()); 2685 attributes.Add("type", "number"); 26862687 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 26882689 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 2690 } 2691 @using Dynamicweb.Rapido.Blocks.Components 26922693 @using Dynamicweb.Frontend 2694 @using Dynamicweb.Frontend.Devices 2695 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 2696 @using Dynamicweb.Rapido.Blocks.Components.General 2697 @using System.Collections.Generic; 26982699 @* Component *@ 27002701 @helper RenderCustomerCenterList(CustomerCenterList settings) 2702 { 2703 bool isTouchDevice = Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet" ? true : false; 2704 string hideActions = isTouchDevice ? "u-block" : ""; 27052706 <table class="table data-list dw-mod"> 2707 @if (settings.GetHeaders().Length > 0) { 2708 <thead> 2709 <tr class="u-bold"> 2710 @foreach (CustomerCenterListHeaderItem header in settings.GetHeaders()) 2711 { 2712 var attributes = new Dictionary<string, string>(); 2713 if (!string.IsNullOrEmpty(header.Id)) { attributes.Add("id", header.Id); } 2714 if (!string.IsNullOrEmpty(header.CssClass)) { attributes.Add("class", header.CssClass); } 2715 attributes.Add("align", header.Align.ToString()); 2716 attributes = attributes.Concat(header.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 27172718 <td @ComponentMethods.AddAttributes(attributes)>@header.Title</td> 2719 } 2720 </tr> 2721 </thead> 2722 } 2723 @foreach (CustomerCenterListItem listItem in settings.GetItems()) 2724 { 2725 int columnCount = 0; 2726 int totalColumns = listItem.GetInfoItems().Length; 2727 string rowHasActions = listItem.GetActions().Length > 0 ? "data-list__item--has-actions" : ""; 2728 listItem.Id = !string.IsNullOrEmpty(listItem.Id) ? listItem.Id : Guid.NewGuid().ToString("N"); 27292730 var attributes = new Dictionary<string, string>(); 2731 if (!string.IsNullOrEmpty(listItem.Title)) { attributes.Add("title", listItem.Title); }; 27322733 attributes = attributes.Concat(listItem.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 2734 <tbody class="data-list__item @rowHasActions @listItem.CssClass dw-mod" @ComponentMethods.AddAttributes(attributes)> 2735 <tr> 2736 @if (!string.IsNullOrEmpty(listItem.Title) || !string.IsNullOrEmpty(listItem.Description)) { 2737 string onClick = !string.IsNullOrEmpty(listItem.OnClick) ? "onclick=\"" + listItem.OnClick + "\"" : ""; 27382739 <td rowspan="2" @onClick class="data-list__main-item dw-mod"> 2740 @if (!string.IsNullOrEmpty(listItem.Title)) { 2741 <div class="u-bold">@listItem.Title</div> 2742 } 2743 @if (!string.IsNullOrEmpty(listItem.Description)) { 2744 <div>@listItem.Description</div> 2745 } 2746 </td> 2747 } 27482749 @foreach (CustomerCenterListInfoItem infoItem in listItem.GetInfoItems()) 2750 { 2751 var infoAttributes = new Dictionary<string, string>(); 2752 if (!string.IsNullOrEmpty(infoItem.Id)) { infoAttributes.Add("id", infoItem.Id); }; 2753 if (!string.IsNullOrEmpty(infoItem.OnClick)) { infoAttributes.Add("onclick", infoItem.OnClick); }; 2754 infoAttributes.Add("align", infoItem.Align.ToString()); 27552756 infoAttributes = infoAttributes.Concat(infoItem.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 2757 string columnClick = columnCount < (totalColumns-1) && !string.IsNullOrEmpty(listItem.OnClick) ? "onclick=\"" + listItem.OnClick + "\"" : ""; 27582759 <td @ComponentMethods.AddAttributes(infoAttributes) @columnClick class="data-list__info-item dw-mod"> 2760 @if (!string.IsNullOrEmpty(infoItem.Title)) { 2761 <div>@infoItem.Title</div> 2762 } 2763 @if (!string.IsNullOrEmpty(infoItem.Subtitle)) { 2764 <div><small>@infoItem.Subtitle</small></div> 2765 } 2766 </td> 27672768 columnCount++; 2769 } 2770 </tr> 2771 <tr> 2772 <td colspan="7" align="right" class="u-va-bottom u-no-border"> 2773 <div class="data-list__actions @hideActions dw-mod" id="ActionsMenu_@listItem.Id"> 2774 @foreach (ButtonBase action in listItem.GetActions()) 2775 { 2776 action.ButtonLayout = ButtonLayout.LinkClean; 2777 action.Icon.CssClass += " u-full-height"; 2778 action.CssClass += " data-list__action-button link"; 27792780 @Render(action) 2781 } 2782 </div> 2783 </td> 2784 </tr> 2785 </tbody> 2786 } 2787 </table> 2788 } 27892790 @* Include the Blocks for the page *@ 2791 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2792 @using Dynamicweb.Core 2793 @using System 2794 @using System.Web 2795 @using System.Collections.Generic 2796 @using Dynamicweb.Rapido.Blocks 27972798 @{ 2799 BlocksPage productListProductsBlocksPage = BlocksPage.GetBlockPage("ProductList"); 28002801 Block productsBlock = new Block 2802 { 2803 Id = "Views", 2804 SortId = 30, 2805 Template = RenderProducts() 2806 }; 28072808 productListProductsBlocksPage.Add("ProductList", productsBlock); 2809 } 28102811 @helper RenderProducts() 2812 { 2813 @*This is part of a script template *@ 28142815 <div id="ProductsContainer" data-template="{{listTemplate}}" class="grid product-list grid--external-bleed-x dw-mod grid--align-content-start" data-save-cookie="true"> 2816 {{#ProductsContainer}} 2817 {{> (lookup . 'template') }} 2818 {{/ProductsContainer}} 2819 </div> 2820 } 282128222823 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2824 @using Dynamicweb.Core 2825 @using System 2826 @using System.Web 2827 @using System.Collections.Generic 2828 @using Dynamicweb.Rapido.Blocks 2829 @using Dynamicweb.Rapido.Blocks.Components 2830 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 2831 @using Dynamicweb.Rapido.Blocks.Components.General 2832 @using Dynamicweb.Rapido.Services 2833 @using Nevotex.Data.Entities 28342835 @functions { 2836 BlocksPage gridViewPage = BlocksPage.GetBlockPage("ProductList"); 2837 Dynamicweb.Frontend.ItemViewModel gridViewSettings = null; 2838 } 28392840 @if (true) 2841 { 2842 //gridViewSettings = Pageview.AreaSettings.GetItem("ProductList").GetItem("GridView"); 28432844 BlocksPage gridViewPage = BlocksPage.GetBlockPage("ProductList"); 28452846 gridViewPage.Add("Views", new Block 2847 { 2848 Id = "ProductGridItemContainer", 2849 Name = "th", 2850 SortId = 20 2851 }); 28522853 Block gridViewScripts = new Block 2854 { 2855 Id = "GridViewScripts", 2856 SortId = 20, 2857 Template = GridView(), 2858 BlocksList = new List<Block> { 2859 new Block 2860 { 2861 Id = "GridViewItem", 2862 SortId = 10, 2863 Template = RenderGridViewItem(), 2864 SkipRenderBlocksList = true, 2865 BlocksList = new List<Block> { 2866 new Block 2867 { 2868 Id = "GridViewItemHiddenProperties", 2869 SortId = 10, 2870 Template = RenderGridViewItemHiddenProperties() 2871 }, 2872 new Block 2873 { 2874 Id = "GridViewItemImageContainer", 2875 SortId = 20, 2876 SkipRenderBlocksList = true, 2877 Template = RenderGridViewItemImageContainer(), 2878 BlocksList = new List<Block> { 2879 new Block 2880 { 2881 Id = "GridViewItemImage", 2882 SortId = 10, 2883 Template = RenderGridViewItemImage() 2884 }, 2885 new Block 2886 { 2887 Id = "GridViewItemStickers", 2888 SortId = 20, 2889 Template = RenderGridViewItemStickers() 2890 } 2891 } 2892 }, 2893 new Block 2894 { 2895 Id = "GridViewItemInfoContainer", 2896 SortId = 30, 2897 SkipRenderBlocksList = true, 2898 Template = RenderGridViewItemInfoContainer(), 2899 BlocksList = new List<Block> { 2900 new Block 2901 { 2902 Id = "GridViewItemTitle", 2903 SortId = 10, 2904 Template = RenderGridViewItemTitle() 2905 } 2906 } 2907 }, 2908 new Block 2909 { 2910 Id = "GridViewItemFooter", 2911 SortId = 40, 2912 SkipRenderBlocksList = true, 2913 Template = RenderGridViewItemFooter(), 2914 BlocksList = new List<Block> { 2915 new Block 2916 { 2917 Id = "GridViewItemActions", 2918 SortId = 10, 2919 Template = RenderGridViewItemActions() 2920 } 2921 } 2922 } 2923 } 2924 } 2925 } 2926 }; 292729282929293029312932 gridViewPage.Add("BottomSnippets", gridViewScripts); 29332934 //favorites 2935 bool gridViewShowFavoriteButton = true; 29362937 if (gridViewShowFavoriteButton) 2938 { 2939 gridViewPage.Add("GridViewItemImageContainer", new Block 2940 { 2941 Id = "GridViewItemFavorites", 2942 SortId = 30, 2943 Template = RenderGridViewItemFavorites() 2944 }); 2945 } 29462947 //number 2948 bool gridViewShowNumber = true; 29492950 if (gridViewShowNumber) 2951 { 2952 gridViewPage.Add("GridViewItemInfoContainer", new Block 2953 { 2954 Id = "GridViewItemNumber", 2955 SortId = 20, 2956 Template = RenderGridViewItemNumber() 2957 }); 2958 } 29592960296129622963 //price 2964 bool gridViewShowPrice = true; 2965 if (gridViewShowPrice && Dynamicweb.Rapido.Services.User.IsPricesAllowed()) 2966 { 2967 gridViewPage.Add("GridViewItemInfoContainer", new Block 2968 { 2969 Id = "GridViewItemPrice", 2970 SortId = 30, 2971 Template = RenderGridViewItemPrice() 2972 }); 2973 } 29742975 //stock 2976 bool gridViewShowStock = false; 29772978 if (User.IsStockInfoAllowed() && gridViewShowStock) 2979 { 2980 gridViewPage.Add("GridViewItemFooter", new Block 2981 { 2982 Id = "GridViewItemStockAndDelivery", 2983 SortId = 20, 2984 Template = RenderGridViewItemStockAndDelivery() 2985 }); 2986 } 29872988 //static variants 2989 bool gridViewShowStaticVariants = false; 29902991 if (gridViewShowStaticVariants) 2992 { 2993 gridViewPage.Add("GridViewItemFooter", new Block 2994 { 2995 Id = "GridViewItemStaticVariants", 2996 SortId = 30, 2997 Template = RenderGridViewItemStaticVariants() 2998 }); 2999 } 30003001 //download button 3002 bool gridViewShowAddToDownloadButton = false; 30033004 if (gridViewShowAddToDownloadButton && Pageview.User != null) 3005 { 3006 gridViewPage.Add("GridViewItemFooter", new Block 3007 { 3008 Id = "GridViewItemDownloadButton", 3009 SortId = 40, 3010 Template = RenderGridViewItemDownloadButton() 3011 }); 3012 } 3013 } 30143015 @helper GridView() 3016 { 3017 int columnsCount = 3; 3018 string imageZoomOnHover = "image-hover--zoom"; 30193020 <script id="ProductGridItemContainer" type="text/x-template"> 3021 {{#.}} 3022 <div id="Product{{id}}" data-template="GridViewItem" data-preloader="overlay" class="grid__col-lg-{{columnCss}} grid__col-md-{{columnCss}} grid__col-sm-{{columnCss}} grid__col-xs-6 product-list__grid-item @imageZoomOnHover dw-mod"> 3023 {{#Product}} 3024 {{>GridViewItem}} 3025 {{/Product}} 3026 </div> 3027 {{/.}} 3028 </script> 3029 } 30303031 @helper RenderGridViewItem() 3032 { 3033 List<Block> subBlocks = gridViewPage.GetBlockListById("GridViewItem"); 30343035 <script id="GridViewItem" type="text/x-template"> 3036 {{#.}} 3037 <div class="grid__col--auto js-product-scroll-trigger u-no-padding u-full-height" data-params="{{googleImpression}}"> 3038 @RenderBlockList(subBlocks) 3039 </div> 3040 {{/.}} 3041 </script> 3042 } 30433044 @helper RenderGridViewItemHiddenProperties() 3045 { 3046 <input type="hidden" name="ProductLoopCounter{{id}}" value="{{id}}" /> 3047 <input type="hidden" name="ProductID{{id}}" value="{{productId}}" /> 3048 <input type="hidden" name="VariantID{{id}}" value="{{variantid}}" id="Variant_{{id}}" /> 3049 <input type="hidden" name="UnitID{{id}}" value="{{unitId}}" id="Unit_{{id}}" /> 3050 <input type="hidden" name="Quantity{{id}}" value="1" id="Quantity_{{id}}" /> 3051 } 30523053 @helper RenderGridViewItemImageContainer() 3054 { 3055 List<Block> subBlocks = gridViewPage.GetBlockListById("GridViewItemImageContainer"); 30563057 <div class="grid__cell product-list__grid-item__image dw-mod {{imageBorder}} {{noImage}}"> 3058 @RenderBlockList(subBlocks) 3059 </div> 3060 } 30613062 @helper RenderGridViewItemImage() 3063 { 3064 bool secondaryImage = false; 30653066 <a href="{{link}}" 3067 onclick="{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}" 3068 title="{{{name}}}{{#if variantName}}, {{variantName}}{{/if}}" 3069 class="u-block u-position-relative image-hover__wrapper dw-mod"> 3070 <img width="168" height="168" class="grid__cell-img grid__cell-img--centered u-padding {{imgPadding}} b-lazy" src="/Files/Images/placeholder.gif" 3071 data-src="/Admin/Public/GetImage.ashx?width=300&amp;height=300&amp;crop={{cropMode}}&amp;Compression=75&amp;FillCanvas=true&amp;DoNotUpscale=true&amp;image={{image}}" 3072 @if (secondaryImage) { <text> 3073 {{#if secondaryImage}} 3074 data-secondary-image-src="/Admin/Public/GetImage.ashx?width=300&amp;height=300&amp;crop=5&amp;Compression=75&amp;FillCanvas=true&amp;DoNotUpscale=true&amp;image={{secondaryImage}}" 3075 {{/if}} 3076 </text> } 3077 alt="{{{name}}}{{#if variantName}}, {{variantName}}{{/if}}" /> 3078 </a> 3079 } 30803081 @helper RenderGridViewItemStickers() 3082 { 3083 <text> 3084 {{#StickersContainers}} 3085 {{>StickersContainer}} 3086 {{/StickersContainers}} 3087 </text> 3088 } 30893090 @helper RenderGridViewItemFavorites() 3091 { 3092 <div class="favorites favorites--for-grid-view u-pull--right {{hasVariants}} dw-mod" {{hasVariants}}> 3093 {{#Favorite}} 3094 {{>FavoriteTemplate}} 3095 {{/Favorite}} 3096 </div> 3097 } 30983099 @helper RenderGridViewItemInfoContainer() 3100 { 3101 List<Block> subBlocks = gridViewPage.GetBlockListById("GridViewItemInfoContainer"); 31023103 <div class="grid__cell product-list__grid-item__price-info dw-mod {{paddingFix}} "> 3104 @RenderBlockList(subBlocks) 3105 </div> 3106 } 31073108 @helper RenderGridViewItemTitle() 3109 { 3110 <a href="{{link}}" class="u-color-inherit" onclick="{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}" title="{{{name}}}{{#if variantName}}, {{variantName}}{{/if}}"> 3111 <h6 class="u-condensed-text u-bold">{{{name}}}{{#if variantName}}, {{variantName}}{{/if}}</h6> 3112 </a> 3113 } 31143115 @helper RenderGridViewItemNumber() 3116 { 3117 <div class="item-number dw-mod {{displayCss}} {{hideArticleNumberCss}} ">@Translate("ArtNr", "Art. nr"): {{number}} </div> 31183119 if (Dynamicweb.Frontend.PageView.Current().Device != Dynamicweb.Frontend.Devices.DeviceType.Mobile) 3120 { 3121 // login to see price 3122 bool userLoggedIn = Dynamicweb.Security.UserManagement.User.IsExtranetUserLoggedIn(); 31233124 if (!userLoggedIn && (Pageview.AreaID == 21 || Pageview.AreaID == 24 || Pageview.AreaID == 25)) 3125 { 3126 <div class="u-ta-left dw-mod {{displayCss}}"> 3127 <label for="SignInModalTrigger" class="item-number sign-in-modal-trigger-button" onclick="setTimeout(function () { document.getElementById('LoginUsername').focus() }, 10)"> 3128 @Translate("Logga_in_for_pris_och_kop") 3129 </label> 3130 </div> 3131 } 3132 } 3133 } 31343135313631373138 @helper RenderGridViewItemPrice() 3139 { 3140 int columnsCount = 4; 3141 bool pointShopOnly = false; 3142 bool showCartButton = false; 3143 bool showVATPrice = false; 3144 bool isPricesWithVATEnabled = Dynamicweb.Ecommerce.Common.Context.DisplayPricesWithVat; 31453146 if (pointShopOnly) 3147 { 3148 <text> 3149 {{#if havePointPrice}} 3150 <div class="price price--product-list dw-mod">{{points}} @Translate("points")</div> 3151 @if (showCartButton) 3152 { 3153 <text> 3154 {{#unless canBePurchasedWithPoints}} 3155 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small> 3156 {{/unless}} 3157 </text> 3158 } 3159 {{else}} 3160 @Translate("Not available") 3161 {{/if}} 3162 </text> 31633164 } 3165 else 3166 { 3167 <div class="price price--product-list dw-mod">{{price}}</div> 3168 <div class="before-price {{onSale}} dw-mod">{{discount}}</div> 3169 if (showVATPrice) 3170 { 3171 <div class="vat-price vat-price--product-list u-margin-top dw-mod"> 3172 @if (columnsCount <= 4) 3173 { 3174 if (isPricesWithVATEnabled) 3175 { 3176 <span>@Translate("excl. VAT")</span><span> ({{priceWithoutVAT}})</span> 3177 } 3178 else 3179 { 3180 <span>@Translate("incl. VAT")</span><span> ({{priceWithVAT}})</span> 3181 } 3182 } 3183 else 3184 { 3185 if (isPricesWithVATEnabled) 3186 { 3187 <div>@Translate("excl. VAT")</div><div>({{priceWithoutVAT}})</div> 3188 } 3189 else 3190 { 3191 <div>@Translate("incl. VAT")</div><div>({{priceWithVAT}})</div> 3192 } 3193 } 3194 </div> 3195 } 3196 <text> 3197 {{#if priceRRP}} 3198 <div><small>@Translate("RRP") {{priceRRP}}</small></div> 3199 {{/if}} 3200 </text> 3201 } 3202 } 32033204 @helper RenderGridViewItemFooter() 3205 { 3206 List<Block> subBlocks = gridViewPage.GetBlockListById("GridViewItemFooter"); 3207 bool showStaticVariants = false; 32083209 <div class="product-list__grid-item__footer dw-mod {{displayCss}}"> 3210 @RenderBlockList(subBlocks) 3211 </div> 3212 } 32133214 @helper RenderGridViewItemViewButton() 3215 { 3216 string viewMoreText = "View"; 32173218 @Render(new Link 3219 { 3220 Href = "{{link}}", 3221 Id = "CartButton_{{id}}", 3222 Title = Translate(viewMoreText), 3223 OnClick = "{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}", 3224 ButtonLayout = ButtonLayout.Secondary, 3225 CssClass = "u-no-margin" 3226 }); 3227 } 32283229 @helper RenderGridViewItemAddToCart() 3230 { 3231 bool pointShopOnly = false; 3232 string wrapperClass = "buttons-collection--center"; 3233 int columnsCount = 4; 3234 bool hideButtonText = columnsCount >= 4 || Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet"; 32353236 if (pointShopOnly && columnsCount <= 4) 3237 { 3238 hideButtonText = false; 3239 } 32403241 var addToCartBtn = new CustomAddToCart 3242 { 3243 WrapperCssClass = wrapperClass, 3244 AddButton = new CustomAddToCartBtn 3245 { 3246 HideTitle = hideButtonText, 3247 ProductId = "{{productId}}", 3248 VariantId = "{{variantid}}", 3249 UnitId = "{{unitId}}", 3250 ProductInfo = "{{productInfo}}", 3251 BuyForPoints = pointShopOnly, 3252 OnClick = "{{facebookPixelAction}}", 3253 ExtraAttributes = new Dictionary<string, string> 3254 { 3255 { "{{disabledBuyButton}}", "" } 3256 } 3257 } 3258 }; 32593260 if (!pointShopOnly) 3261 { 3262 addToCartBtn.QuantitySelector = new QuantitySelector 3263 { 3264 Id = "Quantity{{id}}" 3265 }; 3266 } 32673268 @Render(addToCartBtn) 3269 } 32703271 @helper RenderGridViewItemActions() 3272 { 3273 bool showCartButton = false; 3274 bool showViewButton = true; 32753276 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed()) 3277 { 3278 if (showCartButton) 3279 { 3280 if (!showViewButton) 3281 { 3282 <text>{{#if hideAddToCartButton}}</text> 3283 <div>@RenderGridViewItemViewButton()</div> 3284 <text>{{else}}</text> 3285 @RenderGridViewItemAddToCart() 3286 <text>{{/if}}</text> 3287 } 3288 else 3289 { 3290 @RenderGridViewItemAddToCart() 3291 } 3292 } 3293 else if (showViewButton) 3294 { 3295 <div>@RenderGridViewItemViewButton()</div> 3296 } 3297 } 3298 else if (showViewButton) 3299 { 3300 <div>@RenderGridViewItemViewButton()</div> 3301 } 3302 } 33033304 @helper RenderGridViewItemStockAndDelivery() 3305 { 3306 <text>{{#if stockText}}</text> 3307 <div class="u-margin-top"> 3308 <div><span class="stock-icon {{stockState}} u-no-margin dw-mod" title="{{stockText}}"></span> {{stockText}}</div> 3309 <div> 3310 {{#if deliveryText}} 3311 {{deliveryText}} 3312 {{else}} 3313 - 3314 {{/if}} 3315 </div> 3316 </div> 3317 <text>{{/if}}</text> 3318 } 33193320 @helper RenderGridViewItemStaticVariants() 3321 { 3322 string variantsSize = "sm"; 33233324 <text> 3325 {{#Variants}} 3326 @if (variantsSize == "lg") 3327 { 3328 <text> 3329 {{>StaticVariantsLgTemplate}} 3330 </text> 3331 } 3332 else 3333 { 3334 <text> 3335 {{>StaticVariantsTemplate}} 3336 </text> 3337 } 3338 {{/Variants}} 33393340 {{#ifCond variantGroupsCount '>' 1}} 3341 <div class="static-variant"> 3342 @Translate("More options available") 3343 </div> 3344 {{/ifCond}} 33453346 {{#ifCond variantGroupsCount '==' 0}} 3347 <div class="static-variant"></div> 3348 {{/ifCond}} 3349 </text> 3350 } 33513352 @helper RenderGridViewItemDownloadButton() 3353 { 3354 <button type="button" class="btn btn--primary u-no-margin u-margin-top btn--condensed dw-mod js-add-to-downloads" title="@Translate("Add")" data-product-id="{{productId}}"> 3355 @Render(new Icon { Prefix = "fas", Name = "fa-plus", CssClass = "js-button-icon" }) 3356 <span class="js-button-text">@Translate("Add")</span> 3357 </button> 3358 } 33593360 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 3361 @using Dynamicweb.Core 3362 @using System 3363 @using System.Web 3364 @using System.Collections.Generic 3365 @using Dynamicweb.Rapido.Blocks 33663367 @{ 3368 /* 3369 BlocksPage productListPromotionsBlocksPage = BlocksPage.GetBlockPage("ProductList"); 33703371 Block productListPromotions = new Block 3372 { 3373 Id = "Promotions", 3374 SortId = 10, 3375 Template = RenderProductListPromotions() 3376 }; 3377 productListPromotionsBlocksPage.Add("PageContainer", productListPromotions); 3378 */ 3379 } 33803381 @helper RenderProductListPromotions() 3382 { 3383 @*This is part of a script template *@ 33843385 //string listId = HttpContext.Current.Request.QueryString.Get("ListID"); 3386 //bool isFavoriteList = !string.IsNullOrEmpty(listId); 3387 string smallDeviceCss = ""; 33883389 if (false) 3390 { 3391 switch ("Disable") 3392 { 3393 case "OnlyText": 3394 <article class="grid__col-12 u-margin-bottom @smallDeviceCss"> 3395 <h1>{{groupName}}</h1> 3396 {{{groupDescription}}} 3397 {{#ifCond groupPromotionLink "!==" ""}} 3398 <div> 3399 <a href="{{groupPromotionLink}}" class="btn btn--primary">{{groupPromotionLinkText}}</a> 3400 </div> 3401 {{/ifCond}} 3402 </article> 3403 break; 3404 case "TextAndImage": 3405 <article class="grid__col-12 u-margin-bottom @smallDeviceCss"> 3406 <div class="grid grid--bleed"> 3407 <div class="grid__col-md-6"> 3408 <h1>{{groupName}}</h1> 3409 {{{groupDescription}}} 3410 {{#ifCond groupPromotionLink "!==" ""}} 3411 <div> 3412 <a href="{{groupPromotionLink}}" class="btn btn--primary">{{groupPromotionLinkText}}</a> 3413 </div> 3414 {{/ifCond}} 3415 </div> 3416 {{#ifCond groupPromotionImage "!==" ""}} 3417 <div class="grid__col-md-6"> 3418 <img src="/Admin/Public/GetImage.ashx?width=600&crop=5&Compression=75&DoNotUpscale=true&image={{groupPromotionImage}}" alt="{{groupName}}" class="background-image__cover" /> 3419 </div> 3420 {{/ifCond}} 3421 </div> 3422 </article> 3423 break; 3424 case "Banner": 3425 <text> 3426 {{#ifCond groupPromotionImage "!==" ""}} 3427 <article class="grid__col-12 u-margin-bottom @smallDeviceCss"> 3428 <div class="u-color-light grid center-container center-container--with-background-image grid__col--bg" style="background-image:url('{{groupPromotionImage}}');"> 3429 <div class="grid__col-12 u-middle"> 3430 <div class="grid__cell"> 3431 {{{groupDescription}}} 3432 {{#ifCond groupPromotionLink "!==" ""}} 3433 <div> 3434 <a href="{{groupPromotionLink}}" class="btn btn--primary">{{groupPromotionLinkText}}</a> 3435 </div> 3436 {{/ifCond}} 3437 </div> 3438 </div> 3439 </div> 3440 </article> 3441 {{/ifCond}} 3442 </text> 3443 break; 3444 } 3445 } 3446 } 3447 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 3448 @using Dynamicweb.Core 3449 @using System 3450 @using System.Web 3451 @using System.Collections.Generic 3452 @using Dynamicweb.Rapido.Blocks 34533454 @{ 3455 BlocksPage productListMenuBlocksPage = BlocksPage.GetBlockPage("ProductList"); 34563457 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && 3458 Converter.ToString(Pageview.Page.PropertyItem["LeftMenu"]) == "True" && 3459 Pageview.Page.NavigationSettings != null && 3460 Pageview.Page.NavigationSettings.UseEcomGroups) { 34613462 Block productListMenuBlock = new Block 3463 { 3464 Id = "Menu", 3465 SortId = 20, 3466 Template = RenderProductListMenu() 3467 }; 34683469 productListMenuBlocksPage.Add("Navigation", productListMenuBlock); 3470 } 3471 } 34723473 @helper RenderProductListMenu() 3474 { 3475 var navigationMarkup = RenderNavigation(new 3476 { 3477 id = "leftnav", 3478 cssclass = "dwnavigation", 3479 startLevel = 1, 3480 endlevel = 5, 3481 template = "LeftNavigation.xslt", 3482 mode = "ecom" 3483 }); 34843485 <h2 class="u-margin-bottom">@Translate("Product categories")</h2> 34863487 <div class="u-padding-bottom--lg"> 3488 @navigationMarkup 3489 </div> 3490 } 3491 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 3492 @using Dynamicweb.Core 3493 @using System 3494 @using System.Web 3495 @using System.Collections.Generic 3496 @using Dynamicweb.Rapido.Blocks 3497 @using Dynamicweb.Rapido.Blocks.Components.General 34983499 @{ 3500 BlocksPage productListFacetsBlocksPage = BlocksPage.GetBlockPage("ProductList"); 3501 string facetsBlockViewMode = "left"; 35023503 if (facetsBlockViewMode == "left" && Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 3504 { 3505 Block facetsBlock = new Block 3506 { 3507 Id = "Facets", 3508 SortId = 30, 3509 Template = RenderProductListFacets() 3510 }; 3511 productListFacetsBlocksPage.Add("Navigation", facetsBlock); 3512 } 35133514 if (facetsBlockViewMode == "top" || Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet") 3515 { 3516 Block facetsBlock = new Block 3517 { 3518 Id = "Facets", 3519 SortId = 10, 3520 Template = RenderProductListTopFacets() 3521 }; 3522 productListFacetsBlocksPage.Add("ProductList", facetsBlock); 3523 } 35243525 Block facetSelections = new Block 3526 { 3527 Id = "FacetSelections", 3528 SortId = 20, 3529 Template = RenderFacetSelections() 3530 }; 3531 productListFacetsBlocksPage.Add("ProductList", facetSelections); 35323533 Block checkboxFacetTemplate = new Block 3534 { 3535 Id = "CheckboxFacet", 3536 SortId = 30, 3537 Template = RenderCheckboxFacets() 3538 }; 3539 productListFacetsBlocksPage.Add("BottomSnippets", checkboxFacetTemplate); 35403541 Block RangeFacetTemplate = new Block 3542 { 3543 Id = "RangeFacet", 3544 SortId = 90, 3545 Template = RenderRangeFacets() 3546 }; 3547 productListFacetsBlocksPage.Add("BottomSnippets", RangeFacetTemplate); 35483549 Block tagsFacetTemplate = new Block 3550 { 3551 Id = "TagsFacet", 3552 SortId = 40, 3553 Template = RenderTagsFacets() 3554 }; 3555 productListFacetsBlocksPage.Add("BottomSnippets", tagsFacetTemplate); 35563557 Block colorsFacetTemplate = new Block 3558 { 3559 Id = "ColorFacet", 3560 SortId = 50, 3561 Template = RenderColorFacets() 3562 }; 3563 productListFacetsBlocksPage.Add("BottomSnippets", colorsFacetTemplate); 35643565 Block selectedFilter = new Block 3566 { 3567 Id = "SelectedFilter", 3568 SortId = 60, 3569 Template = RenderSelectedFilter() 3570 }; 3571 productListFacetsBlocksPage.Add("BottomSnippets", selectedFilter); 35723573 Block selectedRangeFilter = new Block 3574 { 3575 Id = "SelectedRangeFilter", 3576 SortId = 60, 3577 Template = RenderSelectedRangeFilter() 3578 }; 3579 productListFacetsBlocksPage.Add("BottomSnippets", selectedRangeFilter); 358035813582 Block selectedColorFilter = new Block 3583 { 3584 Id = "SelectedColorFilter", 3585 SortId = 70, 3586 Template = RenderSelectedColorFilter() 3587 }; 3588 productListFacetsBlocksPage.Add("BottomSnippets", selectedColorFilter); 35893590 Block resetFilters = new Block 3591 { 3592 Id = "ResetFilters", 3593 SortId = 80, 3594 Template = RenderResetFilters() 3595 }; 3596 productListFacetsBlocksPage.Add("BottomSnippets", resetFilters); 3597 } 35983599 @helper RenderFacetSelections() 3600 { 3601 @*This is part of a script template *@ 3602 <text> 3603 {{#if FacetSelections}} 3604 <div class="buttons-collection u-margin-bottom" id="selectedFacets"> 3605 {{#FacetSelections}} 3606 {{>(lookup . 'template')}} 3607 {{/FacetSelections}} 3608 </div> 3609 {{/if}} 3610 </text> 3611 } 36123613 @helper RenderProductListFacets() 3614 { 3615 var facetSettings = Pageview.AreaSettings.GetItem("ProductList").GetItem("Facets"); 3616 string boxDisplay = facetSettings.GetList("BoxDisplay") != null ? facetSettings.GetList("BoxDisplay").SelectedValue : "scroll"; 36173618 string facetMoreClass = (boxDisplay == "view-more" ? "facets-container__list--more" : ""); 36193620 @*This is part of a script template *@ 36213622 <input type="checkbox" id="CheckFacetGroups" class="js-remember-state u-hidden" data-expand="CheckFacetGroups" /> 3623 <div class="facets-container facets-container--left expandable--collapsed dw-mod" data-trigger="CheckFacetGroups"> 3624 {{#FacetGroups}} 3625 <input type="checkbox" id="OptionsGroup_{{name}}" class="expand-trigger js-remember-state" {{defaultState}} /> 36263627 <div class="expand-container facets-container__box dw-mod js-filter"> 3628 <label class="expand-container__btn facets-container__header dw-mod" for="OptionsGroup_{{name}}">{{name}}</label> 3629 <div class="expand-container__content js-facet-container dw-mod" data-input="OptionsGroup_{{name}}"> 36303631 {{#ifCond template "===" "Checkboxes"}} 3632 <div class="facets-container__search {{showFilter}} dw-mod"> 3633 <input type="text" class="u-full-width u-no-margin" onkeyup="Filter.FilterItems(event)" placeholder="@Translate("Search")" /> 3634 </div> 3635 {{/ifCond}} 36363637 <div id="facetList{{name}}" class="x {{template}} facets-container__list @facetMoreClass dw-mod"> 3638 {{#FacetOptions}} 3639 {{#ifCond template "===" "Checkboxes"}} 3640 {{>Checkboxes}} 3641 {{/ifCond}} 3642 {{#ifCond template "===" "Range"}} 3643 {{>Range}} 3644 {{/ifCond}} 3645 {{#ifCond template "===" "Weight"}} 3646 {{>Checkboxes}} 3647 {{/ifCond}} 3648 {{#ifCond template "===" "Tags"}} 3649 {{>Tags}} 3650 {{/ifCond}} 3651 {{#ifCond template "===" "Colors"}} 3652 {{>Colors}} 3653 {{/ifCond}} 3654 {{/FacetOptions}} 3655 <div class="u-hidden js-filter-not-found"> 3656 @Translate("Your search gave 0 results") 3657 </div> 3658 </div> 36593660 @if (boxDisplay == "view-more") 3661 { 3662 <div class="facets-container__more js-facet-expand"> 3663 @Render(new Button 3664 { 3665 Title = "<span class=js-facet-trigger-text>" + Translate("View more") + "</span>", 3666 ButtonType = ButtonType.Button, 3667 ButtonLayout = ButtonLayout.Clean, 3668 CssClass = "facets-container__more-button js-facet-trigger u-flex u-no-margin u-full-width", 3669 OnClick = "Facets.ExpandToggle(this)", 3670 ExtraAttributes = new Dictionary<string, string>{ 3671 {"data-target", "facetList{{name}}"}, 3672 {"data-toggle-text", Translate("Show less")}, 3673 }, 3674 Icon = new Icon 3675 { 3676 Prefix = "fal", 3677 Name = "fa-angle-down", 3678 } 3679 }) 3680 </div> 3681 } 3682 </div> 3683 </div> 3684 {{/FacetGroups}} 3685 </div> 3686 <label for="CheckFacetGroups" class="btn btn--primary btn--full u-no-margin dw-mod js-expand-hide facets-container-trigger" data-trigger="CheckFacetGroups">@Translate("Select filters")</label> 3687 <label for="CheckFacetGroups" class="btn btn--primary btn--full u-no-margin dw-mod expandable--collapsed facets-container-trigger" data-trigger="CheckFacetGroups">@Translate("Close filters")</label> 3688 } 36893690 @helper RenderProductListTopFacets() 3691 { 3692 @*This is part of a script template *@ 3693 <input type="checkbox" id="CheckFacetGroups" class="js-remember-state u-hidden" data-expand="CheckFacetGroups" /> 3694 <div class="grid grid--external-bleed dw-mod expandable--collapsed facets-container facets-container--top u-margin-bottom" data-trigger="CheckFacetGroups"> 3695 @if (Pageview.Device.ToString() == "Mobile") 3696 { 3697 string dropdownCssClass = Pageview.Device.ToString() == "Mobile" ? "u-flex-grow--1" : ""; 36983699 <div class="grid__col-lg-3 grid__col-md-3 grid__col-sm-4 grid__col-xs-12"> 3700 <input type="checkbox" id="ProductSort" class="dropdown-trigger" /> 3701 <div class="dropdown u-inline-block @dropdownCssClass dw-mod"> 3702 <label class="dropdown__header dropdown__btn dropdown__btn--small dw-mod" for="ProductSort">{{selectedSort}}</label> 3703 <div class="dropdown__content dw-mod"> 3704 <div class="dropdown__item" onclick="HandlebarsBolt.UpdateQueryParameters('productList', { SortBy: '', SortOrder: '' }, true);">@Translate("Default")</div> 3705 <div class="dropdown__item" onclick="HandlebarsBolt.UpdateQueryParameters('productList', { SortBy: 'Created', SortOrder: 'DESC'}, true);">@Translate("Newest")</div> 3706 <div class="dropdown__item" onclick="HandlebarsBolt.UpdateQueryParameters('productList', { SortBy: 'NameForSort', SortOrder: 'ASC'}, true);">@Translate("Name A - Z")</div> 3707 <div class="dropdown__item" onclick="HandlebarsBolt.UpdateQueryParameters('productList', { SortBy: 'NameForSort', SortOrder: 'DESC'}, true);">@Translate("Name Z - A")</div> 3708 @if (Dynamicweb.Rapido.Services.User.IsPricesAllowed()) 3709 { 3710 <div class="dropdown__item" onclick="HandlebarsBolt.UpdateQueryParameters('productList', { SortBy: 'Price', SortOrder: 'ASC' }, true);">@Translate("Price low - high")</div> 3711 <div class="dropdown__item" onclick="HandlebarsBolt.UpdateQueryParameters('productList', { SortBy: 'Price', SortOrder: 'DESC' }, true);">@Translate("Price high - low")</div> 3712 } 3713 </div> 3714 <label class="dropdown-trigger-off" for="ProductSort"></label> 3715 </div> 3716 </div> 3717 } 37183719 {{#FacetGroups}} 3720 <div class="grid__col-lg-3 grid__col-md-3 grid__col-sm-4 grid__col-xs-12"> 3721 <input type="checkbox" id="OptionsGroup_{{counter}}" class="dropdown-trigger" /> 3722 <div class="dropdown dw-mod js-filter"> 3723 <label class="dropdown__header dropdown__btn dw-mod" for="OptionsGroup_{{counter}}">{{name}}</label> 3724 <div class="dropdown__content dropdown__content--padding dw-mod"> 3725 <div class="u-margin-bottom {{showFilter}}"> 3726 <input type="text" class="u-full-width u-no-margin" onkeyup="Filter.FilterItems(event)" placeholder="@Translate("Search")" /> 3727 </div> 3728 {{#FacetOptions}} 3729 {{#ifCond template "===" "Checkboxes"}} 3730 {{>Checkboxes}} 3731 {{/ifCond}} 3732 {{#ifCond template "===" "Range"}} 3733 {{>Range}} 3734 {{/ifCond}} 3735 {{#ifCond template "===" "Weight"}} 3736 {{>Checkboxes}} 3737 {{/ifCond}} 3738 {{#ifCond template "===" "Tags"}} 3739 {{>Tags}} 3740 {{/ifCond}} 3741 {{#ifCond template "===" "Colors"}} 3742 {{>Colors}} 3743 {{/ifCond}} 3744 {{/FacetOptions}} 3745 <div class="u-hidden js-filter-not-found"> 3746 @Translate("Your search gave 0 results") 3747 </div> 3748 </div> 3749 <label class="dropdown-trigger-off" for="OptionsGroup_{{counter}}"></label> 3750 </div> 3751 </div> 3752 {{/FacetGroups}} 3753 </div> 3754 <label for="CheckFacetGroups" class="btn btn--primary btn--full u-margin-bottom--lg dw-mod js-expand-hide facets-container-trigger" data-trigger="CheckFacetGroups">@Translate("Select filters")</label> 3755 <label for="CheckFacetGroups" class="btn btn--primary btn--full u-margin-bottom--lg dw-mod expandable--collapsed facets-container-trigger" data-trigger="CheckFacetGroups">@Translate("Close filters")</label> 3756 } 37573758 @helper RenderCheckboxFacets() 3759 { 3760 <script id="Checkboxes" type="text/x-template"> 3761 <div class="form__field-group u-no-margin dw-mod"> 3762 <input type="checkbox" class="{{selected}} checkbox-facet__checkbox form__control dw-mod" onclick="Facets.UpdateFacets(this);" id="{{queryParameter}}{{value}}" name="{{queryParameter}}" value="[{{value}}]" {{selected}} {{disabled}}> 3763 <label class="{{disabled}} checkbox-facet dw-mod" data-filter-value="{{label}}" for="{{queryParameter}}{{value}}"> 3764 <span class="checkbox-facet__label dw-mod">{{label}}</span> 3765 <span class="checkbox-facet__count dw-mod">{{#if showCount}}({{count}}){{/if}}</span> 3766 </label> 3767 </div> 3768 </script> 3769 } 37703771 @helper RenderRangeFacets() 3772 { 3773 var queryParameterFrom = string.Empty; 3774 var queryParameterTo = string.Empty; 37753776 if (!string.IsNullOrWhiteSpace(Dynamicweb.Context.Current.Request.QueryString["Bredd_From"]) && !string.IsNullOrWhiteSpace(Dynamicweb.Context.Current.Request.QueryString["Bredd_To"])) 3777 { 3778 queryParameterFrom = Dynamicweb.Context.Current.Request.QueryString["Bredd_From"]; 3779 queryParameterTo = Dynamicweb.Context.Current.Request.QueryString["Bredd_To"]; 37803781 } 37823783 <script id="Range" type="text/x-template"> 3784 <div class="form__field-group u-no-margin dw-mod" > 3785 <div class="rangeInputContainer"> 3786 <span id="from_container"> 3787 <span>@Translate("Från") </span> 3788378937903791 <select id="{{queryParameter}}_From" name="{{queryParameter}}_From"> 3792 {{#datalist}} 3793 <option value="{{option}}" {{fromSelected}} >{{option}}</option> 3794 {{/datalist}} 37953796 </select> 3797 </span> 3798 <span id="to_conatiner"> 3799 <span>@Translate("Till") </span> 3800 <select id="{{queryParameter}}_To" name="{{queryParameter}}_To"> 3801 {{#datalist}} 3802 <option value="{{option}}" {{toSelected}} >{{option}}</option> 3803 {{/datalist}} 3804 </select> 3805 </span> 38063807 </div> 3808 <div class="button_control"> 3809 <input type="button" name="{{queryParameter}}" class="js-rangeFilterApply" value="@Translate("Filtrera")" onclick="Facets.UpdateFacets(this);" /> 38103811 @if (!string.IsNullOrWhiteSpace(queryParameterFrom)) 3812 { 38133814 } 38153816 {{#if queryParameterFrom }} 3817 <button type="button" class="btn btn--tag btn--removeFilter dw-mod" data-check="checked" onclick="Facets.UpdateFacets(this);" name="Bredd" value="[]" title="Ta bort filter"> 3818 @Translate("Visa alla bredd")&nbsp;<i class="fal fa-times"></i> 3819 </button> 3820 {{/if}} 382138223823 </div> 3824 </div> 3825 </script> 3826 } 38273828 @helper RenderTagsFacets() 3829 { 3830 <script id="Tags" type="text/x-template"> 3831 <button type="button" class="btn btn--tag {{selected}} {{disabled}} dw-mod" data-filter-value="{{label}}" data-check="{{selected}}" onclick="Facets.UpdateFacets(this);" name="{{queryParameter}}" value="[{{value}}]" {{disabled}}> 3832 {{label}} <span class="facets-group__counter dw-mod">({{count}})</span> 3833 </button> 3834 </script> 3835 } 38363837 @helper RenderColorFacets() 3838 { 3839 <script id="Colors" type="text/x-template"> 3840 <button type="button" class="btn btn--colorbox u-margin-right {{selected}} {{disabled}} dw-mod" data-filter-value="{{label}}" style="background-color: {{value}}" title="{{label}}" data-check="{{selected}}" onclick="Facets.UpdateFacets(this);" name="{{queryParameter}}" value="[{{value}}]" {{disabled}}></button> 3841 </script> 3842 } 38433844 @helper RenderSelectedFilter() 3845 { 3846 <script id="SelectedFilter" type="text/x-template"> 3847 <button type="button" class="btn btn--tag dw-mod" data-check="checked" onclick="Facets.UpdateFacets(this);" name="{{queryParameter}}" value="[{{value}}]" title="@Translate("Remove filter")"> 3848 {{group}}: {{label}} &nbsp;<i class="fal fa-times"></i> 3849 </button> 3850 </script> 3851 } 38523853 @helper RenderSelectedRangeFilter() 3854 { 3855 <script id="SelectedRangeFilter" type="text/x-template"> 3856 <button type="button" class="btn btn--tag dw-mod" data-check="checked" onclick="Facets.UpdateFacets(this);" name="{{name}}" value="[{{value}}]" title="@Translate("Remove filter")"> 3857 {{group}}: {{queryParameterFrom}} - {{queryParameterTo}} &nbsp;<i class="fal fa-times"></i> 3858 </button> 3859 </script> 3860 } 38613862 @helper RenderSelectedColorFilter() 3863 { 3864 <script id="SelectedColorFilter" type="text/x-template"> 3865 <button type="button" class="btn btn--tag dw-mod" data-check="checked" onclick="Facets.UpdateFacets(this);" name="{{queryParameter}}" value="[{{value}}]" title="@Translate("Remove filter")"> 3866 {{group}}: <div class="btn__colorbox dw-mod" style="background-color: {{value}}"></div> <i class="fas fa-times"></i> 3867 </button> 3868 </script> 3869 } 38703871 @helper RenderResetFilters() 3872 { 3873 <script id="ResetFilters" type="text/x-template"> 3874 <button type="button" class="btn btn--tag" onclick="Facets.ResetFacets();"> 3875 @Translate("Reset all filters") &nbsp;<i class="fal fa-redo"></i> 3876 </button> 3877 </script> 3878 } 387938803881 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 3882 @using Dynamicweb.Core 3883 @using System 3884 @using System.Web 3885 @using System.Collections.Generic 3886 @using Dynamicweb.Rapido.Blocks 38873888 @{ 3889 BlocksPage productListMoreBlocksPage = BlocksPage.GetBlockPage("ProductList"); 38903891 Block moreBlock = new Block 3892 { 3893 Id = "More", 3894 SortId = 40, 3895 Template = RenderListMore() 3896 }; 38973898 productListMoreBlocksPage.Add("ProductList", moreBlock); 3899 } 39003901 @helper RenderListMore() 3902 { 3903 @*This is part of a script template *@ 3904 string groupID = HttpContext.Current.Request.QueryString.Get("groupid"); 3905 string listId = HttpContext.Current.Request.QueryString.Get("ListID"); 3906 bool isFavoriteList = !string.IsNullOrEmpty(listId); 3907 string moreFeedFullUrl = GetGlobalValue("Global:Pageview.Url.Raw") + "&feed=true"; 3908 moreFeedFullUrl += !isFavoriteList ? "&DoNotShowVariantsAsSingleProducts=True" : ""; 3909 string columnCss = Pageview.Device.ToString() == "Mobile" ? "grid__col--bleed" : "u-no-padding"; 3910 <text> 3911 {{#if ProductsContainer}} 3912 <div class="grid"> 3913 <div class="grid__col-12 @columnCss"> 3914 <button type="button" id="LoadMoreButton" class="btn btn--primary btn--full {{nextdisabled}} dw-mod" data-current="{{currentPage}}" data-page-size="{{pageSize}}" data-total="{{totalPages}}" data-container="ProductsContainer" data-feed-url="@moreFeedFullUrl&{{loadMoreFeedParams}}" onclick="LoadMore.Next(this)" {{nextdisabled}}>@Translate("Load") {{pageSizeText}} @Translate("more")</button> 3915 <button type="button" class="btn btn--clean" onclick="window.scroll(0, 0)">@Translate("Return to top")</button> 3916 </div> 3917 </div> 3918 {{/if}} 3919 </text> 3920 } 3921 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 3922 @using Dynamicweb.Core 3923 @using System 3924 @using System.Web 3925 @using System.Collections.Generic 3926 @using Dynamicweb.Rapido.Blocks 3927 @using Dynamicweb.Rapido.Blocks.Components 3928 @using Dynamicweb.Rapido.Blocks.Components.General 39293930 @{ 3931 BlocksPage productListBottomSnippetsPage = BlocksPage.GetBlockPage("ProductList"); 39323933 Block productListStickers = new Block 3934 { 3935 Id = "Stickers", 3936 SortId = 10, 3937 Template = RenderStickersTemplates() 3938 }; 3939 productListBottomSnippetsPage.Add("BottomSnippets", productListStickers); 39403941 Block productListUnits = new Block 3942 { 3943 Id = "Units", 3944 SortId = 20, 3945 Template = RenderUnitTemplates() 3946 }; 3947 productListBottomSnippetsPage.Add("BottomSnippets", productListUnits); 39483949 Block productListVariants = new Block 3950 { 3951 Id = "Variants", 3952 SortId = 30, 3953 Template = RenderVariantTemplates() 3954 }; 3955 productListBottomSnippetsPage.Add("BottomSnippets", productListVariants); 39563957 Block productListFavorites = new Block 3958 { 3959 Id = "Favorites", 3960 SortId = 40, 3961 Template = RenderFavoritesTemplates() 3962 }; 3963 productListBottomSnippetsPage.Add("BottomSnippets", productListFavorites); 39643965 Block productListPreRender = new Block 3966 { 3967 Id = "PreRenders", 3968 SortId = 50, 3969 Template = RenderPreRenderTemplates() 3970 }; 3971 productListBottomSnippetsPage.Add("BottomSnippets", productListPreRender); 39723973 Block productListInitializers = new Block 3974 { 3975 Id = "Initializers", 3976 SortId = 60, 3977 Template = RenderInitializers() 3978 }; 3979 productListBottomSnippetsPage.Add("BottomSnippets", productListInitializers); 3980 } 398139823983 @helper RenderFavoritesTemplates() 3984 { 3985 var selectedFavoriteIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue : "star"; 3986 string favoriteIcon = "fas fa-" + selectedFavoriteIcon; 3987 string favoriteOutlineIcon = "fal fa-" + selectedFavoriteIcon; 3988 bool useFacebookPixel = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID")); 3989 string currentFavoriteListId = HttpContext.Current.Request.QueryString.Get("ListID"); 39903991 <script id="FavoriteTemplate" type="text/x-template"> 3992 <div class="favorites-list u-ta-left js-favorites-list"> 3993 @Render(new Button { 3994 CssClass = "u-no-margin js-favorite-btn", 3995 Icon = new Icon 3996 { 3997 Name = "{{#if isInAnyFavoriteList}}" + favoriteIcon + "{{else}}" + favoriteOutlineIcon + "{{/if}}", 3998 CssClass = "fa-1_5x", 3999 LabelPosition = IconLabelPosition.After 4000 }, 4001 ButtonLayout = ButtonLayout.LinkClean, 4002 ButtonType = ButtonType.Button, 4003 OnClick = "document.getElementById('FavoriteTrigger_{{id}}').checked = true" 4004 }) 4005 <input type="checkbox" id="FavoriteTrigger_{{id}}" class="dropdown-trigger" /> 4006 <div class="dropdown dropdown--position-32px"> 4007 <div class="dropdown__content dropdown__content--show-left dropdown__content--padding u-w220px dw-mod"> 4008 <ul class="list list--clean dw-mod"> 4009 {{#FavoriteLists}} 4010 {{>FavoriteListItem}} 4011 {{/FavoriteLists}} 4012 </ul> 4013 </div> 4014 <label class="dropdown-trigger-off" for="FavoriteTrigger_{{id}}"></label> 4015 </div> 4016 </div> 4017 </script> 40184019 <script id="FavoriteListItem" type="text/x-template"> 4020 <li> 4021 @{ 4022 var button = new Button { 4023 CssClass = "list__link u-no-underline", 4024 OnClick = "toggleFavAction(this, event)", 4025 Icon = new Icon { Name = "{{#if isInFavoriteList}}" + favoriteIcon + "{{else}}" + favoriteOutlineIcon + "{{/if}}", LabelPosition = IconLabelPosition.After }, 4026 AltText = "{{#if isInFavoriteList}}" + Translate("Remove from") + " {{name}}{{else}}" + Translate("Add to") + " {{name}}{{/if}}", 4027 Title = "{{name}}", 4028 ButtonType = ButtonType.Button, 4029 ButtonLayout = ButtonLayout.LinkClean, 4030 ExtraAttributes = new Dictionary<string, string> 4031 { 4032 { "data-list-id", "{{listId}}" }, 4033 { "data-list-name", "{{name}}" }, 4034 { "data-remove-link", "{{removeLink}}" }, 4035 { "data-add-link", "{{addLink}}" }, 4036 { "data-is-in-list", "{{isInFavoriteList}}" }, 40374038 } 4039 }; 4040 if (useFacebookPixel) 4041 { 4042 button.ExtraAttributes.Add("data-facebook-object", "{{facebookPixelAddAction}}"); 4043 } 4044 } 4045 @Render(button) 4046 </li> 4047 </script> 40484049 <script> 4050 @if (!string.IsNullOrEmpty(currentFavoriteListId)) 4051 { 4052 <text> 4053 window.currentFavoriteListId = "@currentFavoriteListId"; 4054 </text> 4055 } 4056 function toggleFavAction(button, event) { 4057 if (button.getAttribute('data-add-link').indexOf('CCCreateNewList') > -1) { 4058 Scroll.SavePosition(event); 4059 @if (useFacebookPixel) 4060 { 4061 <text> 4062 fbq('track', 'AddToWishlist', JSON.parse(button.getAttribute('data-facebook-object'))); 4063 </text> 4064 } 4065 location.href = button.getAttribute('data-add-link'); 4066 return; 4067 } 4068 let isAdd = button.getAttribute('data-is-in-list') == "false"; 4069 Request.Fetch().get( 4070 isAdd ? button.getAttribute('data-add-link') : button.getAttribute('data-remove-link'), 4071 function (result) { 4072 button.querySelector('i').className = isAdd ? '@favoriteIcon u-margin-right--lg' : '@favoriteOutlineIcon u-margin-right--lg'; 4073 button.setAttribute('data-is-in-list', isAdd); 4074 button.setAttribute('title', (!isAdd ? '@Translate("Add to") ' : '@Translate("Remove from") ') + button.getAttribute('data-list-name')) 4075 let favList = button.closest('.js-favorites-list'); 4076 let favBtn = favList.querySelector('.js-favorite-btn i'); 4077 let isInAnyFavoriteList = favList.querySelector('[data-is-in-list=true]') != null; 4078 if (isInAnyFavoriteList) { 4079 favBtn.className = '@favoriteIcon' + ' fa-1_5x'; 4080 } else { 4081 favBtn.className = '@favoriteOutlineIcon' + ' fa-1_5x'; 4082 } 4083 @if (useFacebookPixel) 4084 { 4085 <text> 4086 if (isAdd) { 4087 fbq('track', 'AddToWishlist', JSON.parse(button.getAttribute('data-facebook-object'))); 4088 } 4089 </text> 4090 } 4091 if (window.currentFavoriteListId != null) { //if this page is favorite list 4092 let listId = button.getAttribute("data-list-id"); 4093 if (listId == window.currentFavoriteListId && !isAdd) { 4094 location.reload(); 4095 } 4096 } 4097 }, 4098 function () { 4099 console.error("FavoriteLists: Error in ToggleFavAction request"); 4100 }, 4101 false 4102 ); 4103 } 4104 </script> 4105 } 41064107 @helper RenderStickersTemplates() 4108 { 4109 <script id="StickersContainer" type="text/x-template"> 4110 <div class="stickers-container stickers-container--{{{convertStickerPositionToClassName Position}}} dw-mod"> 4111 {{#Stickers}} 4112 {{>Sticker}} 4113 {{/Stickers}} 4114 </div> 4115 </script> 41164117 <script id="Sticker" type="text/x-template"> 4118 <div class="stickers-container__tag {{CssClass}} dw-mod">{{Title}}</div> 4119 </script> 41204121 <script id="MiniSticker" type="text/x-template"> 4122 <div class="stickers-container__tag stickers-container__tag--micro {{CssClass}} dw-mod">{{Title}}</div> 4123 </script> 4124 } 41254126 @helper RenderUnitTemplates() 4127 { 4128 <script id="UnitOption" type="text/x-template"> 4129 <div class="dropdown__item dw-mod" onclick="HandlebarsBolt.UpdateContent(this.closest('.js-product').id, '{{link}}&feed=true&UnitID={{value}}')">{{name}}</div> 4130 </script> 4131 } 41324133 @helper RenderVariantTemplates() { 4134 <script id="VariantsTemplate" type="text/x-template"> 4135 {{#.}} 4136 <div> 4137 <div> 4138 {{#VariantOptions}} 4139 {{>VariantOption}} 4140 {{/VariantOptions}} 4141 </div> 4142 </div> 4143 {{/.}} 4144 </script> 41454146 <script id="VariantOption" type="text/x-template"> 4147 {{#if color}} 4148 <button type="button" data-variant-id="{{variantId}}" data-variant-group="{{groupId}}" onclick="MatchVariants.SelectThis(event)" class="btn btn--colorbox u-margin-right {{disabled}} {{selected}} js-variant-option" data-check="{{selected}}" {{disabled}} style="background-color: {{color}}"></button> 4149 {{else}} 4150 {{#if image}} 4151 <img data-variant-id="{{variantId}}" data-variant-group="{{groupId}}" src="{{image}}" onclick="MatchVariants.SelectThis(event)" alt="{{name}}" title="{{name}}" class="btn btn--tag {{selected}} js-variant-option" data-check="{{selected}}" /> 4152 {{else}} 4153 <button type="button" data-variant-id="{{variantId}}" data-variant-group="{{groupId}}" onclick="MatchVariants.SelectThis(event)" class="btn btn--tag {{disabled}} {{selected}} js-variant-option" data-check="{{selected}}" {{disabled}}>{{name}}</button> 4154 {{/if}} 4155 {{/if}} 4156 </script> 41574158 <script id="DropdownVariantsTemplate" type="text/x-template"> 4159 {{#.}} 4160 <div> 4161 <div class="u-bold">{{name}}</div> 4162 <select id="VariantSelector_{{id}}" class="u-full-width dw-mod" name="VariantSelector_{{id}}" onchange="MatchVariants.SelectOnChange(event)" > 4163 <option>@Translate("Choose")</option> 4164 {{#VariantOptions}} 4165 {{>DropdownVariantOption}} 4166 {{/VariantOptions}} 4167 </select> 4168 </div> 4169 {{/.}} 4170 </script> 41714172 <script id="DropdownVariantOption" type="text/x-template"> 4173 <option class="js-variant-option {{selected}}" id="{{groupId}}_{{variantId}}" value="{{groupId}}_{{variantId}}" data-variant-id="{{variantId}}" data-variant-group="{{groupId}}" {{#if selected}}selected{{/if}} data-check="{{selected}}">{{name}}</option> 4174 </script> 41754176 <script id="StaticVariantsTemplate" type="text/x-template"> 4177 {{#.}} 4178 {{#if isFirstGroup}} 4179 <div> 4180 {{#VariantOptions}} 4181 {{>StaticVariantOption}} 4182 {{/VariantOptions}} 4183 </div> 4184 {{/if}} 4185 {{/.}} 4186 </script> 41874188 <script id="StaticVariantOption" type="text/x-template"> 4189 {{#if color}} 4190 <div class="static-variant static-variant--color dw-mod" style="background-color: {{color}}" title="{{name}}"></div> 4191 {{else}} 4192 <div class="static-variant dw-mod">{{name}} </div> 4193 {{/if}} 4194 </script> 419541964197 <script id="StaticVariantsLgTemplate" type="text/x-template"> 4198 {{#.}} 4199 {{#if isFirstGroup}} 4200 <div class="padding-size-xs"> 4201 {{#VariantOptions}} 4202 {{>StaticVariantLgOption}} 4203 {{/VariantOptions}} 4204 </div> 4205 {{/if}} 4206 {{/.}} 4207 </script> 42084209 <script id="StaticVariantLgOption" type="text/x-template"> 4210 {{#if color}} 4211 <div class="static-variant static-variant--color static-variant--color--lg dw-mod" style="background-color: {{color}}" title="{{name}}"></div> 4212 {{else}} 4213 <div class="static-variant dw-mod">{{name}} </div> 4214 {{/if}} 4215 </script> 42164217 <script id="VariantOptionImage" type="text/x-template"> 4218 <img data-variant-id="{{variantId}}" data-friends="{{friendsList}}" data-variant-group="{{groupId}}" onclick="MatchVariants.SelectThis(event)" src="/Admin/Public/GetImage.ashx?width=100&amp;height=50&amp;crop=5&amp;Compression=75&amp;image=/Images/{{image}}" alt="{{name}}" title="{{name}}" class="btn btn--tag {{disabled}} {{selected}} js-variant-option" data-check="{{selected}}" {{disabled}} /> 4219 </script> 4220 } 42214222 @helper RenderPreRenderTemplates() { 4223 string facetsViewMode = !String.IsNullOrEmpty(Pageview.AreaSettings.GetItem("ProductList").GetString("FacetsViewMode")) ? Pageview.AreaSettings.GetItem("ProductList").GetString("FacetsViewMode").ToLower() : "left"; 42244225 <script id="ProductPreRenderContainer" type="text/x-template"> 4226 @if (facetsViewMode == "left" && Pageview.Device.ToString() != "Mobile") 4227 { 4228 <div class="grid__col-3"> 4229 <div class="pre-render-element pre-render-element--xs"></div> 4230 <div class="pre-render-element pre-render-element--md"></div> 4231 <div class="pre-render-element pre-render-element--md"></div> 4232 <div class="pre-render-element pre-render-element--md"></div> 4233 </div> 4234 } 4235 <div class="grid__col-auto"> 4236 <div class="pre-render-element pre-render-element--xs"></div> 4237 <div class="pre-render-element pre-render-element--lg"></div> 4238 <div class="pre-render-element pre-render-element--lg"></div> 4239 <div class="pre-render-element pre-render-element--lg"></div> 4240 <div class="pre-render-element pre-render-element--lg"></div> 4241 </div> 4242 </script> 4243 } 42444245 @helper RenderInitializers() { 4246 <script> 4247 document.addEventListener("DOMContentLoaded", function (event) { 4248 document.getElementById("productList").addEventListener('contentLoaded', function (e) { 4249 if (getTarget(e).id === "productList") { 4250 Search.Init(); 4251 Facets.Init("selectedFacets", "productList"); 4252 } 4253 }, false); 42544255 @{ 4256 bool useGoogleTagManager = false; 42574258 if (useGoogleTagManager) 4259 { 4260 <text> 4261 Scroll.AddIsInViewportListener(".js-product-scroll-trigger", function (elem) { 4262 let googleImpression = JSON.parse(elem.getAttribute("data-params")); 4263 googleEnchantImpression(googleImpression); 4264 elem.classList.remove("js-product-scroll-trigger"); 4265 }); 4266 </text> 4267 } 4268 } 42694270 }); 4271 </script> 4272 } 427342744275 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 4276 @using Dynamicweb.Core 4277 @using System 4278 @using System.Web 4279 @using System.Collections.Generic 4280 @using Dynamicweb.Rapido.Blocks 42814282 @{ 4283 BlocksPage customBlocksPage = BlocksPage.GetBlockPage("ProductList"); 42844285 } 428642874288 @if (productListNavigation.BlocksList.Count == 0) 4289 { 4290 productListNavigation.Design.RenderType = RenderType.Hide; 4291 } 42924293 <form name="multiForm" id="multiForm" method="post" onkeypress="return event.keyCode != 13;"> 4294 @* onkeypress is the fix for disabling submit form on Enter key from any field in product list *@ 4295 <input type="hidden" name="CartCmd" id="CartCmd" value="addMulti" /> 4296 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 4297 @RenderBlockList(productListPage.BlocksRoot.BlocksList) 4298 </form> 42994300 @helper RenderPageContainer() 4301 { 4302 List<Block> subBlocks = this.productListPage.GetBlockListById("PageContainer").OrderBy(item => item.SortId).ToList(); 4303 var groupid = HttpContext.Current.Request.QueryString["groupid"]; 4304 string pageUrl = GetGlobalValue("Global:Pageview.Url.Raw"); 4305 string feedFullUrl = pageUrl + "&feed=true"; 4306 feedFullUrl += !isFavoriteList ? "&DoNotShowVariantsAsSingleProducts=True" : ""; 4307 string smallDeviceCss = Pageview.Device.ToString() == "Mobile" ? "" : "u-padding"; 4308 string pageId = Convert.ToString(Dynamicweb.Frontend.PageView.Current().Page.ID); 4309 string groupUrl = $"/default.aspx?id={pageId}&GroupId="; 4310 var renderGroups = true; 4311 var renderProducts = true; 4312 var group = Services.ProductGroups.GetGroup(groupid); 43134314 if (!string.IsNullOrWhiteSpace(groupid)) 4315 { 4316 if (Services.ProductGroups.HasSubgroups(group)) 4317 { 4318 renderProducts = false; 4319 } 4320 else 4321 { 4322 renderGroups = false; 4323 } 43244325 } 432643274328432943304331 if (groupid == "GROUP318" || groupid == "GROUP758" || groupid == "1011atSHOP17" || groupid == "1011atSHOP16" || groupid == "1011atSHOP15") 4332 { 4333 renderGroups = false; 4334 } 4335433643374338 if (renderGroups) 4339 { 4340 <section class="multiple-paragraphs-container multiple-paragraphs-container--spacing-sm dw-mod groupheader-fix"> 4341 <div class="paragraph-container__grid--bleed-x "> 4342 <div class="grid grid--align-content-start js-handlebars-root" id="groupList" data-template="GroupContainer" data-pre-render-template="ProductPreRenderContainer" data-json-feed="@feedFullUrl" data-no-result-template="NoGroupsFound" data-preloader="overlay"></div> 4343 </div> 4344 </section> 4345 } 43464347 if (renderProducts) 4348 { 4349 <div class="grid grid--align-content-start @smallDeviceCss js-handlebars-root" id="productList" data-template="ProductContainer" data-pre-render-template="ProductPreRenderContainer" data-json-feed="@feedFullUrl" data-preloader="minimal"></div> 4350 } 4351 else 4352 { 4353 <div id="productList"></div> 4354 } 43554356435743584359 <script id="GroupContainer" type="text/x-template"> 4360 {{#.}} 43614362 {{#if groupLargeImage}} 4363 <div class="grid"> 4364 <div class="grid__col-12 grid__col--bleed-x"> 4365 <div class="grid__cell group-image"> 4366 <img src="{{groupLargeImage}}" alt="{{groupName}}" /> 4367 </div> 4368 </div> 4369 </div> 4370 {{/if}} 43714372 <div class="grid"> 4373 <div class="grid__col-12"> 4374 <div class="grid__cell"> 4375 <div class="u-pull--left"> 4376 <h1><i class="{{headerIcon}}"></i>{{groupName}}</h1> 4377 <div class="u-margin-bottom-lg">{{{groupDescription}}}</div> 4378 </div> 4379 </div> 4380 </div> 4381 </div> 43824383 <div class="grid"> 4384 <div class="grid__col-12 grid__col--bleed-x"> 4385 <div class="grid__cell"> 4386 <div id="GroupsContainer" class="grid product-list dw-mod" data-template="GroupGridItemContainer" data-preloader="minimal"> 4387 {{#GroupsContainer}} 4388 {{>GroupGridItemContainer}} 4389 {{/GroupsContainer}} 4390 </div> 4391 </div> 4392 </div> 4393 </div> 4394439543964397 {{/.}} 4398 </script> 43994400 <script id="GroupGridItemContainer" type="text/x-template"> 4401 {{#.}} 4402 <div id="Group{{id}}" class="grid__col-lg-3 grid__col-md-3 grid__col-sm-3 grid__col-xs-6 product-list__list-item dw-mod" style="{{hide}}" data-template="GroupGridItem" data-preloader="false"> 4403 {{#Group}} 4404 {{>GroupGridItem}} 4405 {{/Group}} 4406 </div> 4407 {{/.}} 4408 </script> 44094410 <script id="GroupGridItem" type="text/x-template"> 4411 {{#.}} 4412 <div class="grid__cell u-border dw-mod {{noImage}}"> 4413 <a href="@groupUrl{{link}}" onclick="Scroll.SavePosition(event)"><img class="grid__cell-img grid__cell-sm-img--centered" src="/Admin/Public/GetImage.ashx?width=350&amp;height=350&amp;crop=0&amp;Compression=75&amp;image={{image}}" alt="{{name}}" /></a> 4414 </div> 44154416 <div class="grid__cell dw-mod u-margin-top"> 4417 <a href="@groupUrl{{link}}" onclick="Scroll.SavePosition(event)" title="{{name}}"><h6 class="u-condensed-text grid__cell-sm-img--centered">{{name}}</h6></a> 4418 </div> 4419 {{/.}} 4420 </script> 442144224423 <script id="ProductContainer" type="text/x-template"> 4424 {{#each .}} 4425 @RenderBlockList(subBlocks) 4426 {{else}} 44274428 @{ 4429 var searchText = HttpContext.Current.Request.QueryString.Get("Search") != null ? HttpContext.Current.Request.QueryString.Get("Search") : ""; 44304431 if (!string.IsNullOrWhiteSpace(searchText)) 4432 { 4433 <div class="grid__col-12"> 4434 <h2 class="u-ta-center">@Translate("Your search gave 0 results")</h2> 4435 </div> 4436 } 44374438 } 44394440 {{/each}} 4441 </script> 4442 } 44434444 @helper RenderProductList() 4445 { 4446 @*This is part of a script template *@ 44474448 List<Block> subBlocks = productListPage.GetBlockListById("ProductList").OrderBy(item => item.SortId).ToList(); 4449 string smallDeviceCss = Pageview.Device.ToString() == "Mobile" ? "u-no-padding" : ""; 4450 string columnClass = "auto"; 44514452 if (productListPage.GetBlockListById("Navigation").Count == 0) 4453 { 4454 columnClass = "12"; 4455 } 445644574458 <div class="grid__col-@columnClass @smallDeviceCss"> 4459 @RenderBlockList(subBlocks) 4460 </div> 4461 } 44624463 @helper RenderProductListHeader() 4464 { 4465 List<Block> subBlocks = this.productListPage.GetBlockListById("ProductListHeader"); 4466 bool enableSeparationLine = productListSettings.GetBoolean("EnableSeparationLine"); 4467 string className = (enableSeparationLine != null && enableSeparationLine ? "u-border-bottom u-padding-bottom" : ""); 44684469 <div class="grid grid--align-content-start grid--justify-start grid--bleed u-margin-bottom--lg u-padding grid--wrap u-flex-grow--0 dw-mod"> 4470 <div class="grid @className"> 4471 <div class="u-pull--left"> 4472 <h1><i class="{{headerIcon}}"></i>{{groupName}}</h1> 4473 <div class="u-margin-bottom-lg">{{{groupDescription}}}</div> 4474 </div> 44754476 @RenderBlockList(subBlocks) 4477 </div> 4478 </div> 4479 } 44804481 @helper RenderProductListTitle() 4482 { 4483 var header = new Heading { Title = "{{{header}}}", CssClass = "u-no-margin" }; 4484 var searchText = HttpContext.Current.Request.QueryString.Get("Search") != null ? HttpContext.Current.Request.QueryString.Get("Search") : ""; 44854486 if (isFavoriteList) 4487 { 4488 var selectedFavoriteIcon = "star"; 4489 header.Icon = new Icon { Prefix = "fas", Name = "fa-" + selectedFavoriteIcon, LabelPosition = IconLabelPosition.After }; 4490 @Render(header) 4491 } 449244934494 if (!string.IsNullOrWhiteSpace(searchText)) 4495 { 4496 @Render(header) 4497 } 449844994500 } 45014502 @helper RenderFavoriteListSearch() 4503 { 4504 string pageId = GetGlobalValue("Global:Page.ID"); 4505 string pageUrl = GetGlobalValue("Global:Pageview.Url.Raw"); 4506 string feedFullUrl = pageUrl + "&feed=true"; 4507 string searchPlaceholder = Translate("Search favorite products"); 4508 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; 45094510 <div class="typeahead u-color-inherit typeahead--favorites js-typeahead" data-page-size="10" id="FavoritesSearch" data-list-id="@favoriteListId" data-search-feed-id="@pageId&feed=true" data-result-page-id="@pageId"> 4511 <input type="text" class="typeahead-search-field u-no-margin u-full-width js-typeahead-search-field" placeholder="@searchPlaceholder" value="@searchValue"> 4512 <ul class="dropdown dropdown--absolute-position u-full-width js-handlebars-root js-typeahead-search-content u-min-w220px u-full-width dw-mod" id="FavoritesSearchContent" data-template="SearchProductsTemplate" data-json-feed="@feedFullUrl&ListID=@favoriteListId" data-init-onload="false" data-preloader="minimal"></ul> 4513 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod js-typeahead-enter-btn"><i class="fas fa-search"></i></button> 4514 </div> 4515 }