Error executing template "Designs/Rapido/Paragraph/ParagraphContainer.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_f4ba310f5d7f4b2292a4865c801afc0a.Execute() in f:\Domains\Sites\asibrake.com\Files\Templates\Designs\Rapido\Paragraph\ParagraphContainer.cshtml:line 2461
   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> @using System.Collections.Generic @using System @using System.Text.RegularExpressions @using Dynamicweb.Core @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @functions { public string GenerateRgba(string color, double opacity) { color = color.Replace("#", ""); if (color.Length == 6) { return "rgba(" + Convert.ToInt32(color.Substring(0, 2), 16) + ", " + Convert.ToInt32(color.Substring(2, 2), 16) + ", " + Convert.ToInt32(color.Substring(4, 2), 16) + ", " + opacity + ");"; } else { return Convert.ToInt16(color).ToString(); } } } @* Include the required Grid builder (Contains the methods @RenderBlockList and @RenderBlock) *@ @using System.Text.RegularExpressions @using System.Collections.Generic @using System.Reflection @using System.Web @using System.Web.UI.HtmlControls @using Dynamicweb.Rapido.Blocks.Components @using Dynamicweb.Rapido.Blocks.Components.Articles @using Dynamicweb.Rapido.Blocks.Components.Documentation @using Dynamicweb.Rapido.Blocks @*--- START: Base block renderers ---*@ @helper RenderBlockList(List<Block> blocks) { bool debug = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("debug")) ? Convert.ToBoolean(HttpContext.Current.Request.QueryString.Get("debug")) : false; blocks = blocks.OrderBy(item => item.SortId).ToList(); foreach (Block item in blocks) { if (debug) { <!-- Block START: @item.Id --> } if (item.Design == null) { @RenderBlock(item) } else if (item.Design.RenderType == RenderType.None) { string cssClass = item.Design.CssClass != null ? item.Design.CssClass : ""; <div class="@cssClass dw-mod"> @RenderBlock(item) </div> } else if (item.Design.RenderType != RenderType.Hide) { string cssClass = item.Design.CssClass != null ? item.Design.CssClass : ""; if (!item.SkipRenderBlocksList) { if (item.Design.RenderType == RenderType.Row) { <div class="grid grid--align-content-start @cssClass dw-mod" id="Block__@item.Id"> @RenderBlock(item) </div> } if (item.Design.RenderType == RenderType.Column) { string hidePadding = item.Design.HidePadding ? "u-no-padding" : ""; string size = item.Design.Size ?? "12"; size = Regex.IsMatch(size, @"\d") ? "md-" + item.Design.Size : item.Design.Size; <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"> @RenderBlock(item) </div> } if (item.Design.RenderType == RenderType.Table) { <table class="table @cssClass dw-mod" id="Block__@item.Id"> @RenderBlock(item) </table> } if (item.Design.RenderType == RenderType.TableRow) { <tr class="@cssClass dw-mod" id="Block__@item.Id"> @RenderBlock(item) </tr> } if (item.Design.RenderType == RenderType.TableColumn) { <td class="@cssClass dw-mod" id="Block__@item.Id"> @RenderBlock(item) </td> } if (item.Design.RenderType == RenderType.CardHeader) { <div class="card-header @cssClass dw-mod"> @RenderBlock(item) </div> } if (item.Design.RenderType == RenderType.CardBody) { <div class="card @cssClass dw-mod"> @RenderBlock(item) </div> } if (item.Design.RenderType == RenderType.CardFooter) { <div class="card-footer @cssClass dw-mod"> @RenderBlock(item) </div> } } else { @RenderBlock(item) } } if (debug) { <!-- Block END: @item.Id --> } } } @helper RenderBlock(Block item) { bool debug = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("debug")) ? Convert.ToBoolean(HttpContext.Current.Request.QueryString.Get("debug")) : false; if (item.Template != null) { @BlocksPage.RenderTemplate(item.Template) } if (item.Component != null) { string customSufix = "Custom"; string methodName = item.Component.HelperName; ComponentBase[] methodParameters = new ComponentBase[1]; methodParameters[0] = item.Component; Type methodType = this.GetType(); MethodInfo customMethod = methodType.GetMethod(methodName + customSufix); MethodInfo generalMethod = methodType.GetMethod(methodName); try { if (debug) { <!-- Component: @methodName.Replace("Render", "") --> } @customMethod.Invoke(this, methodParameters).ToString(); } catch { try { @generalMethod.Invoke(this, methodParameters).ToString(); } catch(Exception ex) { throw new Exception(item.Component.GetType().Name + " method '" + methodName +"' could not be invoked", ex); } } } if (item.BlocksList.Count > 0 && !item.SkipRenderBlocksList) { @RenderBlockList(item.BlocksList) } } @*--- END: Base block renderers ---*@ @* Include the components *@ @using Dynamicweb.Rapido.Blocks.Components @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks @using System.IO @* Required *@ @using Dynamicweb.Rapido.Blocks.Components @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks @helper Render(ComponentBase component) { if (component != null) { @component.Render(this) } } @* Components *@ @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @* Component *@ @helper RenderIcon(Icon settings) { if (settings != null) { string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : ""; if (settings.Name != null) { if (string.IsNullOrEmpty(settings.Label)) { <i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i> } else { if (settings.LabelPosition == IconLabelPosition.Before) { <span>@settings.Label <i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i></span> } else { <span><i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i> @settings.Label</span> } } } else if (!string.IsNullOrEmpty(settings.Label)) { @settings.Label } } } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @using Dynamicweb.Core @* Component *@ @helper RenderButton(Button settings) { if (settings != null && (!string.IsNullOrEmpty(settings.Title) || settings.Icon != null)) { Dictionary<string, string> attributes = new Dictionary<string, string>(); List<string> classList = settings.CssClass != null ? settings.CssClass.Split(' ').ToList() : new List<string>(); if (settings.Disabled) { attributes.Add("disabled", "true"); classList.Add("disabled"); } if (!string.IsNullOrEmpty(settings.ConfirmText) || !string.IsNullOrEmpty(settings.ConfirmTitle)) { settings.Id = !string.IsNullOrEmpty(settings.Id) ? settings.Id : Guid.NewGuid().ToString("N"); @RenderConfirmDialog(settings); settings.OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = true"; } if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } if (!string.IsNullOrEmpty(settings.AltText)) { attributes.Add("title", settings.AltText); } else if (!string.IsNullOrEmpty(settings.Title)) { attributes.Add("title", settings.Title); } var onClickEvents = new List<string>(); if (!string.IsNullOrEmpty(settings.OnClick)) { onClickEvents.Add(settings.OnClick); } if (!string.IsNullOrEmpty(settings.Href)) { onClickEvents.Add("location.href='" + settings.Href + "'"); } if (onClickEvents.Count > 0) { attributes.Add("onClick", string.Join(";", onClickEvents)); } if (settings.ButtonLayout != ButtonLayout.None) { classList.Add("btn"); string btnLayout = Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower(); if (btnLayout == "linkclean") { btnLayout = "link-clean"; //fix } classList.Add("btn--" + btnLayout); } if (settings.Icon == null) { settings.Icon = new Icon(); } settings.Icon.Label = settings.Title; attributes.Add("type", Enum.GetName(typeof(ButtonType), settings.ButtonType).ToLower()); <button class="@string.Join(" ", classList) dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@Render(settings.Icon)</button> } } @helper RenderConfirmDialog(Button settings) { Modal confirmDialog = new Modal { Id = settings.Id, Width = ModalWidth.Sm, Heading = new Heading { Level = 2, Title = settings.ConfirmTitle }, BodyText = settings.ConfirmText }; confirmDialog.AddAction(new Button { Title = Translate("Cancel"), ButtonLayout = ButtonLayout.Secondary, OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = false"}); confirmDialog.AddAction(new Button { Title = Translate("OK"), ButtonLayout = ButtonLayout.Primary, OnClick = "document.getElementById('" + settings.Id + "ModalTrigger').checked = false;" + settings.OnClick }); @Render(confirmDialog) } @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @using Dynamicweb.Core @helper RenderDashboard(Dashboard settings) { var widgets = settings.GetWidgets(); if (!string.IsNullOrEmpty(settings.WidgetsBaseBackgroundColor)) { //set bg color for them System.Drawing.Color color = System.Drawing.ColorTranslator.FromHtml(settings.WidgetsBaseBackgroundColor); int r = Convert.ToInt16(color.R); int g = Convert.ToInt16(color.G); int b = Convert.ToInt16(color.B); var count = widgets.Length; var max = Math.Max(r, Math.Max(g, b)); double step = 255.0 / (max * count); var i = 0; foreach (var widget in widgets) { i++; var shade = "rgb(" + Converter.ToString(r * step * i).Replace(",", ".") + ", " + Converter.ToString(g * step * i).Replace(",", ".") + ", " + Converter.ToString(b * step * i).Replace(",", ".") + ")"; widget.BackgroundColor = shade; } } <div class="dashboard @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> @foreach (var widget in widgets) { <div class="dashboard__widget"> @Render(widget) </div> } </div> } @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @helper RenderDashboardWidgetLink(DashboardWidgetLink settings) { if (!string.IsNullOrEmpty(settings.Link)) { var backgroundStyles = ""; if (!string.IsNullOrEmpty(settings.BackgroundColor)) { backgroundStyles = "style=\"background-color:" + settings.BackgroundColor + "\""; } <a href="@settings.Link" class="widget widget--link @settings.CssClass dw-mod" @backgroundStyles title="@settings.Title" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> <div class="u-center-middle u-color-light"> @if (settings.Icon != null) { settings.Icon.CssClass += "widget__icon"; @Render(settings.Icon) } <div class="widget__title">@settings.Title</div> </div> </a> } } @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @helper RenderDashboardWidgetCounter(DashboardWidgetCounter settings) { var backgroundStyles = ""; if (!string.IsNullOrEmpty(settings.BackgroundColor)) { backgroundStyles = "style='background-color:" + settings.BackgroundColor + "'"; } <div class="widget @settings.CssClass dw-mod" @backgroundStyles @ComponentMethods.AddAttributes(settings.ExtraAttributes)> <div class="u-center-middle u-color-light"> @if (settings.Icon != null) { settings.Icon.CssClass += "widget__icon"; @Render(settings.Icon) } <div class="widget__counter">@settings.Count</div> <div class="widget__title">@settings.Title</div> </div> </div> } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @using Dynamicweb.Core @* Component *@ @helper RenderLink(Link settings) { if (settings != null && !string.IsNullOrEmpty(settings.Href) && (!string.IsNullOrEmpty(settings.Title) || settings.Icon != null)) { Dictionary<string, string> attributes = new Dictionary<string, string>(); List<string> classList = settings.CssClass != null ? settings.CssClass.Split(' ').ToList() : new List<string>(); if (settings.Disabled) { attributes.Add("disabled", "true"); classList.Add("disabled"); } if (!string.IsNullOrEmpty(settings.AltText)) { attributes.Add("title", settings.AltText); } else if (!string.IsNullOrEmpty(settings.Title)) { attributes.Add("title", settings.Title); } if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onClick", settings.OnClick); } attributes.Add("href", settings.Href); if (settings.ButtonLayout != ButtonLayout.None) { classList.Add("btn"); string btnLayout = Enum.GetName(typeof(ButtonLayout), settings.ButtonLayout).ToLower(); if (btnLayout == "linkclean") { btnLayout = "link-clean"; //fix } classList.Add("btn--" + btnLayout); } if (settings.Icon == null) { settings.Icon = new Icon(); } settings.Icon.Label = settings.Title; if (settings.Target == LinkTargetType.Blank && settings.Rel == LinkRelType.None) { settings.Rel = LinkRelType.Noopener; } if (settings.Target != LinkTargetType.None) { attributes.Add("target", "_" + Enum.GetName(typeof(LinkTargetType), settings.Target).ToLower()); } if (settings.Download) { attributes.Add("download", "true"); } if (settings.Rel != LinkRelType.None) { attributes.Add("rel", Enum.GetName(typeof(LinkRelType), settings.Rel).ToLower()); } <a class="@string.Join(" ", classList) dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@Render(settings.Icon)</a> } } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks @* Component *@ @helper RenderRating(Rating settings) { if (settings.Score > 0) { int rating = settings.Score; string iconType = "fa-star"; switch (settings.Type.ToString()) { case "Stars": iconType = "fa-star"; break; case "Hearts": iconType = "fa-heart"; break; case "Lemons": iconType = "fa-lemon"; break; case "Bombs": iconType = "fa-bomb"; break; } <div class="u-ta-right"> @for (int i = 0; i < settings.OutOf; i++) { <i class="@(rating > i ? "fas" : "far") @iconType"></i> } </div> } } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @* Component *@ @helper RenderSelectFieldOption(SelectFieldOption settings) { Dictionary<string, string> attributes = new Dictionary<string, string>(); if (settings.Checked) { attributes.Add("selected", "true"); } if (settings.Disabled) { attributes.Add("disabled", "true"); } if (settings.Value != null) { attributes.Add("value", settings.Value); } if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } <option @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Label</option> } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @* Component *@ @helper RenderNavigation(Navigation settings) { @RenderNavigation(new { id = settings.Id, cssclass = settings.CssClass, startLevel = settings.StartLevel, endlevel = settings.EndLevel, expandmode = settings.Expandmode, sitemapmode = settings.SitemapMode, template = settings.Template }) } @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @* Component *@ @helper RenderBreadcrumbNavigation(BreadcrumbNavigation settings) { settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id; settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template; settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel; settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel; settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode; settings.SitemapMode = false; @RenderNavigation(settings) } @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @* Component *@ @helper RenderLeftNavigation(LeftNavigation settings) { settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id; settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template; settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel; settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel; settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode; <div class="grid__cell"> @RenderNavigation(settings) </div> } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Core @* Component *@ @helper RenderHeading(Heading settings) { if (settings != null && !string.IsNullOrEmpty(settings.Title)) { string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : ""; string tagName = settings.Level != 0 ? "h" + settings.Level.ToString() : "div"; @("<" + tagName + " class=\"" + settings.CssClass + " dw-mod\" " + color + ">") if (!string.IsNullOrEmpty(settings.Link)) { @Render(new Link { Href = settings.Link, Icon = settings.Icon, Title = settings.Title, ButtonLayout = ButtonLayout.None }) } else { if (settings.Icon == null) { settings.Icon = new Icon(); } settings.Icon.Label = settings.Title; @Render(settings.Icon) } @("</" + tagName + ">"); } } @using Dynamicweb.Rapido.Blocks.Components @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks @* Component *@ @helper RenderImage(Image settings) { if (settings.FilterPrimary != ImageFilter.None || settings.FilterSecondary != ImageFilter.None) { Dictionary<string, string> optionalAttributes = new Dictionary<string, string>(); if (!string.IsNullOrEmpty(settings.FilterColor)) { optionalAttributes.Add("style", "background-color: " + settings.FilterColor); } if (settings.Caption != null) { @:<div> } var primaryFilterClass = settings.FilterPrimary.ToString().ToLower(); var secondaryFilterClass = settings.FilterSecondary.ToString().ToLower(); <div class="image-filter image-filter--@primaryFilterClass u-position-relative dw-mod" @ComponentMethods.AddAttributes(optionalAttributes)> <div class="image-filter image-filter--@secondaryFilterClass dw-mod"> @if (settings.Link != null) { <a href="@settings.Link"> @RenderTheImage(settings) </a> } else { @RenderTheImage(settings) } </div> </div> if (settings.Caption != null) { <span class="image-caption dw-mod">@settings.Caption</span> @:</div> } } else { if (settings.Caption != null) { @:<div> } if (!string.IsNullOrEmpty(settings.Link)) { <a href="@settings.Link"> @RenderTheImage(settings) </a> } else { @RenderTheImage(settings) } if (settings.Caption != null) { <span class="image-caption dw-mod">@settings.Caption</span> @:</div> } } } @helper RenderTheImage(Image settings) { if (settings != null) { string placeholderImage = "/Files/Images/placeholder.gif"; string imageEngine = "/Admin/Public/GetImage.ashx?"; string imageStyle = ""; switch (settings.Style) { case ImageStyle.Ball: imageStyle = "grid__cell-img--ball"; break; } if (settings.Style == ImageStyle.Ball || settings.Style == ImageStyle.Circle) { if (settings.ImageDefault != null) { settings.ImageDefault.Height = settings.ImageDefault.Width; } if (settings.ImageMedium != null) { settings.ImageMedium.Height = settings.ImageMedium.Width; } if (settings.ImageSmall != null) { settings.ImageSmall.Height = settings.ImageSmall.Width; } } string defaultImage = imageEngine; string imageSmall = ""; string imageMedium = ""; if (settings.DisableImageEngine) { defaultImage = settings.Path; } else { if (settings.ImageDefault != null) { defaultImage += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageDefault); if (settings.Path.GetType() != typeof(string)) { defaultImage += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; defaultImage += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; } else { defaultImage += settings.Path != null ? "Image=" + settings.Path : ""; } } if (settings.ImageSmall != null) { imageSmall = "data-src-small=\"" + imageEngine; imageSmall += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageSmall); if (settings.Path.GetType() != typeof(string)) { imageSmall += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; imageSmall += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; } else { imageSmall += settings.Path != null ? "Image=" + settings.Path : ""; } imageSmall += "\""; } if (settings.ImageMedium != null) { imageMedium = "data-src-medium=\"" + imageEngine; imageMedium += Dynamicweb.Rapido.Services.Images.GetImagePathFromSettings(settings.ImageMedium); if (settings.Path.GetType() != typeof(string)) { imageMedium += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; imageMedium += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; } else { imageMedium += settings.Path != null ? "Image=" + settings.Path : ""; } imageMedium += "\""; } } Dictionary<string, string> optionalAttributes = new Dictionary<string, string>(); if (!string.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick); } if (!string.IsNullOrEmpty(settings.Title)) { optionalAttributes.Add("alt", settings.Title); optionalAttributes.Add("title", settings.Title); } if (settings.DisableLazyLoad) { <img id="@settings.Id" class="@imageStyle @settings.CssClass dw-mod" src="@defaultImage" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> } else { <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) /> } } } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @* Component *@ @helper RenderFileField(FileField settings) { var attributes = new Dictionary<string, string>(); if (string.IsNullOrEmpty(settings.Id)) { settings.Id = Guid.NewGuid().ToString("N"); } if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } if (settings.Disabled) { attributes.Add("disabled", "true"); } if (settings.Required) { attributes.Add("required", "true"); } if (settings.Multiple) { attributes.Add("multiple", "true"); } if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } if (string.IsNullOrEmpty(settings.ChooseFileText)) { settings.ChooseFileText = Translate("Choose file"); } if (string.IsNullOrEmpty(settings.NoFilesChosenText)) { settings.NoFilesChosenText = Translate("No files chosen..."); } if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } string setValueToFakeInput = "FileUpload.setValueToFakeInput(this)"; attributes.Add("onchange", setValueToFakeInput + (!string.IsNullOrEmpty(settings.OnChange) ? settings.OnChange : "")); attributes.Add("type", "file"); if (!string.IsNullOrEmpty(settings.Value)) { attributes.Add("value", settings.Value); } settings.CssClass = "u-full-width " + settings.CssClass; var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod"> @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id">@settings.Label</label> } @if (!string.IsNullOrEmpty(settings.HelpText)) { <small class="form__help-text">@settings.HelpText</small> } <div class="form__field-combi file-input u-no-margin dw-mod"> <input @ComponentMethods.AddAttributes(resultAttributes) class="file-input__real-input" data-no-files-text="@settings.NoFilesChosenText" data-many-files-text="@Translate("files")" /> <label for="@settings.Id" class="file-input__btn btn--secondary btn dw-mod">@settings.ChooseFileText</label> <label for="@settings.Id" class="@settings.CssClass file-input__fake-input js-fake-input dw-mod">@settings.NoFilesChosenText</label> @if (settings.UploadButton != null) { settings.UploadButton.CssClass += " btn--condensed u-no-margin"; @Render(settings.UploadButton) } </div> @Render(new NotificationMessage { Message = settings.ErrorMessage }) </div> } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @using Dynamicweb.Core @using System.Linq @* Component *@ @helper RenderDateTimeField(DateTimeField settings) { if (string.IsNullOrEmpty(settings.Id)) { settings.Id = Guid.NewGuid().ToString("N"); } var textField = new TextField { Name = settings.Name, Id = settings.Id, Label = settings.Label, HelpText = settings.HelpText, Value = settings.Value, Disabled = settings.Disabled, Required = settings.Required, ErrorMessage = settings.ErrorMessage, CssClass = settings.CssClass, WrapperCssClass = settings.WrapperCssClass, OnChange = settings.OnChange, OnClick = settings.OnClick, ExtraAttributes = settings.ExtraAttributes, // Placeholder = settings.Placeholder }; @Render(textField) List<string> jsAttributes = new List<string>(); jsAttributes.Add("mode: '" + Enum.GetName(typeof(DateTimeFieldMode), settings.Mode).ToLower() + "'"); if (!string.IsNullOrEmpty(settings.DateFormat)) { jsAttributes.Add("dateFormat: '" + settings.DateFormat + "'"); } if (!string.IsNullOrEmpty(settings.MinDate)) { jsAttributes.Add("minDate: '" + settings.MinDate + "'"); } if (!string.IsNullOrEmpty(settings.MaxDate)) { jsAttributes.Add("maxDate: '" + settings.MaxDate + "'"); } if (settings.IsInline) { jsAttributes.Add("inline: " + Converter.ToString(settings.IsInline).ToLower()); } if (settings.EnableTime) { jsAttributes.Add("enableTime: " + Converter.ToString(settings.EnableTime).ToLower()); } if (settings.EnableWeekNumbers) { jsAttributes.Add("weekNumbers: " + Converter.ToString(settings.EnableWeekNumbers).ToLower()); } jsAttributes.AddRange(settings.GetFlatPickrOptions().Select(x => x.Key + ": " + x.Value)); <script> document.addEventListener("DOMContentLoaded", function () { flatpickr("#@textField.Id", { @string.Join(",", jsAttributes) }); }); </script> } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @* Component *@ @helper RenderTextField(TextField settings) { var attributes = new Dictionary<string, string>(); if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) { settings.Id = Guid.NewGuid().ToString("N"); } /*base settings*/ if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } if (settings.Disabled) { attributes.Add("disabled", "true"); } if (settings.Required) { attributes.Add("required", "true"); } if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } /*end*/ if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } if (settings.ReadOnly) { attributes.Add("readonly", "true"); } if (settings.MaxLength != 0) { attributes.Add("maxlength", settings.MaxLength.ToString()); } if (!string.IsNullOrEmpty(settings.Placeholder)) { attributes.Add("placeholder", settings.Placeholder); } attributes.Add("type", Enum.GetName(typeof(TextFieldType), settings.Type).ToLower()); if (settings.Type == TextFieldType.Password) { attributes.Add("autocomplete", "off"); }; if (!string.IsNullOrEmpty(settings.Value)) { attributes.Add("value", settings.Value); } settings.CssClass = "u-full-width " + settings.CssClass; var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); string noMargin = "u-no-margin"; if (!settings.ReadOnly) { noMargin = ""; } <div class="form__field-group u-full-width @noMargin @settings.WrapperCssClass dw-mod"> @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id">@settings.Label</label> } @if (!string.IsNullOrEmpty(settings.HelpText)) { <small class="form__help-text">@settings.HelpText</small> } @if (settings.ActionButton != null) { settings.ActionButton.CssClass += " btn--condensed u-no-margin"; <div class="form__field-combi u-no-margin dw-mod"> <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> @Render(settings.ActionButton) </div> } else { <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> } @Render(new NotificationMessage { Message = settings.ErrorMessage }) </div> } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @* Component *@ @helper RenderNumberField(NumberField settings) { var attributes = new Dictionary<string, string>(); if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) { settings.Id = Guid.NewGuid().ToString("N"); } /*base settings*/ if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } if (settings.Disabled) { attributes.Add("disabled", "true"); } if (settings.Required) { attributes.Add("required", "true"); } if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } /*end*/ if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } if (settings.ReadOnly) { attributes.Add("readonly", "true"); } if (settings.Max != null) { attributes.Add("max", settings.Max.ToString()); } if (settings.Min != null) { attributes.Add("min", settings.Min.ToString()); } if (settings.Step != 0) { attributes.Add("step", settings.Step.ToString()); } if (settings.Value != null && !string.IsNullOrEmpty(settings.Value.ToString())) { attributes.Add("value", settings.Value.ToString()); } attributes.Add("type", "number"); var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod"> @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id">@settings.Label</label> } @if (!string.IsNullOrEmpty(settings.HelpText)) { <small class="form__help-text">@settings.HelpText</small> } @if (settings.ActionButton != null) { settings.ActionButton.CssClass += " btn--condensed u-no-margin"; <div class="form__field-combi u-no-margin dw-mod"> <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> @Render(settings.ActionButton) </div> } else { <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> } @Render(new NotificationMessage { Message = settings.ErrorMessage }) </div> } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @* Component *@ @helper RenderTextareaField(TextareaField settings) { Dictionary<string, string> attributes = new Dictionary<string, string>(); string id = settings.Id; if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(id)) { id = Guid.NewGuid().ToString("N"); } if (!string.IsNullOrEmpty(id)) { attributes.Add("id", id); } if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } if (!string.IsNullOrEmpty(settings.Placeholder)) { attributes.Add("placeholder", settings.Placeholder); } if (settings.Disabled) { attributes.Add("disabled", "true"); } if (settings.Required) { attributes.Add("required", "true"); } if (settings.ReadOnly) { attributes.Add("readonly", "true"); } if (settings.MaxLength != 0) { attributes.Add("maxlength", settings.MaxLength.ToString()); } if (settings.Rows != 0) { attributes.Add("rows", settings.Rows.ToString()); } attributes.Add("name", settings.Name); <div class="form__field-group @settings.WrapperCssClass dw-mod"> @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@id">@settings.Label</label> } @if (!string.IsNullOrEmpty(settings.HelpText)) { <small class="form__help-text">@settings.HelpText</small> } <textarea class="u-full-width @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Value</textarea> @Render(new NotificationMessage { Message = settings.ErrorMessage }) </div> } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @* Component *@ @helper RenderHiddenField(HiddenField settings) { var attributes = new Dictionary<string, string>(); attributes.Add("type", "hidden"); if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } if (!string.IsNullOrEmpty(settings.Value)) { attributes.Add("value", settings.Value); } if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } <input @ComponentMethods.AddAttributes(attributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)/> } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @* Component *@ @helper RenderCheckboxField(CheckboxField settings) { var attributes = new Dictionary<string, string>(); if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) { settings.Id = Guid.NewGuid().ToString("N"); } /*base settings*/ if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } if (settings.Disabled) { attributes.Add("disabled", "true"); } if (settings.Required) { attributes.Add("required", "true"); } if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } /*end*/ attributes.Add("type", "checkbox"); if (settings.Checked) { attributes.Add("checked", "true"); } settings.CssClass = "form__control " + settings.CssClass; if (!string.IsNullOrEmpty(settings.Value)) { attributes.Add("value", settings.Value); } var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); <div class="form__field-group @settings.WrapperCssClass dw-mod"> <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="dw-mod">@settings.Label</label> } @if (!string.IsNullOrEmpty(settings.HelpText)) { <small class="form__help-text">@settings.HelpText</small> } @Render(new NotificationMessage { Message = settings.ErrorMessage }) </div> } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @* Component *@ @helper RenderCheckboxListField(CheckboxListField settings) { <div class="form__field-group @settings.WrapperCssClass u-margin-bottom dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> @if (!string.IsNullOrEmpty(settings.Label)) { <label>@settings.Label</label> } @if (!string.IsNullOrEmpty(settings.HelpText)) { <small class="form__help-text">@settings.HelpText</small> } @foreach (var item in settings.Options) { if (settings.Required) { item.Required = true; } if (settings.Disabled) { item.Disabled = true; } if (!string.IsNullOrEmpty(settings.Name)) { item.Name = settings.Name; } if (!string.IsNullOrEmpty(settings.CssClass)) { item.CssClass += settings.CssClass; } /* value is not supported */ if (!string.IsNullOrEmpty(settings.OnClick)) { item.OnClick += settings.OnClick; } if (!string.IsNullOrEmpty(settings.OnChange)) { item.OnChange += settings.OnChange; } @Render(item) } @Render(new NotificationMessage { Message = settings.ErrorMessage }) </div> } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @* Component *@ @helper RenderSelectField(SelectField settings) { if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) { settings.Id = Guid.NewGuid().ToString("N"); } <div class="form__field-group u-full-width @settings.WrapperCssClass dw-mod"> @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id">@settings.Label</label> } @if (!string.IsNullOrEmpty(settings.HelpText)) { <small class="form__help-text">@settings.HelpText</small> } @if (settings.ActionButton != null) { settings.ActionButton.CssClass += " btn--condensed u-no-margin"; <div class="form__field-combi u-no-margin dw-mod"> @RenderSelectBase(settings) @Render(settings.ActionButton) </div> } else { @RenderSelectBase(settings) } @Render(new NotificationMessage { Message = settings.ErrorMessage }) </div> } @helper RenderSelectBase(SelectField settings) { var attributes = new Dictionary<string, string>(); /*base settings*/ if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } if (settings.Disabled) { attributes.Add("disabled", "true"); } if (settings.Required) { attributes.Add("required", "true"); } if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } /*end*/ var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); <select @ComponentMethods.AddAttributes(resultAttributes) class="u-full-width @settings.CssClass dw-mod"> @if (settings.Default != null) { @Render(settings.Default) } @foreach (var item in settings.Options) { if (!string.IsNullOrEmpty(settings.Value)) { item.Checked = item.Value == settings.Value; } @Render(item) } </select> } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @* Component *@ @helper RenderRadioButtonField(RadioButtonField settings) { var attributes = new Dictionary<string, string>(); if (!string.IsNullOrEmpty(settings.Label) && string.IsNullOrEmpty(settings.Id)) { settings.Id = Guid.NewGuid().ToString("N"); } /*base settings*/ if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } if (settings.Disabled) { attributes.Add("disabled", "true"); } if (settings.Required) { attributes.Add("required", "true"); } if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } /*end*/ attributes.Add("type", "radio"); if (settings.Checked) { attributes.Add("checked", "true"); } settings.CssClass = "form__control " + settings.CssClass; if (!string.IsNullOrEmpty(settings.Value)) { attributes.Add("value", settings.Value); } var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); <div class="form__field-group @settings.WrapperCssClass dw-mod"> <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> @if (!string.IsNullOrEmpty(settings.Label)) { <label for="@settings.Id" class="dw-mod">@settings.Label</label> } @if (!string.IsNullOrEmpty(settings.HelpText)) { <small class="form__help-text">@settings.HelpText</small> } @Render(new NotificationMessage { Message = settings.ErrorMessage }) </div> } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @* Component *@ @helper RenderRadioButtonListField(RadioButtonListField settings) { <div class="form__field-group @settings.WrapperCssClass u-margin-bottom dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> @if (!string.IsNullOrEmpty(settings.Label)) { <label>@settings.Label</label> } @if (!string.IsNullOrEmpty(settings.HelpText)) { <small class="form__help-text">@settings.HelpText</small> } @foreach (var item in settings.Options) { if (settings.Required) { item.Required = true; } if (settings.Disabled) { item.Disabled = true; } if (!string.IsNullOrEmpty(settings.Name)) { item.Name = settings.Name; } if (!string.IsNullOrEmpty(settings.Value) && settings.Value == item.Value) { item.Checked = true; } if (!string.IsNullOrEmpty(settings.OnClick)) { item.OnClick += settings.OnClick; } if (!string.IsNullOrEmpty(settings.OnChange)) { item.OnChange += settings.OnChange; } if (!string.IsNullOrEmpty(settings.CssClass)) { item.CssClass += settings.CssClass; } @Render(item) } @Render(new NotificationMessage { Message = settings.ErrorMessage }) </div> } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @* Component *@ @helper RenderNotificationMessage(NotificationMessage settings) { if (!string.IsNullOrEmpty(settings.Message)) { var attributes = new Dictionary<string, string>(); if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } string messageTypeClass = Enum.GetName(typeof(NotificationMessageType), settings.MessageType).ToLower(); <div class="field-@messageTypeClass @settings.CssClass u-full-width dw-mod" @ComponentMethods.AddAttributes(attributes)>@settings.Message</div> } } @using Dynamicweb.Rapido.Blocks.Components.General @* Component *@ @helper RenderHandlebarsRoot(HandlebarsRoot settings) { string preRender = !String.IsNullOrEmpty(settings.PreRenderScriptTemplate) ? "data-pre-render-template=\"" + settings.PreRenderScriptTemplate + "\"" : ""; <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> @if (settings.SubBlocks != null) { @RenderBlockList(settings.SubBlocks) } </div> } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @using System.Text.RegularExpressions @* Component *@ @helper RenderSticker(Sticker settings) { if (!String.IsNullOrEmpty(settings.Title)) { string size = settings.Size.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Size.ToString().ToLower() : ""; string style = settings.Style.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Style.ToString().ToLower() : ""; Dictionary<String, String> optionalAttributes = new Dictionary<string, string>(); if (!String.IsNullOrEmpty(settings.Color) || !String.IsNullOrEmpty(settings.BackgroundColor)) { string styleTag = !String.IsNullOrEmpty(settings.Color) ? "color: " + settings.Color + "; " : ""; styleTag += !String.IsNullOrEmpty(settings.BackgroundColor) ? "background-color: " + settings.BackgroundColor + "; " : ""; optionalAttributes.Add("style", styleTag); } <div class="stickers-container__tag @size @style @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Title</div> } } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @* Component *@ @helper RenderStickersCollection(StickersCollection settings) { if (settings.Stickers.Count > 0) { string position = "stickers-container--" + Regex.Replace(settings.Position.ToString(), "([a-z])([A-Z])", "$1-$2").ToLower(); <div class="stickers-container @position @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> @foreach (Sticker sticker in settings.Stickers) { @Render(sticker) } </div> } } @using Dynamicweb.Rapido.Blocks.Components.General @* Component *@ @helper RenderForm(Form settings) { if (settings != null) { Dictionary<string, string> optionalAttributes = new Dictionary<string, string>(); if (!string.IsNullOrEmpty(settings.Action)) { optionalAttributes.Add("action", settings.Action); }; if (!string.IsNullOrEmpty(settings.Name)) { optionalAttributes.Add("name", settings.Name); }; if (!string.IsNullOrEmpty(settings.OnSubmit)) { optionalAttributes.Add("onsubmit", settings.OnSubmit); }; var enctypes = new Dictionary<string, string> { { "multipart", "multipart/form-data" }, { "text", "text/plain" }, { "application", "application/x-www-form-urlencoded" } }; if (settings.Enctype != FormEnctype.none) { optionalAttributes.Add("enctype", enctypes[Enum.GetName(typeof(FormEnctype), settings.Enctype).ToLower()]); }; optionalAttributes.Add("method", settings.Method.ToString()); if (!string.IsNullOrEmpty(settings.FormStartMarkup)) { @settings.FormStartMarkup } else { @:<form class="@settings.CssClass u-no-margin dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)> } foreach (var field in settings.GetFields()) { @Render(field) } @:</form> } } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @* Component *@ @helper RenderText(Text settings) { @settings.Content } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @* Component *@ @helper RenderContentModule(ContentModule settings) { if (!string.IsNullOrEmpty(settings.Content)) { @settings.Content } } @using System.Reflection @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @* Component *@ @helper RenderModal(Modal settings) { if (settings != null) { string modalId = !string.IsNullOrEmpty(settings.Id) ? settings.Id : Guid.NewGuid().ToString("N"); string onchange = !string.IsNullOrEmpty(settings.OnClose) ? "onchange=\"if(!this.checked){" + settings.OnClose + "}\"" : ""; <input type="checkbox" id="@(modalId)ModalTrigger" class="modal-trigger" @onchange /> <div class="modal-container"> @if (!settings.DisableDarkOverlay) { <label for="@(modalId)ModalTrigger" id="@(modalId)ModalOverlay" class="modal-overlay"></label> } <div class="modal modal--@settings.Width.ToString().ToLower() modal-height--@settings.Height.ToString().ToLower()" id="@(modalId)Modal"> @if (settings.Heading != null) { if (!string.IsNullOrEmpty(settings.Heading.Title)) { <div class="modal__header"> @Render(settings.Heading) </div> } } <div class="modal__body @(settings.Width.ToString().ToLower() == "full" ? "modal__body--full" : "")"> @if (!string.IsNullOrEmpty(settings.BodyText)) { @settings.BodyText } @if (settings.BodyTemplate != null) { @settings.BodyTemplate } @{ var actions = settings.GetActions(); } </div> @if (actions.Length > 0) { <div class="modal__footer"> @foreach (var action in actions) { action.CssClass += " u-no-margin"; @Render(action) } </div> } <label class="modal__close-btn" for="@(modalId)ModalTrigger"></label> </div> </div> } } @using Dynamicweb.Rapido.Blocks.Components.General @* Component *@ @helper RenderMediaListItem(MediaListItem settings) { <div class="media-list-item @settings.CssClass dw-mod" @(!string.IsNullOrEmpty(settings.Id) ? "id=\"" + settings.Id + "\"" : "")> @if (!string.IsNullOrEmpty(settings.Label)) { if (!string.IsNullOrEmpty(settings.Link)) { @Render(new Link { Href = settings.Link, CssClass = "media-list-item__sticker dw-mod", ButtonLayout = ButtonLayout.None, Title = settings.Label, OnClick = !string.IsNullOrEmpty(settings.OnClick) ? settings.OnClick : "" }) } else if (!string.IsNullOrEmpty(settings.OnClick)) { <span class="media-list-item__sticker dw-mod" onclick="@(settings.OnClick)"> <span class="u-uppercase">@settings.Label</span> </span> } else { <span class="media-list-item__sticker media-list-item__sticker--no-link dw-mod"> <span class="u-uppercase">@settings.Label</span> </span> } } <div class="media-list-item__wrap"> <div class="media-list-item__info dw-mod"> <div class="media-list-item__header dw-mod"> @if (!string.IsNullOrEmpty(settings.Title)) { if (!string.IsNullOrEmpty(settings.Link)) { @Render(new Link { Href = settings.Link, CssClass = "media-list-item__name dw-mod", ButtonLayout = ButtonLayout.None, Title = settings.Title, OnClick = !string.IsNullOrEmpty(settings.OnClick) ? settings.OnClick : "" }) } else if (!string.IsNullOrEmpty(settings.OnClick)) { <span class="media-list-item__name dw-mod" onclick="@(settings.OnClick)">@settings.Title</span> } else { <span class="media-list-item__name media-list-item__name--no-link dw-mod">@settings.Title</span> } } @if (!string.IsNullOrEmpty(settings.Status)) { <div class="media-list-item__state dw-mod">@settings.Status</div> } </div> @{ settings.InfoTable.CssClass += " media-list-item__parameters-table"; } @Render(settings.InfoTable) </div> <div class="media-list-item__actions dw-mod"> <div class="media-list-item__actions-list dw-mod"> @{ var actions = settings.GetActions(); foreach (ButtonBase action in actions) { action.ButtonLayout = ButtonLayout.None; action.CssClass += " media-list-item__action link"; @Render(action) } } </div> @if (settings.SelectButton != null && !string.IsNullOrEmpty(settings.SelectButton.Title)) { settings.SelectButton.CssClass += " u-no-margin"; <div class="media-list-item__action-button"> @Render(settings.SelectButton) </div> } </div> </div> </div> } @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @helper RenderTable(Table settings) { Dictionary<string, string> attributes = new Dictionary<string, string>(); if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } var enumToClasses = new Dictionary<TableDesign, string> { { TableDesign.Clean, "table--clean" }, { TableDesign.Bordered, "table--bordered" }, { TableDesign.Striped, "table--striped" }, { TableDesign.Hover, "table--hover" }, { TableDesign.Compact, "table--compact" }, { TableDesign.Condensed, "table--condensed" }, { TableDesign.NoTopBorder, "table--no-top-border" } }; string tableDesignClass = ""; if (settings.Design != TableDesign.None) { tableDesignClass = enumToClasses[settings.Design]; } if (!string.IsNullOrEmpty(settings.CssClass) || settings.Design != TableDesign.None) { attributes.Add("class", "table " + tableDesignClass + " " + settings.CssClass + " dw-mod"); } var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value); <table @ComponentMethods.AddAttributes(resultAttributes)> @if (settings.Header != null) { <thead> @Render(settings.Header) </thead> } <tbody> @foreach (var row in settings.Rows) { @Render(row) } </tbody> @if (settings.Footer != null) { <tfoot> @Render(settings.Footer) </tfoot> } </table> } @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @helper RenderTableRow(TableRow settings) { Dictionary<string, string> attributes = new Dictionary<string, string>(); if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } var enumToClasses = new Dictionary<TableRowDesign, string> { { TableRowDesign.NoBorder, "table__row--no-border" }, { TableRowDesign.Border, "table__row--border" }, { TableRowDesign.TopBorder, "table__row--top-line" }, { TableRowDesign.BottomBorder, "table__row--bottom-line" }, { TableRowDesign.Solid, "table__row--solid" } }; string tableRowDesignClass = ""; if (settings.Design != TableRowDesign.None) { tableRowDesignClass = enumToClasses[settings.Design]; } if (!string.IsNullOrEmpty(settings.CssClass) || settings.Design != TableRowDesign.None) { attributes.Add("class", "table__row " + tableRowDesignClass + " " + settings.CssClass + " dw-mod"); } var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value); <tr @ComponentMethods.AddAttributes(resultAttributes)> @foreach (var cell in settings.Cells) { if (settings.IsHeaderRow) { cell.IsHeader = true; } @Render(cell) } </tr> } @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @using Dynamicweb.Core @helper RenderTableCell(TableCell settings) { Dictionary<string, string> attributes = new Dictionary<string, string>(); if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } if (settings.Colspan != 0) { attributes.Add("colspan", Converter.ToString(settings.Colspan)); } if (settings.Rowspan != 0) { attributes.Add("rowspan", Converter.ToString(settings.Rowspan)); } if (!string.IsNullOrEmpty(settings.CssClass)) { attributes.Add("class", settings.CssClass + " dw-mod"); } var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.Last().Value); string tagName = settings.IsHeader ? "th" : "td"; @("<" + tagName + " " + ComponentMethods.AddAttributes(resultAttributes) + ">") @settings.Content @("</" + tagName + ">"); } @using System.Linq @using Dynamicweb.Rapido.Blocks.Components.General @* Component *@ @helper RenderPagination(Dynamicweb.Rapido.Blocks.Components.General.Pagination settings) { var pageNumberQueryStringName = Dynamicweb.Rapido.Services.Pagination.GetPageNumberQueryStringName(settings); // Get the proper 'page number' query string parameter var queryParameters = Dynamicweb.Rapido.Services.Url.GetQueryParameters(pageNumberQueryStringName); // Get the NameValueCollection from the querystring if (settings.NumberOfPages > 1) { string url = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + "/Default.aspx"; string ariaLabel = !string.IsNullOrWhiteSpace(settings.AriaLabel) ? settings.AriaLabel : Translate("Page navigation"); Dictionary<string, int> startAndEndPageNumber = Dynamicweb.Rapido.Services.Pagination.GetStartAndEndPageNumber(settings); <div class="pager u-margin-top dw-mod @settings.CssClass" aria-label="@ariaLabel"> @if (settings.ShowPagingInfo) { <div class="pager__info dw-mod"> @Translate("Page") @settings.CurrentPageNumber @Translate("of") @settings.NumberOfPages </div> } <ul class="pager__list dw-mod"> @if (!string.IsNullOrWhiteSpace(settings.FirstPageUrl) && settings.ShowFirstAndLastControls) { @Render(new PaginationItem { Link = settings.FirstPageUrl, Icon = settings.FirstIcon }) } @if (!string.IsNullOrWhiteSpace(settings.PreviousPageUrl) && settings.ShowNextAndPrevControls) { @Render(new PaginationItem { Link = settings.PreviousPageUrl, Icon = settings.PrevIcon }) } @if (settings.GetPages().Any()) { foreach (var page in settings.GetPages()) { @Render(page) } } else { for (var page = startAndEndPageNumber["StartPage"]; page <= startAndEndPageNumber["EndPage"]; page++) { queryParameters = Dynamicweb.Rapido.Services.Url.UpdateQueryStringParameter(queryParameters, pageNumberQueryStringName, page.ToString()); @Render(new PaginationItem { Label = page.ToString(), Link = Dynamicweb.Rapido.Services.Url.BuildUri(url, queryParameters).PathAndQuery, IsActive = (settings.CurrentPageNumber == page) }); } } @if (!string.IsNullOrWhiteSpace(settings.NextPageUrl) && settings.ShowNextAndPrevControls) { @Render(new PaginationItem { Link = settings.NextPageUrl, Icon = settings.NextIcon }) } @if (!string.IsNullOrWhiteSpace(settings.LastPageUrl) && settings.ShowFirstAndLastControls) { @Render(new PaginationItem { Link = settings.LastPageUrl, Icon = settings.LastIcon }) } </ul> </div> } } @helper RenderPaginationItem(PaginationItem settings) { if (settings.Icon == null) { settings.Icon = new Icon(); } settings.Icon.Label = settings.Label; <li class="pager__btn dw-mod"> @if (settings.IsActive) { <span class="pager__num pager__num--current dw-mod"> @Render(settings.Icon) </span> } else { <a href="@settings.Link" class="pager__num dw-mod"> @Render(settings.Icon) </a> } </li> } @using Dynamicweb.Rapido.Blocks.Components.General 2 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 3 4 5 @using System.Linq 6 @using Dna.Rizzo.Components 7 @using Dynamicweb.Core 8 @using Dynamicweb.Rapido.Blocks.Components.General 9 10 @helper RenderMonthYearField(DateTimeField settings) 11 { 12 if (string.IsNullOrEmpty(settings.Id)) 13 { 14 settings.Id = Guid.NewGuid().ToString("N"); 15 } 16 17 var textField = new TextField { 18 Name = settings.Name, 19 Id = settings.Id, 20 Label = settings.Label, 21 HelpText = settings.HelpText, 22 Value = settings.Value, 23 Disabled = settings.Disabled, 24 Required = settings.Required, 25 ErrorMessage = settings.ErrorMessage, 26 CssClass = settings.CssClass, 27 WrapperCssClass = settings.WrapperCssClass, 28 OnChange = settings.OnChange, 29 OnClick = settings.OnClick, 30 ExtraAttributes = settings.ExtraAttributes, 31 // 32 Placeholder = settings.Placeholder 33 }; 34 35 @Render(textField) 36 37 List<string> jsAttributes = new List<string>(); 38 39 jsAttributes.Add("mode: '" + Enum.GetName(typeof(DateTimeFieldMode), settings.Mode).ToLower() + "'"); 40 41 if (!string.IsNullOrEmpty(settings.DateFormat)) 42 { 43 jsAttributes.Add("dateFormat: '" + settings.DateFormat + "'"); 44 } 45 if (!string.IsNullOrEmpty(settings.MinDate)) 46 { 47 jsAttributes.Add("minDate: '" + settings.MinDate + "'"); 48 } 49 if (!string.IsNullOrEmpty(settings.MaxDate)) 50 { 51 jsAttributes.Add("maxDate: '" + settings.MaxDate + "'"); 52 } 53 if (settings.IsInline) 54 { 55 jsAttributes.Add("inline: " + Converter.ToString(settings.IsInline).ToLower()); 56 } 57 if (settings.EnableTime) 58 { 59 jsAttributes.Add("enableTime: " + Converter.ToString(settings.EnableTime).ToLower()); 60 } 61 if (settings.EnableWeekNumbers) 62 { 63 jsAttributes.Add("weekNumbers: " + Converter.ToString(settings.EnableWeekNumbers).ToLower()); 64 } 65 jsAttributes.Add("plugins: " + "[new monthSelectPlugin({shorthand: true, dateFormat: 'F Y', altFormat: 'F Y'})]"); 66 67 jsAttributes.AddRange(settings.GetFlatPickrOptions().Select(x => x.Key + ": " + x.Value)); 68 69 <script> 70 document.addEventListener("DOMContentLoaded", function () { 71 flatpickr("#@textField.Id", { 72 @string.Join(",", jsAttributes) 73 }); 74 }); 75 </script> 76 } 77 @* Include the basic, re-used, paragraph initializer *@ @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel> @using Dynamicweb.Frontend @using Dynamicweb.Rapido.Blocks.Components.General @using Dynamicweb.Rapido.Blocks.Components @functions { public class ContentParagraph { public string Title { get; set; } public Image Image { get; set; } public string Text { get; set; } public string Link { get; set; } public bool SetImageAsBackground { get; set; } public bool HideOuterPadding { get; set; } public string InnerPaddingCss { get; set; } public string CardCss { get; set; } public string ButtonWrapperCss { get; set; } public string Layout { get; set; } public string Module { get; set; } public Link ButtonPrimary { get; set; } public Link ButtonSecondary { get; set; } } } @helper RenderParagraph(ItemViewModel item, bool renderModule = true) { if (item != null) { string layout = item.GetList("ContentPositions").SelectedValue; string paragraphClasses = ""; string paragraphWidth = !String.IsNullOrEmpty(item.GetString("Width")) ? item.GetList("Width").SelectedValue : "12"; paragraphClasses += " grid__col-lg-" + paragraphWidth + " grid__col-md-" + paragraphWidth + " grid__col-sm-" + paragraphWidth; if (item.GetList("WidthMobile").SelectedValue == "hide") { paragraphClasses += " u-hidden-xs"; } else { paragraphClasses += " grid__col-xs-" + item.GetList("WidthMobile").SelectedValue; } paragraphClasses += item.GetBoolean("HidePadding") ? " paragraph-container--no-padding" : ""; paragraphClasses += layout == "middle-center" || layout == "middle-left" ? " u-middle-horizontal grid--justify-center grid--align-self-center" : ""; //Alternative Design Layout var designLayout = Model.Item.GetItem("CustomSettings") != null ? Model.Item.GetItem("CustomSettings").GetString("DesignLayout") != null ? Model.Item.GetItem("CustomSettings").GetList("DesignLayout").SelectedValue : "" : ""; paragraphClasses += !String.IsNullOrEmpty(designLayout) ? designLayout : ""; string title = item.GetBoolean("ShowTitle") ? item.GetString("Title") : ""; string cardClass = item.GetBoolean("ShowAsCard") ? "paragraph-card" : ""; string buttonSpacing = ""; string buttonAlignment = layout == "all-centered" || layout == "middle-center" ? "grid--justify-center" : ""; string image = item.GetFile("Image") != null ? item.GetFile("Image").ToString() + "&" + item.GetFile("Image").GetFocalPointParameters() : ""; int cropMode = !String.IsNullOrEmpty(Converter.ToString(item.GetList("ImageCrop"))) ? Convert.ToInt32(item.GetList("ImageCrop").SelectedValue) : 0; ImageStyle imageStyle = item.GetList("ImageStyle").SelectedValue == "ball" ? ImageStyle.Ball : ImageStyle.None; 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; if (primaryButtonLayout == ButtonLayout.Link) { primaryButtonLayout = ButtonLayout.LinkClean; } 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; if (secondaryButtonLayout == ButtonLayout.Link) { secondaryButtonLayout = ButtonLayout.LinkClean; } ImageFilter primaryImageFilter = !string.IsNullOrEmpty(item.GetList("ImageFilterPrimary").SelectedValue) ? (ImageFilter) Enum.Parse(typeof(ImageFilter), item.GetList("ImageFilterPrimary").SelectedValue.Replace("-", ""), true) : ImageFilter.None; ImageFilter secondaryImageFilter = !string.IsNullOrEmpty(item.GetList("ImageFilterSecondary").SelectedValue) ? (ImageFilter) Enum.Parse(typeof(ImageFilter), item.GetList("ImageFilterSecondary").SelectedValue.Replace("-", ""), true) : ImageFilter.None; string imageFilterColorCode = item.GetString("ColorForTheFilter").StartsWith("#") && primaryImageFilter == ImageFilter.Colorize ? GenerateRgba(item.GetString("ColorForTheFilter"), 0.3) : ""; bool setImageAsBackground = item.GetList("ImageStyle").SelectedValue.ToLower() == "background" ? true : false; Image paragraphImage = null; if (!String.IsNullOrEmpty(image)) { paragraphImage = new Image { Path = image, Link = item.GetString("Link"), FilterPrimary = primaryImageFilter, FilterSecondary = secondaryImageFilter, FilterColor = imageFilterColorCode, Style = imageStyle, ImageDefault = new ImageSettings { Crop = cropMode, Height = 845, Width = 1920 }, ImageMedium = new ImageSettings { Crop = cropMode, Height = 450, Width = 1024 }, ImageSmall = new ImageSettings { Crop = cropMode, Height = 544, Width = 640 } }; } if (paragraphWidth != "auto" && paragraphImage != null) { if (Convert.ToInt32(paragraphWidth) < 7) { paragraphImage.ImageDefault = new ImageSettings { Crop = cropMode, Height = 544, Width = 640 }; } } ContentParagraph paragraph = new ContentParagraph { Title = title, Text = item.GetString("Text"), Image = paragraphImage, Link = item.GetString("Link"), Module = !String.IsNullOrEmpty(Model.GetModuleOutput()) && renderModule ? Model.GetModuleOutput() : "", InnerPaddingCss = item.GetList("InnerPadding") != null ? "paragraph-container__body--padding-" + item.GetList("InnerPadding").SelectedValue : "", CardCss = cardClass, HideOuterPadding = item.GetBoolean("HidePadding"), SetImageAsBackground = item.GetList("ImageStyle").SelectedValue.ToLower() == "background" ? true : false, ButtonWrapperCss = buttonSpacing + buttonAlignment, Layout = layout }; if (!String.IsNullOrEmpty(item.GetString("Link"))) { paragraph.ButtonPrimary = new Link { Href = item.GetString("Link"), Title = item.GetString("LinkText"), ButtonLayout = primaryButtonLayout, CssClass = "u-no-margin" }; if (!String.IsNullOrEmpty(item.GetString("SecondaryLink"))) { paragraph.ButtonPrimary.CssClass = ""; } } if (!String.IsNullOrEmpty(item.GetString("SecondaryLink"))) { if (!String.IsNullOrEmpty(item.GetString("Link"))) { paragraph.ButtonPrimary.CssClass += " u-margin-right--lg"; } paragraph.ButtonSecondary = new Link { Href = item.GetString("SecondaryLink"), Title = item.GetString("SecondaryLinkText"), ButtonLayout = secondaryButtonLayout }; } <div class="paragraph-container @paragraphClasses dw-mod"> @if (setImageAsBackground == true && paragraphImage != null) { paragraphImage.CssClass = "background-image__cover"; <div class="background-image dw-mod"> <div class="background-image__wrapper dw-mod"> @Render(paragraphImage) </div> </div> } @{ switch (layout) { case "title-top": @RenderLayoutTitleTop(paragraph) break; case "image-left": @RenderLayoutImageLeft(paragraph) break; case "image-right": @RenderLayoutImageRight(paragraph) break; case "image-centered": @RenderLayoutImageCentered(paragraph) break; case "all-centered": @RenderLayoutAllCentered(paragraph) break; case "middle-center": case "middle-left": @RenderLayoutMiddle(paragraph) break; default: @RenderLayoutImageTop(paragraph) break; } } </div> } } @helper RenderLayoutTitleTop(ContentParagraph settings) { <div class="grid__cell @settings.CardCss @settings.InnerPaddingCss dw-mod"> @Render(new Heading { Level = 2, Title = settings.Title, Link = settings.Link }) @if (!settings.SetImageAsBackground && settings.Image != null) { <div class="u-margin-bottom--lg"> @Render(settings.Image) </div> } @Render(new Text { Content = settings.Text}) @Render(new ContentModule { Content = settings.Module }) @if (settings.ButtonPrimary != null || settings.ButtonSecondary != null) { <div class="grid__cell"> <div class="paragraph-container__button @settings.ButtonWrapperCss dw-mod"> @Render(settings.ButtonPrimary) @Render(settings.ButtonSecondary) </div> </div> } </div> } @helper RenderLayoutImageLeft(ContentParagraph settings) { <div class="grid__cell @settings.CardCss @settings.InnerPaddingCss dw-mod"> <div class="grid grid--external-bleed"> @if (!settings.SetImageAsBackground && settings.Image != null) { <div class="grid__col-3"> @Render(settings.Image) </div> } <div class="grid__col-9 @settings.InnerPaddingCss dw-mod"> @Render(new Heading { Level = 2, Title = settings.Title, Link = settings.Link }) @Render(new Text { Content = settings.Text }) @Render(new ContentModule { Content = settings.Module }) @if (settings.ButtonPrimary != null || settings.ButtonSecondary != null) { <div class="grid__cell"> <div class="paragraph-container__button @settings.ButtonWrapperCss dw-mod"> @Render(settings.ButtonPrimary) @Render(settings.ButtonSecondary) </div> </div> } </div> </div> </div> } @helper RenderLayoutImageRight(ContentParagraph settings) { <div class="grid__cell @settings.CardCss"> <div class="grid grid--external-bleed"> <div class="grid__col-9 @settings.InnerPaddingCss dw-mod"> @Render(new Heading { Level = 2, Title = settings.Title, Link = settings.Link }) @Render(new Text { Content = settings.Text }) @Render(new ContentModule { Content = settings.Module }) @if (settings.ButtonPrimary != null || settings.ButtonSecondary != null) { <div class="grid__cell"> <div class="paragraph-container__button @settings.ButtonWrapperCss dw-mod"> @Render(settings.ButtonPrimary) @Render(settings.ButtonSecondary) </div> </div> } </div> @if (!settings.SetImageAsBackground && settings.Image != null) { <div class="grid__col-3"> @Render(settings.Image) </div> } </div> </div> } @helper RenderLayoutImageCentered(ContentParagraph settings) { <div class="grid__cell @settings.CardCss @settings.InnerPaddingCss dw-mod"> <div class="u-ta-center"> @if (!settings.SetImageAsBackground && settings.Image != null) { <div class="u-margin-bottom--lg u-inline-block"> @Render(settings.Image) </div> } </div> @Render(new Heading { Level = 2, Title = settings.Title, Link = settings.Link }) @Render(new Text { Content = settings.Text }) @Render(new ContentModule { Content = settings.Module }) @if (settings.ButtonPrimary != null || settings.ButtonSecondary != null) { <div class="paragraph-container__button @settings.ButtonWrapperCss dw-mod"> @Render(settings.ButtonPrimary) @Render(settings.ButtonSecondary) </div> } </div> } @helper RenderLayoutAllCentered(ContentParagraph settings) { <div class="grid__cell @settings.CardCss @settings.InnerPaddingCss dw-mod"> <div class="u-ta-center"> @if (!settings.SetImageAsBackground && settings.Image != null) { <div class="u-margin-bottom--lg u-inline-block"> @Render(settings.Image) </div> } @Render(new Heading { Level = 2, Title = settings.Title, Link = settings.Link }) @Render(new Text { Content = settings.Text }) @Render(new ContentModule { Content = settings.Module }) </div> @if (settings.ButtonPrimary != null || settings.ButtonSecondary != null) { <div class="paragraph-container__button @settings.ButtonWrapperCss dw-mod"> @Render(settings.ButtonPrimary) @Render(settings.ButtonSecondary) </div> } </div> } @helper RenderLayoutMiddle(ContentParagraph settings) { <div> <div class="grid__cell @settings.CardCss @settings.InnerPaddingCss dw-mod"> <div class="@(settings.Layout == "middle-center" ? "u-ta-center" : "")"> @if (!settings.SetImageAsBackground && settings.Image != null) { <div class="u-margin-bottom--lg u-inline-block"> @Render(settings.Image) </div> } @Render(new Heading { Level = 2, Title = settings.Title, Link = settings.Link }) @Render(new Text { Content = settings.Text }) @Render(new ContentModule { Content = settings.Module }) </div> @if (settings.ButtonPrimary != null || settings.ButtonSecondary != null) { <div class="paragraph-container__button @settings.ButtonWrapperCss dw-mod"> @Render(settings.ButtonPrimary) @Render(settings.ButtonSecondary) </div> } </div> </div> } @helper RenderLayoutImageTop(ContentParagraph settings) { <div class="grid__cell @settings.CardCss"> @if (!settings.SetImageAsBackground && settings.Image != null) { <div class="u-margin-bottom--lg"> @Render(settings.Image) </div> } <div class="@settings.InnerPaddingCss dw-mod"> @Render(new Heading { Level = 2, Title = settings.Title, Link = settings.Link }) @Render(new Text { Content = settings.Text }) @Render(new ContentModule { Content = settings.Module }) @if (settings.ButtonPrimary != null || settings.ButtonSecondary != null) { <div class="paragraph-container__button @settings.ButtonWrapperCss dw-mod"> @Render(settings.ButtonPrimary) @Render(settings.ButtonSecondary) </div> } </div> </div> } @{ string fontColor = !string.IsNullOrEmpty(Model.Item.GetString("FontColor")) && !Model.Item.GetString("FontColor").StartsWith("#") ? "u-" + Model.Item.GetString("FontColor").Replace(" ", "-").ToLower() : ""; string backgroundColor = !string.IsNullOrEmpty(Model.Item.GetString("BackgroundColor")) && !Model.Item.GetString("BackgroundColor").StartsWith("#") ? "u-" + Model.Item.GetString("BackgroundColor").Replace(" ", "-").ToLower() + "--bg" : ""; string colorSettings = Model.Item.GetString("FontColor").StartsWith("#") || Model.Item.GetString("BackgroundColor").StartsWith("#") ? "style=\"" : ""; string fontColorHex = Model.Item.GetString("FontColor").StartsWith("#") ? "color: " + Model.Item.GetString("FontColor") + ";" : ""; string backgroundColorHex = Model.Item.GetString("BackgroundColor").StartsWith("#") ? "background-color: " + Model.Item.GetString("BackgroundColor") + ";" : ""; colorSettings += fontColorHex; colorSettings += backgroundColorHex; colorSettings += Model.Item.GetString("FontColor").StartsWith("#") || Model.Item.GetString("BackgroundColor").StartsWith("#") ? "\"" : ""; string paragraphContainerClasses = ""; string containerClasses = ""; string gridClasses = ""; string spacingSize = Model.Item.GetList("Spacing") != null && Model.Item.GetList("Spacing").SelectedValue != "" ? Model.Item.GetList("Spacing").SelectedValue : "lg"; switch (Model.Item.GetList("Width").SelectedValue) { case "center": containerClasses += "center-container paragraph-container "; paragraphContainerClasses += " " + fontColor + " " + backgroundColor; break; case "full": containerClasses += fontColor + " " + backgroundColor + " "; paragraphContainerClasses += "paragraph-container--full-width "; break; case "combi": paragraphContainerClasses += "paragraph-container--full-width " + fontColor + " " + backgroundColor + " "; containerClasses += "center-container paragraph-container "; break; default: paragraphContainerClasses += "center-container "; break; } //Background string focalPointParameters = Model.Item.GetFile("BackgroundImage") != null ? "&" + Model.Item.GetFile("BackgroundImage").GetFocalPointParameters() : ""; string containerBackgroundImageFilterColor = Model.Item.GetList("ColorForTheFilter") != null ? Model.Item.GetString("ColorForTheFilter").Replace(" ", "-").ToLower() : "none"; string containerBackgroundImageFilterPrimary = Model.Item.GetList("ImageFilterPrimary") != null ? Model.Item.GetList("ImageFilterPrimary").SelectedValue : "none"; string containerBackgroundImageFilterSecondary = Model.Item.GetList("ImageFilterSecondary") != null ? Model.Item.GetList("ImageFilterSecondary").SelectedValue : "none"; string containerBackgroundImageFilterColorCode = Model.Item.GetString("ColorForTheFilter").StartsWith("#") && containerBackgroundImageFilterPrimary == "colorize" ? "style=\"background-color: " + GenerateRgba(Model.Item.GetString("ColorForTheFilter"), 0.3) + "\"" : ""; if (containerBackgroundImageFilterPrimary == "colorize" && !containerBackgroundImageFilterPrimary.StartsWith("#")) { containerBackgroundImageFilterPrimary = containerBackgroundImageFilterColor; } if (Model.Item.GetFile("BackgroundImage") == null) { backgroundColor = "u-color-light--bg"; } //Separation line bool hasSeparationLine = Model.Item.GetBoolean("SeperationLineAfter"); if (hasSeparationLine && Model.Item.GetList("Width").SelectedValue != "center") { paragraphContainerClasses += "multiple-paragraphs-container--seperation-line-after "; } else if (hasSeparationLine) { containerClasses += "multiple-paragraphs-container--seperation-line-after "; } //Alternative Design Layout var designLayout = Model.Item.GetItem("CustomSettings") != null ? Model.Item.GetItem("CustomSettings").GetString("DesignLayout") != null ? Model.Item.GetItem("CustomSettings").GetList("DesignLayout").SelectedValue : "" : ""; paragraphContainerClasses += !String.IsNullOrEmpty(designLayout) ? designLayout : ""; var paragraphHeight = Model.Item.GetList("Height").SelectedValue; //Height if (!string.IsNullOrEmpty(paragraphHeight)) { gridClasses += "paragraph-container--height-" + paragraphHeight + " " + (paragraphHeight == "screen" ? "screen-height " : ""); } if (Model.Item.GetString("MakeParagraphsCenterAligned") != null && Model.Item.GetBoolean("MakeParagraphsCenterAligned")) { gridClasses += "grid--justify-center "; } //Set as carousel if (Model.Item.GetBoolean("EnableCarousel")) { containerClasses.Replace(" paragraph-container ", ""); } //getting video ID from youtube URL string videoCode = Model.Item.GetString("VideoURL"); Regex regex = new Regex(@".be\/(.[^?]*)"); Match match = regex.Match(videoCode); string videoId = ""; if (match.Success) { videoId = match.Groups[1].Value; } else { regex = new Regex(@"v=([^&]+)"); match = regex.Match(videoCode); if (match.Success) { videoId = match.Groups[1].Value; } } } <div class="grid__col-md-12 grid__col--bleed"> <section class="multiple-paragraphs-container @paragraphContainerClasses multiple-paragraphs-container--spacing-@spacingSize dw-mod" @colorSettings> <div class="background-image image-filter image-filter--@containerBackgroundImageFilterPrimary dw-mod" @containerBackgroundImageFilterColorCode> <div class="background-image__wrapper image-filter image-filter--@containerBackgroundImageFilterSecondary dw-mod"> @if (!String.IsNullOrEmpty(Model.Item.GetString("BackgroundImage"))) { @Render(new Image { Path = Model.Item.GetFile("BackgroundImage").PathUrlEncoded + focalPointParameters, CssClass = "background-image__cover", ImageDefault = new ImageSettings { Width = 1920, Height = 845, Crop = 0, FillCanvas = true }, ImageMedium = new ImageSettings { Width = 1024, Height = 450, Crop = 0, FillCanvas = true }, ImageSmall = new ImageSettings { Width = 640, Height = 544, Crop = 0, FillCanvas = true } }) } @if (!string.IsNullOrEmpty(videoId)) { <div class="video-background"> <div class="video-background__container"> <div class="js-youtube-video" data-video="@videoId" id="ytPlayer@(Model.ID)"></div> </div> </div> } </div> </div> @if (!Model.Item.GetBoolean("EnableCarousel")) { <div class="@containerClasses dw-mod"> <div class="grid @gridClasses dw-mod"> @foreach (var paragraph in Model.Item.GetItems("Paragraph")) { @RenderParagraph(paragraph, false) } @if (!String.IsNullOrEmpty(Model.GetModuleOutput())) { <div class="paragraph-container grid__col-12 dw-mod"> @Render(new ContentModule { Content = Model.GetModuleOutput() }) </div> } </div> </div> } else { var slides = new List<List<Dynamicweb.Frontend.ItemViewModel>>(); int tempColumnsCount = 0; var paragraphs = Model.Item.GetItems("Paragraph"); bool hasAtLeastOneVisibleParagraph = false; if (paragraphs.Count > 0) { slides.Add(new List<Dynamicweb.Frontend.ItemViewModel>()); } foreach (var paragraph in paragraphs) { int columnWidth = 0; if (Pageview.Device.ToString() == "Mobile" && paragraph.GetList("WidthMobile").SelectedValue == "hide") { continue; } hasAtLeastOneVisibleParagraph = true; if (paragraph.GetList("Width").SelectedValue != "auto") { columnWidth = Pageview.Device.ToString() != "Mobile" ? Int32.Parse(paragraph.GetList("Width").SelectedValue) : Int32.Parse(paragraph.GetList("WidthMobile").SelectedValue); } else { columnWidth = 1; } if (tempColumnsCount + columnWidth > 12) { slides.Add(new List<Dynamicweb.Frontend.ItemViewModel>()); tempColumnsCount = 0; } slides[slides.Count - 1].Add(paragraph); tempColumnsCount += columnWidth; } if (hasAtLeastOneVisibleParagraph) { <div class="@containerClasses dw-mod"> <div class="carousel dw-mod" id="Paragraph_@(Model.ID)"> <div class="carousel__container js-carousel-slides dw-mod"> @foreach (var slide in slides) { <div class="carousel__slide dw-mod"> <div class="grid @gridClasses dw-mod"> @foreach (var paragraph in slide) { @RenderParagraph(paragraph, false) } </div> </div> } </div> </div> </div> } if (slides.Count > 1) { bool enableDots = Model.Item.GetBoolean("ShowDots"); <script> document.addEventListener("DOMContentLoaded", function () { new CarouselModule("#Paragraph_@(Model.ID)", { slideTime: @Model.Item.GetString("SlideTime"), dots: @(Model.Item.GetBoolean("ShowDots").ToString().ToLower()) }); }) </script> } } </section> </div>
Countries

Premium solution partner

Solution partners

Business partners