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

Pregătim viitorul în elita agriculturii

Agricultura este factor de progres, iar Agricover și-a asumat un rol activ în formarea noii generații de fermieri profesioniști care vor crește calitatea vieții pentru o țară întreagă și chiar mai mult.

Credem cu tărie că tinerii reprezintă viitorul agriculturii care generează prosperitate, iar construirea și menținerea unei rețele puternice de tineri lideri pregătiți și informați, vectori de imagine și de interese comune sunt esențiale în dezvoltarea agriculturii de mâine.

Realizarea acestui crez s-a materializat prin susținerea programului educațional Tineri Lideri pentru Agricultură, organizat de către Clubul Fermierilor Români. Astfel, Agricover investește anual în burse pentru pregătirea și formarea tinerilor fermieri.

Obiectivul Agricover este ca în 10 ani să susținem formarea profesională a 1000 de tineri lideri fermieri bine pregătiți care să asigure schimbarea generațională în ferme și să participe activ la o reprezentare mai bună a intereselor agriculturii românești.

Mai multe detalii despre procedura de selecție, etape și juriul programului pot fi văzute pe site-ul oficial www.cfro.ro/tineri-lideri.  

“Tineri Lideri pentru Agricultură” ediția a patra

Înscrierile pentru seria a patra a programului au început! La această ediție sunt așteptați să participe 120 de cursanți, de două ori mai mulți decât anul trecut. Ca susținători ai dezvoltării agriculturii românești de mâine, ne dorim sa pregătim tinerii fermieri pentru a continua afacerile familiei, cât și pentru asumarea rolului de lider în propriile afaceri și în comunitate.

  • Înscriere program: 21 februarie - 15 august 2022
  • Interviuri de cunoaștere: 7 martie - 31 august 2022
  • Listă finală participanți: 5 septembrie 2022

Dacă ești și tu un tânăr fermier dornic de dezvoltare personală sau cunoști tineri fermieri pe care să-i recomanzi în programul nostru de burse, completează formularul de înscriere!

Obiectivul nostru: 1000tineri lideri pregătiți în cadrul Programului "Tineri Lideri pentru Agricultură"

Burse acordate până în prezent

1