Error executing template "Designs/Rapido/Paragraph/ParagraphContainer.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_f3ee8cae224b43e0aa4bc45e8a66210b.Execute() in E:\Dynamicweb.net\Solutions\FlexMedia\sensor.dw9.dynamicweb-cms.com\Files\Templates\Designs\Rapido\Paragraph\ParagraphContainer.cshtml:line 2703
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

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

Selvbetjening

Selvbetjeningsløsninger til udfordrende miljøer er værktøjer og systemer, der giver brugerne mulighed for at betjene sig selv og udføre forskellige opgaver eller transaktioner i miljøer, der kan være komplekse eller vanskelige. Disse løsninger er designet til at lette processen og forbedre effektiviteten i situationer, hvor der kan være begrænset adgang til personlig assistance eller hvor der er specifikke udfordringer, der skal overvindes.

Nogle eksempler på selvbetjeningsløsninger til udfordrende miljøer inkluderer:

Selvbetjeningskiosker: Disse er fysiske terminaler, der er placeret i offentlige rum eller specifikke miljøer og giver brugerne mulighed for at udføre forskellige opgaver. For eksempel kan selvbetjeningskiosker findes i lufthavne, hvor rejsende kan checke ind, udskrive boardingpas og foretage ændringer i deres reservationer uden at skulle interagere med personale.

Mobilapps: Mobilapplikationer kan være en effektiv selvbetjeningsløsning til udfordrende miljøer. For eksempel kan mobilapps bruges i områder med dårlig internetforbindelse eller i fjerntliggende områder, hvor brugerne kan udføre transaktioner eller få adgang til oplysninger offline.

Online selvbetjening: Online-platforme og websteder giver brugerne mulighed for at udføre forskellige opgaver eller transaktioner uden behov for fysisk tilstedeværelse. For eksempel kan online selvbetjeningsløsninger anvendes til at administrere bankkonti, betale regninger, planlægge rejser og foretage indkøb.

Automatiserede betalingsløsninger: I udfordrende miljøer kan selvbetjeningsløsninger til betaling være særligt nyttige. Dette kan omfatte betalingsautomater, kontaktløse betalingssystemer eller mobile betalingsløsninger, der giver brugerne mulighed for at foretage betalinger uden at skulle interagere med en person.

Selvbetjening i sundhedssektoren: I sundhedssektoren kan selvbetjeningsløsninger være gavnlige i udfordrende miljøer som hospitaler eller klinikker. Dette kan omfatte selvbetjeningsregistrering, online tidsbestillingssystemer, elektronisk patientjournaladgang og selvtestningsudstyr.

Selvbetjeningsløsninger til udfordrende miljøer er designet til at forbedre effektiviteten, spare tid og give brugerne en mere fleksibel og bekvem oplevelse. Ved at implementere sådanne løsninger kan organisationer forbedre deres service og tilgængelighed i miljøer, hvor der kan være begrænsninger eller udfordringer ved traditionelle betjeningsmetoder.

Denne hjemmeside bruger cookies

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

Du kan altid slette gemte cookies i dine browserinstillinger

Show details