Fri fragt over 350 kr     Afsendelse 1-2 hverdage
Error executing template "Designs/Rapido/Paragraph/ParagraphContainer.cshtml"
System.IO.FileNotFoundException: Could not find file 'D:\dynamicweb.net\Solutions\FlexMedia\flexmediarapidoempty.dw9.dynamicweb-cms.com\Files\Images\KretaMadplus1jpg'.
File name: 'D:\dynamicweb.net\Solutions\FlexMedia\flexmediarapidoempty.dw9.dynamicweb-cms.com\Files\Images\KretaMadplus1jpg'
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.File.GetAttributes(String path)
   at Dynamicweb.Content.Files.FilesPermissionHelper.HasAccessToSecureFolder(String fullPath)
   at Dynamicweb.Content.Items.Editors.FileEditor.GetViewModelValue(Object value)
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at Dynamicweb.Frontend.ItemFieldViewModel.GetValue()
   at Dynamicweb.Frontend.ItemFieldViewModel.GetValue[T]()
   at Dynamicweb.Frontend.ItemViewModel.GetFile(String systemName)
   at CompiledRazorTemplates.Dynamic.RazorEngine_8b286cfbfce640abb16ddc3a6540c262.Execute() in D:\dynamicweb.net\Solutions\FlexMedia\flexmediarapidoempty.dw9.dynamicweb-cms.com\Files\Templates\Designs\Rapido\Paragraph\ParagraphContainer.cshtml:line 2314
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

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

Medlemsfordele

  • Bliv inviteret til spændende arrangementer hos vores leverandører på Kreta 
  • Bliv inviteret til foredrag og smagninger før alle andre
  • Få særlige rabatter på udvalgte arrangementer
  • Modtag spændende og informative nyhedsbreve
  • Få medlemstilbud med særligt gode priser på udvalgte produkter
  • Deltag i konkurrencer om fine præmier
  • Log ind i vores kundecenter og se tidligere ordrer, genbestil m.v

 

Tilmeld dig Kreta Mad+

Jeg giver hermed samtykke til at Kreta Mad må sende mig e-mails eller anden elektronisk materiale med nyheder, tilbud, konkurrencer, tips og ideer. Du vil inden for kort tid efter tilmelding få en velkomstmail. Du kan til enhver tid trække dit samtykke tilbage. 

Ved tilmelding til Kreta Mad+ giver jeg samtykke til, at Kreta Mad må gemme og anvende mine persondata i overensstemmelse med Kreta Mads persondatapolitik. Du kan læse mere om Kreta Mads håndtering af dine persondata her.

Månedens supertilbud

I november måned kan alle medlemmer af Kreta Mad+ få et super godt tilbud på vinegars fra Terra Creta. Du kan i denne måned få en rød og hvid vinegar for kun 100 kr. – du sparer altså hele 40% på disse skønne balsamicoeddiker.