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

Dette website bruger cookies til at følge din adfærd og for at forbedre brugeroplevelsen på sitet.

Du kan altid slette gemte cookies i dine browserinstillinger

Show details