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

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

BikeShop Aalborg

Adresse
Østerbro 3
9100 Aalborg

Tlf: 12345678
Mail: BikeShopAlborg@mail.dk

BikeShop Aarhus

Adresse
Bjørnholms Allé 30
8260 Viby J

Tlf: 19876234
Mail: BikeShopAarhus@mail.dk

BikeShop Copenhagen

Adresse
Ingemannsvej 1
1964 Frederiksbjerg C.

Tlf: 11663388
Mail: BikeShopCPH@mail.dk

Kontakt os

Hvis du har spørgsmål, skriv venligst til vores hovedkontor, brug venligst vores form. En af vores ansatte vil kontakte dig så hurtigt så muligt. 

Åbningstider på kontoret
Mandag til Fredag 7.00-16.00
Lørdag 10.00-14.00

 

Ved at kontakte os accepterer du, at dine oplysninger vil blive gemt i vores backend og CRM-system. Læs mere i vores persondatapolitik.

[Include file 'Blocks/Maps/Custom__Blocks.cshtml' not found in 'Templates/Designs/Rapido/Paragraph/Maps.cshtml']

Find os

  • 1
    BikeShop Aalborg
    Østerbro 3
    9100 Aalborg
  • 2
    BikeShop Aarhus
    Bjørnholms Allé 30
    8260 Viby J
  • 3
    BikeShop København
    Ingemannsvej 1
    1964 Frederiksberg
  • 4
    BikeShop Odense
    Klaregade 2
    5000 Odense