Saca el máximo partido a tu gama

 

Adaptación de la chimenea

¿Qué necesitamos saber sobre la personalización de chimeneas especiales?

 

*1 : Altura del conducto

*2 : Altura total

*3 : Grados de inclinación

*4 : Salida central

Cómo medir el ángulo

 

Si el bisel se va a cortar en diagonal en el canal, el punto más alto del canal debe anotarse en la información adicional. El punto más alto se describe desde el dial.

La línea discontinua roja muestra un ejemplo donde el punto más alto es
a la 1:30 am

Estos puntos deben ser abandonados.

Estos puntos deben indicarse al realizar el pedido.

Altura total = medida del centro: (*2)

Grados: (*3)

Lado más alto: (Derecho o izquierdo)


Si tiene alguna pregunta, comuníquese con nuestra oficina de ventas.

Error executing template "Designs/Rapido/ContentPage/Paragraph/StandardParagraphOne.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_5801b4bba1724d949c46d51c0be0abd9.<RenderTheContent>b__46_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\S_DW_Thermex\Files\Templates\Designs\Rapido\ContentPage\Paragraph\StandardParagraphOne.cshtml:line 2189
   at CompiledRazorTemplates.Dynamic.RazorEngine_5801b4bba1724d949c46d51c0be0abd9.Execute() in D:\dynamicweb.net\Solutions\S_DW_Thermex\Files\Templates\Designs\Rapido\ContentPage\Paragraph\StandardParagraphOne.cshtml:line 2140
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

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