Error executing template "Designs/Rapido/Paragraph/ParagraphContainer.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_24be1728eb354ec5a0f3d3fc68d7947d.Execute() in D:\Dynamicweb.net\Solutions\FlexMedia\granzow.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\Paragraph\ParagraphContainer.cshtml:line 2418
   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.b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   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 575 @using Dynamicweb.Rapido.Blocks.Components.General 576 @using Dynamicweb.Rapido.Blocks.Components 577 578 579 @* Component *@ 580 581 @helper RenderLeftNavigation(LeftNavigation settings) { 582 settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id; 583 settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template; 584 settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel; 585 settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel; 586 settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode; 587 588 <div class="grid__cell"> 589 @RenderNavigation(settings) 590 </div> 591 } 592 @using System.Reflection 593 @using Dynamicweb.Rapido.Blocks.Components.General 594 @using Dynamicweb.Core 595 596 @* Component *@ 597 598 @helper RenderHeading(Heading settings) 599 { 600 if (settings != null && !string.IsNullOrEmpty(settings.Title)) 601 { 602 string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : ""; 603 string tagName = settings.Level != 0 ? "h" + settings.Level.ToString() : "div"; 604 605 @("<" + tagName + " class=\"" + settings.CssClass + " dw-mod\" " + color + ">") 606 if (!string.IsNullOrEmpty(settings.Link)) 607 { 608 @Render(new Link { Href = settings.Link, Icon = settings.Icon, Title = settings.Title, ButtonLayout = ButtonLayout.None }) 609 } 610 else 611 { 612 if (settings.Icon == null) 613 { 614 settings.Icon = new Icon(); 615 } 616 settings.Icon.Label = settings.Title; 617 @Render(settings.Icon) 618 } 619 @("</" + tagName + ">"); 620 } 621 } 622 @using Dynamicweb.Rapido.Blocks.Components 623 @using Dynamicweb.Rapido.Blocks.Components.General 624 @using Dynamicweb.Rapido.Blocks 625 626 627 @* Component *@ 628 629 @helper RenderImage(Image settings) 630 { 631 if (settings.FilterPrimary != ImageFilter.None || settings.FilterSecondary != ImageFilter.None) 632 { 633 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>(); 634 if (!string.IsNullOrEmpty(settings.FilterColor)) { optionalAttributes.Add("style", "background-color: " + settings.FilterColor); } 635 636 if (settings.Caption != null) 637 { 638 @:<div> 639 } 640 641 var primaryFilterClass = settings.FilterPrimary.ToString().ToLower(); 642 var secondaryFilterClass = settings.FilterSecondary.ToString().ToLower(); 643 644 <div class="image-filter image-filter--@primaryFilterClass u-position-relative dw-mod" @ComponentMethods.AddAttributes(optionalAttributes)> 645 <div class="image-filter image-filter--@secondaryFilterClass dw-mod"> 646 @if (settings.Link != null) 647 { 648 <a href="@settings.Link"> 649 @RenderTheImage(settings) 650 </a> 651 } 652 else 653 { 654 @RenderTheImage(settings) 655 } 656 </div> 657 </div> 658 659 if (settings.Caption != null) 660 { 661 <span class="image-caption dw-mod">@settings.Caption</span> 662 @:</div> 663 } 664 } 665 else 666 { 667 if (settings.Caption != null) 668 { 669 @:<div> 670 } 671 if (!string.IsNullOrEmpty(settings.Link)) 672 { 673 <a href="@settings.Link"> 674 @RenderTheImage(settings) 675 </a> 676 } 677 else 678 { 679 @RenderTheImage(settings) 680 } 681 682 if (settings.Caption != null) 683 { 684 <span class="image-caption dw-mod">@settings.Caption</span> 685 @:</div> 686 } 687 } 688 } 689 690 @helper RenderTheImage(Image settings) 691 { 692 if (settings != null) 693 { 694 string placeholderImage = "/Files/Images/placeholder.gif"; 695 string imageEngine = "/Admin/Public/GetImage.ashx?"; 696 697 string imageStyle = ""; 698 699 switch (settings.Style) 700 { 701 case ImageStyle.Ball: 702 imageStyle = "grid__cell-img--ball"; 703 break; 704 } 705 706 if (settings.Style == ImageStyle.Ball || settings.Style == ImageStyle.Circle) 707 { 708 if (settings.ImageDefault != null) 709 { 710 settings.ImageDefault.Height = settings.ImageDefault.Width; 711 } 712 if (settings.ImageMedium != null) 713 { 714 settings.ImageMedium.Height = settings.ImageMedium.Width; 715 } 716 if (settings.ImageSmall != null) 717 { 718 settings.ImageSmall.Height = settings.ImageSmall.Width; 719 } 720 } 721 722 string defaultImage = imageEngine; 723 string imageSmall = ""; 724 string imageMedium = ""; 725 726 string SVGimg = settings.Path.ToString(); 727 728 if(SVGimg.EndsWith(".svg&")){ 729 settings.Path=SVGimg.Substring(0,SVGimg.Length-1); 730 } 731 732 if (settings.DisableImageEngine || settings.Path.ToString().EndsWith(".svg")) 733 { 734 defaultImage = settings.Path.ToString(); 735 } 736 else 737 { 738 if (settings.ImageDefault != null) 739 { 740 defaultImage += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageDefault); 741 742 if (settings.Path.GetType() != typeof(string)) 743 { 744 defaultImage += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 745 defaultImage += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 746 } 747 else 748 { 749 defaultImage += settings.Path != null ? "Image=" + settings.Path : ""; 750 } 751 } 752 753 if (settings.ImageSmall != null) 754 { 755 imageSmall = "data-src-small=\"" + imageEngine; 756 imageSmall += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageSmall); 757 758 if (settings.Path.GetType() != typeof(string)) 759 { 760 imageSmall += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 761 imageSmall += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 762 } 763 else 764 { 765 imageSmall += settings.Path != null ? "Image=" + settings.Path : ""; 766 } 767 768 imageSmall += "\""; 769 } 770 771 if (settings.ImageMedium != null) 772 { 773 imageMedium = "data-src-medium=\"" + imageEngine; 774 imageMedium += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageMedium); 775 776 if (settings.Path.GetType() != typeof(string)) 777 { 778 imageMedium += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 779 imageMedium += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 780 } 781 else 782 { 783 imageMedium += settings.Path != null ? "Image=" + settings.Path : ""; 784 } 785 786 imageMedium += "\""; 787 } 788 } 789 790 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>(); 791 if (!string.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick); } 792 if (!string.IsNullOrEmpty(settings.Title)) 793 { 794 optionalAttributes.Add("alt", settings.Title); 795 optionalAttributes.Add("title", settings.Title); 796 } 797 798 if (settings.DisableLazyLoad) 799 { 800 <img id="@settings.Id" class="@imageStyle @settings.CssClass dw-mod" src="@defaultImage" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) alt="" /> 801 } 802 else 803 { 804 <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) alt="" /> 805 } 806 } 807 } 808 @using System.Reflection 809 @using Dynamicweb.Rapido.Blocks.Components.General 810 @using Dynamicweb.Rapido.Blocks.Components 811 812 @* Component *@ 813 814 @helper RenderFileField(FileField settings) 815 { 816 var attributes = new Dictionary<string, string>(); 817 if (string.IsNullOrEmpty(settings.Id)) 818 { 819 settings.Id = Guid.NewGuid().ToString("N"); 820 } 821 822 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 823 if (settings.Disabled) { attributes.Add("disabled", "true"); } 824 if (settings.Required) { attributes.Add("required", "true"); } 825 if (settings.Multiple) { attributes.Add("multiple", "true"); } 826 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 827 if (string.IsNullOrEmpty(settings.ChooseFileText)) 828 { 829 settings.ChooseFileText = Translate("Choose file"); 830 } 831 if (string.IsNullOrEmpty(settings.NoFilesChosenText)) 832 { 833 settings.NoFilesChosenText = Translate("No files chosen..."); 834 } 835 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 836 837 string setValueToFakeInput = "FileUpload.setValueToFakeInput(this)"; 838 attributes.Add("onchange", setValueToFakeInput + (!string.IsNullOrEmpty(settings.OnChange) ? settings.OnChange : "")); 839 840 attributes.Add("type", "file"); 841 if (!string.IsNullOrEmpty(settings.Value)) { attributes.Add("value", settings.Value); } 842 settings.CssClass = "u-full-width " + settings.CssClass; 843 844 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 845 846 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod"> 847 @if (!string.IsNullOrEmpty(settings.Label)) 848 { 849 <label for="@settings.Id">@settings.Label</label> 850 } 851 @if (!string.IsNullOrEmpty(settings.HelpText)) 852 { 853 <small class="form__help-text">@settings.HelpText</small> 854 } 855 856 <div class="form__field-combi file-input u-no-margin dw-mod"> 857 <input @ComponentMethods.AddAttributes(resultAttributes) class="file-input__real-input" data-no-files-text="@settings.NoFilesChosenText" data-many-files-text="@Translate("files")" /> 858 <label for="@settings.Id" class="file-input__btn btn--secondary btn dw-mod">@settings.ChooseFileText</label> 859 <label for="@settings.Id" class="@settings.CssClass file-input__fake-input js-fake-input dw-mod">@settings.NoFilesChosenText</label> 860 @if (settings.UploadButton != null) 861 { 862 settings.UploadButton.CssClass += " btn--condensed u-no-margin"; 863 @Render(settings.UploadButton) 864 } 865 </div> 866 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 867 </div> 868 } 869 @using System.Reflection 870 @using Dynamicweb.Rapido.Blocks.Components.General 871 @using Dynamicweb.Rapido.Blocks.Components 872 @using Dynamicweb.Core 873 @using System.Linq 874 875 @* Component *@ 876 877 @helper RenderDateTimeField(DateTimeField settings) 878 { 879 if (string.IsNullOrEmpty(settings.Id)) 880 { 881 settings.Id = Guid.NewGuid().ToString("N"); 882 } 883 884 var textField = new TextField { 885 Name = settings.Name, 886 Id = settings.Id, 887 Label = settings.Label, 888 HelpText = settings.HelpText, 889 Value = settings.Value, 890 Disabled = settings.Disabled, 891 Required = settings.Required, 892 ErrorMessage = settings.ErrorMessage, 893 CssClass = settings.CssClass, 894 WrapperCssClass = settings.WrapperCssClass, 895 OnChange = settings.OnChange, 896 OnClick = settings.OnClick, 897 ExtraAttributes = settings.ExtraAttributes, 898 // 899 Placeholder = settings.Placeholder 900 }; 901 902 @Render(textField) 903 904 List<string> jsAttributes = new List<string>(); 905 906 jsAttributes.Add("mode: '" + Enum.GetName(typeof(DateTimeFieldMode), settings.Mode).ToLower() + "'"); 907 908 if (!string.IsNullOrEmpty(settings.DateFormat)) 909 { 910 jsAttributes.Add("dateFormat: '" + settings.DateFormat + "'"); 911 } 912 if (!string.IsNullOrEmpty(settings.MinDate)) 913 { 914 jsAttributes.Add("minDate: '" + settings.MinDate + "'"); 915 } 916 if (!string.IsNullOrEmpty(settings.MaxDate)) 917 { 918 jsAttributes.Add("maxDate: '" + settings.MaxDate + "'"); 919 } 920 if (settings.IsInline) 921 { 922 jsAttributes.Add("inline: " + Converter.ToString(settings.IsInline).ToLower()); 923 } 924 if (settings.EnableTime) 925 { 926 jsAttributes.Add("enableTime: " + Converter.ToString(settings.EnableTime).ToLower()); 927 } 928 if (settings.EnableWeekNumbers) 929 { 930 jsAttributes.Add("weekNumbers: " + Converter.ToString(settings.EnableWeekNumbers).ToLower()); 931 } 932 933 jsAttributes.AddRange(settings.GetFlatPickrOptions().Select(x => x.Key + ": " + x.Value)); 934 935 <script> 936 document.addEventListener("DOMContentLoaded", function () { 937 flatpickr("#@textField.Id", { 938 @string.Join(",", jsAttributes) 939 }); 940 }); 941 </script> 942 } 943 @using System.Reflection 944 @using Dynamicweb.Rapido.Blocks.Components.General 945 @using Dynamicweb.Rapido.Blocks.Components 946 947 @* Component *@ 948 949 @helper RenderTextField(TextField settings) 950 { 951 var attributes = new Dictionary<string, string>(); 952 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 953 { 954 settings.Id = Guid.NewGuid().ToString("N"); 955 } 956 957 /*base settings*/ 958 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 959 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 960 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 961 if (settings.Disabled) { attributes.Add("disabled", "true"); } 962 if (settings.Required) { attributes.Add("required", "true"); } 963 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 964 /*end*/ 965 966 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 967 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 968 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 969 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 970 if (settings.MaxLength != 0) { attributes.Add("maxlength", settings.MaxLength.ToString()); } 971 if (!string.IsNullOrEmpty(settings.Placeholder)) { attributes.Add("placeholder", settings.Placeholder); } 972 attributes.Add("type", Enum.GetName(typeof(TextFieldType), settings.Type).ToLower()); 973 if (settings.Type == TextFieldType.Password) { attributes.Add("autocomplete", "off"); }; 974 if (!string.IsNullOrEmpty(settings.Value)) { attributes.Add("value", settings.Value); } 975 settings.CssClass = "u-full-width " + settings.CssClass; 976 977 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 978 979 string noMargin = "u-no-margin"; 980 if (!settings.ReadOnly) { 981 noMargin = ""; 982 } 983 if (settings.Id == "EcomOrderCustomerEAN") { 984 noMargin = ""; 985 } 986 987 <div class="form__field-group u-full-width @noMargin @settings.WrapperCssClass dw-mod"> 988 @if (!string.IsNullOrEmpty(settings.Label)) 989 { 990 <label for="@settings.Id">@settings.Label</label> 991 } 992 @if (!string.IsNullOrEmpty(settings.HelpText)) 993 { 994 <small class="form__help-text">@settings.HelpText</small> 995 } 996 997 @if (settings.ActionButton != null) 998 { 999 settings.ActionButton.CssClass += " btn--condensed u-no-margin"; 1000 <div class="form__field-combi u-no-margin dw-mod"> 1001 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1002 @Render(settings.ActionButton) 1003 </div> 1004 } 1005 else 1006 { 1007 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1008 } 1009 1010 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1011 </div> 1012 } 1013 @using System.Reflection 1014 @using Dynamicweb.Rapido.Blocks.Components.General 1015 @using Dynamicweb.Rapido.Blocks.Components 1016 1017 @* Component *@ 1018 1019 @helper RenderNumberField(NumberField settings) 1020 { 1021 var attributes = new Dictionary<string, string>(); 1022 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1023 { 1024 settings.Id = Guid.NewGuid().ToString("N"); 1025 } 1026 1027 /*base settings*/ 1028 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1029 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1030 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1031 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1032 if (settings.Required) { attributes.Add("required", "true"); } 1033 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1034 /*end*/ 1035 1036 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 1037 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 1038 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 1039 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 1040 if (settings.Max != null) { attributes.Add("max", settings.Max.ToString()); } 1041 if (settings.Min != null) { attributes.Add("min", settings.Min.ToString()); } 1042 if (settings.Step != 0) { attributes.Add("step", settings.Step.ToString()); } 1043 if (settings.Value != null && !string.IsNullOrEmpty(settings.Value.ToString())) { attributes.Add("value", settings.Value.ToString()); } 1044 attributes.Add("type", "number"); 1045 1046 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1047 1048 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod"> 1049 @if (!string.IsNullOrEmpty(settings.Label)) 1050 { 1051 <label for="@settings.Id">@settings.Label</label> 1052 } 1053 @if (!string.IsNullOrEmpty(settings.HelpText)) 1054 { 1055 <small class="form__help-text">@settings.HelpText</small> 1056 } 1057 1058 @if (settings.ActionButton != null) 1059 { 1060 settings.ActionButton.CssClass += " btn--condensed u-no-margin"; 1061 <div class="form__field-combi u-no-margin dw-mod"> 1062 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1063 @Render(settings.ActionButton) 1064 </div> 1065 } 1066 else 1067 { 1068 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1069 } 1070 1071 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1072 </div> 1073 } 1074 @using System.Reflection 1075 @using Dynamicweb.Rapido.Blocks.Components.General 1076 @using Dynamicweb.Rapido.Blocks.Components 1077 1078 1079 @* Component *@ 1080 1081 @helper RenderTextareaField(TextareaField settings) 1082 { 1083 Dictionary<string, string> attributes = new Dictionary<string, string>(); 1084 string id = settings.Id; 1085 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(id)) 1086 { 1087 id = Guid.NewGuid().ToString("N"); 1088 } 1089 1090 if (!string.IsNullOrEmpty(id)) { attributes.Add("id", id); } 1091 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1092 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 1093 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 1094 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 1095 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1096 if (!string.IsNullOrEmpty(settings.Placeholder)) { attributes.Add("placeholder", settings.Placeholder); } 1097 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1098 if (settings.Required) { attributes.Add("required", "true"); } 1099 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 1100 if (settings.MaxLength != 0) { attributes.Add("maxlength", settings.MaxLength.ToString()); } 1101 if (settings.Rows != 0) { attributes.Add("rows", settings.Rows.ToString()); } 1102 attributes.Add("name", settings.Name); 1103 1104 <div class="form__field-group @settings.WrapperCssClass dw-mod"> 1105 @if (!string.IsNullOrEmpty(settings.Label)) 1106 { 1107 <label for="@id">@settings.Label</label> 1108 } 1109 @if (!string.IsNullOrEmpty(settings.HelpText)) 1110 { 1111 <small class="form__help-text">@settings.HelpText</small> 1112 } 1113 1114 <textarea class="u-full-width @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Value</textarea> 1115 1116 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1117 </div> 1118 } 1119 @using System.Reflection 1120 @using Dynamicweb.Rapido.Blocks.Components.General 1121 @using Dynamicweb.Rapido.Blocks.Components 1122 1123 1124 @* Component *@ 1125 1126 @helper RenderHiddenField(HiddenField settings) { 1127 var attributes = new Dictionary<string, string>(); 1128 attributes.Add("type", "hidden"); 1129 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1130 if (!string.IsNullOrEmpty(settings.Value)) { attributes.Add("value", settings.Value); } 1131 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1132 1133 <input @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)/> 1134 } 1135 @using System.Reflection 1136 @using Dynamicweb.Rapido.Blocks.Components.General 1137 @using Dynamicweb.Rapido.Blocks.Components 1138 1139 @* Component *@ 1140 1141 @helper RenderCheckboxField(CheckboxField settings) 1142 { 1143 var attributes = new Dictionary<string, string>(); 1144 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1145 { 1146 settings.Id = Guid.NewGuid().ToString("N"); 1147 } 1148 1149 /*base settings*/ 1150 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1151 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1152 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1153 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1154 if (settings.Required) { attributes.Add("required", "true"); } 1155 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1156 /*end*/ 1157 1158 attributes.Add("type", "checkbox"); 1159 if (settings.Checked) { attributes.Add("checked", "true"); } 1160 settings.CssClass = "form__control " + settings.CssClass; 1161 if (!string.IsNullOrEmpty(settings.Value)) { attributes.Add("value", settings.Value); } 1162 1163 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1164 1165 <div class="form__field-group @settings.WrapperCssClass dw-mod"> 1166 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1167 @if (!string.IsNullOrEmpty(settings.Label)) 1168 { 1169 <label for="@settings.Id" class="dw-mod">@settings.Label</label> 1170 } 1171 @if (!string.IsNullOrEmpty(settings.HelpText)) 1172 { 1173 <small class="form__help-text">@settings.HelpText</small> 1174 } 1175 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1176 </div> 1177 } 1178 @using System.Reflection 1179 @using Dynamicweb.Rapido.Blocks.Components.General 1180 @using Dynamicweb.Rapido.Blocks.Components 1181 1182 1183 @* Component *@ 1184 1185 @helper RenderCheckboxListField(CheckboxListField settings) 1186 { 1187 <div class="form__field-group @settings.WrapperCssClass u-margin-bottom dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1188 @if (!string.IsNullOrEmpty(settings.Label)) 1189 { 1190 <label>@settings.Label</label> 1191 } 1192 @if (!string.IsNullOrEmpty(settings.HelpText)) 1193 { 1194 <small class="form__help-text">@settings.HelpText</small> 1195 } 1196 1197 @foreach (var item in settings.Options) 1198 { 1199 if (settings.Required) 1200 { 1201 item.Required = true; 1202 } 1203 if (settings.Disabled) 1204 { 1205 item.Disabled = true; 1206 } 1207 if (!string.IsNullOrEmpty(settings.Name)) 1208 { 1209 item.Name = settings.Name; 1210 } 1211 if (!string.IsNullOrEmpty(settings.CssClass)) 1212 { 1213 item.CssClass += settings.CssClass; 1214 } 1215 1216 /* value is not supported */ 1217 1218 if (!string.IsNullOrEmpty(settings.OnClick)) 1219 { 1220 item.OnClick += settings.OnClick; 1221 } 1222 if (!string.IsNullOrEmpty(settings.OnChange)) 1223 { 1224 item.OnChange += settings.OnChange; 1225 } 1226 @Render(item) 1227 } 1228 1229 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1230 </div> 1231 } 1232 @using System.Reflection 1233 @using Dynamicweb.Rapido.Blocks.Components.General 1234 @using Dynamicweb.Rapido.Blocks.Components 1235 1236 1237 @* Component *@ 1238 1239 @helper RenderSelectField(SelectField settings) 1240 { 1241 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1242 { 1243 settings.Id = Guid.NewGuid().ToString("N"); 1244 } 1245 1246 <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod"> 1247 @if (!string.IsNullOrEmpty(settings.Label)) 1248 { 1249 <label for="@settings.Id">@settings.Label</label> 1250 } 1251 @if (!string.IsNullOrEmpty(settings.HelpText)) 1252 { 1253 <small class="form__help-text">@settings.HelpText</small> 1254 } 1255 1256 @if (settings.ActionButton != null) 1257 { 1258 settings.ActionButton.CssClass += " btn--condensed u-no-margin"; 1259 <div class="form__field-combi u-no-margin dw-mod"> 1260 @RenderSelectBase(settings) 1261 @Render(settings.ActionButton) 1262 </div> 1263 } 1264 else 1265 { 1266 @RenderSelectBase(settings) 1267 } 1268 1269 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1270 </div> 1271 } 1272 1273 @helper RenderSelectBase(SelectField settings) 1274 { 1275 var attributes = new Dictionary<string, string>(); 1276 1277 /*base settings*/ 1278 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1279 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1280 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1281 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1282 if (settings.Required) { attributes.Add("required", "true"); } 1283 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1284 /*end*/ 1285 1286 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1287 1288 <select @ComponentMethods.AddAttributes(resultAttributes) class="u-full-width @settings.CssClass dw-mod"> 1289 @if (settings.Default != null) 1290 { 1291 @Render(settings.Default) 1292 } 1293 1294 @foreach (var item in settings.Options) 1295 { 1296 if (!string.IsNullOrEmpty(settings.Value)) { 1297 item.Checked = item.Value == settings.Value; 1298 } 1299 @Render(item) 1300 } 1301 </select> 1302 } 1303 @using System.Reflection 1304 @using Dynamicweb.Rapido.Blocks.Components.General 1305 @using Dynamicweb.Rapido.Blocks.Components 1306 1307 @* Component *@ 1308 1309 @helper RenderRadioButtonField(RadioButtonField settings) 1310 { 1311 var attributes = new Dictionary<string, string>(); 1312 if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) 1313 { 1314 settings.Id = Guid.NewGuid().ToString("N"); 1315 } 1316 1317 /*base settings*/ 1318 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1319 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 1320 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 1321 if (settings.Disabled) { attributes.Add("disabled", "true"); } 1322 if (settings.Required) { attributes.Add("required", "true"); } 1323 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 1324 /*end*/ 1325 1326 attributes.Add("type", "radio"); 1327 if (settings.Checked) { attributes.Add("checked", "true"); } 1328 settings.CssClass = "form__control " + settings.CssClass; 1329 if (!string.IsNullOrEmpty(settings.Value)) { attributes.Add("value", settings.Value); } 1330 1331 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 1332 1333 <div class="form__field-group @settings.WrapperCssClass dw-mod"> 1334 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 1335 @if (!string.IsNullOrEmpty(settings.Label)) 1336 { 1337 <label for="@settings.Id" class="dw-mod">@settings.Label</label> 1338 } 1339 @if (!string.IsNullOrEmpty(settings.HelpText)) 1340 { 1341 <small class="form__help-text">@settings.HelpText</small> 1342 } 1343 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1344 </div> 1345 } 1346 @using System.Reflection 1347 @using Dynamicweb.Rapido.Blocks.Components.General 1348 @using Dynamicweb.Rapido.Blocks.Components 1349 1350 1351 @* Component *@ 1352 1353 @helper RenderRadioButtonListField(RadioButtonListField settings) 1354 { 1355 <div class="form__field-group @settings.WrapperCssClass u-margin-bottom dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1356 @if (!string.IsNullOrEmpty(settings.Label)) 1357 { 1358 <label>@settings.Label</label> 1359 } 1360 @if (!string.IsNullOrEmpty(settings.HelpText)) 1361 { 1362 <small class="form__help-text">@settings.HelpText</small> 1363 } 1364 1365 @foreach (var item in settings.Options) 1366 { 1367 if (settings.Required) 1368 { 1369 item.Required = true; 1370 } 1371 if (settings.Disabled) 1372 { 1373 item.Disabled = true; 1374 } 1375 if (!string.IsNullOrEmpty(settings.Name)) 1376 { 1377 item.Name = settings.Name; 1378 } 1379 if (!string.IsNullOrEmpty(settings.Value) && settings.Value == item.Value) 1380 { 1381 item.Checked = true; 1382 } 1383 if (!string.IsNullOrEmpty(settings.OnClick)) 1384 { 1385 item.OnClick += settings.OnClick; 1386 } 1387 if (!string.IsNullOrEmpty(settings.OnChange)) 1388 { 1389 item.OnChange += settings.OnChange; 1390 } 1391 if (!string.IsNullOrEmpty(settings.CssClass)) 1392 { 1393 item.CssClass += settings.CssClass; 1394 } 1395 @Render(item) 1396 } 1397 1398 @Render(new NotificationMessage { Message = settings.ErrorMessage }) 1399 </div> 1400 } 1401 @using System.Reflection 1402 @using Dynamicweb.Rapido.Blocks.Components.General 1403 @using Dynamicweb.Rapido.Blocks.Components 1404 1405 1406 @* Component *@ 1407 1408 @helper RenderNotificationMessage(NotificationMessage settings) 1409 { 1410 if (!string.IsNullOrEmpty(settings.Message)) 1411 { 1412 var attributes = new Dictionary<string, string>(); 1413 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1414 1415 string messageTypeClass = Enum.GetName(typeof(NotificationMessageType), settings.MessageType).ToLower(); 1416 <div class="field-@messageTypeClass @settings.CssClass u-full-width dw-mod" @ComponentMethods.AddAttributes(attributes)>@settings.Message</div> 1417 } 1418 } 1419 @using Dynamicweb.Rapido.Blocks.Components.General 1420 1421 1422 @* Component *@ 1423 1424 @helper RenderHandlebarsRoot(HandlebarsRoot settings) { 1425 string preRender = !String.IsNullOrEmpty(settings.PreRenderScriptTemplate) ? "data-pre-render-template=\"" + settings.PreRenderScriptTemplate + "\"" : ""; 1426 1427 <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> 1428 @if (settings.SubBlocks != null) { 1429 @RenderBlockList(settings.SubBlocks) 1430 } 1431 </div> 1432 } 1433 @using System.Reflection 1434 @using Dynamicweb.Rapido.Blocks.Components.General 1435 @using Dynamicweb.Rapido.Blocks.Components 1436 @using System.Text.RegularExpressions 1437 1438 1439 @* Component *@ 1440 1441 @helper RenderSticker(Sticker settings) { 1442 if (!String.IsNullOrEmpty(settings.Title)) { 1443 string size = settings.Size.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Size.ToString().ToLower() : ""; 1444 string style = settings.Style.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Style.ToString().ToLower() : ""; 1445 1446 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>(); 1447 if (!String.IsNullOrEmpty(settings.Color) || !String.IsNullOrEmpty(settings.BackgroundColor)) { 1448 string styleTag = !String.IsNullOrEmpty(settings.Color) ? "color: " + settings.Color + "; " : ""; 1449 styleTag += !String.IsNullOrEmpty(settings.BackgroundColor) ? "background-color: " + settings.BackgroundColor + "; " : ""; 1450 optionalAttributes.Add("style", styleTag); 1451 } 1452 1453 <div class="stickers-container__tag @size @style @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Title</div> 1454 } 1455 } 1456 1457 @using System.Reflection 1458 @using Dynamicweb.Rapido.Blocks.Components.General 1459 @using Dynamicweb.Rapido.Blocks.Components 1460 1461 1462 @* Component *@ 1463 1464 @helper RenderStickersCollection(StickersCollection settings) 1465 { 1466 if (settings.Stickers.Count > 0) 1467 { 1468 string position = "stickers-container--" + Regex.Replace(settings.Position.ToString(), "([a-z])([A-Z])", "$1-$2").ToLower(); 1469 1470 <div class="stickers-container @position @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1471 @foreach (Sticker sticker in settings.Stickers) 1472 { 1473 @Render(sticker) 1474 } 1475 </div> 1476 } 1477 } 1478 1479 @using Dynamicweb.Rapido.Blocks.Components.General 1480 1481 1482 @* Component *@ 1483 1484 @helper RenderForm(Form settings) { 1485 if (settings != null) 1486 { 1487 Dictionary<string, string> optionalAttributes = new Dictionary<string, string>(); 1488 if (!string.IsNullOrEmpty(settings.Action)) { optionalAttributes.Add("action", settings.Action); }; 1489 if (!string.IsNullOrEmpty(settings.Name)) { optionalAttributes.Add("name", settings.Name); }; 1490 if (!string.IsNullOrEmpty(settings.OnSubmit)) { optionalAttributes.Add("onsubmit", settings.OnSubmit); }; 1491 var enctypes = new Dictionary<string, string> 1492 { 1493 { "multipart", "multipart/form-data" }, 1494 { "text", "text/plain" }, 1495 { "application", "application/x-www-form-urlencoded" } 1496 }; 1497 if (settings.Enctype != FormEnctype.none) { optionalAttributes.Add("enctype", enctypes[Enum.GetName(typeof(FormEnctype), settings.Enctype).ToLower()]); }; 1498 optionalAttributes.Add("method", settings.Method.ToString()); 1499 1500 if (!string.IsNullOrEmpty(settings.FormStartMarkup)) 1501 { 1502 @settings.FormStartMarkup 1503 } 1504 else 1505 { 1506 @:<form name="@settings.Name" class="@settings.CssClass u-no-margin dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1507 } 1508 1509 foreach (var field in settings.GetFields()) 1510 { 1511 @Render(field) 1512 } 1513 1514 @:</form> 1515 } 1516 } 1517 @using System.Reflection 1518 @using Dynamicweb.Rapido.Blocks.Components.General 1519 @using Dynamicweb.Rapido.Blocks.Components 1520 1521 1522 @* Component *@ 1523 1524 @helper RenderText(Text settings) 1525 { 1526 @settings.Content 1527 } 1528 @using System.Reflection 1529 @using Dynamicweb.Rapido.Blocks.Components.General 1530 @using Dynamicweb.Rapido.Blocks.Components 1531 1532 1533 @* Component *@ 1534 1535 @helper RenderContentModule(ContentModule settings) { 1536 if (!string.IsNullOrEmpty(settings.Content)) 1537 { 1538 @settings.Content 1539 } 1540 } 1541 @using System.Reflection 1542 @using Dynamicweb.Rapido.Blocks.Components.General 1543 @using Dynamicweb.Rapido.Blocks.Components 1544 1545 1546 @* Component *@ 1547 1548 @helper RenderModal(Modal settings) { 1549 if (settings != null) 1550 { 1551 string modalId = !string.IsNullOrEmpty(settings.Id) ? settings.Id : Guid.NewGuid().ToString("N"); 1552 1553 string onchange = !string.IsNullOrEmpty(settings.OnClose) ? "onchange=\"if(!this.checked){" + settings.OnClose + "}\"" : ""; 1554 1555 <input type="checkbox" id="@(modalId)ModalTrigger" class="modal-trigger" @onchange /> 1556 1557 <div class="modal-container"> 1558 @if (!settings.DisableDarkOverlay) 1559 { 1560 <label for="@(modalId)ModalTrigger" id="@(modalId)ModalOverlay" class="modal-overlay"></label> 1561 } 1562 <div class="modal modal--@settings.Width.ToString().ToLower() modal-height--@settings.Height.ToString().ToLower()" id="@(modalId)Modal"> 1563 @if (settings.Heading != null) 1564 { 1565 if (!string.IsNullOrEmpty(settings.Heading.Title)) 1566 { 1567 <div class="modal__header"> 1568 @Render(settings.Heading) 1569 </div> 1570 } 1571 } 1572 <div class="modal__body @(settings.Width.ToString().ToLower() == "full" ? "modal__body--full" : "")"> 1573 @if (!string.IsNullOrEmpty(settings.BodyText)) 1574 { 1575 @settings.BodyText 1576 } 1577 @if (settings.BodyTemplate != null) 1578 { 1579 @settings.BodyTemplate 1580 } 1581 @{ 1582 var actions = settings.GetActions(); 1583 } 1584 </div> 1585 @if (actions.Length > 0) 1586 { 1587 <div class="modal__footer"> 1588 @foreach (var action in actions) 1589 { 1590 action.CssClass += " u-no-margin"; 1591 @Render(action) 1592 } 1593 </div> 1594 } 1595 <label class="modal__close-btn" for="@(modalId)ModalTrigger"></label> 1596 </div> 1597 </div> 1598 } 1599 } 1600 @using Dynamicweb.Rapido.Blocks.Components.General 1601 1602 @* Component *@ 1603 1604 @helper RenderMediaListItem(MediaListItem settings) 1605 { 1606 <div class="media-list-item @settings.CssClass dw-mod" @(!string.IsNullOrEmpty(settings.Id) ? "id=\"" + settings.Id + "\"" : "")> 1607 @if (!string.IsNullOrEmpty(settings.Label)) 1608 { 1609 if (!string.IsNullOrEmpty(settings.Link)) 1610 { 1611 @Render(new Link 1612 { 1613 Href = settings.Link, 1614 CssClass = "media-list-item__sticker dw-mod", 1615 ButtonLayout = ButtonLayout.None, 1616 Title = settings.Label, 1617 OnClick = !string.IsNullOrEmpty(settings.OnClick) ? settings.OnClick : "" 1618 }) 1619 } 1620 else if (!string.IsNullOrEmpty(settings.OnClick)) 1621 { 1622 <span class="media-list-item__sticker dw-mod" onclick="@(settings.OnClick)"> 1623 <span class="u-uppercase">@settings.Label</span> 1624 </span> 1625 } 1626 else 1627 { 1628 <span class="media-list-item__sticker media-list-item__sticker--no-link dw-mod"> 1629 <span class="u-uppercase">@settings.Label</span> 1630 </span> 1631 } 1632 } 1633 <div class="media-list-item__wrap"> 1634 <div class="media-list-item__info dw-mod"> 1635 <div class="media-list-item__header dw-mod"> 1636 @if (!string.IsNullOrEmpty(settings.Title)) 1637 { 1638 if (!string.IsNullOrEmpty(settings.Link)) 1639 { 1640 @Render(new Link 1641 { 1642 Href = settings.Link, 1643 CssClass = "media-list-item__name dw-mod", 1644 ButtonLayout = ButtonLayout.None, 1645 Title = settings.Title, 1646 OnClick = !string.IsNullOrEmpty(settings.OnClick) ? settings.OnClick : "" 1647 }) 1648 } 1649 else if (!string.IsNullOrEmpty(settings.OnClick)) 1650 { 1651 <span class="media-list-item__name dw-mod" onclick="@(settings.OnClick)">@settings.Title</span> 1652 } 1653 else 1654 { 1655 <span class="media-list-item__name media-list-item__name--no-link dw-mod">@settings.Title</span> 1656 } 1657 } 1658 1659 @if (!string.IsNullOrEmpty(settings.Status)) 1660 { 1661 <div class="media-list-item__state dw-mod">@settings.Status</div> 1662 } 1663 </div> 1664 @{ 1665 settings.InfoTable.CssClass += " media-list-item__parameters-table"; 1666 } 1667 1668 @Render(settings.InfoTable) 1669 </div> 1670 <div class="media-list-item__actions dw-mod"> 1671 <div class="media-list-item__actions-list dw-mod"> 1672 @{ 1673 var actions = settings.GetActions(); 1674 1675 foreach (ButtonBase action in actions) 1676 { 1677 action.ButtonLayout = ButtonLayout.None; 1678 action.CssClass += " media-list-item__action link"; 1679 1680 @Render(action) 1681 } 1682 } 1683 </div> 1684 1685 @if (settings.SelectButton != null && !string.IsNullOrEmpty(settings.SelectButton.Title)) 1686 { 1687 settings.SelectButton.CssClass += " u-no-margin"; 1688 1689 <div class="media-list-item__action-button"> 1690 @Render(settings.SelectButton) 1691 </div> 1692 } 1693 </div> 1694 </div> 1695 </div> 1696 } 1697 @using Dynamicweb.Rapido.Blocks.Components.General 1698 @using Dynamicweb.Rapido.Blocks.Components 1699 1700 @helper RenderTable(Table settings) 1701 { 1702 Dictionary<string, string> attributes = new Dictionary<string, string>(); 1703 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1704 1705 var enumToClasses = new Dictionary<TableDesign, string> 1706 { 1707 { TableDesign.Clean, "table--clean" }, 1708 { TableDesign.Bordered, "table--bordered" }, 1709 { TableDesign.Striped, "table--striped" }, 1710 { TableDesign.Hover, "table--hover" }, 1711 { TableDesign.Compact, "table--compact" }, 1712 { TableDesign.Condensed, "table--condensed" }, 1713 { TableDesign.NoTopBorder, "table--no-top-border" } 1714 }; 1715 string tableDesignClass = ""; 1716 if (settings.Design != TableDesign.None) 1717 { 1718 tableDesignClass = enumToClasses[settings.Design]; 1719 } 1720 1721 if (!string.IsNullOrEmpty(settings.CssClass) || settings.Design != TableDesign.None) { attributes.Add("class", "table " + tableDesignClass + " " + settings.CssClass + " dw-mod"); } 1722 1723 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value); 1724 1725 <table @ComponentMethods.AddAttributes(resultAttributes)> 1726 @if (settings.Header != null) 1727 { 1728 <thead> 1729 @Render(settings.Header) 1730 </thead> 1731 } 1732 <tbody> 1733 @foreach (var row in settings.Rows) 1734 { 1735 @Render(row) 1736 } 1737 </tbody> 1738 @if (settings.Footer != null) 1739 { 1740 <tfoot> 1741 @Render(settings.Footer) 1742 </tfoot> 1743 } 1744 </table> 1745 } 1746 @using Dynamicweb.Rapido.Blocks.Components.General 1747 @using Dynamicweb.Rapido.Blocks.Components 1748 1749 @helper RenderTableRow(TableRow settings) 1750 { 1751 Dictionary<string, string> attributes = new Dictionary<string, string>(); 1752 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1753 1754 var enumToClasses = new Dictionary<TableRowDesign, string> 1755 { 1756 { TableRowDesign.NoBorder, "table__row--no-border" }, 1757 { TableRowDesign.Border, "table__row--border" }, 1758 { TableRowDesign.TopBorder, "table__row--top-line" }, 1759 { TableRowDesign.BottomBorder, "table__row--bottom-line" }, 1760 { TableRowDesign.Solid, "table__row--solid" } 1761 }; 1762 1763 string tableRowDesignClass = ""; 1764 if (settings.Design != TableRowDesign.None) 1765 { 1766 tableRowDesignClass = enumToClasses[settings.Design]; 1767 } 1768 1769 if (!string.IsNullOrEmpty(settings.CssClass) || settings.Design != TableRowDesign.None) { attributes.Add("class", "table__row " + tableRowDesignClass + " " + settings.CssClass + " dw-mod"); } 1770 1771 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value); 1772 1773 <tr @ComponentMethods.AddAttributes(resultAttributes)> 1774 @foreach (var cell in settings.Cells) 1775 { 1776 if (settings.IsHeaderRow) 1777 { 1778 cell.IsHeader = true; 1779 } 1780 @Render(cell) 1781 } 1782 </tr> 1783 } 1784 @using Dynamicweb.Rapido.Blocks.Components.General 1785 @using Dynamicweb.Rapido.Blocks.Components 1786 @using Dynamicweb.Core 1787 1788 @helper RenderTableCell(TableCell settings) 1789 { 1790 Dictionary<string, string> attributes = new Dictionary<string, string>(); 1791 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 1792 if (settings.Colspan != 0) { attributes.Add("colspan", Converter.ToString(settings.Colspan)); } 1793 if (settings.Rowspan != 0) { attributes.Add("rowspan", Converter.ToString(settings.Rowspan)); } 1794 if (!string.IsNullOrEmpty(settings.CssClass)) { attributes.Add("class", settings.CssClass + " dw-mod"); } 1795 1796 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value); 1797 1798 string tagName = settings.IsHeader ? "th" : "td"; 1799 1800 @("<" + tagName + " " + ComponentMethods.AddAttributes(resultAttributes) + ">") 1801 @settings.Content 1802 @("</" + tagName + ">"); 1803 } 1804 @using System.Linq 1805 @using Dynamicweb.Rapido.Blocks.Components.General 1806 1807 @* Component *@ 1808 1809 @helper RenderPagination(Dynamicweb.Rapido.Blocks.Components.General.Pagination settings) 1810 { 1811 var pageNumberQueryStringName = Dynamicweb.Rapido.Services.Pagination.GetPageNumberQueryStringName(settings); // Get the proper 'page number' query string parameter 1812 var queryParameters = Dynamicweb.Rapido.Services.Url.GetQueryParameters(pageNumberQueryStringName); // Get the NameValueCollection from the querystring 1813 1814 if (settings.NumberOfPages > 1) 1815 { 1816 string url = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + "/Default.aspx"; 1817 string ariaLabel = !string.IsNullOrWhiteSpace(settings.AriaLabel) ? settings.AriaLabel : Translate("Page navigation"); 1818 Dictionary<string, int> startAndEndPageNumber = Dynamicweb.Rapido.Services.Pagination.GetStartAndEndPageNumber(settings); 1819 1820 <div class="pager u-margin-top dw-mod @settings.CssClass" aria-label="@ariaLabel"> 1821 @if (settings.ShowPagingInfo) 1822 { 1823 <div class="pager__info dw-mod"> 1824 @Translate("Page") @settings.CurrentPageNumber @Translate("of") @settings.NumberOfPages 1825 </div> 1826 } 1827 <ul class="pager__list dw-mod"> 1828 @if (!string.IsNullOrWhiteSpace(settings.FirstPageUrl) && settings.ShowFirstAndLastControls) 1829 { 1830 @Render(new PaginationItem { Link = settings.FirstPageUrl, Icon = settings.FirstIcon }) 1831 } 1832 @if (!string.IsNullOrWhiteSpace(settings.PreviousPageUrl) && settings.ShowNextAndPrevControls) 1833 { 1834 @Render(new PaginationItem { Link = settings.PreviousPageUrl, Icon = settings.PrevIcon }) 1835 } 1836 @if (settings.GetPages().Any()) 1837 { 1838 foreach (var page in settings.GetPages()) 1839 { 1840 @Render(page) 1841 } 1842 } 1843 else 1844 { 1845 for (var page = startAndEndPageNumber["StartPage"]; page <= startAndEndPageNumber["EndPage"]; page++) 1846 { 1847 queryParameters = Dynamicweb.Rapido.Services.Url.UpdateQueryStringParameter(queryParameters, pageNumberQueryStringName, page.ToString()); 1848 @Render(new PaginationItem { Label = page.ToString(), Link = Dynamicweb.Rapido.Services.Url.BuildUri(url, queryParameters).PathAndQuery, IsActive = (settings.CurrentPageNumber == page) }); 1849 } 1850 } 1851 @if (!string.IsNullOrWhiteSpace(settings.NextPageUrl) && settings.ShowNextAndPrevControls) 1852 { 1853 @Render(new PaginationItem { Link = settings.NextPageUrl, Icon = settings.NextIcon }) 1854 } 1855 @if (!string.IsNullOrWhiteSpace(settings.LastPageUrl) && settings.ShowFirstAndLastControls) 1856 { 1857 @Render(new PaginationItem { Link = settings.LastPageUrl, Icon = settings.LastIcon }) 1858 } 1859 </ul> 1860 </div> 1861 } 1862 } 1863 1864 @helper RenderPaginationItem(PaginationItem settings) 1865 { 1866 if (settings.Icon == null) 1867 { 1868 settings.Icon = new Icon(); 1869 } 1870 1871 settings.Icon.Label = settings.Label; 1872 <li class="pager__btn dw-mod"> 1873 @if (settings.IsActive) 1874 { 1875 <span class="pager__num pager__num--current dw-mod"> 1876 @Render(settings.Icon) 1877 </span> 1878 } 1879 else 1880 { 1881 <a href="@settings.Link" class="pager__num dw-mod"> 1882 @Render(settings.Icon) 1883 </a> 1884 } 1885 </li> 1886 } 1887 1888 1889 @using Dynamicweb.Rapido.Blocks.Components.General 1890 1891 1892 @* Include the basic, re-used, paragraph initializer *@ 1893 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> 1894 @using Dynamicweb.Frontend 1895 @using Dynamicweb.Rapido.Blocks.Components.General 1896 @using Dynamicweb.Rapido.Blocks.Components 1897 1898 @functions { 1899 public class ContentParagraph 1900 { 1901 public string Title { get; set; } 1902 public Image Image { get; set; } 1903 public string Text { get; set; } 1904 public string Link { get; set; } 1905 public bool SetImageAsBackground { get; set; } 1906 public bool HideOuterPadding { get; set; } 1907 public string InnerPaddingCss { get; set; } 1908 public string CardCss { get; set; } 1909 public string ButtonWrapperCss { get; set; } 1910 public string Layout { get; set; } 1911 public string Module { get; set; } 1912 public Link ButtonPrimary { get; set; } 1913 public Link ButtonSecondary { get; set; } 1914 } 1915 } 1916 1917 @helper RenderParagraph(ItemViewModel item, bool renderModule = true) 1918 { 1919 if (item != null) { 1920 string layout = item.GetList("ContentPositions").SelectedValue; 1921 1922 string paragraphClasses = ""; 1923 string paragraphWidth = !String.IsNullOrEmpty(item.GetString("Width")) ? item.GetList("Width").SelectedValue : "12"; 1924 paragraphClasses += " grid__col-lg-" + paragraphWidth + " grid__col-md-" + paragraphWidth + " grid__col-sm-" + paragraphWidth; 1925 if (item.GetList("WidthMobile").SelectedValue == "hide") 1926 { 1927 paragraphClasses += " u-hidden-xs"; 1928 } 1929 else 1930 { 1931 paragraphClasses += " grid__col-xs-" + item.GetList("WidthMobile").SelectedValue; 1932 } 1933 paragraphClasses += item.GetBoolean("HidePadding") ? " paragraph-container--no-padding" : ""; 1934 paragraphClasses += layout == "middle-center" || layout == "middle-left" ? " u-middle-horizontal grid--justify-center grid--align-self-center" : ""; 1935 1936 //Alternative Design Layout 1937 var designLayout = Model.Item.GetItem("CustomSettings") != null ? Model.Item.GetItem("CustomSettings").GetString("DesignLayout") != null ? Model.Item.GetItem("CustomSettings").GetList("DesignLayout").SelectedValue : "" : ""; 1938 paragraphClasses += !String.IsNullOrEmpty(designLayout) ? designLayout : ""; 1939 1940 string title = item.GetBoolean("ShowTitle") ? item.GetString("Title") : ""; 1941 string cardClass = item.GetBoolean("ShowAsCard") ? "paragraph-card" : ""; 1942 string buttonSpacing = ""; 1943 string buttonAlignment = layout == "all-centered" || layout == "middle-center" ? "grid--justify-center" : ""; 1944 1945 string image = item.GetFile("Image") != null ? item.GetFile("Image").ToString() + "&" + item.GetFile("Image").GetFocalPointParameters() : ""; 1946 int cropMode = !String.IsNullOrEmpty(Converter.ToString(item.GetList("ImageCrop"))) ? Convert.ToInt32(item.GetList("ImageCrop").SelectedValue) : 0; 1947 ImageStyle imageStyle = item.GetList("ImageStyle").SelectedValue == "ball" ? ImageStyle.Ball : ImageStyle.None; 1948 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; 1949 if (primaryButtonLayout == ButtonLayout.Link) 1950 { 1951 primaryButtonLayout = ButtonLayout.LinkClean; 1952 } 1953 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; 1954 if (secondaryButtonLayout == ButtonLayout.Link) 1955 { 1956 secondaryButtonLayout = ButtonLayout.LinkClean; 1957 } 1958 ImageFilter primaryImageFilter = !string.IsNullOrEmpty(item.GetList("ImageFilterPrimary").SelectedValue) ? (ImageFilter) Enum.Parse(typeof(ImageFilter), item.GetList("ImageFilterPrimary").SelectedValue.Replace("-", ""), true) : ImageFilter.None; 1959 ImageFilter secondaryImageFilter = !string.IsNullOrEmpty(item.GetList("ImageFilterSecondary").SelectedValue) ? (ImageFilter) Enum.Parse(typeof(ImageFilter), item.GetList("ImageFilterSecondary").SelectedValue.Replace("-", ""), true) : ImageFilter.None; 1960 string imageFilterColorCode = item.GetString("ColorForTheFilter").StartsWith("#") && primaryImageFilter == ImageFilter.Colorize ? GenerateRgba(item.GetString("ColorForTheFilter"), 0.3) : ""; 1961 bool setImageAsBackground = item.GetList("ImageStyle").SelectedValue.ToLower() == "background" ? true : false; 1962 1963 Image paragraphImage = null; 1964 if (!String.IsNullOrEmpty(image)) 1965 { 1966 paragraphImage = new Image 1967 { 1968 Path = image, 1969 Link = item.GetString("Link"), 1970 FilterPrimary = primaryImageFilter, 1971 FilterSecondary = secondaryImageFilter, 1972 FilterColor = imageFilterColorCode, 1973 Style = imageStyle, 1974 ImageDefault = new ImageSettings 1975 { 1976 Crop = cropMode, 1977 Height = 845, 1978 Width = 1920 1979 }, 1980 ImageMedium = new ImageSettings 1981 { 1982 Crop = cropMode, 1983 Height = 420, 1984 Width = 960 1985 }, 1986 ImageSmall = new ImageSettings 1987 { 1988 Crop = cropMode, 1989 Height = 544, 1990 Width = 640 1991 } 1992 }; 1993 } 1994 1995 if (paragraphWidth != "auto" && paragraphImage != null) { 1996 if (Convert.ToInt32(paragraphWidth) < 7) 1997 { 1998 paragraphImage.ImageDefault = new ImageSettings 1999 { 2000 Crop = cropMode, 2001 Height = 544, 2002 Width = 640 2003 }; 2004 } 2005 } 2006 2007 ContentParagraph paragraph = new ContentParagraph 2008 { 2009 Title = title, 2010 Text = item.GetString("Text"), 2011 Image = paragraphImage, 2012 Link = item.GetString("Link"), 2013 Module = !String.IsNullOrEmpty(Model.GetModuleOutput()) && renderModule ? Model.GetModuleOutput() : "", 2014 InnerPaddingCss = item.GetList("InnerPadding") != null ? "paragraph-container__body--padding-" + item.GetList("InnerPadding").SelectedValue : "", 2015 CardCss = cardClass, 2016 HideOuterPadding = item.GetBoolean("HidePadding"), 2017 SetImageAsBackground = item.GetList("ImageStyle").SelectedValue.ToLower() == "background" ? true : false, 2018 ButtonWrapperCss = buttonSpacing + buttonAlignment, 2019 Layout = layout 2020 }; 2021 2022 if (!String.IsNullOrEmpty(item.GetString("Link"))) 2023 { 2024 paragraph.ButtonPrimary = new Link 2025 { 2026 Href = item.GetString("Link"), 2027 Title = item.GetString("LinkText"), 2028 ButtonLayout = primaryButtonLayout, 2029 CssClass = "u-no-margin" 2030 }; 2031 2032 if (!String.IsNullOrEmpty(item.GetString("SecondaryLink"))) { 2033 paragraph.ButtonPrimary.CssClass = ""; 2034 } 2035 } 2036 2037 if (!String.IsNullOrEmpty(item.GetString("SecondaryLink"))) 2038 { 2039 if (!String.IsNullOrEmpty(item.GetString("Link"))) 2040 { 2041 paragraph.ButtonPrimary.CssClass += " u-margin-right--lg"; 2042 } 2043 2044 paragraph.ButtonSecondary = new Link 2045 { 2046 Href = item.GetString("SecondaryLink"), 2047 Title = item.GetString("SecondaryLinkText"), 2048 ButtonLayout = secondaryButtonLayout 2049 }; 2050 } 2051 2052 <div class="paragraph-container @paragraphClasses dw-mod"> 2053 @if (setImageAsBackground == true && paragraphImage != null) 2054 { 2055 paragraphImage.CssClass = "background-image__cover"; 2056 2057 <div class="background-image dw-mod"> 2058 <div class="background-image__wrapper dw-mod"> 2059 @Render(paragraphImage) 2060 </div> 2061 </div> 2062 } 2063 @{ 2064 switch (layout) 2065 { 2066 case "title-top": 2067 @RenderLayoutTitleTop(paragraph) 2068 break; 2069 case "image-left": 2070 @RenderLayoutImageLeft(paragraph) 2071 break; 2072 case "image-right": 2073 @RenderLayoutImageRight(paragraph) 2074 break; 2075 case "image-centered": 2076 @RenderLayoutImageCentered(paragraph) 2077 break; 2078 case "all-centered": 2079 @RenderLayoutAllCentered(paragraph) 2080 break; 2081 case "middle-center": 2082 case "middle-left": 2083 @RenderLayoutMiddle(paragraph) 2084 break; 2085 default: 2086 @RenderLayoutImageTop(paragraph) 2087 break; 2088 } 2089 } 2090 </div> 2091 @* 2092 <div class="grid__col-md-12 grid__col--bleed"> 2093 <section class="multiple-paragraphs-container paragraph-container--full-width multiple-paragraphs-container--spacing-sm dw-mod" style="color: #4C4949;background-color: #EEEEEE;"> 2094 <!-- kontakt Afsnit her 3 --> 2095 @RenderParagraphContent(5556) 2096 <!--@Global:Paragraph.Content(5556)--> 2097 </section> 2098 </div> 2099 *@ 2100 } 2101 } 2102 2103 2104 @helper RenderLayoutTitleTop(ContentParagraph settings) 2105 { 2106 <div class="grid__cell @settings.CardCss @settings.InnerPaddingCss dw-mod"> 2107 @Render(new Heading { Level = 2, Title = settings.Title, Link = settings.Link }) 2108 @if (!settings.SetImageAsBackground && settings.Image != null) 2109 { 2110 <div class="u-margin-bottom--lg"> 2111 @Render(settings.Image) 2112 </div> 2113 } 2114 @Render(new Text { Content = settings.Text}) 2115 @Render(new ContentModule { Content = settings.Module }) 2116 2117 @if (settings.ButtonPrimary != null || settings.ButtonSecondary != null) 2118 { 2119 <div class="grid__cell"> 2120 <div class="paragraph-container__button @settings.ButtonWrapperCss dw-mod"> 2121 @Render(settings.ButtonPrimary) 2122 @Render(settings.ButtonSecondary) 2123 </div> 2124 </div> 2125 } 2126 </div> 2127 } 2128 2129 @helper RenderLayoutImageLeft(ContentParagraph settings) 2130 { 2131 <div class="grid__cell @settings.CardCss @settings.InnerPaddingCss dw-mod"> 2132 <div class="grid grid--external-bleed"> 2133 @if (!settings.SetImageAsBackground && settings.Image != null) 2134 { 2135 <div class="grid__col-3"> 2136 @Render(settings.Image) 2137 </div> 2138 } 2139 <div class="grid__col-9 @settings.InnerPaddingCss dw-mod"> 2140 @Render(new Heading { Level = 2, Title = settings.Title, Link = settings.Link }) 2141 @Render(new Text { Content = settings.Text }) 2142 @Render(new ContentModule { Content = settings.Module }) 2143 2144 @if (settings.ButtonPrimary != null || settings.ButtonSecondary != null) 2145 { 2146 <div class="grid__cell"> 2147 <div class="paragraph-container__button @settings.ButtonWrapperCss dw-mod"> 2148 @Render(settings.ButtonPrimary) 2149 @Render(settings.ButtonSecondary) 2150 </div> 2151 </div> 2152 } 2153 </div> 2154 </div> 2155 </div> 2156 } 2157 2158 @helper RenderLayoutImageRight(ContentParagraph settings) 2159 { 2160 <div class="grid__cell @settings.CardCss"> 2161 <div class="grid grid--external-bleed"> 2162 <div class="grid__col-9 @settings.InnerPaddingCss dw-mod"> 2163 @Render(new Heading { Level = 2, Title = settings.Title, Link = settings.Link }) 2164 @Render(new Text { Content = settings.Text }) 2165 @Render(new ContentModule { Content = settings.Module }) 2166 2167 @if (settings.ButtonPrimary != null || settings.ButtonSecondary != null) 2168 { 2169 <div class="grid__cell"> 2170 <div class="paragraph-container__button @settings.ButtonWrapperCss dw-mod"> 2171 @Render(settings.ButtonPrimary) 2172 @Render(settings.ButtonSecondary) 2173 </div> 2174 </div> 2175 } 2176 </div> 2177 @if (!settings.SetImageAsBackground && settings.Image != null) 2178 { 2179 <div class="grid__col-3"> 2180 @Render(settings.Image) 2181 </div> 2182 } 2183 </div> 2184 </div> 2185 } 2186 2187 @helper RenderLayoutImageCentered(ContentParagraph settings) 2188 { 2189 <div class="grid__cell @settings.CardCss @settings.InnerPaddingCss dw-mod"> 2190 2191 <div class="u-ta-center"> 2192 @if (!settings.SetImageAsBackground && settings.Image != null) 2193 { 2194 <div class="u-margin-bottom--lg u-inline-block"> 2195 @Render(settings.Image) 2196 </div> 2197 } 2198 </div> 2199 2200 @Render(new Heading { Level = 2, Title = settings.Title, Link = settings.Link }) 2201 @Render(new Text { Content = settings.Text }) 2202 @Render(new ContentModule { Content = settings.Module }) 2203 2204 @if (settings.ButtonPrimary != null || settings.ButtonSecondary != null) 2205 { 2206 <div class="paragraph-container__button @settings.ButtonWrapperCss dw-mod"> 2207 @Render(settings.ButtonPrimary) 2208 @Render(settings.ButtonSecondary) 2209 </div> 2210 } 2211 </div> 2212 } 2213 2214 @helper RenderLayoutAllCentered(ContentParagraph settings) 2215 { 2216 <div class="grid__cell @settings.CardCss @settings.InnerPaddingCss dw-mod"> 2217 2218 <div class="u-ta-center"> 2219 @if (!settings.SetImageAsBackground && settings.Image != null) 2220 { 2221 <div class="u-margin-bottom--lg u-inline-block"> 2222 @Render(settings.Image) 2223 </div> 2224 } 2225 @Render(new Heading { Level = 2, Title = settings.Title, Link = settings.Link }) 2226 @Render(new Text { Content = settings.Text }) 2227 @Render(new ContentModule { Content = settings.Module }) 2228 </div> 2229 2230 @if (settings.ButtonPrimary != null || settings.ButtonSecondary != null) 2231 { 2232 <div class="paragraph-container__button @settings.ButtonWrapperCss dw-mod"> 2233 @Render(settings.ButtonPrimary) 2234 @Render(settings.ButtonSecondary) 2235 </div> 2236 } 2237 </div> 2238 } 2239 2240 @helper RenderLayoutMiddle(ContentParagraph settings) 2241 { 2242 <div> 2243 <div class="grid__cell @settings.CardCss @settings.InnerPaddingCss dw-mod"> 2244 2245 <div class="@(settings.Layout == "middle-center" ? "u-ta-center" : "")"> 2246 @if (!settings.SetImageAsBackground && settings.Image != null) 2247 { 2248 <div class="u-margin-bottom--lg u-inline-block"> 2249 @Render(settings.Image) 2250 </div> 2251 } 2252 @Render(new Heading { Level = 2, Title = settings.Title, Link = settings.Link }) 2253 @Render(new Text { Content = settings.Text }) 2254 @Render(new ContentModule { Content = settings.Module }) 2255 </div> 2256 2257 @if (settings.ButtonPrimary != null || settings.ButtonSecondary != null) 2258 { 2259 <div class="paragraph-container__button @settings.ButtonWrapperCss dw-mod"> 2260 @Render(settings.ButtonPrimary) 2261 @Render(settings.ButtonSecondary) 2262 </div> 2263 } 2264 </div> 2265 </div> 2266 } 2267 2268 @helper RenderLayoutImageTop(ContentParagraph settings) 2269 { 2270 <div class="grid__cell @settings.CardCss"> 2271 @if (!settings.SetImageAsBackground && settings.Image != null) 2272 { 2273 <div class="u-margin-bottom--lg"> 2274 @Render(settings.Image) 2275 </div> 2276 } 2277 2278 <div class="@settings.InnerPaddingCss dw-mod"> 2279 @Render(new Heading { Level = 2, Title = settings.Title, Link = settings.Link }) 2280 @Render(new Text { Content = settings.Text }) 2281 @Render(new ContentModule { Content = settings.Module }) 2282 2283 @if (settings.ButtonPrimary != null || settings.ButtonSecondary != null) 2284 { 2285 <div class="paragraph-container__button @settings.ButtonWrapperCss dw-mod"> 2286 @Render(settings.ButtonPrimary) 2287 @Render(settings.ButtonSecondary) 2288 </div> 2289 } 2290 </div> 2291 </div> 2292 2293 2294 2295 2296 @* 2297 <div class="grid__col-md-12 grid__col--bleed"> 2298 <!-- kontakt Afsnit her 2 --> 2299 2300 </div> 2301 *@ 2302 2303 } 2304 2305 2306 @{ 2307 string fontColor = !string.IsNullOrEmpty(Model.Item.GetString("FontColor")) && !Model.Item.GetString("FontColor").StartsWith("#") ? "u-" + Model.Item.GetString("FontColor").Replace(" ", "-").ToLower() : ""; 2308 string backgroundColor = !string.IsNullOrEmpty(Model.Item.GetString("BackgroundColor")) && !Model.Item.GetString("BackgroundColor").StartsWith("#") ? "u-" + Model.Item.GetString("BackgroundColor").Replace(" ", "-").ToLower() + "--bg" : ""; 2309 string colorSettings = Model.Item.GetString("FontColor").StartsWith("#") || Model.Item.GetString("BackgroundColor").StartsWith("#") ? "style=\"" : ""; 2310 string fontColorHex = Model.Item.GetString("FontColor").StartsWith("#") ? "color: " + Model.Item.GetString("FontColor") + ";" : ""; 2311 string backgroundColorHex = Model.Item.GetString("BackgroundColor").StartsWith("#") ? "background-color: " + Model.Item.GetString("BackgroundColor") + ";" : ""; 2312 colorSettings += fontColorHex; 2313 colorSettings += backgroundColorHex; 2314 colorSettings += Model.Item.GetString("FontColor").StartsWith("#") || Model.Item.GetString("BackgroundColor").StartsWith("#") ? "\"" : ""; 2315 2316 string paragraphContainerClasses = ""; 2317 string containerClasses = ""; 2318 string gridClasses = ""; 2319 2320 string spacingSize = Model.Item.GetList("Spacing") != null && Model.Item.GetList("Spacing").SelectedValue != "" ? Model.Item.GetList("Spacing").SelectedValue : "lg"; 2321 2322 switch (Model.Item.GetList("Width").SelectedValue) 2323 { 2324 case "center": 2325 containerClasses += "center-container paragraph-container "; 2326 paragraphContainerClasses += " " + fontColor + " " + backgroundColor; 2327 break; 2328 case "full": 2329 containerClasses += fontColor + " " + backgroundColor + " "; 2330 paragraphContainerClasses += "paragraph-container--full-width "; 2331 break; 2332 case "combi": 2333 paragraphContainerClasses += "paragraph-container--full-width " + fontColor + " " + backgroundColor + " "; 2334 containerClasses += "center-container paragraph-container "; 2335 break; 2336 default: 2337 paragraphContainerClasses += "center-container "; 2338 break; 2339 } 2340 2341 //Background 2342 2343 2344 string focalPointParameters = Model.Item.GetFile("BackgroundImage") != null ? "&" + Model.Item.GetFile("BackgroundImage").GetFocalPointParameters() : ""; 2345 2346 string containerBackgroundImageFilterColor = Model.Item.GetList("ColorForTheFilter") != null ? Model.Item.GetString("ColorForTheFilter").Replace(" ", "-").ToLower() : "none"; 2347 string containerBackgroundImageFilterPrimary = Model.Item.GetList("ImageFilterPrimary") != null ? Model.Item.GetList("ImageFilterPrimary").SelectedValue : "none"; 2348 string containerBackgroundImageFilterSecondary = Model.Item.GetList("ImageFilterSecondary") != null ? Model.Item.GetList("ImageFilterSecondary").SelectedValue : "none"; 2349 string containerBackgroundImageFilterColorCode = Model.Item.GetString("ColorForTheFilter").StartsWith("#") && containerBackgroundImageFilterPrimary == "colorize" ? "style=\"background-color: " + GenerateRgba(Model.Item.GetString("ColorForTheFilter"), 0.3) + "\"" : ""; 2350 2351 if (containerBackgroundImageFilterPrimary == "colorize" && !containerBackgroundImageFilterPrimary.StartsWith("#")) 2352 { 2353 containerBackgroundImageFilterPrimary = containerBackgroundImageFilterColor; 2354 } 2355 2356 if (Model.Item.GetFile("BackgroundImage") == null) { 2357 backgroundColor = "u-color-light--bg"; 2358 } 2359 2360 //Separation line 2361 bool hasSeparationLine = Model.Item.GetBoolean("SeperationLineAfter"); 2362 if (hasSeparationLine && Model.Item.GetList("Width").SelectedValue != "center") 2363 { 2364 paragraphContainerClasses += "multiple-paragraphs-container--seperation-line-after "; 2365 } 2366 else if (hasSeparationLine) 2367 { 2368 containerClasses += "multiple-paragraphs-container--seperation-line-after "; 2369 } 2370 2371 //Alternative Design Layout 2372 var designLayout = Model.Item.GetItem("CustomSettings") != null ? Model.Item.GetItem("CustomSettings").GetString("DesignLayout") != null ? Model.Item.GetItem("CustomSettings").GetList("DesignLayout").SelectedValue : "" : ""; 2373 paragraphContainerClasses += !String.IsNullOrEmpty(designLayout) ? designLayout : ""; 2374 2375 var paragraphHeight = Model.Item.GetList("Height").SelectedValue; 2376 //Height 2377 if (!string.IsNullOrEmpty(paragraphHeight)) 2378 { 2379 gridClasses += "paragraph-container--height-" + paragraphHeight + " " + (paragraphHeight == "screen" ? "screen-height " : ""); 2380 } 2381 2382 if (Model.Item.GetString("MakeParagraphsCenterAligned") != null && Model.Item.GetBoolean("MakeParagraphsCenterAligned")) 2383 { 2384 gridClasses += "grid--justify-center "; 2385 } 2386 2387 //Set as carousel 2388 if (Model.Item.GetBoolean("EnableCarousel")) 2389 { 2390 containerClasses.Replace(" paragraph-container ", ""); 2391 } 2392 2393 //getting video ID from youtube URL 2394 string videoCode = Model.Item.GetString("VideoURL"); 2395 Regex regex = new Regex(@".be\/(.[^?]*)"); 2396 Match match = regex.Match(videoCode); 2397 string videoId = ""; 2398 if (match.Success) 2399 { 2400 videoId = match.Groups[1].Value; 2401 } 2402 else 2403 { 2404 regex = new Regex(@"v=([^&]+)"); 2405 match = regex.Match(videoCode); 2406 if (match.Success) 2407 { 2408 videoId = match.Groups[1].Value; 2409 } 2410 } 2411 } 2412 2413 <div class="grid__col-md-12 grid__col--bleed"> 2414 <section class="multiple-paragraphs-container @paragraphContainerClasses multiple-paragraphs-container--spacing-@spacingSize dw-mod" @colorSettings> 2415 <div class="background-image image-filter image-filter--@containerBackgroundImageFilterPrimary dw-mod" @containerBackgroundImageFilterColorCode> 2416 <div class="background-image__wrapper image-filter image-filter--@containerBackgroundImageFilterSecondary dw-mod"> 2417 @if (!String.IsNullOrEmpty(Model.Item.GetString("BackgroundImage"))) { 2418 @Render(new Image { 2419 Path = Model.Item.GetFile("BackgroundImage").PathUrlEncoded + focalPointParameters, 2420 CssClass = "background-image__cover", 2421 ImageDefault = new ImageSettings { 2422 Width = 1920, 2423 Height = 845, 2424 Crop = 0, 2425 FillCanvas = true 2426 }, 2427 ImageMedium = new ImageSettings 2428 { 2429 Width = 1024, 2430 Height = 450, 2431 Crop = 0, 2432 FillCanvas = true 2433 }, 2434 ImageSmall = new ImageSettings 2435 { 2436 Width = 640, 2437 Height = 544, 2438 Crop = 0, 2439 FillCanvas = true 2440 } 2441 }) 2442 } 2443 2444 @if (!string.IsNullOrEmpty(videoId)) 2445 { 2446 <div class="video-background"> 2447 <div class="video-background__container"> 2448 <div class="js-youtube-video" data-video="@videoId" id="ytPlayer@(Model.ID)"></div> 2449 </div> 2450 </div> 2451 } 2452 </div> 2453 </div> 2454 2455 @if (!Model.Item.GetBoolean("EnableCarousel")) 2456 { 2457 <div class="@containerClasses dw-mod"> 2458 <div class="grid @gridClasses dw-mod"> 2459 @foreach (var paragraph in Model.Item.GetItems("Paragraph")) 2460 { 2461 @RenderParagraph(paragraph, false) 2462 } 2463 @if (!String.IsNullOrEmpty(Model.GetModuleOutput())) { 2464 <div class="paragraph-container grid__col-12 dw-mod"> 2465 @Render(new ContentModule { Content = Model.GetModuleOutput() }) 2466 </div> 2467 } 2468 </div> 2469 </div> 2470 } 2471 else 2472 { 2473 var slides = new List<List<Dynamicweb.Frontend.ItemViewModel>>(); 2474 int tempColumnsCount = 0; 2475 var paragraphs = Model.Item.GetItems("Paragraph"); 2476 bool hasAtLeastOneVisibleParagraph = false; 2477 if (paragraphs.Count > 0) 2478 { 2479 slides.Add(new List<Dynamicweb.Frontend.ItemViewModel>()); 2480 } 2481 2482 foreach (var paragraph in paragraphs) 2483 { 2484 int columnWidth = 0; 2485 if (Pageview.Device.ToString() == "Mobile" && paragraph.GetList("WidthMobile").SelectedValue == "hide") 2486 { 2487 continue; 2488 } 2489 hasAtLeastOneVisibleParagraph = true; 2490 if (paragraph.GetList("Width").SelectedValue != "auto") 2491 { 2492 columnWidth = Pageview.Device.ToString() != "Mobile" ? Int32.Parse(paragraph.GetList("Width").SelectedValue) : Int32.Parse(paragraph.GetList("WidthMobile").SelectedValue); 2493 } 2494 else 2495 { 2496 columnWidth = 1; 2497 } 2498 2499 if (tempColumnsCount + columnWidth > 12) 2500 { 2501 slides.Add(new List<Dynamicweb.Frontend.ItemViewModel>()); 2502 tempColumnsCount = 0; 2503 } 2504 2505 slides[slides.Count - 1].Add(paragraph); 2506 tempColumnsCount += columnWidth; 2507 } 2508 2509 if (hasAtLeastOneVisibleParagraph) 2510 { 2511 <div class="@containerClasses dw-mod"> 2512 <div class="carousel dw-mod" id="Paragraph_@(Model.ID)"> 2513 <div class="carousel__container js-carousel-slides dw-mod"> 2514 @foreach (var slide in slides) 2515 { 2516 <div class="carousel__slide dw-mod"> 2517 <div class="grid @gridClasses dw-mod"> 2518 @foreach (var paragraph in slide) 2519 { 2520 @RenderParagraph(paragraph, false) 2521 } 2522 </div> 2523 </div> 2524 } 2525 </div> 2526 </div> 2527 </div> 2528 } 2529 2530 if (slides.Count > 1) 2531 { 2532 bool enableDots = Model.Item.GetBoolean("ShowDots"); 2533 2534 <script> 2535 document.addEventListener("DOMContentLoaded", function () { 2536 new CarouselModule("#Paragraph_@(Model.ID)", { 2537 slideTime: @Model.Item.GetString("SlideTime"), 2538 dots: @(Model.Item.GetBoolean("ShowDots").ToString().ToLower()) 2539 }); 2540 }) 2541 </script> 2542 } 2543 } 2544 </section> 2545 </div> 2546

Olie- og boreplatforme

Granzow er leverandør til offshore olie-og gasindustrien i skruekompressorer, trykluft behandling, energivenlige kompressor kontrol og container løsninger.

Vi forhandler også et komplet sortiment af automatiserings produkter, såsom sprængplader, Lucifer Magnetventiler, termostater, ventiler, pneumatiske cylindre. Disse kommer i overensstemmelse med ATEX-direktiverne.

Et omfattende program af effektive pumper som højtrykspumper, membranpumper, slangepumper, mobile pumper.

Komplet serie af vakuumpumper, måleudstyr, lækagesøgning systemer og sputter-systemer.

Se udvalget af vores offshore produkter