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_ddeb8cf3186449d7a78df7cc7efcf0bc.<RenderPageContainer>b__97_0(TextWriter __razor_helper_writer) in E:\wwwroot\nevotex\Files\Templates\Designs\Rapido\eCom\Productlist\ProductsRender.cshtml:line 4320
at RazorEngine.Templating.TemplateWriter.ToString()
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at CompiledRazorTemplates.Dynamic.RazorEngine_ddeb8cf3186449d7a78df7cc7efcf0bc.<>c__DisplayClass5_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in E:\wwwroot\nevotex\Files\Templates\Designs\Rapido\eCom\Productlist\ProductsRender.cshtml:line 228
at CompiledRazorTemplates.Dynamic.RazorEngine_ddeb8cf3186449d7a78df7cc7efcf0bc.<>c__DisplayClass4_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in E:\wwwroot\nevotex\Files\Templates\Designs\Rapido\eCom\Productlist\ProductsRender.cshtml:line 138
at CompiledRazorTemplates.Dynamic.RazorEngine_ddeb8cf3186449d7a78df7cc7efcf0bc.Execute() in E:\wwwroot\nevotex\Files\Templates\Designs\Rapido\eCom\Productlist\ProductsRender.cshtml:line 4300
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}} {{collectionItem}} "> 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-bold">{{{name}}}{{#if variantName}}, {{variantName}}{{/if}}</h6> 3114 </a> 3115 <p class="u-margin-top">{{selectVariantText}}</p> 3116 } 31173118 @helper RenderGridViewItemNumber() 3119 { 3120 <div class="item-number dw-mod {{displayCss}} {{hideArticleNumberCss}} ">@Translate("ArtNr", "Art. nr"): {{number}} </div> 31213122 if (Dynamicweb.Frontend.PageView.Current().Device != Dynamicweb.Frontend.Devices.DeviceType.Mobile) 3123 { 3124 // login to see price 3125 bool userLoggedIn = Dynamicweb.Security.UserManagement.User.IsExtranetUserLoggedIn(); 31263127 if (!userLoggedIn && (Pageview.AreaID == 21 || Pageview.AreaID == 24 || Pageview.AreaID == 25)) 3128 { 3129 <div class="u-ta-left dw-mod {{displayCss}}"> 3130 <label for="SignInModalTrigger" class="item-number sign-in-modal-trigger-button" onclick="setTimeout(function () { document.getElementById('LoginUsername').focus() }, 10)"> 3131 @Translate("Logga_in_for_pris_och_kop") 3132 </label> 3133 </div> 3134 } 3135 } 3136 } 31373138313931403141 @helper RenderGridViewItemPrice() 3142 { 3143 int columnsCount = 4; 3144 bool pointShopOnly = false; 3145 bool showCartButton = false; 3146 bool showVATPrice = false; 3147 bool isPricesWithVATEnabled = Dynamicweb.Ecommerce.Common.Context.DisplayPricesWithVat; 31483149 if (pointShopOnly) 3150 { 3151 <text> 3152 {{#if havePointPrice}} 3153 <div class="price price--product-list dw-mod">{{points}} @Translate("points")</div> 3154 @if (showCartButton) 3155 { 3156 <text> 3157 {{#unless canBePurchasedWithPoints}} 3158 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small> 3159 {{/unless}} 3160 </text> 3161 } 3162 {{else}} 3163 @Translate("Not available") 3164 {{/if}} 3165 </text> 31663167 } 3168 else 3169 { 3170 <div class="price price--product-list dw-mod">{{price}}</div> 3171 <div class="before-price {{onSale}} dw-mod">{{discount}}</div> 3172 if (showVATPrice) 3173 { 3174 <div class="vat-price vat-price--product-list u-margin-top dw-mod"> 3175 @if (columnsCount <= 4) 3176 { 3177 if (isPricesWithVATEnabled) 3178 { 3179 <span>@Translate("excl. VAT")</span><span> ({{priceWithoutVAT}})</span> 3180 } 3181 else 3182 { 3183 <span>@Translate("incl. VAT")</span><span> ({{priceWithVAT}})</span> 3184 } 3185 } 3186 else 3187 { 3188 if (isPricesWithVATEnabled) 3189 { 3190 <div>@Translate("excl. VAT")</div><div>({{priceWithoutVAT}})</div> 3191 } 3192 else 3193 { 3194 <div>@Translate("incl. VAT")</div><div>({{priceWithVAT}})</div> 3195 } 3196 } 3197 </div> 3198 } 3199 <text> 3200 {{#if priceRRP}} 3201 <div><small>@Translate("RRP") {{priceRRP}}</small></div> 3202 {{/if}} 3203 </text> 3204 } 3205 } 32063207 @helper RenderGridViewItemFooter() 3208 { 3209 List<Block> subBlocks = gridViewPage.GetBlockListById("GridViewItemFooter"); 3210 bool showStaticVariants = false; 32113212 <div class="product-list__grid-item__footer dw-mod {{displayCss}}"> 3213 @RenderBlockList(subBlocks) 3214 </div> 3215 } 32163217 @helper RenderGridViewItemViewButton() 3218 { 3219 string viewMoreText = "View"; 32203221 @Render(new Link 3222 { 3223 Href = "{{link}}", 3224 Id = "CartButton_{{id}}", 3225 Title = Translate(viewMoreText), 3226 OnClick = "{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}", 3227 ButtonLayout = ButtonLayout.Secondary, 3228 CssClass = "u-no-margin" 3229 }); 3230 } 32313232 @helper RenderGridViewItemAddToCart() 3233 { 3234 bool pointShopOnly = false; 3235 string wrapperClass = "buttons-collection--center"; 3236 int columnsCount = 4; 3237 bool hideButtonText = columnsCount >= 4 || Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet"; 32383239 if (pointShopOnly && columnsCount <= 4) 3240 { 3241 hideButtonText = false; 3242 } 32433244 var addToCartBtn = new CustomAddToCart 3245 { 3246 WrapperCssClass = wrapperClass, 3247 AddButton = new CustomAddToCartBtn 3248 { 3249 HideTitle = hideButtonText, 3250 ProductId = "{{productId}}", 3251 VariantId = "{{variantid}}", 3252 UnitId = "{{unitId}}", 3253 ProductInfo = "{{productInfo}}", 3254 BuyForPoints = pointShopOnly, 3255 OnClick = "{{facebookPixelAction}}", 3256 ExtraAttributes = new Dictionary<string, string> 3257 { 3258 { "{{disabledBuyButton}}", "" } 3259 } 3260 } 3261 }; 32623263 if (!pointShopOnly) 3264 { 3265 addToCartBtn.QuantitySelector = new QuantitySelector 3266 { 3267 Id = "Quantity{{id}}" 3268 }; 3269 } 32703271 @Render(addToCartBtn) 3272 } 32733274 @helper RenderGridViewItemActions() 3275 { 3276 bool showCartButton = false; 3277 bool showViewButton = true; 32783279 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed()) 3280 { 3281 if (showCartButton) 3282 { 3283 if (!showViewButton) 3284 { 3285 <text>{{#if hideAddToCartButton}}</text> 3286 <div>@RenderGridViewItemViewButton()</div> 3287 <text>{{else}}</text> 3288 @RenderGridViewItemAddToCart() 3289 <text>{{/if}}</text> 3290 } 3291 else 3292 { 3293 @RenderGridViewItemAddToCart() 3294 } 3295 } 3296 else if (showViewButton) 3297 { 3298 <div>@RenderGridViewItemViewButton()</div> 3299 } 3300 } 3301 else if (showViewButton) 3302 { 3303 <div>@RenderGridViewItemViewButton()</div> 3304 } 3305 } 33063307 @helper RenderGridViewItemStockAndDelivery() 3308 { 3309 <text>{{#if stockText}}</text> 3310 <div class="u-margin-top"> 3311 <div><span class="stock-icon {{stockState}} u-no-margin dw-mod" title="{{stockText}}"></span> {{stockText}}</div> 3312 <div> 3313 {{#if deliveryText}} 3314 {{deliveryText}} 3315 {{else}} 3316 - 3317 {{/if}} 3318 </div> 3319 </div> 3320 <text>{{/if}}</text> 3321 } 33223323 @helper RenderGridViewItemStaticVariants() 3324 { 3325 string variantsSize = "sm"; 33263327 <text> 3328 {{#Variants}} 3329 @if (variantsSize == "lg") 3330 { 3331 <text> 3332 {{>StaticVariantsLgTemplate}} 3333 </text> 3334 } 3335 else 3336 { 3337 <text> 3338 {{>StaticVariantsTemplate}} 3339 </text> 3340 } 3341 {{/Variants}} 33423343 {{#ifCond variantGroupsCount '>' 1}} 3344 <div class="static-variant"> 3345 @Translate("More options available") 3346 </div> 3347 {{/ifCond}} 33483349 {{#ifCond variantGroupsCount '==' 0}} 3350 <div class="static-variant"></div> 3351 {{/ifCond}} 3352 </text> 3353 } 33543355 @helper RenderGridViewItemDownloadButton() 3356 { 3357 <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}}"> 3358 @Render(new Icon { Prefix = "fas", Name = "fa-plus", CssClass = "js-button-icon" }) 3359 <span class="js-button-text">@Translate("Add")</span> 3360 </button> 3361 } 33623363 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 3364 @using Dynamicweb.Core 3365 @using System 3366 @using System.Web 3367 @using System.Collections.Generic 3368 @using Dynamicweb.Rapido.Blocks 33693370 @{ 3371 /* 3372 BlocksPage productListPromotionsBlocksPage = BlocksPage.GetBlockPage("ProductList"); 33733374 Block productListPromotions = new Block 3375 { 3376 Id = "Promotions", 3377 SortId = 10, 3378 Template = RenderProductListPromotions() 3379 }; 3380 productListPromotionsBlocksPage.Add("PageContainer", productListPromotions); 3381 */ 3382 } 33833384 @helper RenderProductListPromotions() 3385 { 3386 @*This is part of a script template *@ 33873388 //string listId = HttpContext.Current.Request.QueryString.Get("ListID"); 3389 //bool isFavoriteList = !string.IsNullOrEmpty(listId); 3390 string smallDeviceCss = ""; 33913392 if (false) 3393 { 3394 switch ("Disable") 3395 { 3396 case "OnlyText": 3397 <article class="grid__col-12 u-margin-bottom @smallDeviceCss"> 3398 <h1>{{groupName}}</h1> 3399 {{{groupDescription}}} 3400 {{#ifCond groupPromotionLink "!==" ""}} 3401 <div> 3402 <a href="{{groupPromotionLink}}" class="btn btn--primary">{{groupPromotionLinkText}}</a> 3403 </div> 3404 {{/ifCond}} 3405 </article> 3406 break; 3407 case "TextAndImage": 3408 <article class="grid__col-12 u-margin-bottom @smallDeviceCss"> 3409 <div class="grid grid--bleed"> 3410 <div class="grid__col-md-6"> 3411 <h1>{{groupName}}</h1> 3412 {{{groupDescription}}} 3413 {{#ifCond groupPromotionLink "!==" ""}} 3414 <div> 3415 <a href="{{groupPromotionLink}}" class="btn btn--primary">{{groupPromotionLinkText}}</a> 3416 </div> 3417 {{/ifCond}} 3418 </div> 3419 {{#ifCond groupPromotionImage "!==" ""}} 3420 <div class="grid__col-md-6"> 3421 <img src="/Admin/Public/GetImage.ashx?width=600&crop=5&Compression=75&DoNotUpscale=true&image={{groupPromotionImage}}" alt="{{groupName}}" class="background-image__cover" /> 3422 </div> 3423 {{/ifCond}} 3424 </div> 3425 </article> 3426 break; 3427 case "Banner": 3428 <text> 3429 {{#ifCond groupPromotionImage "!==" ""}} 3430 <article class="grid__col-12 u-margin-bottom @smallDeviceCss"> 3431 <div class="u-color-light grid center-container center-container--with-background-image grid__col--bg" style="background-image:url('{{groupPromotionImage}}');"> 3432 <div class="grid__col-12 u-middle"> 3433 <div class="grid__cell"> 3434 {{{groupDescription}}} 3435 {{#ifCond groupPromotionLink "!==" ""}} 3436 <div> 3437 <a href="{{groupPromotionLink}}" class="btn btn--primary">{{groupPromotionLinkText}}</a> 3438 </div> 3439 {{/ifCond}} 3440 </div> 3441 </div> 3442 </div> 3443 </article> 3444 {{/ifCond}} 3445 </text> 3446 break; 3447 } 3448 } 3449 } 3450 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 3451 @using Dynamicweb.Core 3452 @using System 3453 @using System.Web 3454 @using System.Collections.Generic 3455 @using Dynamicweb.Rapido.Blocks 34563457 @{ 3458 BlocksPage productListMenuBlocksPage = BlocksPage.GetBlockPage("ProductList"); 34593460 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && 3461 Converter.ToString(Pageview.Page.PropertyItem["LeftMenu"]) == "True" && 3462 Pageview.Page.NavigationSettings != null && 3463 Pageview.Page.NavigationSettings.UseEcomGroups) { 34643465 Block productListMenuBlock = new Block 3466 { 3467 Id = "Menu", 3468 SortId = 20, 3469 Template = RenderProductListMenu() 3470 }; 34713472 productListMenuBlocksPage.Add("Navigation", productListMenuBlock); 3473 } 3474 } 34753476 @helper RenderProductListMenu() 3477 { 3478 var navigationMarkup = RenderNavigation(new 3479 { 3480 id = "leftnav", 3481 cssclass = "dwnavigation", 3482 startLevel = 1, 3483 endlevel = 5, 3484 template = "LeftNavigation.xslt", 3485 mode = "ecom" 3486 }); 34873488 <h2 class="u-margin-bottom">@Translate("Product categories")</h2> 34893490 <div class="u-padding-bottom--lg"> 3491 @navigationMarkup 3492 </div> 3493 } 3494 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 3495 @using Dynamicweb.Core 3496 @using System 3497 @using System.Web 3498 @using System.Collections.Generic 3499 @using Dynamicweb.Rapido.Blocks 3500 @using Dynamicweb.Rapido.Blocks.Components.General 35013502 @{ 3503 BlocksPage productListFacetsBlocksPage = BlocksPage.GetBlockPage("ProductList"); 3504 string facetsBlockViewMode = "left"; 35053506 if (facetsBlockViewMode == "left" && Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 3507 { 3508 Block facetsBlock = new Block 3509 { 3510 Id = "Facets", 3511 SortId = 30, 3512 Template = RenderProductListFacets() 3513 }; 3514 productListFacetsBlocksPage.Add("Navigation", facetsBlock); 3515 } 35163517 if (facetsBlockViewMode == "top" || Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet") 3518 { 3519 Block facetsBlock = new Block 3520 { 3521 Id = "Facets", 3522 SortId = 10, 3523 Template = RenderProductListTopFacets() 3524 }; 3525 productListFacetsBlocksPage.Add("ProductList", facetsBlock); 3526 } 35273528 Block facetSelections = new Block 3529 { 3530 Id = "FacetSelections", 3531 SortId = 20, 3532 Template = RenderFacetSelections() 3533 }; 3534 productListFacetsBlocksPage.Add("ProductList", facetSelections); 35353536 Block checkboxFacetTemplate = new Block 3537 { 3538 Id = "CheckboxFacet", 3539 SortId = 30, 3540 Template = RenderCheckboxFacets() 3541 }; 3542 productListFacetsBlocksPage.Add("BottomSnippets", checkboxFacetTemplate); 35433544 Block RangeFacetTemplate = new Block 3545 { 3546 Id = "RangeFacet", 3547 SortId = 90, 3548 Template = RenderRangeFacets() 3549 }; 3550 productListFacetsBlocksPage.Add("BottomSnippets", RangeFacetTemplate); 35513552 Block tagsFacetTemplate = new Block 3553 { 3554 Id = "TagsFacet", 3555 SortId = 40, 3556 Template = RenderTagsFacets() 3557 }; 3558 productListFacetsBlocksPage.Add("BottomSnippets", tagsFacetTemplate); 35593560 Block colorsFacetTemplate = new Block 3561 { 3562 Id = "ColorFacet", 3563 SortId = 50, 3564 Template = RenderColorFacets() 3565 }; 3566 productListFacetsBlocksPage.Add("BottomSnippets", colorsFacetTemplate); 35673568 Block selectedFilter = new Block 3569 { 3570 Id = "SelectedFilter", 3571 SortId = 60, 3572 Template = RenderSelectedFilter() 3573 }; 3574 productListFacetsBlocksPage.Add("BottomSnippets", selectedFilter); 35753576 Block selectedRangeFilter = new Block 3577 { 3578 Id = "SelectedRangeFilter", 3579 SortId = 60, 3580 Template = RenderSelectedRangeFilter() 3581 }; 3582 productListFacetsBlocksPage.Add("BottomSnippets", selectedRangeFilter); 358335843585 Block selectedColorFilter = new Block 3586 { 3587 Id = "SelectedColorFilter", 3588 SortId = 70, 3589 Template = RenderSelectedColorFilter() 3590 }; 3591 productListFacetsBlocksPage.Add("BottomSnippets", selectedColorFilter); 35923593 Block resetFilters = new Block 3594 { 3595 Id = "ResetFilters", 3596 SortId = 80, 3597 Template = RenderResetFilters() 3598 }; 3599 productListFacetsBlocksPage.Add("BottomSnippets", resetFilters); 3600 } 36013602 @helper RenderFacetSelections() 3603 { 3604 @*This is part of a script template *@ 3605 <text> 3606 {{#if FacetSelections}} 3607 <div class="buttons-collection u-margin-bottom" id="selectedFacets"> 3608 {{#FacetSelections}} 3609 {{>(lookup . 'template')}} 3610 {{/FacetSelections}} 3611 </div> 3612 {{/if}} 3613 </text> 3614 } 36153616 @helper RenderProductListFacets() 3617 { 3618 var facetSettings = Pageview.AreaSettings.GetItem("ProductList").GetItem("Facets"); 3619 string boxDisplay = facetSettings.GetList("BoxDisplay") != null ? facetSettings.GetList("BoxDisplay").SelectedValue : "scroll"; 36203621 string facetMoreClass = (boxDisplay == "view-more" ? "facets-container__list--more" : ""); 36223623 @*This is part of a script template *@ 36243625 <input type="checkbox" id="CheckFacetGroups" class="js-remember-state u-hidden" data-expand="CheckFacetGroups" /> 3626 <div class="facets-container facets-container--left expandable--collapsed dw-mod" data-trigger="CheckFacetGroups"> 3627 {{#FacetGroups}} 3628 <input type="checkbox" id="OptionsGroup_{{name}}" class="expand-trigger js-remember-state" {{defaultState}} /> 36293630 <div class="expand-container facets-container__box dw-mod js-filter"> 3631 <label class="expand-container__btn facets-container__header dw-mod" for="OptionsGroup_{{name}}">{{name}}</label> 3632 <div class="expand-container__content js-facet-container dw-mod" data-input="OptionsGroup_{{name}}"> 36333634 {{#ifCond template "===" "Checkboxes"}} 3635 <div class="facets-container__search {{showFilter}} dw-mod"> 3636 <input type="text" class="u-full-width u-no-margin" onkeyup="Filter.FilterItems(event)" placeholder="@Translate("Search")" /> 3637 </div> 3638 {{/ifCond}} 36393640 <div id="facetList{{name}}" class="x {{template}} facets-container__list @facetMoreClass dw-mod"> 3641 {{#FacetOptions}} 3642 {{#ifCond template "===" "Checkboxes"}} 3643 {{>Checkboxes}} 3644 {{/ifCond}} 3645 {{#ifCond template "===" "Range"}} 3646 {{>Range}} 3647 {{/ifCond}} 3648 {{#ifCond template "===" "Weight"}} 3649 {{>Checkboxes}} 3650 {{/ifCond}} 3651 {{#ifCond template "===" "Tags"}} 3652 {{>Tags}} 3653 {{/ifCond}} 3654 {{#ifCond template "===" "Colors"}} 3655 {{>Colors}} 3656 {{/ifCond}} 3657 {{/FacetOptions}} 3658 <div class="u-hidden js-filter-not-found"> 3659 @Translate("Your search gave 0 results") 3660 </div> 3661 </div> 36623663 @if (boxDisplay == "view-more") 3664 { 3665 <div class="facets-container__more js-facet-expand"> 3666 @Render(new Button 3667 { 3668 Title = "<span class=js-facet-trigger-text>" + Translate("View more") + "</span>", 3669 ButtonType = ButtonType.Button, 3670 ButtonLayout = ButtonLayout.Clean, 3671 CssClass = "facets-container__more-button js-facet-trigger u-flex u-no-margin u-full-width", 3672 OnClick = "Facets.ExpandToggle(this)", 3673 ExtraAttributes = new Dictionary<string, string>{ 3674 {"data-target", "facetList{{name}}"}, 3675 {"data-toggle-text", Translate("Show less")}, 3676 }, 3677 Icon = new Icon 3678 { 3679 Prefix = "fal", 3680 Name = "fa-angle-down", 3681 } 3682 }) 3683 </div> 3684 } 3685 </div> 3686 </div> 3687 {{/FacetGroups}} 3688 </div> 3689 <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> 3690 <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> 3691 } 36923693 @helper RenderProductListTopFacets() 3694 { 3695 @*This is part of a script template *@ 3696 <input type="checkbox" id="CheckFacetGroups" class="js-remember-state u-hidden" data-expand="CheckFacetGroups" /> 3697 <div class="grid grid--external-bleed dw-mod expandable--collapsed facets-container facets-container--top u-margin-bottom" data-trigger="CheckFacetGroups"> 3698 @if (Pageview.Device.ToString() == "Mobile") 3699 { 3700 string dropdownCssClass = Pageview.Device.ToString() == "Mobile" ? "u-flex-grow--1" : ""; 37013702 <div class="grid__col-lg-3 grid__col-md-3 grid__col-sm-4 grid__col-xs-12"> 3703 <input type="checkbox" id="ProductSort" class="dropdown-trigger" /> 3704 <div class="dropdown u-inline-block @dropdownCssClass dw-mod"> 3705 <label class="dropdown__header dropdown__btn dropdown__btn--small dw-mod" for="ProductSort">{{selectedSort}}</label> 3706 <div class="dropdown__content dw-mod"> 3707 <div class="dropdown__item" onclick="HandlebarsBolt.UpdateQueryParameters('productList', { SortBy: '', SortOrder: '' }, true);">@Translate("Default")</div> 3708 <div class="dropdown__item" onclick="HandlebarsBolt.UpdateQueryParameters('productList', { SortBy: 'Created', SortOrder: 'DESC'}, true);">@Translate("Newest")</div> 3709 <div class="dropdown__item" onclick="HandlebarsBolt.UpdateQueryParameters('productList', { SortBy: 'NameForSort', SortOrder: 'ASC'}, true);">@Translate("Name A - Z")</div> 3710 <div class="dropdown__item" onclick="HandlebarsBolt.UpdateQueryParameters('productList', { SortBy: 'NameForSort', SortOrder: 'DESC'}, true);">@Translate("Name Z - A")</div> 3711 @if (Dynamicweb.Rapido.Services.User.IsPricesAllowed()) 3712 { 3713 <div class="dropdown__item" onclick="HandlebarsBolt.UpdateQueryParameters('productList', { SortBy: 'Price', SortOrder: 'ASC' }, true);">@Translate("Price low - high")</div> 3714 <div class="dropdown__item" onclick="HandlebarsBolt.UpdateQueryParameters('productList', { SortBy: 'Price', SortOrder: 'DESC' }, true);">@Translate("Price high - low")</div> 3715 } 3716 </div> 3717 <label class="dropdown-trigger-off" for="ProductSort"></label> 3718 </div> 3719 </div> 3720 } 37213722 {{#FacetGroups}} 3723 <div class="grid__col-lg-3 grid__col-md-3 grid__col-sm-4 grid__col-xs-12"> 3724 <input type="checkbox" id="OptionsGroup_{{counter}}" class="dropdown-trigger" /> 3725 <div class="dropdown dw-mod js-filter"> 3726 <label class="dropdown__header dropdown__btn dw-mod" for="OptionsGroup_{{counter}}">{{name}}</label> 3727 <div class="dropdown__content dropdown__content--padding dw-mod"> 3728 <div class="u-margin-bottom {{showFilter}}"> 3729 <input type="text" class="u-full-width u-no-margin" onkeyup="Filter.FilterItems(event)" placeholder="@Translate("Search")" /> 3730 </div> 3731 {{#FacetOptions}} 3732 {{#ifCond template "===" "Checkboxes"}} 3733 {{>Checkboxes}} 3734 {{/ifCond}} 3735 {{#ifCond template "===" "Range"}} 3736 {{>Range}} 3737 {{/ifCond}} 3738 {{#ifCond template "===" "Weight"}} 3739 {{>Checkboxes}} 3740 {{/ifCond}} 3741 {{#ifCond template "===" "Tags"}} 3742 {{>Tags}} 3743 {{/ifCond}} 3744 {{#ifCond template "===" "Colors"}} 3745 {{>Colors}} 3746 {{/ifCond}} 3747 {{/FacetOptions}} 3748 <div class="u-hidden js-filter-not-found"> 3749 @Translate("Your search gave 0 results") 3750 </div> 3751 </div> 3752 <label class="dropdown-trigger-off" for="OptionsGroup_{{counter}}"></label> 3753 </div> 3754 </div> 3755 {{/FacetGroups}} 3756 </div> 3757 <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> 3758 <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> 3759 } 37603761 @helper RenderCheckboxFacets() 3762 { 3763 <script id="Checkboxes" type="text/x-template"> 3764 <div class="form__field-group u-no-margin dw-mod"> 3765 <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}}> 3766 <label class="{{disabled}} checkbox-facet dw-mod" data-filter-value="{{label}}" for="{{queryParameter}}{{value}}"> 3767 <span class="checkbox-facet__label dw-mod">{{label}}</span> 3768 <span class="checkbox-facet__count dw-mod">{{#if showCount}}({{count}}){{/if}}</span> 3769 </label> 3770 </div> 3771 </script> 3772 } 37733774 @helper RenderRangeFacets() 3775 { 3776 var queryParameterFrom = string.Empty; 3777 var queryParameterTo = string.Empty; 37783779 if (!string.IsNullOrWhiteSpace(Dynamicweb.Context.Current.Request.QueryString["Bredd_From"]) && !string.IsNullOrWhiteSpace(Dynamicweb.Context.Current.Request.QueryString["Bredd_To"])) 3780 { 3781 queryParameterFrom = Dynamicweb.Context.Current.Request.QueryString["Bredd_From"]; 3782 queryParameterTo = Dynamicweb.Context.Current.Request.QueryString["Bredd_To"]; 37833784 } 37853786 <script id="Range" type="text/x-template"> 3787 <div class="form__field-group u-no-margin dw-mod" > 3788 <div class="rangeInputContainer"> 3789 <span id="from_container"> 3790 <span>@Translate("Från") </span> 3791379237933794 <select id="{{queryParameter}}_From" name="{{queryParameter}}_From"> 3795 {{#datalist}} 3796 <option value="{{option}}" {{fromSelected}} >{{option}}</option> 3797 {{/datalist}} 37983799 </select> 3800 </span> 3801 <span id="to_conatiner"> 3802 <span>@Translate("Till") </span> 3803 <select id="{{queryParameter}}_To" name="{{queryParameter}}_To"> 3804 {{#datalist}} 3805 <option value="{{option}}" {{toSelected}} >{{option}}</option> 3806 {{/datalist}} 3807 </select> 3808 </span> 38093810 </div> 3811 <div class="button_control"> 3812 <input type="button" name="{{queryParameter}}" class="js-rangeFilterApply" value="@Translate("Filtrera")" onclick="Facets.UpdateFacets(this);" /> 38133814 @if (!string.IsNullOrWhiteSpace(queryParameterFrom)) 3815 { 38163817 } 38183819 {{#if queryParameterFrom }} 3820 <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"> 3821 @Translate("Visa alla bredd")&nbsp;<i class="fal fa-times"></i> 3822 </button> 3823 {{/if}} 382438253826 </div> 3827 </div> 3828 </script> 3829 } 38303831 @helper RenderTagsFacets() 3832 { 3833 <script id="Tags" type="text/x-template"> 3834 <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}}> 3835 {{label}} <span class="facets-group__counter dw-mod">({{count}})</span> 3836 </button> 3837 </script> 3838 } 38393840 @helper RenderColorFacets() 3841 { 3842 <script id="Colors" type="text/x-template"> 3843 <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> 3844 </script> 3845 } 38463847 @helper RenderSelectedFilter() 3848 { 3849 <script id="SelectedFilter" type="text/x-template"> 3850 <button type="button" class="btn btn--tag dw-mod" data-check="checked" onclick="Facets.UpdateFacets(this);" name="{{queryParameter}}" value="[{{value}}]" title="@Translate("Remove filter")"> 3851 {{group}}: {{label}} &nbsp;<i class="fal fa-times"></i> 3852 </button> 3853 </script> 3854 } 38553856 @helper RenderSelectedRangeFilter() 3857 { 3858 <script id="SelectedRangeFilter" type="text/x-template"> 3859 <button type="button" class="btn btn--tag dw-mod" data-check="checked" onclick="Facets.UpdateFacets(this);" name="{{name}}" value="[{{value}}]" title="@Translate("Remove filter")"> 3860 {{group}}: {{queryParameterFrom}} - {{queryParameterTo}} &nbsp;<i class="fal fa-times"></i> 3861 </button> 3862 </script> 3863 } 38643865 @helper RenderSelectedColorFilter() 3866 { 3867 <script id="SelectedColorFilter" type="text/x-template"> 3868 <button type="button" class="btn btn--tag dw-mod" data-check="checked" onclick="Facets.UpdateFacets(this);" name="{{queryParameter}}" value="[{{value}}]" title="@Translate("Remove filter")"> 3869 {{group}}: <div class="btn__colorbox dw-mod" style="background-color: {{value}}"></div> <i class="fas fa-times"></i> 3870 </button> 3871 </script> 3872 } 38733874 @helper RenderResetFilters() 3875 { 3876 <script id="ResetFilters" type="text/x-template"> 3877 <button type="button" class="btn btn--tag" onclick="Facets.ResetFacets();"> 3878 @Translate("Reset all filters") &nbsp;<i class="fal fa-redo"></i> 3879 </button> 3880 </script> 3881 } 388238833884 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 3885 @using Dynamicweb.Core 3886 @using System 3887 @using System.Web 3888 @using System.Collections.Generic 3889 @using Dynamicweb.Rapido.Blocks 38903891 @{ 3892 BlocksPage productListMoreBlocksPage = BlocksPage.GetBlockPage("ProductList"); 38933894 Block moreBlock = new Block 3895 { 3896 Id = "More", 3897 SortId = 40, 3898 Template = RenderListMore() 3899 }; 39003901 productListMoreBlocksPage.Add("ProductList", moreBlock); 3902 } 39033904 @helper RenderListMore() 3905 { 3906 @*This is part of a script template *@ 3907 string groupID = HttpContext.Current.Request.QueryString.Get("groupid"); 3908 string listId = HttpContext.Current.Request.QueryString.Get("ListID"); 3909 bool isFavoriteList = !string.IsNullOrEmpty(listId); 3910 string moreFeedFullUrl = GetGlobalValue("Global:Pageview.Url.Raw") + "&feed=true"; 3911 moreFeedFullUrl += !isFavoriteList ? "&DoNotShowVariantsAsSingleProducts=True" : ""; 3912 string columnCss = Pageview.Device.ToString() == "Mobile" ? "grid__col--bleed" : "u-no-padding"; 3913 <text> 3914 {{#if ProductsContainer}} 3915 <div class="grid"> 3916 <div class="grid__col-12 @columnCss"> 3917 <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> 3918 <button type="button" class="btn btn--clean" onclick="window.scroll(0, 0)">@Translate("Return to top")</button> 3919 </div> 3920 </div> 3921 {{/if}} 3922 </text> 3923 } 3924 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 3925 @using Dynamicweb.Core 3926 @using System 3927 @using System.Web 3928 @using System.Collections.Generic 3929 @using Dynamicweb.Rapido.Blocks 3930 @using Dynamicweb.Rapido.Blocks.Components 3931 @using Dynamicweb.Rapido.Blocks.Components.General 39323933 @{ 3934 BlocksPage productListBottomSnippetsPage = BlocksPage.GetBlockPage("ProductList"); 39353936 Block productListStickers = new Block 3937 { 3938 Id = "Stickers", 3939 SortId = 10, 3940 Template = RenderStickersTemplates() 3941 }; 3942 productListBottomSnippetsPage.Add("BottomSnippets", productListStickers); 39433944 Block productListUnits = new Block 3945 { 3946 Id = "Units", 3947 SortId = 20, 3948 Template = RenderUnitTemplates() 3949 }; 3950 productListBottomSnippetsPage.Add("BottomSnippets", productListUnits); 39513952 Block productListVariants = new Block 3953 { 3954 Id = "Variants", 3955 SortId = 30, 3956 Template = RenderVariantTemplates() 3957 }; 3958 productListBottomSnippetsPage.Add("BottomSnippets", productListVariants); 39593960 Block productListFavorites = new Block 3961 { 3962 Id = "Favorites", 3963 SortId = 40, 3964 Template = RenderFavoritesTemplates() 3965 }; 3966 productListBottomSnippetsPage.Add("BottomSnippets", productListFavorites); 39673968 Block productListPreRender = new Block 3969 { 3970 Id = "PreRenders", 3971 SortId = 50, 3972 Template = RenderPreRenderTemplates() 3973 }; 3974 productListBottomSnippetsPage.Add("BottomSnippets", productListPreRender); 39753976 Block productListInitializers = new Block 3977 { 3978 Id = "Initializers", 3979 SortId = 60, 3980 Template = RenderInitializers() 3981 }; 3982 productListBottomSnippetsPage.Add("BottomSnippets", productListInitializers); 3983 } 398439853986 @helper RenderFavoritesTemplates() 3987 { 3988 var selectedFavoriteIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue : "star"; 3989 string favoriteIcon = "fas fa-" + selectedFavoriteIcon; 3990 string favoriteOutlineIcon = "fal fa-" + selectedFavoriteIcon; 3991 bool useFacebookPixel = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID")); 3992 string currentFavoriteListId = HttpContext.Current.Request.QueryString.Get("ListID"); 39933994 <script id="FavoriteTemplate" type="text/x-template"> 3995 <div class="favorites-list u-ta-left js-favorites-list"> 3996 @Render(new Button { 3997 CssClass = "u-no-margin js-favorite-btn", 3998 Icon = new Icon 3999 { 4000 Name = "{{#if isInAnyFavoriteList}}" + favoriteIcon + "{{else}}" + favoriteOutlineIcon + "{{/if}}", 4001 CssClass = "fa-1_5x", 4002 LabelPosition = IconLabelPosition.After 4003 }, 4004 ButtonLayout = ButtonLayout.LinkClean, 4005 ButtonType = ButtonType.Button, 4006 OnClick = "document.getElementById('FavoriteTrigger_{{id}}').checked = true" 4007 }) 4008 <input type="checkbox" id="FavoriteTrigger_{{id}}" class="dropdown-trigger" /> 4009 <div class="dropdown dropdown--position-32px"> 4010 <div class="dropdown__content dropdown__content--show-left dropdown__content--padding u-w220px dw-mod"> 4011 <ul class="list list--clean dw-mod"> 4012 {{#FavoriteLists}} 4013 {{>FavoriteListItem}} 4014 {{/FavoriteLists}} 4015 </ul> 4016 </div> 4017 <label class="dropdown-trigger-off" for="FavoriteTrigger_{{id}}"></label> 4018 </div> 4019 </div> 4020 </script> 40214022 <script id="FavoriteListItem" type="text/x-template"> 4023 <li> 4024 @{ 4025 var button = new Button { 4026 CssClass = "list__link u-no-underline", 4027 OnClick = "toggleFavAction(this, event)", 4028 Icon = new Icon { Name = "{{#if isInFavoriteList}}" + favoriteIcon + "{{else}}" + favoriteOutlineIcon + "{{/if}}", LabelPosition = IconLabelPosition.After }, 4029 AltText = "{{#if isInFavoriteList}}" + Translate("Remove from") + " {{name}}{{else}}" + Translate("Add to") + " {{name}}{{/if}}", 4030 Title = "{{name}}", 4031 ButtonType = ButtonType.Button, 4032 ButtonLayout = ButtonLayout.LinkClean, 4033 ExtraAttributes = new Dictionary<string, string> 4034 { 4035 { "data-list-id", "{{listId}}" }, 4036 { "data-list-name", "{{name}}" }, 4037 { "data-remove-link", "{{removeLink}}" }, 4038 { "data-add-link", "{{addLink}}" }, 4039 { "data-is-in-list", "{{isInFavoriteList}}" }, 40404041 } 4042 }; 4043 if (useFacebookPixel) 4044 { 4045 button.ExtraAttributes.Add("data-facebook-object", "{{facebookPixelAddAction}}"); 4046 } 4047 } 4048 @Render(button) 4049 </li> 4050 </script> 40514052 <script> 4053 @if (!string.IsNullOrEmpty(currentFavoriteListId)) 4054 { 4055 <text> 4056 window.currentFavoriteListId = "@currentFavoriteListId"; 4057 </text> 4058 } 4059 function toggleFavAction(button, event) { 4060 if (button.getAttribute('data-add-link').indexOf('CCCreateNewList') > -1) { 4061 Scroll.SavePosition(event); 4062 @if (useFacebookPixel) 4063 { 4064 <text> 4065 fbq('track', 'AddToWishlist', JSON.parse(button.getAttribute('data-facebook-object'))); 4066 </text> 4067 } 4068 location.href = button.getAttribute('data-add-link'); 4069 return; 4070 } 4071 let isAdd = button.getAttribute('data-is-in-list') == "false"; 4072 Request.Fetch().get( 4073 isAdd ? button.getAttribute('data-add-link') : button.getAttribute('data-remove-link'), 4074 function (result) { 4075 button.querySelector('i').className = isAdd ? '@favoriteIcon u-margin-right--lg' : '@favoriteOutlineIcon u-margin-right--lg'; 4076 button.setAttribute('data-is-in-list', isAdd); 4077 button.setAttribute('title', (!isAdd ? '@Translate("Add to") ' : '@Translate("Remove from") ') + button.getAttribute('data-list-name')) 4078 let favList = button.closest('.js-favorites-list'); 4079 let favBtn = favList.querySelector('.js-favorite-btn i'); 4080 let isInAnyFavoriteList = favList.querySelector('[data-is-in-list=true]') != null; 4081 if (isInAnyFavoriteList) { 4082 favBtn.className = '@favoriteIcon' + ' fa-1_5x'; 4083 } else { 4084 favBtn.className = '@favoriteOutlineIcon' + ' fa-1_5x'; 4085 } 4086 @if (useFacebookPixel) 4087 { 4088 <text> 4089 if (isAdd) { 4090 fbq('track', 'AddToWishlist', JSON.parse(button.getAttribute('data-facebook-object'))); 4091 } 4092 </text> 4093 } 4094 if (window.currentFavoriteListId != null) { //if this page is favorite list 4095 let listId = button.getAttribute("data-list-id"); 4096 if (listId == window.currentFavoriteListId && !isAdd) { 4097 location.reload(); 4098 } 4099 } 4100 }, 4101 function () { 4102 console.error("FavoriteLists: Error in ToggleFavAction request"); 4103 }, 4104 false 4105 ); 4106 } 4107 </script> 4108 } 41094110 @helper RenderStickersTemplates() 4111 { 4112 <script id="StickersContainer" type="text/x-template"> 4113 <div class="stickers-container stickers-container--{{{convertStickerPositionToClassName Position}}} dw-mod"> 4114 {{#Stickers}} 4115 {{>Sticker}} 4116 {{/Stickers}} 4117 </div> 4118 </script> 41194120 <script id="Sticker" type="text/x-template"> 4121 <div class="stickers-container__tag {{CssClass}} dw-mod">{{Title}}</div> 4122 </script> 41234124 <script id="MiniSticker" type="text/x-template"> 4125 <div class="stickers-container__tag stickers-container__tag--micro {{CssClass}} dw-mod">{{Title}}</div> 4126 </script> 4127 } 41284129 @helper RenderUnitTemplates() 4130 { 4131 <script id="UnitOption" type="text/x-template"> 4132 <div class="dropdown__item dw-mod" onclick="HandlebarsBolt.UpdateContent(this.closest('.js-product').id, '{{link}}&feed=true&UnitID={{value}}')">{{name}}</div> 4133 </script> 4134 } 41354136 @helper RenderVariantTemplates() { 4137 <script id="VariantsTemplate" type="text/x-template"> 4138 {{#.}} 4139 <div> 4140 <div> 4141 {{#VariantOptions}} 4142 {{>VariantOption}} 4143 {{/VariantOptions}} 4144 </div> 4145 </div> 4146 {{/.}} 4147 </script> 41484149 <script id="VariantOption" type="text/x-template"> 4150 {{#if color}} 4151 <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> 4152 {{else}} 4153 {{#if image}} 4154 <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}}" /> 4155 {{else}} 4156 <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> 4157 {{/if}} 4158 {{/if}} 4159 </script> 41604161 <script id="DropdownVariantsTemplate" type="text/x-template"> 4162 {{#.}} 4163 <div> 4164 <div class="u-bold">{{name}}</div> 4165 <select id="VariantSelector_{{id}}" class="u-full-width dw-mod" name="VariantSelector_{{id}}" onchange="MatchVariants.SelectOnChange(event)" > 4166 <option>@Translate("Choose")</option> 4167 {{#VariantOptions}} 4168 {{>DropdownVariantOption}} 4169 {{/VariantOptions}} 4170 </select> 4171 </div> 4172 {{/.}} 4173 </script> 41744175 <script id="DropdownVariantOption" type="text/x-template"> 4176 <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> 4177 </script> 41784179 <script id="StaticVariantsTemplate" type="text/x-template"> 4180 {{#.}} 4181 {{#if isFirstGroup}} 4182 <div> 4183 {{#VariantOptions}} 4184 {{>StaticVariantOption}} 4185 {{/VariantOptions}} 4186 </div> 4187 {{/if}} 4188 {{/.}} 4189 </script> 41904191 <script id="StaticVariantOption" type="text/x-template"> 4192 {{#if color}} 4193 <div class="static-variant static-variant--color dw-mod" style="background-color: {{color}}" title="{{name}}"></div> 4194 {{else}} 4195 <div class="static-variant dw-mod">{{name}} </div> 4196 {{/if}} 4197 </script> 419841994200 <script id="StaticVariantsLgTemplate" type="text/x-template"> 4201 {{#.}} 4202 {{#if isFirstGroup}} 4203 <div class="padding-size-xs"> 4204 {{#VariantOptions}} 4205 {{>StaticVariantLgOption}} 4206 {{/VariantOptions}} 4207 </div> 4208 {{/if}} 4209 {{/.}} 4210 </script> 42114212 <script id="StaticVariantLgOption" type="text/x-template"> 4213 {{#if color}} 4214 <div class="static-variant static-variant--color static-variant--color--lg dw-mod" style="background-color: {{color}}" title="{{name}}"></div> 4215 {{else}} 4216 <div class="static-variant dw-mod">{{name}} </div> 4217 {{/if}} 4218 </script> 42194220 <script id="VariantOptionImage" type="text/x-template"> 4221 <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}} /> 4222 </script> 4223 } 42244225 @helper RenderPreRenderTemplates() { 4226 string facetsViewMode = !String.IsNullOrEmpty(Pageview.AreaSettings.GetItem("ProductList").GetString("FacetsViewMode")) ? Pageview.AreaSettings.GetItem("ProductList").GetString("FacetsViewMode").ToLower() : "left"; 42274228 <script id="ProductPreRenderContainer" type="text/x-template"> 4229 @if (facetsViewMode == "left" && Pageview.Device.ToString() != "Mobile") 4230 { 4231 <div class="grid__col-3"> 4232 <div class="pre-render-element pre-render-element--xs"></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 class="pre-render-element pre-render-element--md"></div> 4236 </div> 4237 } 4238 <div class="grid__col-auto"> 4239 <div class="pre-render-element pre-render-element--xs"></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 class="pre-render-element pre-render-element--lg"></div> 4244 </div> 4245 </script> 4246 } 42474248 @helper RenderInitializers() { 4249 <script> 4250 document.addEventListener("DOMContentLoaded", function (event) { 4251 document.getElementById("productList").addEventListener('contentLoaded', function (e) { 4252 if (getTarget(e).id === "productList") { 4253 Search.Init(); 4254 Facets.Init("selectedFacets", "productList"); 4255 } 4256 }, false); 42574258 @{ 4259 bool useGoogleTagManager = false; 42604261 if (useGoogleTagManager) 4262 { 4263 <text> 4264 Scroll.AddIsInViewportListener(".js-product-scroll-trigger", function (elem) { 4265 let googleImpression = JSON.parse(elem.getAttribute("data-params")); 4266 googleEnchantImpression(googleImpression); 4267 elem.classList.remove("js-product-scroll-trigger"); 4268 }); 4269 </text> 4270 } 4271 } 42724273 }); 4274 </script> 4275 } 427642774278 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 4279 @using Dynamicweb.Core 4280 @using System 4281 @using System.Web 4282 @using System.Collections.Generic 4283 @using Dynamicweb.Rapido.Blocks 42844285 @{ 4286 BlocksPage customBlocksPage = BlocksPage.GetBlockPage("ProductList"); 42874288 } 428942904291 @if (productListNavigation.BlocksList.Count == 0) 4292 { 4293 productListNavigation.Design.RenderType = RenderType.Hide; 4294 } 42954296 <form name="multiForm" id="multiForm" method="post" onkeypress="return event.keyCode != 13;"> 4297 @* onkeypress is the fix for disabling submit form on Enter key from any field in product list *@ 4298 <input type="hidden" name="CartCmd" id="CartCmd" value="addMulti" /> 4299 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 4300 @RenderBlockList(productListPage.BlocksRoot.BlocksList) 4301 </form> 43024303 @helper RenderPageContainer() 4304 { 4305 List<Block> subBlocks = this.productListPage.GetBlockListById("PageContainer").OrderBy(item => item.SortId).ToList(); 4306 var groupid = HttpContext.Current.Request.QueryString["groupid"]; 4307 string pageUrl = GetGlobalValue("Global:Pageview.Url.Raw"); 4308 string feedFullUrl = pageUrl + "&feed=true"; 4309 feedFullUrl += !isFavoriteList ? "&DoNotShowVariantsAsSingleProducts=True" : ""; 4310 string smallDeviceCss = Pageview.Device.ToString() == "Mobile" ? "" : "u-padding"; 4311 string pageId = Convert.ToString(Dynamicweb.Frontend.PageView.Current().Page.ID); 4312 string groupUrl = $"/default.aspx?id={pageId}&GroupId="; 4313 var renderGroups = true; 4314 var renderProducts = true; 4315 var groupPlacement = Convert.ToString(GetBoolean("Ecom:Group:Field.LowDescriptionPlacement")); 4316 var group = Services.ProductGroups.GetGroup(groupid); 43174318 if (!string.IsNullOrWhiteSpace(groupid)) 4319 { 4320 if (Services.ProductGroups.HasSubgroups(group)) 4321 { 4322 renderProducts = false; 4323 } 4324 else 4325 { 4326 renderGroups = false; 4327 } 43284329 } 433043314332433343344335 if (groupid == "GROUP318" || groupid == "GROUP758" || groupid == "1011atSHOP17" || groupid == "1011atSHOP16" || groupid == "1011atSHOP15") 4336 { 4337 renderGroups = false; 4338 } 4339434043414342 if (renderGroups) 4343 { 4344 <section class="multiple-paragraphs-container multiple-paragraphs-container--spacing-sm dw-mod groupheader-fix"> 4345 <div class="paragraph-container__grid--bleed-x "> 4346 <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> 4347 </div> 4348 </section> 4349 } 43504351 if (renderProducts) 4352 { 4353 <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> 4354 } 4355 else 4356 { 4357 <div id="productList"></div> 4358 } 43594360436143624363 <script id="GroupContainer" type="text/x-template"> 4364 {{#.}} 43654366 {{#if groupLargeImage}} 4367 <div class="grid"> 4368 <div class="grid__col-12 grid__col--bleed-x"> 4369 <div class="grid__cell group-image"> 4370 <img src="{{groupLargeImage}}" alt="{{groupName}}" /> 4371 </div> 4372 </div> 4373 </div> 4374 {{/if}} 43754376 <div class="grid"> 4377 <div class="grid__col-12"> 4378 <div class="grid__cell"> 4379 <div class="u-pull--left"> 4380 <h1><i class="{{headerIcon}}"></i>{{groupName}}</h1> 4381 {{#if groupDescription}} 4382 <div class="u-margin-bottom-lg groupDescription">{{{groupDescription}}}</div> 4383 {{/if}} 4384 </div> 4385 </div> 4386 </div> 4387 </div> 43884389 <div class="grid"> 4390 <div class="grid__col-12 grid__col--bleed-x"> 4391 <div class="grid__cell"> 4392 <div id="GroupsContainer" class="grid product-list dw-mod" data-template="GroupGridItemContainer" data-preloader="minimal"> 4393 {{#GroupsContainer}} 4394 {{>GroupGridItemContainer}} 4395 {{/GroupsContainer}} 4396 </div> 4397 </div> 4398 </div> 4399 </div> 44004401 {{#if gropLowDescription}} 44024403 <div class="grid"> 4404 <div class="grid__col-12"> 4405 <div class="grid__cell"> 4406 <div class="u-pull--left"> 4407 <div class="u-margin-bottom-lg gropLowDescription">{{{gropLowDescription}}}</div> 4408 </div> 4409 </div> 4410 </div> 4411 </div> 4412 {{/if}} 441344144415 {{/.}} 4416 </script> 44174418 <script id="GroupGridItemContainer" type="text/x-template"> 4419 {{#.}} 4420 <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"> 4421 {{#Group}} 4422 {{>GroupGridItem}} 4423 {{/Group}} 4424 </div> 4425 {{/.}} 4426 </script> 44274428 <script id="GroupGridItem" type="text/x-template"> 4429 {{#.}} 4430 <div class="grid__cell u-border dw-mod {{noImage}}"> 4431 <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> 4432 </div> 44334434 <div class="grid__cell dw-mod u-margin-top"> 4435 <a href="@groupUrl{{link}}" onclick="Scroll.SavePosition(event)" title="{{name}}"><h6 class="u-condensed-text grid__cell-sm-img--centered">{{name}}</h6></a> 4436 </div> 4437 {{/.}} 4438 </script> 443944404441 <script id="ProductContainer" type="text/x-template"> 4442 {{#each .}} 4443 @RenderBlockList(subBlocks) 44444445 {{#if gropLowDescription}} 44464447 <div class="grid"> 4448 <div class="grid__col-12"> 4449 <div class="grid__cell"> 4450 <div class="u-pull--left"> 4451 <div class="u-margin-bottom-lg gropLowDescription">{{{gropLowDescription}}}</div> 4452 </div> 4453 </div> 4454 </div> 4455 </div> 4456 {{/if}} 44574458 {{else}} 44594460 @{ 4461 var searchText = HttpContext.Current.Request.QueryString.Get("Search") != null ? HttpContext.Current.Request.QueryString.Get("Search") : ""; 44624463 if (!string.IsNullOrWhiteSpace(searchText)) 4464 { 4465 <div class="grid__col-12"> 4466 <h2 class="u-ta-center">@Translate("Your search gave 0 results")</h2> 4467 </div> 4468 } 44694470 } 44714472 {{/each}} 4473 </script> 4474 } 44754476 @helper RenderProductList() 4477 { 4478 @*This is part of a script template *@ 44794480 List<Block> subBlocks = productListPage.GetBlockListById("ProductList").OrderBy(item => item.SortId).ToList(); 4481 string smallDeviceCss = Pageview.Device.ToString() == "Mobile" ? "u-no-padding" : ""; 4482 string columnClass = "auto"; 44834484 if (productListPage.GetBlockListById("Navigation").Count == 0) 4485 { 4486 columnClass = "12"; 4487 } 448844894490 <div class="grid__col-@columnClass @smallDeviceCss"> 4491 @RenderBlockList(subBlocks) 4492 </div> 4493 } 44944495 @helper RenderProductListHeader() 4496 { 4497 List<Block> subBlocks = this.productListPage.GetBlockListById("ProductListHeader"); 4498 bool enableSeparationLine = productListSettings.GetBoolean("EnableSeparationLine"); 4499 string className = (enableSeparationLine != null && enableSeparationLine ? "u-border-bottom u-padding-bottom" : ""); 45004501 <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"> 4502 <div class="grid @className"> 4503 <div class="u-pull--left"> 4504 <h1><i class="{{headerIcon}}"></i>{{groupName}}</h1> 4505 {{#if groupDescription}} 4506 <div class="u-margin-bottom-lg">{{{groupDescription}}}</div> 4507 {{/if}} 45084509 </div> 45104511 @RenderBlockList(subBlocks) 4512 </div> 45134514 </div> 4515 } 45164517 @helper RenderProductListTitle() 4518 { 4519 var header = new Heading { Title = "{{{header}}}", CssClass = "u-no-margin" }; 4520 var searchText = HttpContext.Current.Request.QueryString.Get("Search") != null ? HttpContext.Current.Request.QueryString.Get("Search") : ""; 45214522 if (isFavoriteList) 4523 { 4524 var selectedFavoriteIcon = "star"; 4525 header.Icon = new Icon { Prefix = "fas", Name = "fa-" + selectedFavoriteIcon, LabelPosition = IconLabelPosition.After }; 4526 @Render(header) 4527 } 452845294530 if (!string.IsNullOrWhiteSpace(searchText)) 4531 { 4532 @Render(header) 4533 } 453445354536 } 45374538 @helper RenderFavoriteListSearch() 4539 { 4540 string pageId = GetGlobalValue("Global:Page.ID"); 4541 string pageUrl = GetGlobalValue("Global:Pageview.Url.Raw"); 4542 string feedFullUrl = pageUrl + "&feed=true"; 4543 string searchPlaceholder = Translate("Search favorite products"); 4544 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; 45454546 <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"> 4547 <input type="text" class="typeahead-search-field u-no-margin u-full-width js-typeahead-search-field" placeholder="@searchPlaceholder" value="@searchValue"> 4548 <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> 4549 <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> 4550 </div> 4551 }