Form

Error executing template "Designs/Rapido/Forms/Form/SignUpForEventForm.cshtml"
System.ArgumentException: The requested block ID can not be found
Parameter name: Form1422
   at Dynamicweb.Rapido.Blocks.BlocksPage.GetBlockListById(String childId)
   at Dynamicweb.Rapido.Blocks.BlocksPage.Add(String id, Block block)
   at CompiledRazorTemplates.Dynamic.RazorEngine_e268060f6b89402a9c6521421c5cc598.Execute() in D:\Dynamicweb.net\Solutions\Dynamicweb\aktrading.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\Forms\Form\SignUpForEventForm.cshtml:line 329
   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.Rapido.Blocks 3 @using Dynamicweb.Rapido.Blocks.Components.General 4 5 @using System.Web 6 7 @functions { 8 BlocksPage eventFormPage = BlocksPage.GetBlockPage("FormPage"); 9 } 10 11 @{ 12 Block formPlaceholder = new Block 13 { 14 Id = "Form", 15 SortId = 10, 16 Template = RenderSignUpForm(), 17 SkipRenderBlocksList = true 18 }; 19 20 eventFormPage.Add(formPlaceholder); 21 } 22 23 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 24 25 @using Dynamicweb.Core 26 @using Dynamicweb.Rapido.Blocks 27 @using Dynamicweb.Rapido.Blocks.Components 28 @using Dynamicweb.Rapido.Blocks.Components.General 29 30 31 @functions { 32 BlocksPage formPage = BlocksPage.GetBlockPage("FormPage"); 33 } 34 35 @{ 36 // Hack to match date time format of the Flatpickr plugin 37 string shortDateFormat = Pageview.Area.CultureInfo.DateTimeFormat.ShortDatePattern.Replace("M", "n").Replace("d", "j").Replace("yyyy", "Y"); 38 string shortTimeFormat = Pageview.Area.CultureInfo.DateTimeFormat.ShortTimePattern.Replace("mm", "i").Replace("tt", "K"); 39 40 Form form = new Form 41 { 42 FormStartMarkup = GetString("Form.FormStart") + GetString("Form.SystemFields") 43 }; 44 45 foreach (LoopItem field in GetLoop("Fields")) 46 { 47 string fieldType = field.GetString("Field.Type"); 48 bool required = field.GetBoolean("Field.Required"); 49 string systemName = field.GetString("Field.SystemName"); 50 string value = field.GetString("Field.ValueFromAutoOrDefault"); 51 string placeholder = Translate(field.GetString("Field.Placeholder")); 52 string label = Translate(field.GetString("Field.Name")); 53 string description = Translate(field.GetString("Field.Description")); 54 string control = field.GetString("Field.Control"); 55 56 switch (fieldType) 57 { 58 case "TextInput": 59 case "Email": 60 case "Password": 61 case "Tel": 62 TextFieldType type = TextFieldType.Text; 63 // Missing Component 64 type = fieldType == "Email" ? TextFieldType.Email : type; 65 type = fieldType == "Password" ? TextFieldType.Password : type; 66 type = fieldType == "Tel" ? TextFieldType.Tel : type; 67 68 form.Add(new TextField 69 { 70 Id = systemName, 71 Type = type, 72 Name = systemName, 73 Label = label, 74 Placeholder = placeholder, 75 Value = value, 76 HelpText = description, 77 Required = required 78 }); 79 break; 80 81 case "Week": 82 case "Time": 83 case "Color": 84 // BUG: comes out as "TextInput" 85 break; 86 87 case "Month": 88 case "Search": 89 case "Url": 90 case "Range": 91 // Missing Component 92 break; 93 94 case "Number": 95 form.Add(new NumberField() 96 { 97 Id = systemName, 98 Name = systemName, 99 Label = label, 100 Value = value, 101 HelpText = description, 102 Required = required, 103 CssClass = "u-full-width" 104 }); 105 break; 106 107 case "Textarea": 108 form.Add(new TextareaField 109 { 110 Id = systemName, 111 Name = systemName, 112 Label = label, 113 Placeholder = placeholder, 114 Value = value, 115 HelpText = description, 116 Required = required 117 }); 118 break; 119 120 case "Hidden": 121 form.Add(new HiddenField { Id = systemName, Name = systemName, Value = value }); //??? event 122 break; 123 124 case "File": 125 form.Add(new FileField 126 { 127 Id = systemName, 128 Name = systemName, 129 Label = label, 130 HelpText = description, 131 Required = required 132 }); 133 break; 134 135 case "Date": 136 form.Add(new DateTimeField() 137 { 138 Id = systemName, 139 Name = systemName, 140 Label = label, 141 HelpText = description, 142 Placeholder = placeholder, 143 Value = value, 144 Required = required, 145 CssClass = "u-full-width", 146 DateFormat = shortDateFormat 147 }); 148 break; 149 150 case "Datetime": 151 case "Datetime-Local": 152 form.Add(new DateTimeField() 153 { 154 Id = systemName, 155 Name = systemName, 156 Label = label, 157 HelpText = description, 158 Placeholder = placeholder, 159 Value = value, 160 Required = required, 161 EnableTime = true, 162 CssClass = "u-full-width " + Pageview.Area.CultureInfo.DateTimeFormat.ShortTimePattern, 163 DateFormat = shortDateFormat + " " + shortTimeFormat 164 }); 165 break; 166 167 case "CheckBox": 168 form.Add(new CheckboxField 169 { 170 Id = systemName, 171 Name = systemName, 172 Label = label, 173 Value = value, 174 HelpText = description, 175 Required = required 176 }); 177 break; 178 179 case "Radio": 180 RadioButtonListField radioButtonsList = new RadioButtonListField 181 { 182 Id = systemName, 183 Name = systemName, 184 Label = label, 185 HelpText = description 186 }; 187 188 foreach (LoopItem option in field.GetLoop("Options")) 189 { 190 bool isChecked = option.GetBoolean("Option.DefaultSelected"); 191 string id = systemName + option.GetString("Option.ID"); 192 string optionValue = option.GetString("Option.Value"); 193 string optionText = Translate(option.GetString("Option.Text")); 194 195 radioButtonsList.Options.Add(new RadioButtonField 196 { 197 Id = id, 198 Value = optionValue, 199 Label = optionText, 200 Checked = isChecked 201 }); 202 } 203 form.Add(radioButtonsList); 204 break; 205 206 case "CheckBoxList": 207 CheckboxListField checkboxList = new CheckboxListField 208 { 209 Id = systemName, 210 Name = systemName, 211 Label = label, 212 HelpText = description 213 }; 214 215 foreach (LoopItem option in field.GetLoop("Options")) 216 { 217 bool isChecked = option.GetBoolean("Option.DefaultSelected"); 218 string id = systemName + option.GetString("Option.ID"); 219 string optionValue = option.GetString("Option.Value"); 220 string optionText = Translate(option.GetString("Option.Text")); 221 222 checkboxList.Options.Add(new CheckboxField 223 { 224 Id = id, 225 Value = optionValue, 226 Label = optionText, 227 Checked = isChecked 228 }); 229 } 230 231 form.Add(checkboxList); 232 break; 233 234 case "Select": 235 236 SelectField select = new SelectField 237 { 238 Id = systemName, 239 Name = systemName, 240 Label = label, 241 Value = value, 242 HelpText = description, 243 Required = required 244 }; 245 246 foreach (var option in field.GetLoop("Options")) 247 { 248 select.Options.Add(new SelectFieldOption 249 { 250 Label = option.GetString("Option.Text"), 251 Value = option.GetString("Option.Value"), 252 Checked = option.GetBoolean("Option.DefaultSelected") 253 }); 254 } 255 256 form.Add(select); 257 break; 258 259 case "Submit": 260 form.Add(new Button 261 { 262 ButtonType = ButtonType.Submit, 263 Id = systemName, 264 Title = label, 265 OnClick = "Buttons.LockButton(event)", 266 CssClass = "u-no-margin" 267 }); 268 269 form.Add(new Text { Content = description }); 270 break; 271 272 case "Reset": 273 form.Add(new Button 274 { 275 ButtonType = ButtonType.Reset, 276 Id = systemName, 277 Title = label 278 }); 279 280 form.Add(new Text { Content = description }); 281 break; 282 case "Text": 283 control = $"<div class=\"form__field-group u-margin-bottom dw-mod\">{control}</div>"; 284 form.Add(new Text { Content = control }); 285 break; 286 287 case "Image": 288 string imagePath = field.GetString("Field.Image"); 289 if (imagePath.IsNotNullOrEmpty()) 290 { 291 var image = new Image 292 { 293 Path = imagePath, 294 Caption = description, 295 CssClass = "flex-img", 296 ImageDefault = new ImageSettings 297 { 298 Width = 1440, 299 Format = ImageFormat.WebP 300 }, 301 ImageMedium = new ImageSettings 302 { 303 Width = 690, 304 Format = ImageFormat.WebP 305 }, 306 ImageSmall = new ImageSettings 307 { 308 Width = 450, 309 Format = ImageFormat.WebP 310 } 311 }; 312 form.Add(new Text { Content = Converter.ToString(Render(image)) }); 313 } 314 break; 315 316 case "PageShift": 317 form.Add(new Text { Content = "<label for=" + systemName + ">" + label + "</label><span class='formPageShift'></span>" }); 318 break; 319 } 320 } 321 322 Block formBlock = new Block 323 { 324 Id = "FormComponent", 325 SortId = 10, 326 Component = form 327 }; 328 329 formPage.Add("Form" + Pageview.CurrentParagraph.ID, formBlock); 330 } 331 332 @helper RenderCheckboxFieldCustom(CheckboxField settings) { 333 int termsPageId = GetPageIdByNavigationTag("TermsAndConditions"); 334 335 if (settings.Id == "TermsAccept") 336 { 337 settings.Label += " <a href='/Default.aspx?Id=" + termsPageId + "' target='_blank' rel='noopener'>" + Translate("the terms and conditions of this website") + "</a>"; 338 } 339 @RenderCheckboxField(settings) 340 } 341 342 @helper RenderSignUpForm() 343 { 344 string eventName = HttpContext.Current.Request.QueryString.Get("eventName"); 345 346 @Render(new Heading { Title = Translate("Sign up form"), Level = 2, CssClass = "u-margin-bottom" }) 347 @Render(new Heading { Title = eventName, Level = 3, CssClass = "u-margin-bottom" }) 348 349 List<Block> subBlocks = this.eventFormPage.GetBlockListById("Form").OrderBy(item => item.SortId).ToList(); 350 351 // Render Content 352 @RenderBlockList(subBlocks) 353 } 354 355 @* Include the Rendering helpers *@ 356 @using System.Text.RegularExpressions 357 @using System.Collections.Generic 358 @using System.Reflection 359 @using System.Web 360 @using System.Web.UI.HtmlControls 361 @using Dynamicweb.Rapido.Blocks.Components 362 @using Dynamicweb.Rapido.Blocks.Components.Articles 363 @using Dynamicweb.Rapido.Blocks.Components.Documentation 364 @using Dynamicweb.Rapido.Blocks 365 366 367 @*--- START: Base block renderers ---*@ 368 369 @helper RenderBlockList(List<Block> blocks) 370 { 371 bool debug = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("debug")) ? Convert.ToBoolean(HttpContext.Current.Request.QueryString.Get("debug")) : false; 372 blocks = blocks.OrderBy(item => item.SortId).ToList(); 373 374 foreach (Block item in blocks) 375 { 376 if (debug) { 377 <!-- Block START: @item.Id --> 378 } 379 380 if (item.Design == null) 381 { 382 @RenderBlock(item) 383 } 384 else if (item.Design.RenderType == RenderType.None) { 385 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : ""; 386 387 <div class="@cssClass dw-mod"> 388 @RenderBlock(item) 389 </div> 390 } 391 else if (item.Design.RenderType != RenderType.Hide) 392 { 393 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : ""; 394 395 if (!item.SkipRenderBlocksList) { 396 if (item.Design.RenderType == RenderType.Row) 397 { 398 <div class="grid grid--align-content-start @cssClass dw-mod" id="Block__@item.Id"> 399 @RenderBlock(item) 400 </div> 401 } 402 403 if (item.Design.RenderType == RenderType.Column) 404 { 405 string hidePadding = item.Design.HidePadding ? "u-no-padding" : ""; 406 string size = item.Design.Size ?? "12"; 407 size = Regex.IsMatch(size, @"\d") ? "md-" + item.Design.Size : item.Design.Size; 408 409 <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"> 410 @RenderBlock(item) 411 </div> 412 } 413 414 if (item.Design.RenderType == RenderType.Table) 415 { 416 <table class="table @cssClass dw-mod" id="Block__@item.Id"> 417 @RenderBlock(item) 418 </table> 419 } 420 421 if (item.Design.RenderType == RenderType.TableRow) 422 { 423 <tr class="@cssClass dw-mod" id="Block__@item.Id"> 424 @RenderBlock(item) 425 </tr> 426 } 427 428 if (item.Design.RenderType == RenderType.TableColumn) 429 { 430 <td class="@cssClass dw-mod" id="Block__@item.Id"> 431 @RenderBlock(item) 432 </td> 433 } 434 435 if (item.Design.RenderType == RenderType.CardHeader) 436 { 437 <div class="card-header @cssClass dw-mod"> 438 @RenderBlock(item) 439 </div> 440 } 441 442 if (item.Design.RenderType == RenderType.CardBody) 443 { 444 <div class="card @cssClass dw-mod"> 445 @RenderBlock(item) 446 </div> 447 } 448 449 if (item.Design.RenderType == RenderType.CardFooter) 450 { 451 <div class="card-footer @cssClass dw-mod"> 452 @RenderBlock(item) 453 </div> 454 } 455 } 456 else 457 { 458 @RenderBlock(item) 459 } 460 } 461 462 if (debug) { 463 <!-- Block END: @item.Id --> 464 } 465 } 466 } 467 468 @helper RenderBlock(Block item) 469 { 470 bool debug = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("debug")) ? Convert.ToBoolean(HttpContext.Current.Request.QueryString.Get("debug")) : false; 471 472 if (item.Template != null) 473 { 474 @BlocksPage.RenderTemplate(item.Template) 475 } 476 477 if (item.Component != null) 478 { 479 string customSufix = "Custom"; 480 string methodName = item.Component.HelperName; 481 482 ComponentBase[] methodParameters = new ComponentBase[1]; 483 methodParameters[0] = item.Component; 484 Type methodType = this.GetType(); 485 486 MethodInfo customMethod = methodType.GetMethod(methodName + customSufix); 487 MethodInfo generalMethod = methodType.GetMethod(methodName); 488 489 try { 490 if (debug) { 491 <!-- Component: @methodName --> 492 } 493 @customMethod.Invoke(this, methodParameters).ToString(); 494 } catch { 495 try { 496 @generalMethod.Invoke(this, methodParameters).ToString(); 497 } catch(Exception ex) { 498 throw new Exception(item.Component.GetType().Name + " method '" + methodName +"' could not be invoked", ex); 499 } 500 } 501 } 502 503 if (item.BlocksList.Count > 0 && !item.SkipRenderBlocksList) 504 { 505 @RenderBlockList(item.BlocksList) 506 } 507 } 508 509 @*--- END: Base block renderers ---*@ 510 511 @using Dynamicweb.Rapido.Blocks.Components 512 @using Dynamicweb.Rapido.Blocks.Components.General 513 @using Dynamicweb.Rapido.Blocks 514 @using System.IO 515 516 @* Required *@ 517 @using Dynamicweb.Rapido.Blocks.Components 518 @using Dynamicweb.Rapido.Blocks.Components.General 519 @using Dynamicweb.Rapido.Blocks 520 521 522 @helper Render(ComponentBase component) 523 { 524 if (component != null) 525 { 526 @component.Render(this) 527 } 528 } 529 530 @* Components *@ 531 @using System.Reflection 532 @using Dynamicweb.Rapido.Blocks.Components.General 533 534 535 @* Component *@ 536 537 @helper RenderIcon(Icon settings) 538 { 539 if (settings != null) 540 { 541 string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : ""; 542 543 if (settings.Name != null) 544 { 545 if (string.IsNullOrEmpty(settings.Label)) 546 { 547 <i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i> 548 } 549 else 550 { 551 if (settings.LabelPosition == IconLabelPosition.Before) 552 { 553 <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> 554 } 555 else 556 { 557 <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> 558 } 559 } 560 } 561 else if (!string.IsNullOrEmpty(settings.Label)) 562 { 563 @settings.Label 564 } 565 } 566 } 567 @using System.Reflection 568 @using Dynamicweb.Rapido.Blocks.Components.General 569 @using Dynamicweb.Rapido.Blocks.Components 570 @using Dynamicweb.Core 571 572 @* Component *@ 573 574 @helper RenderButton(Button settings) 575 { 576 if (settings != null && (!string.IsNullOrEmpty(settings.Title) || settings.Icon != null)) 577 { 578 Dictionary<string, string> attributes = new Dictionary<string, string>(); 579 List<string> classList = settings.CssClass != null ? settings.CssClass.Split(' ').ToList() : new List<string>(); 580 if (settings.Disabled) { 581 attributes.Add("disabled", "true"); 582 classList.Add("disabled"); 583 } 584 585 if (!string.IsNullOrEmpty(settings.ConfirmText) || !string.IsNullOrEmpty(settings.ConfirmTitle)) 586 { 587 settings.Id = !string.IsNullOrEmpty(settings.Id) ? settings.Id : Guid.NewGuid().ToString("N"); 588 @RenderConfirmDialog(settings); 589 settings.OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = true"; 590 } 591 592 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 593 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 594 if (!string.IsNullOrEmpty(settings.AltText)) 595 { 596 attributes.Add("title", settings.AltText); 597 } 598 else if (!string.IsNullOrEmpty(settings.Title)) 599 { 600 attributes.Add("title", settings.Title); 601 } 602 603 var onClickEvents = new List<string>(); 604 if (!string.IsNullOrEmpty(settings.OnClick)) 605 { 606 onClickEvents.Add(settings.OnClick); 607 } 608 if (!string.IsNullOrEmpty(settings.Href)) 609 { 610 onClickEvents.Add("location.href='" + settings.Href + "'"); 611 } 612 if (onClickEvents.Count > 0) 613 { 614 attributes.Add("onClick", string.Join(";", onClickEvents)); 615 } 616 617 if (settings.ButtonLayout != ButtonLayout.None) 618 { 619 classList.Add("btn"); 620 string btnLayout = Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower(); 621 if (btnLayout == "linkclean") 622 { 623 btnLayout = "link-clean"; //fix 624 } 625 classList.Add("btn--" + btnLayout); 626 } 627 628 if (settings.Icon == null) 629 { 630 settings.Icon = new Icon(); 631 } 632 633 settings.Icon.CssClass += Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower() != "linkclean" ? " u-flex--align-center" : ""; 634 settings.Icon.Label = settings.Title; 635 636 attributes.Add("type", Enum.GetName(typeof(ButtonType), settings.ButtonType).ToLower()); 637 638 <button class="@string.Join(" ", classList) dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@Render(settings.Icon)</button> 639 } 640 } 641 642 @helper RenderConfirmDialog(Button settings) 643 { 644 Modal confirmDialog = new Modal { 645 Id = settings.Id, 646 Width = ModalWidth.Sm, 647 Heading = new Heading 648 { 649 Level = 2, 650 Title = settings.ConfirmTitle 651 }, 652 BodyText = settings.ConfirmText 653 }; 654 655 confirmDialog.AddAction(new Button { Title = Translate("Cancel"), ButtonLayout = ButtonLayout.Secondary, OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = false"}); 656 confirmDialog.AddAction(new Button { Title = Translate("OK"), ButtonLayout = ButtonLayout.Primary, OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = false;" + settings.OnClick }); 657 658 @Render(confirmDialog) 659 } 660 @using Dynamicweb.Rapido.Blocks.Components.General 661 @using Dynamicweb.Rapido.Blocks.Components 662 @using Dynamicweb.Core 663 664 @helper RenderDashboard(Dashboard settings) 665 { 666 var widgets = settings.GetWidgets(); 667 668 if (!string.IsNullOrEmpty(settings.WidgetsBaseBackgroundColor)) 669 { 670 //set bg color for them 671 672 System.Drawing.Color color = System.Drawing.ColorTranslator.FromHtml(settings.WidgetsBaseBackgroundColor); 673 int r = Convert.ToInt16(color.R); 674 int g = Convert.ToInt16(color.G); 675 int b = Convert.ToInt16(color.B); 676 677 var count = widgets.Length; 678 var max = Math.Max(r, Math.Max(g, b)); 679 double step = 255.0 / (max * count); 680 var i = 0; 681 foreach (var widget in widgets) 682 { 683 i++; 684 685 var shade = "rgb(" + Converter.ToString(r * step * i).Replace(",", ".") + ", " + Converter.ToString(g * step * i).Replace(",", ".") + ", " + Converter.ToString(b * step * i).Replace(",", ".") + ")"; 686 widget.BackgroundColor = shade; 687 } 688 } 689 690 <div class="dashboard @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 691 @foreach (var widget in widgets) 692 { 693 <div class="dashboard__widget"> 694 @Render(widget) 695 </div> 696 } 697 </div> 698 } 699 @using Dynamicweb.Rapido.Blocks.Components.General 700 @using Dynamicweb.Rapido.Blocks.Components 701 702 @helper RenderDashboardWidgetLink(DashboardWidgetLink settings) 703 { 704 if (!string.IsNullOrEmpty(settings.Link)) 705 { 706 var backgroundStyles = ""; 707 if (!string.IsNullOrEmpty(settings.BackgroundColor)) 708 { 709 backgroundStyles = "style=\"background-color:" + settings.BackgroundColor + "\""; 710 } 711 712 <a href="@settings.Link" class="widget widget--link @settings.CssClass dw-mod" @backgroundStyles title="@settings.Title" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 713 <div class="u-center-middle u-color-light"> 714 @if (settings.Icon != null) 715 { 716 settings.Icon.CssClass += "widget__icon"; 717 @Render(settings.Icon) 718 } 719 <div class="widget__title">@settings.Title</div> 720 </div> 721 </a> 722 } 723 } 724 @using Dynamicweb.Rapido.Blocks.Components.General 725 @using Dynamicweb.Rapido.Blocks.Components 726 727 @helper RenderDashboardWidgetCounter(DashboardWidgetCounter settings) 728 { 729 var backgroundStyles = ""; 730 if (!string.IsNullOrEmpty(settings.BackgroundColor)) 731 { 732 backgroundStyles = "style='background-color:" + settings.BackgroundColor + "'"; 733 } 734 735 <div class="widget @settings.CssClass dw-mod" @backgroundStyles @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 736 <div class="u-center-middle u-color-light"> 737 @if (settings.Icon != null) 738 { 739 settings.Icon.CssClass += "widget__icon"; 740 @Render(settings.Icon) 741 } 742 <div class="widget__counter">@settings.Count</div> 743 <div class="widget__title">@settings.Title</div> 744 </div> 745 </div> 746 } 747 @using System.Reflection 748 @using Dynamicweb.Rapido.Blocks.Components.General 749 @using Dynamicweb.Rapido.Blocks.Components 750 @using Dynamicweb.Core 751 752 @* Component *@ 753 754 @helper RenderLink(Link settings) 755 { 756 if (settings != null && !string.IsNullOrEmpty(settings.Href) && (!string.IsNullOrEmpty(settings.Title) || settings.Icon != null)) 757 { 758 Dictionary<string, string> attributes = new Dictionary<string, string>(); 759 List<string> classList = settings.CssClass != null ? settings.CssClass.Split(' ').ToList() : new List<string>(); 760 if (settings.Disabled) 761 { 762 attributes.Add("disabled", "true"); 763 classList.Add("disabled"); 764 } 765 766 if (!string.IsNullOrEmpty(settings.AltText)) 767 { 768 attributes.Add("title", settings.AltText); 769 } 770 else if (!string.IsNullOrEmpty(settings.Title)) 771 { 772 attributes.Add("title", settings.Title); 773 } 774 775 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 776 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 777 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onClick", settings.OnClick); } 778 attributes.Add("href", settings.Href); 779 780 if (settings.ButtonLayout != ButtonLayout.None) 781 { 782 classList.Add("btn"); 783 string btnLayout = Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower(); 784 if (btnLayout == "linkclean") 785 { 786 btnLayout = "link-clean"; //fix 787 } 788 classList.Add("btn--" + btnLayout); 789 } 790 791 if (settings.Icon == null) 792 { 793 settings.Icon = new Icon(); 794 } 795 settings.Icon.Label = settings.Title; 796 797 if (settings.Target == LinkTargetType.Blank && settings.Rel == LinkRelType.None) 798 { 799 settings.Rel = LinkRelType.Noopener; 800 } 801 if (settings.Target != LinkTargetType.None) 802 { 803 attributes.Add("target", "_" + Enum.GetName(typeof(LinkTargetType), settings.Target).ToLower()); 804 } 805 if (settings.Download) 806 { 807 attributes.Add("download", "true"); 808 } 809 if (settings.Rel != LinkRelType.None) 810 { 811 attributes.Add("rel", Enum.GetName(typeof(LinkRelType), settings.Rel).ToLower()); 812 } 813 814 <a class="@string.Join(" ", classList) dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@Render(settings.Icon)</a> 815 } 816 } 817 @using System.Reflection 818 @using Dynamicweb.Rapido.Blocks.Components 819 @using Dynamicweb.Rapido.Blocks.Components.General 820 @using Dynamicweb.Rapido.Blocks 821 822 823 @* Component *@ 824 825 @helper RenderRating(Rating settings) 826 { 827 if (settings.Score > 0) 828 { 829 int rating = settings.Score; 830 string iconType = "fa-star"; 831 832 switch (settings.Type.ToString()) { 833 case "Stars": 834 iconType = "fa-star"; 835 break; 836 case "Hearts": 837 iconType = "fa-heart"; 838 break; 839 case "Lemons": 840 iconType = "fa-lemon"; 841 break; 842 case "Bombs": 843 iconType = "fa-bomb"; 844 break; 845 } 846 847 <div class="u-ta-right"> 848 @for (int i = 0; i < settings.OutOf; i++) 849 { 850 <i class="@(rating > i ? "fas" : "far") @iconType"></i> 851 } 852 </div> 853 } 854 } 855 @using System.Reflection 856 @using Dynamicweb.Rapido.Blocks.Components.General 857 @using Dynamicweb.Rapido.Blocks.Components 858 859 860 @* Component *@ 861 862 @helper RenderSelectFieldOption(SelectFieldOption settings) 863 { 864 Dictionary<string, string> attributes = new Dictionary<string, string>(); 865 if (settings.Checked) { attributes.Add("selected", "true"); } 866 if (settings.Disabled) { attributes.Add("disabled", "true"); } 867 if (settings.Value != null) { attributes.Add("value", settings.Value); } 868 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 869 870 <option @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Label</option> 871 } 872 @using System.Reflection 873 @using Dynamicweb.Rapido.Blocks.Components.General 874 @using Dynamicweb.Rapido.Blocks.Components 875 876 877 @* Component *@ 878 879 @helper RenderNavigation(Navigation settings) { 880 @RenderNavigation(new 881 { 882 id = settings.Id, 883 cssclass = settings.CssClass, 884 startLevel = settings.StartLevel, 885 endlevel = settings.EndLevel, 886 expandmode = settings.Expandmode, 887 sitemapmode = settings.SitemapMode, 888 template = settings.Template 889 }) 890 } 891 @using Dynamicweb.Rapido.Blocks.Components.General 892 @using Dynamicweb.Rapido.Blocks.Components 893 894 895 @* Component *@ 896 897 @helper RenderBreadcrumbNavigation(BreadcrumbNavigation settings) { 898 settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id; 899 settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template; 900 settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel; 901 settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel; 902 settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode; 903 settings.SitemapMode = false; 904 905 @RenderNavigation(settings) 906 } 907 @using Dynamicweb.Rapido.Blocks.Components.General 908 @using Dynamicweb.Rapido.Blocks.Components 909 910 911 @* Component *@ 912 913 @helper RenderLeftNavigation(LeftNavigation settings) { 914 settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id; 915 settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template; 916 settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel; 917 settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel; 918 settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode; 919 920 <div class="grid__cell"> 921 @RenderNavigation(settings) 922 </div> 923 } 924 @using System.Reflection 925 @using Dynamicweb.Rapido.Blocks.Components.General 926 @using Dynamicweb.Core 927 928 @* Component *@ 929 930 @helper RenderHeading(Heading settings) 931 { 932 if (settings != null && !string.IsNullOrEmpty(settings.Title)) 933 { 934 string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : ""; 935 string tagName = settings.Level != 0 ? "h" + settings.Level.ToString() : "div"; 936 937 @("<" + tagName + " class=\"" + settings.CssClass + " dw-mod\" " + color + ">") 938 if (!string.IsNullOrEmpty(settings.Link)) 939 { 940 @Render(new Link { Href = settings.Link, Icon = settings.Icon, Title = settings.Title, ButtonLayout = ButtonLayout.None }) 941 } 942 else 943 { 944 if (settings.Icon == null) 945 { 946 settings.Icon = new Icon(); 947 } 948 settings.Icon.Label = settings.Title; 949 @Render(settings.Icon) 950 } 951 @("</" + tagName + ">"); 952 } 953 } 954 @using Dynamicweb.Rapido.Blocks.Components 955 @using Dynamicweb.Rapido.Blocks.Components.General 956 @using Dynamicweb.Rapido.Blocks 957 958 959 @* Component *@ 960 961 @helper RenderImage(Image settings) 962 { 963 if (settings.FilterPrimary != ImageFilter.None || settings.FilterSecondary != ImageFilter.None) 964 { 965 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>(); 966 if (!string.IsNullOrEmpty(settings.FilterColor)) { optionalAttributes.Add("style", "background-color: " + settings.FilterColor); } 967 968 if (settings.Caption != null) 969 { 970 @:<div> 971 } 972 973 var primaryFilterClass = settings.FilterPrimary.ToString().ToLower(); 974 var secondaryFilterClass = settings.FilterSecondary.ToString().ToLower(); 975 976 <div class="image-filter image-filter--@primaryFilterClass u-position-relative dw-mod" @ComponentMethods.AddAttributes(optionalAttributes)> 977 <div class="image-filter image-filter--@secondaryFilterClass dw-mod"> 978 @if (settings.Link != null) 979 { 980 <a href="@settings.Link"> 981 @RenderTheImage(settings) 982 </a> 983 } 984 else 985 { 986 @RenderTheImage(settings) 987 } 988 </div> 989 </div> 990 991 if (settings.Caption != null) 992 { 993 <span class="image-caption dw-mod">@settings.Caption</span> 994 @:</div> 995 } 996 } 997 else 998 { 999 if (settings.Caption != null) 1000 { 1001 @:<div> 1002 } 1003 if (!string.IsNullOrEmpty(settings.Link)) 1004 { 1005 <a href="@settings.Link"> 1006 @RenderTheImage(settings) 1007 </a> 1008 } 1009 else 1010 { 1011 @RenderTheImage(settings) 1012 } 1013 1014 if (settings.Caption != null) 1015 { 1016 <span class="image-caption dw-mod">@settings.Caption</span> 1017 @:</div> 1018 } 1019 } 1020 } 1021 1022 @helper RenderTheImage(Image settings) 1023 { 1024 if (settings != null) 1025 { 1026 string alternativeImage = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("AlternativeImage")) ? Pageview.AreaSettings.GetItem("Settings").GetFile("AlternativeImage").PathUrlEncoded : "/Images/missing_image.jpg"; 1027 string placeholderImage = "/Files/Images/placeholder.gif"; 1028 string imageEngine = "/Admin/Public/GetImage.ashx?"; 1029 1030 string imageStyle = ""; 1031 1032 switch (settings.Style) 1033 { 1034 case ImageStyle.Ball: 1035 imageStyle = "grid__cell-img--ball"; 1036 break; 1037 1038 case ImageStyle.Triangle: 1039 imageStyle = "grid__cell-img--triangle"; 1040 break; 1041 } 1042 1043 if (settings.Style == ImageStyle.Ball || settings.Style == ImageStyle.Circle || settings.Style == ImageStyle.Triangle) 1044 { 1045 settings.ImageDefault.Crop = settings.ImageDefault.Crop == 5 ? settings.ImageDefault.Crop = 0 : settings.ImageDefault.Crop; 1046 1047 if (settings.ImageDefault != null) 1048 { 1049 settings.ImageDefault.Height = settings.ImageDefault.Width; 1050 } 1051 if (settings.ImageMedium != null) 1052 { 1053 settings.ImageMedium.Height = settings.ImageMedium.Width; 1054 } 1055 if (settings.ImageSmall != null) 1056 { 1057 settings.ImageSmall.Height = settings.ImageSmall.Width; 1058 } 1059 } 1060 1061 string defaultImage = imageEngine; 1062 string imageSmall = ""; 1063 string imageMedium = ""; 1064 1065 if (settings.DisableImageEngine) 1066 { 1067 defaultImage = settings.Path; 1068 } 1069 else 1070 { 1071 if (settings.ImageDefault != null) 1072 { 1073 defaultImage += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageDefault); 1074 1075 if (settings.Path.GetType() != typeof(string)) 1076 { 1077 defaultImage += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 1078 defaultImage += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 1079 } 1080 else 1081 { 1082 defaultImage += settings.Path != null ? "Image=" + settings.Path : ""; 1083 } 1084 1085 defaultImage += "&AlternativeImage=" + alternativeImage; 1086 } 1087 1088 if (settings.ImageSmall != null) 1089 { 1090 imageSmall = "data-src-small=\"" + imageEngine; 1091 imageSmall += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageSmall); 1092 1093 if (settings.Path.GetType() != typeof(string)) 1094 { 1095 imageSmall += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 1096 imageSmall += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 1097 } 1098 else 1099 { 1100 imageSmall += settings.Path != null ? "Image=" + settings.Path : ""; 1101 } 1102 1103 imageSmall += "&alternativeImage=" + alternativeImage; 1104 1105 imageSmall += "\""; 1106 } 1107 1108 if (settings.ImageMedium != null) 1109 { 1110 imageMedium = "data-src-medium=\"" + imageEngine; 1111 imageMedium += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageMedium); 1112 1113 if (settings.Path.GetType() != typeof(string)) 1114 { 1115 imageMedium += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 1116 imageMedium += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 1117 } 1118 else 1119 { 1120 imageMedium += settings.Path != null ? "Image=" + settings.Path : ""; 1121 } 1122 1123 imageMedium += "&alternativeImage=" + alternativeImage; 1124 1125 imageMedium += "\""; 1126 } 1127 } 1128 1129 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>(); 1130 if (!string.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick); } 1131 if (!string.IsNullOrEmpty(settings.Title)) 1132 { 1133 optionalAttributes.Add("alt", settings.Title); 1134 optionalAttributes.Add("title", settings.Title); 1135 } 1136 1137 if (settings.DisableLazyLoad) 1138 { 1139 <img id="@settings.Id" class="@imageStyle @settings.CssClass dw-mod" src="@defaultImage" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 1140 } 1141 else 1142 { 1143 <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) /> 1144 } 1145 } 1146 } 1147 @using System.Reflection 1148 @using Dynamicweb.Rapido.Blocks.Components.General 1149 @using Dynamicweb.Rapido.Blocks.Components 1150 1151 @* Component *@ 1152 1153 @helper RenderFileField(FileField settings) 1154 { 1155 var attributes = new Dictionary<string, string>(); 1156 if (string.IsNullOrEmpty(settings.Id)) 1157 { 1158 settings.Id = Guid.NewGuid().ToString("N"); 1159 } 1160 1161 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1162 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1163 if (settings.Required) { attributes.Add("required", "true"); } 1164 if (settings.Multiple) { attributes.Add("multiple", "true"); } 1165 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1166 if (string.IsNullOrEmpty(settings.ChooseFileText)) 1167 { 1168 settings.ChooseFileText = Translate("Choose file"); 1169 } 1170 if (string.IsNullOrEmpty(settings.NoFilesChosenText)) 1171 { 1172 settings.NoFilesChosenText = Translate("No files chosen..."); 1173 } 1174 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1175 1176 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; } 1177 1178 string setValueToFakeInput = "FileUpload.setValueToFakeInput(this)"; 1179 attributes.Add("onchange", setValueToFakeInput + (!string.IsNullOrEmpty(settings.OnChange) ? settings.OnChange : "")); 1180 1181 attributes.Add("type", "file"); 1182 if (settings.Value != null) { attributes.Add("value", settings.Value); } 1183 settings.CssClass = "u-full-width " + settings.CssClass; 1184 1185 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1186 1187 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod"> 1188 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null ) 1189 { 1190 <div class="u-full-width"> 1191 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } 1192 @if (settings.Link != null) { 1193 <div class="u-pull--right"> 1194 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } 1195 @Render(settings.Link) 1196 </div> 1197 } 1198 </div> 1199 1200 } 1201 1202 @if (!string.IsNullOrEmpty(settings.HelpText)) 1203 { 1204 <small class="form__help-text">@settings.HelpText</small> 1205 } 1206 1207 <div class="form__field-combi file-input u-no-margin dw-mod"> 1208 <input @ComponentMethods.AddAttributes(resultAttributes) class="file-input__real-input" data-no-files-text="@settings.NoFilesChosenText" data-many-files-text="@Translate("files")" /> 1209 <label for="@settings.Id" class="file-input__btn btn--secondary btn dw-mod">@settings.ChooseFileText</label> 1210 <label for="@settings.Id" class="@settings.CssClass file-input__fake-input js-fake-input dw-mod">@settings.NoFilesChosenText</label> 1211 @if (settings.UploadButton != null) 1212 { 1213 settings.UploadButton.CssClass += " btn--condensed u-no-margin"; 1214 @Render(settings.UploadButton) 1215 } 1216 </div> 1217 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1218 </div> 1219 } 1220 @using System.Reflection 1221 @using Dynamicweb.Rapido.Blocks.Components.General 1222 @using Dynamicweb.Rapido.Blocks.Components 1223 @using Dynamicweb.Core 1224 @using System.Linq 1225 1226 @* Component *@ 1227 1228 @helper RenderDateTimeField(DateTimeField settings) 1229 { 1230 if (string.IsNullOrEmpty(settings.Id)) 1231 { 1232 settings.Id = Guid.NewGuid().ToString("N"); 1233 } 1234 1235 var textField = new TextField { 1236 Name = settings.Name, 1237 Id = settings.Id, 1238 Label = settings.Label, 1239 HelpText = settings.HelpText, 1240 Value = settings.Value, 1241 Disabled = settings.Disabled, 1242 Required = settings.Required, 1243 ErrorMessage = settings.ErrorMessage, 1244 CssClass = settings.CssClass, 1245 WrapperCssClass = settings.WrapperCssClass, 1246 OnChange = settings.OnChange, 1247 OnClick = settings.OnClick, 1248 Link = settings.Link, 1249 ExtraAttributes = settings.ExtraAttributes, 1250 // 1251 Placeholder = settings.Placeholder 1252 }; 1253 1254 @Render(textField) 1255 1256 List<string> jsAttributes = new List<string>(); 1257 1258 jsAttributes.Add("mode: '" + Enum.GetName(typeof(DateTimeFieldMode), settings.Mode).ToLower() + "'"); 1259 1260 if (!string.IsNullOrEmpty(settings.DateFormat)) 1261 { 1262 jsAttributes.Add("dateFormat: '" + settings.DateFormat + "'"); 1263 } 1264 if (!string.IsNullOrEmpty(settings.MinDate)) 1265 { 1266 jsAttributes.Add("minDate: '" + settings.MinDate + "'"); 1267 } 1268 if (!string.IsNullOrEmpty(settings.MaxDate)) 1269 { 1270 jsAttributes.Add("maxDate: '" + settings.MaxDate + "'"); 1271 } 1272 if (settings.IsInline) 1273 { 1274 jsAttributes.Add("inline: " + Converter.ToString(settings.IsInline).ToLower()); 1275 } 1276 if (settings.EnableTime) 1277 { 1278 jsAttributes.Add("enableTime: " + Converter.ToString(settings.EnableTime).ToLower()); 1279 } 1280 if (settings.EnableWeekNumbers) 1281 { 1282 jsAttributes.Add("weekNumbers: " + Converter.ToString(settings.EnableWeekNumbers).ToLower()); 1283 } 1284 1285 jsAttributes.AddRange(settings.GetFlatPickrOptions().Select(x => x.Key + ": " + x.Value)); 1286 1287 <script> 1288 document.addEventListener("DOMContentLoaded", function () { 1289 flatpickr("#@textField.Id", { 1290 @string.Join(",", jsAttributes) 1291 }); 1292 }); 1293 </script> 1294 } 1295 @using System.Reflection 1296 @using Dynamicweb.Rapido.Blocks.Components.General 1297 @using Dynamicweb.Rapido.Blocks.Components 1298 1299 @* Component *@ 1300 1301 @helper RenderTextField(TextField settings) 1302 { 1303 var attributes = new Dictionary<string, string>(); 1304 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1305 { 1306 settings.Id = Guid.NewGuid().ToString("N"); 1307 } 1308 1309 /*base settings*/ 1310 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1311 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1312 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1313 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1314 if (settings.Required) { attributes.Add("required", "true"); } 1315 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1316 /*end*/ 1317 1318 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 1319 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 1320 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 1321 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 1322 if (settings.MaxLength != 0) { attributes.Add("maxlength", settings.MaxLength.ToString()); } 1323 if (!string.IsNullOrEmpty(settings.Placeholder)) { attributes.Add("placeholder", settings.Placeholder); } 1324 attributes.Add("type", Enum.GetName(typeof(TextFieldType), settings.Type).ToLower()); 1325 if (settings.Type == TextFieldType.Password) { attributes.Add("autocomplete", "off"); }; 1326 if (settings.Value != null) { attributes.Add("value", settings.Value); } 1327 1328 settings.CssClass = "u-full-width " + settings.CssClass; 1329 1330 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; } 1331 1332 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1333 1334 string noMargin = "u-no-margin"; 1335 if (!settings.ReadOnly) { 1336 noMargin = ""; 1337 } 1338 1339 <div class="form__field-group u-full-width @noMargin @settings.WrapperCssClass dw-mod"> 1340 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null ) 1341 { 1342 <div class="u-full-width"> 1343 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } 1344 @if (settings.Link != null) { 1345 settings.Link.ButtonLayout = ButtonLayout.LinkClean; 1346 1347 <div class="u-pull--right"> 1348 @Render(settings.Link) 1349 </div> 1350 } 1351 </div> 1352 1353 } 1354 1355 @if (!string.IsNullOrEmpty(settings.HelpText)) 1356 { 1357 <small class="form__help-text">@settings.HelpText</small> 1358 } 1359 1360 @if (settings.ActionButton != null) 1361 { 1362 settings.ActionButton.CssClass += " btn--condensed u-no-margin"; 1363 <div class="form__field-combi u-no-margin dw-mod"> 1364 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1365 @Render(settings.ActionButton) 1366 </div> 1367 } 1368 else 1369 { 1370 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1371 } 1372 1373 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1374 </div> 1375 } 1376 @using System.Reflection 1377 @using Dynamicweb.Rapido.Blocks.Components.General 1378 @using Dynamicweb.Rapido.Blocks.Components 1379 1380 @* Component *@ 1381 1382 @helper RenderNumberField(NumberField settings) 1383 { 1384 var attributes = new Dictionary<string, string>(); 1385 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1386 { 1387 settings.Id = Guid.NewGuid().ToString("N"); 1388 } 1389 1390 /*base settings*/ 1391 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1392 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1393 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1394 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1395 if (settings.Required) { attributes.Add("required", "true"); } 1396 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1397 /*end*/ 1398 1399 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 1400 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 1401 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 1402 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 1403 if (settings.Max != null) { attributes.Add("max", settings.Max.ToString()); } 1404 if (settings.Min != null) { attributes.Add("min", settings.Min.ToString()); } 1405 if (settings.Step != 0) { attributes.Add("step", settings.Step.ToString()); } 1406 if (settings.Value != null && !string.IsNullOrEmpty(settings.Value.ToString())) { attributes.Add("value", settings.Value.ToString()); } 1407 attributes.Add("type", "number"); 1408 1409 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1410 1411 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod"> 1412 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null ) 1413 { 1414 <div class="u-full-width"> 1415 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } 1416 @if (settings.Link != null) { 1417 <div class="u-pull--right"> 1418 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } 1419 @Render(settings.Link) 1420 </div> 1421 } 1422 </div> 1423 1424 } 1425 1426 @if (!string.IsNullOrEmpty(settings.HelpText)) 1427 { 1428 <small class="form__help-text">@settings.HelpText</small> 1429 } 1430 1431 @if (settings.ActionButton != null) 1432 { 1433 settings.ActionButton.CssClass += " btn--condensed u-no-margin"; 1434 <div class="form__field-combi u-no-margin dw-mod"> 1435 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1436 @Render(settings.ActionButton) 1437 </div> 1438 } 1439 else 1440 { 1441 <div class="form__field-combi u-no-margin dw-mod"> 1442 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1443 </div> 1444 } 1445 1446 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1447 </div> 1448 } 1449 @using System.Reflection 1450 @using Dynamicweb.Rapido.Blocks.Components.General 1451 @using Dynamicweb.Rapido.Blocks.Components 1452 1453 1454 @* Component *@ 1455 1456 @helper RenderTextareaField(TextareaField settings) 1457 { 1458 Dictionary<string, string> attributes = new Dictionary<string, string>(); 1459 string id = settings.Id; 1460 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(id)) 1461 { 1462 id = Guid.NewGuid().ToString("N"); 1463 } 1464 1465 if (!string.IsNullOrEmpty(id)) { attributes.Add("id", id); } 1466 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1467 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 1468 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 1469 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 1470 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1471 if (!string.IsNullOrEmpty(settings.Placeholder)) { attributes.Add("placeholder", settings.Placeholder); } 1472 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1473 if (settings.Required) { attributes.Add("required", "true"); } 1474 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 1475 if (settings.MaxLength != 0) { attributes.Add("maxlength", settings.MaxLength.ToString()); } 1476 if (settings.Rows != 0) { attributes.Add("rows", settings.Rows.ToString()); } 1477 attributes.Add("name", settings.Name); 1478 1479 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; } 1480 1481 <div class="form__field-group @settings.WrapperCssClass dw-mod"> 1482 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null ) 1483 { 1484 <div class="u-full-width"> 1485 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } 1486 @if (settings.Link != null) { 1487 <div class="u-pull--right"> 1488 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } 1489 @Render(settings.Link) 1490 </div> 1491 } 1492 </div> 1493 } 1494 1495 @if (!string.IsNullOrEmpty(settings.HelpText)) 1496 { 1497 <small class="form__help-text">@settings.HelpText</small> 1498 } 1499 1500 <textarea class="u-full-width @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Value</textarea> 1501 1502 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1503 </div> 1504 } 1505 @using System.Reflection 1506 @using Dynamicweb.Rapido.Blocks.Components.General 1507 @using Dynamicweb.Rapido.Blocks.Components 1508 1509 1510 @* Component *@ 1511 1512 @helper RenderHiddenField(HiddenField settings) { 1513 var attributes = new Dictionary<string, string>(); 1514 attributes.Add("type", "hidden"); 1515 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1516 if (settings.Value != null) { attributes.Add("value", settings.Value); } 1517 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1518 1519 <input @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)/> 1520 } 1521 @using System.Reflection 1522 @using Dynamicweb.Rapido.Blocks.Components.General 1523 @using Dynamicweb.Rapido.Blocks.Components 1524 1525 @* Component *@ 1526 1527 @helper RenderCheckboxField(CheckboxField settings) 1528 { 1529 var attributes = new Dictionary<string, string>(); 1530 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1531 { 1532 settings.Id = Guid.NewGuid().ToString("N"); 1533 } 1534 1535 /*base settings*/ 1536 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1537 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1538 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1539 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1540 if (settings.Required) { attributes.Add("required", "true"); } 1541 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1542 /*end*/ 1543 1544 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; } 1545 1546 attributes.Add("type", "checkbox"); 1547 if (settings.Checked) { attributes.Add("checked", "true"); } 1548 settings.CssClass = "form__control " + settings.CssClass; 1549 if (settings.Value != null) { attributes.Add("value", settings.Value); } 1550 1551 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1552 1553 <div class="form__field-group @settings.WrapperCssClass dw-mod"> 1554 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1555 @if (!string.IsNullOrEmpty(settings.Label)) 1556 { 1557 <label for="@settings.Id" class="dw-mod">@settings.Label</label> 1558 } 1559 1560 @if (settings.Link != null) { 1561 <span> 1562 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } 1563 @Render(settings.Link) 1564 </span> 1565 } 1566 1567 @if (!string.IsNullOrEmpty(settings.HelpText)) 1568 { 1569 <small class="form__help-text checkbox-help dw-mod">@settings.HelpText</small> 1570 } 1571 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1572 </div> 1573 } 1574 @using System.Reflection 1575 @using Dynamicweb.Rapido.Blocks.Components.General 1576 @using Dynamicweb.Rapido.Blocks.Components 1577 1578 1579 @* Component *@ 1580 1581 @helper RenderCheckboxListField(CheckboxListField settings) 1582 { 1583 <div class="form__field-group @settings.WrapperCssClass u-margin-bottom dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1584 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null ) 1585 { 1586 <div class="u-full-width"> 1587 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } 1588 @if (settings.Link != null) { 1589 <div class="u-pull--right"> 1590 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } 1591 @Render(settings.Link) 1592 </div> 1593 } 1594 </div> 1595 1596 } 1597 1598 <div class="u-pull--left"> 1599 @if (!string.IsNullOrEmpty(settings.HelpText)) 1600 { 1601 <small class="form__help-text">@settings.HelpText</small> 1602 } 1603 1604 @foreach (var item in settings.Options) 1605 { 1606 if (settings.Required) 1607 { 1608 item.Required = true; 1609 } 1610 if (settings.Disabled) 1611 { 1612 item.Disabled = true; 1613 } 1614 if (!string.IsNullOrEmpty(settings.Name)) 1615 { 1616 item.Name = settings.Name; 1617 } 1618 if (!string.IsNullOrEmpty(settings.CssClass)) 1619 { 1620 item.CssClass += settings.CssClass; 1621 } 1622 1623 /* value is not supported */ 1624 1625 if (!string.IsNullOrEmpty(settings.OnClick)) 1626 { 1627 item.OnClick += settings.OnClick; 1628 } 1629 if (!string.IsNullOrEmpty(settings.OnChange)) 1630 { 1631 item.OnChange += settings.OnChange; 1632 } 1633 @Render(item) 1634 } 1635 1636 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1637 </div> 1638 1639 </div> 1640 } 1641 @using Dynamicweb.Rapido.Blocks.Components.General 1642 1643 @* Component *@ 1644 1645 @helper RenderSearch(Search settings) 1646 { 1647 var searchValue = HttpContext.Current.Request.QueryString.Get(settings.SearchParameter) ?? ""; 1648 var groupValue = HttpContext.Current.Request.QueryString.Get(settings.GroupsParameter) ?? ""; 1649 1650 if (string.IsNullOrEmpty(settings.Id)) 1651 { 1652 settings.Id = Guid.NewGuid().ToString("N"); 1653 } 1654 1655 var resultAttributes = new Dictionary<string, string>(); 1656 1657 if (settings.PageSize != 0) 1658 { 1659 resultAttributes.Add("data-page-size", settings.PageSize.ToString()); 1660 } 1661 if (!string.IsNullOrEmpty(settings.GroupItemsFeedUrl)) 1662 { 1663 resultAttributes.Add("data-groups-feed-url", settings.GroupItemsFeedUrl); 1664 if (!string.IsNullOrEmpty(groupValue)) 1665 { 1666 resultAttributes.Add("data-selected-group", groupValue); 1667 } 1668 if (!string.IsNullOrEmpty(settings.GroupsParameter)) 1669 { 1670 resultAttributes.Add("data-groups-parameter", settings.GroupsParameter); 1671 } 1672 } 1673 resultAttributes.Add("data-force-init", "true"); 1674 if (settings.GoToFirstSearchResultOnEnter) 1675 { 1676 resultAttributes.Add("data-go-to-first-search-result-on-enter", settings.GoToFirstSearchResultOnEnter.ToString().ToLower()); 1677 } 1678 if (!string.IsNullOrEmpty(settings.SearchParameter)) 1679 { 1680 resultAttributes.Add("data-search-parameter", settings.SearchParameter); 1681 } 1682 resultAttributes.Add("data-search-feed-url", settings.SearchData.SearchFeedUrl); 1683 resultAttributes.Add("data-results-template-id", settings.SearchData.ResultsTemplateId); 1684 1685 if (settings.SecondSearchData != null) 1686 { 1687 resultAttributes.Add("data-second-search-feed-url", settings.SecondSearchData.SearchFeedUrl); 1688 resultAttributes.Add("data-second-results-template-id", settings.SecondSearchData.ResultsTemplateId); 1689 } 1690 if (!string.IsNullOrEmpty(settings.ResultsPageUrl)) 1691 { 1692 resultAttributes.Add("data-results-page-url", settings.ResultsPageUrl); 1693 } 1694 1695 resultAttributes = resultAttributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1696 1697 string searchFieldCss = (settings.SearchButton == null) ? "search--with-icon" : ""; 1698 1699 <div class="search @settings.CssClass @searchFieldCss js-search-data-source dw-mod" id="@settings.Id" @ComponentMethods.AddAttributes(resultAttributes)> 1700 @if (!string.IsNullOrEmpty(settings.GroupItemsFeedUrl)) 1701 { 1702 <button type="button" class="search__groups-btn dw-mod js-search-groups-btn">@Translate("All")</button> 1703 <ul class="dropdown dropdown--absolute-position dw-mod search__groups-results js-search-groups-list"></ul> 1704 } 1705 1706 <input type="text" class="search__field dw-mod js-search-field" placeholder="@settings.Placeholder" value="@searchValue"> 1707 1708 <div class="dropdown dropdown--absolute-position search__results dw-mod js-search-results @(settings.SecondSearchData != null ? "search__results--combined" : "")"> 1709 @if (settings.SecondSearchData != null) 1710 { 1711 <div class="search__column search__column--products dw-mod"> 1712 <div class="search__column-header dw-mod">@Translate("Products")</div> 1713 <ul class="search__results-list dw-mod js-search-results-list" id="@(settings.Id)_ResultsList"></ul> 1714 @if (!string.IsNullOrEmpty(settings.SearchData.ResultsPageUrl)) 1715 { 1716 @Render(new Link { 1717 Title = Translate("View all"), 1718 CssClass = "js-view-all-button u-margin", 1719 Href = settings.SearchData.ResultsPageUrl 1720 }); 1721 } 1722 </div> 1723 <div class="search__column search__column--pages dw-mod"> 1724 <div class="search__column-header">@Translate("Pages")</div> 1725 <ul class="search__results-list dw-mod js-search-results-second-list" id="@(settings.Id)_SecondResultsList"></ul> 1726 @if (!string.IsNullOrEmpty(settings.SecondSearchData.ResultsPageUrl)) 1727 { 1728 @Render(new Link 1729 { 1730 Title = Translate("View all"), 1731 CssClass = "js-view-all-button u-margin", 1732 Href = settings.SecondSearchData.ResultsPageUrl 1733 }); 1734 } 1735 </div> 1736 } 1737 else 1738 { 1739 <div class="search__column search__column--only dw-mod"> 1740 <ul class="search__results-list dw-mod js-search-results-list" id="@(settings.Id)_ResultsList"></ul> 1741 @if (!string.IsNullOrEmpty(settings.SearchData.ResultsPageUrl)) 1742 { 1743 @Render(new Link { 1744 Title = Translate("View all"), 1745 CssClass = "js-view-all-button u-margin", 1746 Href = settings.SearchData.ResultsPageUrl 1747 }); 1748 } 1749 </div> 1750 } 1751 </div> 1752 1753 @if (settings.SearchButton != null) 1754 { 1755 settings.SearchButton.CssClass += " search__btn js-search-btn"; 1756 if (settings.RenderDefaultSearchIcon) 1757 { 1758 settings.SearchButton.Icon = new Icon { Name = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue }; 1759 } 1760 @Render(settings.SearchButton); 1761 } 1762 </div> 1763 } 1764 @using System.Reflection 1765 @using Dynamicweb.Rapido.Blocks.Components.General 1766 @using Dynamicweb.Rapido.Blocks.Components 1767 1768 1769 @* Component *@ 1770 1771 @helper RenderSelectField(SelectField settings) 1772 { 1773 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1774 { 1775 settings.Id = Guid.NewGuid().ToString("N"); 1776 } 1777 1778 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod"> 1779 @if (!string.IsNullOrEmpty(settings.Label) || settings.Link != null ) 1780 { 1781 <div class="u-full-width"> 1782 @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="u-pull--left">@settings.Label</label> } 1783 @if (settings.Link != null) { 1784 <div class="u-pull--right"> 1785 @{ settings.Link.ButtonLayout = ButtonLayout.LinkClean; } 1786 @Render(settings.Link) 1787 </div> 1788 } 1789 </div> 1790 } 1791 1792 @if (!string.IsNullOrEmpty(settings.HelpText)) 1793 { 1794 <small class="form__help-text">@settings.HelpText</small> 1795 } 1796 1797 @if (settings.ActionButton != null) 1798 { 1799 settings.ActionButton.CssClass += " btn--condensed u-no-margin"; 1800 <div class="form__field-combi u-no-margin dw-mod"> 1801 @RenderSelectBase(settings) 1802 @Render(settings.ActionButton) 1803 </div> 1804 } 1805 else 1806 { 1807 @RenderSelectBase(settings) 1808 } 1809 1810 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1811 </div> 1812 } 1813 1814 @helper RenderSelectBase(SelectField settings) 1815 { 1816 var attributes = new Dictionary<string, string>(); 1817 1818 /*base settings*/ 1819 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1820 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1821 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1822 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1823 if (settings.Required) { attributes.Add("required", "true"); } 1824 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1825 /*end*/ 1826 1827 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1828 1829 <select @ComponentMethods.AddAttributes(resultAttributes) class="u-full-width @settings.CssClass dw-mod"> 1830 @if (settings.Default != null) 1831 { 1832 @Render(settings.Default) 1833 } 1834 1835 @foreach (var item in settings.Options) 1836 { 1837 if (settings.Value != null) { 1838 item.Checked = item.Value == settings.Value; 1839 } 1840 @Render(item) 1841 } 1842 </select> 1843 } 1844 @using System.Reflection 1845 @using Dynamicweb.Rapido.Blocks.Components.General 1846 @using Dynamicweb.Rapido.Blocks.Components 1847 1848 @* Component *@ 1849 1850 @helper RenderRadioButtonField(RadioButtonField settings) 1851 { 1852 var attributes = new Dictionary<string, string>(); 1853 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1854 { 1855 settings.Id = Guid.NewGuid().ToString("N"); 1856 } 1857 1858 /*base settings*/ 1859 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1860 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1861 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1862 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1863 if (settings.Required) { attributes.Add("required", "true"); } 1864 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1865 /*end*/ 1866 1867 attributes.Add("type", "radio"); 1868 if (settings.Checked) { attributes.Add("checked", "true"); } 1869 settings.CssClass = "form__control " + settings.CssClass; 1870 if (settings.Value != null) { attributes.Add("value", settings.Value); } 1871 1872 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1873 1874 <div class="form__field-group @settings.WrapperCssClass dw-mod"> 1875 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1876 @if (!string.IsNullOrEmpty(settings.Label)) 1877 { 1878 <label for="@settings.Id" class="dw-mod">@settings.Label</label> 1879 } 1880 @if (!string.IsNullOrEmpty(settings.HelpText)) 1881 { 1882 <small class="form__help-text">@settings.HelpText</small> 1883 } 1884 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1885 </div> 1886 } 1887 @using System.Reflection 1888 @using Dynamicweb.Rapido.Blocks.Components.General 1889 @using Dynamicweb.Rapido.Blocks.Components 1890 1891 1892 @* Component *@ 1893 1894 @helper RenderRadioButtonListField(RadioButtonListField settings) 1895 { 1896 if (settings.Required && !String.IsNullOrEmpty(settings.Label)) { settings.Label += " <span class=\"required dw-mod\">*</span>"; } 1897 1898 <div class="form__field-group @settings.WrapperCssClass u-margin-bottom dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1899 @if (!string.IsNullOrEmpty(settings.Label)) 1900 { 1901 <label>@settings.Label</label> 1902 } 1903 @if (!string.IsNullOrEmpty(settings.HelpText)) 1904 { 1905 <small class="form__help-text">@settings.HelpText</small> 1906 } 1907 1908 @foreach (var item in settings.Options) 1909 { 1910 if (settings.Required) 1911 { 1912 item.Required = true; 1913 } 1914 if (settings.Disabled) 1915 { 1916 item.Disabled = true; 1917 } 1918 if (!string.IsNullOrEmpty(settings.Name)) 1919 { 1920 item.Name = settings.Name; 1921 } 1922 if (settings.Value != null && settings.Value == item.Value) 1923 { 1924 item.Checked = true; 1925 } 1926 if (!string.IsNullOrEmpty(settings.OnClick)) 1927 { 1928 item.OnClick += settings.OnClick; 1929 } 1930 if (!string.IsNullOrEmpty(settings.OnChange)) 1931 { 1932 item.OnChange += settings.OnChange; 1933 } 1934 if (!string.IsNullOrEmpty(settings.CssClass)) 1935 { 1936 item.CssClass += settings.CssClass; 1937 } 1938 @Render(item) 1939 } 1940 1941 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1942 </div> 1943 } 1944 @using System.Reflection 1945 @using Dynamicweb.Rapido.Blocks.Components.General 1946 @using Dynamicweb.Rapido.Blocks.Components 1947 1948 1949 @* Component *@ 1950 1951 @helper RenderNotificationMessage(NotificationMessage settings) 1952 { 1953 if (!string.IsNullOrEmpty(settings.Message)) 1954 { 1955 var attributes = new Dictionary<string, string>(); 1956 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1957 1958 string messageTypeClass = Enum.GetName(typeof(NotificationMessageType), settings.MessageType).ToLower(); 1959 string messageLayoutClass = Enum.GetName(typeof(NotificationMessageLayout), settings.MessageLayout).ToLower(); 1960 string minHeightClass = settings.Icon != null ? "u-min-h70px" : ""; 1961 1962 <div class="notification-message-@messageTypeClass notification-message-@messageLayoutClass @messageLayoutClass @minHeightClass @settings.CssClass u-full-width dw-mod" @ComponentMethods.AddAttributes(attributes)> 1963 @if (settings.Icon != null) { 1964 settings.Icon.Label = !string.IsNullOrEmpty(settings.Icon.Label) ? settings.Message + settings.Icon.Label : settings.Message; 1965 @Render(settings.Icon) 1966 } else { 1967 @settings.Message 1968 } 1969 </div> 1970 } 1971 } 1972 @using Dynamicweb.Rapido.Blocks.Components.General 1973 1974 1975 @* Component *@ 1976 1977 @helper RenderHandlebarsRoot(HandlebarsRoot settings) { 1978 string preRender = !String.IsNullOrEmpty(settings.PreRenderScriptTemplate) ? "data-pre-render-template=\"" + settings.PreRenderScriptTemplate + "\"" : ""; 1979 1980 <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> 1981 @if (settings.SubBlocks != null) { 1982 @RenderBlockList(settings.SubBlocks) 1983 } 1984 </div> 1985 } 1986 @using System.Reflection 1987 @using Dynamicweb.Rapido.Blocks.Components.General 1988 @using Dynamicweb.Rapido.Blocks.Components 1989 @using System.Text.RegularExpressions 1990 1991 1992 @* Component *@ 1993 1994 @helper RenderSticker(Sticker settings) { 1995 if (!String.IsNullOrEmpty(settings.Title)) { 1996 string size = settings.Size.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Size.ToString().ToLower() : ""; 1997 string style = settings.Style.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Style.ToString().ToLower() : ""; 1998 1999 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>(); 2000 if (!String.IsNullOrEmpty(settings.Color) || !String.IsNullOrEmpty(settings.BackgroundColor)) { 2001 string styleTag = !String.IsNullOrEmpty(settings.Color) ? "color: " + settings.Color + "; " : ""; 2002 styleTag += !String.IsNullOrEmpty(settings.BackgroundColor) ? "background-color: " + settings.BackgroundColor + "; " : ""; 2003 optionalAttributes.Add("style", styleTag); 2004 } 2005 2006 <div class="stickers-container__tag @size @style @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Title</div> 2007 } 2008 } 2009 2010 @using System.Reflection 2011 @using Dynamicweb.Rapido.Blocks.Components.General 2012 @using Dynamicweb.Rapido.Blocks.Components 2013 2014 2015 @* Component *@ 2016 2017 @helper RenderStickersCollection(StickersCollection settings) 2018 { 2019 if (settings.Stickers.Count > 0) 2020 { 2021 string position = "stickers-container--" + Regex.Replace(settings.Position.ToString(), "([a-z])([A-Z])", "$1-$2").ToLower(); 2022 2023 <div class="stickers-container @position @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 2024 @foreach (Sticker sticker in settings.Stickers) 2025 { 2026 @Render(sticker) 2027 } 2028 </div> 2029 } 2030 } 2031 2032 @using Dynamicweb.Rapido.Blocks.Components.General 2033 2034 2035 @* Component *@ 2036 2037 @helper RenderForm(Form settings) { 2038 if (settings != null) 2039 { 2040 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>(); 2041 if (!string.IsNullOrEmpty(settings.Action)) { optionalAttributes.Add("action", settings.Action); }; 2042 if (!string.IsNullOrEmpty(settings.Name)) { optionalAttributes.Add("name", settings.Name); }; 2043 if (!string.IsNullOrEmpty(settings.OnSubmit)) { optionalAttributes.Add("onsubmit", settings.OnSubmit); }; 2044 var enctypes = new Dictionary<string, string> 2045 { 2046 { "multipart", "multipart/form-data" }, 2047 { "text", "text/plain" }, 2048 { "application", "application/x-www-form-urlencoded" } 2049 }; 2050 if (settings.Enctype != FormEnctype.none) { optionalAttributes.Add("enctype", enctypes[Enum.GetName(typeof(FormEnctype), settings.Enctype).ToLower()]); }; 2051 optionalAttributes.Add("method", settings.Method.ToString()); 2052 2053 if (!string.IsNullOrEmpty(settings.FormStartMarkup)) 2054 { 2055 @settings.FormStartMarkup 2056 } 2057 else 2058 { 2059 @:<form class="@settings.CssClass u-no-margin dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 2060 } 2061 2062 foreach (var field in settings.GetFields()) 2063 { 2064 @Render(field) 2065 } 2066 2067 @:</form> 2068 } 2069 } 2070 @using System.Reflection 2071 @using Dynamicweb.Rapido.Blocks.Components.General 2072 @using Dynamicweb.Rapido.Blocks.Components 2073 2074 2075 @* Component *@ 2076 2077 @helper RenderText(Text settings) 2078 { 2079 @settings.Content 2080 } 2081 @using System.Reflection 2082 @using Dynamicweb.Rapido.Blocks.Components.General 2083 @using Dynamicweb.Rapido.Blocks.Components 2084 2085 2086 @* Component *@ 2087 2088 @helper RenderContentModule(ContentModule settings) { 2089 if (!string.IsNullOrEmpty(settings.Content)) 2090 { 2091 @settings.Content 2092 } 2093 } 2094 @using System.Reflection 2095 @using Dynamicweb.Rapido.Blocks.Components.General 2096 @using Dynamicweb.Rapido.Blocks.Components 2097 2098 2099 @* Component *@ 2100 2101 @helper RenderModal(Modal settings) { 2102 if (settings != null) 2103 { 2104 string modalId = !string.IsNullOrEmpty(settings.Id) ? settings.Id : Guid.NewGuid().ToString("N"); 2105 2106 string onchange = !string.IsNullOrEmpty(settings.OnClose) ? "onchange=\"if(!this.checked){" + settings.OnClose + "}\"" : ""; 2107 2108 <input type="checkbox" id="@(modalId)ModalTrigger" class="modal-trigger" @onchange /> 2109 2110 <div class="modal-container"> 2111 @if (!settings.DisableDarkOverlay) 2112 { 2113 <label for="@(modalId)ModalTrigger" id="@(modalId)ModalOverlay" class="modal-overlay"></label> 2114 } 2115 <div class="modal modal--@settings.Width.ToString().ToLower() modal-height--@settings.Height.ToString().ToLower()" id="@(modalId)Modal"> 2116 @if (settings.Heading != null) 2117 { 2118 if (!string.IsNullOrEmpty(settings.Heading.Title)) 2119 { 2120 <div class="modal__header"> 2121 @Render(settings.Heading) 2122 </div> 2123 } 2124 } 2125 <div class="modal__body @(settings.Width.ToString().ToLower() == "full" ? "modal__body--full" : "")"> 2126 @if (!string.IsNullOrEmpty(settings.BodyText)) 2127 { 2128 @settings.BodyText 2129 } 2130 @if (settings.BodyTemplate != null) 2131 { 2132 @settings.BodyTemplate 2133 } 2134 @{ 2135 var actions = settings.GetActions(); 2136 } 2137 </div> 2138 @if (actions.Length > 0) 2139 { 2140 <div class="modal__footer"> 2141 @foreach (var action in actions) 2142 { 2143 if (Pageview.Device.ToString() != "Mobile") { 2144 action.CssClass += " u-no-margin"; 2145 } else { 2146 action.CssClass += " u-full-width u-margin-bottom"; 2147 } 2148 2149 @Render(action) 2150 } 2151 </div> 2152 } 2153 <label class="modal__close-btn" for="@(modalId)ModalTrigger"></label> 2154 </div> 2155 </div> 2156 } 2157 } 2158 @using Dynamicweb.Rapido.Blocks.Components.General 2159 2160 @* Component *@ 2161 2162 @helper RenderMediaListItem(MediaListItem settings) 2163 { 2164 <div class="media-list-item @settings.CssClass dw-mod" @(!string.IsNullOrEmpty(settings.Id) ? "id=\"" + settings.Id + "\"" : "")> 2165 @if (!string.IsNullOrEmpty(settings.Label)) 2166 { 2167 if (!string.IsNullOrEmpty(settings.Link)) 2168 { 2169 @Render(new Link 2170 { 2171 Href = settings.Link, 2172 CssClass = "media-list-item__sticker dw-mod", 2173 ButtonLayout = ButtonLayout.None, 2174 Title = settings.Label, 2175 OnClick = !string.IsNullOrEmpty(settings.OnClick) ? settings.OnClick : "" 2176 }) 2177 } 2178 else if (!string.IsNullOrEmpty(settings.OnClick)) 2179 { 2180 <span class="media-list-item__sticker dw-mod" onclick="@(settings.OnClick)"> 2181 <span class="u-uppercase">@settings.Label</span> 2182 </span> 2183 } 2184 else 2185 { 2186 <span class="media-list-item__sticker media-list-item__sticker--no-link dw-mod"> 2187 <span class="u-uppercase">@settings.Label</span> 2188 </span> 2189 } 2190 } 2191 <div class="media-list-item__wrap"> 2192 <div class="media-list-item__info dw-mod"> 2193 <div class="media-list-item__header dw-mod"> 2194 @if (!string.IsNullOrEmpty(settings.Title)) 2195 { 2196 if (!string.IsNullOrEmpty(settings.Link)) 2197 { 2198 @Render(new Link 2199 { 2200 Href = settings.Link, 2201 CssClass = "media-list-item__name dw-mod", 2202 ButtonLayout = ButtonLayout.None, 2203 Title = settings.Title, 2204 OnClick = !string.IsNullOrEmpty(settings.OnClick) ? settings.OnClick : "" 2205 }) 2206 } 2207 else if (!string.IsNullOrEmpty(settings.OnClick)) 2208 { 2209 <span class="media-list-item__name dw-mod" onclick="@(settings.OnClick)">@settings.Title</span> 2210 } 2211 else 2212 { 2213 <span class="media-list-item__name media-list-item__name--no-link dw-mod">@settings.Title</span> 2214 } 2215 } 2216 2217 @if (!string.IsNullOrEmpty(settings.Status)) 2218 { 2219 <div class="media-list-item__state dw-mod">@settings.Status</div> 2220 } 2221 </div> 2222 @{ 2223 settings.InfoTable.CssClass += " media-list-item__parameters-table"; 2224 } 2225 2226 @Render(settings.InfoTable) 2227 </div> 2228 <div class="media-list-item__actions dw-mod"> 2229 <div class="media-list-item__actions-list dw-mod"> 2230 @{ 2231 var actions = settings.GetActions(); 2232 2233 foreach (ButtonBase action in actions) 2234 { 2235 action.ButtonLayout = ButtonLayout.None; 2236 action.CssClass += " media-list-item__action link"; 2237 2238 @Render(action) 2239 } 2240 } 2241 </div> 2242 2243 @if (settings.SelectButton != null && !string.IsNullOrEmpty(settings.SelectButton.Title)) 2244 { 2245 settings.SelectButton.CssClass += " u-no-margin"; 2246 2247 <div class="media-list-item__action-button"> 2248 @Render(settings.SelectButton) 2249 </div> 2250 } 2251 </div> 2252 </div> 2253 </div> 2254 } 2255 @using Dynamicweb.Rapido.Blocks.Components.General 2256 @using Dynamicweb.Rapido.Blocks.Components 2257 2258 @helper RenderTable(Table settings) 2259 { 2260 Dictionary<string, string> attributes = new Dictionary<string, string>(); 2261 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 2262 2263 var enumToClasses = new Dictionary<TableDesign, string> 2264 { 2265 { TableDesign.Clean, "table--clean" }, 2266 { TableDesign.Bordered, "table--bordered" }, 2267 { TableDesign.Striped, "table--striped" }, 2268 { TableDesign.Hover, "table--hover" }, 2269 { TableDesign.Compact, "table--compact" }, 2270 { TableDesign.Condensed, "table--condensed" }, 2271 { TableDesign.NoTopBorder, "table--no-top-border" } 2272 }; 2273 string tableDesignClass = ""; 2274 if (settings.Design != TableDesign.None) 2275 { 2276 tableDesignClass = enumToClasses[settings.Design]; 2277 } 2278 2279 if (!string.IsNullOrEmpty(settings.CssClass) || settings.Design != TableDesign.None) { attributes.Add("class", "table " + tableDesignClass + " " + settings.CssClass + " dw-mod"); } 2280 2281 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value); 2282 2283 <table @ComponentMethods.AddAttributes(resultAttributes)> 2284 @if (settings.Header != null) 2285 { 2286 <thead> 2287 @Render(settings.Header) 2288 </thead> 2289 } 2290 <tbody> 2291 @foreach (var row in settings.Rows) 2292 { 2293 @Render(row) 2294 } 2295 </tbody> 2296 @if (settings.Footer != null) 2297 { 2298 <tfoot> 2299 @Render(settings.Footer) 2300 </tfoot> 2301 } 2302 </table> 2303 } 2304 @using Dynamicweb.Rapido.Blocks.Components.General 2305 @using Dynamicweb.Rapido.Blocks.Components 2306 2307 @helper RenderTableRow(TableRow settings) 2308 { 2309 Dictionary<string, string> attributes = new Dictionary<string, string>(); 2310 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 2311 2312 var enumToClasses = new Dictionary<TableRowDesign, string> 2313 { 2314 { TableRowDesign.NoBorder, "table__row--no-border" }, 2315 { TableRowDesign.Border, "table__row--border" }, 2316 { TableRowDesign.TopBorder, "table__row--top-line" }, 2317 { TableRowDesign.BottomBorder, "table__row--bottom-line" }, 2318 { TableRowDesign.Solid, "table__row--solid" } 2319 }; 2320 2321 string tableRowDesignClass = ""; 2322 if (settings.Design != TableRowDesign.None) 2323 { 2324 tableRowDesignClass = enumToClasses[settings.Design]; 2325 } 2326 2327 if (!string.IsNullOrEmpty(settings.CssClass) || settings.Design != TableRowDesign.None) { attributes.Add("class", "table__row " + tableRowDesignClass + " " + settings.CssClass + " dw-mod"); } 2328 2329 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value); 2330 2331 <tr @ComponentMethods.AddAttributes(resultAttributes)> 2332 @foreach (var cell in settings.Cells) 2333 { 2334 if (settings.IsHeaderRow) 2335 { 2336 cell.IsHeader = true; 2337 } 2338 @Render(cell) 2339 } 2340 </tr> 2341 } 2342 @using Dynamicweb.Rapido.Blocks.Components.General 2343 @using Dynamicweb.Rapido.Blocks.Components 2344 @using Dynamicweb.Core 2345 2346 @helper RenderTableCell(TableCell settings) 2347 { 2348 Dictionary<string, string> attributes = new Dictionary<string, string>(); 2349 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 2350 if (settings.Colspan != 0) { attributes.Add("colspan", Converter.ToString(settings.Colspan)); } 2351 if (settings.Rowspan != 0) { attributes.Add("rowspan", Converter.ToString(settings.Rowspan)); } 2352 if (!string.IsNullOrEmpty(settings.CssClass)) { attributes.Add("class", settings.CssClass + " dw-mod"); } 2353 2354 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value); 2355 2356 string tagName = settings.IsHeader ? "th" : "td"; 2357 2358 @("<" + tagName + " " + ComponentMethods.AddAttributes(resultAttributes) + ">") 2359 @settings.Content 2360 @("</" + tagName + ">"); 2361 } 2362 @using System.Linq 2363 @using Dynamicweb.Rapido.Blocks.Components.General 2364 2365 @* Component *@ 2366 2367 @helper RenderPagination(Dynamicweb.Rapido.Blocks.Components.General.Pagination settings) 2368 { 2369 var pageNumberQueryStringName = Dynamicweb.Rapido.Services.Pagination.GetPageNumberQueryStringName(settings); // Get the proper 'page number' query string parameter 2370 var queryParameters = Dynamicweb.Rapido.Services.Url.GetQueryParameters(pageNumberQueryStringName); // Get the NameValueCollection from the querystring 2371 2372 if (settings.NumberOfPages > 1) 2373 { 2374 string url = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + "/Default.aspx"; 2375 string ariaLabel = !string.IsNullOrWhiteSpace(settings.AriaLabel) ? settings.AriaLabel : Translate("Page navigation"); 2376 Dictionary<string, int> startAndEndPageNumber = Dynamicweb.Rapido.Services.Pagination.GetStartAndEndPageNumber(settings); 2377 2378 <div class="pager u-margin-top dw-mod @settings.CssClass" aria-label="@ariaLabel"> 2379 @if (settings.ShowPagingInfo) 2380 { 2381 <div class="pager__info dw-mod"> 2382 @Translate("Page") @settings.CurrentPageNumber @Translate("of") @settings.NumberOfPages 2383 </div> 2384 } 2385 <ul class="pager__list dw-mod"> 2386 @if (!string.IsNullOrWhiteSpace(settings.FirstPageUrl) && settings.ShowFirstAndLastControls) 2387 { 2388 @Render(new PaginationItem { Link = settings.FirstPageUrl, Icon = settings.FirstIcon }) 2389 } 2390 @if (!string.IsNullOrWhiteSpace(settings.PreviousPageUrl) && settings.ShowNextAndPrevControls) 2391 { 2392 @Render(new PaginationItem { Link = settings.PreviousPageUrl, Icon = settings.PrevIcon }) 2393 } 2394 @if (settings.GetPages().Any()) 2395 { 2396 foreach (var page in settings.GetPages()) 2397 { 2398 @Render(page) 2399 } 2400 } 2401 else 2402 { 2403 for (var page = startAndEndPageNumber["StartPage"]; page <= startAndEndPageNumber["EndPage"]; page++) 2404 { 2405 queryParameters = Dynamicweb.Rapido.Services.Url.UpdateQueryStringParameter(queryParameters, pageNumberQueryStringName, page.ToString()); 2406 @Render(new PaginationItem { Label = page.ToString(), Link = Dynamicweb.Rapido.Services.Url.BuildUri(url, queryParameters).PathAndQuery, IsActive = (settings.CurrentPageNumber == page) }); 2407 } 2408 } 2409 @if (!string.IsNullOrWhiteSpace(settings.NextPageUrl) && settings.ShowNextAndPrevControls) 2410 { 2411 @Render(new PaginationItem { Link = settings.NextPageUrl, Icon = settings.NextIcon }) 2412 } 2413 @if (!string.IsNullOrWhiteSpace(settings.LastPageUrl) && settings.ShowFirstAndLastControls) 2414 { 2415 @Render(new PaginationItem { Link = settings.LastPageUrl, Icon = settings.LastIcon }) 2416 } 2417 </ul> 2418 </div> 2419 } 2420 } 2421 2422 @helper RenderPaginationItem(PaginationItem settings) 2423 { 2424 if (settings.Icon == null) 2425 { 2426 settings.Icon = new Icon(); 2427 } 2428 2429 settings.Icon.Label = settings.Label; 2430 <li class="pager__btn dw-mod"> 2431 @if (settings.IsActive) 2432 { 2433 <span class="pager__num pager__num--current dw-mod"> 2434 @Render(settings.Icon) 2435 </span> 2436 } 2437 else 2438 { 2439 <a href="@settings.Link" class="pager__num dw-mod"> 2440 @Render(settings.Icon) 2441 </a> 2442 } 2443 </li> 2444 } 2445 2446 2447 @using Dynamicweb.Rapido.Blocks.Components.General 2448 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 2449 2450 2451 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2452 @using System.Web; 2453 @using Dynamicweb.Rapido.Blocks; 2454 2455 2456 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 2457 @RenderBlockList(eventFormPage.BlocksRoot.BlocksList) 2458 2459 2460