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