DIT WAS ESTETIKA 2021

Hoe leuk was dit? Om elkaar opnieuw te kunnen ontmoeten op een professionele beauty beurs! Jullie kwamen onze ProNails stand massaal bezoeken en samen maakten we er een topeditie van.

Heb je jouw foto’s in onze #PronailsExperience tunnel gedeeld op jouw Instagram? Dan maak jij kans op één van deze 3 fantastische prijzen:

  • Limited Edition Box Gellak of Sopolish van de nieuwe AW21-22 collectie
  • Gevulde Hand & Nail Care Display
  • LongWear Display van de nieuwe AW21-22 collectie


​Heel binnenkort maken we de winnaars bekend! Houd onze Instagram & website dus zeker goed in de gaten.

Tot op de volgende beurs!

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