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_04b057be6586423ebf4acc1b86fa8f32.<RenderPageContainer>b__97_0(TextWriter __razor_helper_writer) in D:\wwwroot\nevotex\Files\Templates\Designs\Rapido\eCom\Productlist\ProductsRender.cshtml:line 4319
at RazorEngine.Templating.TemplateWriter.ToString()
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at CompiledRazorTemplates.Dynamic.RazorEngine_04b057be6586423ebf4acc1b86fa8f32.<>c__DisplayClass5_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\wwwroot\nevotex\Files\Templates\Designs\Rapido\eCom\Productlist\ProductsRender.cshtml:line 228
at CompiledRazorTemplates.Dynamic.RazorEngine_04b057be6586423ebf4acc1b86fa8f32.<>c__DisplayClass4_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\wwwroot\nevotex\Files\Templates\Designs\Rapido\eCom\Productlist\ProductsRender.cshtml:line 138
at CompiledRazorTemplates.Dynamic.RazorEngine_04b057be6586423ebf4acc1b86fa8f32.Execute() in D:\wwwroot\nevotex\Files\Templates\Designs\Rapido\eCom\Productlist\ProductsRender.cshtml:line 4299
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 18 19 @functions { 20 BlocksPage productListPage = BlocksPage.GetBlockPage("ProductList"); 21 Dynamicweb.Frontend.ItemViewModel productListSettings = null; 22 23 string favoriteListId = HttpContext.Current.Request.QueryString.Get("ListID"); 24 bool isFavoriteList = !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("ListID")); 25 26 } 27 28 @{ 29 30 productListSettings = Pageview.AreaSettings.GetItem("ProductList"); 31 32 33 34 // productlistTemplate 35 36 Block pageContainer = new Block() 37 { 38 Id = "PageContainer", 39 Template = RenderPageContainer(), 40 SkipRenderBlocksList = true, 41 BlocksList = new List<Block> { 42 new Block 43 { 44 Id = "ProductListHeader", 45 SortId = 10, 46 Template = RenderProductListHeader(), 47 SkipRenderBlocksList = true, 48 BlocksList = new List<Block> { 49 new Block 50 { 51 Id = "ProductListTitle", 52 SortId = 10, 53 Design = new Design 54 { 55 CssClass = isFavoriteList ? "grid__col-xs-12 grid__col-md-4" : "grid__col-xs-12 grid__col-md-6" 56 }, 57 Template = RenderProductListTitle() 58 } 59 } 60 } 61 } 62 }; 63 productListPage.Add(pageContainer); 64 65 Block productListNavigation = new Block() 66 { 67 Id = "Navigation", 68 SortId = 20, 69 Design = new Design 70 { 71 RenderType = RenderType.Column, 72 Size = "3" 73 } 74 }; 75 productListPage.Add("PageContainer", productListNavigation); 76 77 Block productListContainer = new Block() 78 { 79 Id = "ProductList", 80 SortId = 30, 81 Template = RenderProductList(), 82 SkipRenderBlocksList = true 83 }; 84 productListPage.Add("PageContainer", productListContainer); 85 86 if (isFavoriteList) 87 { 88 productListPage.Add("ProductListHeader", new Block 89 { 90 Id = "FavoriteListSearch", 91 SortId = 20, 92 Template = RenderFavoriteListSearch(), 93 Design = new Design 94 { 95 CssClass = "grid__col-sm-4 u-margin-bottom u-margin-top grid--align-self-center" 96 } 97 }); 98 } 99100 Block productListSnippets = new Block() 101 { 102 Id = "BottomSnippets", 103 SortId = 40 104 }; 105 productListPage.Add(productListSnippets); 106 } 107108 @* This is required for the product list feed to work *@ 109 @GetValue("DoNotRenderProductListTemplate") 110111 @* Include the required Grid builder (Contains the methods @RenderBlockList and @RenderBlock) *@ 112 @using System.Text.RegularExpressions 113 @using System.Collections.Generic 114 @using System.Reflection 115 @using System.Web 116 @using System.Web.UI.HtmlControls 117 @using Dynamicweb.Rapido.Blocks.Components 118 @using Dynamicweb.Rapido.Blocks.Components.Articles 119 @using Dynamicweb.Rapido.Blocks.Components.Documentation 120 @using Dynamicweb.Rapido.Blocks 121122123 @*--- START: Base block renderers ---*@ 124125 @helper RenderBlockList(List<Block> blocks) 126 { 127 bool debug = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("debug")) ? Convert.ToBoolean(HttpContext.Current.Request.QueryString.Get("debug")) : false; 128 blocks = blocks.OrderBy(item => item.SortId).ToList(); 129130 foreach (Block item in blocks) 131 { 132 if (debug) { 133 <!-- Block START: @item.Id --> 134 } 135136 if (item.Design == null) 137 { 138 @RenderBlock(item) 139 } 140 else if (item.Design.RenderType == RenderType.None) { 141 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : ""; 142143 <div class="@cssClass dw-mod"> 144 @RenderBlock(item) 145 </div> 146 } 147 else if (item.Design.RenderType != RenderType.Hide) 148 { 149 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : ""; 150151 if (!item.SkipRenderBlocksList) { 152 if (item.Design.RenderType == RenderType.Row) 153 { 154 <div class="grid grid--align-content-start @cssClass dw-mod" id="Block__@item.Id"> 155 @RenderBlock(item) 156 </div> 157 } 158159 if (item.Design.RenderType == RenderType.Column) 160 { 161 string hidePadding = item.Design.HidePadding ? "u-no-padding" : ""; 162 string size = item.Design.Size ?? "12"; 163 size = Regex.IsMatch(size, @"\d") ? "md-" + item.Design.Size : item.Design.Size; 164165 <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"> 166 @RenderBlock(item) 167 </div> 168 } 169170 if (item.Design.RenderType == RenderType.Table) 171 { 172 <table class="table @cssClass dw-mod" id="Block__@item.Id"> 173 @RenderBlock(item) 174 </table> 175 } 176177 if (item.Design.RenderType == RenderType.TableRow) 178 { 179 <tr class="@cssClass dw-mod" id="Block__@item.Id"> 180 @RenderBlock(item) 181 </tr> 182 } 183184 if (item.Design.RenderType == RenderType.TableColumn) 185 { 186 <td class="@cssClass dw-mod" id="Block__@item.Id"> 187 @RenderBlock(item) 188 </td> 189 } 190191 if (item.Design.RenderType == RenderType.CardHeader) 192 { 193 <div class="card-header @cssClass dw-mod"> 194 @RenderBlock(item) 195 </div> 196 } 197198 if (item.Design.RenderType == RenderType.CardBody) 199 { 200 <div class="card @cssClass dw-mod"> 201 @RenderBlock(item) 202 </div> 203 } 204205 if (item.Design.RenderType == RenderType.CardFooter) 206 { 207 <div class="card-footer @cssClass dw-mod"> 208 @RenderBlock(item) 209 </div> 210 } 211 } 212 else 213 { 214 @RenderBlock(item) 215 } 216 } 217218 if (debug) { 219 <!-- Block END: @item.Id --> 220 } 221 } 222 } 223224 @helper RenderBlock(Block item) 225 { 226 bool debug = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("debug")) ? Convert.ToBoolean(HttpContext.Current.Request.QueryString.Get("debug")) : false; 227228 if (item.Template != null) 229 { 230 @BlocksPage.RenderTemplate(item.Template) 231 } 232233 if (item.Component != null) 234 { 235 string customSufix = "Custom"; 236 string methodName = item.Component.HelperName; 237238 ComponentBase[] methodParameters = new ComponentBase[1]; 239 methodParameters[0] = item.Component; 240 Type methodType = this.GetType(); 241242 MethodInfo customMethod = methodType.GetMethod(methodName + customSufix); 243 MethodInfo generalMethod = methodType.GetMethod(methodName); 244245 try { 246 if (debug) { 247 <!-- Component: @methodName.Replace("Render", "") --> 248 } 249 @customMethod.Invoke(this, methodParameters).ToString(); 250 } catch { 251 try { 252 @generalMethod.Invoke(this, methodParameters).ToString(); 253 } catch(Exception ex) { 254 throw new Exception(item.Component.GetType().Name + " method '" + methodName +"' could not be invoked", ex); 255 } 256 } 257 } 258259 if (item.BlocksList.Count > 0 && !item.SkipRenderBlocksList) 260 { 261 @RenderBlockList(item.BlocksList) 262 } 263 } 264265 @*--- END: Base block renderers ---*@ 266267 @using Dynamicweb.Rapido.Blocks.Components 268 @using Dynamicweb.Rapido.Blocks.Components.General 269 @using Dynamicweb.Rapido.Blocks 270 @using System.IO 271272 @* Required *@ 273 @using Dynamicweb.Rapido.Blocks.Components 274 @using Dynamicweb.Rapido.Blocks.Components.General 275 @using Dynamicweb.Rapido.Blocks 276277278 @helper Render(ComponentBase component) 279 { 280 if (component != null) 281 { 282 @component.Render(this) 283 } 284 } 285286 @* Components *@ 287 @using System.Reflection 288 @using Dynamicweb.Rapido.Blocks.Components.General 289290291 @* Component *@ 292293 @helper RenderIcon(Icon settings) 294 { 295 if (settings != null) 296 { 297 string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : ""; 298299 if (settings.Name != null) 300 { 301 if (string.IsNullOrEmpty(settings.Label)) 302 { 303 <i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i> 304 } 305 else 306 { 307 if (settings.LabelPosition == IconLabelPosition.Before) 308 { 309 <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> 310 } 311 else 312 { 313 <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> 314 } 315 } 316 } 317 else if (!string.IsNullOrEmpty(settings.Label)) 318 { 319 @settings.Label 320 } 321 } 322 } 323 @using System.Reflection 324 @using Dynamicweb.Rapido.Blocks.Components.General 325 @using Dynamicweb.Rapido.Blocks.Components 326 @using Dynamicweb.Core 327328 @* Component *@ 329330 @helper RenderButton(Button settings) 331 { 332 if (settings != null && (!string.IsNullOrEmpty(settings.Title) || settings.Icon != null)) 333 { 334 Dictionary<string, string> attributes = new Dictionary<string, string>(); 335 List<string> classList = settings.CssClass != null ? settings.CssClass.Split(' ').ToList() : new List<string>(); 336 if (settings.Disabled) { 337 attributes.Add("disabled", "true"); 338 classList.Add("disabled"); 339 } 340341 if (!string.IsNullOrEmpty(settings.ConfirmText) || !string.IsNullOrEmpty(settings.ConfirmTitle)) 342 { 343 settings.Id = !string.IsNullOrEmpty(settings.Id) ? settings.Id : Guid.NewGuid().ToString("N"); 344 @RenderConfirmDialog(settings); 345 settings.OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = true"; 346 } 347348 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 349 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 350 if (!string.IsNullOrEmpty(settings.AltText)) 351 { 352 attributes.Add("title", settings.AltText); 353 } 354 else if (!string.IsNullOrEmpty(settings.Title)) 355 { 356 string cleanTitle = Regex.Replace(settings.Title, "<.*?>", String.Empty); 357 cleanTitle = cleanTitle.Replace("&nbsp;", " "); 358 attributes.Add("title", cleanTitle); 359 } 360361 var onClickEvents = new List<string>(); 362 if (!string.IsNullOrEmpty(settings.OnClick)) 363 { 364 onClickEvents.Add(settings.OnClick); 365 } 366 if (!string.IsNullOrEmpty(settings.Href)) 367 { 368 onClickEvents.Add("location.href='" + settings.Href + "'"); 369 } 370 if (onClickEvents.Count > 0) 371 { 372 attributes.Add("onClick", string.Join(";", onClickEvents)); 373 } 374375 if (settings.ButtonLayout != ButtonLayout.None) 376 { 377 classList.Add("btn"); 378 string btnLayout = Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower(); 379 if (btnLayout == "linkclean") 380 { 381 btnLayout = "link-clean"; //fix 382 } 383 classList.Add("btn--" + btnLayout); 384 } 385386 if (settings.Icon == null) 387 { 388 settings.Icon = new Icon(); 389 } 390391 settings.Icon.CssClass += Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower() != "linkclean" ? " u-flex--align-center" : ""; 392 settings.Icon.Label = settings.Title; 393394 attributes.Add("type", Enum.GetName(typeof(ButtonType), settings.ButtonType).ToLower()); 395396 <button class="@string.Join(" ", classList) dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@Render(settings.Icon)</button> 397 } 398 } 399400 @helper RenderConfirmDialog(Button settings) 401 { 402 Modal confirmDialog = new Modal { 403 Id = settings.Id, 404 Width = ModalWidth.Sm, 405 Heading = new Heading 406 { 407 Level = 2, 408 Title = settings.ConfirmTitle 409 }, 410 BodyText = settings.ConfirmText 411 }; 412413 confirmDialog.AddAction(new Button { Title = Translate("Cancel"), ButtonLayout = ButtonLayout.Secondary, OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = false"}); 414 confirmDialog.AddAction(new Button { Title = Translate("OK"), ButtonLayout = ButtonLayout.Primary, OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = false;" + settings.OnClick }); 415416 @Render(confirmDialog) 417 } 418 @using Dynamicweb.Rapido.Blocks.Components.General 419 @using Dynamicweb.Rapido.Blocks.Components 420 @using Dynamicweb.Core 421422 @helper RenderDashboard(Dashboard settings) 423 { 424 var widgets = settings.GetWidgets(); 425426 if (!string.IsNullOrEmpty(settings.WidgetsBaseBackgroundColor)) 427 { 428 //set bg color for them 429430 System.Drawing.Color color = System.Drawing.ColorTranslator.FromHtml(settings.WidgetsBaseBackgroundColor); 431 int r = Convert.ToInt16(color.R); 432 int g = Convert.ToInt16(color.G); 433 int b = Convert.ToInt16(color.B); 434435 var count = widgets.Length; 436 var max = Math.Max(r, Math.Max(g, b)); 437 double step = 255.0 / (max * count); 438 var i = 0; 439 foreach (var widget in widgets) 440 { 441 i++; 442443 var shade = "rgb(" + Converter.ToString(r * step * i).Replace(",", ".") + ", " + Converter.ToString(g * step * i).Replace(",", ".") + ", " + Converter.ToString(b * step * i).Replace(",", ".") + ")"; 444 widget.BackgroundColor = shade; 445 } 446 } 447448 <div class="dashboard @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 449 @foreach (var widget in widgets) 450 { 451 <div class="dashboard__widget"> 452 @Render(widget) 453 </div> 454 } 455 </div> 456 } 457 @using Dynamicweb.Rapido.Blocks.Components.General 458 @using Dynamicweb.Rapido.Blocks.Components 459460 @helper RenderDashboardWidgetLink(DashboardWidgetLink settings) 461 { 462 if (!string.IsNullOrEmpty(settings.Link)) 463 { 464 var backgroundStyles = ""; 465 if (!string.IsNullOrEmpty(settings.BackgroundColor)) 466 { 467 backgroundStyles = "style=\"background-color:" + settings.BackgroundColor + "\""; 468 } 469470 <a href="@settings.Link" class="widget widget--link @settings.CssClass dw-mod" @backgroundStyles title="@settings.Title" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 471 <div class="u-center-middle u-color-light"> 472 @if (settings.Icon != null) 473 { 474 settings.Icon.CssClass += "widget__icon"; 475 @Render(settings.Icon) 476 } 477 <div class="widget__title">@settings.Title</div> 478 </div> 479 </a> 480 } 481 } 482 @using Dynamicweb.Rapido.Blocks.Components.General 483 @using Dynamicweb.Rapido.Blocks.Components 484485 @helper RenderDashboardWidgetCounter(DashboardWidgetCounter settings) 486 { 487 var backgroundStyles = ""; 488 if (!string.IsNullOrEmpty(settings.BackgroundColor)) 489 { 490 backgroundStyles = "style='background-color:" + settings.BackgroundColor + "'"; 491 } 492493 <div class="widget @settings.CssClass dw-mod" @backgroundStyles @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 494 <div class="u-center-middle u-color-light"> 495 @if (settings.Icon != null) 496 { 497 settings.Icon.CssClass += "widget__icon"; 498 @Render(settings.Icon) 499 } 500 <div class="widget__counter">@settings.Count</div> 501 <div class="widget__title">@settings.Title</div> 502 </div> 503 </div> 504 } 505 @using System.Reflection 506 @using Dynamicweb.Rapido.Blocks.Components.General 507 @using Dynamicweb.Rapido.Blocks.Components 508 @using Dynamicweb.Core 509510 @* Component *@ 511512 @helper RenderLink(Link settings) 513 { 514 if (settings != null && !string.IsNullOrEmpty(settings.Href) && (!string.IsNullOrEmpty(settings.Title) || settings.Icon != null)) 515 { 516 Dictionary<string, string> attributes = new Dictionary<string, string>(); 517 List<string> classList = settings.CssClass != null ? settings.CssClass.Split(' ').ToList() : new List<string>(); 518 if (settings.Disabled) 519 { 520 attributes.Add("disabled", "true"); 521 classList.Add("disabled"); 522 } 523524 if (!string.IsNullOrEmpty(settings.AltText)) 525 { 526 attributes.Add("title", settings.AltText); 527 } 528 else if (!string.IsNullOrEmpty(settings.Title)) 529 { 530 attributes.Add("title", settings.Title); 531 } 532533 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 534 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 535 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onClick", settings.OnClick); } 536 attributes.Add("href", settings.Href); 537538 if (settings.ButtonLayout != ButtonLayout.None) 539 { 540 classList.Add("btn"); 541 string btnLayout = Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower(); 542 if (btnLayout == "linkclean") 543 { 544 btnLayout = "link-clean"; //fix 545 } 546 classList.Add("btn--" + btnLayout); 547 } 548549 if (settings.Icon == null) 550 { 551 settings.Icon = new Icon(); 552 } 553 settings.Icon.Label = settings.Title; 554555 if (settings.Target == LinkTargetType.Blank && settings.Rel == LinkRelType.None) 556 { 557 settings.Rel = LinkRelType.Noopener; 558 } 559 if (settings.Target != LinkTargetType.None) 560 { 561 attributes.Add("target", "_" + Enum.GetName(typeof(LinkTargetType), settings.Target).ToLower()); 562 } 563 if (settings.Download) 564 { 565 attributes.Add("download", "true"); 566 } 567 if (settings.Rel != LinkRelType.None) 568 { 569 attributes.Add("rel", Enum.GetName(typeof(LinkRelType), settings.Rel).ToLower()); 570 } 571572 <a class="@string.Join(" ", classList) dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@Render(settings.Icon)</a> 573 } 574 } 575 @using System.Reflection 576 @using Dynamicweb.Rapido.Blocks.Components 577 @using Dynamicweb.Rapido.Blocks.Components.General 578 @using Dynamicweb.Rapido.Blocks 579580581 @* Component *@ 582583 @helper RenderRating(Rating settings) 584 { 585 if (settings.Score > 0) 586 { 587 int rating = settings.Score; 588 string iconType = "fa-star"; 589590 switch (settings.Type.ToString()) { 591 case "Stars": 592 iconType = "fa-star"; 593 break; 594 case "Hearts": 595 iconType = "fa-heart"; 596 break; 597 case "Lemons": 598 iconType = "fa-lemon"; 599 break; 600 case "Bombs": 601 iconType = "fa-bomb"; 602 break; 603 } 604605 <div class="u-ta-right"> 606 @for (int i = 0; i < settings.OutOf; i++) 607 { 608 <i class="@(rating > i ? "fas" : "far") @iconType"></i> 609 } 610 </div> 611 } 612 } 613 @using System.Reflection 614 @using Dynamicweb.Rapido.Blocks.Components.General 615 @using Dynamicweb.Rapido.Blocks.Components 616617618 @* Component *@ 619620 @helper RenderSelectFieldOption(SelectFieldOption settings) 621 { 622 Dictionary<string, string> attributes = new Dictionary<string, string>(); 623 if (settings.Checked) { attributes.Add("selected", "true"); } 624 if (settings.Disabled) { attributes.Add("disabled", "true"); } 625 if (settings.Value != null) { attributes.Add("value", settings.Value); } 626 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 627628 <option @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Label</option> 629 } 630 @using System.Reflection 631 @using Dynamicweb.Rapido.Blocks.Components.General 632 @using Dynamicweb.Rapido.Blocks.Components 633634635 @* Component *@ 636637 @helper RenderNavigation(Navigation settings) { 638 @RenderNavigation(new 639 { 640 id = settings.Id, 641 cssclass = settings.CssClass, 642 startLevel = settings.StartLevel, 643 endlevel = settings.EndLevel, 644 expandmode = settings.Expandmode, 645 sitemapmode = settings.SitemapMode, 646 template = settings.Template 647 }) 648 } 649 @using Dynamicweb.Rapido.Blocks.Components.General 650 @using Dynamicweb.Rapido.Blocks.Components 651652653 @* Component *@ 654655 @helper RenderBreadcrumbNavigation(BreadcrumbNavigation settings) { 656 settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id; 657 settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template; 658 settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel; 659 settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel; 660 settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode; 661 settings.SitemapMode = false; 662663 @RenderNavigation(settings) 664 } 665 @using Dynamicweb.Rapido.Blocks.Components.General 666 @using Dynamicweb.Rapido.Blocks.Components 667668669 @* Component *@ 670671 @helper RenderLeftNavigation(LeftNavigation settings) { 672 settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id; 673 settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template; 674 settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel; 675 settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel; 676 settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode; 677678 <div class="grid__cell"> 679 @RenderNavigation(settings) 680 </div> 681 } 682 @using System.Reflection 683 @using Dynamicweb.Rapido.Blocks.Components.General 684 @using Dynamicweb.Core 685686 @* Component *@ 687688 @helper RenderHeading(Heading settings) 689 { 690 if (settings != null && !string.IsNullOrEmpty(settings.Title)) 691 { 692 string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : ""; 693 string tagName = settings.Level != 0 ? "h" + settings.Level.ToString() : "div"; 694695 @("<" + tagName + " class=\"" + settings.CssClass + " dw-mod\" " + color + ">") 696 if (!string.IsNullOrEmpty(settings.Link)) 697 { 698 @Render(new Link { Href = settings.Link, Icon = settings.Icon, Title = settings.Title, ButtonLayout = ButtonLayout.None }) 699 } 700 else 701 { 702 if (settings.Icon == null) 703 { 704 settings.Icon = new Icon(); 705 } 706 settings.Icon.Label = settings.Title; 707 @Render(settings.Icon) 708 } 709 @("</" + tagName + ">"); 710 } 711 } 712 @using Dynamicweb.Rapido.Blocks.Components 713 @using Dynamicweb.Rapido.Blocks.Components.General 714 @using Dynamicweb.Rapido.Blocks 715716717 @* Component *@ 718719 @helper RenderImage(Image settings) 720 { 721 if (settings.FilterPrimary != ImageFilter.None || settings.FilterSecondary != ImageFilter.None) 722 { 723 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>(); 724 if (!string.IsNullOrEmpty(settings.FilterColor)) { optionalAttributes.Add("style", "background-color: " + settings.FilterColor); } 725726 if (settings.Caption != null) 727 { 728 @:<div> 729 } 730731 var primaryFilterClass = settings.FilterPrimary.ToString().ToLower(); 732 var secondaryFilterClass = settings.FilterSecondary.ToString().ToLower(); 733734 <div class="image-filter image-filter--@primaryFilterClass u-position-relative dw-mod" @ComponentMethods.AddAttributes(optionalAttributes)> 735 <div class="image-filter image-filter--@secondaryFilterClass dw-mod"> 736 @if (settings.Link != null) 737 { 738 <a href="@settings.Link"> 739 @RenderTheImage(settings) 740 </a> 741 } 742 else 743 { 744 @RenderTheImage(settings) 745 } 746 </div> 747 </div> 748749 if (settings.Caption != null) 750 { 751 <span class="image-caption dw-mod">@settings.Caption</span> 752 @:</div> 753 } 754 } 755 else 756 { 757 if (settings.Caption != null) 758 { 759 @:<div> 760 } 761 if (!string.IsNullOrEmpty(settings.Link)) 762 { 763 <a href="@settings.Link"> 764 @RenderTheImage(settings) 765 </a> 766 } 767 else 768 { 769 @RenderTheImage(settings) 770 } 771772 if (settings.Caption != null) 773 { 774 <span class="image-caption dw-mod">@settings.Caption</span> 775 @:</div> 776 } 777 } 778 } 779780 @helper RenderTheImage(Image settings) 781 { 782 if (settings != null) 783 { 784 string alternativeImage = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("AlternativeImage")) ? Pageview.AreaSettings.GetItem("Settings").GetFile("AlternativeImage").PathUrlEncoded : "/Images/missing_image.jpg"; 785 string placeholderImage = "/Files/Images/placeholder.gif"; 786 string imageEngine = "/Admin/Public/GetImage.ashx?"; 787788 string imageStyle = ""; 789790 switch (settings.Style) 791 { 792 case ImageStyle.Ball: 793 imageStyle = "grid__cell-img--ball"; 794 break; 795796 case ImageStyle.Triangle: 797 imageStyle = "grid__cell-img--triangle"; 798 break; 799 } 800801 if (settings.Style == ImageStyle.Ball || settings.Style == ImageStyle.Circle || settings.Style == ImageStyle.Triangle) 802 { 803 settings.ImageDefault.Crop = settings.ImageDefault.Crop == 5 ? settings.ImageDefault.Crop = 0 : settings.ImageDefault.Crop; 804805 if (settings.ImageDefault != null) 806 { 807 settings.ImageDefault.Height = settings.ImageDefault.Width; 808 } 809 if (settings.ImageMedium != null) 810 { 811 settings.ImageMedium.Height = settings.ImageMedium.Width; 812 } 813 if (settings.ImageSmall != null) 814 { 815 settings.ImageSmall.Height = settings.ImageSmall.Width; 816 } 817 } 818819 string defaultImage = imageEngine; 820 string imageSmall = ""; 821 string imageMedium = ""; 822823 if (settings.DisableImageEngine) 824 { 825 defaultImage = settings.Path; 826 } 827 else 828 { 829 if (settings.ImageDefault != null) 830 { 831 defaultImage += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageDefault); 832833 if (settings.Path.GetType() != typeof(string)) 834 { 835 defaultImage += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 836 defaultImage += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 837 } 838 else 839 { 840 defaultImage += settings.Path != null ? "Image=" + settings.Path : ""; 841 } 842843 defaultImage += "&AlternativeImage=" + alternativeImage; 844 } 845846 if (settings.ImageSmall != null) 847 { 848 imageSmall = "data-src-small=\"" + imageEngine; 849 imageSmall += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageSmall); 850851 if (settings.Path.GetType() != typeof(string)) 852 { 853 imageSmall += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 854 imageSmall += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 855 } 856 else 857 { 858 imageSmall += settings.Path != null ? "Image=" + settings.Path : ""; 859 } 860861 imageSmall += "&alternativeImage=" + alternativeImage; 862863 imageSmall += "\""; 864 } 865866 if (settings.ImageMedium != null) 867 { 868 imageMedium = "data-src-medium=\"" + imageEngine; 869 imageMedium += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageMedium); 870871 if (settings.Path.GetType() != typeof(string)) 872 { 873 imageMedium += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 874 imageMedium += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 875 } 876 else 877 { 878 imageMedium += settings.Path != null ? "Image=" + settings.Path : ""; 879 } 880881 imageMedium += "&alternativeImage=" + alternativeImage; 882883 imageMedium += "\""; 884 } 885 } 886887 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>(); 888 if (!string.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick); } 889 if (!string.IsNullOrEmpty(settings.Title)) 890 { 891 optionalAttributes.Add("alt", settings.Title); 892 optionalAttributes.Add("title", settings.Title); 893 } 894895 if (settings.DisableLazyLoad) 896 { 897 <img id="@settings.Id" class="@imageStyle @settings.CssClass dw-mod" src="@defaultImage" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 898 } 899 else 900 { 901 <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) /> 902 } 903 } 904 } 905 @using System.Reflection 906 @using Dynamicweb.Rapido.Blocks.Components.General 907 @using Dynamicweb.Rapido.Blocks.Components 908909 @* Component *@ 910911 @helper RenderFileField(FileField settings) 912 { 913 var attributes = new Dictionary<string, string>(); 914 if (string.IsNullOrEmpty(settings.Id)) 915 { 916 settings.Id = Guid.NewGuid().ToString("N"); 917 } 918919 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 920 if (settings.Disabled) { attributes.Add("disabled", "true"); } 921 if (settings.Required) { attributes.Add("required", "true"); } 922 if (settings.Multiple) { attributes.Add("multiple", "true"); } 923 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 924 if (string.IsNullOrEmpty(settings.ChooseFileText)) 925 { 926 settings.ChooseFileText = Translate("Choose file"); 927 } 928 if (string.IsNullOrEmpty(settings.NoFilesChosenText)) 929 { 930 settings.NoFilesChosenText = Translate("No files chosen..."); 931 } 932 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 933934 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; } 935936 string setValueToFakeInput = "FileUpload.setValueToFakeInput(this)"; 937 attributes.Add("onchange", setValueToFakeInput + (!string.IsNullOrEmpty(settings.OnChange) ? settings.OnChange : "")); 938939 attributes.Add("type", "file"); 940 if (settings.Value != null) { attributes.Add("value", settings.Value); } 941 settings.CssClass = "u-full-width " + settings.CssClass; 942943 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 944945 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod"> 946 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null ) 947 { 948 <div class="u-full-width"> 949 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } 950 @if (settings.Link != null) { 951 <div class="u-pull--right"> 952 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } 953 @Render(settings.Link) 954 </div> 955 } 956 </div> 957958 } 959960 @if (!string.IsNullOrEmpty(settings.HelpText)) 961 { 962 <small class="form__help-text">@settings.HelpText</small> 963 } 964965 <div class="form__field-combi file-input u-no-margin dw-mod"> 966 <input @ComponentMethods.AddAttributes(resultAttributes) class="file-input__real-input" data-no-files-text="@settings.NoFilesChosenText" data-many-files-text="@Translate("files")" /> 967 <label for="@settings.Id" class="file-input__btn btn--secondary btn dw-mod">@settings.ChooseFileText</label> 968 <label for="@settings.Id" class="@settings.CssClass file-input__fake-input js-fake-input dw-mod">@settings.NoFilesChosenText</label> 969 @if (settings.UploadButton != null) 970 { 971 settings.UploadButton.CssClass += " btn--condensed u-no-margin"; 972 @Render(settings.UploadButton) 973 } 974 </div> 975 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 976 </div> 977 } 978 @using System.Reflection 979 @using Dynamicweb.Rapido.Blocks.Components.General 980 @using Dynamicweb.Rapido.Blocks.Components 981 @using Dynamicweb.Core 982 @using System.Linq 983984 @* Component *@ 985986 @helper RenderDateTimeField(DateTimeField settings) 987 { 988 if (string.IsNullOrEmpty(settings.Id)) 989 { 990 settings.Id = Guid.NewGuid().ToString("N"); 991 } 992993 var textField = new TextField { 994 Name = settings.Name, 995 Id = settings.Id, 996 Label = settings.Label, 997 HelpText = settings.HelpText, 998 Value = settings.Value, 999 Disabled = settings.Disabled, 1000 Required = settings.Required, 1001 ErrorMessage = settings.ErrorMessage, 1002 CssClass = settings.CssClass, 1003 WrapperCssClass = settings.WrapperCssClass, 1004 OnChange = settings.OnChange, 1005 OnClick = settings.OnClick, 1006 Link = settings.Link, 1007 ExtraAttributes = settings.ExtraAttributes, 1008 // 1009 Placeholder = settings.Placeholder 1010 }; 10111012 @Render(textField) 10131014 List<string> jsAttributes = new List<string>(); 10151016 jsAttributes.Add("mode: '" + Enum.GetName(typeof(DateTimeFieldMode), settings.Mode).ToLower() + "'"); 10171018 if (!string.IsNullOrEmpty(settings.DateFormat)) 1019 { 1020 jsAttributes.Add("dateFormat: '" + settings.DateFormat + "'"); 1021 } 1022 if (!string.IsNullOrEmpty(settings.MinDate)) 1023 { 1024 jsAttributes.Add("minDate: '" + settings.MinDate + "'"); 1025 } 1026 if (!string.IsNullOrEmpty(settings.MaxDate)) 1027 { 1028 jsAttributes.Add("maxDate: '" + settings.MaxDate + "'"); 1029 } 1030 if (settings.IsInline) 1031 { 1032 jsAttributes.Add("inline: " + Converter.ToString(settings.IsInline).ToLower()); 1033 } 1034 if (settings.EnableTime) 1035 { 1036 jsAttributes.Add("enableTime: " + Converter.ToString(settings.EnableTime).ToLower()); 1037 } 1038 if (settings.EnableWeekNumbers) 1039 { 1040 jsAttributes.Add("weekNumbers: " + Converter.ToString(settings.EnableWeekNumbers).ToLower()); 1041 } 10421043 jsAttributes.AddRange(settings.GetFlatPickrOptions().Select(x => x.Key + ": " + x.Value)); 10441045 <script> 1046 document.addEventListener("DOMContentLoaded", function () { 1047 flatpickr("#@textField.Id", { 1048 @string.Join(",", jsAttributes) 1049 }); 1050 }); 1051 </script> 1052 } 1053 @using System.Reflection 1054 @using Dynamicweb.Rapido.Blocks.Components.General 1055 @using Dynamicweb.Rapido.Blocks.Components 10561057 @* Component *@ 10581059 @helper RenderTextField(TextField settings) 1060 { 1061 var attributes = new Dictionary<string, string>(); 1062 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1063 { 1064 settings.Id = Guid.NewGuid().ToString("N"); 1065 } 10661067 /*base settings*/ 1068 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1069 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1070 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1071 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1072 if (settings.Required) { attributes.Add("required", "true"); } 1073 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1074 /*end*/ 10751076 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 1077 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 1078 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 1079 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 1080 if (settings.MaxLength != 0) { attributes.Add("maxlength", settings.MaxLength.ToString()); } 1081 if (!string.IsNullOrEmpty(settings.Placeholder)) { attributes.Add("placeholder", settings.Placeholder); } 1082 attributes.Add("type", Enum.GetName(typeof(TextFieldType), settings.Type).ToLower()); 1083 if (settings.Type == TextFieldType.Password) { attributes.Add("autocomplete", "off"); }; 1084 if (settings.Value != null) { attributes.Add("value", settings.Value); } 10851086 settings.CssClass = "u-full-width " + settings.CssClass; 10871088 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; } 10891090 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 10911092 string noMargin = "u-no-margin"; 1093 if (!settings.ReadOnly) { 1094 noMargin = ""; 1095 } 10961097 <div class="form__field-group u-full-width @noMargin @settings.WrapperCssClass dw-mod"> 1098 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null ) 1099 { 1100 <div class="u-full-width"> 1101 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } 1102 @if (settings.Link != null) { 1103 settings.Link.ButtonLayout = ButtonLayout.LinkClean; 11041105 <div class="u-pull--right"> 1106 @Render(settings.Link) 1107 </div> 1108 } 1109 </div> 11101111 } 11121113 @if (!string.IsNullOrEmpty(settings.HelpText)) 1114 { 1115 <small class="form__help-text">@settings.HelpText</small> 1116 } 11171118 @if (settings.ActionButton != null) 1119 { 1120 settings.ActionButton.CssClass += " btn--condensed u-no-margin"; 1121 <div class="form__field-combi u-no-margin dw-mod"> 1122 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1123 @Render(settings.ActionButton) 1124 </div> 1125 } 1126 else 1127 { 1128 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1129 } 11301131 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1132 </div> 1133 } 1134 @using System.Reflection 1135 @using Dynamicweb.Rapido.Blocks.Components.General 1136 @using Dynamicweb.Rapido.Blocks.Components 11371138 @* Component *@ 11391140 @helper RenderNumberField(NumberField settings) 1141 { 1142 var attributes = new Dictionary<string, string>(); 1143 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1144 { 1145 settings.Id = Guid.NewGuid().ToString("N"); 1146 } 11471148 /*base settings*/ 1149 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1150 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1151 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1152 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1153 if (settings.Required) { attributes.Add("required", "true"); } 1154 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1155 /*end*/ 11561157 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 1158 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 1159 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 1160 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 1161 if (settings.Max != null) { attributes.Add("max", settings.Max.ToString()); } 1162 if (settings.Min != null) { attributes.Add("min", settings.Min.ToString()); } 1163 if (settings.Step != 0) { attributes.Add("step", settings.Step.ToString()); } 1164 if (settings.Value != null && !string.IsNullOrEmpty(settings.Value.ToString())) { attributes.Add("value", settings.Value.ToString()); } 1165 attributes.Add("type", "number"); 11661167 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 11681169 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod"> 1170 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null ) 1171 { 1172 <div class="u-full-width"> 1173 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } 1174 @if (settings.Link != null) { 1175 <div class="u-pull--right"> 1176 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } 1177 @Render(settings.Link) 1178 </div> 1179 } 1180 </div> 11811182 } 11831184 @if (!string.IsNullOrEmpty(settings.HelpText)) 1185 { 1186 <small class="form__help-text">@settings.HelpText</small> 1187 } 11881189 @if (settings.ActionButton != null) 1190 { 1191 settings.ActionButton.CssClass += " btn--condensed u-no-margin"; 1192 <div class="form__field-combi u-no-margin dw-mod"> 1193 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1194 @Render(settings.ActionButton) 1195 </div> 1196 } 1197 else 1198 { 1199 <div class="form__field-combi u-no-margin dw-mod"> 1200 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1201 </div> 1202 } 12031204 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1205 </div> 1206 } 1207 @using System.Reflection 1208 @using Dynamicweb.Rapido.Blocks.Components.General 1209 @using Dynamicweb.Rapido.Blocks.Components 121012111212 @* Component *@ 12131214 @helper RenderTextareaField(TextareaField settings) 1215 { 1216 Dictionary<string, string> attributes = new Dictionary<string, string>(); 1217 string id = settings.Id; 1218 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(id)) 1219 { 1220 id = Guid.NewGuid().ToString("N"); 1221 } 12221223 if (!string.IsNullOrEmpty(id)) { attributes.Add("id", id); } 1224 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1225 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 1226 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 1227 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 1228 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1229 if (!string.IsNullOrEmpty(settings.Placeholder)) { attributes.Add("placeholder", settings.Placeholder); } 1230 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1231 if (settings.Required) { attributes.Add("required", "true"); } 1232 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 1233 if (settings.MaxLength != 0) { attributes.Add("maxlength", settings.MaxLength.ToString()); } 1234 if (settings.Rows != 0) { attributes.Add("rows", settings.Rows.ToString()); } 1235 attributes.Add("name", settings.Name); 12361237 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; } 12381239 <div class="form__field-group @settings.WrapperCssClass dw-mod"> 1240 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null ) 1241 { 1242 <div class="u-full-width"> 1243 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } 1244 @if (settings.Link != null) { 1245 <div class="u-pull--right"> 1246 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } 1247 @Render(settings.Link) 1248 </div> 1249 } 1250 </div> 1251 } 12521253 @if (!string.IsNullOrEmpty(settings.HelpText)) 1254 { 1255 <small class="form__help-text">@settings.HelpText</small> 1256 } 12571258 <textarea class="u-full-width @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Value</textarea> 12591260 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1261 </div> 1262 } 1263 @using System.Reflection 1264 @using Dynamicweb.Rapido.Blocks.Components.General 1265 @using Dynamicweb.Rapido.Blocks.Components 126612671268 @* Component *@ 12691270 @helper RenderHiddenField(HiddenField settings) { 1271 var attributes = new Dictionary<string, string>(); 1272 attributes.Add("type", "hidden"); 1273 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1274 if (settings.Value != null) { attributes.Add("value", settings.Value); } 1275 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 12761277 <input @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)/> 1278 } 1279 @using System.Reflection 1280 @using Dynamicweb.Rapido.Blocks.Components.General 1281 @using Dynamicweb.Rapido.Blocks.Components 12821283 @* Component *@ 12841285 @helper RenderCheckboxField(CheckboxField settings) 1286 { 1287 var attributes = new Dictionary<string, string>(); 1288 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1289 { 1290 settings.Id = Guid.NewGuid().ToString("N"); 1291 } 12921293 /*base settings*/ 1294 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1295 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1296 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1297 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1298 if (settings.Required) { attributes.Add("required", "true"); } 1299 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1300 /*end*/ 13011302 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; } 13031304 attributes.Add("type", "checkbox"); 1305 if (settings.Checked) { attributes.Add("checked", "true"); } 1306 settings.CssClass = "form__control " + settings.CssClass; 1307 if (settings.Value != null) { attributes.Add("value", settings.Value); } 13081309 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 13101311 <div class="form__field-group @settings.WrapperCssClass dw-mod"> 1312 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1313 @if (!string.IsNullOrEmpty(settings.Label)) 1314 { 1315 <label for="@settings.Id" class="dw-mod">@settings.Label</label> 1316 } 13171318 @if (settings.Link != null) { 1319 <span> 1320 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } 1321 @Render(settings.Link) 1322 </span> 1323 } 13241325 @if (!string.IsNullOrEmpty(settings.HelpText)) 1326 { 1327 <small class="form__help-text checkbox-help dw-mod">@settings.HelpText</small> 1328 } 1329 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1330 </div> 1331 } 1332 @using System.Reflection 1333 @using Dynamicweb.Rapido.Blocks.Components.General 1334 @using Dynamicweb.Rapido.Blocks.Components 133513361337 @* Component *@ 13381339 @helper RenderCheckboxListField(CheckboxListField settings) 1340 { 1341 <div class="form__field-group @settings.WrapperCssClass u-margin-bottom dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1342 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null ) 1343 { 1344 <div class="u-full-width"> 1345 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } 1346 @if (settings.Link != null) { 1347 <div class="u-pull--right"> 1348 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } 1349 @Render(settings.Link) 1350 </div> 1351 } 1352 </div> 13531354 } 13551356 <div class="u-pull--left"> 1357 @if (!string.IsNullOrEmpty(settings.HelpText)) 1358 { 1359 <small class="form__help-text">@settings.HelpText</small> 1360 } 13611362 @foreach (var item in settings.Options) 1363 { 1364 if (settings.Required) 1365 { 1366 item.Required = true; 1367 } 1368 if (settings.Disabled) 1369 { 1370 item.Disabled = true; 1371 } 1372 if (!string.IsNullOrEmpty(settings.Name)) 1373 { 1374 item.Name = settings.Name; 1375 } 1376 if (!string.IsNullOrEmpty(settings.CssClass)) 1377 { 1378 item.CssClass += settings.CssClass; 1379 } 13801381 /* value is not supported */ 13821383 if (!string.IsNullOrEmpty(settings.OnClick)) 1384 { 1385 item.OnClick += settings.OnClick; 1386 } 1387 if (!string.IsNullOrEmpty(settings.OnChange)) 1388 { 1389 item.OnChange += settings.OnChange; 1390 } 1391 @Render(item) 1392 } 13931394 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1395 </div> 13961397 </div> 1398 } 1399 @using Dynamicweb.Rapido.Blocks.Components.General 14001401 @* Component *@ 14021403 @helper RenderSearch(Search settings) 1404 { 1405 var searchValue = HttpContext.Current.Request.QueryString.Get(settings.SearchParameter) ?? ""; 1406 var groupValue = HttpContext.Current.Request.QueryString.Get(settings.GroupsParameter) ?? ""; 14071408 if (string.IsNullOrEmpty(settings.Id)) 1409 { 1410 settings.Id = Guid.NewGuid().ToString("N"); 1411 } 14121413 var resultAttributes = new Dictionary<string, string>(); 14141415 if (settings.PageSize != 0) 1416 { 1417 resultAttributes.Add("data-page-size", settings.PageSize.ToString()); 1418 } 1419 if (!string.IsNullOrEmpty(settings.GroupItemsFeedUrl)) 1420 { 1421 resultAttributes.Add("data-groups-feed-url", settings.GroupItemsFeedUrl); 1422 if (!string.IsNullOrEmpty(groupValue)) 1423 { 1424 resultAttributes.Add("data-selected-group", groupValue); 1425 } 1426 if (!string.IsNullOrEmpty(settings.GroupsParameter)) 1427 { 1428 resultAttributes.Add("data-groups-parameter", settings.GroupsParameter); 1429 } 1430 } 1431 resultAttributes.Add("data-force-init", "true"); 1432 if (settings.GoToFirstSearchResultOnEnter) 1433 { 1434 resultAttributes.Add("data-go-to-first-search-result-on-enter", settings.GoToFirstSearchResultOnEnter.ToString().ToLower()); 1435 } 1436 if (!string.IsNullOrEmpty(settings.SearchParameter)) 1437 { 1438 resultAttributes.Add("data-search-parameter", settings.SearchParameter); 1439 } 1440 resultAttributes.Add("data-search-feed-url", settings.SearchData.SearchFeedUrl); 1441 resultAttributes.Add("data-results-template-id", settings.SearchData.ResultsTemplateId); 14421443 if (settings.SecondSearchData != null) 1444 { 1445 resultAttributes.Add("data-second-search-feed-url", settings.SecondSearchData.SearchFeedUrl); 1446 resultAttributes.Add("data-second-results-template-id", settings.SecondSearchData.ResultsTemplateId); 1447 } 1448 if (!string.IsNullOrEmpty(settings.ResultsPageUrl)) 1449 { 1450 resultAttributes.Add("data-results-page-url", settings.ResultsPageUrl); 1451 } 14521453 resultAttributes = resultAttributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 14541455 string searchFieldCss = (settings.SearchButton == null) ? "search--with-icon" : ""; 14561457 <div class="search @settings.CssClass @searchFieldCss js-search-data-source dw-mod" id="@settings.Id" @ComponentMethods.AddAttributes(resultAttributes)> 1458 @if (!string.IsNullOrEmpty(settings.GroupItemsFeedUrl)) 1459 { 1460 <button type="button" class="search__groups-btn dw-mod js-search-groups-btn">@Translate("All")</button> 1461 <ul class="dropdown dropdown--absolute-position dw-mod search__groups-results js-search-groups-list"></ul> 1462 } 14631464 <input type="text" class="search__field dw-mod js-search-field" placeholder="@settings.Placeholder" value="@searchValue"> 14651466 <div class="dropdown dropdown--absolute-position search__results dw-mod js-search-results @(settings.SecondSearchData != null ? "search__results--combined" : "")"> 1467 @if (settings.SecondSearchData != null) 1468 { 1469 <div class="search__column search__column--products dw-mod"> 1470 <div class="search__column-header dw-mod">@Translate("Products")</div> 1471 <ul class="search__results-list dw-mod js-search-results-list" id="@(settings.Id)_ResultsList"></ul> 1472 @if (!string.IsNullOrEmpty(settings.SearchData.ResultsPageUrl)) 1473 { 1474 @Render(new Link { 1475 Title = Translate("View all"), 1476 CssClass = "js-view-all-button u-margin", 1477 Href = settings.SearchData.ResultsPageUrl 1478 }); 1479 } 1480 </div> 1481 <div class="search__column search__column--pages dw-mod"> 1482 <div class="search__column-header">@Translate("Pages")</div> 1483 <ul class="search__results-list dw-mod js-search-results-second-list" id="@(settings.Id)_SecondResultsList"></ul> 1484 @if (!string.IsNullOrEmpty(settings.SecondSearchData.ResultsPageUrl)) 1485 { 1486 @Render(new Link 1487 { 1488 Title = Translate("View all"), 1489 CssClass = "js-view-all-button u-margin", 1490 Href = settings.SecondSearchData.ResultsPageUrl 1491 }); 1492 } 1493 </div> 1494 } 1495 else 1496 { 1497 <div class="search__column search__column--only dw-mod"> 1498 <ul class="search__results-list dw-mod js-search-results-list" id="@(settings.Id)_ResultsList"></ul> 1499 @if (!string.IsNullOrEmpty(settings.SearchData.ResultsPageUrl)) 1500 { 1501 @Render(new Link { 1502 Title = Translate("View all"), 1503 CssClass = "js-view-all-button u-margin", 1504 Href = settings.SearchData.ResultsPageUrl 1505 }); 1506 } 1507 </div> 1508 } 1509 </div> 15101511 @if (settings.SearchButton != null) 1512 { 1513 settings.SearchButton.CssClass += " search__btn js-search-btn"; 1514 if (settings.RenderDefaultSearchIcon) 1515 { 1516 settings.SearchButton.Icon = new Icon { Name = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue }; 1517 } 1518 @Render(settings.SearchButton); 1519 } 1520 </div> 1521 } 1522 @using System.Reflection 1523 @using Dynamicweb.Rapido.Blocks.Components.General 1524 @using Dynamicweb.Rapido.Blocks.Components 152515261527 @* Component *@ 15281529 @helper RenderSelectField(SelectField settings) 1530 { 1531 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1532 { 1533 settings.Id = Guid.NewGuid().ToString("N"); 1534 } 15351536 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod"> 1537 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null ) 1538 { 1539 <div class="u-full-width"> 1540 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } 1541 @if (settings.Link != null) { 1542 <div class="u-pull--right"> 1543 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } 1544 @Render(settings.Link) 1545 </div> 1546 } 1547 </div> 1548 } 15491550 @if (!string.IsNullOrEmpty(settings.HelpText)) 1551 { 1552 <small class="form__help-text">@settings.HelpText</small> 1553 } 15541555 @if (settings.ActionButton != null) 1556 { 1557 settings.ActionButton.CssClass += " btn--condensed u-no-margin"; 1558 <div class="form__field-combi u-no-margin dw-mod"> 1559 @RenderSelectBase(settings) 1560 @Render(settings.ActionButton) 1561 </div> 1562 } 1563 else 1564 { 1565 @RenderSelectBase(settings) 1566 } 15671568 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1569 </div> 1570 } 15711572 @helper RenderSelectBase(SelectField settings) 1573 { 1574 var attributes = new Dictionary<string, string>(); 15751576 /*base settings*/ 1577 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1578 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1579 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1580 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1581 if (settings.Required) { attributes.Add("required", "true"); } 1582 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1583 /*end*/ 15841585 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 15861587 <select @ComponentMethods.AddAttributes(resultAttributes) class="u-full-width @settings.CssClass dw-mod"> 1588 @if (settings.Default != null) 1589 { 1590 @Render(settings.Default) 1591 } 15921593 @foreach (var item in settings.Options) 1594 { 1595 if (settings.Value != null) { 1596 item.Checked = item.Value == settings.Value; 1597 } 1598 @Render(item) 1599 } 1600 </select> 1601 } 1602 @using System.Reflection 1603 @using Dynamicweb.Rapido.Blocks.Components.General 1604 @using Dynamicweb.Rapido.Blocks.Components 16051606 @* Component *@ 16071608 @helper RenderRadioButtonField(RadioButtonField settings) 1609 { 1610 var attributes = new Dictionary<string, string>(); 1611 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1612 { 1613 settings.Id = Guid.NewGuid().ToString("N"); 1614 } 16151616 /*base settings*/ 1617 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1618 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1619 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1620 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1621 if (settings.Required) { attributes.Add("required", "true"); } 1622 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1623 /*end*/ 16241625 attributes.Add("type", "radio"); 1626 if (settings.Checked) { attributes.Add("checked", "true"); } 1627 settings.CssClass = "form__control " + settings.CssClass; 1628 if (settings.Value != null) { attributes.Add("value", settings.Value); } 16291630 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 16311632 <div class="form__field-group @settings.WrapperCssClass dw-mod"> 1633 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1634 @if (!string.IsNullOrEmpty(settings.Label)) 1635 { 1636 <label for="@settings.Id" class="dw-mod">@settings.Label</label> 1637 } 1638 @if (!string.IsNullOrEmpty(settings.HelpText)) 1639 { 1640 <small class="form__help-text">@settings.HelpText</small> 1641 } 1642 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1643 </div> 1644 } 1645 @using System.Reflection 1646 @using Dynamicweb.Rapido.Blocks.Components.General 1647 @using Dynamicweb.Rapido.Blocks.Components 164816491650 @* Component *@ 16511652 @helper RenderRadioButtonListField(RadioButtonListField settings) 1653 { 1654 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; } 16551656 <div class="form__field-group @settings.WrapperCssClass u-margin-bottom dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1657 @if (!string.IsNullOrEmpty(settings.Label)) 1658 { 1659 <label>@settings.Label</label> 1660 } 1661 @if (!string.IsNullOrEmpty(settings.HelpText)) 1662 { 1663 <small class="form__help-text">@settings.HelpText</small> 1664 } 16651666 @foreach (var item in settings.Options) 1667 { 1668 if (settings.Required) 1669 { 1670 item.Required = true; 1671 } 1672 if (settings.Disabled) 1673 { 1674 item.Disabled = true; 1675 } 1676 if (!string.IsNullOrEmpty(settings.Name)) 1677 { 1678 item.Name = settings.Name; 1679 } 1680 if (settings.Value != null && settings.Value == item.Value) 1681 { 1682 item.Checked = true; 1683 } 1684 if (!string.IsNullOrEmpty(settings.OnClick)) 1685 { 1686 item.OnClick += settings.OnClick; 1687 } 1688 if (!string.IsNullOrEmpty(settings.OnChange)) 1689 { 1690 item.OnChange += settings.OnChange; 1691 } 1692 if (!string.IsNullOrEmpty(settings.CssClass)) 1693 { 1694 item.CssClass += settings.CssClass; 1695 } 1696 @Render(item) 1697 } 16981699 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1700 </div> 1701 } 1702 @using System.Reflection 1703 @using Dynamicweb.Rapido.Blocks.Components.General 1704 @using Dynamicweb.Rapido.Blocks.Components 170517061707 @* Component *@ 17081709 @helper RenderNotificationMessage(NotificationMessage settings) 1710 { 1711 if (!string.IsNullOrEmpty(settings.Message)) 1712 { 1713 var attributes = new Dictionary<string, string>(); 1714 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 17151716 string messageTypeClass = Enum.GetName(typeof(NotificationMessageType), settings.MessageType).ToLower(); 1717 string messageLayoutClass = Enum.GetName(typeof(NotificationMessageLayout), settings.MessageLayout).ToLower(); 1718 string minHeightClass = settings.Icon != null ? "u-min-h70px" : ""; 17191720 <div class="notification-message-@messageTypeClass notification-message-@messageLayoutClass @messageLayoutClass @minHeightClass @settings.CssClass u-full-width dw-mod" @ComponentMethods.AddAttributes(attributes)> 1721 @if (settings.Icon != null) { 1722 settings.Icon.Label = !string.IsNullOrEmpty(settings.Icon.Label) ? settings.Message + settings.Icon.Label : settings.Message; 1723 @Render(settings.Icon) 1724 } else { 1725 @settings.Message 1726 } 1727 </div> 1728 } 1729 } 1730 @using Dynamicweb.Rapido.Blocks.Components.General 173117321733 @* Component *@ 17341735 @helper RenderHandlebarsRoot(HandlebarsRoot settings) { 1736 string preRender = !String.IsNullOrEmpty(settings.PreRenderScriptTemplate) ? "data-pre-render-template=\"" + settings.PreRenderScriptTemplate + "\"" : ""; 17371738 <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> 1739 @if (settings.SubBlocks != null) { 1740 @RenderBlockList(settings.SubBlocks) 1741 } 1742 </div> 1743 } 1744 @using System.Reflection 1745 @using Dynamicweb.Rapido.Blocks.Components.General 1746 @using Dynamicweb.Rapido.Blocks.Components 1747 @using System.Text.RegularExpressions 174817491750 @* Component *@ 17511752 @helper RenderSticker(Sticker settings) { 1753 if (!String.IsNullOrEmpty(settings.Title)) { 1754 string size = settings.Size.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Size.ToString().ToLower() : ""; 1755 string style = settings.Style.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Style.ToString().ToLower() : ""; 17561757 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>(); 1758 if (!String.IsNullOrEmpty(settings.Color) || !String.IsNullOrEmpty(settings.BackgroundColor)) { 1759 string styleTag = !String.IsNullOrEmpty(settings.Color) ? "color: " + settings.Color + "; " : ""; 1760 styleTag += !String.IsNullOrEmpty(settings.BackgroundColor) ? "background-color: " + settings.BackgroundColor + "; " : ""; 1761 optionalAttributes.Add("style", styleTag); 1762 } 17631764 <div class="stickers-container__tag @size @style @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Title</div> 1765 } 1766 } 17671768 @using System.Reflection 1769 @using Dynamicweb.Rapido.Blocks.Components.General 1770 @using Dynamicweb.Rapido.Blocks.Components 177117721773 @* Component *@ 17741775 @helper RenderStickersCollection(StickersCollection settings) 1776 { 1777 if (settings.Stickers.Count > 0) 1778 { 1779 string position = "stickers-container--" + Regex.Replace(settings.Position.ToString(), "([a-z])([A-Z])", "$1-$2").ToLower(); 17801781 <div class="stickers-container @position @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1782 @foreach (Sticker sticker in settings.Stickers) 1783 { 1784 @Render(sticker) 1785 } 1786 </div> 1787 } 1788 } 17891790 @using Dynamicweb.Rapido.Blocks.Components.General 179117921793 @* Component *@ 17941795 @helper RenderForm(Form settings) { 1796 if (settings != null) 1797 { 1798 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>(); 1799 if (!string.IsNullOrEmpty(settings.Action)) { optionalAttributes.Add("action", settings.Action); }; 1800 if (!string.IsNullOrEmpty(settings.Name)) { optionalAttributes.Add("name", settings.Name); }; 1801 if (!string.IsNullOrEmpty(settings.OnSubmit)) { optionalAttributes.Add("onsubmit", settings.OnSubmit); }; 1802 var enctypes = new Dictionary<string, string> 1803 { 1804 { "multipart", "multipart/form-data" }, 1805 { "text", "text/plain" }, 1806 { "application", "application/x-www-form-urlencoded" } 1807 }; 1808 if (settings.Enctype != FormEnctype.none) { optionalAttributes.Add("enctype", enctypes[Enum.GetName(typeof(FormEnctype), settings.Enctype).ToLower()]); }; 1809 optionalAttributes.Add("method", settings.Method.ToString()); 18101811 if (!string.IsNullOrEmpty(settings.FormStartMarkup)) 1812 { 1813 @settings.FormStartMarkup 1814 } 1815 else 1816 { 1817 @:<form class="@settings.CssClass u-no-margin dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1818 } 18191820 foreach (var field in settings.GetFields()) 1821 { 1822 @Render(field) 1823 } 18241825 @:</form> 1826 } 1827 } 1828 @using System.Reflection 1829 @using Dynamicweb.Rapido.Blocks.Components.General 1830 @using Dynamicweb.Rapido.Blocks.Components 183118321833 @* Component *@ 18341835 @helper RenderText(Text settings) 1836 { 1837 @settings.Content 1838 } 1839 @using System.Reflection 1840 @using Dynamicweb.Rapido.Blocks.Components.General 1841 @using Dynamicweb.Rapido.Blocks.Components 184218431844 @* Component *@ 18451846 @helper RenderContentModule(ContentModule settings) { 1847 if (!string.IsNullOrEmpty(settings.Content)) 1848 { 1849 @settings.Content 1850 } 1851 } 1852 @using System 1853 @using System.Reflection 1854 @using Dynamicweb.Rapido.Blocks.Components.General 1855 @using Dynamicweb.Rapido.Blocks.Components 185618571858 @* Component *@ 18591860 @helper RenderModal(Modal settings) { 1861 if (settings != null) 1862 { 1863 string modalId = !string.IsNullOrEmpty(settings.Id) ? settings.Id : Guid.NewGuid().ToString("N"); 18641865 string onchange = !string.IsNullOrEmpty(settings.OnClose) ? "onchange=\"if(!this.checked){" + settings.OnClose + "}\"" : ""; 18661867 <input type="checkbox" id="@(modalId)ModalTrigger" class="modal-trigger" @onchange /> 18681869 <div class="modal-container"> 1870 @if (!settings.DisableDarkOverlay) 1871 { 1872 <label for="@(modalId)ModalTrigger" id="@(modalId)ModalOverlay" class="modal-overlay"></label> 1873 } 1874 <div class="modal modal--@settings.Width.ToString().ToLower() modal-height--@settings.Height.ToString().ToLower()" id="@(modalId)Modal"> 1875 @if (settings.Heading != null) 1876 { 1877 if (!string.IsNullOrEmpty(settings.Heading.Title)) 1878 { 1879 <div class="modal__header"> 1880 @Render(settings.Heading) 1881 </div> 1882 } 1883 } 1884 <div class="modal__body @(settings.Width.ToString().ToLower() == "full" ? "modal__body--full" : "")"> 1885 @if (settings.BodyText != "LOGIN_MODAL_BODY") 1886 { 1887 <div class="modal__body_text">@settings.BodyText</div> 18881889 } 1890 @if (settings.BodyTemplate != null) 1891 { 1892 @settings.BodyTemplate 1893 } 1894 @{ 1895 var actions = settings.GetActions(); 1896 } 1897 </div> 1898 @if (actions.Length > 0) 1899 { 1900 <div class="modal__footer"> 1901 @foreach (var action in actions) 1902 { 1903 if (Pageview.Device.ToString() != "Mobile") { 1904 action.CssClass += " u-no-margin"; 1905 } else { 1906 action.CssClass += " u-full-width u-margin-bottom"; 1907 } 19081909 @Render(action) 1910 } 1911 </div> 1912 } 1913 <label class="modal__close-btn" for="@(modalId)ModalTrigger"></label> 1914 </div> 1915 </div> 1916 } 1917 } 1918 @using Dynamicweb.Rapido.Blocks.Components.General 19191920 @* Component *@ 19211922 @helper RenderMediaListItem(MediaListItem settings) 1923 { 1924 <div class="media-list-item @settings.CssClass dw-mod" @(!string.IsNullOrEmpty(settings.Id) ? "id=\"" + settings.Id + "\"" : "")> 1925 @if (!string.IsNullOrEmpty(settings.Label)) 1926 { 1927 if (!string.IsNullOrEmpty(settings.Link)) 1928 { 1929 @Render(new Link 1930 { 1931 Href = settings.Link, 1932 CssClass = "media-list-item__sticker dw-mod", 1933 ButtonLayout = ButtonLayout.None, 1934 Title = settings.Label, 1935 OnClick = !string.IsNullOrEmpty(settings.OnClick) ? settings.OnClick : "" 1936 }) 1937 } 1938 else if (!string.IsNullOrEmpty(settings.OnClick)) 1939 { 1940 <span class="media-list-item__sticker dw-mod" onclick="@(settings.OnClick)"> 1941 <span class="u-uppercase">@settings.Label</span> 1942 </span> 1943 } 1944 else 1945 { 1946 <span class="media-list-item__sticker media-list-item__sticker--no-link dw-mod"> 1947 <span class="u-uppercase">@settings.Label</span> 1948 </span> 1949 } 1950 } 1951 <div class="media-list-item__wrap"> 1952 <div class="media-list-item__info dw-mod"> 1953 <div class="media-list-item__header dw-mod"> 1954 @if (!string.IsNullOrEmpty(settings.Title)) 1955 { 1956 if (!string.IsNullOrEmpty(settings.Link)) 1957 { 1958 @Render(new Link 1959 { 1960 Href = settings.Link, 1961 CssClass = "media-list-item__name dw-mod", 1962 ButtonLayout = ButtonLayout.None, 1963 Title = settings.Title, 1964 OnClick = !string.IsNullOrEmpty(settings.OnClick) ? settings.OnClick : "" 1965 }) 1966 } 1967 else if (!string.IsNullOrEmpty(settings.OnClick)) 1968 { 1969 <span class="media-list-item__name dw-mod" onclick="@(settings.OnClick)">@settings.Title</span> 1970 } 1971 else 1972 { 1973 <span class="media-list-item__name media-list-item__name--no-link dw-mod">@settings.Title</span> 1974 } 1975 } 19761977 @if (!string.IsNullOrEmpty(settings.Status)) 1978 { 1979 <div class="media-list-item__state dw-mod">@settings.Status</div> 1980 } 1981 </div> 1982 @{ 1983 settings.InfoTable.CssClass += " media-list-item__parameters-table"; 1984 } 19851986 @Render(settings.InfoTable) 1987 </div> 1988 <div class="media-list-item__actions dw-mod"> 1989 <div class="media-list-item__actions-list dw-mod"> 1990 @{ 1991 var actions = settings.GetActions(); 19921993 foreach (ButtonBase action in actions) 1994 { 1995 action.ButtonLayout = ButtonLayout.None; 1996 action.CssClass += " media-list-item__action link"; 19971998 @Render(action) 1999 } 2000 } 2001 </div> 20022003 @if (settings.SelectButton != null && !string.IsNullOrEmpty(settings.SelectButton.Title)) 2004 { 2005 settings.SelectButton.CssClass += " u-no-margin"; 20062007 <div class="media-list-item__action-button"> 2008 @Render(settings.SelectButton) 2009 </div> 2010 } 2011 </div> 2012 </div> 2013 </div> 2014 } 2015 @using Dynamicweb.Rapido.Blocks.Components.General 2016 @using Dynamicweb.Rapido.Blocks.Components 20172018 @helper RenderTable(Table settings) 2019 { 2020 Dictionary<string, string> attributes = new Dictionary<string, string>(); 2021 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 20222023 var enumToClasses = new Dictionary<TableDesign, string> 2024 { 2025 { TableDesign.Clean, "table--clean" }, 2026 { TableDesign.Bordered, "table--bordered" }, 2027 { TableDesign.Striped, "table--striped" }, 2028 { TableDesign.Hover, "table--hover" }, 2029 { TableDesign.Compact, "table--compact" }, 2030 { TableDesign.Condensed, "table--condensed" }, 2031 { TableDesign.NoTopBorder, "table--no-top-border" } 2032 }; 2033 string tableDesignClass = ""; 2034 if (settings.Design != TableDesign.None) 2035 { 2036 tableDesignClass = enumToClasses[settings.Design]; 2037 } 20382039 if (!string.IsNullOrEmpty(settings.CssClass) || settings.Design != TableDesign.None) { attributes.Add("class", "table " + tableDesignClass + " " + settings.CssClass + " dw-mod"); } 20402041 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value); 20422043 <table @ComponentMethods.AddAttributes(resultAttributes)> 2044 @if (settings.Header != null) 2045 { 2046 <thead> 2047 @Render(settings.Header) 2048 </thead> 2049 } 2050 <tbody> 2051 @foreach (var row in settings.Rows) 2052 { 2053 @Render(row) 2054 } 2055 </tbody> 2056 @if (settings.Footer != null) 2057 { 2058 <tfoot> 2059 @Render(settings.Footer) 2060 </tfoot> 2061 } 2062 </table> 2063 } 2064 @using Dynamicweb.Rapido.Blocks.Components.General 2065 @using Dynamicweb.Rapido.Blocks.Components 20662067 @helper RenderTableRow(TableRow settings) 2068 { 2069 Dictionary<string, string> attributes = new Dictionary<string, string>(); 2070 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 20712072 var enumToClasses = new Dictionary<TableRowDesign, string> 2073 { 2074 { TableRowDesign.NoBorder, "table__row--no-border" }, 2075 { TableRowDesign.Border, "table__row--border" }, 2076 { TableRowDesign.TopBorder, "table__row--top-line" }, 2077 { TableRowDesign.BottomBorder, "table__row--bottom-line" }, 2078 { TableRowDesign.Solid, "table__row--solid" } 2079 }; 20802081 string tableRowDesignClass = ""; 2082 if (settings.Design != TableRowDesign.None) 2083 { 2084 tableRowDesignClass = enumToClasses[settings.Design]; 2085 } 20862087 if (!string.IsNullOrEmpty(settings.CssClass) || settings.Design != TableRowDesign.None) { attributes.Add("class", "table__row " + tableRowDesignClass + " " + settings.CssClass + " dw-mod"); } 20882089 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value); 20902091 <tr @ComponentMethods.AddAttributes(resultAttributes)> 2092 @foreach (var cell in settings.Cells) 2093 { 2094 if (settings.IsHeaderRow) 2095 { 2096 cell.IsHeader = true; 2097 } 2098 @Render(cell) 2099 } 2100 </tr> 2101 } 2102 @using Dynamicweb.Rapido.Blocks.Components.General 2103 @using Dynamicweb.Rapido.Blocks.Components 2104 @using Dynamicweb.Core 21052106 @helper RenderTableCell(TableCell settings) 2107 { 2108 Dictionary<string, string> attributes = new Dictionary<string, string>(); 2109 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 2110 if (settings.Colspan != 0) { attributes.Add("colspan", Converter.ToString(settings.Colspan)); } 2111 if (settings.Rowspan != 0) { attributes.Add("rowspan", Converter.ToString(settings.Rowspan)); } 2112 if (!string.IsNullOrEmpty(settings.CssClass)) { attributes.Add("class", settings.CssClass + " dw-mod"); } 21132114 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value); 21152116 string tagName = settings.IsHeader ? "th" : "td"; 21172118 @("<" + tagName + " " + ComponentMethods.AddAttributes(resultAttributes) + ">") 2119 @settings.Content 2120 @("</" + tagName + ">"); 2121 } 2122 @using System.Linq 2123 @using Dynamicweb.Rapido.Blocks.Components.General 21242125 @* Component *@ 21262127 @helper RenderPagination(Dynamicweb.Rapido.Blocks.Components.General.Pagination settings) 2128 { 2129 var pageNumberQueryStringName = Dynamicweb.Rapido.Services.Pagination.GetPageNumberQueryStringName(settings); // Get the proper 'page number' query string parameter 2130 var queryParameters = Dynamicweb.Rapido.Services.Url.GetQueryParameters(pageNumberQueryStringName); // Get the NameValueCollection from the querystring 21312132 if (settings.NumberOfPages > 1) 2133 { 2134 string url = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + "/Default.aspx"; 2135 string ariaLabel = !string.IsNullOrWhiteSpace(settings.AriaLabel) ? settings.AriaLabel : Translate("Page navigation"); 2136 Dictionary<string, int> startAndEndPageNumber = Dynamicweb.Rapido.Services.Pagination.GetStartAndEndPageNumber(settings); 21372138 <div class="pager u-margin-top dw-mod @settings.CssClass" aria-label="@ariaLabel"> 2139 @if (settings.ShowPagingInfo) 2140 { 2141 <div class="pager__info dw-mod"> 2142 @Translate("Page") @settings.CurrentPageNumber @Translate("of") @settings.NumberOfPages 2143 </div> 2144 } 2145 <ul class="pager__list dw-mod"> 2146 @if (!string.IsNullOrWhiteSpace(settings.FirstPageUrl) && settings.ShowFirstAndLastControls) 2147 { 2148 @Render(new PaginationItem { Link = settings.FirstPageUrl, Icon = settings.FirstIcon }) 2149 } 2150 @if (!string.IsNullOrWhiteSpace(settings.PreviousPageUrl) && settings.ShowNextAndPrevControls) 2151 { 2152 @Render(new PaginationItem { Link = settings.PreviousPageUrl, Icon = settings.PrevIcon }) 2153 } 2154 @if (settings.GetPages().Any()) 2155 { 2156 foreach (var page in settings.GetPages()) 2157 { 2158 @Render(page) 2159 } 2160 } 2161 else 2162 { 2163 for (var page = startAndEndPageNumber["StartPage"]; page <= startAndEndPageNumber["EndPage"]; page++) 2164 { 2165 queryParameters = Dynamicweb.Rapido.Services.Url.UpdateQueryStringParameter(queryParameters, pageNumberQueryStringName, page.ToString()); 2166 @Render(new PaginationItem { Label = page.ToString(), Link = Dynamicweb.Rapido.Services.Url.BuildUri(url, queryParameters).PathAndQuery, IsActive = (settings.CurrentPageNumber == page) }); 2167 } 2168 } 2169 @if (!string.IsNullOrWhiteSpace(settings.NextPageUrl) && settings.ShowNextAndPrevControls) 2170 { 2171 @Render(new PaginationItem { Link = settings.NextPageUrl, Icon = settings.NextIcon }) 2172 } 2173 @if (!string.IsNullOrWhiteSpace(settings.LastPageUrl) && settings.ShowFirstAndLastControls) 2174 { 2175 @Render(new PaginationItem { Link = settings.LastPageUrl, Icon = settings.LastIcon }) 2176 } 2177 </ul> 2178 </div> 2179 } 2180 } 21812182 @helper RenderPaginationItem(PaginationItem settings) 2183 { 2184 if (settings.Icon == null) 2185 { 2186 settings.Icon = new Icon(); 2187 } 21882189 settings.Icon.Label = settings.Label; 2190 <li class="pager__btn dw-mod"> 2191 @if (settings.IsActive) 2192 { 2193 <span class="pager__num pager__num--current dw-mod"> 2194 @Render(settings.Icon) 2195 </span> 2196 } 2197 else 2198 { 2199 <a href="@settings.Link" class="pager__num dw-mod"> 2200 @Render(settings.Icon) 2201 </a> 2202 } 2203 </li> 2204 } 220522062207 @using Dynamicweb.Rapido.Blocks.Components.General 2208 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 220922102211 @using Dynamicweb.Rapido.Blocks.Components 2212 @using Dynamicweb.Rapido.Blocks.Components.General 2213 @using Dynamicweb.Rapido.Blocks 2214 @using System.IO 221522162217 @using Dynamicweb.Rapido.Blocks.Components.General 2218 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 221922202221 @* Component *@ 22222223 @helper RenderVariantMatrix(VariantMatrix settings) { 2224 if (settings != null) 2225 { 2226 int productLoopCounter = 0; 2227 int groupCount = 0; 2228 List<VariantOption> firstDimension = new List<VariantOption>(); 2229 List<VariantOption> secondDimension = new List<VariantOption>(); 2230 List<VariantOption> thirdDimension = new List<VariantOption>(); 22312232 foreach (VariantGroup variantGroup in settings.GetVariantGroups()) 2233 { 2234 foreach (VariantOption variantOptions in variantGroup.GetVariantOptions()) 2235 { 2236 if (groupCount == 0) { 2237 firstDimension.Add(variantOptions); 2238 } 2239 if (groupCount == 1) 2240 { 2241 secondDimension.Add(variantOptions); 2242 } 2243 if (groupCount == 2) 2244 { 2245 thirdDimension.Add(variantOptions); 2246 } 2247 } 2248 groupCount++; 2249 } 22502251 int rowCount = 0; 2252 int columnCount = 0; 22532254 <script> 2255 var variantsCollection = []; 2256 </script> 22572258 <table class="table table--compact js-variants-matrix dw-mod" id="VariantMatrixTable_@settings.ProductId"> 2259 @if (groupCount == 1) 2260 { 2261 <tbody> 2262 @foreach (VariantOption firstVariantOption in firstDimension) 2263 { 2264 var variantId = firstVariantOption.Id; 2265 <tr> 2266 <td class="u-bold"> 2267 @firstVariantOption.Name 2268 </td> 2269 <td> 2270 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount) 2271 </td> 2272 </tr> 2273 productLoopCounter++; 2274 } 22752276 <tr> 2277 <td>&nbsp;</td> 2278 <td> 2279 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div> 2280 </td> 2281 </tr> 2282 </tbody> 2283 } 2284 @if (groupCount == 2) 2285 { 2286 <thead> 2287 <tr> 2288 <td>&nbsp;</td> 2289 @foreach (VariantOption variant in secondDimension) 2290 { 2291 <td>@variant.Name</td> 2292 } 2293 </tr> 2294 </thead> 2295 <tbody> 2296 @foreach (VariantOption firstVariantOption in firstDimension) 2297 { 2298 string variantId = ""; 2299 columnCount = 0; 23002301 <tr> 2302 <td class="u-min-w120px">@firstVariantOption.Name</td> 23032304 @foreach (VariantOption secondVariantOption in secondDimension) 2305 { 2306 variantId = firstVariantOption.Id + "." + secondVariantOption.Id; 2307 <td> 2308 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount) 2309 </td> 23102311 columnCount++; 23122313 productLoopCounter++; 2314 } 23152316 <td> 2317 <div class="qty-field js-total-qty-row-@rowCount dw-mod">0</div> 2318 </td> 2319 </tr> 23202321 rowCount++; 2322 } 23232324 @{ 2325 columnCount = 0; 2326 } 23272328 <tr> 2329 <td>&nbsp;</td> 2330 @foreach (VariantOption secondVariantOption in secondDimension) 2331 { 2332 <td> 2333 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div> 2334 </td> 23352336 columnCount++; 2337 } 2338 <td>&nbsp;</td> 2339 </tr> 2340 </tbody> 2341 } 2342 @if (groupCount == 3) 2343 { 2344 <thead> 2345 <tr> 2346 <td>&nbsp;</td> 2347 @foreach (VariantOption thirdVariantOption in thirdDimension) 2348 { 2349 <td>@thirdVariantOption.Name</td> 2350 } 2351 </tr> 2352 </thead> 2353 <tbody> 2354 @foreach (VariantOption firstVariantOption in firstDimension) 2355 { 2356 int colspan = (thirdDimension.Count + 1); 23572358 <tr> 2359 <td colspan="@colspan" class="u-color-light-gray--bg u-bold">@firstVariantOption.Name</td> 2360 </tr> 23612362 foreach (VariantOption secondVariantOption in secondDimension) 2363 { 2364 string variantId = ""; 2365 columnCount = 0; 23662367 <tr> 2368 <td class="u-min-w120px">@secondVariantOption.Name</td> 23692370 @foreach (VariantOption thirdVariantOption in thirdDimension) 2371 { 2372 variantId = firstVariantOption.Id + "." + secondVariantOption.Id + "." + thirdVariantOption.Id; 23732374 <td> 2375 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount) 2376 </td> 23772378 columnCount++; 2379 productLoopCounter++; 2380 } 23812382 <td> 2383 <div class="qty-field js-total-qty-row-@rowCount dw-mod">0</div> 2384 </td> 2385 </tr> 2386 rowCount++; 2387 } 2388 } 23892390 @{ 2391 columnCount = 0; 2392 } 23932394 <tr> 2395 <td>&nbsp;</td> 2396 @foreach (VariantOption thirdVariantOption in thirdDimension) 2397 { 2398 <td> 2399 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div> 2400 </td> 24012402 columnCount++; 2403 } 2404 <td>&nbsp;</td> 2405 </tr> 2406 </tbody> 2407 } 2408 </table> 24092410 <script> 2411 document.addEventListener("DOMContentLoaded", function (event) { 2412 MatrixUpdateQuantity("@settings.ProductId"); 2413 }); 24142415 MatrixUpdateQuantity = function (productId) { 2416 var currentMatrix = document.getElementById("VariantMatrixTable_" + productId); 2417 var allQtyFields = currentMatrix.getElementsByClassName("js-qty"); 24182419 var qtyRowArr = []; 2420 var qtyColumnArr = []; 24212422 var totalQty = 0; 24232424 for (var i = 0; i < allQtyFields.length; i++) { 2425 qtyRowArr[allQtyFields[i].getAttribute("data-qty-row-group")] = 0; 2426 qtyColumnArr[allQtyFields[i].getAttribute("data-qty-column-group")] = 0; 2427 } 24282429 for (var i = 0; i < allQtyFields.length; i++) { 2430 qtyRowArr[allQtyFields[i].getAttribute("data-qty-row-group")] += parseFloat(allQtyFields[i].value); 2431 qtyColumnArr[allQtyFields[i].getAttribute("data-qty-column-group")] += parseFloat(allQtyFields[i].value); 2432 totalQty += parseFloat(allQtyFields[i].value); 2433 } 24342435 //Update row counters 2436 for (var i = 0; i < qtyRowArr.length; i++) { 2437 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-row-" + i)[0]; 24382439 if (qtyRowArr[i] != undefined && qtyCounter != null) { 2440 var currentCount = qtyCounter.innerHTML; 2441 qtyCounter.innerHTML = qtyRowArr[i]; 24422443 if (currentCount != qtyCounter.innerHTML) { 2444 qtyCounter.classList.add("qty-field--active"); 2445 } 2446 } 24472448 } 24492450 //Update column counters 2451 for (var i = 0; i < qtyColumnArr.length; i++) { 2452 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-column-" + i)[0]; 24532454 if (qtyColumnArr[i] != undefined && qtyCounter != null) { 2455 var currentCount = qtyCounter.innerHTML; 2456 qtyCounter.innerHTML = qtyColumnArr[i]; 24572458 if (currentCount != qtyCounter.innerHTML) { 2459 qtyCounter.classList.add("qty-field--active"); 2460 } 2461 } 2462 } 24632464 if (document.getElementById("TotalQtyCount_" + productId)) { 2465 document.getElementById("TotalQtyCount_" + productId).innerHTML = totalQty; 2466 } 24672468 //Clean up animations 2469 setTimeout(function () { 2470 for (var i = 0; i < qtyRowArr.length; i++) { 2471 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-row-" + i)[0]; 2472 if (qtyCounter != null) { 2473 qtyCounter.classList.remove("qty-field--active"); 2474 } 2475 } 2476 for (var i = 0; i < qtyColumnArr.length; i++) { 2477 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-column-" + i)[0]; 2478 if (qtyCounter != null) { 2479 qtyCounter.classList.remove("qty-field--active"); 2480 } 2481 } 2482 }, 1000); 2483 } 2484 </script> 2485 } 2486 } 24872488 @helper RenderVariantMatrixQuantityField(string variantId, VariantMatrix settings, int productLoopCounter, int rowCount, int columnCount) 2489 { 2490 string loopCount = productLoopCounter.ToString(); 24912492 bool combinationFound = false; 2493 double stock = 0; 2494 double quantityValue = 0; 2495 string note = ""; 24962497 VariantProduct variantProduct = null; 24982499 if (settings.GetVariantProducts().TryGetValue(variantId, out variantProduct)) 2500 { 2501 stock = variantProduct.Stock; 2502 quantityValue = variantProduct.Quantity; 2503 combinationFound = true; 2504 } 25052506 if (combinationFound) 2507 { 2508 <input type="hidden" name="ProductLoopCounter@(loopCount)" value="@loopCount" /> 2509 <input type="hidden" name="ProductID@(loopCount)" value="@settings.ProductId" /> 2510 <input type="hidden" name="VariantID@(loopCount)" value="@variantId" /> 2511 <input type="hidden" name="CurrentNote@(loopCount)" id="CurrentNote_@(settings.ProductId)_@variantId" value="@note" /> 2512 <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"> 25132514 if (stock != 0) 2515 { 2516 <small>@Translate("Stock") @stock</small> 2517 } 25182519 <script> 2520 var variants = '{ "ProductId" :' + '"@settings.ProductId"' + ', "VariantId": ' + '"@variantId"' +'}'; 2521 variantsCollection.push(variants); 2522 document.getElementById("Quantity_@(settings.ProductId)_@variantId").closest(".js-variants-matrix").setAttribute("data-variants-collection", "[" + variantsCollection + "]" ); 2523 </script> 2524 } 2525 else 2526 { 2527 <div class="use-btn-height" style="background-color: #a8a8a8"></div> 2528 } 2529 } 2530 @using System 2531 @using Dynamicweb.Rapido.Blocks.Components 2532 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 2533 @using Nevotex.Data.Entities 2534 @* Component *@ 25352536 @helper RenderAddToCart(CustomAddToCart settings) 2537 { 2538 //set Id for quantity selector to get it's value from button 2539 if (settings.QuantitySelector != null) 2540 { 2541 if (string.IsNullOrEmpty(settings.QuantitySelector.Id)) 2542 { 2543 settings.QuantitySelector.Id = Guid.NewGuid().ToString("N"); 2544 } 25452546 settings.AddButton.QuantitySelectorId = settings.QuantitySelector.Id; 25472548 if (settings.Disabled) 2549 { 2550 settings.QuantitySelector.Disabled = true; 2551 } 25522553 if (string.IsNullOrEmpty(settings.QuantitySelector.Name)) 2554 { 2555 settings.QuantitySelector.Name = settings.QuantitySelector.Id; 2556 } 2557 } 25582559 if (settings.Disabled) 2560 { 2561 settings.AddButton.Disabled = true; 2562 } 25632564 settings.AddButton.CssClass += " btn--condensed"; 25652566 //unitsSelector 2567 if (settings.UnitSelector != null) 2568 { 2569 if (settings.Disabled) 2570 { 2571 settings.QuantitySelector.Disabled = true; 2572 } 2573 } 25742575 <div class="buttons-collection @settings.WrapperCssClass" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 2576 @if (settings.UnitSelector != null) 2577 { 2578 @Render(settings.UnitSelector) 2579 } 2580 @if (settings.QuantitySelector != null) 2581 { 2582 @Render(settings.QuantitySelector) 2583 } 2584 @Render(settings.AddButton) 2585 </div> 2586 } 2587 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 2588 @using Dynamicweb.Rapido.Blocks.Components.General 2589 @using Nevotex.Data.Entities 25902591 @* Component *@ 25922593 @helper RenderAddToCartButton(CustomAddToCartBtn settings) 2594 { 2595 if (!settings.HideTitle) 2596 { 2597 if (string.IsNullOrEmpty(settings.Title)) 2598 { 2599 if (settings.BuyForPoints) 2600 { 2601 settings.Title = Translate("Buy with points"); 2602 } 2603 else 2604 { 2605 settings.Title = Translate("Add to cart"); 2606 } 2607 } 2608 } 2609 else 2610 { 2611 settings.Title = ""; 2612 } 26132614 if (settings.Icon == null) 2615 { 2616 settings.Icon = new Icon(); 2617 settings.Icon.LabelPosition = Dynamicweb.Rapido.Blocks.Components.General.IconLabelPosition.After; 2618 } 26192620 if (string.IsNullOrEmpty(settings.Icon.Name)) 2621 { 2622 settings.Icon.Name = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue; 2623 } 26242625 var errorMessage = Translate("Felaktigt antal, köp kan endast göras i jämt antal av"); 26262627 settings.OnClick = "if(CheckMultiple('Quantity_" + settings.ProductId + "', '{{multiple}}'))Cart.AddToCart(event, { " + 2628 "id: '" + settings.ProductId + "'," + 2629 (!string.IsNullOrEmpty(settings.VariantId) ? "variantId: '" + settings.VariantId + "'," : "") + 2630 (!string.IsNullOrEmpty(settings.UnitId) ? "unitId: '" + settings.UnitId + "'," : "") + 2631 (settings.BuyForPoints ? "buyForPoints: true," : "") + 2632 (!string.IsNullOrEmpty(settings.ProductInfo) ? "productInfo: " + settings.ProductInfo + "," : "") + 2633 "quantity: " + (string.IsNullOrEmpty(settings.QuantitySelectorId) ? "1" : "parseFloat(document.getElementById('" + settings.QuantitySelectorId + "').value)") + 2634 "});" + settings.OnClick; 26352636 @RenderButton(settings) 2637 } 2638 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 26392640 @* Component *@ 26412642 @helper RenderUnitSelector(UnitSelector settings) 2643 { 2644 if (string.IsNullOrEmpty(settings.Id)) 2645 { 2646 settings.Id = Guid.NewGuid().ToString("N"); 2647 } 2648 var disabledClass = settings.Disabled ? "disabled" : ""; 26492650 <input type="checkbox" id="@settings.Id" class="dropdown-trigger" /> 2651 <div class="dropdown unit-selector @settings.CssClass @disabledClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 2652 <label class="dropdown__header dropdown__btn dropdown__btn--unit-selector dw-mod" for="@settings.Id">@settings.SelectedOption</label> 2653 <div class="dropdown__content dw-mod"> 2654 @settings.OptionsContent 2655 </div> 2656 <label class="dropdown-trigger-off" for="@settings.Id"></label> 2657 </div> 2658 } 2659 @using System.Reflection 2660 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 26612662 @* Component *@ 26632664 @helper RenderQuantitySelector(QuantitySelector settings) 2665 { 2666 var attributes = new Dictionary<string, string>(); 26672668 /*base settings*/ 2669 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 2670 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 2671 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 2672 if (settings.Disabled) { attributes.Add("disabled", "true"); } 2673 if (settings.Required) { attributes.Add("required", "true"); } 2674 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 2675 /*end*/ 26762677 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 2678 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 2679 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 2680 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 2681 if (settings.Max != null) { attributes.Add("max", settings.Max.ToString()); } 2682 if (settings.Min == null) { settings.Min = 1; } 2683 attributes.Add("min", settings.Min.ToString()); 2684 if (settings.Step != null && !string.IsNullOrEmpty(settings.Step.ToString())) { attributes.Add("step", settings.Step.ToString()); } 2685 if (settings.Value == null) { settings.Value = 1; } 2686 attributes.Add("value", settings.Value.ToString()); 2687 attributes.Add("type", "number"); 26882689 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 26902691 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 2692 } 2693 @using Dynamicweb.Rapido.Blocks.Components 26942695 @using Dynamicweb.Frontend 2696 @using Dynamicweb.Frontend.Devices 2697 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 2698 @using Dynamicweb.Rapido.Blocks.Components.General 2699 @using System.Collections.Generic; 27002701 @* Component *@ 27022703 @helper RenderCustomerCenterList(CustomerCenterList settings) 2704 { 2705 bool isTouchDevice = Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet" ? true : false; 2706 string hideActions = isTouchDevice ? "u-block" : ""; 27072708 <table class="table data-list dw-mod"> 2709 @if (settings.GetHeaders().Length > 0) { 2710 <thead> 2711 <tr class="u-bold"> 2712 @foreach (CustomerCenterListHeaderItem header in settings.GetHeaders()) 2713 { 2714 var attributes = new Dictionary<string, string>(); 2715 if (!string.IsNullOrEmpty(header.Id)) { attributes.Add("id", header.Id); } 2716 if (!string.IsNullOrEmpty(header.CssClass)) { attributes.Add("class", header.CssClass); } 2717 attributes.Add("align", header.Align.ToString()); 2718 attributes = attributes.Concat(header.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 27192720 <td @ComponentMethods.AddAttributes(attributes)>@header.Title</td> 2721 } 2722 </tr> 2723 </thead> 2724 } 2725 @foreach (CustomerCenterListItem listItem in settings.GetItems()) 2726 { 2727 int columnCount = 0; 2728 int totalColumns = listItem.GetInfoItems().Length; 2729 string rowHasActions = listItem.GetActions().Length > 0 ? "data-list__item--has-actions" : ""; 2730 listItem.Id = !string.IsNullOrEmpty(listItem.Id) ? listItem.Id : Guid.NewGuid().ToString("N"); 27312732 var attributes = new Dictionary<string, string>(); 2733 if (!string.IsNullOrEmpty(listItem.Title)) { attributes.Add("title", listItem.Title); }; 27342735 attributes = attributes.Concat(listItem.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 2736 <tbody class="data-list__item @rowHasActions @listItem.CssClass dw-mod" @ComponentMethods.AddAttributes(attributes)> 2737 <tr> 2738 @if (!string.IsNullOrEmpty(listItem.Title) || !string.IsNullOrEmpty(listItem.Description)) { 2739 string onClick = !string.IsNullOrEmpty(listItem.OnClick) ? "onclick=\"" + listItem.OnClick + "\"" : ""; 27402741 <td rowspan="2" @onClick class="data-list__main-item dw-mod"> 2742 @if (!string.IsNullOrEmpty(listItem.Title)) { 2743 <div class="u-bold">@listItem.Title</div> 2744 } 2745 @if (!string.IsNullOrEmpty(listItem.Description)) { 2746 <div>@listItem.Description</div> 2747 } 2748 </td> 2749 } 27502751 @foreach (CustomerCenterListInfoItem infoItem in listItem.GetInfoItems()) 2752 { 2753 var infoAttributes = new Dictionary<string, string>(); 2754 if (!string.IsNullOrEmpty(infoItem.Id)) { infoAttributes.Add("id", infoItem.Id); }; 2755 if (!string.IsNullOrEmpty(infoItem.OnClick)) { infoAttributes.Add("onclick", infoItem.OnClick); }; 2756 infoAttributes.Add("align", infoItem.Align.ToString()); 27572758 infoAttributes = infoAttributes.Concat(infoItem.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 2759 string columnClick = columnCount < (totalColumns-1) && !string.IsNullOrEmpty(listItem.OnClick) ? "onclick=\"" + listItem.OnClick + "\"" : ""; 27602761 <td @ComponentMethods.AddAttributes(infoAttributes) @columnClick class="data-list__info-item dw-mod"> 2762 @if (!string.IsNullOrEmpty(infoItem.Title)) { 2763 <div>@infoItem.Title</div> 2764 } 2765 @if (!string.IsNullOrEmpty(infoItem.Subtitle)) { 2766 <div><small>@infoItem.Subtitle</small></div> 2767 } 2768 </td> 27692770 columnCount++; 2771 } 2772 </tr> 2773 <tr> 2774 <td colspan="7" align="right" class="u-va-bottom u-no-border"> 2775 <div class="data-list__actions @hideActions dw-mod" id="ActionsMenu_@listItem.Id"> 2776 @foreach (ButtonBase action in listItem.GetActions()) 2777 { 2778 action.ButtonLayout = ButtonLayout.LinkClean; 2779 action.Icon.CssClass += " u-full-height"; 2780 action.CssClass += " data-list__action-button link"; 27812782 @Render(action) 2783 } 2784 </div> 2785 </td> 2786 </tr> 2787 </tbody> 2788 } 2789 </table> 2790 } 27912792 @* Include the Blocks for the page *@ 2793 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2794 @using Dynamicweb.Core 2795 @using System 2796 @using System.Web 2797 @using System.Collections.Generic 2798 @using Dynamicweb.Rapido.Blocks 27992800 @{ 2801 BlocksPage productListProductsBlocksPage = BlocksPage.GetBlockPage("ProductList"); 28022803 Block productsBlock = new Block 2804 { 2805 Id = "Views", 2806 SortId = 30, 2807 Template = RenderProducts() 2808 }; 28092810 productListProductsBlocksPage.Add("ProductList", productsBlock); 2811 } 28122813 @helper RenderProducts() 2814 { 2815 @*This is part of a script template *@ 28162817 <div id="ProductsContainer" data-template="{{listTemplate}}" class="grid product-list grid--external-bleed-x dw-mod grid--align-content-start" data-save-cookie="true"> 2818 {{#ProductsContainer}} 2819 {{> (lookup . 'template') }} 2820 {{/ProductsContainer}} 2821 </div> 2822 } 282328242825 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2826 @using Dynamicweb.Core 2827 @using System 2828 @using System.Web 2829 @using System.Collections.Generic 2830 @using Dynamicweb.Rapido.Blocks 2831 @using Dynamicweb.Rapido.Blocks.Components 2832 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 2833 @using Dynamicweb.Rapido.Blocks.Components.General 2834 @using Dynamicweb.Rapido.Services 2835 @using Nevotex.Data.Entities 28362837 @functions { 2838 BlocksPage gridViewPage = BlocksPage.GetBlockPage("ProductList"); 2839 Dynamicweb.Frontend.ItemViewModel gridViewSettings = null; 2840 } 28412842 @if (true) 2843 { 2844 //gridViewSettings = Pageview.AreaSettings.GetItem("ProductList").GetItem("GridView"); 28452846 BlocksPage gridViewPage = BlocksPage.GetBlockPage("ProductList"); 28472848 gridViewPage.Add("Views", new Block 2849 { 2850 Id = "ProductGridItemContainer", 2851 Name = "th", 2852 SortId = 20 2853 }); 28542855 Block gridViewScripts = new Block 2856 { 2857 Id = "GridViewScripts", 2858 SortId = 20, 2859 Template = GridView(), 2860 BlocksList = new List<Block> { 2861 new Block 2862 { 2863 Id = "GridViewItem", 2864 SortId = 10, 2865 Template = RenderGridViewItem(), 2866 SkipRenderBlocksList = true, 2867 BlocksList = new List<Block> { 2868 new Block 2869 { 2870 Id = "GridViewItemHiddenProperties", 2871 SortId = 10, 2872 Template = RenderGridViewItemHiddenProperties() 2873 }, 2874 new Block 2875 { 2876 Id = "GridViewItemImageContainer", 2877 SortId = 20, 2878 SkipRenderBlocksList = true, 2879 Template = RenderGridViewItemImageContainer(), 2880 BlocksList = new List<Block> { 2881 new Block 2882 { 2883 Id = "GridViewItemImage", 2884 SortId = 10, 2885 Template = RenderGridViewItemImage() 2886 }, 2887 new Block 2888 { 2889 Id = "GridViewItemStickers", 2890 SortId = 20, 2891 Template = RenderGridViewItemStickers() 2892 } 2893 } 2894 }, 2895 new Block 2896 { 2897 Id = "GridViewItemInfoContainer", 2898 SortId = 30, 2899 SkipRenderBlocksList = true, 2900 Template = RenderGridViewItemInfoContainer(), 2901 BlocksList = new List<Block> { 2902 new Block 2903 { 2904 Id = "GridViewItemTitle", 2905 SortId = 10, 2906 Template = RenderGridViewItemTitle() 2907 } 2908 } 2909 }, 2910 new Block 2911 { 2912 Id = "GridViewItemFooter", 2913 SortId = 40, 2914 SkipRenderBlocksList = true, 2915 Template = RenderGridViewItemFooter(), 2916 BlocksList = new List<Block> { 2917 new Block 2918 { 2919 Id = "GridViewItemActions", 2920 SortId = 10, 2921 Template = RenderGridViewItemActions() 2922 } 2923 } 2924 } 2925 } 2926 } 2927 } 2928 }; 292929302931293229332934 gridViewPage.Add("BottomSnippets", gridViewScripts); 29352936 //favorites 2937 bool gridViewShowFavoriteButton = true; 29382939 if (gridViewShowFavoriteButton) 2940 { 2941 gridViewPage.Add("GridViewItemImageContainer", new Block 2942 { 2943 Id = "GridViewItemFavorites", 2944 SortId = 30, 2945 Template = RenderGridViewItemFavorites() 2946 }); 2947 } 29482949 //number 2950 bool gridViewShowNumber = true; 29512952 if (gridViewShowNumber) 2953 { 2954 gridViewPage.Add("GridViewItemInfoContainer", new Block 2955 { 2956 Id = "GridViewItemNumber", 2957 SortId = 20, 2958 Template = RenderGridViewItemNumber() 2959 }); 2960 } 29612962296329642965 //price 2966 bool gridViewShowPrice = true; 2967 if (gridViewShowPrice && Dynamicweb.Rapido.Services.User.IsPricesAllowed()) 2968 { 2969 gridViewPage.Add("GridViewItemInfoContainer", new Block 2970 { 2971 Id = "GridViewItemPrice", 2972 SortId = 30, 2973 Template = RenderGridViewItemPrice() 2974 }); 2975 } 29762977 //stock 2978 bool gridViewShowStock = false; 29792980 if (User.IsStockInfoAllowed() && gridViewShowStock) 2981 { 2982 gridViewPage.Add("GridViewItemFooter", new Block 2983 { 2984 Id = "GridViewItemStockAndDelivery", 2985 SortId = 20, 2986 Template = RenderGridViewItemStockAndDelivery() 2987 }); 2988 } 29892990 //static variants 2991 bool gridViewShowStaticVariants = false; 29922993 if (gridViewShowStaticVariants) 2994 { 2995 gridViewPage.Add("GridViewItemFooter", new Block 2996 { 2997 Id = "GridViewItemStaticVariants", 2998 SortId = 30, 2999 Template = RenderGridViewItemStaticVariants() 3000 }); 3001 } 30023003 //download button 3004 bool gridViewShowAddToDownloadButton = false; 30053006 if (gridViewShowAddToDownloadButton && Pageview.User != null) 3007 { 3008 gridViewPage.Add("GridViewItemFooter", new Block 3009 { 3010 Id = "GridViewItemDownloadButton", 3011 SortId = 40, 3012 Template = RenderGridViewItemDownloadButton() 3013 }); 3014 } 3015 } 30163017 @helper GridView() 3018 { 3019 int columnsCount = 3; 3020 string imageZoomOnHover = "image-hover--zoom"; 30213022 <script id="ProductGridItemContainer" type="text/x-template"> 3023 {{#.}} 3024 <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"> 3025 {{#Product}} 3026 {{>GridViewItem}} 3027 {{/Product}} 3028 </div> 3029 {{/.}} 3030 </script> 3031 } 30323033 @helper RenderGridViewItem() 3034 { 3035 List<Block> subBlocks = gridViewPage.GetBlockListById("GridViewItem"); 30363037 <script id="GridViewItem" type="text/x-template"> 3038 {{#.}} 3039 <div class="grid__col--auto js-product-scroll-trigger u-no-padding u-full-height" data-params="{{googleImpression}}"> 3040 @RenderBlockList(subBlocks) 3041 </div> 3042 {{/.}} 3043 </script> 3044 } 30453046 @helper RenderGridViewItemHiddenProperties() 3047 { 3048 <input type="hidden" name="ProductLoopCounter{{id}}" value="{{id}}" /> 3049 <input type="hidden" name="ProductID{{id}}" value="{{productId}}" /> 3050 <input type="hidden" name="VariantID{{id}}" value="{{variantid}}" id="Variant_{{id}}" /> 3051 <input type="hidden" name="UnitID{{id}}" value="{{unitId}}" id="Unit_{{id}}" /> 3052 <input type="hidden" name="Quantity{{id}}" value="1" id="Quantity_{{id}}" /> 3053 } 30543055 @helper RenderGridViewItemImageContainer() 3056 { 3057 List<Block> subBlocks = gridViewPage.GetBlockListById("GridViewItemImageContainer"); 30583059 <div class="grid__cell product-list__grid-item__image dw-mod {{imageBorder}} {{noImage}}"> 3060 @RenderBlockList(subBlocks) 3061 </div> 3062 } 30633064 @helper RenderGridViewItemImage() 3065 { 3066 bool secondaryImage = false; 30673068 <a href="{{link}}" 3069 onclick="{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}" 3070 title="{{{name}}}{{#if variantName}}, {{variantName}}{{/if}}" 3071 class="u-block u-position-relative image-hover__wrapper dw-mod"> 3072 <img width="168" height="168" class="grid__cell-img grid__cell-img--centered u-padding {{imgPadding}} b-lazy" src="/Files/Images/placeholder.gif" 3073 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}}" 3074 @if (secondaryImage) { <text> 3075 {{#if secondaryImage}} 3076 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}}" 3077 {{/if}} 3078 </text> } 3079 alt="{{{name}}}{{#if variantName}}, {{variantName}}{{/if}}" /> 3080 </a> 3081 } 30823083 @helper RenderGridViewItemStickers() 3084 { 3085 <text> 3086 {{#StickersContainers}} 3087 {{>StickersContainer}} 3088 {{/StickersContainers}} 3089 </text> 3090 } 30913092 @helper RenderGridViewItemFavorites() 3093 { 3094 <div class="favorites favorites--for-grid-view u-pull--right {{hasVariants}} dw-mod" {{hasVariants}}> 3095 {{#Favorite}} 3096 {{>FavoriteTemplate}} 3097 {{/Favorite}} 3098 </div> 3099 } 31003101 @helper RenderGridViewItemInfoContainer() 3102 { 3103 List<Block> subBlocks = gridViewPage.GetBlockListById("GridViewItemInfoContainer"); 31043105 <div class="grid__cell product-list__grid-item__price-info dw-mod {{paddingFix}} "> 3106 @RenderBlockList(subBlocks) 3107 </div> 3108 } 31093110 @helper RenderGridViewItemTitle() 3111 { 3112 <a href="{{link}}" class="u-color-inherit" onclick="{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}" title="{{{name}}}{{#if variantName}}, {{variantName}}{{/if}}"> 3113 <h6 class="u-condensed-text u-bold">{{{name}}}{{#if variantName}}, {{variantName}}{{/if}}</h6> 3114 </a> 3115 } 31163117 @helper RenderGridViewItemNumber() 3118 { 3119 <div class="item-number dw-mod {{displayCss}} {{hideArticleNumberCss}} ">@Translate("ArtNr", "Art. nr"): {{number}} </div> 31203121 if (Dynamicweb.Frontend.PageView.Current().Device != Dynamicweb.Frontend.Devices.DeviceType.Mobile) 3122 { 3123 // login to see price 3124 bool userLoggedIn = Dynamicweb.Security.UserManagement.User.IsExtranetUserLoggedIn(); 31253126 if (!userLoggedIn && (Pageview.AreaID == 21 || Pageview.AreaID == 24 || Pageview.AreaID == 25)) 3127 { 3128 <div class="u-ta-left dw-mod {{displayCss}}"> 3129 <label for="SignInModalTrigger" class="item-number sign-in-modal-trigger-button" onclick="setTimeout(function () { document.getElementById('LoginUsername').focus() }, 10)"> 3130 @Translate("Logga_in_for_pris_och_kop") 3131 </label> 3132 </div> 3133 } 3134 } 3135 } 31363137313831393140 @helper RenderGridViewItemPrice() 3141 { 3142 int columnsCount = 4; 3143 bool pointShopOnly = false; 3144 bool showCartButton = false; 3145 bool showVATPrice = false; 3146 bool isPricesWithVATEnabled = Dynamicweb.Ecommerce.Common.Context.DisplayPricesWithVat; 31473148 if (pointShopOnly) 3149 { 3150 <text> 3151 {{#if havePointPrice}} 3152 <div class="price price--product-list dw-mod">{{points}} @Translate("points")</div> 3153 @if (showCartButton) 3154 { 3155 <text> 3156 {{#unless canBePurchasedWithPoints}} 3157 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small> 3158 {{/unless}} 3159 </text> 3160 } 3161 {{else}} 3162 @Translate("Not available") 3163 {{/if}} 3164 </text> 31653166 } 3167 else 3168 { 3169 <div class="price price--product-list dw-mod">{{price}}</div> 3170 <div class="before-price {{onSale}} dw-mod">{{discount}}</div> 3171 if (showVATPrice) 3172 { 3173 <div class="vat-price vat-price--product-list u-margin-top dw-mod"> 3174 @if (columnsCount <= 4) 3175 { 3176 if (isPricesWithVATEnabled) 3177 { 3178 <span>@Translate("excl. VAT")</span><span> ({{priceWithoutVAT}})</span> 3179 } 3180 else 3181 { 3182 <span>@Translate("incl. VAT")</span><span> ({{priceWithVAT}})</span> 3183 } 3184 } 3185 else 3186 { 3187 if (isPricesWithVATEnabled) 3188 { 3189 <div>@Translate("excl. VAT")</div><div>({{priceWithoutVAT}})</div> 3190 } 3191 else 3192 { 3193 <div>@Translate("incl. VAT")</div><div>({{priceWithVAT}})</div> 3194 } 3195 } 3196 </div> 3197 } 3198 <text> 3199 {{#if priceRRP}} 3200 <div><small>@Translate("RRP") {{priceRRP}}</small></div> 3201 {{/if}} 3202 </text> 3203 } 3204 } 32053206 @helper RenderGridViewItemFooter() 3207 { 3208 List<Block> subBlocks = gridViewPage.GetBlockListById("GridViewItemFooter"); 3209 bool showStaticVariants = false; 32103211 <div class="product-list__grid-item__footer dw-mod {{displayCss}}"> 3212 @RenderBlockList(subBlocks) 3213 </div> 3214 } 32153216 @helper RenderGridViewItemViewButton() 3217 { 3218 string viewMoreText = "View"; 32193220 @Render(new Link 3221 { 3222 Href = "{{link}}", 3223 Id = "CartButton_{{id}}", 3224 Title = Translate(viewMoreText), 3225 OnClick = "{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}", 3226 ButtonLayout = ButtonLayout.Secondary, 3227 CssClass = "u-no-margin" 3228 }); 3229 } 32303231 @helper RenderGridViewItemAddToCart() 3232 { 3233 bool pointShopOnly = false; 3234 string wrapperClass = "buttons-collection--center"; 3235 int columnsCount = 4; 3236 bool hideButtonText = columnsCount >= 4 || Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet"; 32373238 if (pointShopOnly && columnsCount <= 4) 3239 { 3240 hideButtonText = false; 3241 } 32423243 var addToCartBtn = new CustomAddToCart 3244 { 3245 WrapperCssClass = wrapperClass, 3246 AddButton = new CustomAddToCartBtn 3247 { 3248 HideTitle = hideButtonText, 3249 ProductId = "{{productId}}", 3250 VariantId = "{{variantid}}", 3251 UnitId = "{{unitId}}", 3252 ProductInfo = "{{productInfo}}", 3253 BuyForPoints = pointShopOnly, 3254 OnClick = "{{facebookPixelAction}}", 3255 ExtraAttributes = new Dictionary<string, string> 3256 { 3257 { "{{disabledBuyButton}}", "" } 3258 } 3259 } 3260 }; 32613262 if (!pointShopOnly) 3263 { 3264 addToCartBtn.QuantitySelector = new QuantitySelector 3265 { 3266 Id = "Quantity{{id}}" 3267 }; 3268 } 32693270 @Render(addToCartBtn) 3271 } 32723273 @helper RenderGridViewItemActions() 3274 { 3275 bool showCartButton = false; 3276 bool showViewButton = true; 32773278 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed()) 3279 { 3280 if (showCartButton) 3281 { 3282 if (!showViewButton) 3283 { 3284 <text>{{#if hideAddToCartButton}}</text> 3285 <div>@RenderGridViewItemViewButton()</div> 3286 <text>{{else}}</text> 3287 @RenderGridViewItemAddToCart() 3288 <text>{{/if}}</text> 3289 } 3290 else 3291 { 3292 @RenderGridViewItemAddToCart() 3293 } 3294 } 3295 else if (showViewButton) 3296 { 3297 <div>@RenderGridViewItemViewButton()</div> 3298 } 3299 } 3300 else if (showViewButton) 3301 { 3302 <div>@RenderGridViewItemViewButton()</div> 3303 } 3304 } 33053306 @helper RenderGridViewItemStockAndDelivery() 3307 { 3308 <text>{{#if stockText}}</text> 3309 <div class="u-margin-top"> 3310 <div><span class="stock-icon {{stockState}} u-no-margin dw-mod" title="{{stockText}}"></span> {{stockText}}</div> 3311 <div> 3312 {{#if deliveryText}} 3313 {{deliveryText}} 3314 {{else}} 3315 - 3316 {{/if}} 3317 </div> 3318 </div> 3319 <text>{{/if}}</text> 3320 } 33213322 @helper RenderGridViewItemStaticVariants() 3323 { 3324 string variantsSize = "sm"; 33253326 <text> 3327 {{#Variants}} 3328 @if (variantsSize == "lg") 3329 { 3330 <text> 3331 {{>StaticVariantsLgTemplate}} 3332 </text> 3333 } 3334 else 3335 { 3336 <text> 3337 {{>StaticVariantsTemplate}} 3338 </text> 3339 } 3340 {{/Variants}} 33413342 {{#ifCond variantGroupsCount '>' 1}} 3343 <div class="static-variant"> 3344 @Translate("More options available") 3345 </div> 3346 {{/ifCond}} 33473348 {{#ifCond variantGroupsCount '==' 0}} 3349 <div class="static-variant"></div> 3350 {{/ifCond}} 3351 </text> 3352 } 33533354 @helper RenderGridViewItemDownloadButton() 3355 { 3356 <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}}"> 3357 @Render(new Icon { Prefix = "fas", Name = "fa-plus", CssClass = "js-button-icon" }) 3358 <span class="js-button-text">@Translate("Add")</span> 3359 </button> 3360 } 33613362 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 3363 @using Dynamicweb.Core 3364 @using System 3365 @using System.Web 3366 @using System.Collections.Generic 3367 @using Dynamicweb.Rapido.Blocks 33683369 @{ 3370 /* 3371 BlocksPage productListPromotionsBlocksPage = BlocksPage.GetBlockPage("ProductList"); 33723373 Block productListPromotions = new Block 3374 { 3375 Id = "Promotions", 3376 SortId = 10, 3377 Template = RenderProductListPromotions() 3378 }; 3379 productListPromotionsBlocksPage.Add("PageContainer", productListPromotions); 3380 */ 3381 } 33823383 @helper RenderProductListPromotions() 3384 { 3385 @*This is part of a script template *@ 33863387 //string listId = HttpContext.Current.Request.QueryString.Get("ListID"); 3388 //bool isFavoriteList = !string.IsNullOrEmpty(listId); 3389 string smallDeviceCss = ""; 33903391 if (false) 3392 { 3393 switch ("Disable") 3394 { 3395 case "OnlyText": 3396 <article class="grid__col-12 u-margin-bottom @smallDeviceCss"> 3397 <h1>{{groupName}}</h1> 3398 {{{groupDescription}}} 3399 {{#ifCond groupPromotionLink "!==" ""}} 3400 <div> 3401 <a href="{{groupPromotionLink}}" class="btn btn--primary">{{groupPromotionLinkText}}</a> 3402 </div> 3403 {{/ifCond}} 3404 </article> 3405 break; 3406 case "TextAndImage": 3407 <article class="grid__col-12 u-margin-bottom @smallDeviceCss"> 3408 <div class="grid grid--bleed"> 3409 <div class="grid__col-md-6"> 3410 <h1>{{groupName}}</h1> 3411 {{{groupDescription}}} 3412 {{#ifCond groupPromotionLink "!==" ""}} 3413 <div> 3414 <a href="{{groupPromotionLink}}" class="btn btn--primary">{{groupPromotionLinkText}}</a> 3415 </div> 3416 {{/ifCond}} 3417 </div> 3418 {{#ifCond groupPromotionImage "!==" ""}} 3419 <div class="grid__col-md-6"> 3420 <img src="/Admin/Public/GetImage.ashx?width=600&crop=5&Compression=75&DoNotUpscale=true&image={{groupPromotionImage}}" alt="{{groupName}}" class="background-image__cover" /> 3421 </div> 3422 {{/ifCond}} 3423 </div> 3424 </article> 3425 break; 3426 case "Banner": 3427 <text> 3428 {{#ifCond groupPromotionImage "!==" ""}} 3429 <article class="grid__col-12 u-margin-bottom @smallDeviceCss"> 3430 <div class="u-color-light grid center-container center-container--with-background-image grid__col--bg" style="background-image:url('{{groupPromotionImage}}');"> 3431 <div class="grid__col-12 u-middle"> 3432 <div class="grid__cell"> 3433 {{{groupDescription}}} 3434 {{#ifCond groupPromotionLink "!==" ""}} 3435 <div> 3436 <a href="{{groupPromotionLink}}" class="btn btn--primary">{{groupPromotionLinkText}}</a> 3437 </div> 3438 {{/ifCond}} 3439 </div> 3440 </div> 3441 </div> 3442 </article> 3443 {{/ifCond}} 3444 </text> 3445 break; 3446 } 3447 } 3448 } 3449 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 3450 @using Dynamicweb.Core 3451 @using System 3452 @using System.Web 3453 @using System.Collections.Generic 3454 @using Dynamicweb.Rapido.Blocks 34553456 @{ 3457 BlocksPage productListMenuBlocksPage = BlocksPage.GetBlockPage("ProductList"); 34583459 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && 3460 Converter.ToString(Pageview.Page.PropertyItem["LeftMenu"]) == "True" && 3461 Pageview.Page.NavigationSettings != null && 3462 Pageview.Page.NavigationSettings.UseEcomGroups) { 34633464 Block productListMenuBlock = new Block 3465 { 3466 Id = "Menu", 3467 SortId = 20, 3468 Template = RenderProductListMenu() 3469 }; 34703471 productListMenuBlocksPage.Add("Navigation", productListMenuBlock); 3472 } 3473 } 34743475 @helper RenderProductListMenu() 3476 { 3477 var navigationMarkup = RenderNavigation(new 3478 { 3479 id = "leftnav", 3480 cssclass = "dwnavigation", 3481 startLevel = 1, 3482 endlevel = 5, 3483 template = "LeftNavigation.xslt", 3484 mode = "ecom" 3485 }); 34863487 <h2 class="u-margin-bottom">@Translate("Product categories")</h2> 34883489 <div class="u-padding-bottom--lg"> 3490 @navigationMarkup 3491 </div> 3492 } 3493 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 3494 @using Dynamicweb.Core 3495 @using System 3496 @using System.Web 3497 @using System.Collections.Generic 3498 @using Dynamicweb.Rapido.Blocks 3499 @using Dynamicweb.Rapido.Blocks.Components.General 35003501 @{ 3502 BlocksPage productListFacetsBlocksPage = BlocksPage.GetBlockPage("ProductList"); 3503 string facetsBlockViewMode = "left"; 35043505 if (facetsBlockViewMode == "left" && Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 3506 { 3507 Block facetsBlock = new Block 3508 { 3509 Id = "Facets", 3510 SortId = 30, 3511 Template = RenderProductListFacets() 3512 }; 3513 productListFacetsBlocksPage.Add("Navigation", facetsBlock); 3514 } 35153516 if (facetsBlockViewMode == "top" || Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet") 3517 { 3518 Block facetsBlock = new Block 3519 { 3520 Id = "Facets", 3521 SortId = 10, 3522 Template = RenderProductListTopFacets() 3523 }; 3524 productListFacetsBlocksPage.Add("ProductList", facetsBlock); 3525 } 35263527 Block facetSelections = new Block 3528 { 3529 Id = "FacetSelections", 3530 SortId = 20, 3531 Template = RenderFacetSelections() 3532 }; 3533 productListFacetsBlocksPage.Add("ProductList", facetSelections); 35343535 Block checkboxFacetTemplate = new Block 3536 { 3537 Id = "CheckboxFacet", 3538 SortId = 30, 3539 Template = RenderCheckboxFacets() 3540 }; 3541 productListFacetsBlocksPage.Add("BottomSnippets", checkboxFacetTemplate); 35423543 Block RangeFacetTemplate = new Block 3544 { 3545 Id = "RangeFacet", 3546 SortId = 90, 3547 Template = RenderRangeFacets() 3548 }; 3549 productListFacetsBlocksPage.Add("BottomSnippets", RangeFacetTemplate); 35503551 Block tagsFacetTemplate = new Block 3552 { 3553 Id = "TagsFacet", 3554 SortId = 40, 3555 Template = RenderTagsFacets() 3556 }; 3557 productListFacetsBlocksPage.Add("BottomSnippets", tagsFacetTemplate); 35583559 Block colorsFacetTemplate = new Block 3560 { 3561 Id = "ColorFacet", 3562 SortId = 50, 3563 Template = RenderColorFacets() 3564 }; 3565 productListFacetsBlocksPage.Add("BottomSnippets", colorsFacetTemplate); 35663567 Block selectedFilter = new Block 3568 { 3569 Id = "SelectedFilter", 3570 SortId = 60, 3571 Template = RenderSelectedFilter() 3572 }; 3573 productListFacetsBlocksPage.Add("BottomSnippets", selectedFilter); 35743575 Block selectedRangeFilter = new Block 3576 { 3577 Id = "SelectedRangeFilter", 3578 SortId = 60, 3579 Template = RenderSelectedRangeFilter() 3580 }; 3581 productListFacetsBlocksPage.Add("BottomSnippets", selectedRangeFilter); 358235833584 Block selectedColorFilter = new Block 3585 { 3586 Id = "SelectedColorFilter", 3587 SortId = 70, 3588 Template = RenderSelectedColorFilter() 3589 }; 3590 productListFacetsBlocksPage.Add("BottomSnippets", selectedColorFilter); 35913592 Block resetFilters = new Block 3593 { 3594 Id = "ResetFilters", 3595 SortId = 80, 3596 Template = RenderResetFilters() 3597 }; 3598 productListFacetsBlocksPage.Add("BottomSnippets", resetFilters); 3599 } 36003601 @helper RenderFacetSelections() 3602 { 3603 @*This is part of a script template *@ 3604 <text> 3605 {{#if FacetSelections}} 3606 <div class="buttons-collection u-margin-bottom" id="selectedFacets"> 3607 {{#FacetSelections}} 3608 {{>(lookup . 'template')}} 3609 {{/FacetSelections}} 3610 </div> 3611 {{/if}} 3612 </text> 3613 } 36143615 @helper RenderProductListFacets() 3616 { 3617 var facetSettings = Pageview.AreaSettings.GetItem("ProductList").GetItem("Facets"); 3618 string boxDisplay = facetSettings.GetList("BoxDisplay") != null ? facetSettings.GetList("BoxDisplay").SelectedValue : "scroll"; 36193620 string facetMoreClass = (boxDisplay == "view-more" ? "facets-container__list--more" : ""); 36213622 @*This is part of a script template *@ 36233624 <input type="checkbox" id="CheckFacetGroups" class="js-remember-state u-hidden" data-expand="CheckFacetGroups" /> 3625 <div class="facets-container facets-container--left expandable--collapsed dw-mod" data-trigger="CheckFacetGroups"> 3626 {{#FacetGroups}} 3627 <input type="checkbox" id="OptionsGroup_{{name}}" class="expand-trigger js-remember-state" {{defaultState}} /> 36283629 <div class="expand-container facets-container__box dw-mod js-filter"> 3630 <label class="expand-container__btn facets-container__header dw-mod" for="OptionsGroup_{{name}}">{{name}}</label> 3631 <div class="expand-container__content js-facet-container dw-mod" data-input="OptionsGroup_{{name}}"> 36323633 {{#ifCond template "===" "Checkboxes"}} 3634 <div class="facets-container__search {{showFilter}} dw-mod"> 3635 <input type="text" class="u-full-width u-no-margin" onkeyup="Filter.FilterItems(event)" placeholder="@Translate("Search")" /> 3636 </div> 3637 {{/ifCond}} 36383639 <div id="facetList{{name}}" class="x {{template}} facets-container__list @facetMoreClass dw-mod"> 3640 {{#FacetOptions}} 3641 {{#ifCond template "===" "Checkboxes"}} 3642 {{>Checkboxes}} 3643 {{/ifCond}} 3644 {{#ifCond template "===" "Range"}} 3645 {{>Range}} 3646 {{/ifCond}} 3647 {{#ifCond template "===" "Weight"}} 3648 {{>Checkboxes}} 3649 {{/ifCond}} 3650 {{#ifCond template "===" "Tags"}} 3651 {{>Tags}} 3652 {{/ifCond}} 3653 {{#ifCond template "===" "Colors"}} 3654 {{>Colors}} 3655 {{/ifCond}} 3656 {{/FacetOptions}} 3657 <div class="u-hidden js-filter-not-found"> 3658 @Translate("Your search gave 0 results") 3659 </div> 3660 </div> 36613662 @if (boxDisplay == "view-more") 3663 { 3664 <div class="facets-container__more js-facet-expand"> 3665 @Render(new Button 3666 { 3667 Title = "<span class=js-facet-trigger-text>" + Translate("View more") + "</span>", 3668 ButtonType = ButtonType.Button, 3669 ButtonLayout = ButtonLayout.Clean, 3670 CssClass = "facets-container__more-button js-facet-trigger u-flex u-no-margin u-full-width", 3671 OnClick = "Facets.ExpandToggle(this)", 3672 ExtraAttributes = new Dictionary<string, string>{ 3673 {"data-target", "facetList{{name}}"}, 3674 {"data-toggle-text", Translate("Show less")}, 3675 }, 3676 Icon = new Icon 3677 { 3678 Prefix = "fal", 3679 Name = "fa-angle-down", 3680 } 3681 }) 3682 </div> 3683 } 3684 </div> 3685 </div> 3686 {{/FacetGroups}} 3687 </div> 3688 <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> 3689 <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> 3690 } 36913692 @helper RenderProductListTopFacets() 3693 { 3694 @*This is part of a script template *@ 3695 <input type="checkbox" id="CheckFacetGroups" class="js-remember-state u-hidden" data-expand="CheckFacetGroups" /> 3696 <div class="grid grid--external-bleed dw-mod expandable--collapsed facets-container facets-container--top u-margin-bottom" data-trigger="CheckFacetGroups"> 3697 @if (Pageview.Device.ToString() == "Mobile") 3698 { 3699 string dropdownCssClass = Pageview.Device.ToString() == "Mobile" ? "u-flex-grow--1" : ""; 37003701 <div class="grid__col-lg-3 grid__col-md-3 grid__col-sm-4 grid__col-xs-12"> 3702 <input type="checkbox" id="ProductSort" class="dropdown-trigger" /> 3703 <div class="dropdown u-inline-block @dropdownCssClass dw-mod"> 3704 <label class="dropdown__header dropdown__btn dropdown__btn--small dw-mod" for="ProductSort">{{selectedSort}}</label> 3705 <div class="dropdown__content dw-mod"> 3706 <div class="dropdown__item" onclick="HandlebarsBolt.UpdateQueryParameters('productList', { SortBy: '', SortOrder: '' }, true);">@Translate("Default")</div> 3707 <div class="dropdown__item" onclick="HandlebarsBolt.UpdateQueryParameters('productList', { SortBy: 'Created', SortOrder: 'DESC'}, true);">@Translate("Newest")</div> 3708 <div class="dropdown__item" onclick="HandlebarsBolt.UpdateQueryParameters('productList', { SortBy: 'NameForSort', SortOrder: 'ASC'}, true);">@Translate("Name A - Z")</div> 3709 <div class="dropdown__item" onclick="HandlebarsBolt.UpdateQueryParameters('productList', { SortBy: 'NameForSort', SortOrder: 'DESC'}, true);">@Translate("Name Z - A")</div> 3710 @if (Dynamicweb.Rapido.Services.User.IsPricesAllowed()) 3711 { 3712 <div class="dropdown__item" onclick="HandlebarsBolt.UpdateQueryParameters('productList', { SortBy: 'Price', SortOrder: 'ASC' }, true);">@Translate("Price low - high")</div> 3713 <div class="dropdown__item" onclick="HandlebarsBolt.UpdateQueryParameters('productList', { SortBy: 'Price', SortOrder: 'DESC' }, true);">@Translate("Price high - low")</div> 3714 } 3715 </div> 3716 <label class="dropdown-trigger-off" for="ProductSort"></label> 3717 </div> 3718 </div> 3719 } 37203721 {{#FacetGroups}} 3722 <div class="grid__col-lg-3 grid__col-md-3 grid__col-sm-4 grid__col-xs-12"> 3723 <input type="checkbox" id="OptionsGroup_{{counter}}" class="dropdown-trigger" /> 3724 <div class="dropdown dw-mod js-filter"> 3725 <label class="dropdown__header dropdown__btn dw-mod" for="OptionsGroup_{{counter}}">{{name}}</label> 3726 <div class="dropdown__content dropdown__content--padding dw-mod"> 3727 <div class="u-margin-bottom {{showFilter}}"> 3728 <input type="text" class="u-full-width u-no-margin" onkeyup="Filter.FilterItems(event)" placeholder="@Translate("Search")" /> 3729 </div> 3730 {{#FacetOptions}} 3731 {{#ifCond template "===" "Checkboxes"}} 3732 {{>Checkboxes}} 3733 {{/ifCond}} 3734 {{#ifCond template "===" "Range"}} 3735 {{>Range}} 3736 {{/ifCond}} 3737 {{#ifCond template "===" "Weight"}} 3738 {{>Checkboxes}} 3739 {{/ifCond}} 3740 {{#ifCond template "===" "Tags"}} 3741 {{>Tags}} 3742 {{/ifCond}} 3743 {{#ifCond template "===" "Colors"}} 3744 {{>Colors}} 3745 {{/ifCond}} 3746 {{/FacetOptions}} 3747 <div class="u-hidden js-filter-not-found"> 3748 @Translate("Your search gave 0 results") 3749 </div> 3750 </div> 3751 <label class="dropdown-trigger-off" for="OptionsGroup_{{counter}}"></label> 3752 </div> 3753 </div> 3754 {{/FacetGroups}} 3755 </div> 3756 <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> 3757 <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> 3758 } 37593760 @helper RenderCheckboxFacets() 3761 { 3762 <script id="Checkboxes" type="text/x-template"> 3763 <div class="form__field-group u-no-margin dw-mod"> 3764 <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}}> 3765 <label class="{{disabled}} checkbox-facet dw-mod" data-filter-value="{{label}}" for="{{queryParameter}}{{value}}"> 3766 <span class="checkbox-facet__label dw-mod">{{label}}</span> 3767 <span class="checkbox-facet__count dw-mod">{{#if showCount}}({{count}}){{/if}}</span> 3768 </label> 3769 </div> 3770 </script> 3771 } 37723773 @helper RenderRangeFacets() 3774 { 3775 var queryParameterFrom = string.Empty; 3776 var queryParameterTo = string.Empty; 37773778 if (!string.IsNullOrWhiteSpace(Dynamicweb.Context.Current.Request.QueryString["Bredd_From"]) && !string.IsNullOrWhiteSpace(Dynamicweb.Context.Current.Request.QueryString["Bredd_To"])) 3779 { 3780 queryParameterFrom = Dynamicweb.Context.Current.Request.QueryString["Bredd_From"]; 3781 queryParameterTo = Dynamicweb.Context.Current.Request.QueryString["Bredd_To"]; 37823783 } 37843785 <script id="Range" type="text/x-template"> 3786 <div class="form__field-group u-no-margin dw-mod" > 3787 <div class="rangeInputContainer"> 3788 <span id="from_container"> 3789 <span>@Translate("Från") </span> 3790379137923793 <select id="{{queryParameter}}_From" name="{{queryParameter}}_From"> 3794 {{#datalist}} 3795 <option value="{{option}}" {{fromSelected}} >{{option}}</option> 3796 {{/datalist}} 37973798 </select> 3799 </span> 3800 <span id="to_conatiner"> 3801 <span>@Translate("Till") </span> 3802 <select id="{{queryParameter}}_To" name="{{queryParameter}}_To"> 3803 {{#datalist}} 3804 <option value="{{option}}" {{toSelected}} >{{option}}</option> 3805 {{/datalist}} 3806 </select> 3807 </span> 38083809 </div> 3810 <div class="button_control"> 3811 <input type="button" name="{{queryParameter}}" class="js-rangeFilterApply" value="@Translate("Filtrera")" onclick="Facets.UpdateFacets(this);" /> 38123813 @if (!string.IsNullOrWhiteSpace(queryParameterFrom)) 3814 { 38153816 } 38173818 {{#if queryParameterFrom }} 3819 <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"> 3820 @Translate("Visa alla bredd")&nbsp;<i class="fal fa-times"></i> 3821 </button> 3822 {{/if}} 382338243825 </div> 3826 </div> 3827 </script> 3828 } 38293830 @helper RenderTagsFacets() 3831 { 3832 <script id="Tags" type="text/x-template"> 3833 <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}}> 3834 {{label}} <span class="facets-group__counter dw-mod">({{count}})</span> 3835 </button> 3836 </script> 3837 } 38383839 @helper RenderColorFacets() 3840 { 3841 <script id="Colors" type="text/x-template"> 3842 <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> 3843 </script> 3844 } 38453846 @helper RenderSelectedFilter() 3847 { 3848 <script id="SelectedFilter" type="text/x-template"> 3849 <button type="button" class="btn btn--tag dw-mod" data-check="checked" onclick="Facets.UpdateFacets(this);" name="{{queryParameter}}" value="[{{value}}]" title="@Translate("Remove filter")"> 3850 {{group}}: {{label}} &nbsp;<i class="fal fa-times"></i> 3851 </button> 3852 </script> 3853 } 38543855 @helper RenderSelectedRangeFilter() 3856 { 3857 <script id="SelectedRangeFilter" type="text/x-template"> 3858 <button type="button" class="btn btn--tag dw-mod" data-check="checked" onclick="Facets.UpdateFacets(this);" name="{{name}}" value="[{{value}}]" title="@Translate("Remove filter")"> 3859 {{group}}: {{queryParameterFrom}} - {{queryParameterTo}} &nbsp;<i class="fal fa-times"></i> 3860 </button> 3861 </script> 3862 } 38633864 @helper RenderSelectedColorFilter() 3865 { 3866 <script id="SelectedColorFilter" type="text/x-template"> 3867 <button type="button" class="btn btn--tag dw-mod" data-check="checked" onclick="Facets.UpdateFacets(this);" name="{{queryParameter}}" value="[{{value}}]" title="@Translate("Remove filter")"> 3868 {{group}}: <div class="btn__colorbox dw-mod" style="background-color: {{value}}"></div> <i class="fas fa-times"></i> 3869 </button> 3870 </script> 3871 } 38723873 @helper RenderResetFilters() 3874 { 3875 <script id="ResetFilters" type="text/x-template"> 3876 <button type="button" class="btn btn--tag" onclick="Facets.ResetFacets();"> 3877 @Translate("Reset all filters") &nbsp;<i class="fal fa-redo"></i> 3878 </button> 3879 </script> 3880 } 388138823883 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 3884 @using Dynamicweb.Core 3885 @using System 3886 @using System.Web 3887 @using System.Collections.Generic 3888 @using Dynamicweb.Rapido.Blocks 38893890 @{ 3891 BlocksPage productListMoreBlocksPage = BlocksPage.GetBlockPage("ProductList"); 38923893 Block moreBlock = new Block 3894 { 3895 Id = "More", 3896 SortId = 40, 3897 Template = RenderListMore() 3898 }; 38993900 productListMoreBlocksPage.Add("ProductList", moreBlock); 3901 } 39023903 @helper RenderListMore() 3904 { 3905 @*This is part of a script template *@ 3906 string groupID = HttpContext.Current.Request.QueryString.Get("groupid"); 3907 string listId = HttpContext.Current.Request.QueryString.Get("ListID"); 3908 bool isFavoriteList = !string.IsNullOrEmpty(listId); 3909 string moreFeedFullUrl = GetGlobalValue("Global:Pageview.Url.Raw") + "&feed=true"; 3910 moreFeedFullUrl += !isFavoriteList ? "&DoNotShowVariantsAsSingleProducts=True" : ""; 3911 string columnCss = Pageview.Device.ToString() == "Mobile" ? "grid__col--bleed" : "u-no-padding"; 3912 <text> 3913 {{#if ProductsContainer}} 3914 <div class="grid"> 3915 <div class="grid__col-12 @columnCss"> 3916 <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> 3917 <button type="button" class="btn btn--clean" onclick="window.scroll(0, 0)">@Translate("Return to top")</button> 3918 </div> 3919 </div> 3920 {{/if}} 3921 </text> 3922 } 3923 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 3924 @using Dynamicweb.Core 3925 @using System 3926 @using System.Web 3927 @using System.Collections.Generic 3928 @using Dynamicweb.Rapido.Blocks 3929 @using Dynamicweb.Rapido.Blocks.Components 3930 @using Dynamicweb.Rapido.Blocks.Components.General 39313932 @{ 3933 BlocksPage productListBottomSnippetsPage = BlocksPage.GetBlockPage("ProductList"); 39343935 Block productListStickers = new Block 3936 { 3937 Id = "Stickers", 3938 SortId = 10, 3939 Template = RenderStickersTemplates() 3940 }; 3941 productListBottomSnippetsPage.Add("BottomSnippets", productListStickers); 39423943 Block productListUnits = new Block 3944 { 3945 Id = "Units", 3946 SortId = 20, 3947 Template = RenderUnitTemplates() 3948 }; 3949 productListBottomSnippetsPage.Add("BottomSnippets", productListUnits); 39503951 Block productListVariants = new Block 3952 { 3953 Id = "Variants", 3954 SortId = 30, 3955 Template = RenderVariantTemplates() 3956 }; 3957 productListBottomSnippetsPage.Add("BottomSnippets", productListVariants); 39583959 Block productListFavorites = new Block 3960 { 3961 Id = "Favorites", 3962 SortId = 40, 3963 Template = RenderFavoritesTemplates() 3964 }; 3965 productListBottomSnippetsPage.Add("BottomSnippets", productListFavorites); 39663967 Block productListPreRender = new Block 3968 { 3969 Id = "PreRenders", 3970 SortId = 50, 3971 Template = RenderPreRenderTemplates() 3972 }; 3973 productListBottomSnippetsPage.Add("BottomSnippets", productListPreRender); 39743975 Block productListInitializers = new Block 3976 { 3977 Id = "Initializers", 3978 SortId = 60, 3979 Template = RenderInitializers() 3980 }; 3981 productListBottomSnippetsPage.Add("BottomSnippets", productListInitializers); 3982 } 398339843985 @helper RenderFavoritesTemplates() 3986 { 3987 var selectedFavoriteIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue : "star"; 3988 string favoriteIcon = "fas fa-" + selectedFavoriteIcon; 3989 string favoriteOutlineIcon = "fal fa-" + selectedFavoriteIcon; 3990 bool useFacebookPixel = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID")); 3991 string currentFavoriteListId = HttpContext.Current.Request.QueryString.Get("ListID"); 39923993 <script id="FavoriteTemplate" type="text/x-template"> 3994 <div class="favorites-list u-ta-left js-favorites-list"> 3995 @Render(new Button { 3996 CssClass = "u-no-margin js-favorite-btn", 3997 Icon = new Icon 3998 { 3999 Name = "{{#if isInAnyFavoriteList}}" + favoriteIcon + "{{else}}" + favoriteOutlineIcon + "{{/if}}", 4000 CssClass = "fa-1_5x", 4001 LabelPosition = IconLabelPosition.After 4002 }, 4003 ButtonLayout = ButtonLayout.LinkClean, 4004 ButtonType = ButtonType.Button, 4005 OnClick = "document.getElementById('FavoriteTrigger_{{id}}').checked = true" 4006 }) 4007 <input type="checkbox" id="FavoriteTrigger_{{id}}" class="dropdown-trigger" /> 4008 <div class="dropdown dropdown--position-32px"> 4009 <div class="dropdown__content dropdown__content--show-left dropdown__content--padding u-w220px dw-mod"> 4010 <ul class="list list--clean dw-mod"> 4011 {{#FavoriteLists}} 4012 {{>FavoriteListItem}} 4013 {{/FavoriteLists}} 4014 </ul> 4015 </div> 4016 <label class="dropdown-trigger-off" for="FavoriteTrigger_{{id}}"></label> 4017 </div> 4018 </div> 4019 </script> 40204021 <script id="FavoriteListItem" type="text/x-template"> 4022 <li> 4023 @{ 4024 var button = new Button { 4025 CssClass = "list__link u-no-underline", 4026 OnClick = "toggleFavAction(this, event)", 4027 Icon = new Icon { Name = "{{#if isInFavoriteList}}" + favoriteIcon + "{{else}}" + favoriteOutlineIcon + "{{/if}}", LabelPosition = IconLabelPosition.After }, 4028 AltText = "{{#if isInFavoriteList}}" + Translate("Remove from") + " {{name}}{{else}}" + Translate("Add to") + " {{name}}{{/if}}", 4029 Title = "{{name}}", 4030 ButtonType = ButtonType.Button, 4031 ButtonLayout = ButtonLayout.LinkClean, 4032 ExtraAttributes = new Dictionary<string, string> 4033 { 4034 { "data-list-id", "{{listId}}" }, 4035 { "data-list-name", "{{name}}" }, 4036 { "data-remove-link", "{{removeLink}}" }, 4037 { "data-add-link", "{{addLink}}" }, 4038 { "data-is-in-list", "{{isInFavoriteList}}" }, 40394040 } 4041 }; 4042 if (useFacebookPixel) 4043 { 4044 button.ExtraAttributes.Add("data-facebook-object", "{{facebookPixelAddAction}}"); 4045 } 4046 } 4047 @Render(button) 4048 </li> 4049 </script> 40504051 <script> 4052 @if (!string.IsNullOrEmpty(currentFavoriteListId)) 4053 { 4054 <text> 4055 window.currentFavoriteListId = "@currentFavoriteListId"; 4056 </text> 4057 } 4058 function toggleFavAction(button, event) { 4059 if (button.getAttribute('data-add-link').indexOf('CCCreateNewList') > -1) { 4060 Scroll.SavePosition(event); 4061 @if (useFacebookPixel) 4062 { 4063 <text> 4064 fbq('track', 'AddToWishlist', JSON.parse(button.getAttribute('data-facebook-object'))); 4065 </text> 4066 } 4067 location.href = button.getAttribute('data-add-link'); 4068 return; 4069 } 4070 let isAdd = button.getAttribute('data-is-in-list') == "false"; 4071 Request.Fetch().get( 4072 isAdd ? button.getAttribute('data-add-link') : button.getAttribute('data-remove-link'), 4073 function (result) { 4074 button.querySelector('i').className = isAdd ? '@favoriteIcon u-margin-right--lg' : '@favoriteOutlineIcon u-margin-right--lg'; 4075 button.setAttribute('data-is-in-list', isAdd); 4076 button.setAttribute('title', (!isAdd ? '@Translate("Add to") ' : '@Translate("Remove from") ') + button.getAttribute('data-list-name')) 4077 let favList = button.closest('.js-favorites-list'); 4078 let favBtn = favList.querySelector('.js-favorite-btn i'); 4079 let isInAnyFavoriteList = favList.querySelector('[data-is-in-list=true]') != null; 4080 if (isInAnyFavoriteList) { 4081 favBtn.className = '@favoriteIcon' + ' fa-1_5x'; 4082 } else { 4083 favBtn.className = '@favoriteOutlineIcon' + ' fa-1_5x'; 4084 } 4085 @if (useFacebookPixel) 4086 { 4087 <text> 4088 if (isAdd) { 4089 fbq('track', 'AddToWishlist', JSON.parse(button.getAttribute('data-facebook-object'))); 4090 } 4091 </text> 4092 } 4093 if (window.currentFavoriteListId != null) { //if this page is favorite list 4094 let listId = button.getAttribute("data-list-id"); 4095 if (listId == window.currentFavoriteListId && !isAdd) { 4096 location.reload(); 4097 } 4098 } 4099 }, 4100 function () { 4101 console.error("FavoriteLists: Error in ToggleFavAction request"); 4102 }, 4103 false 4104 ); 4105 } 4106 </script> 4107 } 41084109 @helper RenderStickersTemplates() 4110 { 4111 <script id="StickersContainer" type="text/x-template"> 4112 <div class="stickers-container stickers-container--{{{convertStickerPositionToClassName Position}}} dw-mod"> 4113 {{#Stickers}} 4114 {{>Sticker}} 4115 {{/Stickers}} 4116 </div> 4117 </script> 41184119 <script id="Sticker" type="text/x-template"> 4120 <div class="stickers-container__tag {{CssClass}} dw-mod">{{Title}}</div> 4121 </script> 41224123 <script id="MiniSticker" type="text/x-template"> 4124 <div class="stickers-container__tag stickers-container__tag--micro {{CssClass}} dw-mod">{{Title}}</div> 4125 </script> 4126 } 41274128 @helper RenderUnitTemplates() 4129 { 4130 <script id="UnitOption" type="text/x-template"> 4131 <div class="dropdown__item dw-mod" onclick="HandlebarsBolt.UpdateContent(this.closest('.js-product').id, '{{link}}&feed=true&UnitID={{value}}')">{{name}}</div> 4132 </script> 4133 } 41344135 @helper RenderVariantTemplates() { 4136 <script id="VariantsTemplate" type="text/x-template"> 4137 {{#.}} 4138 <div> 4139 <div> 4140 {{#VariantOptions}} 4141 {{>VariantOption}} 4142 {{/VariantOptions}} 4143 </div> 4144 </div> 4145 {{/.}} 4146 </script> 41474148 <script id="VariantOption" type="text/x-template"> 4149 {{#if color}} 4150 <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> 4151 {{else}} 4152 {{#if image}} 4153 <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}}" /> 4154 {{else}} 4155 <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> 4156 {{/if}} 4157 {{/if}} 4158 </script> 41594160 <script id="DropdownVariantsTemplate" type="text/x-template"> 4161 {{#.}} 4162 <div> 4163 <div class="u-bold">{{name}}</div> 4164 <select id="VariantSelector_{{id}}" class="u-full-width dw-mod" name="VariantSelector_{{id}}" onchange="MatchVariants.SelectOnChange(event)" > 4165 <option>@Translate("Choose")</option> 4166 {{#VariantOptions}} 4167 {{>DropdownVariantOption}} 4168 {{/VariantOptions}} 4169 </select> 4170 </div> 4171 {{/.}} 4172 </script> 41734174 <script id="DropdownVariantOption" type="text/x-template"> 4175 <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> 4176 </script> 41774178 <script id="StaticVariantsTemplate" type="text/x-template"> 4179 {{#.}} 4180 {{#if isFirstGroup}} 4181 <div> 4182 {{#VariantOptions}} 4183 {{>StaticVariantOption}} 4184 {{/VariantOptions}} 4185 </div> 4186 {{/if}} 4187 {{/.}} 4188 </script> 41894190 <script id="StaticVariantOption" type="text/x-template"> 4191 {{#if color}} 4192 <div class="static-variant static-variant--color dw-mod" style="background-color: {{color}}" title="{{name}}"></div> 4193 {{else}} 4194 <div class="static-variant dw-mod">{{name}} </div> 4195 {{/if}} 4196 </script> 419741984199 <script id="StaticVariantsLgTemplate" type="text/x-template"> 4200 {{#.}} 4201 {{#if isFirstGroup}} 4202 <div class="padding-size-xs"> 4203 {{#VariantOptions}} 4204 {{>StaticVariantLgOption}} 4205 {{/VariantOptions}} 4206 </div> 4207 {{/if}} 4208 {{/.}} 4209 </script> 42104211 <script id="StaticVariantLgOption" type="text/x-template"> 4212 {{#if color}} 4213 <div class="static-variant static-variant--color static-variant--color--lg dw-mod" style="background-color: {{color}}" title="{{name}}"></div> 4214 {{else}} 4215 <div class="static-variant dw-mod">{{name}} </div> 4216 {{/if}} 4217 </script> 42184219 <script id="VariantOptionImage" type="text/x-template"> 4220 <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}} /> 4221 </script> 4222 } 42234224 @helper RenderPreRenderTemplates() { 4225 string facetsViewMode = !String.IsNullOrEmpty(Pageview.AreaSettings.GetItem("ProductList").GetString("FacetsViewMode")) ? Pageview.AreaSettings.GetItem("ProductList").GetString("FacetsViewMode").ToLower() : "left"; 42264227 <script id="ProductPreRenderContainer" type="text/x-template"> 4228 @if (facetsViewMode == "left" && Pageview.Device.ToString() != "Mobile") 4229 { 4230 <div class="grid__col-3"> 4231 <div class="pre-render-element pre-render-element--xs"></div> 4232 <div class="pre-render-element pre-render-element--md"></div> 4233 <div class="pre-render-element pre-render-element--md"></div> 4234 <div class="pre-render-element pre-render-element--md"></div> 4235 </div> 4236 } 4237 <div class="grid__col-auto"> 4238 <div class="pre-render-element pre-render-element--xs"></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 class="pre-render-element pre-render-element--lg"></div> 4242 <div class="pre-render-element pre-render-element--lg"></div> 4243 </div> 4244 </script> 4245 } 42464247 @helper RenderInitializers() { 4248 <script> 4249 document.addEventListener("DOMContentLoaded", function (event) { 4250 document.getElementById("productList").addEventListener('contentLoaded', function (e) { 4251 if (getTarget(e).id === "productList") { 4252 Search.Init(); 4253 Facets.Init("selectedFacets", "productList"); 4254 } 4255 }, false); 42564257 @{ 4258 bool useGoogleTagManager = false; 42594260 if (useGoogleTagManager) 4261 { 4262 <text> 4263 Scroll.AddIsInViewportListener(".js-product-scroll-trigger", function (elem) { 4264 let googleImpression = JSON.parse(elem.getAttribute("data-params")); 4265 googleEnchantImpression(googleImpression); 4266 elem.classList.remove("js-product-scroll-trigger"); 4267 }); 4268 </text> 4269 } 4270 } 42714272 }); 4273 </script> 4274 } 427542764277 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 4278 @using Dynamicweb.Core 4279 @using System 4280 @using System.Web 4281 @using System.Collections.Generic 4282 @using Dynamicweb.Rapido.Blocks 42834284 @{ 4285 BlocksPage customBlocksPage = BlocksPage.GetBlockPage("ProductList"); 42864287 } 428842894290 @if (productListNavigation.BlocksList.Count == 0) 4291 { 4292 productListNavigation.Design.RenderType = RenderType.Hide; 4293 } 42944295 <form name="multiForm" id="multiForm" method="post" onkeypress="return event.keyCode != 13;"> 4296 @* onkeypress is the fix for disabling submit form on Enter key from any field in product list *@ 4297 <input type="hidden" name="CartCmd" id="CartCmd" value="addMulti" /> 4298 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 4299 @RenderBlockList(productListPage.BlocksRoot.BlocksList) 4300 </form> 43014302 @helper RenderPageContainer() 4303 { 4304 List<Block> subBlocks = this.productListPage.GetBlockListById("PageContainer").OrderBy(item => item.SortId).ToList(); 4305 var groupid = HttpContext.Current.Request.QueryString["groupid"]; 4306 string pageUrl = GetGlobalValue("Global:Pageview.Url.Raw"); 4307 string feedFullUrl = pageUrl + "&feed=true"; 4308 feedFullUrl += !isFavoriteList ? "&DoNotShowVariantsAsSingleProducts=True" : ""; 4309 string smallDeviceCss = Pageview.Device.ToString() == "Mobile" ? "" : "u-padding"; 4310 string pageId = Convert.ToString(Dynamicweb.Frontend.PageView.Current().Page.ID); 4311 string groupUrl = $"/default.aspx?id={pageId}&GroupId="; 4312 var renderGroups = true; 4313 var renderProducts = true; 4314 var groupPlacement = Convert.ToString(GetBoolean("Ecom:Group:Field.LowDescriptionPlacement")); 4315 var group = Services.ProductGroups.GetGroup(groupid); 43164317 if (!string.IsNullOrWhiteSpace(groupid)) 4318 { 4319 if (Services.ProductGroups.HasSubgroups(group)) 4320 { 4321 renderProducts = false; 4322 } 4323 else 4324 { 4325 renderGroups = false; 4326 } 43274328 } 432943304331433243334334 if (groupid == "GROUP318" || groupid == "GROUP758" || groupid == "1011atSHOP17" || groupid == "1011atSHOP16" || groupid == "1011atSHOP15") 4335 { 4336 renderGroups = false; 4337 } 4338433943404341 if (renderGroups) 4342 { 4343 <section class="multiple-paragraphs-container multiple-paragraphs-container--spacing-sm dw-mod groupheader-fix"> 4344 <div class="paragraph-container__grid--bleed-x "> 4345 <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> 4346 </div> 4347 </section> 4348 } 43494350 if (renderProducts) 4351 { 4352 <div data-group-placement="@groupPlacement" 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> 4353 } 4354 else 4355 { 4356 <div id="productList"></div> 4357 } 43584359436043614362 <script id="GroupContainer" type="text/x-template"> 4363 {{#.}} 43644365 {{#if groupLargeImage}} 4366 <div class="grid"> 4367 <div class="grid__col-12 grid__col--bleed-x"> 4368 <div class="grid__cell group-image"> 4369 <img src="{{groupLargeImage}}" alt="{{groupName}}" /> 4370 </div> 4371 </div> 4372 </div> 4373 {{/if}} 43744375 <div class="grid"> 4376 <div class="grid__col-12"> 4377 <div class="grid__cell"> 4378 <div class="u-pull--left"> 4379 <h1><i class="{{headerIcon}}"></i>{{groupName}}</h1> 4380 {{#if groupDescription}} 4381 <div class="u-margin-bottom-lg groupDescription">{{{groupDescription}}}</div> 4382 {{/if}} 4383 </div> 4384 </div> 4385 </div> 4386 </div> 43874388 <div class="grid"> 4389 <div class="grid__col-12 grid__col--bleed-x"> 4390 <div class="grid__cell"> 4391 <div id="GroupsContainer" class="grid product-list dw-mod" data-template="GroupGridItemContainer" data-preloader="minimal"> 4392 {{#GroupsContainer}} 4393 {{>GroupGridItemContainer}} 4394 {{/GroupsContainer}} 4395 </div> 4396 </div> 4397 </div> 4398 </div> 43994400 {{#if gropLowDescription}} 44014402 <div class="grid"> 4403 <div class="grid__col-12"> 4404 <div class="grid__cell"> 4405 <div class="u-pull--left"> 4406 <div class="u-margin-bottom-lg gropLowDescription">{{{gropLowDescription}}}</div> 4407 </div> 4408 </div> 4409 </div> 4410 </div> 4411 {{/if}} 441244134414 {{/.}} 4415 </script> 44164417 <script id="GroupGridItemContainer" type="text/x-template"> 4418 {{#.}} 4419 <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"> 4420 {{#Group}} 4421 {{>GroupGridItem}} 4422 {{/Group}} 4423 </div> 4424 {{/.}} 4425 </script> 44264427 <script id="GroupGridItem" type="text/x-template"> 4428 {{#.}} 4429 <div class="grid__cell u-border dw-mod {{noImage}}"> 4430 <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> 4431 </div> 44324433 <div class="grid__cell dw-mod u-margin-top"> 4434 <a href="@groupUrl{{link}}" onclick="Scroll.SavePosition(event)" title="{{name}}"><h6 class="u-condensed-text grid__cell-sm-img--centered">{{name}}</h6></a> 4435 </div> 4436 {{/.}} 4437 </script> 443844394440 <script id="ProductContainer" type="text/x-template"> 4441 {{#each .}} 4442 @RenderBlockList(subBlocks) 44434444 {{#if gropLowDescription}} 44454446 <div class="grid"> 4447 <div class="grid__col-12"> 4448 <div class="grid__cell"> 4449 <div class="u-pull--left"> 4450 <div class="u-margin-bottom-lg gropLowDescription">{{{gropLowDescription}}}</div> 4451 </div> 4452 </div> 4453 </div> 4454 </div> 4455 {{/if}} 44564457 {{else}} 44584459 @{ 4460 var searchText = HttpContext.Current.Request.QueryString.Get("Search") != null ? HttpContext.Current.Request.QueryString.Get("Search") : ""; 44614462 if (!string.IsNullOrWhiteSpace(searchText)) 4463 { 4464 <div class="grid__col-12"> 4465 <h2 class="u-ta-center">@Translate("Your search gave 0 results")</h2> 4466 </div> 4467 } 44684469 } 44704471 {{/each}} 4472 </script> 4473 } 44744475 @helper RenderProductList() 4476 { 4477 @*This is part of a script template *@ 44784479 List<Block> subBlocks = productListPage.GetBlockListById("ProductList").OrderBy(item => item.SortId).ToList(); 4480 string smallDeviceCss = Pageview.Device.ToString() == "Mobile" ? "u-no-padding" : ""; 4481 string columnClass = "auto"; 44824483 if (productListPage.GetBlockListById("Navigation").Count == 0) 4484 { 4485 columnClass = "12"; 4486 } 448744884489 <div class="grid__col-@columnClass @smallDeviceCss"> 4490 @RenderBlockList(subBlocks) 4491 </div> 4492 } 44934494 @helper RenderProductListHeader() 4495 { 4496 List<Block> subBlocks = this.productListPage.GetBlockListById("ProductListHeader"); 4497 bool enableSeparationLine = productListSettings.GetBoolean("EnableSeparationLine"); 4498 string className = (enableSeparationLine != null && enableSeparationLine ? "u-border-bottom u-padding-bottom" : ""); 44994500 <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"> 4501 <div class="grid @className"> 4502 <div class="u-pull--left"> 4503 <h1><i class="{{headerIcon}}"></i>{{groupName}}</h1> 4504 {{#if groupDescription}} 4505 <div class="u-margin-bottom-lg">{{{groupDescription}}}</div> 4506 {{/if}} 45074508 </div> 45094510 @RenderBlockList(subBlocks) 4511 </div> 45124513 </div> 4514 } 45154516 @helper RenderProductListTitle() 4517 { 4518 var header = new Heading { Title = "{{{header}}}", CssClass = "u-no-margin" }; 4519 var searchText = HttpContext.Current.Request.QueryString.Get("Search") != null ? HttpContext.Current.Request.QueryString.Get("Search") : ""; 45204521 if (isFavoriteList) 4522 { 4523 var selectedFavoriteIcon = "star"; 4524 header.Icon = new Icon { Prefix = "fas", Name = "fa-" + selectedFavoriteIcon, LabelPosition = IconLabelPosition.After }; 4525 @Render(header) 4526 } 452745284529 if (!string.IsNullOrWhiteSpace(searchText)) 4530 { 4531 @Render(header) 4532 } 453345344535 } 45364537 @helper RenderFavoriteListSearch() 4538 { 4539 string pageId = GetGlobalValue("Global:Page.ID"); 4540 string pageUrl = GetGlobalValue("Global:Pageview.Url.Raw"); 4541 string feedFullUrl = pageUrl + "&feed=true"; 4542 string searchPlaceholder = Translate("Search favorite products"); 4543 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; 45444545 <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"> 4546 <input type="text" class="typeahead-search-field u-no-margin u-full-width js-typeahead-search-field" placeholder="@searchPlaceholder" value="@searchValue"> 4547 <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> 4548 <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> 4549 </div> 4550 }